Vector.Wrap Method

Definition

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

Overload List

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

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
)

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.

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)

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
)

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.

Type Parameters

T

Return Value

DenseVector<T>
A DenseVector<T>.

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

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
)

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.

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>(ArraySlice<T>, Int32, ArrayMutability)

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

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.

Type Parameters

T

Return Value

DenseVector<T>
A DenseVector<T>.

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,
	bool checkMissingValues
)

Parameters

source  T[]
The source data.
mutability  ArrayMutability
Specifies how the resulting object's values may be changed.
checkMissingValues  Boolean
Specifies whether operations involving the vector should check for the presence of missing values.

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,
	bool checkMissingValues
)

Parameters

source  Memory<T>
The source data.
mutability  ArrayMutability
Specifies how the resulting object's values may be changed.
checkMissingValues  Boolean
Specifies whether operations involving the vector should check for the presence of missing values.

Type Parameters

T

Return Value

DenseVector<T>
A DenseVector<T>.

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

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
)

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.

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)

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

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.

Type Parameters

T

Return Value

DenseVector<T>
A DenseVector<T>.

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

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
)

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.

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>(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
)

Parameters

source  ArraySlice<T>
The source data.
length  Int32
The number of elements.
mutability  ArrayMutability
Specifies how the resulting object's values may be changed.
checkMissingValues  Boolean
Specifies whether operations involving the vector should check for the presence of missing values.

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,
	bool checkMissingValues
)

Parameters

source  T[]
The source data.
length  Int32
The number of elements.
mutability  ArrayMutability
Specifies how the resulting object's values may be changed.
checkMissingValues  Boolean
Specifies whether operations involving the vector should check for the presence of missing values.

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,
	bool checkMissingValues
)

Parameters

source  Memory<T>
The source data.
length  Int32
The number of elements.
mutability  ArrayMutability
Specifies how the resulting object's values may be changed.
checkMissingValues  Boolean
Specifies whether operations involving the vector should check for the presence of missing values.

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)

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
)

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.

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
)

Parameters

values  MemorySlice<T>
The storage containing the vector values.
length  Int32
The number of elements.
mutability  ArrayMutability
Specifies how the resulting object's values may be changed.
checkMissingValues  Boolean
Specifies whether operations involving the vector should check for the presence of missing values.

Type Parameters

T

Return Value

DenseVector<T>
A DenseVector<T>.

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

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
)

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.

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, 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,
	bool checkMissingValues
)

Parameters

source  T[]
The source data.
startIndex  Int32
The zero-based index of the first element.
length  Int32
The number of elements.
mutability  ArrayMutability
Specifies how the resulting object's values may be changed.
checkMissingValues  Boolean
Specifies whether operations involving the vector should check for the presence of missing values.

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,
	bool checkMissingValues
)

Parameters

source  Memory<T>
The source data.
startIndex  Int32
The zero-based index of the first element.
length  Int32
The number of elements.
mutability  ArrayMutability
Specifies how the resulting object's values may be changed.
checkMissingValues  Boolean
Specifies whether operations involving the vector should check for the presence of missing values.

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)

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
)

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.

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,
	bool checkMissingValues
)

Parameters

source  T[]
The source data.
startIndex  Int32
The zero-based index of the first element.
length  Int32
The number of elements.
stride  Int32
The stride between consecutive elements.
mutability  ArrayMutability
Specifies how the resulting object's values may be changed.
checkMissingValues  Boolean
Specifies whether operations involving the vector should check for the presence of missing values.

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,
	ArrayMutability mutability,
	bool checkMissingValues
)

Parameters

source  Memory<T>
The source data.
startIndex  Int32
The zero-based index of the first element.
length  Int32
The number of elements.
stride  Int32
The stride between consecutive elements.
mutability  ArrayMutability
Specifies how the resulting object's values may be changed.
checkMissingValues  Boolean
Specifies whether operations involving the vector should check for the presence of missing values.

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