# 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 NoNo NoNo
`byte` Yes Yes NoNo NoNo
`short` Yes Yes Yes NoNo
`ushort` Yes Yes NoNo NoNo
`int` Yes Yes Yes NoNo
`uint` Yes Yes NoNo NoNo
`long` Yes Yes NoNo NoNo
`ulong` Yes Yes NoNo NoNo
`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 返回一个包含所有 1 的向量。Returns a vector containing all ones. Zero Zero Zero Zero 返回一个包含所有 0 的向量。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. 。. 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.