[GiNaC-list] Bug with matrix subtraction

Ondrej Certik ondrej at certik.cz
Sun Mar 25 21:58:15 CEST 2007


Hi, I am a co-developer of swiginac. The bug is probably there. But, exactly as
Alexei said, A-A = 0 is ugly, but, but fixing it would be very
difficult (if possible at all). That's why I decided to rewrite the
whole GiNaC in python directly:

http://code.google.com/p/sympy/

And in SymPy, you can do:

In [1]: m = Matrix(2,2,[x,0,0,0])

In [2]: m
Out[2]:
x 0
0 0


In [3]: m-m
Out[3]:
0 0
0 0


In [4]: m+(-m)
Out[4]:
0 0
0 0

Ondrej

On 3/22/07, Martin Sandve Alnæs <martinal at simula.no> wrote:
> 2007/3/22, Sheplyakov Alexei <varg at theor.jinr.ru>:
> > Hello!
> >
> > On Thu, Mar 22, 2007 at 09:44:03AM +0100, Martin Sandve Alnæs wrote:
> >
> > > If I subtract two equal matrices, I get the scalar 0.
> >
> > In GiNaC (A-A) is always transformed into 0 (number). I admit this is
> > ugly, but fixing it would be very difficult (if possible at all).
>
> I see.
>
> > > If I do a+(-b) instead of a-b, I get a zero matrix as wanted.
> >
> > Interesting. I get zero (a number) in both ways:
>
> Seems like the matrix with zeros only happens when using the swiginac
> bindings, so techniqually the bug is there.
>
> Thanks for the quick response, anyway.
>
> martin
> _______________________________________________
> GiNaC-list mailing list
> GiNaC-list at ginac.de
> https://www.cebix.net/mailman/listinfo/ginac-list
>


More information about the GiNaC-list mailing list