@@ -9,6 +9,7 @@ submodule(stdlib_linalg_iterative_solvers) stdlib_linalg_iterative_pcg
9
9
use stdlib_sparse
10
10
use stdlib_constants
11
11
use stdlib_linalg_iterative_solvers
12
+ use stdlib_optval, only: optval
12
13
implicit none
13
14
14
15
enum, bind(c)
@@ -93,7 +94,7 @@ contains
93
94
${t}$, intent(in) :: b(:)
94
95
${t}$, intent(inout) :: x(:)
95
96
${t}$, intent(in), optional :: tol
96
- logical(1 ), intent(in), optional, target :: di(:)
97
+ logical(int8 ), intent(in), optional, target :: di(:)
97
98
integer, intent(in), optional :: maxiter
98
99
logical, intent(in), optional :: restart
99
100
integer, intent(in), optional :: precond
@@ -106,18 +107,18 @@ contains
106
107
integer :: n, maxiter_
107
108
${t}$ :: tol_
108
109
logical :: restart_
109
- logical(1 ), pointer :: di_(:)
110
+ logical(int8 ), pointer :: di_(:)
110
111
!-------------------------
111
112
! working data for preconditioner
112
113
integer :: precond_
113
114
${t}$, allocatable :: diagonal(:)
114
115
115
116
!-------------------------
116
117
n = size(b)
117
- maxiter_ = n; if(present( maxiter)) maxiter_ = maxiter
118
- restart_ = .true.; if(present( restart)) restart_ = restart
119
- tol_ = 1.e-4_${s}$; if(present(tol)) tol_ = tol
120
- precond_ = pc_none; if(present( precond)) precond_ = precond
118
+ maxiter_ = optval(x= maxiter, default=n)
119
+ restart_ = optval(x= restart, default=.true.)
120
+ tol_ = optval(x=tol, default= 1.e-4_${s}$)
121
+ precond_ = optval(x= precond, default=pc_none)
121
122
!-------------------------
122
123
! internal memory setup
123
124
! preconditioner
0 commit comments