Share via


TensorPrimitives.ProductOfDifferences Method

Definition

Overloads

ProductOfDifferences(ReadOnlySpan<Single>, ReadOnlySpan<Single>)

Computes the product of the element-wise differences of the single-precision floating-point numbers in the specified non-empty tensors.

ProductOfDifferences<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Computes the product of the element-wise differences of the numbers in the specified non-empty tensors.

ProductOfDifferences(ReadOnlySpan<Single>, ReadOnlySpan<Single>)

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

Computes the product of the element-wise differences of the single-precision floating-point numbers in the specified non-empty tensors.

public:
 static float ProductOfDifferences(ReadOnlySpan<float> x, ReadOnlySpan<float> y);
public static float ProductOfDifferences (ReadOnlySpan<float> x, ReadOnlySpan<float> y);
static member ProductOfDifferences : ReadOnlySpan<single> * ReadOnlySpan<single> -> single
Public Shared Function ProductOfDifferences (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 result of multiplying the element-wise subtraction of the elements in the second tensor from the first tensor.

Exceptions

x and y must have the same length.

Remarks

This method effectively computes: Span<float> differences = ...; TensorPrimitives.Subtract(x, y, differences); float result = TensorPrimitives.Product(differences); but without requiring additional temporary storage for the intermediate differences.

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

ProductOfDifferences<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Source:
TensorPrimitives.Product.cs
Source:
TensorPrimitives.Product.cs

Computes the product of the element-wise differences of the numbers in the specified non-empty tensors.

public:
generic <typename T>
 where T : System::Numerics::ISubtractionOperators<T, T, T>, System::Numerics::IMultiplyOperators<T, T, T>, System::Numerics::IMultiplicativeIdentity<T, T> static T ProductOfDifferences(ReadOnlySpan<T> x, ReadOnlySpan<T> y);
public static T ProductOfDifferences<T> (ReadOnlySpan<T> x, ReadOnlySpan<T> y) where T : System.Numerics.ISubtractionOperators<T,T,T>, System.Numerics.IMultiplyOperators<T,T,T>, System.Numerics.IMultiplicativeIdentity<T,T>;
static member ProductOfDifferences : ReadOnlySpan<'T (requires 'T :> System.Numerics.ISubtractionOperators<'T, 'T, 'T> and 'T :> System.Numerics.IMultiplyOperators<'T, 'T, 'T> and 'T :> System.Numerics.IMultiplicativeIdentity<'T, 'T>)> * ReadOnlySpan<'T (requires 'T :> System.Numerics.ISubtractionOperators<'T, 'T, 'T> and 'T :> System.Numerics.IMultiplyOperators<'T, 'T, 'T> and 'T :> System.Numerics.IMultiplicativeIdentity<'T, 'T>)> -> 'T (requires 'T :> System.Numerics.ISubtractionOperators<'T, 'T, 'T> and 'T :> System.Numerics.IMultiplyOperators<'T, 'T, 'T> and 'T :> System.Numerics.IMultiplicativeIdentity<'T, 'T>)
Public Shared Function ProductOfDifferences(Of T As {ISubtractionOperators(Of T, 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 result of multiplying the element-wise subtraction of the elements in the second tensor from the first tensor.

Exceptions

x and y must have the same length.

Remarks

This method effectively computes: Span<T> differences = ...; TensorPrimitives.Subtract(x, y, differences); T result = TensorPrimitives.Product(differences); but without requiring additional temporary storage for the intermediate differences.

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