def determinant(a):
    if shape(a) == (2, 2):
        return a[0, 0] * a[1, 1] - a[0, 1] * a[1, 0]
    elif shape(a) == (3, 3):
        return a[0,0]*(a[1,1]*a[2,2]-a[2,1]*a[1,2]) + \
               a[1,0]*(a[2,1]*a[0,2]-a[0,1]*a[2,2]) + \
            a[2,0]*(a[0,1]*a[1,2]+a[1,1]*a[0,2])
    return linear_algebra.determinant(a)
def determinant(a):
	if shape(a) == (2,2):
		return a[0,0]*a[1,1] - a[0,1]*a[1,0]
	elif shape(a) == (3,3):
		return a[0,0]*(a[1,1]*a[2,2]-a[2,1]*a[1,2]) + \
		       a[1,0]*(a[2,1]*a[0,2]-a[0,1]*a[2,2]) + \
			   a[2,0]*(a[0,1]*a[1,2]+a[1,1]*a[0,2])
	return linear_algebra.determinant(a)
Example #3
0
def tet_volume(tet, points):
    p1 = points[tet[0]]
    p2 = points[tet[1]]
    p3 = points[tet[2]]
    p4 = points[tet[3]]

    a = [[p2[0] - p1[0], p3[0] - p1[0], p4[0] - p1[0]],
         [p2[1] - p1[1], p3[1] - p1[1], p4[1] - p1[1]],
         [p2[2] - p1[2], p3[2] - p1[2], p4[2] - p1[2]]]

    det = la.determinant(a)
    return det / 6.0
Example #4
0
 def determinant(self):
     """Computes the determinant of the matrix."""
     return LinearAlgebra.determinant(self)
Example #5
0
 def determinant(self):
     """Computes the determinant of the matrix."""
     return LinearAlgebra.determinant(self)