Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef __MyMatrix_H
- #define __MyMatrix_H
- #include <vector>
- #include "Eigen/Dense"
- #include "Fraction.h"
- template <typename T> class MyMatrix {
- private:
- std::vector<std::vector<T> > mat;
- unsigned rows;
- unsigned cols;
- public:
- MyMatrix(unsigned _rows, unsigned _cols, const T& _initial);
- MyMatrix(const MyMatrix<T>& rhs);
- virtual ~MyMatrix();
- // Operator overloading, for "standard" mathematical MyMatrix operations
- MyMatrix<T>& operator=(const MyMatrix<T>& rhs);
- // MyMatrix mathematical operations
- MyMatrix<T> operator+(const MyMatrix<T>& rhs);
- MyMatrix<T> operator*(const MyMatrix<T>& rhs);
- MyMatrix<T> transpose();
- MyMatrix<T> swap_rows(unsigned row1, unsigned row2);
- void print();
- Eigen::MatrixXd create_double_eigen();
- Eigen::MatrixXf create_float_eigen();
- void gwp(std::vector<T> vec);
- void gpp(std::vector<T> vec);
- void gcp(std::vector<T> vec);
- // MyMatrix/vector operations
- std::vector<T> operator*(const std::vector<T>& rhs);
- std::vector<T> diag_vec();
- // Access the individual elements
- T& operator()(const unsigned& row, const unsigned& col);
- const T& operator()(const unsigned& row, const unsigned& col) const;
- // Access the row and column sizes
- unsigned get_rows() const;
- unsigned get_cols() const;
- };
- #include "matrix.cpp"
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement