Vector.Wrap Method

Definition

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

Overload List

Wrap<T>(T[], ArrayMutability, Boolean) Constructs a new dense vector by wrapping an existing array without copying.
Wrap<T>(Memory<T>, ArrayMutability, Boolean) Constructs a new dense vector by wrapping a memory block without copying.
Wrap<T>(ArraySlice<T>, Int32, ArrayMutability, Boolean) Constructs a new dense vector.
Wrap<T>(T[], Int32, ArrayMutability, Boolean) Constructs a new dense vector by wrapping a portion of an existing array without copying.
Wrap<T>(Memory<T>, Int32, ArrayMutability, Boolean) Constructs a new dense vector by wrapping a portion of a memory block without copying.
Wrap<T>(MemorySlice<T>, Int32, ArrayMutability, Boolean) Constructs a new dense vector.
Wrap<T>(T[], Int32, Int32, ArrayMutability, Boolean) Constructs a new dense vector by wrapping a portion of an existing array without copying.
Wrap<T>(Memory<T>, Int32, Int32, ArrayMutability, Boolean) Constructs a new dense vector by wrapping a portion of a memory block without copying.
Wrap<T>(T[], Int32, Int32, Int32, ArrayMutability, Boolean) Constructs a new dense vector by wrapping a portion of an existing array without copying.
Wrap<T>(Memory<T>, Int32, Int32, Int32, ArrayMutability, Boolean) Constructs a new dense vector by wrapping a portion of a memory block without copying.

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

Constructs a new dense vector by wrapping an existing array without copying.
C#
public static DenseVector<T> Wrap<T>(
	T[] source,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  T[]
An array that contains the elements of the new DenseVector<T>.
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 array referenced by source is used directly. Any changes to the elements of this DenseVector<T> will also affect the original array.

Exceptions

ArgumentNullException

source is null.

Wrap<T>(Memory<T>, ArrayMutability, Boolean)

Constructs a new dense vector by wrapping a memory block without copying.
C#
public static DenseVector<T> Wrap<T>(
	Memory<T> source,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  Memory<T>
A memory block that contains the elements of the new DenseVector<T>.
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>.

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

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

Parameters

source  ArraySlice<T>
A strided structure containing the elements.
length  Int32
The length 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>.

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

Constructs a new dense vector by wrapping a portion of an existing array without copying.
C#
public static DenseVector<T> Wrap<T>(
	T[] source,
	int length,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  T[]
An array that contains the elements.
length  Int32
The length of the vector.
mutability  ArrayMutability  (Optional)
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

source is null.

ArgumentOutOfRangeException

length is less than zero.

-or-

The length of source is less than required for the specified parameters.

Wrap<T>(Memory<T>, Int32, ArrayMutability, Boolean)

Constructs a new dense vector by wrapping a portion of a memory block without copying.
C#
public static DenseVector<T> Wrap<T>(
	Memory<T> source,
	int length,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  Memory<T>
A memory block that contains the elements.
length  Int32
The length of the vector.
mutability  ArrayMutability  (Optional)
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

source is null.

ArgumentOutOfRangeException

length is less than zero.

-or-

The length of source is less than required for the specified parameters.

Wrap<T>(MemorySlice<T>, Int32, ArrayMutability, Boolean)

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

Parameters

values  MemorySlice<T>
A strided structure containing the elements.
length  Int32
The length 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>.

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

Constructs a new dense vector by wrapping a portion of an existing array without copying.
C#
public static DenseVector<T> Wrap<T>(
	T[] source,
	int startIndex,
	int length,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  T[]
An array that contains the elements.
startIndex  Int32
The offset of the first element of the vector in source.
length  Int32
The length of the vector.
mutability  ArrayMutability  (Optional)
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

source is null.

ArgumentOutOfRangeException

length is less than zero.

-or-

The length of source is less than required for the specified parameters.

Wrap<T>(Memory<T>, Int32, Int32, ArrayMutability, Boolean)

Constructs a new dense vector by wrapping a portion of a memory block without copying.
C#
public static DenseVector<T> Wrap<T>(
	Memory<T> source,
	int startIndex,
	int length,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  Memory<T>
A memory block that contains the elements.
startIndex  Int32
The offset of the first element of the vector in source.
length  Int32
The length of the vector.
mutability  ArrayMutability  (Optional)
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

source is null.

ArgumentOutOfRangeException

length is less than zero.

-or-

The length of source is less than required for the specified parameters.

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

Constructs a new dense vector by wrapping a portion of an existing array without copying.
C#
public static DenseVector<T> Wrap<T>(
	T[] source,
	int startIndex,
	int length,
	int stride,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  T[]
An array that contains the elements.
startIndex  Int32
The offset of the first element of the vector in source.
length  Int32
The length of the vector.
stride  Int32
The stride between successive elements of the vector.
mutability  ArrayMutability  (Optional)
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

source is null.

ArgumentOutOfRangeException

length is less than zero.

-or-

The length of source is less than required for the specified parameters.

Wrap<T>(Memory<T>, Int32, Int32, Int32, ArrayMutability, Boolean)

Constructs a new dense vector by wrapping a portion of a memory block without copying.
C#
public static DenseVector<T> Wrap<T>(
	Memory<T> source,
	int startIndex,
	int length,
	int stride = 1,
	ArrayMutability mutability = ArrayMutability.MutableValues,
	bool checkMissingValues = false
)

Parameters

source  Memory<T>
A memory block that contains the elements.
startIndex  Int32
The offset of the first element of the vector in source.
length  Int32
The length of the vector.
stride  Int32  (Optional)
The stride between successive elements of the vector.
mutability  ArrayMutability  (Optional)
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

source is null.

ArgumentOutOfRangeException

length is less than zero.

-or-

The length of source is less than required for the specified parameters.

See Also