Namespaces

Types in MathNet.Numerics

Type Generate

Namespace MathNet.Numerics

Static Functions

Public Static Functions

BigInteger[] Fibonacci(int length)

Generate a Fibonacci sequence, including zero as first value.

IEnumerable<BigInteger> FibonacciSequence()

Generate an infinite Fibonacci sequence, including zero as first value.

Double[] Impulse(int length, double amplitude, int delay)

Create a Kronecker Delta impulse sample vector.
Parameters
int length

The number of samples to generate.

double amplitude

The maximal reached peak.

int delay

Offset to the time axis. Zero or positive.

IEnumerable<double> ImpulseSequence(double amplitude, int delay)

Create a Kronecker Delta impulse sample vector.
Parameters
double amplitude

The maximal reached peak.

int delay

Offset to the time axis, hence the sample index of the impulse.

Double[] LinearRange(int start, int step, int stop)

Generate a linearly spaced sample vector within the inclusive interval (start, stop) and the provided step. The start value is aways included as first value, but stop is only included if it stop-start is a multiple of step. Equivalent to MATLAB double colon operator (::).

Double[] LinearRange(double start, double step, double stop)

Generate a linearly spaced sample vector within the inclusive interval (start, stop) and the provide step. The start value is aways included as first value, but stop is only included if it stop-start is a multiple of step. Equivalent to MATLAB double colon operator (::).

Double[] LinearRange(int start, int stop)

Generate a linearly spaced sample vector within the inclusive interval (start, stop) and step 1. Equivalent to MATLAB colon operator (:).

Int32[] LinearRangeInt32(int start, int stop)

Generate a linearly spaced sample vector within the inclusive interval (start, stop) and step 1. Equivalent to MATLAB colon operator (:).

Int32[] LinearRangeInt32(int start, int step, int stop)

Generate a linearly spaced sample vector within the inclusive interval (start, stop) and the provided step. The start value is aways included as first value, but stop is only included if it stop-start is a multiple of step. Equivalent to MATLAB double colon operator (::).

T[] LinearRangeMap<T>(double start, double step, double stop, Func<double, T> map)

Generate samples by sampling a function at linearly spaced points within the inclusive interval (start, stop) and the provide step. The start value is aways included as first value, but stop is only included if it stop-start is a multiple of step.

Double[] LinearSpaced(int length, double start, double stop)

Generate a linearly spaced sample vector of the given length between the specified values (inclusive). Equivalent to MATLAB linspace but with the length as first instead of last argument.

T[] LinearSpacedMap<T>(int length, double start, double stop, Func<double, T> map)

Generate samples by sampling a function at linearly spaced points between the specified values (inclusive).

Double[] LogSpaced(int length, double startExponent, double stopExponent)

Generate a base 10 logarithmically spaced sample vector of the given length between the specified decade exponents (inclusive). Equivalent to MATLAB logspace but with the length as first instead of last argument.

T[] LogSpacedMap<T>(int length, double startExponent, double stopExponent, Func<double, T> map)

Generate samples by sampling a function at base 10 logarithmically spaced points between the specified decade exponents (inclusive).

T[] Map<TA, T>(TA[] points, Func<TA, T> map)

Generate samples by sampling a function at the provided points.

T[] Map2<TA, TB, T>(TA[] pointsA, TB[] pointsB, Func<TA, TB, T> map)

Generate samples by sampling a function at the provided points.

IEnumerable<T> Map2Sequence<TA, TB, T>(IEnumerable<TA> pointsA, IEnumerable<TB> pointsB, Func<TA, TB, T> map)

Generate a sample sequence by sampling a function at the provided point sequence.

IEnumerable<T> MapSequence<TA, T>(IEnumerable<TA> points, Func<TA, T> map)

Generate a sample sequence by sampling a function at the provided point sequence.

Double[] Normal(int length, double mean, double standardDeviation)

Create samples with independent amplitudes of normal distribution and a flat spectral density.

IEnumerable<double> NormalSequence(double mean, double standardDeviation)

Create an infinite sample sequence with independent amplitudes of normal distribution and a flat spectral density.

Double[] Periodic(int length, double samplingRate, double frequency, double amplitude, double phase, int delay)

Create a periodic wave.
Parameters
int length

The number of samples to generate.

double samplingRate

Samples per time unit (Hz). Must be larger than twice the frequency to satisfy the Nyquist criterion.

double frequency

Frequency in periods per time unit (Hz).

double amplitude

The length of the period when sampled at one sample per time unit. This is the interval of the periodic domain, a typical value is 1.0, or 2*Pi for angular functions.

double phase

Optional phase offset.

int delay

Optional delay, relative to the phase.

Double[] PeriodicImpulse(int length, int period, double amplitude, int delay)

Create a periodic Kronecker Delta impulse sample vector.
Parameters
int length

The number of samples to generate.

int period

impulse sequence period.

double amplitude

The maximal reached peak.

int delay

Offset to the time axis. Zero or positive.

IEnumerable<double> PeriodicImpulseSequence(int period, double amplitude, int delay)

Create a Kronecker Delta impulse sample vector.
Parameters
int period

impulse sequence period.

double amplitude

The maximal reached peak.

int delay

Offset to the time axis. Zero or positive.

T[] PeriodicMap<T>(int length, Func<double, T> map, double samplingRate, double frequency, double amplitude, double phase, int delay)

Create a periodic wave.
Parameters
int length

The number of samples to generate.

Func<double, T> map

The function to apply to each of the values and evaluate the resulting sample.

double samplingRate

Samples per time unit (Hz). Must be larger than twice the frequency to satisfy the Nyquist criterion.

double frequency

Frequency in periods per time unit (Hz).

double amplitude

The length of the period when sampled at one sample per time unit. This is the interval of the periodic domain, a typical value is 1.0, or 2*Pi for angular functions.

double phase

Optional phase offset.

int delay

Optional delay, relative to the phase.

IEnumerable<T> PeriodicMapSequence<T>(Func<double, T> map, double samplingRate, double frequency, double amplitude, double phase, int delay)

Create an infinite periodic wave sequence.
Parameters
Func<double, T> map

The function to apply to each of the values and evaluate the resulting sample.

double samplingRate

Samples per time unit (Hz). Must be larger than twice the frequency to satisfy the Nyquist criterion.

double frequency

Frequency in periods per time unit (Hz).

double amplitude

The length of the period when sampled at one sample per time unit. This is the interval of the periodic domain, a typical value is 1.0, or 2*Pi for angular functions.

double phase

Optional phase offset.

int delay

Optional delay, relative to the phase.

IEnumerable<double> PeriodicSequence(double samplingRate, double frequency, double amplitude, double phase, int delay)

Create an infinite periodic wave sequence.
Parameters
double samplingRate

Samples per time unit (Hz). Must be larger than twice the frequency to satisfy the Nyquist criterion.

double frequency

Frequency in periods per time unit (Hz).

double amplitude

The length of the period when sampled at one sample per time unit. This is the interval of the periodic domain, a typical value is 1.0, or 2*Pi for angular functions.

double phase

Optional phase offset.

int delay

Optional delay, relative to the phase.

IEnumerable<double> Random(IContinuousDistribution distribution)

Create an infinite random sample sequence.

Double[] Random(int length, IContinuousDistribution distribution)

Create random samples.

Complex[] RandomComplex(int length, IContinuousDistribution distribution)

Create random samples.

IEnumerable<Complex> RandomComplex(IContinuousDistribution distribution)

Create an infinite random sample sequence.

IEnumerable<Complex32> RandomComplex32(IContinuousDistribution distribution)

Create an infinite random sample sequence.

Complex32[] RandomComplex32(int length, IContinuousDistribution distribution)

Create random samples.

T[] RandomMap<T>(int length, IContinuousDistribution distribution, Func<double, T> map)

Generate samples by sampling a function at samples from a probability distribution.

T[] RandomMap2<T>(int length, IContinuousDistribution distribution, Func<double, double, T> map)

Generate samples by sampling a function at sample pairs from a probability distribution.

IEnumerable<T> RandomMap2Sequence<T>(IContinuousDistribution distribution, Func<double, double, T> map)

Generate a sample sequence by sampling a function at sample pairs from a probability distribution.

IEnumerable<T> RandomMapSequence<T>(IContinuousDistribution distribution, Func<double, T> map)

Generate a sample sequence by sampling a function at samples from a probability distribution.

Single[] RandomSingle(int length, IContinuousDistribution distribution)

Create random samples.

IEnumerable<float> RandomSingle(IContinuousDistribution distribution)

Create an infinite random sample sequence.

T[] Repeat<T>(int length, T value)

Create an array with each field set to the same value.
Parameters
int length

The number of samples to generate.

T value

The value that each field should be set to.

IEnumerable<T> RepeatSequence<T>(T value)

Create an infinite sequence where each element has the same value.
Parameters
T value

The value that each element should be set to.

Double[] Sawtooth(int length, int period, double lowValue, double highValue, int delay)

Create a periodic sawtooth wave, starting with the lowest sample.
Parameters
int length

The number of samples to generate.

int period

Number of samples a full sawtooth period.

double lowValue

Lowest sample value.

double highValue

Highest sample value.

int delay

Optional delay.

IEnumerable<double> SawtoothSequence(int period, double lowValue, double highValue, int delay)

Create an infinite periodic sawtooth wave sequence, starting with the lowest sample.
Parameters
int period

Number of samples a full sawtooth period.

double lowValue

Lowest sample value.

double highValue

Highest sample value.

int delay

Optional delay.

Double[] Sinusoidal(int length, double samplingRate, double frequency, double amplitude, double mean, double phase, int delay)

Create a Sine wave.
Parameters
int length

The number of samples to generate.

double samplingRate

Samples per time unit (Hz). Must be larger than twice the frequency to satisfy the Nyquist criterion.

double frequency

Frequency in periods per time unit (Hz).

double amplitude

The maximal reached peak.

double mean

The mean, or DC part, of the signal.

double phase

Optional phase offset.

int delay

Optional delay, relative to the phase.

IEnumerable<double> SinusoidalSequence(double samplingRate, double frequency, double amplitude, double mean, double phase, int delay)

Create an infinite Sine wave sequence.
Parameters
double samplingRate

Samples per unit.

double frequency

Frequency in samples per unit.

double amplitude

The maximal reached peak.

double mean

The mean, or DC part, of the signal.

double phase

Optional phase offset.

int delay

Optional delay, relative to the phase.

Double[] Square(int length, int highDuration, int lowDuration, double lowValue, double highValue, int delay)

Create a periodic square wave, starting with the high phase.
Parameters
int length

The number of samples to generate.

int highDuration

Number of samples of the high phase.

int lowDuration

Number of samples of the low phase.

double lowValue

Sample value to be emitted during the low phase.

double highValue

Sample value to be emitted during the high phase.

int delay

Optional delay.

IEnumerable<double> SquareSequence(int highDuration, int lowDuration, double lowValue, double highValue, int delay)

Create an infinite periodic square wave sequence, starting with the high phase.
Parameters
int highDuration

Number of samples of the high phase.

int lowDuration

Number of samples of the low phase.

double lowValue

Sample value to be emitted during the low phase.

double highValue

Sample value to be emitted during the high phase.

int delay

Optional delay.

Double[] Standard(int length)

Create samples with independent amplitudes of standard distribution.

IEnumerable<double> StandardSequence()

Create an infinite sample sequence with independent amplitudes of standard distribution.

Double[] Step(int length, double amplitude, int delay)

Create a Heaviside Step sample vector.
Parameters
int length

The number of samples to generate.

double amplitude

The maximal reached peak.

int delay

Offset to the time axis.

IEnumerable<double> StepSequence(double amplitude, int delay)

Create an infinite Heaviside Step sample sequence.
Parameters
double amplitude

The maximal reached peak.

int delay

Offset to the time axis.

Double[] Triangle(int length, int raiseDuration, int fallDuration, double lowValue, double highValue, int delay)

Create a periodic triangle wave, starting with the raise phase from the lowest sample.
Parameters
int length

The number of samples to generate.

int raiseDuration

Number of samples of the raise phase.

int fallDuration

Number of samples of the fall phase.

double lowValue

Lowest sample value.

double highValue

Highest sample value.

int delay

Optional delay.

IEnumerable<double> TriangleSequence(int raiseDuration, int fallDuration, double lowValue, double highValue, int delay)

Create an infinite periodic triangle wave sequence, starting with the raise phase from the lowest sample.
Parameters
int raiseDuration

Number of samples of the raise phase.

int fallDuration

Number of samples of the fall phase.

double lowValue

Lowest sample value.

double highValue

Highest sample value.

int delay

Optional delay.

T[] Unfold<T, TState>(int length, Func<TState, Tuple<T, TState>> f, TState state)

Generate samples generated by the given computation.

IEnumerable<T> UnfoldSequence<T, TState>(Func<TState, Tuple<T, TState>> f, TState state)

Generate an infinite sequence generated by the given computation.

Double[] Uniform(int length)

Create random samples, uniform between 0 and 1. Faster than other methods but with reduced guarantees on randomness.

T[] UniformMap<T>(int length, Func<double, T> map)

Generate samples by sampling a function at samples from a probability distribution, uniform between 0 and 1. Faster than other methods but with reduced guarantees on randomness.

T[] UniformMap2<T>(int length, Func<double, double, T> map)

Generate samples by sampling a function at sample pairs from a probability distribution, uniform between 0 and 1. Faster than other methods but with reduced guarantees on randomness.

IEnumerable<T> UniformMap2Sequence<T>(Func<double, double, T> map)

Generate a sample sequence by sampling a function at sample pairs from a probability distribution, uniform between 0 and 1. Faster than other methods but with reduced guarantees on randomness.

IEnumerable<T> UniformMapSequence<T>(Func<double, T> map)

Generate a sample sequence by sampling a function at samples from a probability distribution, uniform between 0 and 1. Faster than other methods but with reduced guarantees on randomness.

IEnumerable<double> UniformSequence()

Create an infinite random sample sequence, uniform between 0 and 1. Faster than other methods but with reduced guarantees on randomness.