AngouriMath

Navigation

MatrixBuilder


← Back to list of classes

Description

Summary

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.

Example

using System;
using AngouriMath;
using AngouriMath.Core;

var mb = new MatrixBuilder(3);
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("-------------------------");

mb.Add(new Entity[] { 1 } ); // throws

Prints
True
-------------------------
Matrix[2 x 3]
1         2         3         
x         sqrt(y)   5         
-------------------------
Unhandled exception. AngouriMath.Core.Exceptions.InvalidMatrixOperationException: Incorrect usage of MatrixBuilder

Members

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1534 pages online