MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: CPU time for Solve under v.2.0 and 2.1

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Re: CPU time for Solve under v.2.0 and 2.1
  • From: withoff
  • Date: Wed, 18 Nov 92 11:37:15 CST

> Dear Dave,
> thanks for your prompt reply. Today I did further investigation about
> LinearSolve and Solve
> for a linear matrix equation solving. A new test matrix is a 8 x 8 sparse
> symmetric one.
> Here's my conclusion:
> 
> (1) v.2.1 always gives much longer expressions than v.2.0 does. In my 8 x 8
> matrix case,
> the length ratio is over 10 fold!!!
> 
> (2) So even though the CPU time only for Solve and LinearSolve may be a bit
> faster under v.2.1,
>     the total time including the following Cancel or Simplify operation is
> much longer
>     under v.2.1.
> 
> Is it possible to use v.2.0's Solve and LinearSolve under v.2.1
> Mathematica?
> The reason is the overall speed of v.2.1 except the Solve or LinearSolve
> looks much faster!
> 
> Regards,
> 
> Kiyoshi
> 
> *   Kiyoshi Yoda, Ph.D                *
> *   yoda at ele.crl.melco.co.jp          *

The differences you have seen between V2.0 and V2.1 are caused by a
change in the algorithm used to solve systems of symbolic linear
equations.  When the change was made it was believed that the V2.1
algorithm was better on average than the V2.0 algorithm.  Regardless
of whether or not that it true, it seems prudent in hindsight to
deal the fact that the V2.0 algorithm is sometimes better, perhaps
by including both algorithms in future releases.

I would very much like to see the matrices you are working with so I can
try them out in the latest development version of Mathematica and
determine if your concerns will be addressed in the next release.
(Perhaps you could send them to me directly -- withoff at wri.com).

While I have no doubt that your observations are correct, I'm not sure
I agree that Version 2.0 results are always better than Version 2.1
results.  Here is a sparse 8 x 8 matrix that I tried:

m = {{1, 0, 0, 0, 0, 0, 0, x}, {0, 1, 0, 0, z, 0, 0, 0}, 
   {0, 0, 1, y, 0, 0, 0, 0}, {0, 0, y, 1, 0, 0, 0, 0}, 
   {0, z, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0}, 
   {0, 0, 0, 0, 0, 0, 1, 0}, {x, 0, 0, 0, 0, 0, 0, 1}}

b = {1, 2, 3, 4, 5, 6, 7, 8}

--------------------------------------------------------------------

Version 2.0:

In[18]:= result = LinearSolve[m, b]; //Timing

Out[18]= {1.63333 Second, Null}

In[19]:= LeafCount[result]

Out[19]= 895

In[20]:= Cancel[result]; //Timing

Out[20]= {0.55 Second, Null}

In[21]:= Simplify[result] ; //Timing

Out[21]= {6.41667 Second, Null} 

---------------------------------------------------------------------

Version 2.1:

In[9]:= result = LinearSolve[m, b]; //Timing 

Out[9]= {0.2 Second, Null}

In[10]:= LeafCount[result]

Out[10]= 129

In[11]:= Cancel[result]; //Timing

Out[11]= {0.0833333 Second, Null}

In[14]:= Simplify[result] ; //Timing

Out[14]= {1.2 Second, Null}
 
----------------------------------------------------------------------

At least in this example, V2.1 is quite a bit better than V2.0.
(The Simplify-ed result is the same in both versions.)  Still, I
certainly agree that V2.0 is sometimes better, and that it would
be good to address this issue in upcoming releases.

Dave Withoff
WRI





  • Prev by Date: Save and big arrays
  • Next by Date: Re: Plotting problems
  • Previous by thread: Re: CPU time for Solve under v.2.0 and 2.1
  • Next by thread: Thinner lines by default in mma graphics?