Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 16 21:33

    bjodah on master

    Add const qualifier to call met… Merge pull request #1619 from b… (compare)

  • Oct 16 21:33
    bjodah closed #1619
  • Oct 16 16:15
    bjodah opened #1619
  • Oct 15 20:25
    bwasty starred symengine/symengine
  • Oct 11 23:06
    cairdac-rd starred symengine/symengine
  • Oct 08 08:06
    bjodah closed #1618
  • Oct 08 08:06
    bjodah commented #1618
  • Oct 08 03:58
    certik commented #1618
  • Oct 08 03:17
    isuruf commented #1618
  • Oct 07 15:01
    isuruf commented #1616
  • Oct 07 15:01

    isuruf on master

    add specialization for julia fix namespace Avoid duplicating code and 2 more (compare)

  • Oct 07 15:01
    isuruf closed #1616
  • Oct 07 06:16
    isuruf synchronize #1616
  • Oct 07 06:01
    isuruf synchronize #1616
  • Oct 07 05:41
    Roger-luo synchronize #1616
  • Oct 06 12:08
    bjodah opened #1618
  • Oct 03 18:58
    jmig5776 commented #1617
  • Oct 02 22:33
    certik commented #1617
  • Oct 02 22:26
    certik commented #1617
  • Oct 02 22:24
    certik commented #1617
Brandon Bocklund
@bocklund
I'll give it a shot. I'll try to set up dev environment so I can test it
Isuru Fernando
@isuruf
(Or just send a PR with a test. CI will catch it)
Btw, pickle.loads(pickle.dumps(l)) == l is always False because they don't have __eq__ implemented.
Brandon Bocklund
@bocklund
Right
I'll open a PR first (symengine/symengine#1549) with an addition to the dump/save test to verify it fails and the test is working as intended, then I'll push the fix
Isuru Fernando
@isuruf
Thanks. I cancelled tests without LLVM
Richard Otis
@richardotis
I'm trying to get a symengine development environment set up and I'm having some trouble. SymEngine builds and the test binaries pass, but when I try to build symengine.py, I get
(calphadpy3) rotis@x86_64-conda_cos6-linux-gnu ~/git/symengine.py (master) $ python setup.py install build_ext --symengine-dir=$HOME/git/symengine/build --inplace                          
running install
running build
running build_ext
SymEngine_DIR : /home/rotis/git/symengine/build/lib/cmake/symengine
SymEngine Version : 0.4.0
-- Python include path: /home/rotis/anaconda3/envs/calphadpy3/include/python3.7m
-- Python version: 3.7
-- Python install path: /home/rotis/anaconda3/envs/calphadpy3/lib/python3.7/site-packages
-- Found CYTHON: cython
CMAKE_BUILD_TYPE        : Release
CMAKE_CXX_FLAGS         : -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe 
CMAKE_CXX_FLAGS_RELEASE : -Wall -Wextra -Wno-unused-parameter -fno-common -O3 -march=native -funroll-loops -std=c++11 -fPIC -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG -fopenmp
CMAKE_CXX_FLAGS_DEBUG   : -Wall -Wextra -Wno-unused-parameter -fno-common -g -ggdb -std=c++11 -fPIC -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fopenmp
HAVE_SYMENGINE_MPFR     : False
HAVE_SYMENGINE_MPC      : False
HAVE_SYMENGINE_PIRANHA  : False
HAVE_SYMENGINE_FLINT    : False
HAVE_SYMENGINE_LLVM     : True
Copying source of python wrappers into: /home/rotis/git/symengine.py
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rotis/git/symengine.py
[ 25%] Building CXX object symengine/lib/CMakeFiles/symengine_wrapper.dir/symengine_wrapper.cpp.o
In file included from /home/rotis/git/symengine/build/lib/cmake/symengine/../../../include/symengine/mp_class.h:7:0,
                 from /home/rotis/git/symengine.py/symengine/lib/symengine_wrapper.cpp:620:
/home/rotis/git/symengine/build/lib/cmake/symengine/../../../include/symengine/mp_wrapper.h:5:10: fatal error: gmp.h: No such file or directory
 #include <gmp.h>
          ^~~~~~~
compilation terminated.
gmake[2]: *** [symengine/lib/CMakeFiles/symengine_wrapper.dir/build.make:69: symengine/lib/CMakeFiles/symengine_wrapper.dir/symengine_wrapper.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:177: symengine/lib/CMakeFiles/symengine_wrapper.dir/all] Error 2
gmake: *** [Makefile:130: all] Error 2
error: error building project
I am on master for both
Richard Otis
@richardotis
Also I have gmp installed on this computer, and my include file is at /usr/include/gmp.h
Richard Otis
@richardotis
It looks like adding "-I/usr/include" to CMAKE_CXX_FLAGS fixed the issue. I think it may be some kind of poor interaction between my conda environment and my system's cmake
specifically, cmake -DCMAKE_CXX_FLAGS="-I/usr/include -L/usr/lib64" seemed to do the trick
Richard Otis
@richardotis
I did eventually fix it and can run lambdify from symengine.py. The problem was some "mixing" between my conda toolchain (gcc 7) and my system toolchain (gcc 9). I rebuilt symengine completely isolated from conda. The line I used was cmake -DCMAKE_INSTALL_PREFIX=$HOME/git/symengine/build -DINTEGER_CLASS=boostmp -DWITH_LLVM=8.0 -DWITH_OPENMP=yes .
Then, still isolated from conda, I went to symengine.py and manually ran cmake -DSymEngine_DIR=$HOME/git/symengine/build . && make
Only at that point did I activate my conda environment and run pip install -e . to make symengine.py available to conda. Everything was built using my system gcc
Marcello
@torshind_gitlab

Hello there. Thanks for your awesome library.
Please have a look to this:

#include <symengine/expression.h>

int main(int argc, char* argv[]) {
  auto x = SymEngine::symbol("x");

  std::cout << "#1: " << SymEngine::Expression(SymEngine::abs(SymEngine::abs(x))) << "\n";
  std::cout << "#2: " << SymEngine::Expression(SymEngine::abs(SymEngine::mul(x, SymEngine::sign(x)))) << "\n";
  std::cout << "#3: " << SymEngine::Expression(SymEngine::floor(SymEngine::ceiling(x))) << "\n";
  std::cout << "#4: " << SymEngine::Expression(SymEngine::ceiling(SymEngine::floor(x))) << "\n";
  return 0;
}

Output:

#1: abs(abs(x))
#2: abs(x*sign(x))
#3: ceiling(x)
#4: floor(x)

Maybe I'm doing something wrong, but I'd expect #1 = #2 = abs(x)
What do you think about that?

Isuru Fernando
@isuruf
@torshind_gitlab, I think we can fix the first one, but the second one is hard. Even sympy cant do it.
Marcello
@torshind_gitlab

@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?

Richard Otis
@richardotis
@isuruf Not sure if this is a big favor to ask, but would it be possible to cut a new release of symengine.py? Our downstream project would like to take advantage of symengine/symengine.py#288 to make some performance improvements
And @bocklund reminds me there's a quality-of-life improvement in main symengine too, symengine/symengine#1549, which we'd love to use as well
Isuru Fernando
@isuruf
@richardotis, if you could help write the release notes at https://github.com/symengine/symengine/wiki/Release-notes-for-v0.4.1 that'll speedup a new release
@torshind_gitlab, I don't have the time to do that, but I'll review a PR if you send one
Richard Otis
@richardotis
@isuruf I added a bit to your draft release notes. I started from symengine/symengine@cab0213 and worked my way to master HEAD. Let me know what you think and if there's anything else I can do to help.
Isuru Fernando
@isuruf
Thanks. I'll do a release this weekend
Richard Otis
@richardotis
Thanks again for your work. Absolute game-changer for our project.
Ondřej Čertík
@certik
@richardotis I am really glad SymEngine is working for you. Are you at the SciPy 2019 conference?
Richard Otis
@richardotis
@certik Not this year, no. There is an annual conference in June I always go to, and hitting a July one as well has always been a tough lift for my employer
I've been trying to convince @bocklund to go and present on his work
I have a March-April conference slot I've been looking to replace with a SciPy-type conference, though.
Ondřej Čertík
@certik
@richardotis no problem I understand. I haven't gone for SciPy in many years until this year I finally made it.
Marcello
@torshind_gitlab
Hello, please have a look at this:
    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;
Output:
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
Do you have any idea how to eliminate the spurious 0.0 when the coefficients are double?
Isuru Fernando
@isuruf
Its a tough one. We want expand(4.0*(x + y - (x+y))) to give 0.0 instead of 0 to make it clear that the expression is inexact (floating point vs integer)
You can eliminate 0.0 in the final expression by checking if the expression is an Add and if the coefficient is 0.0, remove it
But that doesn't fix 0.0 in intermediate expressions
On second thought, returning 0 for expand(4.0*(x + y - (x+y))) is totally fine
Isuru Fernando
@isuruf
Currently, in symengine 0 * 4.0 gives 0.0, but it should probably return 0. @certik, what do you think?
Isuru Fernando
@isuruf
Marcello
@torshind_gitlab
I deleted my previous message because I verified that the workaround that I've proposed doesn't work. Sorry for the confusion.
Isuru Fernando
@isuruf
@torshind_gitlab, you need to use integer(0) as the coefficient in the code you posted previously
Marcello
@torshind_gitlab
yep, if get_coef()->is_zero() is true, forcing an exact coefficient does the trick
thanks again @isuruf
Isuru Fernando
@isuruf
@richardotis, @bocklund, I've released 0.4.1 of symengine. With conda you can use python-symengine 0.4.0 and symengine 0.4.1
I could use some help in fixing the tests of symengine.py at symengine/symengine.py#289
Steven Lee
@stevenleeS0ht
Is there versioning compatibility requirement between symengine and python-symengine?
Isuru Fernando
@isuruf
@stevenleeS0ht, yes, we usually only support one version of symengine recorded at https://github.com/symengine/symengine.py/blob/master/symengine_version.txt
Carl Poppa
@tgn3000

@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
Isuru Fernando
@isuruf
@tgn3000, looks like an oversight
Note that, we have
2*a*b*c -> 2*a*b*c
1 + 2*a*b*c -> 1+2*a*b*c