Vector<T> Struct
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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
Type Parameters
- T
The type of the elements in the vector. T
can be any primitive numeric type.
- Inheritance
- Implements
Remarks
Vector<T> is an immutable structure that represents a single vector of a specified numeric type. The count of Vector<T> instances is fixed, but its upper limit is CPU-register dependent. It's intended to be used as a building block for vectorizing large algorithms, and therefore cannot be used directly as an arbitrary length vector or tensor.
The Vector<T> structure provides support for hardware acceleration.
The term primitive numeric data type in this article refers to numeric data types that are directly supported by the CPU and have instructions that can manipulate those data types.
Constructors
Vector<T>(ReadOnlySpan<Byte>) |
Constructs a vector from the given read-only span of bytes. |
Vector<T>(ReadOnlySpan<T>) |
Constructs a vector from the given ReadOnlySpan<T>. |
Vector<T>(Span<T>) |
Constructs a vector from the given Span<T>. |
Vector<T>(T) |
Creates a vector whose components are of a specified type. |
Vector<T>(T[]) |
Creates a vector from a specified array. |
Vector<T>(T[], Int32) |
Creates a vector from a specified array starting at a specified index position. |
Properties
AllBitsSet |
Gets a new Vector<T> with all bits set to 1. |
Count |
Returns the number of elements stored in the vector. |
Indices |
Gets a new Vector<T> with the elements set to their index. |
IsSupported |
Gets a value that indicates whether |
Item[Int32] |
Gets the element at a specified index. |
One |
Returns a vector containing all ones. |
Zero |
Returns a vector containing all zeroes. |
Methods
CopyTo(Span<Byte>) |
Copies the vector to the given Span<T>. |
CopyTo(Span<T>) |
Copies the vector to the given span. . |
CopyTo(T[]) |
Copies the vector instance to a specified destination array. |
CopyTo(T[], Int32) |
Copies the vector instance to a specified destination array starting at a specified index position. |
Equals(Object) |
Returns a value that indicates whether this instance is equal to a specified object. |
Equals(Vector<T>) |
Returns a value that indicates whether this instance is equal to a specified vector. |
GetHashCode() |
Returns the hash code for this instance. |
ToString() |
Returns the string representation of this vector using default formatting. |
ToString(String) |
Returns the string representation of this vector using the specified format string to format individual elements. |
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>) |
Attempts to copy the vector to the given byte span. |
TryCopyTo(Span<T>) |
Attempts to copy the vector to the given Span<T>. |
Operators
Addition(Vector<T>, Vector<T>) |
Adds two vectors together. |
BitwiseAnd(Vector<T>, Vector<T>) |
Returns a new vector by performing a bitwise |
BitwiseOr(Vector<T>, Vector<T>) |
Returns a new vector by performing a bitwise |
Division(Vector<T>, T) |
Divides a vector by a scalar to compute the per-element quotient. |
Division(Vector<T>, Vector<T>) |
Divides the first vector by the second. |
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>) |
Returns a new vector by performing a bitwise |
Explicit(Vector<T> to Vector<Byte>) |
Reinterprets the bits of the specified vector into a vector of type Byte. |
Explicit(Vector<T> to Vector<Double>) |
Reinterprets the bits of the specified vector into a vector of type Double. |
Explicit(Vector<T> to Vector<Int16>) |
Reinterprets the bits of the specified vector into a vector of type Int16. |
Explicit(Vector<T> to Vector<Int32>) |
Reinterprets the bits of the specified vector into a vector of type Int32. |
Explicit(Vector<T> to Vector<Int64>) |
Reinterprets the bits of the specified vector into a vector of type Int64. |
Explicit(Vector<T> to Vector<IntPtr>) |
Reinterprets the bits of a source vector into a vector of native-sized integers. |
Explicit(Vector<T> to Vector<SByte>) |
Reinterprets the bits of the specified vector into a vector of type SByte. |
Explicit(Vector<T> to Vector<Single>) |
Reinterprets the bits of the specified vector into a vector of type Single. |
Explicit(Vector<T> to Vector<UInt16>) |
Reinterprets the bits of the specified vector into a vector of type UInt16. |
Explicit(Vector<T> to Vector<UInt32>) |
Reinterprets the bits of the specified vector into a vector of type UInt32. |
Explicit(Vector<T> to Vector<UInt64>) |
Reinterprets the bits of the specified vector into a vector of type UInt64. |
Explicit(Vector<T> to Vector<UIntPtr>) |
Reinterprets the bits of a source vector into a vector of native-sized, unsigned integers. |
Inequality(Vector<T>, Vector<T>) |
Returns a value that indicates whether any single pair of elements in the specified vectors is equal. |
LeftShift(Vector<T>, Int32) |
Shifts each element of a vector left by the specified amount. |
Multiply(T, Vector<T>) |
Multiplies a vector by a specified scalar value. |
Multiply(Vector<T>, T) |
Multiplies a vector by a specified scalar value. |
Multiply(Vector<T>, Vector<T>) |
Returns a new vector whose values are the product of each pair of elements in two specified vectors. |
OnesComplement(Vector<T>) |
Returns a new vector whose elements are obtained by taking the one's complement of a specified vector's elements. |
RightShift(Vector<T>, Int32) |
Shifts (signed) each element of a vector right by the specified amount. |
Subtraction(Vector<T>, Vector<T>) |
Subtracts the second vector from the first. |
UnaryNegation(Vector<T>) |
Negates a given vector. |
UnaryPlus(Vector<T>) |
Returns a given vector unchanged. |
UnsignedRightShift(Vector<T>, Int32) |
Shifts (unsigned) each element of a vector right by the specified amount. |
Extension Methods
As<TFrom,TTo>(Vector<TFrom>) | |
GetElement<T>(Vector<T>, Int32) |
Gets the element at the specified index. |
Store<T>(Vector<T>, T*) |
Stores a vector at the given destination. |
StoreAligned<T>(Vector<T>, T*) |
Stores a vector at the given aligned destination. |
StoreAlignedNonTemporal<T>(Vector<T>, T*) |
Stores a vector at the given aligned destination. |
StoreUnsafe<T>(Vector<T>, T) |
Stores a vector at the given destination. |
StoreUnsafe<T>(Vector<T>, T, UIntPtr) |
Stores a vector at the given destination. |
ToScalar<T>(Vector<T>) |
Converts the given vector to a scalar containing the value of the first element. |
WithElement<T>(Vector<T>, Int32, T) |
Creates a new Vector<T> with the element at the specified index set to the specified value and the remaining elements set to the same value as that in the given vector. |
AsVector128<T>(Vector<T>) |
Reinterprets a Vector<T> as a new Vector128<T>. |
AsVector256<T>(Vector<T>) |
Reinterprets a Vector<T> as a new Vector256<T>. |
AsVector512<T>(Vector<T>) |
Reinterprets a Vector<T> as a new Vector512<T>. |
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om