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

## 定義

``````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

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

## 備註

Vector<T> 是不可變的結構，代表指定之數數值型別的單一向量。Vector<T> is an immutable structure that represents a single vector of a specified numeric type. @No__t-0 實例的計數是固定的，但其上限與 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.

@No__t-0 結構提供硬體加速支援。The Vector<T> structure provides support for hardware acceleration.

`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

## 屬性

 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) CopyTo(Span) CopyTo(Span) CopyTo(Span) 將向量複製到指定的 Span。Copies the vector to the given Span. CopyTo(Span) CopyTo(Span) CopyTo(Span) CopyTo(Span) 將向量複製到指定的範圍。Copies the vector to the given span. 執行個體時提供 SQL Server 登入。. 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) Equals(Vector) Equals(Vector) Equals(Vector) 傳回值，這個值指出此執行個體是否與指定的向量相等。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) TryCopyTo(Span) TryCopyTo(Span) TryCopyTo(Span) 嘗試將向量複製到指定的位元組範圍。Attempts to copy the vector to the given byte span. TryCopyTo(Span) TryCopyTo(Span) TryCopyTo(Span) TryCopyTo(Span) 嘗試將向量複製到指定的 Span。Attempts to copy the vector to the given Span.

## 運算子

 Addition(Vector, Vector) Addition(Vector, Vector) Addition(Vector, Vector) Addition(Vector, Vector) 將兩個向量一起相加。Adds two vectors together. BitwiseAnd(Vector, Vector) BitwiseAnd(Vector, Vector) BitwiseAnd(Vector, Vector) BitwiseAnd(Vector, Vector) 透過在兩個向量的每個元素上執行位元 `And` 運算，以傳回新的向量。Returns a new vector by performing a bitwise `And` operation on each of the elements in two vectors. BitwiseOr(Vector, Vector) BitwiseOr(Vector, Vector) BitwiseOr(Vector, Vector) BitwiseOr(Vector, Vector) 透過在兩個向量的每個元素上執行位元 `Or` 運算，以傳回新的向量。Returns a new vector by performing a bitwise `Or` operation on each of the elements in two vectors. Division(Vector, Vector) Division(Vector, Vector) Division(Vector, Vector) Division(Vector, Vector) 將第一個向量除以第二個。Divides the first vector by the second. Equality(Vector, Vector) Equality(Vector, Vector) Equality(Vector, Vector) Equality(Vector, Vector) 傳回值，指出兩個指定向量的每對元素是否相等。Returns a value that indicates whether each pair of elements in two specified vectors are equal. ExclusiveOr(Vector, Vector) ExclusiveOr(Vector, Vector) ExclusiveOr(Vector, Vector) ExclusiveOr(Vector, Vector) 透過在兩個向量的每個元素上執行位元 `XOr` 運算，以傳回新的向量。Returns a new vector by performing a bitwise `XOr` operation on each of the elements in two vectors. Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) 將指定向量的位元轉換成 UInt64 類型的向量。Reinterprets the bits of the specified vector into a vector of type UInt64. Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) 將指定向量的位元轉換成 UInt32 類型的向量。Reinterprets the bits of the specified vector into a vector of type UInt32. Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) 將指定向量的位元轉換成 UInt16 類型的向量。Reinterprets the bits of the specified vector into a vector of type UInt16. Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) 將指定向量的位元轉換成 Single 類型的向量。Reinterprets the bits of the specified vector into a vector of type Single. Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) 將指定向量的位元轉換成 SByte 類型的向量。Reinterprets the bits of the specified vector into a vector of type SByte. Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) 將指定向量的位元轉換成 Byte 類型的向量。Reinterprets the bits of the specified vector into a vector of type Byte. Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) 將指定向量的位元轉換成 Int32 類型的向量。Reinterprets the bits of the specified vector into a vector of type Int32. Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) 將指定向量的位元轉換成 Int16 類型的向量。Reinterprets the bits of the specified vector into a vector of type Int16. Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) 將指定向量的位元轉換成 Double 類型的向量。Reinterprets the bits of the specified vector into a vector of type Double. Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) Explicit(Vector to Vector) 將指定向量的位元轉換成 Int64 類型的向量。Reinterprets the bits of the specified vector into a vector of type Int64. Inequality(Vector, Vector) Inequality(Vector, Vector) Inequality(Vector, Vector) Inequality(Vector, Vector) 傳回值，指出指定向量的任何一對元素是否相等。Returns a value that indicates whether any single pair of elements in the specified vectors is equal. Multiply(Vector, Vector) Multiply(Vector, Vector) Multiply(Vector, Vector) Multiply(Vector, Vector) 傳回新的向量，其值為兩個指定向量之每對元素的乘積。Returns a new vector whose values are the product of each pair of elements in two specified vectors. Multiply(Vector, T) Multiply(Vector, T) Multiply(Vector, T) Multiply(Vector, T) 將向量乘以指定的純量值。Multiplies a vector by a specified scalar value. Multiply(T, Vector) Multiply(T, Vector) Multiply(T, Vector) Multiply(T, Vector) 將向量乘以指定的純量值。Multiplies a vector by a specified scalar value. OnesComplement(Vector) OnesComplement(Vector) OnesComplement(Vector) OnesComplement(Vector) 傳回新向量，其元素是擷取指定向量之元素的一補數而得。Returns a new vector whose elements are obtained by taking the one's complement of a specified vector's elements. Subtraction(Vector, Vector) Subtraction(Vector, Vector) Subtraction(Vector, Vector) Subtraction(Vector, Vector) 從第一個向量減去第二個向量。Subtracts the second vector from the first. UnaryNegation(Vector) UnaryNegation(Vector) UnaryNegation(Vector) UnaryNegation(Vector) 否定指定向量。Negates a given vector.