Chapter 9: Basic Matrix/Vector Operations

Routines

9.1.       Basic Linear Algebra Subprograms (BLAS)

Programming Notes for Level 1 BLAS

Set a vector to a constant value, xi a..................................................................... SSET

Copy a vector, yi xi........................................................................................... SCOPY

Scale a vector by a constant, xi axi.................................................................... SSCAL

Set a vector to a constant multiple of a vector, yi axi............................................ SVCAL

Add a constant to a vector, xi xi + a...................................................................... SADD

Subtract a vector from a constant, xi axi............................................................ SSUB

Add a multiple of one vector to another, yi axi + yi................................................. SAXPY

Swap two vectors, yi xi..................................................................................... SSWAP

Compute xTy or xHy................................................................................................. SDOT

Compute extended precision xTy or xHy................................................................... DSDOT

Compute extended precision a + xTy or a + xHy..................................................... SDSDOT

Compute ACC + b + xTy
with extended precision accumulator..................................................................... SDDOTI

Compute zi xiyi............................................................................................... SHPROD

Compute Σ xiyizi....................................................................................................... SXYZ

Compute Σ xi......................................................................................................... SSUM

Compute Σ |xi|...................................................................................................... SASUM

Compute ||x||2....................................................................................................... SNRM2

Compute xi.................................................................................................... SPRDCT

Find the index i such that xi = minj xj......................................................................... ISMIN

Find the index i such that xi= maxj xj........................................................................ ISMAX

Find the first  index i such that |xi| = minj |xj|............................................................ ISAMIN

Find the first index i such that |xi| = maxj |xj|............................................................ ISAMAX

Construct a Givens rotation................................................................................... SROTG

Apply a Givens rotation........................................................................................... SROT

Construct a modified Givens rotation................................................................... SROTMG

Programming Notes for Level 2 and Level 3 BLAS

Apply a modified Givens rotation........................................................................... SROTM

Matrix-vector multiply, general.............................................................................. SGEMV

Matrix-vector multiply, banded.............................................................................. SGBMV

Matrix-vector multiply, Hermitian........................................................................... CHEMV

Matrix-vector multiply, packed Hermitian  ............................................................. CHPMV

Matrix-vector multiply, Hermitian and banded......................................................... CHBMV

Matrix-vector multiply, symmetric and real............................................................. SSYMV

Matrix-vector multiply, packed symmetric, real....................................................... SSPMV

Matrix-vector multiply, symmetric and banded........................................................ SSBMV

Matrix-vector multiply, triangular............................................................................ STRMV

Matrix-vector multiply, triangular and banded.......................................................... STBMV

Matrix-vector solve, triangular................................................................................ STRSV

Matrix-vector solve, triangular and banded............................................................... STBSV

Matrix-vector multiply, packed triangular................................................................ STPMV

Matrix-vector solve, packed triangular.................................................................... STPSV

Rank-one matrix update, general and real................................................................ SGER

Rank-one matrix update, general, complex,
and transpose..................................................................................................... CGERU

Rank-one matrix update, general, complex,
and conjugate transpose...................................................................................... CGERC

Rank-one matrix update,
Hermitian and conjugate transpose.......................................................................... CHER

Hermitian, packed and conjugate transpose............................................................. CHPR

Rank-two matrix update,
Hermitian and conjugate transpose........................................................................ CHER2

Rank-two matrix update,
Hermitian, packed and conjugate transpose............................................................ CHPR2

Rank-one matrix update, symmetric and real............................................................ SSYR

Rank-one matrix update, packed symmetric and real................................................ SSPR

Rank-two matrix update, symmetric and real.......................................................... SSYR2

Rank-two matrix update, packed symmetric and real............................................... SSPR2

Matrix-matrix multiply, general............................................................................. SGEMM

Matrix-matrix multiply, symmetric........................................................................ SSYMM

Matrix-matrix multiply, Hermitian.......................................................................... CHEMM

Rank-k update, symmetric.................................................................................... SSYRK

Rank-k update, Hermitian..................................................................................... CHERK

Rank-2k update, symmetric................................................................................ SSYR2K

Rank-2k update, Hermitian.................................................................................. CHER2K

Matrix-matrix multiply, triangular........................................................................... STRMM

Matrix-matrix solve, triangular............................................................................... STRSM

Programming Notes Using BLAS for NVIDIA

Gets the switchover value........................................................................... CUBLAS_GET

Sets the switchover value............................................................................ CUBLAS_SET

Maintains buffer sizes...................................................... CHECK_BUFFER_ALLOCATION

Prints error messages.................................................................... CUDA_ERROR_PRINT

Other Matrix/Vector Operations

Matrix Copy

Real general....................................................................................................... CRGRG

Complex general................................................................................................. CCGCG

Real band........................................................................................................... CRBRB

Complex band..................................................................................................... CCBCB

Matrix Conversion

Real general to real band...................................................................................... CRGRB

Real band to real general...................................................................................... CRBRG

Complex general to complex band........................................................................ CCGCB

Complex band to complex general........................................................................ CCBCG

Real general to complex general........................................................................... CRGCG

Real rectangular to complex rectangular................................................................ CRRCR

Real band to complex band.................................................................................. CRBCB

Real symmetric to real general.............................................................................. CSFRG

Complex Hermitian to complex general.................................................................. CHFCG

Real symmetric band to real band......................................................................... CSBRB

Complex Hermitian band to complex band............................................................. CHBCB

Real rectangular matrix to its transpose................................................................. TRNRR

Matrix Multiplication

Compute XT X....................................................................................................... MXTXF

Compute XTY ....................................................................................................... MXTYF

Compute XYT........................................................................................................ MXYTF

Multiply two real rectangular matrices................................................................... MRRRR

Multiply two complex rectangular matrices............................................................ MCRCR

Compute matrix Hadamard product....................................................................... HRRRR

Compute the bilinear form xTAy................................................................................ BLINF

Compute the matrix polynomial p(A)...................................................................... POLRG

Matrix-Vector Multiplication

Real rectangular matrix times a real vector............................................................ MURRV

Real band matrix times a real vector..................................................................... MURBV

Complex rectangular matrix times a complex vector............................................... MUCRV

Complex band matrix times a complex vector........................................................ MUCBV

Matrix Addition

Real band matrix plus a real band matrix............................................................... ARBRB

Complex band matrix plus a complex band matrix.................................................. ACBCB

Matrix Norm

-norm of a real rectangular matrix......................................................................... NRIRR

1-norm of a real rectangular matrix......................................................................... NR1RR

Frobenius norm of a real rectangular matrix............................................................ NR2RR

1-norm of a real band matrix.................................................................................. NR1RB

1-norm of a complex band matrix........................................................................... NR1CB

Distance Between Two Points

Euclidean distance................................................................................................. DISL2

1-norm distance..................................................................................................... DISL1

-norm distance..................................................................................................... DISLI

Vector Convolutions

Convolution of real vectors.................................................................................... VCONR

Convolution of complex vectors............................................................................. VCONC

Extended Precision Arithmetic

Initialize a real accumulator, ACCa....................................................................... DQINI

Store a real accumulator, aACC........................................................................ DQSTO

Add to a real accumulator, ACCACC + a............................................................. DQADD

Add a product to a real accumulator, ACC ACC + ab.............................................. DQMUL

Initialize a complex accumulator, ACCa................................................................ ZQINI

Store a complex accumulator, aACC.................................................................. ZQSTO

Add to a complex accumulator, ACCACC + a....................................................... ZQADD

Add a product to a complex accumulator,
ACCACC + ab................................................................................................... ZQMUL



http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260