Matrix<T>.SetValue Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.8.0

Overload List

SetValue(T) Sets all elements of the matrix to the specified value.
SetValue(T, Int32, Int32) Sets the matrix element at the specified position to the specified value.
Obsolete
SetValue<R, C>(T, R, C) Sets the value at the specified row and column key value.

SetValue(T)

Sets all elements of the matrix to the specified value.
C#
public virtual Matrix<T> SetValue(
	T value
)

Parameters

value  T
The new value.

Return Value

Matrix<T>
This matrix.

Exceptions

ComponentReadOnlyException One or more elements cannot be written.

SetValue(T, Int32, Int32)

Note: This API is now obsolete.
Sets the matrix element at the specified position to the specified value.
C#
[ObsoleteAttribute("Use SetValueUnchecked instead. Derived matrix types should override UnsafeSetValue.", 
	false)]
public abstract void SetValue(
	T value,
	int row,
	int column
)

Parameters

value  T
The new value of the element.
row  Int32
The zero-based row index of the element to get or set.
column  Int32
The zero-based column index of the element to get or set.

Remarks

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

This virtual member remains a compatibility extension point for existing derived matrix types. New derived types should override UnsafeSetValue(T, Int32, Int32).

Exceptions

ComponentReadOnlyException The selected element cannot be written.

SetValue<R, C>(T, R, C)

Sets the value at the specified row and column key value.
C#
public void SetValue<R, C>(
	T value,
	R rowKey,
	C columnKey
)

Parameters

value  T
The value to assign.
rowKey  R
The row key.
columnKey  C
The column key.

Type Parameters

R
The element type of the row index.
C
The element type of the column index.

Exceptions

InvalidOperationException

The vector is not indexed.

InvalidCastException

The type R does not match the element type of the row index.

-or-

The type C does not match the element type of the column index.

See Also