Tensor<T>.SetValue Method

Definition

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

Overload List

SetValue(T, Tensor<Boolean>) Sets all elements of the tensor to the specified value.
SetValue(T, Index) Sets the value at the specified index in a 1D tensor.
SetValue(T, Index[]) Sets the element at the specified position to the specified value.
SetValue(T, Int32) Sets the value at the specified index in a 1D tensor.
SetValue(T, Int32[]) Sets the element at the specified position to the specified value.
SetValue(T, ReadOnlySpan<Index>) Sets the element at the specified position to the specified value.
SetValue(T, ReadOnlySpan<Int32>) Sets the element at the specified position to the specified value.
SetValue(T, Index, Index) Sets the value at the specified position in a 2D tensor.
SetValue(T, Int32, Int32) Sets the value at the specified position in a 2D tensor.
SetValue(T, Index, Index, Index) Sets the value at the specified position in a 3D tensor.
SetValue(T, Int32, Int32, Int32) Sets the value at the specified position in a 3D tensor.
SetValue(T, Index, Index, Index, Index) Sets the value at the specified position in a 4D tensor.
SetValue(T, Int32, Int32, Int32, Int32) Sets the value at the specified position in a 4D tensor.

SetValue(T, Tensor<Boolean>)

Sets all elements of the tensor to the specified value.
C#
public Tensor<T> SetValue(
	T value,
	Tensor<bool>? mask = null
)

Parameters

value  T
The new value for the elements of the tensor.
mask  Tensor<Boolean>  (Optional)
Optional. A boolean tensor that specifies whether the value at the location should be set to value. If omitted, all elements of the tensor are set.

Return Value

Tensor<T>
This tensor with the selected elements replaced with value.

SetValue(T, Index)

Sets the value at the specified index in a 1D tensor.
C#
public virtual void SetValue(
	T value,
	Index index
)

Parameters

value  T
The new value for the element.
index  Index
The position of the element.

SetValue(T, Index[])

Sets the element at the specified position to the specified value.
C#
public void SetValue(
	T value,
	params Index[] indexes
)

Parameters

value  T
The new value of the element.
indexes  Index[]
The zero-based index of the element.

Return Value

The element in the indexesth position.

Remarks

This method does not perform bounds checking. It is provided for optimized access in situations where the argument is known to be within bounds. If the argument is outside its valid range, the result may be unpredictable.

SetValue(T, Int32)

Sets the value at the specified index in a 1D tensor.
C#
public virtual void SetValue(
	T value,
	int index
)

Parameters

value  T
The new value for the element.
index  Int32
The position of the element.

SetValue(T, Int32[])

Sets the element at the specified position to the specified value.
C#
public void SetValue(
	T value,
	params int[] indexes
)

Parameters

value  T
The new value of the element.
indexes  Int32[]
The zero-based index of the element.

Return Value

The element in the indexesth position.

Remarks

This method does not perform bounds checking. It is provided for optimized access in situations where the argument is known to be within bounds. If the argument is outside its valid range, the result may be unpredictable.

SetValue(T, ReadOnlySpan<Index>)

Sets the element at the specified position to the specified value.
C#
public virtual void SetValue(
	T value,
	ReadOnlySpan<Index> indexes
)

Parameters

value  T
The new value of the element.
indexes  ReadOnlySpan<Index>
The zero-based index of the element.

Return Value

The element in the indexesth position.

Remarks

This method does not perform bounds checking. It is provided for optimized access in situations where the argument is known to be within bounds. If the argument is outside its valid range, the result may be unpredictable.

SetValue(T, ReadOnlySpan<Int32>)

Sets the element at the specified position to the specified value.
C#
public abstract void SetValue(
	T value,
	ReadOnlySpan<int> indexes
)

Parameters

value  T
The new value of the element.
indexes  ReadOnlySpan<Int32>
The zero-based index of the element.

Return Value

The element in the indexesth position.

Remarks

This method does not perform bounds checking. It is provided for optimized access in situations where the argument is known to be within bounds. If the argument is outside its valid range, the result may be unpredictable.

SetValue(T, Index, Index)

Sets the value at the specified position in a 2D tensor.
C#
public virtual void SetValue(
	T value,
	Index index1,
	Index index2
)

Parameters

value  T
The new value for the element.
index1  Index
The position of the element in the first dimension.
index2  Index
The position of the element in the second dimension.

SetValue(T, Int32, Int32)

Sets the value at the specified position in a 2D tensor.
C#
public virtual void SetValue(
	T value,
	int index1,
	int index2
)

Parameters

value  T
The new value for the element.
index1  Int32
The position of the element in the first dimension.
index2  Int32
The position of the element in the second dimension.

SetValue(T, Index, Index, Index)

Sets the value at the specified position in a 3D tensor.
C#
public virtual void SetValue(
	T value,
	Index index1,
	Index index2,
	Index index3
)

Parameters

value  T
The new value for the element.
index1  Index
The position of the element in the first dimension.
index2  Index
The position of the element in the second dimension.
index3  Index
The position of the element in the second dimension.

SetValue(T, Int32, Int32, Int32)

Sets the value at the specified position in a 3D tensor.
C#
public virtual void SetValue(
	T value,
	int index1,
	int index2,
	int index3
)

Parameters

value  T
The new value for the element.
index1  Int32
The position of the element in the first dimension.
index2  Int32
The position of the element in the second dimension.
index3  Int32
The position of the element in the second dimension.

SetValue(T, Index, Index, Index, Index)

Sets the value at the specified position in a 4D tensor.
C#
public virtual void SetValue(
	T value,
	Index index1,
	Index index2,
	Index index3,
	Index index4
)

Parameters

value  T
The new value for the element.
index1  Index
The position of the element in the first dimension.
index2  Index
The position of the element in the second dimension.
index3  Index
The position of the element in the second dimension.
index4  Index
The position of the element in the second dimension.

SetValue(T, Int32, Int32, Int32, Int32)

Sets the value at the specified position in a 4D tensor.
C#
public virtual void SetValue(
	T value,
	int index1,
	int index2,
	int index3,
	int index4
)

Parameters

value  T
The new value for the element.
index1  Int32
The position of the element in the first dimension.
index2  Int32
The position of the element in the second dimension.
index3  Int32
The position of the element in the second dimension.
index4  Int32
The position of the element in the second dimension.

See Also