2 #include <symengine/matrices/matrix_expr.h>
3 #include <symengine/matrices/conjugate_matrix.h>
11 hash_t seed = SYMENGINE_CONJUGATEMATRIX;
12 hash_combine<Basic>(seed, *arg_);
18 return (is_a<ConjugateMatrix>(o)
19 && arg_->__eq__(*down_cast<const ConjugateMatrix &>(o).arg_));
22 bool ConjugateMatrix::is_canonical(
const RCP<const MatrixExpr> &arg)
const
26 if (is_a<IdentityMatrix>(*arg) || is_a<ZeroMatrix>(*arg)
27 || is_a<DiagonalMatrix>(*arg) || is_a<ImmutableDenseMatrix>(*arg)
28 || is_a<ConjugateMatrix>(*arg) || is_a<Transpose>(*arg)
29 || is_a<MatrixAdd>(*arg) || is_a<HadamardProduct>(*arg)) {
37 SYMENGINE_ASSERT(is_a<ConjugateMatrix>(o));
39 return arg_->compare(*down_cast<const ConjugateMatrix &>(o).arg_);
50 RCP<const MatrixExpr> conjugate_;
55 void bvisit(
const Basic &x){};
59 auto arg = rcp_static_cast<const MatrixExpr>(x.
rcp_from_this());
60 conjugate_ = make_rcp<const ConjugateMatrix>(arg);
65 conjugate_ = rcp_static_cast<const MatrixExpr>(x.
rcp_from_this());
70 conjugate_ = rcp_static_cast<const MatrixExpr>(x.
rcp_from_this());
75 auto diag = x.get_container();
77 for (
size_t i = 0; i < diag.size(); i++) {
80 conjugate_ = make_rcp<const DiagonalMatrix>(conj);
85 auto values = x.get_values();
87 for (
size_t i = 0; i < values.size(); i++) {
91 = make_rcp<const ImmutableDenseMatrix>(x.nrows(), x.ncols(), conj);
96 conjugate_ = x.get_arg();
102 auto arg = x.get_arg();
103 auto conj = make_rcp<const ConjugateMatrix>(arg);
104 conjugate_ = make_rcp<const Transpose>(conj);
110 for (
auto &e : x.get_terms()) {
114 conjugate_ = make_rcp<const MatrixAdd>(conj);
120 for (
auto &e : x.get_factors()) {
124 conjugate_ = make_rcp<const HadamardProduct>(conj);
127 RCP<const MatrixExpr> apply(
const MatrixExpr &s)
134 RCP<const MatrixExpr> conjugate_matrix(
const RCP<const MatrixExpr> &arg)
137 return visitor.apply(*arg);
The base class for SymEngine.
The lowest unit of symbolic representation.
vec_basic get_args() const override
Returns the list of arguments.
int compare(const Basic &o) const override
hash_t __hash__() const override
bool __eq__(const Basic &o) const override
Test equality.
RCP< T > rcp_from_this()
Get RCP<T> pointer to self (it will cast the pointer to T)
Main namespace for SymEngine package.
RCP< const Basic > conjugate(const RCP< const Basic > &arg)
Canonicalize Conjugate.