TensorPrimitives.Norm Method

Definition

Overloads

Norm(ReadOnlySpan<Single>)

Computes the Euclidean norm of the specified tensor of single-precision floating-point numbers.

Norm<T>(ReadOnlySpan<T>)

Computes the Euclidean norm of the specified tensor of numbers.

Norm(ReadOnlySpan<Single>)

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

Computes the Euclidean norm of the specified tensor of single-precision floating-point numbers.

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

Parameters

x
ReadOnlySpan<Single>

The first tensor, represented as a span.

Returns

The norm.

Remarks

This method effectively computes MathF.Sqrt(TensorPrimitives.SumOfSquares(x)). This is often referred to as the Euclidean norm or L2 norm. It corresponds to the nrm2 method defined by BLAS1.

If any of the input values is equal to NaN, the result 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

Norm<T>(ReadOnlySpan<T>)

Source:
TensorPrimitives.Norm.cs
Source:
TensorPrimitives.Norm.cs

Computes the Euclidean norm of the specified tensor of numbers.

public:
generic <typename T>
 where T : System::Numerics::IRootFunctions<T> static T Norm(ReadOnlySpan<T> x);
public static T Norm<T> (ReadOnlySpan<T> x) where T : System.Numerics.IRootFunctions<T>;
static member Norm : ReadOnlySpan<'T (requires 'T :> System.Numerics.IRootFunctions<'T>)> -> 'T (requires 'T :> System.Numerics.IRootFunctions<'T>)
Public Shared Function Norm(Of T As IRootFunctions(Of T)) (x As ReadOnlySpan(Of T)) As T

Type Parameters

T

Parameters

x
ReadOnlySpan<T>

The first tensor, represented as a span.

Returns

T

The norm.

Remarks

This method effectively computes T.Sqrt(TensorPrimitives.SumOfSquares(x)). This is often referred to as the Euclidean norm or L2 norm. It corresponds to the nrm2 method defined by BLAS1.

If any of the input values is equal to NaN, the result 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