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