Tensor.CreateRange Method

Definition

Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.0
Creates a tensor with a specified shape and order.

Overload List

CreateRange<T>(T, ArrayMutability) Constructs a new tensor with elements from 0 up to the specified value.
CreateRange<T>(T, T, ArrayMutability) Constructs a new 1D tensor with elements from the specified range..
CreateRange<T>(T, T, T, ArrayMutability) Constructs a new tensor with elements from the specified range..
CreateRange<T>(T, T, Int32, Boolean, ArrayMutability) Constructs a new tensor with elements from the specified range.

CreateRange<T>(T, ArrayMutability)

Constructs a new tensor with elements from 0 up to the specified value.
C#
public static Tensor<T> CreateRange<T>(
	T stop,
	ArrayMutability mutability = ArrayMutability.MutableValues
)

Parameters

stop  T
The upper bound for the range.
mutability  ArrayMutability  (Optional)
Optional. Specifies how the tensor's values may be changed. The default is mutable values.

Type Parameters

T
The type of the elements of the tensor.

Return Value

Tensor<T>
A DenseTensor.

CreateRange<T>(T, T, ArrayMutability)

Constructs a new 1D tensor with elements from the specified range..
C#
public static Tensor<T> CreateRange<T>(
	T start,
	T stop,
	ArrayMutability mutability = ArrayMutability.MutableValues
)

Parameters

start  T
The first value in the range.
stop  T
The (inclusive) upper bound for the range.
mutability  ArrayMutability  (Optional)
Optional. Specifies how the tensor's values may be changed. The default is mutable values.

Type Parameters

T
The type of the elements of the tensor.

Return Value

Tensor<T>
A DenseTensor.

CreateRange<T>(T, T, T, ArrayMutability)

Constructs a new tensor with elements from the specified range..
C#
public static Tensor<T> CreateRange<T>(
	T start,
	T stop,
	T step,
	ArrayMutability mutability = ArrayMutability.MutableValues
)

Parameters

start  T
The first value in the range.
stop  T
The (inclusive) upper bound for the range.
step  T
The distance between successive values in the range.
mutability  ArrayMutability  (Optional)
Optional. Specifies how the tensor's values may be changed. The default is mutable values.

Type Parameters

T
The type of the elements of the tensor.

Return Value

Tensor<T>
A DenseTensor.

Exceptions

InvalidOperationExceptionstep is so small that the length of the number of steps is too large.

CreateRange<T>(T, T, Int32, Boolean, ArrayMutability)

Constructs a new tensor with elements from the specified range.
C#
public static Tensor<T> CreateRange<T>(
	T start,
	T stop,
	int steps,
	bool endPoint,
	ArrayMutability mutability = ArrayMutability.MutableValues
)

Parameters

start  T
The first value in the range.
stop  T
The upper bound for the range.
steps  Int32
The number of values.
endPoint  Boolean
Indicates whether stop is included in the range.
mutability  ArrayMutability  (Optional)
Optional. Specifies how the tensor's values may be changed. The default is mutable values.

Type Parameters

T
The type of the elements of the tensor.

Return Value

Tensor<T>
A DenseTensor.

Exceptions

ArgumentOutOfRangeExceptionsteps is less than zero.

See Also