CPP Linear Algebra ToolBox  0.1.0
lowerTriangularMatrix.h
Go to the documentation of this file.
1 
10 #ifndef LOWER_TRIANGULAR_MATRIX_H
11 #define LOWER_TRIANGULAR_MATRIX_H
12 
13 #include "utils.h"
14 #include "matrix.h"
15 
26 class LTMatrix : public Matrix {
27  public:
28  /* CONSTRUCTORS */
29  LTMatrix();
30  LTMatrix(uint16_t , uint16_t );
31  LTMatrix(uint16_t );
32  LTMatrix(const LTMatrix & );
33 
34  /* DESTRUCTORS */
35  ~LTMatrix();
36 
37  /*ACCESSORS */
38 
39  /* METHODS */
40  uint16_t max_col_from_row(uint16_t ) const;
41 
42  /* OPERATORS */
43  double & operator()(uint32_t ) const;
44  double & operator()(uint16_t, uint16_t) const;
45 
46  LTMatrix & operator=(const LTMatrix & );
47 
48  LTMatrix operator-() const;
49 
50  friend LTMatrix operator*(const LTMatrix & , const LTMatrix & );
51  friend Vector operator*(const LTMatrix & , const Vector & );
52  friend LTMatrix operator*(const double , const LTMatrix & );
53  friend LTMatrix operator*(const LTMatrix & , const double );
54 
55  friend LTMatrix operator+(const LTMatrix & , const LTMatrix & );
56  friend LTMatrix operator+(const double , const LTMatrix & );
57  friend LTMatrix operator+(const LTMatrix & , const double );
58 
59  friend LTMatrix operator-(const LTMatrix & , const LTMatrix & );
60  friend LTMatrix operator-(const LTMatrix & , const double );
61  friend LTMatrix operator-(const double , const LTMatrix & );
62 
63  friend LTMatrix operator/(const LTMatrix & , const double );
64 
65  friend std::ostream & operator<<(std::ostream & , const LTMatrix & );
66 
67  /* OVERLOAD METHODS MATRIX */
68 
69  /* STATIC METHODS */
70  static double tr(const LTMatrix & );
71  static double det(const LTMatrix & );
72 
73  /* OVERLOAD STATIC METHODS MATRIX */
74  static LTMatrix zeros(uint16_t );
75  static LTMatrix ones(uint16_t );
76  static LTMatrix rand(uint16_t );
77  static LTMatrix rand(uint16_t , uint16_t );
78 
79  private:
80  /* ATTRIBUTES */
81 
82  /* METHODS */
83  double & at(uint32_t ) const;
84  double & at(uint16_t , uint16_t ) const;
85  void show() const;
86 };
87 
88 #endif
A class describing a Lower Triangular Matrix. Lower triangular matrix are Matrix of dimension satisf...
Definition: lowerTriangularMatrix.h:26
friend LTMatrix operator+(const LTMatrix &, const LTMatrix &)
Definition: lowerTriangularMatrix.cpp:168
uint16_t max_col_from_row(uint16_t) const
A method to compute the maximum colum index with non-zero data for a given row . Works for a general ...
Definition: lowerTriangularMatrix.cpp:78
static double tr(const LTMatrix &)
Definition: lowerTriangularMatrix.cpp:244
static LTMatrix zeros(uint16_t)
Definition: lowerTriangularMatrix.cpp:263
~LTMatrix()
Definition: lowerTriangularMatrix.cpp:62
friend LTMatrix operator*(const LTMatrix &, const LTMatrix &)
Product of Lower Triangular Matrices. For and two lower triangular matrices of dimension ,...
Definition: lowerTriangularMatrix.cpp:129
static LTMatrix ones(uint16_t)
Definition: lowerTriangularMatrix.cpp:268
static double det(const LTMatrix &)
Definition: lowerTriangularMatrix.cpp:253
LTMatrix & operator=(const LTMatrix &)
Definition: lowerTriangularMatrix.cpp:94
LTMatrix()
Construct a new LTMatrix object. Default Constructor, call parent Matrix constructor.
Definition: lowerTriangularMatrix.cpp:9
friend std::ostream & operator<<(std::ostream &, const LTMatrix &)
Definition: lowerTriangularMatrix.cpp:226
LTMatrix operator-() const
Definition: lowerTriangularMatrix.cpp:111
friend LTMatrix operator/(const LTMatrix &, const double)
Definition: lowerTriangularMatrix.cpp:216
double & operator()(uint32_t) const
Definition: lowerTriangularMatrix.cpp:89
static LTMatrix rand(uint16_t)
Definition: lowerTriangularMatrix.cpp:273
A class describing a Matrix object. Matrices are array of size (n,m) whre n and m are integer greater...
Definition: matrix.h:29
A lightweight class describing a Vector object. Vectors are array with size n (>0) of doubles.
Definition: vector.h:25
Header file for Matrix class.