Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #ifndef __MyMatrix_H
  2. #define __MyMatrix_H
  3.  
  4. #include <vector>
  5. #include "Eigen/Dense"
  6. #include "Fraction.h"
  7.  
  8. template <typename T> class MyMatrix {
  9. private:
  10. std::vector<std::vector<T> > mat;
  11. unsigned rows;
  12. unsigned cols;
  13.  
  14. public:
  15. MyMatrix(unsigned _rows, unsigned _cols, const T& _initial);
  16. MyMatrix(const MyMatrix<T>& rhs);
  17. virtual ~MyMatrix();
  18.  
  19. // Operator overloading, for "standard" mathematical MyMatrix operations
  20. MyMatrix<T>& operator=(const MyMatrix<T>& rhs);
  21.  
  22. // MyMatrix mathematical operations
  23. MyMatrix<T> operator+(const MyMatrix<T>& rhs);
  24. MyMatrix<T> operator*(const MyMatrix<T>& rhs);
  25. MyMatrix<T> transpose();
  26. MyMatrix<T> swap_rows(unsigned row1, unsigned row2);
  27. void print();
  28. Eigen::MatrixXd create_double_eigen();
  29. Eigen::MatrixXf create_float_eigen();
  30. void gwp(std::vector<T> vec);
  31. void gpp(std::vector<T> vec);
  32. void gcp(std::vector<T> vec);
  33.  
  34. // MyMatrix/vector operations
  35. std::vector<T> operator*(const std::vector<T>& rhs);
  36. std::vector<T> diag_vec();
  37.  
  38. // Access the individual elements
  39. T& operator()(const unsigned& row, const unsigned& col);
  40. const T& operator()(const unsigned& row, const unsigned& col) const;
  41.  
  42. // Access the row and column sizes
  43. unsigned get_rows() const;
  44. unsigned get_cols() const;
  45.  
  46. };
  47.  
  48. #include "matrix.cpp"
  49.  
  50. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement