Use this class for solvers and other places when a matrix needs to be built without recreating an instance multiple times.
More...
Use this class for solvers and other places when a matrix needs to be built without recreating an instance multiple times.
It builds an instance of Matrix. It enables to build a tensor row-by-row.
Console.WriteLine(mb.ToMatrix() is null);
Console.WriteLine("-------------------------");
mb.Add(
new Entity[] { 1, 2, 3 } );
mb.Add(
new Entity[] {
"x",
"sqrt(y)", 5 } );
Console.WriteLine(mb.ToMatrix().ToString(multilineFormat: true));
Console.WriteLine("-------------------------");
Prints
<h2>True
</h2>
Matrix[2 x 3]
1 2 3
<h2>x sqrt(y) 5
</h2>
◆ MatrixBuilder() [1/2]
| AngouriMath.Core.MatrixBuilder.MatrixBuilder |
( |
int |
columnCount | ) |
|
|
inline |
Creates a builder with the given number of column and no rows.
- Parameters
-
| columnCount | The number of columns the tensor will have (you cannot change it after creation). |
◆ MatrixBuilder() [2/2]
| AngouriMath.Core.MatrixBuilder.MatrixBuilder |
( |
List< List< Entity >>? |
alreadyHas, |
|
|
int |
columnCount |
|
) |
| |
|
inline |
Creates a builder with the given number of column and no rows.
- Parameters
-
| alreadyHas | The list of rows to put in the builder. All lists in this list must have the same length as columnCount. |
| columnCount | The number of columns the tensor will have (you cannot change it after creation). |
◆ Add() [1/2]
| void AngouriMath.Core.MatrixBuilder.Add |
( |
List< Entity > |
row | ) |
|
|
inline |
Adds a row to the builder.
- Parameters
-
| row | A row to add. Make sure it has the same length as columnCount. |
- Exceptions
-
| InvalidMatrixOperationException | Is thrown if the given row has a wrong length. |
◆ Add() [2/2]
| void AngouriMath.Core.MatrixBuilder.Add |
( |
IEnumerable< Entity > |
row | ) |
|
Adds a row to the builder.
- Parameters
-
| row | A row to add. Make sure it has the same length as columnCount. |
- Exceptions
-
| InvalidMatrixOperationException | Is thrown if the given row has a wrong length. |
◆ ToMatrix()
| Matrix AngouriMath.Core.MatrixBuilder.ToMatrix |
( |
| ) |
|
|
inline |
Builds itself into a Matrix.
- Returns
- An immutable Matrix if there exists at least one row. Null otherwise.
The documentation for this class was generated from the following file:
- Sources/AngouriMath/Core/MatrixBuilder.cs