We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0cd325a commit 3fbb854Copy full SHA for 3fbb854
src/inv.jl
@@ -7,9 +7,10 @@ end
7
@inline _inv(::Size{(1,1)}, A, S::Type) = inv(A[1])
8
9
@inline function _inv(::Size{(2,2)}, A, S::Type)
10
- newtype = similar_type(A, S)
11
- d = det(A)
12
- @inbounds return newtype((A[4]/d, -(A[2]/d), -(A[3]/d), A[1]/d))
+ newtype = similar_type(A,S)
+ A = newtype(A)
+ idet = 1/det(A)
13
+ @inbounds return newtype((A[4]*idet, -(A[2]*idet), -(A[3]*idet), A[1]*idet))
14
end
15
16
@inline function _inv(::Size{(3,3)}, A,S::Type)
0 commit comments