matrix_add.h
1 #ifndef SYMENGINE_MATRICES_MATRIX_ADD_H
2 #define SYMENGINE_MATRICES_MATRIX_ADD_H
3 
4 #include <symengine/basic.h>
5 #include <symengine/matrices/matrix_expr.h>
6 #include <symengine/matrices/size.h>
7 
8 namespace SymEngine
9 {
10 
11 class MatrixAdd : public MatrixExpr
12 {
13 private:
14  vec_basic terms_;
15 
16 public:
17  MatrixAdd(const vec_basic &terms) : terms_(terms)
18  {
19  SYMENGINE_ASSIGN_TYPEID();
20  SYMENGINE_ASSERT(is_canonical(terms));
21  }
22 
23  IMPLEMENT_TYPEID(SYMENGINE_MATRIXADD)
24  hash_t __hash__() const override;
25  bool __eq__(const Basic &o) const override;
26  int compare(const Basic &o) const override;
27  bool is_canonical(const vec_basic &terms) const;
28  vec_basic get_args() const override
29  {
30  return vec_basic(terms_.begin(), terms_.end());
31  }
32  inline const vec_basic &get_terms() const
33  {
34  return terms_;
35  }
36 };
37 
38 RCP<const MatrixExpr> matrix_add(const vec_basic &terms);
39 
40 } // namespace SymEngine
41 
42 #endif
The base class for SymEngine.
#define IMPLEMENT_TYPEID(SYMENGINE_ID)
Inline members and functions.
Definition: basic.h:340
T begin(T... args)
The lowest unit of symbolic representation.
Definition: basic.h:97
vec_basic get_args() const override
Returns the list of arguments.
Definition: matrix_add.h:28
bool __eq__(const Basic &o) const override
Test equality.
Definition: matrix_add.cpp:19
int compare(const Basic &o) const override
Definition: matrix_add.cpp:28
hash_t __hash__() const override
Definition: matrix_add.cpp:10
T end(T... args)
Main namespace for SymEngine package.
Definition: add.cpp:19