Table of Contents

Method Create

Namespace
Zyl.VectorTraits
Assembly
VectorTraits.dll

Create<T>(T)

Creates a new Vector<T> instance with all elements initialized to the specified value (创建新的 Vector<T> 实例,其中所有元素已初始化为指定值).

public static Vector<T> Create<T>(T value) where T : struct

Parameters

value T

The value that all elements will be initialized to (所有元素的初始化目标值).

Returns

Vector<T>

A new Vector<T> with all elements initialized to value (一个新的 Vector<T>,其中所有元素已初始化为 value ).

Type Parameters

T

The vector element type (向量中的元素的类型).

See Also

Create<T>(T[])

Creates a new Vector<T> from a given array (从给定数组创建一个新的 Vector<T> ).

public static Vector<T> Create<T>(T[] values) where T : struct

Parameters

values T[]

The array from which the vector is created (用于创建向量的数组).

Returns

Vector<T>

A new Vector<T> with its elements set to the first Count elements from values (一个新Vector<T>,其元素设置为来自values首批满足长度的元素).

Type Parameters

T

The vector element type (向量中的元素的类型).

See Also
Vector(T[])

Create<T>(T[], int)

Creates a new Vector<T> from a given array starting at a specified index position (于指定索引位置开始,从指定数组创建一个 Vector<T>).

public static Vector<T> Create<T>(T[] values, int index) where T : struct

Parameters

values T[]

The array from which the vector is created (用于创建向量的数组).

index int

The starting index position from which to create the vector (欲创建向量的起始索引位置).

Returns

Vector<T>

A new Vector<T> with its elements set to the first Count elements from values (一个新Vector<T>,其元素设置为来自values首批满足长度的元素).

Type Parameters

T

The vector element type (向量中的元素的类型).

Exceptions

IndexOutOfRangeException

The index is less than zero (index 小于零). The length of values, starting from index, is less than Count (从 index 开始的 values 的长度小于 Count).

See Also
Vector(T[], int)

Create<T>(ReadOnlySpan<byte>)

Creates a new Vector<T> from a given read-only span of bytes (根据给定的只读字节跨度构造一个 Vector<T>).

public static Vector<T> Create<T>(ReadOnlySpan<byte> values) where T : struct

Parameters

values ReadOnlySpan<byte>

A read-only span of bytes that contains the values to add to the vector (从中创建向量的只读字节跨度).

Returns

Vector<T>

A new Vector<T> with its elements set to the first Count elements from values (一个新Vector<T>,其元素设置为来自values首批满足长度的元素).

Type Parameters

T

The vector element type (向量中的元素的类型).

Exceptions

IndexOutOfRangeException

values did not contain at least Count elements (values 的长度小于 Count).

See Also

Create<T>(ReadOnlySpan<T>)

Creates a new Vector<T> from a from the given ReadOnlySpan<T> (根据给定的 ReadOnlySpan<T> 构造一个 Vector<T>).

public static Vector<T> Create<T>(ReadOnlySpan<T> values) where T : struct

Parameters

values ReadOnlySpan<T>

The readonly span from which the vector is created (从中创建向量的只读跨度).

Returns

Vector<T>

A new Vector<T> with its elements set to the first Count elements from values (一个新Vector<T>,其元素设置为来自values首批满足长度的元素).

Type Parameters

T

The vector element type (向量中的元素的类型).

Exceptions

IndexOutOfRangeException

values did not contain at least Count elements (values 的长度小于 Count).

See Also

Create<T>(Span<T>)

Creates a new Vector<T> from a from the given Span<T> (根据给定的 Span<T> 构造一个 Vector<T>).

public static Vector<T> Create<T>(Span<T> values) where T : struct

Parameters

values Span<T>

The span from which the vector is created (从中创建向量的跨度).

Returns

Vector<T>

A new Vector<T> with its elements set to the first Count elements from values (一个新Vector<T>,其元素设置为来自values首批满足长度的元素).

Type Parameters

T

The vector element type (向量中的元素的类型).

Exceptions

IndexOutOfRangeException

values did not contain at least Count elements (values 的长度小于 Count).

See Also

Create(ExInt128)

Creates a new vector instance of element type ExInt128 with all elements initialized to the specified value (创建新的元素类型为ExInt128的向量实例,其中所有元素已初始化为指定值).

public static Vector<ExInt128> Create(ExInt128 value)

Parameters

value ExInt128

The value that all elements will be initialized to (所有元素的初始化值).

Returns

Vector<ExInt128>

A new Vector<T> with all elements initialized to value (一个新向量,它的所有元素都初始化为 value).

Create(ExUInt128)

Creates a new vector instance of element type ExUInt128 with all elements initialized to the specified value (创建新的元素类型为ExUInt128的向量实例,其中所有元素已初始化为指定值).

[CLSCompliant(false)]
public static Vector<ExUInt128> Create(ExUInt128 value)

Parameters

value ExUInt128

The value that all elements will be initialized to (所有元素的初始化值).

Returns

Vector<ExUInt128>

A new Vector<T> with all elements initialized to value (一个新向量,它的所有元素都初始化为 value).

Create(Int128)

Creates a new vector instance of element type Int128 with all elements initialized to the specified value (创建新的元素类型为Int128的向量实例,其中所有元素已初始化为指定值).

public static Vector<Int128> Create(Int128 value)

Parameters

value Int128

The value that all elements will be initialized to (所有元素的初始化值).

Returns

Vector<Int128>

A new Vector<T> with all elements initialized to value (一个新向量,它的所有元素都初始化为 value).

Create(UInt128)

Creates a new vector instance of element type UInt128 with all elements initialized to the specified value (创建新的元素类型为UInt128的向量实例,其中所有元素已初始化为指定值).

[CLSCompliant(false)]
public static Vector<UInt128> Create(UInt128 value)

Parameters

value UInt128

The value that all elements will be initialized to (所有元素的初始化值).

Returns

Vector<UInt128>

A new Vector<T> with all elements initialized to value (一个新向量,它的所有元素都初始化为 value).