Cubli library

Matrix/Matrix.h

Committer:
fbob
Date:
2019-02-13
Revision:
1:085840a3d767
Parent:
0:431ee55036ca
Child:
2:dc7840a67f77

File content as of revision 1:085840a3d767:

#ifndef Matrix_h
#define Matrix_h

#include "stdlib.h"
#include "math.h"

/** Matrix class */
class Matrix
{
  public:
    /** Constructors */
    Matrix();
    Matrix(int rows, int cols);
    /** Destructor */
    ~Matrix();
    /** Assignment */
    Matrix& operator=(const Matrix& m);
    /** Parameters */
    int _rows, _cols;
    float **_data;
    /** Cell data */
    float& operator()(int row, int col);
};

/** Math operators */
Matrix operator+(const Matrix&, const Matrix&);
Matrix operator-(const Matrix&, const Matrix&);
Matrix operator*(const Matrix&, const Matrix&);
Matrix operator*(float, const Matrix&);
Matrix operator*(const Matrix&, float);
Matrix operator/(const Matrix&, float);

/** Matriz algebra */
Matrix transpose(const Matrix&);
Matrix inverse(const Matrix&);
float norm(const Matrix&);

#endif