TensorPrimitives.Cos<T>(ReadOnlySpan<T>, Span<T>) Method

Definition

Computes the element-wise cosine of the value in the specified tensor.

public static void Cos<T> (ReadOnlySpan<T> x, Span<T> destination) where T : System.Numerics.ITrigonometricFunctions<T>;

Type Parameters

T

Parameters

x
ReadOnlySpan<T>

The tensor, represented as a span.

destination
Span<T>

The destination tensor, represented as a span.

Exceptions

x and destination reference overlapping memory locations and do not begin at the same location.

Remarks

This method effectively computes destination[i] = T.Cos(x[i]).

The angles in x must be in radians. Use DegreesToRadians(Single) or multiply by T.Pi/180 to convert degrees to radians.

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

Product Versions
.NET 8 (package-provided), 9 (package-provided)