AngouriMath
With(System.Func{System.Int32,System.Int32,AngouriMath.Entity,AngouriMath.Entity})
Method (no overloads)
Summary
Returns a new matrix/vector of the same shape,
but with each element replaced by the user.
but with each element replaced by the user.
Parameter "elementByIndex"
Takes 2 ints which are row number and column
number of an element, and the current element
as the third argument.
number of an element, and the current element
as the third argument.
Example
var re = O_4.With
((rowId, colId, element) => (rowId, colId, element) switch
{
(0, 1, _) => 1,
(1, 2, _) => 2,
(>1, 3, _) => 6,
(var a, var b, _) when a + b < 3 => 8,
_ => element
});
Console.WriteLine(re.ToString(multilineFormat: true));
The output is going to be:
Matrix[4 x 4]
8 1 8 0
8 8 2 0
8 0 0 6
0 0 0 6
Returns
A new matrix or vector with the same shape
(row count and column count).
(row count and column count).
Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1534 pages online