Determinant function in Mathematica
- To: mathgroup <mathgroup at yoda.physics.unc.edu>
- Subject: Determinant function in Mathematica
- From: HAY at leicester.ac.uk
- Date: Sat, 18 APR 92 11:35:30 GMT
Here's a speed up of my earlier code; obtained by exploiting Transpose
better. The moral seems to be to work globally on large list constructions-
Think big I guess.
NewDet2[M_] :=
Plus@@Times@@(
Append[Transpose[Transpose[M[[#]]&/@#,{1,2,2}]],Signature/@#]&@
Permutations[Range[Length[M]]]
)
The timings on my MacIIfx are
a[n_] := Table[ StringJoin["a",ToString[i],ToString[j]], {i,1,n},{j,1,n}]
Do[ Print[ First[ Timing[ NewDet2[ a[t]]]]], {t,1,7}]
0.0666667 Second
0.0833333 Second
0.133333 Second
0.283333 Second
0.933333 Second
5.13333 Second
38.1833 Second
The timings for the previous form (NewDet) were
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
From
Allan Hayes
Department of Mathematics
The University
Leicester LE1 7RH
U.K.
hay at leicester.ac.uk