backward algorithm, solves the system where U is an upper triangular matrix and y is a vector
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:, :) | :: | U | ||
| real(kind=dp), | intent(in), | dimension(:) | :: | y |
function backward(U, y) result(x) real(dp), dimension(:, :), intent(in) :: U real(dp), dimension(:), intent(in) :: y real(dp), dimension(size(U, 1)) :: x integer :: i, N N = size(U, 1) x(N) = y(N) / U(N, N) do i = N - 1, 1, -1 x(i) = (y(i) - dot_product(U(i, i + 1:N), x(i + 1:N))) / U(i, i) end do end function backward