matrix--vector multiplication

SYNOPSIS

#include "matrix.h"
VEC     *mv_mlt(MAT *A, VEC *x, VEC *out)
VEC     *vm_mlt(MAT *A, VEC *x, VEC *out)
VEC     *mv_mltadd(VEC *v1, VEC *v2, MAT *A,
                   double s, VEC *out)
VEC     *vm_mltadd(VEC *v1, VEC *v2, MAT *A,
                   double s, VEC *out)
#include "zmatrix.h"
ZVEC    *zmv_mlt(ZMAT *A, ZVEC *x, ZVEC *out)
ZVEC    *zvm_mlt(ZMAT *A, ZVEC *x, ZVEC *out)
ZVEC    *zmv_mltadd(ZVEC *v1, ZVEC *v2, ZMAT *A,
                    complex s, ZVEC *out)
ZVEC    *zvm_mltadd(ZVEC *v1, ZVEC *v2, ZMAT *A,
                    complex s, ZVEC *out)

DESCRIPTION

The routines mv_mlt() and vm_mlt() form $Ax$ and $A^Tx=(x^TA)^T$ respectively and store the result in out. The routines zmv_mlt() and zvm_mlt() form $Ax$ and $A^*x=(x^*A)^*$ respectively and store the result in out. The routines mv_mltadd() and vm_mltadd() form $v_1 + s Av_2$ and $v_1 + s A^T v_2$ respectively, and stores the result in out. The routines zmv_mltadd() and zvm_mltadd() form $v_1 + s Av_2$ and $v_1 + s A^*v_2$ respectively, and stores the result in out. If out is NULL or too small to contain the product, then it is resized to the correct size. These routines do not work in situ\/; that is, out must be different to x for mv_mlt() and vm_mlt(), and in the case of mv_mltadd() and vm_mltadd(), out must be different to v2. These routines avoid thrashing virtual memory machines.

EXAMPLE

MAT    *A;
VEC    *x, *y, *out;
Real   alpha;
  ......
out = mv_mlt(A,x,VNULL);   /* out = A.x */
vm_mlt(A,x,out);           /* out = A^T.x */
mv_mltadd(x,y,A,out);      /* out = x + A.y */
vm_mltadd(x,y,A,out);      /* out = x + A^T.y */

SOURCE FILE: matop.c, zmatop.c