Class AutocovarianceFunctions
Convolutions, autocovariances and autocorrelations of a sequence, by the fast Fourier transform: the data's transform, its squared modulus, and that transformed again.
public static class AutocovarianceFunctions
- Inheritance
-
AutocovarianceFunctions
- Inherited Members
Remarks
Each function writes the lags 0 to maxLag into the first maxLag + 1 places of a caller's span. The
overloads taking reuse accept data that isn't centred: they remove its mean, return it, and write the centred
data back into the caller's span where reuse is true.
Methods
Autocorrelations(ReadOnlySpan<double>, Span<double>, int)
The unbiased autocorrelations of centred data for lags 0 to maxLag, the first place holding
the unbiased sample variance.
public static void Autocorrelations(ReadOnlySpan<double> data, Span<double> output, int maxLag)
Parameters
dataReadOnlySpan<double>The sequence, centred (of zero mean).
outputSpan<double>The variance and the autocorrelations, at least
maxLag+ 1 places.maxLagintThe last lag.
Exceptions
- ArgumentOutOfRangeException
maxLagis negative.- ArgumentException
The output is shorter than
maxLag+ 1.- NanoQLException
maxLagisn't less than the data's size.
Autocorrelations(Span<double>, Span<double>, int, bool)
The unbiased autocorrelations for lags 0 to maxLag of data that needn't be centred, the
first place holding the unbiased sample variance: the mean removed and returned.
public static double Autocorrelations(Span<double> data, Span<double> output, int maxLag, bool reuse)
Parameters
dataSpan<double>The sequence; the centred sequence is written back into it where
reuseis true.outputSpan<double>The variance and the autocorrelations, at least
maxLag+ 1 places.maxLagintThe last lag.
reuseboolWhether the centred sequence is written back into
data.
Returns
- double
The data's mean.
Exceptions
- ArgumentOutOfRangeException
maxLagis negative.- ArgumentException
The output is shorter than
maxLag+ 1.- NanoQLException
maxLagisn't less than the data's size.
Autocovariances(ReadOnlySpan<double>, Span<double>, int)
The unbiased autocovariances of centred data, for lags 0 to maxLag.
public static void Autocovariances(ReadOnlySpan<double> data, Span<double> output, int maxLag)
Parameters
dataReadOnlySpan<double>The sequence, centred (of zero mean).
outputSpan<double>The autocovariances, at least
maxLag+ 1 places.maxLagintThe last lag.
Exceptions
- ArgumentOutOfRangeException
maxLagis negative.- ArgumentException
The output is shorter than
maxLag+ 1.- NanoQLException
maxLagisn't less than the data's size.
Autocovariances(Span<double>, Span<double>, int, bool)
The unbiased autocovariances for lags 0 to maxLag of data that needn't be centred: the mean
removed and returned.
public static double Autocovariances(Span<double> data, Span<double> output, int maxLag, bool reuse)
Parameters
dataSpan<double>The sequence; the centred sequence is written back into it where
reuseis true.outputSpan<double>The autocovariances, at least
maxLag+ 1 places.maxLagintThe last lag.
reuseboolWhether the centred sequence is written back into
data.
Returns
- double
The data's mean.
Exceptions
- ArgumentOutOfRangeException
maxLagis negative.- ArgumentException
The output is shorter than
maxLag+ 1.- NanoQLException
maxLagisn't less than the data's size.
Convolutions(ReadOnlySpan<double>, Span<double>, int)
The convolutions x₀xₙ + x₁xₙ₊₁ + x₂xₙ₊₂ + … for n = 0 to maxLag.
public static void Convolutions(ReadOnlySpan<double> data, Span<double> output, int maxLag)
Parameters
dataReadOnlySpan<double>The sequence.
outputSpan<double>The convolutions, at least
maxLag+ 1 places.maxLagintThe last lag.
Exceptions
- ArgumentOutOfRangeException
maxLagis negative.- ArgumentException
The output is shorter than
maxLag+ 1.- NanoQLException
maxLagisn't less than the data's size.