# PetIGA / src / petigainv.f90.in

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53``` ```! -*- f90 -*- pure function Determinant(dim,A) result (detA) use PetIGA implicit none integer(kind=IGA_INTEGER_KIND), intent(in) :: dim real (kind=IGA_REAL_KIND ), intent(in) :: A(dim,dim) real (kind=IGA_REAL_KIND ) :: detA select case (dim) case (1) detA = A(1,1) case (2) detA = + A(1,1)*A(2,2) - A(2,1)*A(1,2) case (3) detA = + A(1,1) * ( A(2,2)*A(3,3) - A(3,2)*A(2,3) ) & - A(2,1) * ( A(1,2)*A(3,3) - A(3,2)*A(1,3) ) & + A(3,1) * ( A(1,2)*A(2,3) - A(2,2)*A(1,3) ) case default detA = 0 end select end function Determinant pure function Inverse(dim,detA,A) result (invA) use PetIGA implicit none integer(kind=IGA_INTEGER_KIND), intent(in) :: dim real (kind=IGA_REAL_KIND ), intent(in) :: detA real (kind=IGA_REAL_KIND ), intent(in) :: A(dim,dim) real (kind=IGA_REAL_KIND ) :: invA(dim,dim) select case (dim) case (1) invA = 1/detA case (2) invA(1,1) = + A(2,2) invA(2,1) = - A(2,1) invA(1,2) = - A(1,2) invA(2,2) = + A(1,1) invA = invA/detA case (3) invA(1,1) = + A(2,2)*A(3,3) - A(2,3)*A(3,2) invA(2,1) = - A(2,1)*A(3,3) + A(2,3)*A(3,1) invA(3,1) = + A(2,1)*A(3,2) - A(2,2)*A(3,1) invA(1,2) = - A(1,2)*A(3,3) + A(1,3)*A(3,2) invA(2,2) = + A(1,1)*A(3,3) - A(1,3)*A(3,1) invA(3,2) = - A(1,1)*A(3,2) + A(1,2)*A(3,1) invA(1,3) = + A(1,2)*A(2,3) - A(1,3)*A(2,2) invA(2,3) = - A(1,1)*A(2,3) + A(1,3)*A(2,1) invA(3,3) = + A(1,1)*A(2,2) - A(1,2)*A(2,1) invA = invA/detA case default invA = 0 end select end function Inverse ```
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.