Bugs and strange behaviours of Maxima with ratmx and sparse set to true
Subject: Bugs and strange behaviours of Maxima with ratmx and sparse set to true
From: Stefano Ferri
Date: Thu, 29 Jan 2009 02:45:04 +0100
Barton Willis ha scritto:
>
>
> Maybe you have already solved your problem; for what it is worth, I'd try
> something like:
>
> (%i19) algebraic : true$
> (%i20) ratmx : true$
>
> (%i21) KT : triangularize(K)$
> Evaluation took 0.2900 seconds (0.2900 elapsed)
>
>
>
> Barton
>
>
I have implemented in my program what you suggested... Sorry I don't
know why I thought gaussian elimination could not be better than
inversion... The code to solve K*u=f now is this:
algebraic : true$
ratmx : true$
ugauss : zeromatrix(nVars,1) $
KT : triangularize(addcol(K,f)) $
ugauss[nVars,1] : KT[nVars,nVars+1]/KT[nVars,nVars];
for i:nVars-1 step -1 thru 1 do (
temp : 0,
for j:nVars step -1 thru i+1 do (
temp : temp + KT[i,j]*ugauss[j,1]
),
ugauss[i,1] : (KT[i,nVars+1] - temp)/KT[i,i]
)$
This set of instructions takes 3.97 seconds and 18.9 MB to be evaluated,
while u : K^^-1 . f takes 4.33 seconds and 29.316 MB. The difference is
small, but anyway it is a better optimized code and it could be useful
with matrices of very high order.
PS: I don't know how triangularize works, but could exist a way to
improve its performances with sparse matrices?
Stefano