# [GiNaC-list] Bug? Segmentation while inverting a matrix

jmt jmt at dxdydz.net
Sun Jan 7 19:08:39 CET 2018

```Hi,

For the sake of consistency, I've copied your matrix in python sympy
and got the following result for the inverse of A :

Matrix([
[       gm/(gm/R2 + gm/R1), 0,  0,  0,        -R1*(gm*(gm/R2 + gm/R1) -
gm**2/R2)/(gm*(gm/R2 + gm/R1)),        gm/(gm/R2 + gm/R1),  0,  0,
-R1*(-gm*(gm/R2 + gm/R1)/R1 + gm**2/(R1*R2))/(gm*(gm/R2 + gm/R1))],
[                        0, 0,  0,
0,
0,                         0,  0,
0,                                                                 1],
[ Ro*gm**2/(gm/R2 + gm/R1), 0, Ro,  0,          R1*Ro*(-gm*(gm/R2 +
gm/R1) + gm**2/R2)/(gm/R2 + gm/R1),  Ro*gm**2/(gm/R2 + gm/R1), Ro,
0,                                    -Ro*gm**2/(R2*(gm/R2 + gm/R1))],
[-Rs*gm**2/(gm/R2 + gm/R1), 0,  0, Rs, -R1*Rs*(-gm**2*(gm/R2 + gm/R1) +
gm**3/R2)/(gm*(gm/R2 + gm/R1)), -Rs*gm**2/(gm/R2 + gm/R1),  0,
Rs,                                     Rs*gm**2/(R2*(gm/R2 + gm/R1))],
[ -gm/(R1*(gm/R2 + gm/R1)), 0,  0,
0,                                        -gm/(R2*(gm/R2 + gm/R1)),
-gm/(R1*(gm/R2 + gm/R1)),  0,
0,                                        gm/(R1*R2*(gm/R2 + gm/R1))],
[-gm/(R2*(-gm/R2 - gm/R1)), 0,  0,
0,                                        gm/(R2*(-gm/R2 - gm/R1)),
gm/(R1*(-gm/R2 - gm/R1)),  0,  0,
-gm/(R1*R2*(-gm/R2 - gm/R1))], [    gm**2/(gm/R2 + gm/R1), 0,  1,
0,             R1*(-gm*(gm/R2 + gm/R1) + gm**2/R2)/(gm/R2 + gm/R1),
gm**2/(gm/R2 + gm/R1),  0,  0,
-gm**2/(R2*(gm/R2 + gm/R1))], [   -gm**2/(gm/R2 + gm/R1), 0,  0,  1,
-R1*(-gm**2*(gm/R2 + gm/R1) + gm**3/R2)/(gm*(gm/R2 + gm/R1)),
-gm**2/(gm/R2 + gm/R1),  0,  0,
gm**2/(R2*(gm/R2 + gm/R1))], [  gm/(R1*(gm/R2 + gm/R1)), 1,  0,
0,                                         gm/(R2*(gm/R2 + gm/R1)),
gm/(R1*(gm/R2 + gm/R1)),  0,  0,
-gm/(R1*R2*(gm/R2 + gm/R1))]])

Seems to me there is a bug somewhere in GiNaC.

jmt

On Sun, 07 Jan 2018 17:08:18 +0100
Patrick Schulz <pschulz at posteo.de> wrote:

> Hi,
>
> i'm getting a segmentation fault while inverting a matrix (the matrix
> itself is invertable, i checked with the symbolic package for
> octave). Can anyone give me some pointers why this is happening? Is
> the matrix ill-formed in some way or is this a bug?
>
> I'm running archlinux (Kernel 4.14.12), my compiler is g++ 7.2.1, the
> GiNaC version i'm using is 1.7.2.
>
> Attached is a sample listing which produces the error (at least on my
> system).
>
> Greetings,
> Patrick

--

Jean-Marie Thomas

http://www.dxdydz.net
```