First of all, I would like to say that the GiNaC package is great! I have used it a lot lately! Now, I am trying to solve a linear system, which consists of 18 equations and 18 variables. The matrix and right-hand side do not contain floating point numbers. I have done similar things with smaller matrices and I very much appreciate that GiNaC gives the solution in non-floating point numbers. However, in this concrete case (which is list below). GiNaC is not able to solve the system on my machine with 1 Gb RAM. It runs out of memory! It is of course possible to solve this linear system by using some other library, but it also seems a bit strange that a 18x18 matrix should be that hard to invert. The matrix is non-singular and non of the eigenvalues are "close to 0". The matrix and right-hand side are as follows: Matrix: [ [0,0,0,0,-1/5,0,0,0,0,0,0,0,0,0,-1/30,-1/10,0,0], [0,0,0,0,-1/20,0,0,0,0,0,0,0,0,0,-1/20,-1/15,0,0], [0,0,0,0,-1/30,0,0,0,0,0,0,0,0,0,-1/5,-1/10,0,0], [0,0,0,0,0,0,1/30,1/5,0,0,0,0,0,1/10,0,0,0,0], [0,0,0,0,0,0,1/20,1/20,0,0,0,0,0,1/15,0,0,0,0], [0,0,0,0,0,0,1/5,1/30,0,0,0,0,0,1/10,0,0,0,0], [1/30*sqrt(2),1/10*sqrt(2),0,0,1/30*sqrt(2),0,0,1/5*sqrt(2),1/10*sqrt(2),0,1/5*sqrt(2),1/30*sqrt(2),0,0,0,0,1/10*sqrt(2),1/5*sqrt(2)], [1/20*sqrt(2),1/15*sqrt(2),0,0,1/20*sqrt(2),0,0,1/20*sqrt(2),1/15*sqrt(2),0,1/20*sqrt(2),1/20*sqrt(2),0,0,0,0,1/15*sqrt(2),1/20*sqrt(2)], [1/5*sqrt(2),1/10*sqrt(2),0,0,1/5*sqrt(2),0,0,1/30*sqrt(2),1/10*sqrt(2),0,1/30*sqrt(2),1/5*sqrt(2),0,0,0,0,1/10*sqrt(2),1/30*sqrt(2)], [1/60,1/30,0,1/360,0,1/180,1/60,1/20,0,1/180,0,1/120,1/60,1/30,0,0,1/90,1/120], [1/20,1/30,0,1/180,0,1/60,1/60,1/60,0,1/180,0,1/30,1/30,1/60,0,0,1/60,1/180], [1/60,1/60,0,1/120,0,1/90,1/20,1/60,0,1/180,0,1/120,1/30,1/30,0,0,1/180,1/360], [0,0,1/30,1/180,1/60,1/180,0,0,1/30,1/60,1/20,1/180,0,0,1/60,1/60,1/60,1/30], [0,0,1/60,1/360,1/20,1/180,0,0,1/30,1/180,1/60,1/120,0,0,1/60,1/30,1/90,1/120], [0,0,1/30,1/120,1/60,1/180,0,0,1/60,1/90,1/60,1/360,0,0,1/20,1/30,1/180,1/120], [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,-2,0,0,0,0,0,2,0,0,0,0,0,0,0,0], [0,0,0,-2,0,2,0,0,0,0,0,0,0,0,0,0,0,0]] rhs: [[1],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]] Kent-Andre Mardal Simula Research Laboratory
Hello! On Wed, Dec 14, 2005 at 11:22:55AM +0100, Kent-Andre Mardal wrote:
Now, I am trying to solve a linear system, which consists of 18 equations and 18 variables. The matrix and right-hand side do not contain floating point numbers.
I have done similar things with smaller matrices and I very much appreciate that GiNaC gives the solution in non-floating point numbers. However, in this concrete case (which is list below). GiNaC is not able to solve the system on my machine with 1 Gb RAM. It runs out of memory!
[snipped]
The matrix and right-hand side are as follows:
Matrix: [ [0,0,0,0,-1/5,0,0,0,0,0,0,0,0,0,-1/30,-1/10,0,0], [0,0,0,0,-1/20,0,0,0,0,0,0,0,0,0,-1/20,-1/15,0,0], [0,0,0,0,-1/30,0,0,0,0,0,0,0,0,0,-1/5,-1/10,0,0], [0,0,0,0,0,0,1/30,1/5,0,0,0,0,0,1/10,0,0,0,0], [0,0,0,0,0,0,1/20,1/20,0,0,0,0,0,1/15,0,0,0,0], [0,0,0,0,0,0,1/5,1/30,0,0,0,0,0,1/10,0,0,0,0], [1/30*sqrt(2),1/10*sqrt(2),0,0,1/30*sqrt(2),0,0,1/5*sqrt(2),1/10*sqrt(2),0,1/5*sqrt(2),1/30*sqrt(2),0,0,0,0,1/10*sqrt(2),1/5*sqrt(2)], [1/20*sqrt(2),1/15*sqrt(2),0,0,1/20*sqrt(2),0,0,1/20*sqrt(2),1/15*sqrt(2),0,1/20*sqrt(2),1/20*sqrt(2),0,0,0,0,1/15*sqrt(2),1/20*sqrt(2)], [1/5*sqrt(2),1/10*sqrt(2),0,0,1/5*sqrt(2),0,0,1/30*sqrt(2),1/10*sqrt(2),0,1/30*sqrt(2),1/5*sqrt(2),0,0,0,0,1/10*sqrt(2),1/30*sqrt(2)], [1/60,1/30,0,1/360,0,1/180,1/60,1/20,0,1/180,0,1/120,1/60,1/30,0,0,1/90,1/120], [1/20,1/30,0,1/180,0,1/60,1/60,1/60,0,1/180,0,1/30,1/30,1/60,0,0,1/60,1/180], [1/60,1/60,0,1/120,0,1/90,1/20,1/60,0,1/180,0,1/120,1/30,1/30,0,0,1/180,1/360], [0,0,1/30,1/180,1/60,1/180,0,0,1/30,1/60,1/20,1/180,0,0,1/60,1/60,1/60,1/30], [0,0,1/60,1/360,1/20,1/180,0,0,1/30,1/180,1/60,1/120,0,0,1/60,1/30,1/90,1/120], [0,0,1/30,1/120,1/60,1/180,0,0,1/60,1/90,1/60,1/360,0,0,1/20,1/30,1/180,1/120], [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,-2,0,0,0,0,0,2,0,0,0,0,0,0,0,0], [0,0,0,-2,0,2,0,0,0,0,0,0,0,0,0,0,0,0]] rhs: [[1],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]]
Try passing solve_algo::gauss as third argument to matrix::solve, e.g. matrix result = m.solve(vars, rhs, solve_algo::gauss); Best regards, Alexei -- All science is either physics or stamp collecting.
ons, 14,.12.2005 kl. 21.03 +0300, skrev Sheplyakov Alexei:
Hello!
On Wed, Dec 14, 2005 at 11:22:55AM +0100, Kent-Andre Mardal wrote:
Now, I am trying to solve a linear system, which consists of 18 equations and 18 variables. The matrix and right-hand side do not contain floating point numbers.
I have done similar things with smaller matrices and I very much appreciate that GiNaC gives the solution in non-floating point numbers. However, in this concrete case (which is list below). GiNaC is not able to solve the system on my machine with 1 Gb RAM. It runs out of memory!
[snipped]
The matrix and right-hand side are as follows:
Matrix: [ [0,0,0,0,-1/5,0,0,0,0,0,0,0,0,0,-1/30,-1/10,0,0], [0,0,0,0,-1/20,0,0,0,0,0,0,0,0,0,-1/20,-1/15,0,0], [0,0,0,0,-1/30,0,0,0,0,0,0,0,0,0,-1/5,-1/10,0,0], [0,0,0,0,0,0,1/30,1/5,0,0,0,0,0,1/10,0,0,0,0], [0,0,0,0,0,0,1/20,1/20,0,0,0,0,0,1/15,0,0,0,0], [0,0,0,0,0,0,1/5,1/30,0,0,0,0,0,1/10,0,0,0,0], [1/30*sqrt(2),1/10*sqrt(2),0,0,1/30*sqrt(2),0,0,1/5*sqrt(2),1/10*sqrt(2),0,1/5*sqrt(2),1/30*sqrt(2),0,0,0,0,1/10*sqrt(2),1/5*sqrt(2)], [1/20*sqrt(2),1/15*sqrt(2),0,0,1/20*sqrt(2),0,0,1/20*sqrt(2),1/15*sqrt(2),0,1/20*sqrt(2),1/20*sqrt(2),0,0,0,0,1/15*sqrt(2),1/20*sqrt(2)], [1/5*sqrt(2),1/10*sqrt(2),0,0,1/5*sqrt(2),0,0,1/30*sqrt(2),1/10*sqrt(2),0,1/30*sqrt(2),1/5*sqrt(2),0,0,0,0,1/10*sqrt(2),1/30*sqrt(2)], [1/60,1/30,0,1/360,0,1/180,1/60,1/20,0,1/180,0,1/120,1/60,1/30,0,0,1/90,1/120], [1/20,1/30,0,1/180,0,1/60,1/60,1/60,0,1/180,0,1/30,1/30,1/60,0,0,1/60,1/180], [1/60,1/60,0,1/120,0,1/90,1/20,1/60,0,1/180,0,1/120,1/30,1/30,0,0,1/180,1/360], [0,0,1/30,1/180,1/60,1/180,0,0,1/30,1/60,1/20,1/180,0,0,1/60,1/60,1/60,1/30], [0,0,1/60,1/360,1/20,1/180,0,0,1/30,1/180,1/60,1/120,0,0,1/60,1/30,1/90,1/120], [0,0,1/30,1/120,1/60,1/180,0,0,1/60,1/90,1/60,1/360,0,0,1/20,1/30,1/180,1/120], [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,-2,0,0,0,0,0,2,0,0,0,0,0,0,0,0], [0,0,0,-2,0,2,0,0,0,0,0,0,0,0,0,0,0,0]] rhs: [[1],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0],[0]]
Try passing solve_algo::gauss as third argument to matrix::solve, e.g.
matrix result = m.solve(vars, rhs, solve_algo::gauss);
This does not help. Kent-Andre Mardal Simula Research Laboratory
tor, 15,.12.2005 kl. 23.41 +0300, skrev Sheplyakov Alexei:
Hello,
Try passing solve_algo::gauss as third argument to matrix::solve, e.g.
matrix result = m.solve(vars, rhs, solve_algo::gauss);
This does not help.
Could you please post the actual code which has this problem?
Hi, I am not able to give you the code (or that would involve downloading and kompiling the library SyFi which I guess you do not want.) I have tried to make a simpler example by printing out the matrix and then read it into another program. But then GiNaC solves the system in no time, but the solution is in floating point numbers. Even though I have created each entry in the matrix as a numeric. Kent-Andre Mardal Simula Research Laboratory
Hello, On Fri, Dec 16, 2005 at 01:22:50PM +0100, Kent-Andre Mardal wrote:
Could you please post the actual code which has this problem?
I am not able to give you the code
Well, let's try the other way around. Attached program (which calculates the inverse of your matrix) seems to Work for me (TM). ginac-config --version 1.3.3 g++ --version g++ (GCC) 4.0.3 20051201 (prerelease) (Debian 4.0.2-5) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. N.B. Passing solve_algo::gauss is essential, so GiNaC heuristics _does_ need to be improved. So, I'd like to see an example (minimal) which demonstrates the problem you have mentioned.
(or that would involve downloading and kompiling the library SyFi which I guess you do not want.)
Why not? -- All science is either physics or stamp collecting.
Hi, This works! Thanks! Kent-Andre Mardal Simula Research Laboratory. fre, 16,.12.2005 kl. 17.10 +0300, skrev Sheplyakov Alexei:
Hello,
On Fri, Dec 16, 2005 at 01:22:50PM +0100, Kent-Andre Mardal wrote:
Could you please post the actual code which has this problem?
I am not able to give you the code
Well, let's try the other way around.
Attached program (which calculates the inverse of your matrix) seems to Work for me (TM).
ginac-config --version 1.3.3 g++ --version g++ (GCC) 4.0.3 20051201 (prerelease) (Debian 4.0.2-5) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
N.B. Passing solve_algo::gauss is essential, so GiNaC heuristics _does_ need to be improved.
So, I'd like to see an example (minimal) which demonstrates the problem you have mentioned.
(or that would involve downloading and kompiling the library SyFi which I guess you do not want.)
Why not?
_______________________________________________ GiNaC-list mailing list GiNaC-list@ginac.de https://www.cebix.net/mailman/listinfo/ginac-list
participants (2)
-
Kent-Andre Mardal
-
varg@theor.jinr.ru