These are chat archives for symengine/symengine

6th
Jul 2015
Ondřej Čertík
@certik
Jul 06 2015 02:43
@Sumith1896 thanks. Ping me when you write this up, I'll look at it.
himanshu
@himanshu81494
Jul 06 2015 04:51
Please anybody guide me. I am new to Open Source . I code in python most of times. I want to contribute to this community.
Sartaj Singh
@leosartaj
Jul 06 2015 05:52
This project mainly involves C++. SymPy is based on Python. If you want to code in python checkout SymPy. Read this to get started https://github.com/sympy/sympy/wiki/Development-workflow.
himanshu
@himanshu81494
Jul 06 2015 07:17
thanks for suggestion!
I code in C++ too. So if it is right place, where do I start?
Sartaj Singh
@leosartaj
Jul 06 2015 07:18
I mostly contribute in SymPy. @Sumith1896 @isuruf can guide you better.
Shivam Vats
@shivamvats
Jul 06 2015 07:20
@himanshu81494 You should first fork and set up symengine on your machine. Here are the build instructions. Symengine has python wrappers too, so you can code in both c++ and python.
Isuru Fernando
@isuruf
Jul 06 2015 16:45
@certik, isn't var supposed to be injected into global namespace? I mean even if called within a function, it still gets injected. This is what is tested at test_var

In python,

var("x")
gc.collect()
y = x + 1

this should be valid right? Since symbol x can be called at the end gc.collect() does not remove it right?

Ondřej Čertík
@certik
Jul 06 2015 16:48
If you look at the source code, you can see that it grabs the parent stack frame and injects there.
What you wrote is correct. That's why you need to use a nested function like this:
def f():
    var("x")
    y = x + 1
f()
gc.collect()
Isuru Fernando
@isuruf
Jul 06 2015 16:51

Does not fix it.

If you look at the source code, you can see that it grabs the parent stack frame and injects there.

This is done recursively right?

Isuru Fernando
@isuruf
Jul 06 2015 16:57
In [2]: from symengine import var

In [3]: def f():
   ...:         var("x")
   ...:         y = x + 1
   ...:     

In [4]: def test_var():
   ...:         f()
   ...:         x = 1
   ...:         import gc
   ...:         gc.collect()
   ...:     

In [6]: test_var()

In [7]: x
Out[7]: x
Ondřej Čertík
@certik
Jul 06 2015 16:58
I think it doesn't work. And that explains why it leaks memory...
Otherwise we need to remove it from the global name space (perhaps del x or something like that), so that it gets deallocated by Python on exit.
(just in the test)
Ondřej Čertík
@certik
Jul 06 2015 17:04
var is meant for an interactive user code, not for library code. So it's actually fine if it gets injected into global namespace, if we can't figure out how to do it in the local namespace (which would obviously be better). We just need to figure out how to make the test code not leak.
For library code, one should use symbols.
Isuru Fernando
@isuruf
Jul 06 2015 17:28
I'll take a look

Btw, spkgs are here,
https://drive.google.com/open?id=0B1xdAm0dyMndfmJobGRLSTMzcTlwSzlxTWxUT0pKZTBLcURvR1FlTHpOdEtRR1RvS0ZKVjA

Just cmake and symengine would do, since you have curl installed in linux and osx

Sumith Kulal
@Sumith1896
Jul 06 2015 19:27
Hi, I am currently moving back to Mumbai, to my institute after vacations.
So, I might be a bit slow to respond for a couple of days.
@himanshu81494 Cool, you can post here if you have any queries, happy to help :smile: