2 #include <symengine/test_visitors.h>
3 #include <symengine/matrices/size.h>
11 RCP<const Basic> nrows_;
12 RCP<const Basic> ncols_;
14 void all_same_size(
const vec_basic &vec)
16 vec[0]->accept(*
this);
19 if (!rows.is_null() && !cols.is_null() && is_a<Integer>(*rows)
20 && is_a<Integer>(*cols)) {
29 for (
size_t i = 1; i < vec.size(); i++) {
30 vec[i]->accept(*
this);
31 if ((!nrows_.is_null() && is_a<Integer>(*nrows_))
32 || (rows.is_null() && !nrows_.is_null())) {
35 if ((!ncols_.is_null() && is_a<Integer>(*ncols_))
36 || (cols.is_null() && !ncols_.is_null())) {
39 if (!rows.is_null() && !cols.is_null() && is_a<Integer>(*rows)
40 && is_a<Integer>(*cols)) {
51 void bvisit(
const Basic &x)
77 nrows_ =
integer(x.get_container().size());
89 auto vec = x.get_terms();
95 auto vec = x.get_factors();
101 auto vec = x.get_factors();
102 vec[0]->accept(*
this);
104 vec.back()->accept(*
this);
108 std::pair<RCP<const Basic>, RCP<const Basic>> apply(
const MatrixExpr &s)
111 return std::make_pair(nrows_, ncols_);
115 std::pair<RCP<const Basic>, RCP<const Basic>> size(
const MatrixExpr &m)
118 return visitor.apply(m);
The lowest unit of symbolic representation.
Main namespace for SymEngine package.
std::enable_if< std::is_integral< T >::value, RCP< const Integer > >::type integer(T i)