Compute e = wd + alpha*tt**2
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n |
Number of observations. |
||
integer, | intent(in) | :: | m |
Number of columns of data in the independent variable. |
||
real(kind=wp), | intent(in) | :: | wd(ldwd,ld2wd,m) |
Squared |
||
integer, | intent(in) | :: | ldwd |
Leading dimension of array |
||
integer, | intent(in) | :: | ld2wd |
Second dimension of array |
||
real(kind=wp), | intent(in) | :: | alpha |
Levenberg-Marquardt parameter. |
||
real(kind=wp), | intent(in) | :: | tt(ldtt,m) |
Scaling values used for |
||
integer, | intent(in) | :: | ldtt |
Leading dimension of array |
||
integer, | intent(in) | :: | i |
Indexing variable. |
||
real(kind=wp), | intent(out) | :: | e(m,m) |
Value of the array |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | j |
pure subroutine esubi(n, m, wd, ldwd, ld2wd, alpha, tt, ldtt, i, e) !! Compute `e = wd + alpha*tt**2`. use odrpack_kinds, only: zero integer, intent(in) :: n !! Number of observations. integer, intent(in) :: m !! Number of columns of data in the independent variable. real(wp), intent(in) :: wd(ldwd, ld2wd, m) !! Squared `delta` weights. integer, intent(in) :: ldwd !! Leading dimension of array `wd`. integer, intent(in) :: ld2wd !! Second dimension of array `wd`. real(wp), intent(in) :: alpha !! Levenberg-Marquardt parameter. real(wp), intent(in) :: tt(ldtt, m) !! Scaling values used for `delta`. integer, intent(in) :: ldtt !! Leading dimension of array `tt`. integer, intent(in) :: i !! Indexing variable. real(wp), intent(out) :: e(m, m) !! Value of the array `e = wd + alpha*tt**2`. ! Local scalars integer :: j ! Variable Definitions (alphabetically) ! J: An indexing variable. ! N.B. the locations of WD and TT accessed depend on the value of the first element of ! each array and the leading dimensions of the multiply subscripted arrays. if (n == 0 .or. m == 0) return if (wd(1, 1, 1) >= zero) then if (ldwd >= n) then ! The elements of WD have been individually specified if (ld2wd == 1) then ! The arrays stored in WD are diagonal e = zero do j = 1, m e(j, j) = wd(i, 1, j) end do else ! The arrays stored in WD are full positive semidefinite matrices e = wd(i, :, :) end if if (tt(1, 1) > zero) then if (ldtt >= n) then do j = 1, m e(j, j) = e(j, j) + alpha*tt(i, j)**2 end do else do j = 1, m e(j, j) = e(j, j) + alpha*tt(1, j)**2 end do end if else do j = 1, m e(j, j) = e(j, j) + alpha*tt(1, 1)**2 end do end if else ! WD is an M by M matrix if (ld2wd == 1) then ! The array stored in WD is diagonal e = zero do j = 1, m e(j, j) = wd(1, 1, j) end do else ! The array stored in WD is a full positive semidefinite matrix e = wd(1, :, :) end if if (tt(1, 1) > zero) then if (ldtt >= n) then do j = 1, m e(j, j) = e(j, j) + alpha*tt(i, j)**2 end do else do j = 1, m e(j, j) = e(j, j) + alpha*tt(1, j)**2 end do end if else do j = 1, m e(j, j) = e(j, j) + alpha*tt(1, 1)**2 end do end if end if else ! WD is a diagonal matrix with elements ABS(WD(1,1,1)) e = zero if (tt(1, 1) > zero) then if (ldtt >= n) then do j = 1, m e(j, j) = abs(wd(1, 1, 1)) + alpha*tt(i, j)**2 end do else do j = 1, m e(j, j) = abs(wd(1, 1, 1)) + alpha*tt(1, j)**2 end do end if else do j = 1, m e(j, j) = abs(wd(1, 1, 1)) + alpha*tt(1, 1)**2 end do end if end if end subroutine esubi