* ************************************************************************ subroutine ltcmvp( n, lmat, v, accum, addsub ) * ************************************************************************ * Purpose : * --------- * This routine adds (addsub=.true.) or substracts (addsub=.false.) * to the vector ACCUM the product of the matrix LMAT times the * vector V. * It is assumed that the matrix LMAT is symmetric, and that only * its lower triangular part is available for storage reasons. * In this case, the product of V with the implicit upper triangular * part is also added or substracted from ACCUM. * The vector V must be of dimension n. * Parameters : * ------------ * n ( int ) * input : the dimension of the matrix LMAT. * output : unmodified. * lmat ( dble ) * input : a vector that contains the successive columns of the * lower triangular part of the matrix LMAT. * output : unmodified. * v ( dble ) * input : a vector of dimension n containing the vector to * multiply by the matrix LMAT. * output : unmodified. * accum ( dble ) * input : a vector of dimension n in which the product will be * added (addsub=.true.) or substracted (addsub=.false.). * output : depending on the value of the logical ADDSUB, * the output value of ACCUM has the following values: * addsub = .true. ==> accum + lmat*v * addsub = .false. ==> accum - lmat*v * addsub ( log ) * input : .true. iff the product of the matrix times the vector V * has to be added in the vector ACCUM. * When .false., this product is to be substracted from ACCUM. * output : unmodified. * Routines used : * --------------- * daxpy, ddot (blasd) * Programming : * ------------- * Ph.L. Toint * ======================================================================== * Routine parameters integer n logical addsub double precision lmat(*), v(*), accum(*) * Internal variables integer i, na, l, nplus1 double precision ddot * * The product of V with the lower triangular part * of LMAT is now added or substracted from ACCUM. * nplus1 = n + 1 na = 1 * if ( addsub ) then do 300 i = 1,n l = nplus1 - i call daxpy( l, v(i), lmat(na), 1, accum(i), 1 ) na = na + l 300 continue else do 400 i = 1,n l = nplus1 - i call daxpy( l, -v(i), lmat(na), 1, accum(i), 1 ) na = na + l 400 continue endif * * The product of V with the implicit upper triangular * part of LMAT is now added or substracted from ACCUM. * na = 2 if( addsub ) then do 500 i = 1,n-1 l = n - i accum(i) = accum(i) + ddot( l, lmat(na), 1, v(i+1), 1 ) na = na + l + 1 500 continue else do 600 i = 1,n-1 l = n - i accum(i) = accum(i) - ddot( l, lmat(na), 1, v(i+1), 1 ) na = na + l + 1 600 continue endif return end