       Re: Dependence of precision on execution speed of Inverse

• To: mathgroup at smc.vnet.net
• Subject: [mg81615] Re: Dependence of precision on execution speed of Inverse
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Sat, 29 Sep 2007 02:31:09 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <fdi5li\$q8j\$1@smc.vnet.net>

```Andrew Moylan wrote:
> m1=RandomReal[1,{50,50}];
> m2=SetPrecision[m1,14];
> Do[Inverse[m1];,{1500}]//Timing
> Do[Inverse[m2];,{10}]//Timing
>
> On my machine, both Timing results are about the same, indicating that
> Inverse (of 50x50 matrices) is about 150 times faster for machine-precision
> numbers than for arbitrary precision numbers (of precision ~14). This factor
> of 150 seems large. Does Mathematica employ an Inverse algorithm that is
> optimised for Mathematica's arbitrary-precision numbers?
>
> Notes:
> * Changing the precision of m2 from 14 to e.g. 17 makes little difference.
> * Calling Developer`FromPackedArray[] on m1 makes little difference.
> * Calling LinearSolve on Inverse yields somewhat different results, but
> still shows a difference in execution time of a factor of order 100.

FWIW,

On my system, machine-precision inversion seems to be 192 times faster
than the arbitrary precision.

In:= m1 = RandomReal[1, {50, 50}];
m2 = SetPrecision[m1, 14];
Do[Inverse[m1];, {1500}] // Timing
Do[Inverse[m2];, {10}] // Timing

Out= {0.843, Null}

Out= {1.078, Null}

In:= %%[]/1500

Out= 0.000562

In:= %%[]/10

Out= 0.1078

In:= %/%%

Out= 191.815

In:= m1 = RandomReal[1, {50, 50}];
m2 = SetPrecision[m1, 14];
Do[Inverse[m1];, {1920}] // Timing
Do[Inverse[m2];, {10}] // Timing

Out= {1.11, Null}

Out= {1.11, Null}

In:= \$Version

Out= "6.0 for Microsoft Windows (32-bit) (June 19, 2007)"

--
Jean-Marc

```

• Prev by Date: Re: Any Mathematica 6 book yet?
• Next by Date: Re: Simplification with subscripted variables and anonymous functions
• Previous by thread: Re: Dependence of precision on execution speed of Inverse
• Next by thread: Alignment matrix Output