Vector.CreateFromArray Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4

Overload List

CreateFromArray<T>(T[], Boolean, ArrayMutability, Boolean) Constructs a new dense vector with the specified elements.
CreateFromArray<T>(Int32, T[], ArrayMutability, Boolean) Constructs a new dense vector.
CreateFromArray<T>(Int32, ArraySlice<T>, ArrayMutability, Boolean) Constructs a new dense vector.
CreateFromArray<T>(Int32, T[], Boolean, ArrayMutability, Boolean) Constructs a new dense vector with the specified elements.
CreateFromArray<T>(Int32, T[], Int32, Int32, ArrayMutability, Boolean) Constructs a new dense vector.

CreateFromArray<T>(T[], Boolean, ArrayMutability, Boolean)

Constructs a new dense vector with the specified elements.
C#
public static DenseVector<T> CreateFromArray<T>(
	T[] values,
	bool createView,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

values  T[]
An array that contains the elements of the new DenseVector<T>.
createView  Boolean
If true, the array referenced by values is used directly. Any changes to the elements of this DenseVector<T> will also affect the original array.If false, the elements are copied from values to a new array.
mutability  ArrayMutability  (Optional)
Specifies how the vector's values may be changed. The default is mutable values.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the vector should check for the presence of missing values. The default is false.

Type Parameters

T

Return Value

DenseVector<T>
A DenseVector<T>.

Remarks

The length of the new vector is equal to the length of values.

Exceptions

ArgumentNullException

values is null.

CreateFromArray<T>(Int32, T[], ArrayMutability, Boolean)

Constructs a new dense vector.
C#
public static DenseVector<T> CreateFromArray<T>(
	int length,
	T[] values,
	ArrayMutability mutability,
	bool checkMissingValues = false
)

Parameters

length  Int32
The length of the vector.
values  T[]
A strided structure containing the elements.
mutability  ArrayMutability
Specifies how the vector's values may be changed.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the vector should check for the presence of missing values. The default is false.

Type Parameters

T

Return Value

DenseVector<T>
A DenseVector<T>.

CreateFromArray<T>(Int32, ArraySlice<T>, ArrayMutability, Boolean)

Constructs a new dense vector.
C#
public static DenseVector<T> CreateFromArray<T>(
	int length,
	ArraySlice<T> values,
	ArrayMutability mutability,
	bool checkMissingValues = false
)

Parameters

length  Int32
The length of the vector.
values  ArraySlice<T>
A strided structure containing the elements.
mutability  ArrayMutability
Specifies how the vector's values may be changed.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the vector should check for the presence of missing values. The default is false.

Type Parameters

T

Return Value

DenseVector<T>
A DenseVector<T>.

CreateFromArray<T>(Int32, T[], Boolean, ArrayMutability, Boolean)

Constructs a new dense vector with the specified elements.
C#
public static DenseVector<T> CreateFromArray<T>(
	int length,
	T[] values,
	bool reuseValuesArray,
	ArrayMutability mutability,
	bool checkMissingValues = false
)

Parameters

length  Int32
The number of elements in the new vector.
values  T[]
An array that contains the elements of the new DenseVector<T>.
reuseValuesArray  Boolean
If true, the array referenced by values is used directly. Any changes to the elements of this DenseVector<T> will also affect the original array. If false, the elements are copied from values to a new array.
mutability  ArrayMutability
Specifies how the vector's values may be changed. The default is mutable values.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the vector should check for the presence of missing values. The default is false.

Type Parameters

T

Return Value

DenseVector<T>
A DenseVector<T>.

Exceptions

ArgumentNullException

values is null.

ArgumentOutOfRangeException

length is less than zero.

-or-

The length of values is less than length.

CreateFromArray<T>(Int32, T[], Int32, Int32, ArrayMutability, Boolean)

Constructs a new dense vector.
C#
public static DenseVector<T> CreateFromArray<T>(
	int length,
	T[] values,
	int offset,
	int stride,
	ArrayMutability mutability,
	bool checkMissingValues = false
)

Parameters

length  Int32
The length of the vector.
values  T[]
A array that contains the elements.
offset  Int32
The offset of the first element of the vector in values.
stride  Int32
The stride between successive elements of the vector.
mutability  ArrayMutability
Specifies how the vector's values may be changed.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the vector should check for the presence of missing values. The default is false.

Type Parameters

T

Return Value

DenseVector<T>
A DenseVector<T>.

Exceptions

ArgumentNullException

values is null.

ArgumentOutOfRangeException

length is less than zero.

-or-

The length of values is less than length.

See Also