Types in MathNet.Numerics.LinearAlgebra

Type VectorBuilder<T>

Namespace MathNet.Numerics.LinearAlgebra

Generic linear algebra type builder, for situations where a matrix or vector must be created in a generic way. Usage of generic builders should not be required in normal user code.

Public Methods

Vector<T>Dense(int length, Func<int, T> init)

Create a new dense vector and initialize each value using the provided init function.

Vector<T>Dense(int length, T value)

Create a new dense vector and initialize each value using the provided value.

Vector<T>Dense(T[] array)

Create a dense vector of T that is directly bound to the specified array.

Vector<T>Dense(DenseVectorStorage<T> storage)

Create a new dense vector straight from an initialized vector storage instance. The storage is used directly without copying. Intended for advanced scenarios where you're working directly with storage for performance or interop reasons.

Vector<T>Dense(int size)

Create a dense vector of T with the given size.
Parameters
`int` size

The size of the vector.

Vector<T>DenseOfArray(T[] array)

Create a new dense vector as a copy of the given array. This new vector will be independent from the array. A new memory block will be allocated for storing the vector.

Vector<T>DenseOfEnumerable(IEnumerable<T> enumerable)

Create a new dense vector as a copy of the given enumerable. This new vector will be independent from the enumerable. A new memory block will be allocated for storing the vector.

Vector<T>DenseOfIndexed(int length, IEnumerable<Tuple<int, T>> enumerable)

Create a new dense vector as a copy of the given indexed enumerable. Keys must be provided at most once, zero is assumed if a key is omitted. This new vector will be independent from the enumerable. A new memory block will be allocated for storing the vector.

Vector<T>DenseOfVector(Vector<T> vector)

Create a new dense vector as a copy of the given other vector. This new vector will be independent from the other vector. A new memory block will be allocated for storing the vector.

Vector<T>OfStorage(VectorStorage<T> storage)

Create a new vector straight from an initialized matrix storage instance. If you have an instance of a discrete storage type instead, use their direct methods instead.

Vector<T>Random(int length)

Create a new dense vector with values sampled from the standard distribution with a system random source.

Vector<T>Random(int length, IContinuousDistribution distribution)

Create a new dense vector with values sampled from the provided random distribution.

Vector<T>Random(int length, int seed)

Create a new dense vector with values sampled from the standard distribution with a system random source.

Vector<T>SameAs(Matrix<T> matrix, Vector<T> vector, int length)

Create a new vector with a type that can represent and is closest to both provided samples.

Vector<T>SameAs(Vector<T> example, Vector<T> otherExample)

Create a new vector with a type that can represent and is closest to both provided samples and the dimensions of example.

Vector<T>SameAs(Vector<T> example, Vector<T> otherExample, int length)

Create a new vector with a type that can represent and is closest to both provided samples.

Vector<T>SameAs<TU>(Matrix<T> example, int length)

Create a new vector with the same kind of the provided example.

Vector<T>SameAs<TU>(Vector<T> example, int length)

Create a new vector with the same kind of the provided example.

Vector<T>SameAs<TU>(Vector<T> example)

Create a new vector with the same kind and dimension of the provided example.

Vector<T>Sparse(int length, T value)

Create a new sparse vector and initialize each value using the provided value.

Vector<T>Sparse(int size)

Create a sparse vector of T with the given size.
Parameters
`int` size

The size of the vector.

Vector<T>Sparse(SparseVectorStorage<T> storage)

Create a new sparse vector straight from an initialized vector storage instance. The storage is used directly without copying. Intended for advanced scenarios where you're working directly with storage for performance or interop reasons.

Vector<T>Sparse(int length, Func<int, T> init)

Create a new sparse vector and initialize each value using the provided init function.

Vector<T>SparseOfArray(T[] array)

Create a new sparse vector as a copy of the given array. This new vector will be independent from the array. A new memory block will be allocated for storing the vector.

Vector<T>SparseOfEnumerable(IEnumerable<T> enumerable)

Create a new sparse vector as a copy of the given enumerable. This new vector will be independent from the enumerable. A new memory block will be allocated for storing the vector.

Vector<T>SparseOfIndexed(int length, IEnumerable<Tuple<int, T>> enumerable)

Create a new sparse vector as a copy of the given indexed enumerable. Keys must be provided at most once, zero is assumed if a key is omitted. This new vector will be independent from the enumerable. A new memory block will be allocated for storing the vector.

Vector<T>SparseOfVector(Vector<T> vector)

Create a new sparse vector as a copy of the given other vector. This new vector will be independent from the other vector. A new memory block will be allocated for storing the vector.

Public Properties

TOne get;

Gets the value of `1.0` for type T.

TZero get;

Gets the value of `0.0` for type T.