Udostępnij za pośrednictwem


TensorPrimitives.PopCount Method

Definition

Overloads

PopCount<T>(ReadOnlySpan<T>, Span<T>)

Computes the element-wise population count of numbers in the specified tensor.

PopCount<T>(ReadOnlySpan<T>)

Computes the population count of all elements in the specified tensor.

PopCount<T>(ReadOnlySpan<T>, Span<T>)

Source:
TensorPrimitives.PopCount.cs
Source:
TensorPrimitives.PopCount.cs

Computes the element-wise population count of numbers in the specified tensor.

public:
generic <typename T>
 where T : System::Numerics::IBinaryInteger<T> static void PopCount(ReadOnlySpan<T> x, Span<T> destination);
public static void PopCount<T> (ReadOnlySpan<T> x, Span<T> destination) where T : System.Numerics.IBinaryInteger<T>;
static member PopCount : ReadOnlySpan<'T (requires 'T :> System.Numerics.IBinaryInteger<'T>)> * Span<'T (requires 'T :> System.Numerics.IBinaryInteger<'T>)> -> unit (requires 'T :> System.Numerics.IBinaryInteger<'T>)
Public Shared Sub PopCount(Of T As IBinaryInteger(Of T)) (x As ReadOnlySpan(Of T), destination As Span(Of 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.PopCount(x[i]).

Applies to

PopCount<T>(ReadOnlySpan<T>)

Source:
TensorPrimitives.PopCount.cs
Source:
TensorPrimitives.PopCount.cs

Computes the population count of all elements in the specified tensor.

public:
generic <typename T>
 where T : System::Numerics::IBinaryInteger<T> static long PopCount(ReadOnlySpan<T> x);
public static long PopCount<T> (ReadOnlySpan<T> x) where T : System.Numerics.IBinaryInteger<T>;
static member PopCount : ReadOnlySpan<'T (requires 'T :> System.Numerics.IBinaryInteger<'T>)> -> int64 (requires 'T :> System.Numerics.IBinaryInteger<'T>)
Public Shared Function PopCount(Of T As IBinaryInteger(Of T)) (x As ReadOnlySpan(Of T)) As Long

Type Parameters

T

Parameters

x
ReadOnlySpan<T>

The tensor, represented as a span.

Returns

The sum of the number of bits set in each element in x.

Applies to