2 #include <symengine/assumptions.h>
4 #include <symengine/test_visitors.h>
12 tribool is_symmetric_;
17 bool found_nonsym =
false;
18 for (
auto &elt : vec) {
20 if (is_indeterminate(is_symmetric_)) {
22 }
else if (is_false(is_symmetric_)) {
31 is_symmetric_ = tribool::trifalse;
33 is_symmetric_ = tribool::tritrue;
39 : assumptions_(assumptions)
43 void bvisit(
const Basic &x){};
46 is_symmetric_ = tribool::indeterminate;
51 is_symmetric_ = tribool::tritrue;
56 is_symmetric_ = is_square(x, assumptions_);
61 is_symmetric_ = tribool::tritrue;
66 size_t nrows = x.nrows();
67 size_t ncols = x.ncols();
69 is_symmetric_ = tribool::trifalse;
73 is_symmetric_ = tribool::tritrue;
74 for (
size_t i = 0; i < ncols; i++) {
75 for (
size_t j = 0; j <= i; j++) {
77 auto e1 = x.get(i, j);
78 auto e2 = x.get(j, i);
79 is_symmetric_ = and_tribool(is_symmetric_,
80 visitor.apply(*
sub(e1, e2)));
82 if (is_false(is_symmetric_)) {
91 check_vector(x.get_terms());
96 check_vector(x.get_factors());
102 return is_symmetric_;
109 return visitor.apply(m);
The base class for SymEngine.
The lowest unit of symbolic representation.
Main namespace for SymEngine package.
RCP< const Basic > sub(const RCP< const Basic > &a, const RCP< const Basic > &b)
Substracts b from a.