MUCRV

Multiplies a complex rectangular matrix by a complex vector.

Required Arguments

A — Complex NRA by NCA rectangular matrix. (Input)

X — Complex vector of length NX. (Input)

Y — Complex vector of length NY containing the product A * X if IPATH is equal to 1 and the product trans(A* X if IPATH is equal to 2. (Output)

Optional Arguments

NRA — Number of rows of A. (Input)
Default: NRA = SIZE (A,1).

NCA — Number of columns of A. (Input)
Default: NCA = SIZE (A,2).

LDA — Leading dimension of A exactly as specified in the dimension statement of the calling program. (Input)
Default: LDA = SIZE (A,1).

NX — Length of the vector X. (Input)
NX must be equal to NCA if IPATH is equal to 1. NX must be equal to NRA if IPATH is equal to 2.
Default: NX = SIZE (X,1).

IPATH — Integer flag. (Input)
IPATH = 1 means the product Y = A * X is computed. IPATH = 2 means the product Y = trans(A* X is computed, where trans(A) is the transpose of A.
Default: IPATH =1.

NY — Length of the vector Y. (Input)
NY must be equal to NRA if IPATH is equal to 1. NY must be equal to NCA if IPATH is equal to 2.
Default: NY = SIZE (Y,1).

FORTRAN 90 Interface

Generic: CALL MUCRV (A, X, Y [])

Specific: The specific interface names are S_MUCRV and D_MUCRV.

FORTRAN 77 Interface

Single: CALL MUCRV (NRA, NCA, A, LDA, NX, X, IPATH, NY, Y)

Double: The double precision name is DMUCRV.

Description

If IPATH = 1, MUCRV computes y = Ax, where A is a complex general matrix and x and y are complex vectors. If IPATH = 2, MUCRV computes y = ATx.

Example

Multiply a 3 ×  3 complex matrix by a complex vector of length 3. The output vector will be a complex vector of length 3.

 

USE MUCRV_INT

USE WRCRN_INT

 

IMPLICIT NONE

! Declare variables

INTEGER NCA, NRA, NX, NY

PARAMETER (NCA=3, NRA=3, NX=3, NY=3)

!

INTEGER IPATH

COMPLEX A(NRA,NCA), X(NX), Y(NY)

!

! Set values for A and X

! A = ( 1.0 + 2.0i 3.0 + 4.0i 1.0 + 0.0i )

! ( 2.0 + 1.0i 3.0 + 2.0i 0.0 - 1.0i )

! ( 2.0 - 1.0i 1.0 + 0.0i 0.0 + 1.0i )

!

! X = ( 1.0 - 1.0i 2.0 - 2.0i 0.0 - 1.0i )

!

DATA A/(1.0,2.0), (2.0,1.0), (2.0,-1.0), (3.0,4.0), (3.0,2.0), &

(1.0,0.0), (1.0,0.0), (0.0,-1.0), (0.0,1.0)/

DATA X/(1.0,-1.0), (2.0,-2.0), (0.0,-1.0)/

! Compute y = Ax

IPATH = 1

CALL MUCRV (A, X, Y)

! Print results

CALL WRCRN ('y = Ax', Y, 1, NY, 1)

END

Output

 

y = Ax

1 2 3

( 17.00, 2.00) ( 12.00, -3.00) ( 4.00, -5.00)