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

Definition

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
Type Parameters
T

The vector type. 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 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.

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:

+ - * /
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

Constructors

Vector<T>(Span<T>) Vector<T>(Span<T>) Vector<T>(Span<T>) Vector<T>(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.

Properties

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.

Methods

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(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.

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.

Operators

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

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

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

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

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

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

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

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

Reinterprets the bits of the specified vector into a vector of type SByte.

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

Reinterprets the bits of the specified vector into a vector of type Double.

Explicit(Vector<T> to Vector<Int32>) Explicit(Vector<T> to Vector<Int32>) Explicit(Vector<T> to Vector<Int32>) Explicit(Vector<T> to Vector<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>)

Reinterprets the bits of the specified vector into a vector of type Int16.

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

Reinterprets the bits of the specified vector into a vector of type Byte.

Explicit(Vector<T> to Vector<Int64>) Explicit(Vector<T> to Vector<Int64>) Explicit(Vector<T> to Vector<Int64>) Explicit(Vector<T> to Vector<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.

Applies to