Share via


TensorPrimitives.Dot Method

Definition

Overloads

Dot(ReadOnlySpan<Single>, ReadOnlySpan<Single>)

Computes the dot product of two tensors containing single-precision floating-point numbers.

Dot<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Computes the dot product of two tensors containing numbers.

Dot(ReadOnlySpan<Single>, ReadOnlySpan<Single>)

Source:
TensorPrimitives.cs
Source:
TensorPrimitives.Single.cs
Source:
TensorPrimitives.Single.cs

Computes the dot product of two tensors containing single-precision floating-point numbers.

public:
 static float Dot(ReadOnlySpan<float> x, ReadOnlySpan<float> y);
public static float Dot (ReadOnlySpan<float> x, ReadOnlySpan<float> y);
static member Dot : ReadOnlySpan<single> * ReadOnlySpan<single> -> single
Public Shared Function Dot (x As ReadOnlySpan(Of Single), y As ReadOnlySpan(Of Single)) As Single

Parameters

x
ReadOnlySpan<Single>

The first tensor, represented as a span.

y
ReadOnlySpan<Single>

The second tensor, represented as a span.

Returns

The dot product.

Exceptions

Length of x must be same as length of y.

Remarks

This method effectively computes the equivalent of: Span<float> products = ...; TensorPrimitives.Multiply(x, y, products); float result = TensorPrimitives.Sum(products); but without requiring additional temporary storage for the intermediate products. It corresponds to the dot method defined by BLAS1.

If any of the input elements is equal to NaN, the resulting value is also NaN.

This method may call into the underlying C runtime or employ instructions specific to the current architecture. Exact results may differ between different operating systems or architectures.

Applies to

Dot<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Source:
TensorPrimitives.Dot.cs
Source:
TensorPrimitives.Dot.cs

Computes the dot product of two tensors containing numbers.

public:
generic <typename T>
 where T : System::Numerics::IAdditionOperators<T, T, T>, System::Numerics::IAdditiveIdentity<T, T>, System::Numerics::IMultiplyOperators<T, T, T>, System::Numerics::IMultiplicativeIdentity<T, T> static T Dot(ReadOnlySpan<T> x, ReadOnlySpan<T> y);
public static T Dot<T> (ReadOnlySpan<T> x, ReadOnlySpan<T> y) where T : System.Numerics.IAdditionOperators<T,T,T>, System.Numerics.IAdditiveIdentity<T,T>, System.Numerics.IMultiplyOperators<T,T,T>, System.Numerics.IMultiplicativeIdentity<T,T>;
static member Dot : ReadOnlySpan<'T (requires 'T :> System.Numerics.IAdditionOperators<'T, 'T, 'T> and 'T :> System.Numerics.IAdditiveIdentity<'T, 'T> and 'T :> System.Numerics.IMultiplyOperators<'T, 'T, 'T> and 'T :> System.Numerics.IMultiplicativeIdentity<'T, 'T>)> * ReadOnlySpan<'T (requires 'T :> System.Numerics.IAdditionOperators<'T, 'T, 'T> and 'T :> System.Numerics.IAdditiveIdentity<'T, 'T> and 'T :> System.Numerics.IMultiplyOperators<'T, 'T, 'T> and 'T :> System.Numerics.IMultiplicativeIdentity<'T, 'T>)> -> 'T (requires 'T :> System.Numerics.IAdditionOperators<'T, 'T, 'T> and 'T :> System.Numerics.IAdditiveIdentity<'T, 'T> and 'T :> System.Numerics.IMultiplyOperators<'T, 'T, 'T> and 'T :> System.Numerics.IMultiplicativeIdentity<'T, 'T>)
Public Shared Function Dot(Of T As {IAdditionOperators(Of T, T, T), IAdditiveIdentity(Of T, T), IMultiplyOperators(Of T, T, T), IMultiplicativeIdentity(Of T, T)}) (x As ReadOnlySpan(Of T), y As ReadOnlySpan(Of T)) As T

Type Parameters

T

Parameters

x
ReadOnlySpan<T>

The first tensor, represented as a span.

y
ReadOnlySpan<T>

The second tensor, represented as a span.

Returns

T

The dot product.

Exceptions

Length of x must be same as length of y.

Remarks

This method effectively computes the equivalent of: Span<T> products = ...; TensorPrimitives.Multiply(x, y, products); T result = TensorPrimitives.Sum(products); but without requiring additional temporary storage for the intermediate products. It corresponds to the dot method defined by BLAS1.

If any of the input elements is equal to NaN, the resulting value is also NaN.

This method may call into the underlying C runtime or employ instructions specific to the current architecture. Exact results may differ between different operating systems or architectures.

Applies to