Skip to content
William Henrique edited this page May 8, 2020 · 20 revisions

Matrix object

A matrix is a template class and can be integrated with a Fractions Number Class.

You need to include Matrix header or LIAL header and call the class by LIAL::Matrix

Your compile might shows for you some methods descriptions. But you can see a explain about all.

Then, You might create easily a class instance.

Like these, Matrix A; Matrix B; Mat C;

  • OBS: Mat is a alias for a Matrix

Public Methods

  • Sum:

Sum Matrix's elements with a common Matrix.

Example:

Matrix<int> A = {{1,0},{0,1}}, B = {{0,0},{0,1}}, C = {3,2}, R;

R = A + B; // Ok

R = A + C; // Generate a Erro! 'Cuz, A has 2x2 dimension and C has 1x2

  • Subtraction, Multiplication and Others.

Example:

R = A * 2; // A now is {{2,0},{0,2}}

R = R / 2; // R is equal A

R = R - A; // R is a Null Matrix

R = A * B; // Product between Matrices

  • Determinant Number

Example:
  • Inverse Matrix

Example:
  • Adjoint

Example:
  • Inverse

Example: