Prints the intermediate results of iterative eigenvalue/singular value decompositions
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | filename |
Output filename. This file will be overwritten |
||
real(kind=dp), | intent(in) | :: | vals(:) |
Intermediate values |
||
real(kind=dp), | intent(inout) | :: | res(:) |
Residuals |
||
real(kind=dp), | intent(in) | :: | tol |
Convergence tolerance |
subroutine write_results_rdp(filename, vals, res, tol) !! Prints the intermediate results of iterative eigenvalue/singular value decompositions implicit none(type, external) character(len=*), intent(in) :: filename !! Output filename. This file will be overwritten real(dp), intent(in) :: vals(:) !! Intermediate values real(dp), intent(inout) :: res(:) !! Residuals real(dp), intent(in) :: tol !! Convergence tolerance ! internals integer :: i, k, idx integer, allocatable :: indices(:) character(len=*), parameter :: fmt = '(I6,2(2X,E16.9),2X,L4)' k = size(vals) if (io_rank()) then ! only IO rank writes allocate(indices(k)) call sort_index(res, indices) ! res is returned in sorted order open (1234, file=filename, status='replace', action='write') write (1234, '(A6,2(A18),A6)') 'Iter', 'value', 'residual', 'conv' do i = 1, k idx = indices(i) write (1234, fmt) k, vals(idx), res(i), res(i) < tol end do close (1234) end if end subroutine write_results_rdp