isuruf on master
csr_binop_csr_canonical bugfixe… Merge pull request #1700 from l… (compare)
isuruf on master
Changed is_lower, is_upper to m… changed to is_number_and_zero Merge pull request #1699 from s… (compare)
@isuruf thank you very much. To be honest I wouldn't even need the second one if the truncate function (aka static_cast<int>) was implemented. In fact, as a temporary solution, I solved it using
SymEngine::mul(SymEngine::sign(lhs), SymEngine::floor(SymEngine::abs(lhs)))
in its place.
Any chance that truncate function will be implemented?
r1 = add(add(real_double(0.), x), y);
std::cout << *r1 << std::endl;
r1 = expand(add(add(real_double(0.), x), y));
std::cout << *r1 << std::endl;
r1 = expand(add(x, mul(real_double(4.), y)));
std::cout << *r1 << std::endl;
r1 = expand(add(x, mul(real_double(4.), add(y, z))));
std::cout << *r1 << std::endl;
r1 = expand(add(x, mul(integer(4), add(y, z))));
std::cout << *r1 << std::endl;
r1 = expand(mul(real_double(4.), add(y, z)));
std::cout << *r1 << std::endl;
r1 = expand(mul(integer(4), add(y, z)));
std::cout << *r1 << std::endl;
x + y
x + y
x + 4.0*y
0.0 + x + 4.0*y + 4.0*z
x + 4*y + 4*z
0.0 + 4.0*y + 4.0*z
4*y + 4*z
Add
and if the coefficient is 0.0
, remove it
0
for expand(4.0*(x + y - (x+y)))
is totally fine
@isuruf Hi Isuru, long time no see! Was wondering if the following behavior is expected. Thanks!! (master
, ed7479baf59a36636061acc35b676bcf9073a932
)
int main() {
RCP<const Basic> a = symbol("a"), b = symbol("b"), c = symbol("c");
map_basic_basic d {{mul(a,b), c}};
RCP<const Basic> r1 = mul(SymEngine::integer(2), mul(a, b)),
r2 = add(SymEngine::integer(1), r1);
std::cout << *r1 << " -> " << *r1->subs(d) << std::endl;
std::cout << *r2 << " -> " << *r2->subs(d) << std::endl;
return 0;
}
produces
2*a*b -> 2*a*b
1 + 2*a*b -> 1 + 2*c
2*a*b*c -> 2*a*b*c
1 + 2*a*b*c -> 1+2*a*b*c
The new as_ctypes API enables some really nice solver accuracy improvements for us downstream
What's the difference between this and the cython one?