subroutine maddi (sgn, n, A) c character*1 sgn double precision A(1) integer n c ***----------------------------------------------------------*** c * 'maddi' overwrites A with (I + A) if sgn .eq. '+' or * c * (I - A) if sgn .eq. '-'. * c * * c * on entry * c * * c * sgn [character*1] * c * '+' or '-' as above. * c * * c * n [integer] * c * The (implicit) number of rows and columns * c * in A. A is accessed as a 1D array inside * c * this subroutine. * c * * c * A [double precision(n**2)] * c * The matrix to be transformed. * c * * c * on return * c * * c * sgn [character*1] * c * Unchanged. * c * * c * n [integer] * c * Unchanged. * c * * c * A [double precision(n**2)] * c * Overwritten with either (I + A) or (I - A). * c ***----------------------------------------------------------*** logical plus, minus, LSAME integer i, k, nsquar c nsquar = n**2 plus = LSAME (sgn, '+') minus = LSAME (sgn, '-') if ( plus ) then do 10 k = 1, n i = (k-1)*n + k A(i) = A(i) + 1.d0 10 continue else if ( minus ) then call mnegv (n, A) do 20 k = 1, n i = (k-1)*n + k A(i) = A(i) + 1.d0 20 continue else write(6,*) ' *** maddi: sgn not understood ' end if return end