LCOV - code coverage report
Current view: top level - math - inv3.f (source / functions) Hit Total Coverage
Test: combined.info Lines: 12 24 50.0 %
Date: 2019-09-08 04:53:50 Functions: 1 2 50.0 %

          Line data    Source code
       1             :       MODULE m_inv3
       2             : !-----------------------------------
       3             : !     invert 3x3 matrix
       4             : !-----------------------------------
       5             : 
       6             :       PRIVATE
       7             : 
       8             :       INTERFACE inv3
       9             :         MODULE PROCEDURE inv3i,inv3r
      10             :       END INTERFACE
      11             : 
      12             :       PUBLIC :: inv3
      13             : 
      14             :       CONTAINS
      15         132 :       SUBROUTINE inv3r(a,b,d)
      16             : 
      17             :       IMPLICIT NONE
      18             : C     ..
      19             : C     .. Arguments ..
      20             :       REAL, INTENT (IN)  :: a(3,3)
      21             :       REAL, INTENT (OUT) :: b(3,3)  ! inverse matrix
      22             :       REAL, INTENT (OUT) :: d       ! determinant
      23             : C     ..
      24             :       d = a(1,1)*a(2,2)*a(3,3) + a(1,2)*a(2,3)*a(3,1) +
      25             :      +    a(2,1)*a(3,2)*a(1,3) - a(1,3)*a(2,2)*a(3,1) -
      26         132 :      +    a(2,3)*a(3,2)*a(1,1) - a(2,1)*a(1,2)*a(3,3)
      27         132 :       b(1,1) = (a(2,2)*a(3,3)-a(2,3)*a(3,2))/d
      28         132 :       b(1,2) = (a(1,3)*a(3,2)-a(1,2)*a(3,3))/d
      29         132 :       b(1,3) = (a(1,2)*a(2,3)-a(2,2)*a(1,3))/d
      30         132 :       b(2,1) = (a(2,3)*a(3,1)-a(2,1)*a(3,3))/d
      31         132 :       b(2,2) = (a(1,1)*a(3,3)-a(3,1)*a(1,3))/d
      32         132 :       b(2,3) = (a(1,3)*a(2,1)-a(1,1)*a(2,3))/d
      33         132 :       b(3,1) = (a(2,1)*a(3,2)-a(2,2)*a(3,1))/d
      34         132 :       b(3,2) = (a(1,2)*a(3,1)-a(1,1)*a(3,2))/d
      35         132 :       b(3,3) = (a(1,1)*a(2,2)-a(1,2)*a(2,1))/d
      36             : 
      37         132 :       END SUBROUTINE inv3r
      38             : 
      39           0 :       SUBROUTINE inv3i(a,b,d)
      40             : 
      41             :       IMPLICIT NONE
      42             : C     ..
      43             : C     .. Arguments ..
      44             :       INTEGER, INTENT (IN)  :: a(3,3)
      45             :       INTEGER, INTENT (OUT) :: b(3,3)  ! inverse matrix
      46             :       INTEGER, INTENT (OUT) :: d       ! determinant
      47             : C     ..
      48             :       d = a(1,1)*a(2,2)*a(3,3) + a(1,2)*a(2,3)*a(3,1) +
      49             :      +    a(2,1)*a(3,2)*a(1,3) - a(1,3)*a(2,2)*a(3,1) -
      50           0 :      +    a(2,3)*a(3,2)*a(1,1) - a(2,1)*a(1,2)*a(3,3)
      51           0 :       b(1,1) = (a(2,2)*a(3,3)-a(2,3)*a(3,2))/d
      52           0 :       b(1,2) = (a(1,3)*a(3,2)-a(1,2)*a(3,3))/d
      53           0 :       b(1,3) = (a(1,2)*a(2,3)-a(2,2)*a(1,3))/d
      54           0 :       b(2,1) = (a(2,3)*a(3,1)-a(2,1)*a(3,3))/d
      55           0 :       b(2,2) = (a(1,1)*a(3,3)-a(3,1)*a(1,3))/d
      56           0 :       b(2,3) = (a(1,3)*a(2,1)-a(1,1)*a(2,3))/d
      57           0 :       b(3,1) = (a(2,1)*a(3,2)-a(2,2)*a(3,1))/d
      58           0 :       b(3,2) = (a(1,2)*a(3,1)-a(1,1)*a(3,2))/d
      59           0 :       b(3,3) = (a(1,1)*a(2,2)-a(1,2)*a(2,1))/d
      60             : 
      61           0 :       END SUBROUTINE inv3i
      62             :       END MODULE m_inv3

Generated by: LCOV version 1.13