Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[apple scitech] Determinant algorithm



Daniel Farrell,

There is a way to effect a 4x4 determinant in 40 muls.
Let us assume a matrix

        double a[4][4];

whence, one simply calculates

	det = a[0][0] * F(1, 2, 3) - a[1][0] * F(0, 2, 3) +
		  a[2][0] * F(0, 1, 3) - a[3][0] * F(0, 1, 2);

where the function F is:

double
F(int x, int y, int z) {
return(
	a[x][1] * (a[y][2] * a[z][3] - a[z][2] * a[y][3]) +
	a[y][1] * (a[z][2] * a[x][3] - a[z][3] * a[x][2]) +
	a[z][1] * (a[x][2] * a[y][3] - a[x][3] * a[y][2])
);
}

I am sure there are clever ways to reduce the ops yet further;
in fact the F-function here suggests such (e.g., the product a[2] [2]*a[3][3]
happens more than once, overall). Plus, the excellent suggestion appearing
before on this scitech list---namely to invoke pivoting even at 4x4---
also might apply to the optimization of the F-function.


Richard Crandall
Advanced Computation Group



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Scitech mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/scitech/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.