Skip to content

A C++ Matrix of Fraction class implementation

License

Notifications You must be signed in to change notification settings

melvinyesudas/matrix-cpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

matrix-cpp

A C++ Matrix of Fraction class implementation

Project purpose

This library was made to avoid me wasting time with calculus when I studied Linear Algebra. It implements the most important Matrix methods.

Example

With this code:

#include <iostream>
#include "Matrix.h"
using namespace std;

int main() {
    Matrix m;
    int rows, cols;
    cout << "Righe: ";
    cin >> rows;
    cout << "Colonne: ";
    cin >> cols;
    m = Matrix(rows, cols);
    cout << "Matrice:" << endl;
    cin >> m;
    cout << "******************" << endl;
    cout << "Matrice:" << endl;
    cout << m << endl;
    cout << "Scalini:" << endl;
    cout << m.step() << endl;
    cout << "Rref:" << endl;
    cout << m.rref() << endl;
    if(m.isInvertible()) {
        cout << "Inversa:" << endl;
        cout << m.invert() << endl;
        cout << "M * Inv:" << endl;
        cout << m * m.invert() << endl; 
    } 
    if(m.isSquare()) {
        cout << "det = " << m.det() << endl;
    }
}

The result could be:

Example Result

Run tests

On windows, you can use these three batch file to build/run/build&run tests:

  • build_test.bat
  • run_test.bat
  • test.bat

TODO

  • Add algebric (variable parameters) support
  • Add a cli commandline
  • Add missing matrix functions

About

A C++ Matrix of Fraction class implementation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 99.3%
  • Batchfile 0.7%