s = inverse2x2(A)
s = inverse3x3(A)
s = inverse4x4(A)

Invert multiple matrices of size 2x2, 3x3 or 4x4 at the same time.

Download 2x2
Download 3x3
Download 4x4

Example

# Test multiple 2x2 inversion
A = rand(2,2,1E6);
B = inverse2x2(A);
Test = B(:,:,1) - inv(A(:,:,1))

# Test multiple 3x3 inversion
A = rand(3,3,1E6);
B = inverse3x3(A);
Test = B(:,:,1) - inv(A(:,:,1))

# Test multiple 4x4 inversion
A = rand(4,4,1E6);
B = inverse4x4(A);
Test = B(:,:,1) - inv(A(:,:,1))

## === expected output ===

ans =

0 0
0 0

ans =

0 0 0
0 0 0
0 0 0

ans =

0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0


imprint