Vector<T> 結構

定義

表示指定數值類型的單一向量,其適用於低層級的平行演算法最佳化。

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

類型參數

T

向量中專案的型別。 T 可以是任何基本數字型別。

繼承
Vector<T>
實作

備註

Vector<T> 是不可變的結構,表示指定之數數值型別的單一向量。 實例計數是固定的 Vector<T> ,但其上限是 CPU 暫存器相依。 其用途是做為向量化大型演算法的建置組塊,因此無法直接當做任意長度向量或張量使用。

結構 Vector<T> 提供硬體加速的支援。

本文中 基本數值資料類型 一詞是指 CPU 直接支援的數值資料類型,並具有可操作這些資料類型的指示。

建構函式

Vector<T>(ReadOnlySpan<Byte>)

從指定的唯讀位元組範圍建構向量。

Vector<T>(ReadOnlySpan<T>)

從指定的 ReadOnlySpan<T> 建構向量。

Vector<T>(Span<T>)

從指定的 Span<T> 建構向量。

Vector<T>(T)

建立具有指定類型元件的向量。

Vector<T>(T[])

從指定的陣列建立向量。

Vector<T>(T[], Int32)

從指定索引位置開始的指定陣列建立向量。

屬性

AllBitsSet

取得新的 Vector<T>,並將所有位元設定為 1。

Count

傳回向量中儲存的項目數。

Indices

表示指定數值類型的單一向量,其適用於低層級的平行演算法最佳化。

IsSupported

取得值,這個值表示是否 T 受到支援。

Item[Int32]

取得位於指定索引上的項目。

One

傳回包含所有一的向量。

Zero

傳回包含所有零的向量。

方法

CopyTo(Span<Byte>)

將向量複製到指定的 Span<T>

CopyTo(Span<T>)

將向量複製到指定的範圍。 .

CopyTo(T[])

將向量執行個體複製到指定的目的陣列。

CopyTo(T[], Int32)

從指定的索引位置開始,將向量執行個體複製到目的陣列。

Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。

Equals(Vector<T>)

傳回值,這個值指出此執行個體是否與指定的向量相等。

GetHashCode()

傳回這個執行個體的雜湊碼。

ToString()

使用預設格式傳回此向量的字串表示。

ToString(String)

使用指定格式字串來格式化個別元素,以傳回此向量的字串表示。

ToString(String, IFormatProvider)

使用指定格式字串來格式化個別項目,以及使用指定的格式提供者來定義特定文化特性的格式,傳回目前此向量的字串表示。

TryCopyTo(Span<Byte>)

嘗試將向量複製到指定的位元組範圍。

TryCopyTo(Span<T>)

嘗試將向量複製到指定的 Span<T>

運算子

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

將兩個向量一起相加。

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

透過在兩個向量的每個元素上執行位元 And 運算,以傳回新的向量。

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

透過在兩個向量的每個元素上執行位元 Or 運算,以傳回新的向量。

Division(Vector<T>, T)

將向量除以純量來計算每個元素的商數。

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

將第一個向量除以第二個。

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

傳回值,指出兩個指定向量的每對元素是否相等。

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

透過在兩個向量的每個元素上執行位元 XOr 運算,以傳回新的向量。

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

將指定向量的位元轉換成 Byte 類型的向量。

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

將指定向量的位元轉換成 Double 類型的向量。

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

將指定向量的位元轉換成 Int16 類型的向量。

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

將指定向量的位元轉換成 Int32 類型的向量。

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

將指定向量的位元轉換成 Int64 類型的向量。

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

將來源向量的位重新解譯成原生大小整數的向量。

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

將指定向量的位元轉換成 SByte 類型的向量。

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

將指定向量的位元轉換成 Single 類型的向量。

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

將指定向量的位元轉換成 UInt16 類型的向量。

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

將指定向量的位元轉換成 UInt32 類型的向量。

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

將指定向量的位元轉換成 UInt64 類型的向量。

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

將來源向量的位重新解譯成原生大小不帶正負號的整數的向量。

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

傳回值,指出指定向量的任何一對元素是否相等。

LeftShift(Vector<T>, Int32)

將向量左方的每個元素移出指定的量。

Multiply(T, Vector<T>)

將向量乘以指定的純量值。

Multiply(Vector<T>, T)

將向量乘以指定的純量值。

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

傳回新的向量,其值為兩個指定向量之每對元素的乘積。

OnesComplement(Vector<T>)

傳回新向量,其元素是擷取指定向量之元素的一補數而得。

RightShift(Vector<T>, Int32)

將 (帶正負號) 指定數量向量的每個元素移位。

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

從第一個向量減去第二個向量。

UnaryNegation(Vector<T>)

否定指定向量。

UnaryPlus(Vector<T>)

傳回未變更的指定向量。

UnsignedRightShift(Vector<T>, Int32)

將 (未帶正負號) 指定數量向量的每個元素移位。

擴充方法

As<TFrom,TTo>(Vector<TFrom>)

Vector<T> 重新解譯為新的 Vector<T>

GetElement<T>(Vector<T>, Int32)

取得位在指定索引處的元素。

Store<T>(Vector<T>, T*)

將向量儲存在指定的目的地。

StoreAligned<T>(Vector<T>, T*)

將向量儲存在指定的對齊目的地。

StoreAlignedNonTemporal<T>(Vector<T>, T*)

將向量儲存在指定的對齊目的地。

StoreUnsafe<T>(Vector<T>, T)

將向量儲存在指定的目的地。

StoreUnsafe<T>(Vector<T>, T, UIntPtr)

將向量儲存在指定的目的地。

ToScalar<T>(Vector<T>)

將指定向量轉換成包含第一個項目值的純量。

WithElement<T>(Vector<T>, Int32, T)

建立新的 Vector<T>,其中指定索引處的項目設為指定值,且其餘項目設定為與指定向量中值的相同值。

AsVector128<T>(Vector<T>)

Vector<T> 重新解譯為新的 Vector128<T>

AsVector256<T>(Vector<T>)

Vector<T> 重新解譯為新的 Vector256<T>

AsVector512<T>(Vector<T>)

Vector<T> 重新解譯為新的 Vector512<T>

適用於