Simplify matrix calculation for .NET application.
- .NET 6
- Simple enumeration of elements
- Enumeration of elements as reference
- Minimal heap memory allocation
- Create submatrix without creating new matrix*
Calculate determinant of a matrix.
using FluentMatrix;
Matrix m1 = new MatrixBuilder(2,2) {
{3, 7},
{1, -4}
};
double determinant = m1.Determinant();
Console.WriteLine(determinant); // -19Enumeration of elements in matrix.
foreach(var item in m1) {
item.Value = item.Value * 2;
}
m1.Print();
// 6 14
// 2 -8Transpose matrix.
m1.Transpose();
m1.Print();
// 6 2
// 14 -8Element get and set by index.
m1[0,0] = 10;
m1[0,1] = 20;
m1[1,0] = 30;
m1[1,1] = 40;
m1.Print();
// 10 20
// 30 40