f | def det4(r0, r1, r2, r3): | f | def det4(r0, r1, r2, r3): |
| | | |
t | def determ3(r1, r2, r3): | t | def det3(r1, r2, r3): |
| perm = [(1, 2, 3), (0, 2, 3), (0, 1, 3), (0, 1, 2)] | | lst = [(1, 2, 3), (0, 2, 3), (0, 1, 3), (0, 1, 2)] |
| count = [] | | dets3 = [] |
| for k in perm: | | for l in lst: |
| count.append(r1[k[0]] * (r2[k[1]] * r3[k[2]] - r2[k[2]] * r3[k[1]]) - r1[k[1]] * (r2[k[0]] * r3[k[2]] - r2[k[2]] * r3[k[0]]) + r1[k[2]] * (r2[k[0]] * r3[k[1]] - r2[k[1]] * r3[k[0]])) | | dets3.append(r1[l[0]] * (r2[l[1]] * r3[l[2]] - r2[l[2]] * r3[l[1]]) - r1[l[1]] * (r2[l[0]] * r3[l[2]] - r2[l[2]] * r3[l[0]]) + r1[l[2]] * (r2[l[0]] * r3[l[1]] - r2[l[1]] * r3[l[0]])) |
| return count | | return dets3 |
| fun = determ3(r1, r2, r3) | | res = det3(r1, r2, r3) |
| det = r0[0] * fun[0] - r0[1] * fun[1] + r0[2] * fun[2] - r0[3] * fun[3] | | determinant = r0[0] * res[0] - r0[1] * res[1] + r0[2] * res[2] - r0[3] * res[3] |
| return det | | return determinant |