I am trying to use GiNaC in, GNU Octave, an interactive scripting language used primarily for numerical analysis. Below, I provide some output from octave. Can you provide any clues as to what I may be doing to make the following assertion to fail? What can I do to fix it? octave:1> symbols installing ex type at type-id = 18 installing sym type at type-id = 19 installing vpa type at type-id = 20 octave:2> page_screen_output = 0; octave:3> x = sym("x") x = x octave:4> x^2 octave: basic.h:77: GiNaC::basic::~basic(): Assertion `(!(flags & status_flags::dynallocated))||(refcount==0)' failed. -- Ben Sapp Los Alamos National Laboratory email: <mailto:bsapp@lanl.gov> Phone: (505)667-3277 Fax: (505)665-7920 URL: http://www.neutrino.lanl.gov/ -- - To UNSUBSCRIBE, email to ginac-list@ginac.de with a subject of "unsubscribe".
On Tue, 27 Mar 2001, Ben Sapp wrote:
Below, I provide some output from octave. Can you provide any clues as to what I may be doing to make the following assertion to fail? What can I do to fix it?
There doesn't seem to be enough information to judge what's going on. I don't know how you allocate expressions. Can you strip this problem down to the bare GiNaC-C++-layer? I would bet you'll find the problem anyways, while doing so, though... Regards -richy. -- Richard Kreckel <Richard.Kreckel@Uni-Mainz.DE> <http://wwwthep.physik.uni-mainz.de/~kreckel/> - To UNSUBSCRIBE, email to ginac-list@ginac.de with a subject of "unsubscribe".
"Richard B. Kreckel" wrote:
There doesn't seem to be enough information to judge what's going on. I don't know how you allocate expressions. Can you strip this problem down to the bare GiNaC-C++-layer? I would bet you'll find the problem anyways, while doing so, though...
I did this and you are right I did find the problem. I ended up changing a function from this: GiNaC::symbol octave_sym::sym_value () const { return x; } to this: GiNaC::symbol octave_sym::sym_value () const { return ex_to_symbol(GiNaC::ex(*(x.duplicate ()))); } Octave classes overload the new operator and sometimes octave types get created as a const value. This was also causing me other problems relating to the fact that GiNaC does reference counting. An ex variable might be a const and GiNaC might change the reference count. This caused my code to crash in unpredictable ways. I can't say I completely understand why the particular assertion failed, but it does not seem to be a problem any more. Thanks. -- Ben Sapp Los Alamos National Laboratory email: <mailto:bsapp@lanl.gov> Phone: (505)667-3277 Fax: (505)665-7920 URL: http://www.neutrino.lanl.gov/ -- - To UNSUBSCRIBE, email to ginac-list@ginac.de with a subject of "unsubscribe".
participants (2)
-
Ben Sapp
-
Richard B. Kreckel