[GiNaC-list] solving linear systems with ginac

Sheplyakov Alexei varg at theor.jinr.ru
Wed Dec 14 19:03:36 CET 2005


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-list/attachments/20051214/5fbd2dd1/attachment.pgp


More information about the GiNaC-list mailing list