Namespaces

Types in MathNet.Numerics.LinearAlgebra

Type CreateVector

Namespace MathNet.Numerics.LinearAlgebra

Static Functions

Public Static Functions

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

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

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

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

Vector<T> Dense<T>(T[] array)

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

Vector<T> Dense<T>(int size)

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

The size of the vector.

Vector<T> Dense<T>(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> DenseOfArray<T>(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<T>(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<T>(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<T>(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> Random<T>(int length)

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

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

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

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

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

Vector<T> SameAs<T>(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<T>(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<T>(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<T, TU>(Matrix<T> example, int length)

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

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

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

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

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

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

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

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

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

Vector<T> Sparse<T>(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<T>(int size)

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

The size of the vector.

Vector<T> SparseOfArray<T>(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<T>(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<T>(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<T>(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.

Vector<T> WithStorage<T>(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.