4 #include <symengine/matrices/matrix_expr.h>
5 #include <symengine/matrices/identity_matrix.h>
12 return n_->__hash__();
17 return (is_a<IdentityMatrix>(o)
18 && n_->__eq__(*down_cast<const IdentityMatrix &>(o).n_));
23 SYMENGINE_ASSERT(is_a<IdentityMatrix>(o));
25 return n_->compare(*down_cast<const IdentityMatrix &>(o).n_);
33 bool IdentityMatrix::is_canonical(
const RCP<const Basic> &n)
const
36 if (is_a<Integer>(*n)) {
37 if (down_cast<const Integer &>(*n).is_negative()) {
47 RCP<const MatrixExpr> identity_matrix(
const RCP<const Basic> &n)
50 if (is_a<Integer>(*n)) {
51 if (down_cast<const Integer &>(*n).is_negative()) {
53 "Dimension of IdentityMatrix must be nonnegative");
57 "Dimension of IdentityMatrix must be a nonnegative integer");
60 return make_rcp<const IdentityMatrix>(n);
The base class for SymEngine.
The lowest unit of symbolic representation.
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.
bool is_a_Number(const Basic &b)