Vector<T> Vector<T> Vector<T> Vector<T> Struct

定義

表示指定數值類型的單一向量,其適用於低層級的平行演算法最佳化。Represents a single vector of a specified numeric type that is suitable for low-level optimization of parallel algorithms.

generic <typename T>
 where T : value classpublic value class Vector : IEquatable<System::Numerics::Vector<T>>, IFormattable
public struct Vector<T> : IEquatable<System.Numerics.Vector<T>>, IFormattable where T : struct
type Vector<'T (requires 'T : struct)> = struct
    interface IFormattable
Public Structure Vector(Of T)
Implements IEquatable(Of Vector(Of T)), IFormattable

類型參數

T

向量類型。The vector type. T可以是任何基本數數值型別。T can be any primitive numeric type.

繼承
實作

備註

Vector<T>這是一個不可變的結構, 代表指定之數數值型別的單一向量。Vector<T> is an immutable structure that represents a single vector of a specified numeric type. Vector<T>實例的計數是固定的, 但其上限與 CPU 暫存器相依。The count of a Vector<T> instance is fixed, but its upper limit is CPU-register dependent. 其目的是用來做為向量化大型演算法的建立區塊。It is intended to be used as a building block for vectorizing large algorithms.

Vector<T>結構可支援硬體加速。The Vector<T> structure provides support for hardware acceleration.

下表顯示哪些基本數值資料類型和作業組合使用內建指示來加快執行速度:The following table shows which primitive numeric data type and operation combination uses intrinsic instructions for faster executions:

基本型別Primitive type + - * /
sbyte Yes Yes No No
byte Yes Yes No No
short Yes [是]Yes Yes No
ushort Yes Yes No No
int Yes [是]Yes Yes No
uint Yes Yes No No
long Yes Yes No No
ulong Yes Yes No No
float Yes [是]Yes [是]Yes [是]Yes
double [是]Yes [是]Yes [是]Yes Yes

建構函式

Vector<T>(ReadOnlySpan<Byte>) Vector<T>(ReadOnlySpan<Byte>) Vector<T>(ReadOnlySpan<Byte>) Vector<T>(ReadOnlySpan<Byte>)

從指定的唯讀位元組範圍建構向量。Constructs a vector from the given read-only span of bytes.

Vector<T>(ReadOnlySpan<T>) Vector<T>(ReadOnlySpan<T>) Vector<T>(ReadOnlySpan<T>) Vector<T>(ReadOnlySpan<T>)

從指定的 ReadOnlySpan<T> 建構向量。Constructs a vector from the given ReadOnlySpan<T>.

Vector<T>(Span<T>) Vector<T>(Span<T>) Vector<T>(Span<T>) Vector<T>(Span<T>)

從指定的 Span<T> 建構向量。Constructs a vector from the given Span<T>.

Vector<T>(T) Vector<T>(T) Vector<T>(T) Vector<T>(T)

建立具有指定類型元件的向量。Creates a vector whose components are of a specified type.

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

從指定的陣列建立向量。Creates a vector from a specified array.

Vector<T>(T[], Int32) Vector<T>(T[], Int32) Vector<T>(T[], Int32) Vector<T>(T[], Int32)

從指定索引位置開始的指定陣列建立向量。Creates a vector from a specified array starting at a specified index position.

屬性

Count Count Count Count

傳回向量中儲存的項目數。Returns the number of elements stored in the vector.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

取得位於指定索引上的項目。Gets the element at a specified index.

One One One One

傳回包含所有一的向量。Returns a vector containing all ones.

Zero Zero Zero Zero

傳回包含所有零的向量。Returns a vector containing all zeroes.

方法

CopyTo(Span<Byte>) CopyTo(Span<Byte>) CopyTo(Span<Byte>) CopyTo(Span<Byte>)

將向量複製到指定的 Span<T>Copies the vector to the given Span<T>.

CopyTo(Span<T>) CopyTo(Span<T>) CopyTo(Span<T>) CopyTo(Span<T>)

將向量複製到指定的範圍。Copies the vector to the given span. .

CopyTo(T[]) CopyTo(T[]) CopyTo(T[]) CopyTo(T[])

將向量執行個體複製到指定的目的陣列。Copies the vector instance to a specified destination array.

CopyTo(T[], Int32) CopyTo(T[], Int32) CopyTo(T[], Int32) CopyTo(T[], Int32)

從指定的索引位置開始,將向量執行個體複製到目的陣列。Copies the vector instance to a specified destination array starting at a specified index position.

Equals(Vector<T>) Equals(Vector<T>) Equals(Vector<T>) Equals(Vector<T>)

傳回值,這個值指出此執行個體是否與指定的向量相等。Returns a value that indicates whether this instance is equal to a specified vector.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。Returns a value that indicates whether this instance is equal to a specified object.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

傳回這個執行個體的雜湊碼。Returns the hash code for this instance.

ToString() ToString() ToString() ToString()

使用預設格式傳回此向量的字串表示。Returns the string representation of this vector using default formatting.

ToString(String) ToString(String) ToString(String) ToString(String)

使用指定格式字串來格式化個別元素,以傳回此向量的字串表示。Returns the string representation of this vector using the specified format string to format individual elements.

ToString(String, IFormatProvider) ToString(String, IFormatProvider) ToString(String, IFormatProvider) ToString(String, IFormatProvider)

使用指定格式字串來格式化個別項目,以及使用指定的格式提供者來定義特定文化特性的格式,傳回目前此向量的字串表示。Returns the string representation of this vector using the specified format string to format individual elements and the specified format provider to define culture-specific formatting.

TryCopyTo(Span<Byte>) TryCopyTo(Span<Byte>) TryCopyTo(Span<Byte>) TryCopyTo(Span<Byte>)

嘗試將向量複製到指定的位元組範圍。Attempts to copy the vector to the given byte span.

TryCopyTo(Span<T>) TryCopyTo(Span<T>) TryCopyTo(Span<T>) TryCopyTo(Span<T>)

嘗試將向量複製到指定的 Span<T>Attempts to copy the vector to the given Span<T>.

運算子

Addition(Vector<T>, Vector<T>) Addition(Vector<T>, Vector<T>) Addition(Vector<T>, Vector<T>) Addition(Vector<T>, Vector<T>)

將兩個向量一起相加。Adds two vectors together.

BitwiseAnd(Vector<T>, Vector<T>) BitwiseAnd(Vector<T>, Vector<T>) BitwiseAnd(Vector<T>, Vector<T>) BitwiseAnd(Vector<T>, Vector<T>)

透過在兩個向量的每個元素上執行位元 And 運算,以傳回新的向量。Returns a new vector by performing a bitwise And operation on each of the elements in two vectors.

BitwiseOr(Vector<T>, Vector<T>) BitwiseOr(Vector<T>, Vector<T>) BitwiseOr(Vector<T>, Vector<T>) BitwiseOr(Vector<T>, Vector<T>)

透過在兩個向量的每個元素上執行位元 Or 運算,以傳回新的向量。Returns a new vector by performing a bitwise Or operation on each of the elements in two vectors.

Division(Vector<T>, Vector<T>) Division(Vector<T>, Vector<T>) Division(Vector<T>, Vector<T>) Division(Vector<T>, Vector<T>)

將第一個向量除以第二個。Divides the first vector by the second.

Equality(Vector<T>, Vector<T>) Equality(Vector<T>, Vector<T>) Equality(Vector<T>, Vector<T>) Equality(Vector<T>, Vector<T>)

傳回值,指出兩個指定向量的每對元素是否相等。Returns a value that indicates whether each pair of elements in two specified vectors are equal.

ExclusiveOr(Vector<T>, Vector<T>) ExclusiveOr(Vector<T>, Vector<T>) ExclusiveOr(Vector<T>, Vector<T>) ExclusiveOr(Vector<T>, Vector<T>)

透過在兩個向量的每個元素上執行位元 XOr 運算,以傳回新的向量。Returns a new vector by performing a bitwise XOr operation on each of the elements in two vectors.

Explicit(Vector<T> to Vector<UInt64>) Explicit(Vector<T> to Vector<UInt64>) Explicit(Vector<T> to Vector<UInt64>) Explicit(Vector<T> to Vector<UInt64>)

將指定向量的位元轉換成 UInt64 類型的向量。Reinterprets the bits of the specified vector into a vector of type UInt64.

Explicit(Vector<T> to Vector<UInt32>) Explicit(Vector<T> to Vector<UInt32>) Explicit(Vector<T> to Vector<UInt32>) Explicit(Vector<T> to Vector<UInt32>)

將指定向量的位元轉換成 UInt32 類型的向量。Reinterprets the bits of the specified vector into a vector of type UInt32.

Explicit(Vector<T> to Vector<UInt16>) Explicit(Vector<T> to Vector<UInt16>) Explicit(Vector<T> to Vector<UInt16>) Explicit(Vector<T> to Vector<UInt16>)

將指定向量的位元轉換成 UInt16 類型的向量。Reinterprets the bits of the specified vector into a vector of type UInt16.

Explicit(Vector<T> to Vector<Single>) Explicit(Vector<T> to Vector<Single>) Explicit(Vector<T> to Vector<Single>) Explicit(Vector<T> to Vector<Single>)

將指定向量的位元轉換成 Single 類型的向量。Reinterprets the bits of the specified vector into a vector of type Single.

Explicit(Vector<T> to Vector<SByte>) Explicit(Vector<T> to Vector<SByte>) Explicit(Vector<T> to Vector<SByte>) Explicit(Vector<T> to Vector<SByte>)

將指定向量的位元轉換成 SByte 類型的向量。Reinterprets the bits of the specified vector into a vector of type SByte.

Explicit(Vector<T> to Vector<Byte>) Explicit(Vector<T> to Vector<Byte>) Explicit(Vector<T> to Vector<Byte>) Explicit(Vector<T> to Vector<Byte>)

將指定向量的位元轉換成 Byte 類型的向量。Reinterprets the bits of the specified vector into a vector of type Byte.

Explicit(Vector<T> to Vector<Int32>) Explicit(Vector<T> to Vector<Int32>) Explicit(Vector<T> to Vector<Int32>) Explicit(Vector<T> to Vector<Int32>)

將指定向量的位元轉換成 Int32 類型的向量。Reinterprets the bits of the specified vector into a vector of type Int32.

Explicit(Vector<T> to Vector<Int16>) Explicit(Vector<T> to Vector<Int16>) Explicit(Vector<T> to Vector<Int16>) Explicit(Vector<T> to Vector<Int16>)

將指定向量的位元轉換成 Int16 類型的向量。Reinterprets the bits of the specified vector into a vector of type Int16.

Explicit(Vector<T> to Vector<Double>) Explicit(Vector<T> to Vector<Double>) Explicit(Vector<T> to Vector<Double>) Explicit(Vector<T> to Vector<Double>)

將指定向量的位元轉換成 Double 類型的向量。Reinterprets the bits of the specified vector into a vector of type Double.

Explicit(Vector<T> to Vector<Int64>) Explicit(Vector<T> to Vector<Int64>) Explicit(Vector<T> to Vector<Int64>) Explicit(Vector<T> to Vector<Int64>)

將指定向量的位元轉換成 Int64 類型的向量。Reinterprets the bits of the specified vector into a vector of type Int64.

Inequality(Vector<T>, Vector<T>) Inequality(Vector<T>, Vector<T>) Inequality(Vector<T>, Vector<T>) Inequality(Vector<T>, Vector<T>)

傳回值,指出指定向量的任何一對元素是否相等。Returns a value that indicates whether any single pair of elements in the specified vectors is equal.

Multiply(Vector<T>, Vector<T>) Multiply(Vector<T>, Vector<T>) Multiply(Vector<T>, Vector<T>) Multiply(Vector<T>, Vector<T>)

傳回新的向量,其值為兩個指定向量之每對元素的乘積。Returns a new vector whose values are the product of each pair of elements in two specified vectors.

Multiply(Vector<T>, T) Multiply(Vector<T>, T) Multiply(Vector<T>, T) Multiply(Vector<T>, T)

將向量乘以指定的純量值。Multiplies a vector by a specified scalar value.

Multiply(T, Vector<T>) Multiply(T, Vector<T>) Multiply(T, Vector<T>) Multiply(T, Vector<T>)

將向量乘以指定的純量值。Multiplies a vector by a specified scalar value.

OnesComplement(Vector<T>) OnesComplement(Vector<T>) OnesComplement(Vector<T>) OnesComplement(Vector<T>)

傳回新向量,其元素是擷取指定向量之元素的一補數而得。Returns a new vector whose elements are obtained by taking the one's complement of a specified vector's elements.

Subtraction(Vector<T>, Vector<T>) Subtraction(Vector<T>, Vector<T>) Subtraction(Vector<T>, Vector<T>) Subtraction(Vector<T>, Vector<T>)

從第一個向量減去第二個向量。Subtracts the second vector from the first.

UnaryNegation(Vector<T>) UnaryNegation(Vector<T>) UnaryNegation(Vector<T>) UnaryNegation(Vector<T>)

否定指定向量。Negates a given vector.

適用於