initialize_ez Subroutine

private subroutine initialize_ez(me, m, n, a, irow, icol, atol, btol, conlim, itnlim, nout)

Constructor for lsqr_solver_ez.

Type Bound

lsqr_solver_ez

Arguments

Type IntentOptional Attributes Name
class(lsqr_solver_ez), intent(out) :: me
integer, intent(in) :: m

number of rows in A matrix

integer, intent(in) :: n

number of columns in A matrix

real(kind=wp), intent(in), dimension(:) :: a

nonzero elements of A

integer, intent(in), dimension(:) :: irow

row indices of nonzero elements of A

integer, intent(in), dimension(:) :: icol

column indices of nonzero elements of A

real(kind=wp), intent(in), optional :: atol

relative error in definition of A

real(kind=wp), intent(in), optional :: btol

relative error in definition of b

real(kind=wp), intent(in), optional :: conlim

An upper limit on cond(Abar), the apparent condition number of the matrix Abar.

integer, intent(in), optional :: itnlim

max iterations

integer, intent(in), optional :: nout

output unit for printing


Source Code

   subroutine initialize_ez(me,m,n,a,irow,icol,atol,btol,conlim,itnlim,nout)

   implicit none

   class(lsqr_solver_ez),intent(out) :: me
   integer,intent(in)                :: m       !! number of rows in `A` matrix
   integer,intent(in)                :: n       !! number of columns in `A` matrix
   integer,dimension(:),intent(in)   :: irow    !! row indices of nonzero elements of `A`
   integer,dimension(:),intent(in)   :: icol    !! column indices of nonzero elements of `A`
   real(wp),dimension(:),intent(in)  :: a       !! nonzero elements of `A`
   real(wp),intent(in),optional      :: atol    !! relative error in definition of `A`
   real(wp),intent(in),optional      :: btol    !! relative error in definition of `b`
   real(wp),intent(in),optional      :: conlim  !! An upper limit on `cond(Abar)`, the apparent
                                                !! condition number of the matrix `Abar`.
   integer,intent(in),optional       :: itnlim  !! max iterations
   integer,intent(in),optional       :: nout    !! output unit for printing

   ! check for consistent inputs:
   if (any(size(a)/=[size(irow),size(icol)])) error stop 'invalid a,icol,irow sizes in initialize_ez'
   if (any(irow>m)) error stop 'invalid irow or m in initialize_ez'
   if (any(icol>n)) error stop 'invalid icol or n in initialize_ez'

   me%num_nonzero_elements = size(irow)
   me%m     = m
   me%n     = n
   me%irow  = irow
   me%icol  = icol
   me%a     = a

   ! optional inputs:
   if (present(atol))   me%atol   = atol
   if (present(btol))   me%btol   = btol
   if (present(conlim)) me%conlim = conlim
   if (present(itnlim)) me%itnlim = itnlim
   if (present(nout))   me%nout   = nout

   end subroutine initialize_ez