Chapter 9 Basic Matrix/Vector Operations
Routines
Basic Linear Algebra Subprograms (BLAS)
Programming Notes for Level 1 BLAS,
Set a vector to a constant value,
xi ← a, SSETCopy a vector,
yi ← xi, SCOPYScale a vector by a constant,
xi ← axi, SSCALSet a vector to a constant multiple of a vector,
yi ← axi, SVCALAdd a constant to a vector,
xi ←xi +
a, SADDSubtract a vector from a constant,
xi ← a‑ xi, SSUBAdd a multiple of one vector to another,
yi ← axi +
yi, SAXPYSwap two vectors,
yi↔ xi, SSWAPCompute extended precision
xTy or
xHy, DSDOTCompute extended precision
a +
xTy or
a +
xHy, SDSDOTCompute ACC +
b +
xTy with extended precision accumulator
, SDDOTIFind the index
i such that
xi = min
j xj, ISMINFind the index
i such that
xi= max
j xj, ISMAXFind the first index
i such that |
xi| = min
j |
xj|
, ISAMINFind the first index
i such that |
xi| = max
j |
xj|
, ISAMAXConstruct a Givens rotation
, SROTGApply a Givens rotation
, SROTConstruct a modified Givens rotation
, SROTMGApply a modified Givens rotation
, SROTMProgramming Notes for Level 2 and Level 3 BLAS,
Matrix-vector multiply, general
, SGEMVMatrix-vector multiply, banded
, SGBMVMatrix-vector multiply, Hermitian
, CHEMVMatrix-vector multiply, packed Hermitian
, CHPMVMatrix-vector multiply, Hermitian and banded
, CHBMVMatrix-vector multiply, symmetric and real
, SSYMVMatrix-vector multiply, packed symmetric, real
, SSPMVMatrix-vector multiply, symmetric and banded
, SSBMVMatrix-vector multiply, triangular
, STRMVMatrix-vector multiply, triangular and banded
, STBMVMatrix-vector solve, triangular
, STRSVMatrix-vector solve, triangular and banded
, STBSVMatrix-vector multiply, packed triangular
, STPMVMatrix-vector solve, packed triangular
, STPSVRank-one matrix update, general and real
, SGERRank-one matrix update, general, complex,and transpose
, CGERURank-one matrix update, general, complex, and conjugate transpose
, CGERCRank-one matrix update, Hermitian and conjugate transpose
, CHERHermitian, packed and conjugate transpose
, CHPRRank-two matrix update, Hermitian and conjugate transpose
, CHER2Rank-two matrix update, Hermitian, packed and conjugate transpose
, CHPR2Rank-one matrix update, symmetric and real
, SSYRRank-one matrix update, packed symmetric and real
, SSPRRank-two matrix update, symmetric and real
, SSYR2Rank-two matrix update, packed symmetric and real
, SSPR2Matrix-matrix multiply, general
, SGEMMMatrix-matrix multiply, symmetric
, SSYMMMatrix-matrix multiply, Hermitian
, CHEMMRank-
k update, symmetric
, SSYRKRank-
k update, Hermitian
, CHERKRank-2
k update, symmetric
, SSYR2KRank-2
k update, Hermitian
, CHER2KMatrix-matrix multiply, triangular
, STRMMMatrix-matrix solve, triangular
, STRSMOther Matrix/Vector Operations
Matrix Copy
Matrix Conversion
Real general to real band
, CRGRBReal band to real general
, CRBRGComplex general to complex band
, CCGCBComplex band to complex general
, CCBCGReal general to complex general
, CRGCGReal rectangular to complex rectangular
, CRRCRReal band to complex band
, CRBCBReal symmetric to real general
, CSFRGComplex Hermitian to complex general
, CHFCGReal symmetric band to real band
, CSBRBComplex Hermitian band to complex band
, CHBCBReal rectangular matrix to its transpose
, TRNRRMatrix Multiplication
Multiply two real rectangular matrices
, MRRRRMultiply two complex rectangular matrices
, MCRCRCompute matrix Hadamard product
, HRRRRCompute the bilinear form
xTAy, BLINFCompute the matrix polynomial
p(
A)
, POLRGMatrix-Vector Multiplication
Real rectangular matrix times a real vector
, MURRVReal band matrix times a real vector
, MURBVComplex rectangular matrix times a complex vector
, MUCRVComplex band matrix times a complex vector
, MUCBVMatrix Addition
Real band matrix plus a real band matrix
, ARBRBComplex band matrix plus a complex band matrix
, ACBCBMatrix Norm
∞-norm of a real rectangular matrix
, NRIRR 1-norm of a real rectangular matrix
, NR1RRFrobenius norm of a real rectangular matrix
, NR2RR1-norm of a real band matrix
, NR1RB1-norm of a complex band matrix
, NR1CBDistance Between Two Points
Euclidean distance
, DISL2 119
1-norm distance
, DISL1 121
Vector Convolutions
Convolution of real vectors
, VCONRConvolution of complex vectors
, VCONCExtended Precision Arithmetic
Initialize a real accumulator,
ACC ←
a, DQINIStore a real accumulator,
a ←
ACC, DQSTOAdd to a real accumulator,
ACC ←
ACC +
a, DQADDAdd a product to a real accumulator,
ACC ← ACC +
ab, DQMULInitialize a complex accumulator,
ACC ←
a, ZQINIStore a complex accumulator,
a ←
ACC, ZQSTOAdd to a complex accumulator,
ACC ←
ACC +
a, ZQADDAdd a product to a complex accumulator,
ACC ←
ACC +
ab, ZQMUL