Call bvls, but matching the interface of the old nnls.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(inout), | dimension(mda,n) | :: | a | ||
integer, | intent(in) | :: | mda | |||
integer, | intent(in) | :: | m | |||
integer, | intent(in) | :: | n | |||
real(kind=wp), | intent(inout), | dimension(m) | :: | b | ||
real(kind=wp), | intent(out), | dimension(n) | :: | x | ||
real(kind=wp), | intent(out) | :: | rnorm | |||
real(kind=wp), | intent(inout), | dimension(n) | :: | w | ||
real(kind=wp), | intent(inout), | dimension(m) | :: | zz | ||
integer, | intent(out) | :: | mode | |||
integer, | intent(in) | :: | max_iter |
maximum number of iterations
(if <=0, then |
subroutine bvls_wrapper(a,mda,m,n,b,x,rnorm,w,zz,mode,max_iter) implicit none integer,intent(in) :: mda integer,intent(in) :: n real(wp),dimension(mda,n),intent(inout) :: a integer,intent(in) :: m real(wp),dimension(m),intent(inout) :: b real(wp),dimension(n),intent(out) :: x real(wp),intent(out) :: rnorm real(wp),dimension(n),intent(inout) :: w real(wp),dimension(m),intent(inout) :: zz integer,intent(out) :: mode integer,intent(in) :: max_iter !! maximum number of iterations !! (if <=0, then `3*n` is used) integer,dimension(n) :: index integer :: ierr integer :: nsetp real(wp),dimension(2,n) :: bnd !! BND(1,J) is the lower bound for X(J). !! BND(2,J) is the upper bound for X(J). ! set bounds for nnls: bnd(1,:) = 0.0_wp bnd(2,:) = huge(0.0_wp) call bvls (a, b, bnd, x, rnorm, nsetp, w, index, ierr, max_iter) select case (ierr) case(0) mode = 1 case(1:2) mode = 2 case(3) ! doesn't exist in nnls... but will never happen because ! we are setting bounds above mode = -999 case(4) mode = 3 case default mode = -9999 !error stop 'unknown output from bvls' end select end subroutine bvls_wrapper