! -----------------------------------------------------------------------------
! -- 
! -- 
! -----------------------------------------------------------------------------

MODULE main_mod

PUBLIC :: System_Size, Get_Coeffs, Get_RHS

CONTAINS

! -----------------------------------------------------------------------------

FUNCTION System_Size() RESULT(size)
  REAL :: size

  size = 3

END FUNCTION System_Size

! -----------------------------------------------------------------------------

SUBROUTINE Get_Coeffs(coeffs) 
  REAL, INTENT(INOUT), DIMENSION(:,:) :: coeffs
  INTEGER :: n, i, j

  ! -- get size n and read in n numbers for rhs of Ax = b :
  n = SIZE(coeffs,1) 

  coeffs(1,1) = 0
  coeffs(1,2) = 4
  coeffs(1,3) = -2

  coeffs(2,1) = 2
  coeffs(2,2) = 3
  coeffs(2,3) = 7

  coeffs(3,1) = -1
  coeffs(3,2) = 2
  coeffs(3,3) = 3

  PRINT *, "Got coeffs :  "
  PRINT *, coeffs(1,1), coeffs(1,2), coeffs(1,3)
  PRINT *, coeffs(2,1), coeffs(2,2), coeffs(2,3)
  PRINT *, coeffs(3,1), coeffs(3,2), coeffs(3,3)
  PRINT *

END SUBROUTINE Get_Coeffs

! -----------------------------------------------------------------------------

SUBROUTINE Get_RHS(rhs)
  REAL, INTENT(INOUT), DIMENSION(:) :: rhs
  INTEGER :: n, i 

  ! -- get size n and read in n numbers for rhs of Ax = b :
  n = SIZE(rhs) 

  DO i = 1, n
      rhs(i) = i**i + i + 1
  END DO

  PRINT *, "Got rhs :  "
  PRINT *, rhs(1), rhs(2), rhs(3)
  PRINT *

END SUBROUTINE Get_RHS

! -----------------------------------------------------------------------------
END MODULE main_mod
! -----------------------------------------------------------------------------
