det3

PURPOSE ^

DET3 Parallel determinant for 3x3 matrices

SYNOPSIS ^

function D = det3(a)

DESCRIPTION ^

DET3  Parallel determinant for 3x3 matrices
  D = DET3(A) calculates the determinant for each 3 rows of A. A must be 
  3N x 3. D is N x 1, such that
    D(i) = det( A( 3*(i-1)+(1:3) , 1:3 ) )
 but it is calculated faster.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function D = det3(a)
0002 %DET3  Parallel determinant for 3x3 matrices
0003 %  D = DET3(A) calculates the determinant for each 3 rows of A. A must be
0004 %  3N x 3. D is N x 1, such that
0005 %    D(i) = det( A( 3*(i-1)+(1:3) , 1:3 ) )
0006 % but it is calculated faster.
0007 
0008 % (C) 2013 Bartlomiej Grychtol. License: GPL version 2 or 3.
0009 % $Id: det3.m 4260 2013-06-24 15:17:15Z aadler $
0010 ln = size(a,1);
0011 c1 = 1:3:ln;
0012 c2 = 2:3:ln;
0013 c3 = 3:3:ln;
0014 D = a(c1,1).*a(c2,2).*a(c3,3) + ...
0015     a(c2,1).*a(c3,2).*a(c1,3) + ...
0016     a(c3,1).*a(c1,2).*a(c2,3) - ...
0017     a(c3,1).*a(c2,2).*a(c1,3) - ...
0018     a(c2,1).*a(c1,2).*a(c3,3) - ...
0019     a(c1,1).*a(c3,2).*a(c2,3);

Generated on Fri 30-Dec-2022 19:44:54 by m2html © 2005