Re: Determinant function in Mathematica
- To: mathgroup <mathgroup at yoda.physics.unc.edu>
- Subject: Re: Determinant function in Mathematica
- From: HAY at leicester.ac.uk
- Date: Thu, 16 APR 92 19:08:25 GMT
Here's some quicker V2.0 code (though it is still looks to less than 2/3 the
speed of Det in Version 1.2 - I don't have a copy of V1.2 to hand to check this
}.
NewDet[M_] :=
Plus@@Times@@(
Append[Transpose[Transpose[M[[#]],{1,1}]&/@#],Signature/@#]&@
Permutations[Range[Length[M]]]
)
Transpose[M,{1,1}] is very quick at extracting the diagonal of M.
Here are the timimgs on a Mac IIfx using Oliver Gloor's tests
a[n_] := Table[ StringJoin["a",ToString[i],ToString[j]], {i,1,n},{j,1,n}]
Do[ Print[ First[ Timing[ NewDet[ a[t]]]]], {t,1,7}]
0.25 Second
0.0833333 Second
0.15 Second
0.3 Second
1.06667 Second
5.91667 Second
43.9333 Second
Using the system Det I get
Do[ Print[ First[ Timing[ Det[ a[t]]]]], {t,1,7}]
0.2 Second
0.633333 Second
0.883333 Second
2.01667 Second
13.5 Second
199.317 Second
$Aborted
For a DEC Risc larry reported the following timings for Det.
0.0166667 Second
0.0666667 Second
0.266667 Second
1. Second
5.76667 Second
70.65 Second
Interrupt> a
[Sorry, I couldn't afford the 45 minutes!]
BUT on the same machine with Version 1.2 he gets much shorter times
0.
0.0166667 Second
0.0166667 Second
0.0666667 Second
0.216667 Second
1.25 Second
9.78333 Second
From
Allan Hayes
Department of Mathematics
The University
Leicester LE1 7RH
U.K.
hay at leicester.ac.uk