2 #include <symengine/assumptions.h>
4 #include <symengine/test_visitors.h>
17 : assumptions_(assumptions)
21 void bvisit(
const Basic &x){};
24 is_diagonal_ = tribool::indeterminate;
29 is_diagonal_ = tribool::tritrue;
34 is_diagonal_ = is_square(x, assumptions_);
39 is_diagonal_ = tribool::tritrue;
44 if (x.nrows() != x.ncols()) {
45 is_diagonal_ = tribool::trifalse;
48 size_t ncols = x.ncols();
51 is_diagonal_ = tribool::tritrue;
52 for (
size_t i = 0; i < ncols; i++) {
54 for (
size_t j = 0; j < ncols; j++) {
56 auto &e = x.get_values()[offset];
57 is_diagonal_ = and_tribool(is_diagonal_, visitor.apply(*e));
58 if (is_false(is_diagonal_)) {
69 bool found_nondiag =
false;
70 for (
auto &elt : x.get_terms()) {
72 if (is_indeterminate(is_diagonal_)) {
74 }
else if (is_false(is_diagonal_)) {
83 is_diagonal_ = tribool::trifalse;
85 is_diagonal_ = tribool::tritrue;
93 for (
auto &elt : x.get_factors()) {
95 if (is_true(is_diagonal_)) {
99 is_diagonal_ = tribool::indeterminate;
112 return visitor.apply(m);
The base class for SymEngine.
The lowest unit of symbolic representation.
Main namespace for SymEngine package.