TensorLayout.ToOffset Method

Definition

Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.0

Overload List

ToOffset(Int32) Converts a set of two integer indexes to a linear offset.
ToOffset(Int32[]) Converts a set of integer indexes to a linear offset.
ToOffset(ReadOnlySpan<Int32>) Converts a set of integer indexes to a linear offset.
ToOffset(Int32, Int32) Converts a set of two integer indexes to a linear offset.
ToOffset(Int32, Int32, Int32) Converts a set of three integer indexes to a linear offset.
ToOffset(Int32, Int32, Int32, Int32) Converts a set of four integer indexes to a linear offset.

ToOffset(Int32)

Converts a set of two integer indexes to a linear offset.
C#
public int ToOffset(
	int index1
)

Parameters

index1  Int32
The first index.

Return Value

Int32
The linear index corresponding to index1.

Remarks

This method multiplies the index by the corresponding stride without any range checks.

ToOffset(Int32[])

Converts a set of integer indexes to a linear offset.
C#
public int ToOffset(
	int[] indexes
)

Parameters

indexes  Int32[]
An array of indexes.

Return Value

Int32
The linear index corresponding to indexes.

Remarks

This method multiplies the indexes by the corresponding strides and returns the sum without any range checks.

ToOffset(ReadOnlySpan<Int32>)

Converts a set of integer indexes to a linear offset.
C#
public int ToOffset(
	ReadOnlySpan<int> indexes
)

Parameters

indexes  ReadOnlySpan<Int32>
An array of indexes.

Return Value

Int32
The linear index corresponding to indexes.

Remarks

This method multiplies the indexes by the corresponding strides and returns the sum without any range checks.

ToOffset(Int32, Int32)

Converts a set of two integer indexes to a linear offset.
C#
public int ToOffset(
	int index1,
	int index2
)

Parameters

index1  Int32
The first index.
index2  Int32
The second index.

Return Value

Int32
The linear index corresponding to index1 and index2.

Remarks

This method multiplies the indexes by the corresponding strides and returns the sum without any range checks.

ToOffset(Int32, Int32, Int32)

Converts a set of three integer indexes to a linear offset.
C#
public int ToOffset(
	int index1,
	int index2,
	int index3
)

Parameters

index1  Int32
The first index.
index2  Int32
The second index.
index3  Int32
The third index.

Return Value

Int32
The linear index corresponding to index1, index2, and index3.

Remarks

This method multiplies the indexes by the corresponding strides and returns the sum without any range checks.

ToOffset(Int32, Int32, Int32, Int32)

Converts a set of four integer indexes to a linear offset.
C#
public int ToOffset(
	int index1,
	int index2,
	int index3,
	int index4
)

Parameters

index1  Int32
The first index.
index2  Int32
The second index.
index3  Int32
The third index.
index4  Int32
The fourth index.

Return Value

Int32
The linear index corresponding to index1, index2, index2, and index4.

Remarks

This method multiplies the indexes by the corresponding strides and returns the sum without any range checks.

See Also