({{, GEMV[ts,α,a,x,β,y] 
computes the matrix-vector multiplication α (Subscript[op, ts])[a].x +β y and resets y to the result.}})

OpenersNotesSection(Spacer1)Details

To use GEMV, you first need to load the BLAS Package using (RefLink[Needs, paclet:ref/Needs])["LinearAlgebra`BLAS`"].

The following arguments must be given:

The transposition string ts describes the operator (Subscript[op, ts]) and may be specified as:

Dimensions of the matrix and vector arguments must be such that the dot product and addition are well defined.

OpenersPrimaryExamplesSection(Spacer1)Examples  (10)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Load the BLAS package:

Needs["LinearAlgebra`BLAS`"]

Compute a.x+2 y and save it in y:

y={-2,1};
a={{1,3},{2,4}};
x={1,2};
GEMV["N",1,a,x,2,y];
y

OpenersExampleSection1(Spacer1)Scope  (4)

Real matrix and vectors:

y={2.3,1.2,3.9};
a={{2.1,0,1.4},{3.5,2.4,0.4},{0,2.7,1.3}};
x={0,1.2,-1.3};
GEMV["N",2,a,x,1,y];
y

Complex matrix and vectors:

y={2.3+3.I,1.2 I,-3.+2.I};
a={{2.1,0,1.4 I},{3.5 I,2.4,0.4+I},{0,2.7,1.3 I}};
x={0,1.2,-1.3-2.I};
GEMV["N",2,a,x,1,y];
y

Arbitrary-precision matrix and vectors:

y={-2`20,1};
a={{1`20,3},{2,4}};
x={1`20,2};
GEMV["N",-1,a,x,2,y];
y

Symbolic matrix and vectors:

y={y1,y2};
a={{m11,m12},{m21,m22}};
x={x1,x2};
GEMV["N",α,a,x,β,y];
y

OpenersExampleSection3(Spacer1)Properties & Relations  (3)

GEMV["N",α,a,x,β,y] is equivalent to y=α a.x+β y:

y=y1=RandomReal[1,{4}];
a=RandomReal[1,{4,5}];
x=RandomReal[1,{5}];
GEMV["N",3,a,x,-2,y];
y==3 a.x-2 y1

GEMV["T",α,a,x,β,y] is equivalent to y=α Transpose[a].x+β y:

y=y1=RandomReal[1,{5}];
a=RandomReal[1,{4,5}];
x=RandomReal[1,{4}];
GEMV["T",3,a,x,-2,y];
y==3 Transpose[a].x-2 y1

GEMV["C",α,a,x,β,y] is equivalent to y=α ConjugateTranspose[a].x+β y:

y=y1=RandomComplex[1+I,{5}];
a=RandomComplex[1+I,{4,5}];
x=RandomComplex[1+I,{4}];
GEMV["C",3+2I,a,x,-2+I,y];
y==(3+2I) ConjugateTranspose[a].x+(-2+I) y1

OpenersExampleSection4(Spacer1)Possible Issues  (2)

The last argument must be a symbol:

a={{1,3},{2,4}};
x={1,2};
GEMV["N",1,a,x,2,{2,3}]

If the last argument is not a symbol initialized to a vector then an error message is issued:

Clear[y];
a={{1,3},{2,4}};
x={1,2};
GEMV["N",1,a,x,2,y]

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Basic Linear Algebra Subroutines, paclet:LowLevelLinearAlgebra/guide/BLASGuide])}})}})