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