Apply rat() to every single thing



I am not surprised that what you did was ineffective. You did not run rat on
any element of m.
Try doing
m[1,1]:rat(m[1,1])

And then nullspace(m).

Generally converting one element to a rat form is enough because it is
"contagious".
But if that doesn't speed it up you could also convert each of the element
by a mapping function or a "for" loop.
For i:1 thru n do for j:1 thru n do m[i,j]:rat(m[i,j]);

RJF
PS, what you did was rename m as a polynomial in a new variable, call it V.
The polynomial is the rational form 1+V^1+0.  V is the same matrix as
before.

 

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu 
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of ptomaine
> Sent: Sunday, May 13, 2007 7:26 AM
> To: Stavros Macrakis
> Cc: maxima at math.utexas.edu
> Subject: Re: [Maxima] Apply rat() to every single thing
> 
> On 5/13/07, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> > As Barton suggested, try
> >
> >   ratmx : true$
> >   nullspace(rat(m))$
> 
> Nope, that doesn't help. I waited for ~10 minutes then 
> canceled. Same for
> triangularize(rat(m)).
> 
> > If your version of triangularize faster than the built-in 
> one, perhaps you
> > should contribute it to Maxima so that others can benefit 
> from it....  Is it
> > tuned specially for the sparse case?
> 
> No, it is not. It's a general Gaussian procedure.
> 
> Here is my code ( R is the 243x270 matrix, type trig(); to 
> triangularize it )
> 
> /**************************/
> nr : length(R);
> nc : length(first(R));
> 
> swap_rows(n,m) := block(
>        tmp : R[n],
>        R[n] : R[m],
>        R[m] : tmp
>    );
> 
> trig_step(n,m) := block(
>    /* Find nonzero element */
>    i:n,
>    for j:n thru nr do
>        if R[j,m] # 0 then
>            return(0)
>        else
>            i:i+1,
>    /* Return if there is no nonzero element */
>    if i = nr+1 then
>        return(0),
>    /* Swap rows */
>    swap_rows(n,i),
>    /* Modify rows */
>    for j:n+1 thru nr do
>        if R[j,m] # 0 then
>                    R[j] : rat(R[j] - R[n] * ( R[j,m] / R[n,m] )),
>    return(1)
>    );
> 
> trig() := block(
>    l:1,
>    for k:1 thru min(nc,nr) do block(
>        if trig_step(l,k) # 0 then
>            l:l+1,
>        display(k,l)
>        )
>    );
> /**************************/
> 
> If I change
>       R[j] : rat(R[j] - R[n] * ( R[j,m] / R[n,m] ))
> to
>       R[j] : R[j] - R[n] * ( R[j,m] / R[n,m] )
> then my procedure is very slow too.
> 
> I also uploaded my matrix dumped with write_data(), so you could see
> the speedup(load it with read_matrix()). According to timer_info() it
> takes 187.17 sec with rat.
> 
> http://gusevfe.googlepages.com/matrix(1)
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>