SUBROUTINE norm1(n,x,outnorm) USE const ! ! Subroutine for computing the 1 norm of ! a vector IMPLICIT NONE ! Dummy variable declarations. ! NOTE: When passing vectors to a subroutine, use ! a dummy variable to size the vector in the subrouine. ! In this case, we are using the n varaible as the size of ! x. ! ! Do not use NMAX to size the vector. INTEGER,INTENT(IN) :: n REAL(kind=dp),INTENT(IN) :: x(n) REAL(kind=dp),INTENT(OUT) :: outnorm ! Local variable declarations INTEGER :: i ! Main loop to compute the 1 norm outnorm = 0 DO i = 1,n outnorm = outnorm + ABS(x(i)) ENDDO RETURN END SUBROUTINE norm1