Matrix.From Function Method
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.7.0
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.7.0
Overload List
| From | Creates a new matrix initialized using a function. |
| From | Creates a new matrix initialized using a function. |
FromFunction<T>(Int32, Int32, Func<Int32, Int32, T>, ArrayMutability)
Creates a new matrix initialized using a function.
public static DenseMatrix<T> FromFunction<T>(
int rowCount,
int columnCount,
Func<int, int, T> initializer,
ArrayMutability mutability = ArrayMutability.MutableValues
)
Parameters
- rowCount Int32
- The number of rows in the new matrix.
- columnCount Int32
- The number of columns in the new matrix.
- initializer Func<Int32, Int32, T>
- A delegate that takes a row and column index and returns the value of the corresponding element.
- mutability ArrayMutability (Optional)
- Specifies how the matrix's values may be changed. The default is mutable values.
Type Parameters
- T
- The element type of the matrix.
Return Value
DenseMatrix<T>A new DenseMatrix<T> initialized using the specified function.
Exceptions
| Argument | rowCount or columnCount is less than zero. |
| Argument | initializer is null. |
FromFunction<T>(Int32, Int32, Func<Int32, Int32, T>, ArrayMutability, Boolean)
Creates a new matrix initialized using a function.
public static DenseMatrix<T> FromFunction<T>(
int rowCount,
int columnCount,
Func<int, int, T> initializer,
ArrayMutability mutability,
bool checkMissingValues
)
Parameters
- rowCount Int32
- The number of rows in the new matrix.
- columnCount Int32
- The number of columns in the new matrix.
- initializer Func<Int32, Int32, T>
- A delegate that takes a row and column index and returns the value of the corresponding element.
- mutability ArrayMutability
- Specifies how the matrix's values may be changed. The default is mutable values.
- checkMissingValues Boolean
- Specifies whether operations involving the matrix should check for the presence of missing values.
Type Parameters
- T
- The element type of the matrix.
Return Value
DenseMatrix<T>A new DenseMatrix<T> initialized using the specified function.
Exceptions
| Argument | rowCount or columnCount is less than zero. |
| Argument | initializer is null. |