File:  [local] / rpl / lapack / blas / dgemv.f
Revision 1.17: download - view: text, annotated - select for diffs - revision graph
Mon Aug 7 08:38:43 2023 UTC (8 months, 3 weeks ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_35, rpl-4_1_34, HEAD
Première mise à jour de lapack et blas.

    1: *> \brief \b DGEMV
    2: *
    3: *  =========== DOCUMENTATION ===========
    4: *
    5: * Online html documentation available at
    6: *            http://www.netlib.org/lapack/explore-html/
    7: *
    8: *  Definition:
    9: *  ===========
   10: *
   11: *       SUBROUTINE DGEMV(TRANS,M,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
   12: *
   13: *       .. Scalar Arguments ..
   14: *       DOUBLE PRECISION ALPHA,BETA
   15: *       INTEGER INCX,INCY,LDA,M,N
   16: *       CHARACTER TRANS
   17: *       ..
   18: *       .. Array Arguments ..
   19: *       DOUBLE PRECISION A(LDA,*),X(*),Y(*)
   20: *       ..
   21: *
   22: *
   23: *> \par Purpose:
   24: *  =============
   25: *>
   26: *> \verbatim
   27: *>
   28: *> DGEMV  performs one of the matrix-vector operations
   29: *>
   30: *>    y := alpha*A*x + beta*y,   or   y := alpha*A**T*x + beta*y,
   31: *>
   32: *> where alpha and beta are scalars, x and y are vectors and A is an
   33: *> m by n matrix.
   34: *> \endverbatim
   35: *
   36: *  Arguments:
   37: *  ==========
   38: *
   39: *> \param[in] TRANS
   40: *> \verbatim
   41: *>          TRANS is CHARACTER*1
   42: *>           On entry, TRANS specifies the operation to be performed as
   43: *>           follows:
   44: *>
   45: *>              TRANS = 'N' or 'n'   y := alpha*A*x + beta*y.
   46: *>
   47: *>              TRANS = 'T' or 't'   y := alpha*A**T*x + beta*y.
   48: *>
   49: *>              TRANS = 'C' or 'c'   y := alpha*A**T*x + beta*y.
   50: *> \endverbatim
   51: *>
   52: *> \param[in] M
   53: *> \verbatim
   54: *>          M is INTEGER
   55: *>           On entry, M specifies the number of rows of the matrix A.
   56: *>           M must be at least zero.
   57: *> \endverbatim
   58: *>
   59: *> \param[in] N
   60: *> \verbatim
   61: *>          N is INTEGER
   62: *>           On entry, N specifies the number of columns of the matrix A.
   63: *>           N must be at least zero.
   64: *> \endverbatim
   65: *>
   66: *> \param[in] ALPHA
   67: *> \verbatim
   68: *>          ALPHA is DOUBLE PRECISION.
   69: *>           On entry, ALPHA specifies the scalar alpha.
   70: *> \endverbatim
   71: *>
   72: *> \param[in] A
   73: *> \verbatim
   74: *>          A is DOUBLE PRECISION array, dimension ( LDA, N )
   75: *>           Before entry, the leading m by n part of the array A must
   76: *>           contain the matrix of coefficients.
   77: *> \endverbatim
   78: *>
   79: *> \param[in] LDA
   80: *> \verbatim
   81: *>          LDA is INTEGER
   82: *>           On entry, LDA specifies the first dimension of A as declared
   83: *>           in the calling (sub) program. LDA must be at least
   84: *>           max( 1, m ).
   85: *> \endverbatim
   86: *>
   87: *> \param[in] X
   88: *> \verbatim
   89: *>          X is DOUBLE PRECISION array, dimension at least
   90: *>           ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n'
   91: *>           and at least
   92: *>           ( 1 + ( m - 1 )*abs( INCX ) ) otherwise.
   93: *>           Before entry, the incremented array X must contain the
   94: *>           vector x.
   95: *> \endverbatim
   96: *>
   97: *> \param[in] INCX
   98: *> \verbatim
   99: *>          INCX is INTEGER
  100: *>           On entry, INCX specifies the increment for the elements of
  101: *>           X. INCX must not be zero.
  102: *> \endverbatim
  103: *>
  104: *> \param[in] BETA
  105: *> \verbatim
  106: *>          BETA is DOUBLE PRECISION.
  107: *>           On entry, BETA specifies the scalar beta. When BETA is
  108: *>           supplied as zero then Y need not be set on input.
  109: *> \endverbatim
  110: *>
  111: *> \param[in,out] Y
  112: *> \verbatim
  113: *>          Y is DOUBLE PRECISION array, dimension at least
  114: *>           ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n'
  115: *>           and at least
  116: *>           ( 1 + ( n - 1 )*abs( INCY ) ) otherwise.
  117: *>           Before entry with BETA non-zero, the incremented array Y
  118: *>           must contain the vector y. On exit, Y is overwritten by the
  119: *>           updated vector y.
  120: *> \endverbatim
  121: *>
  122: *> \param[in] INCY
  123: *> \verbatim
  124: *>          INCY is INTEGER
  125: *>           On entry, INCY specifies the increment for the elements of
  126: *>           Y. INCY must not be zero.
  127: *> \endverbatim
  128: *
  129: *  Authors:
  130: *  ========
  131: *
  132: *> \author Univ. of Tennessee
  133: *> \author Univ. of California Berkeley
  134: *> \author Univ. of Colorado Denver
  135: *> \author NAG Ltd.
  136: *
  137: *> \ingroup double_blas_level2
  138: *
  139: *> \par Further Details:
  140: *  =====================
  141: *>
  142: *> \verbatim
  143: *>
  144: *>  Level 2 Blas routine.
  145: *>  The vector and matrix arguments are not referenced when N = 0, or M = 0
  146: *>
  147: *>  -- Written on 22-October-1986.
  148: *>     Jack Dongarra, Argonne National Lab.
  149: *>     Jeremy Du Croz, Nag Central Office.
  150: *>     Sven Hammarling, Nag Central Office.
  151: *>     Richard Hanson, Sandia National Labs.
  152: *> \endverbatim
  153: *>
  154: *  =====================================================================
  155:       SUBROUTINE DGEMV(TRANS,M,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
  156: *
  157: *  -- Reference BLAS level2 routine --
  158: *  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
  159: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  160: *
  161: *     .. Scalar Arguments ..
  162:       DOUBLE PRECISION ALPHA,BETA
  163:       INTEGER INCX,INCY,LDA,M,N
  164:       CHARACTER TRANS
  165: *     ..
  166: *     .. Array Arguments ..
  167:       DOUBLE PRECISION A(LDA,*),X(*),Y(*)
  168: *     ..
  169: *
  170: *  =====================================================================
  171: *
  172: *     .. Parameters ..
  173:       DOUBLE PRECISION ONE,ZERO
  174:       PARAMETER (ONE=1.0D+0,ZERO=0.0D+0)
  175: *     ..
  176: *     .. Local Scalars ..
  177:       DOUBLE PRECISION TEMP
  178:       INTEGER I,INFO,IX,IY,J,JX,JY,KX,KY,LENX,LENY
  179: *     ..
  180: *     .. External Functions ..
  181:       LOGICAL LSAME
  182:       EXTERNAL LSAME
  183: *     ..
  184: *     .. External Subroutines ..
  185:       EXTERNAL XERBLA
  186: *     ..
  187: *     .. Intrinsic Functions ..
  188:       INTRINSIC MAX
  189: *     ..
  190: *
  191: *     Test the input parameters.
  192: *
  193:       INFO = 0
  194:       IF (.NOT.LSAME(TRANS,'N') .AND. .NOT.LSAME(TRANS,'T') .AND.
  195:      +    .NOT.LSAME(TRANS,'C')) THEN
  196:           INFO = 1
  197:       ELSE IF (M.LT.0) THEN
  198:           INFO = 2
  199:       ELSE IF (N.LT.0) THEN
  200:           INFO = 3
  201:       ELSE IF (LDA.LT.MAX(1,M)) THEN
  202:           INFO = 6
  203:       ELSE IF (INCX.EQ.0) THEN
  204:           INFO = 8
  205:       ELSE IF (INCY.EQ.0) THEN
  206:           INFO = 11
  207:       END IF
  208:       IF (INFO.NE.0) THEN
  209:           CALL XERBLA('DGEMV ',INFO)
  210:           RETURN
  211:       END IF
  212: *
  213: *     Quick return if possible.
  214: *
  215:       IF ((M.EQ.0) .OR. (N.EQ.0) .OR.
  216:      +    ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
  217: *
  218: *     Set  LENX  and  LENY, the lengths of the vectors x and y, and set
  219: *     up the start points in  X  and  Y.
  220: *
  221:       IF (LSAME(TRANS,'N')) THEN
  222:           LENX = N
  223:           LENY = M
  224:       ELSE
  225:           LENX = M
  226:           LENY = N
  227:       END IF
  228:       IF (INCX.GT.0) THEN
  229:           KX = 1
  230:       ELSE
  231:           KX = 1 - (LENX-1)*INCX
  232:       END IF
  233:       IF (INCY.GT.0) THEN
  234:           KY = 1
  235:       ELSE
  236:           KY = 1 - (LENY-1)*INCY
  237:       END IF
  238: *
  239: *     Start the operations. In this version the elements of A are
  240: *     accessed sequentially with one pass through A.
  241: *
  242: *     First form  y := beta*y.
  243: *
  244:       IF (BETA.NE.ONE) THEN
  245:           IF (INCY.EQ.1) THEN
  246:               IF (BETA.EQ.ZERO) THEN
  247:                   DO 10 I = 1,LENY
  248:                       Y(I) = ZERO
  249:    10             CONTINUE
  250:               ELSE
  251:                   DO 20 I = 1,LENY
  252:                       Y(I) = BETA*Y(I)
  253:    20             CONTINUE
  254:               END IF
  255:           ELSE
  256:               IY = KY
  257:               IF (BETA.EQ.ZERO) THEN
  258:                   DO 30 I = 1,LENY
  259:                       Y(IY) = ZERO
  260:                       IY = IY + INCY
  261:    30             CONTINUE
  262:               ELSE
  263:                   DO 40 I = 1,LENY
  264:                       Y(IY) = BETA*Y(IY)
  265:                       IY = IY + INCY
  266:    40             CONTINUE
  267:               END IF
  268:           END IF
  269:       END IF
  270:       IF (ALPHA.EQ.ZERO) RETURN
  271:       IF (LSAME(TRANS,'N')) THEN
  272: *
  273: *        Form  y := alpha*A*x + y.
  274: *
  275:           JX = KX
  276:           IF (INCY.EQ.1) THEN
  277:               DO 60 J = 1,N
  278:                   TEMP = ALPHA*X(JX)
  279:                   DO 50 I = 1,M
  280:                       Y(I) = Y(I) + TEMP*A(I,J)
  281:    50             CONTINUE
  282:                   JX = JX + INCX
  283:    60         CONTINUE
  284:           ELSE
  285:               DO 80 J = 1,N
  286:                   TEMP = ALPHA*X(JX)
  287:                   IY = KY
  288:                   DO 70 I = 1,M
  289:                       Y(IY) = Y(IY) + TEMP*A(I,J)
  290:                       IY = IY + INCY
  291:    70             CONTINUE
  292:                   JX = JX + INCX
  293:    80         CONTINUE
  294:           END IF
  295:       ELSE
  296: *
  297: *        Form  y := alpha*A**T*x + y.
  298: *
  299:           JY = KY
  300:           IF (INCX.EQ.1) THEN
  301:               DO 100 J = 1,N
  302:                   TEMP = ZERO
  303:                   DO 90 I = 1,M
  304:                       TEMP = TEMP + A(I,J)*X(I)
  305:    90             CONTINUE
  306:                   Y(JY) = Y(JY) + ALPHA*TEMP
  307:                   JY = JY + INCY
  308:   100         CONTINUE
  309:           ELSE
  310:               DO 120 J = 1,N
  311:                   TEMP = ZERO
  312:                   IX = KX
  313:                   DO 110 I = 1,M
  314:                       TEMP = TEMP + A(I,J)*X(IX)
  315:                       IX = IX + INCX
  316:   110             CONTINUE
  317:                   Y(JY) = Y(JY) + ALPHA*TEMP
  318:                   JY = JY + INCY
  319:   120         CONTINUE
  320:           END IF
  321:       END IF
  322: *
  323:       RETURN
  324: *
  325: *     End of DGEMV
  326: *
  327:       END

CVSweb interface <joel.bertrand@systella.fr>