|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: linear algebra, BLAS
|
|
Packit |
67cb25 |
single: matrix, operations
|
|
Packit |
67cb25 |
single: vector, operations
|
|
Packit |
67cb25 |
single: BLAS
|
|
Packit |
67cb25 |
single: CBLAS
|
|
Packit |
67cb25 |
single: Basic Linear Algebra Subroutines (BLAS)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. _chap_blas-support:
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
************
|
|
Packit |
67cb25 |
BLAS Support
|
|
Packit |
67cb25 |
************
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The Basic Linear Algebra Subprograms (BLAS) define a set of fundamental
|
|
Packit |
67cb25 |
operations on vectors and matrices which can be used to create optimized
|
|
Packit |
67cb25 |
higher-level linear algebra functionality.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The library provides a low-level layer which corresponds directly to the
|
|
Packit |
67cb25 |
C-language BLAS standard, referred to here as "CBLAS", and a
|
|
Packit |
67cb25 |
higher-level interface for operations on GSL vectors and matrices.
|
|
Packit |
67cb25 |
Users who are interested in simple operations on GSL vector and matrix
|
|
Packit |
67cb25 |
objects should use the high-level layer described
|
|
Packit |
67cb25 |
in this chapter. The functions are declared in the file
|
|
Packit |
67cb25 |
:file:`gsl_blas.h` and should satisfy the needs of most users.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Note that GSL matrices are implemented using dense-storage so the
|
|
Packit |
67cb25 |
interface only includes the corresponding dense-storage BLAS
|
|
Packit |
67cb25 |
functions. The full BLAS functionality for band-format and
|
|
Packit |
67cb25 |
packed-format matrices is available through the low-level CBLAS
|
|
Packit |
67cb25 |
interface. Similarly, GSL vectors are restricted to positive strides,
|
|
Packit |
67cb25 |
whereas the low-level CBLAS interface supports negative
|
|
Packit |
67cb25 |
strides as specified in the BLAS standard [#f1]_.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The interface for the :code:`gsl_cblas` layer is specified in the file
|
|
Packit |
67cb25 |
:file:`gsl_cblas.h`. This interface corresponds to the BLAS Technical
|
|
Packit |
67cb25 |
Forum's standard for the C interface to legacy BLAS
|
|
Packit |
67cb25 |
implementations. Users who have access to other conforming CBLAS
|
|
Packit |
67cb25 |
implementations can use these in place of the version provided by the
|
|
Packit |
67cb25 |
library. Note that users who have only a Fortran BLAS library can
|
|
Packit |
67cb25 |
use a CBLAS conformant wrapper to convert it into a CBLAS
|
|
Packit |
67cb25 |
library. A reference CBLAS wrapper for legacy Fortran
|
|
Packit |
67cb25 |
implementations exists as part of the CBLAS standard and can
|
|
Packit |
67cb25 |
be obtained from Netlib. The complete set of CBLAS functions is
|
|
Packit |
67cb25 |
listed in an :ref:`appendix <chap_cblas>`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
There are three levels of BLAS operations,
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
=========== ===============================================================
|
|
Packit |
67cb25 |
**Level 1** Vector operations, e.g. :math:`y = \alpha x + y`
|
|
Packit |
67cb25 |
**Level 2** Matrix-vector operations, e.g. :math:`y = \alpha A x + \beta y`
|
|
Packit |
67cb25 |
**Level 3** Matrix-matrix operations, e.g. :math:`C = \alpha A B + C`
|
|
Packit |
67cb25 |
=========== ===============================================================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Each routine has a name which specifies the operation, the type of
|
|
Packit |
67cb25 |
matrices involved and their precisions. Some of the most common
|
|
Packit |
67cb25 |
operations and their names are given below,
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
======== =====================================
|
|
Packit |
67cb25 |
**DOT** scalar product, :math:`x^T y`
|
|
Packit |
67cb25 |
**AXPY** vector sum, :math:`\alpha x + y`
|
|
Packit |
67cb25 |
**MV** matrix-vector product, :math:`A x`
|
|
Packit |
67cb25 |
**SV** matrix-vector solve, :math:`inv(A) x`
|
|
Packit |
67cb25 |
**MM** matrix-matrix product, :math:`A B`
|
|
Packit |
67cb25 |
**SM** matrix-matrix solve, :math:`inv(A) B`
|
|
Packit |
67cb25 |
======== =====================================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The types of matrices are,
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
====== =================
|
|
Packit |
67cb25 |
**GE** general
|
|
Packit |
67cb25 |
**GB** general band
|
|
Packit |
67cb25 |
**SY** symmetric
|
|
Packit |
67cb25 |
**SB** symmetric band
|
|
Packit |
67cb25 |
**SP** symmetric packed
|
|
Packit |
67cb25 |
**HE** hermitian
|
|
Packit |
67cb25 |
**HB** hermitian band
|
|
Packit |
67cb25 |
**HP** hermitian packed
|
|
Packit |
67cb25 |
**TR** triangular
|
|
Packit |
67cb25 |
**TB** triangular band
|
|
Packit |
67cb25 |
**TP** triangular packed
|
|
Packit |
67cb25 |
====== =================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Each operation is defined for four precisions,
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
===== ==============
|
|
Packit |
67cb25 |
**S** single real
|
|
Packit |
67cb25 |
**D** double real
|
|
Packit |
67cb25 |
**C** single complex
|
|
Packit |
67cb25 |
**Z** double complex
|
|
Packit |
67cb25 |
===== ==============
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Thus, for example, the name SGEMM stands for "single-precision
|
|
Packit |
67cb25 |
general matrix-matrix multiply" and ZGEMM stands for
|
|
Packit |
67cb25 |
"double-precision complex matrix-matrix multiply".
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Note that the vector and matrix arguments to BLAS functions must not
|
|
Packit |
67cb25 |
be aliased, as the results are undefined when the underlying arrays
|
|
Packit |
67cb25 |
overlap (:ref:`aliasing-of-arrays`).
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
GSL BLAS Interface
|
|
Packit |
67cb25 |
==================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
GSL provides dense vector and matrix objects, based on the relevant
|
|
Packit |
67cb25 |
built-in types. The library provides an interface to the BLAS
|
|
Packit |
67cb25 |
operations which apply to these objects. The interface to this
|
|
Packit |
67cb25 |
functionality is given in the file :file:`gsl_blas.h`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. CblasNoTrans, CblasTrans, CblasConjTrans
|
|
Packit |
67cb25 |
.. CblasUpper, CblasLower
|
|
Packit |
67cb25 |
.. CblasNonUnit, CblasUnit
|
|
Packit |
67cb25 |
.. CblasLeft, CblasRight
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Level 1
|
|
Packit |
67cb25 |
-------
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: DOT, Level-1 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_sdsdot (float alpha, const gsl_vector_float * x, const gsl_vector_float * y, float * result)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
This function computes the sum :math:`\alpha + x^T y` for the vectors
|
|
Packit |
67cb25 |
:data:`x` and :data:`y`, returning the result in :data:`result`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_sdot (const gsl_vector_float * x, const gsl_vector_float * y, float * result)
|
|
Packit |
67cb25 |
int gsl_blas_dsdot (const gsl_vector_float * x, const gsl_vector_float * y, double * result)
|
|
Packit |
67cb25 |
int gsl_blas_ddot (const gsl_vector * x, const gsl_vector * y, double * result)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the scalar product :math:`x^T y` for the vectors
|
|
Packit |
67cb25 |
:data:`x` and :data:`y`, returning the result in :data:`result`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_cdotu (const gsl_vector_complex_float * x, const gsl_vector_complex_float * y, gsl_complex_float * dotu)
|
|
Packit |
67cb25 |
int gsl_blas_zdotu (const gsl_vector_complex * x, const gsl_vector_complex * y, gsl_complex * dotu)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the complex scalar product :math:`x^T y` for the
|
|
Packit |
67cb25 |
vectors :data:`x` and :data:`y`, returning the result in :data:`dotu`
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_cdotc (const gsl_vector_complex_float * x, const gsl_vector_complex_float * y, gsl_complex_float * dotc)
|
|
Packit |
67cb25 |
int gsl_blas_zdotc (const gsl_vector_complex * x, const gsl_vector_complex * y, gsl_complex * dotc)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the complex conjugate scalar product :math:`x^H y`
|
|
Packit |
67cb25 |
for the vectors :data:`x` and :data:`y`, returning the result in
|
|
Packit |
67cb25 |
:data:`dotc`
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: NRM2, Level-1 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: float gsl_blas_snrm2 (const gsl_vector_float * x)
|
|
Packit |
67cb25 |
double gsl_blas_dnrm2 (const gsl_vector * x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the Euclidean norm
|
|
Packit |
67cb25 |
:math:`||x||_2 = \sqrt{\sum x_i^2}` of the vector :data:`x`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: float gsl_blas_scnrm2 (const gsl_vector_complex_float * x)
|
|
Packit |
67cb25 |
double gsl_blas_dznrm2 (const gsl_vector_complex * x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the Euclidean norm of the complex vector :data:`x`,
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. math:: ||x||_2 = \sqrt{\sum (\Re(x_i)^2 + \Im(x_i)^2)}.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: ASUM, Level-1 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: float gsl_blas_sasum (const gsl_vector_float * x)
|
|
Packit |
67cb25 |
double gsl_blas_dasum (const gsl_vector * x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the absolute sum :math:`\sum |x_i|` of the
|
|
Packit |
67cb25 |
elements of the vector :data:`x`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: float gsl_blas_scasum (const gsl_vector_complex_float * x)
|
|
Packit |
67cb25 |
double gsl_blas_dzasum (const gsl_vector_complex * x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the sum of the magnitudes of the real and
|
|
Packit |
67cb25 |
imaginary parts of the complex vector :data:`x`,
|
|
Packit |
67cb25 |
:math:`\sum \left( |\Re(x_i)| + |\Im(x_i)| \right)`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: AMAX, Level-1 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: CBLAS_INDEX_t gsl_blas_isamax (const gsl_vector_float * x)
|
|
Packit |
67cb25 |
CBLAS_INDEX_t gsl_blas_idamax (const gsl_vector * x)
|
|
Packit |
67cb25 |
CBLAS_INDEX_t gsl_blas_icamax (const gsl_vector_complex_float * x)
|
|
Packit |
67cb25 |
CBLAS_INDEX_t gsl_blas_izamax (const gsl_vector_complex * x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions return the index of the largest element of the vector
|
|
Packit |
67cb25 |
:data:`x`. The largest element is determined by its absolute magnitude for
|
|
Packit |
67cb25 |
real vectors and by the sum of the magnitudes of the real and imaginary
|
|
Packit |
67cb25 |
parts :math:`|\Re(x_i)| + |\Im(x_i)|` for complex vectors. If the
|
|
Packit |
67cb25 |
largest value occurs several times then the index of the first
|
|
Packit |
67cb25 |
occurrence is returned.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: SWAP, Level-1 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_sswap (gsl_vector_float * x, gsl_vector_float * y)
|
|
Packit |
67cb25 |
int gsl_blas_dswap (gsl_vector * x, gsl_vector * y)
|
|
Packit |
67cb25 |
int gsl_blas_cswap (gsl_vector_complex_float * x, gsl_vector_complex_float * y)
|
|
Packit |
67cb25 |
int gsl_blas_zswap (gsl_vector_complex * x, gsl_vector_complex * y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions exchange the elements of the vectors :data:`x` and :data:`y`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: COPY, Level-1 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_scopy (const gsl_vector_float * x, gsl_vector_float * y)
|
|
Packit |
67cb25 |
int gsl_blas_dcopy (const gsl_vector * x, gsl_vector * y)
|
|
Packit |
67cb25 |
int gsl_blas_ccopy (const gsl_vector_complex_float * x, gsl_vector_complex_float * y)
|
|
Packit |
67cb25 |
int gsl_blas_zcopy (const gsl_vector_complex * x, gsl_vector_complex * y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions copy the elements of the vector :data:`x` into the vector
|
|
Packit |
67cb25 |
:data:`y`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: AXPY, Level-1 BLAS
|
|
Packit |
67cb25 |
single: DAXPY, Level-1 BLAS
|
|
Packit |
67cb25 |
single: SAXPY, Level-1 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_saxpy (float alpha, const gsl_vector_float * x, gsl_vector_float * y)
|
|
Packit |
67cb25 |
int gsl_blas_daxpy (double alpha, const gsl_vector * x, gsl_vector * y)
|
|
Packit |
67cb25 |
int gsl_blas_caxpy (const gsl_complex_float alpha, const gsl_vector_complex_float * x, gsl_vector_complex_float * y)
|
|
Packit |
67cb25 |
int gsl_blas_zaxpy (const gsl_complex alpha, const gsl_vector_complex * x, gsl_vector_complex * y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the sum :math:`y = \alpha x + y` for the vectors
|
|
Packit |
67cb25 |
:data:`x` and :data:`y`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: SCAL, Level-1 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: void gsl_blas_sscal (float alpha, gsl_vector_float * x)
|
|
Packit |
67cb25 |
void gsl_blas_dscal (double alpha, gsl_vector * x)
|
|
Packit |
67cb25 |
void gsl_blas_cscal (const gsl_complex_float alpha, gsl_vector_complex_float * x)
|
|
Packit |
67cb25 |
void gsl_blas_zscal (const gsl_complex alpha, gsl_vector_complex * x)
|
|
Packit |
67cb25 |
void gsl_blas_csscal (float alpha, gsl_vector_complex_float * x)
|
|
Packit |
67cb25 |
void gsl_blas_zdscal (double alpha, gsl_vector_complex * x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions rescale the vector :data:`x` by the multiplicative factor
|
|
Packit |
67cb25 |
:data:`alpha`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: ROTG, Level-1 BLAS
|
|
Packit |
67cb25 |
single: Givens Rotation, BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_srotg (float a[], float b[], float c[], float s[])
|
|
Packit |
67cb25 |
int gsl_blas_drotg (double a[], double b[], double c[], double s[])
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute a Givens rotation :math:`(c,s)` which zeroes the
|
|
Packit |
67cb25 |
vector :math:`(a,b)`,
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. only:: not texinfo
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. math::
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
\left(
|
|
Packit |
67cb25 |
\begin{matrix}
|
|
Packit |
67cb25 |
c & s \\
|
|
Packit |
67cb25 |
-s & c
|
|
Packit |
67cb25 |
\end{matrix}
|
|
Packit |
67cb25 |
\right)
|
|
Packit |
67cb25 |
\left(
|
|
Packit |
67cb25 |
\begin{matrix}
|
|
Packit |
67cb25 |
a \\
|
|
Packit |
67cb25 |
b
|
|
Packit |
67cb25 |
\end{matrix}
|
|
Packit |
67cb25 |
\right)
|
|
Packit |
67cb25 |
=
|
|
Packit |
67cb25 |
\left(
|
|
Packit |
67cb25 |
\begin{matrix}
|
|
Packit |
67cb25 |
r' \\
|
|
Packit |
67cb25 |
0
|
|
Packit |
67cb25 |
\end{matrix}
|
|
Packit |
67cb25 |
\right)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. only:: texinfo
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
::
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
[ c s ] [ a ] = [ r ]
|
|
Packit |
67cb25 |
[ -s c ] [ b ] [ 0 ]
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The variables :data:`a` and :data:`b` are overwritten by the routine.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_srot (gsl_vector_float * x, gsl_vector_float * y, float c, float s)
|
|
Packit |
67cb25 |
int gsl_blas_drot (gsl_vector * x, gsl_vector * y, const double c, const double s)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions apply a Givens rotation :math:`(x', y') = (c x + s y, -s x + c y)`
|
|
Packit |
67cb25 |
to the vectors :data:`x`, :data:`y`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: Modified Givens Rotation, BLAS
|
|
Packit |
67cb25 |
single: Givens Rotation, Modified, BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_srotmg (float d1[], float d2[], float b1[], float b2, float P[])
|
|
Packit |
67cb25 |
int gsl_blas_drotmg (double d1[], double d2[], double b1[], double b2, double P[])
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute a modified Givens transformation. The modified
|
|
Packit |
67cb25 |
Givens transformation is defined in the original Level-1 BLAS
|
|
Packit |
67cb25 |
specification, given in the references.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_srotm (gsl_vector_float * x, gsl_vector_float * y, const float P[])
|
|
Packit |
67cb25 |
int gsl_blas_drotm (gsl_vector * x, gsl_vector * y, const double P[])
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions apply a modified Givens transformation.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Level 2
|
|
Packit |
67cb25 |
-------
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: GEMV, Level-2 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_sgemv (CBLAS_TRANSPOSE_t TransA, float alpha, const gsl_matrix_float * A, const gsl_vector_float * x, float beta, gsl_vector_float * y)
|
|
Packit |
67cb25 |
int gsl_blas_dgemv (CBLAS_TRANSPOSE_t TransA, double alpha, const gsl_matrix * A, const gsl_vector * x, double beta, gsl_vector * y)
|
|
Packit |
67cb25 |
int gsl_blas_cgemv (CBLAS_TRANSPOSE_t TransA, const gsl_complex_float alpha, const gsl_matrix_complex_float * A, const gsl_vector_complex_float * x, const gsl_complex_float beta, gsl_vector_complex_float * y)
|
|
Packit |
67cb25 |
int gsl_blas_zgemv (CBLAS_TRANSPOSE_t TransA, const gsl_complex alpha, const gsl_matrix_complex * A, const gsl_vector_complex * x, const gsl_complex beta, gsl_vector_complex * y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the matrix-vector product and sum :math:`y = \alpha op(A) x + \beta y`,
|
|
Packit |
67cb25 |
where :math:`op(A) = A`, :math:`A^T`, :math:`A^H` for :data:`TransA` = :code:`CblasNoTrans`,
|
|
Packit |
67cb25 |
:code:`CblasTrans`, :code:`CblasConjTrans`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: TRMV, Level-2 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_strmv (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_matrix_float * A, gsl_vector_float * x)
|
|
Packit |
67cb25 |
int gsl_blas_dtrmv (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_matrix * A, gsl_vector * x)
|
|
Packit |
67cb25 |
int gsl_blas_ctrmv (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_matrix_complex_float * A, gsl_vector_complex_float * x)
|
|
Packit |
67cb25 |
int gsl_blas_ztrmv (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_matrix_complex * A, gsl_vector_complex * x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the matrix-vector product
|
|
Packit |
67cb25 |
:math:`x = op(A) x` for the triangular matrix :data:`A`, where
|
|
Packit |
67cb25 |
:math:`op(A) = A`, :math:`A^T`, :math:`A^H` for :data:`TransA` =
|
|
Packit |
67cb25 |
:code:`CblasNoTrans`, :code:`CblasTrans`, :code:`CblasConjTrans`. When
|
|
Packit |
67cb25 |
:data:`Uplo` is :code:`CblasUpper` then the upper triangle of :data:`A` is
|
|
Packit |
67cb25 |
used, and when :data:`Uplo` is :code:`CblasLower` then the lower triangle
|
|
Packit |
67cb25 |
of :data:`A` is used. If :data:`Diag` is :code:`CblasNonUnit` then the
|
|
Packit |
67cb25 |
diagonal of the matrix is used, but if :data:`Diag` is :code:`CblasUnit`
|
|
Packit |
67cb25 |
then the diagonal elements of the matrix :data:`A` are taken as unity and
|
|
Packit |
67cb25 |
are not referenced.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: TRSV, Level-2 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_strsv (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_matrix_float * A, gsl_vector_float * x)
|
|
Packit |
67cb25 |
int gsl_blas_dtrsv (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_matrix * A, gsl_vector * x)
|
|
Packit |
67cb25 |
int gsl_blas_ctrsv (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_matrix_complex_float * A, gsl_vector_complex_float * x)
|
|
Packit |
67cb25 |
int gsl_blas_ztrsv (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_matrix_complex * A, gsl_vector_complex * x)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute :math:`inv(op(A)) x` for :data:`x`, where
|
|
Packit |
67cb25 |
:math:`op(A) = A`, :math:`A^T`, :math:`A^H` for :data:`TransA` =
|
|
Packit |
67cb25 |
:code:`CblasNoTrans`, :code:`CblasTrans`, :code:`CblasConjTrans`. When
|
|
Packit |
67cb25 |
:data:`Uplo` is :code:`CblasUpper` then the upper triangle of :data:`A` is
|
|
Packit |
67cb25 |
used, and when :data:`Uplo` is :code:`CblasLower` then the lower triangle
|
|
Packit |
67cb25 |
of :data:`A` is used. If :data:`Diag` is :code:`CblasNonUnit` then the
|
|
Packit |
67cb25 |
diagonal of the matrix is used, but if :data:`Diag` is :code:`CblasUnit`
|
|
Packit |
67cb25 |
then the diagonal elements of the matrix :data:`A` are taken as unity and
|
|
Packit |
67cb25 |
are not referenced.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: SYMV, Level-2 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_ssymv (CBLAS_UPLO_t Uplo, float alpha, const gsl_matrix_float * A, const gsl_vector_float * x, float beta, gsl_vector_float * y)
|
|
Packit |
67cb25 |
int gsl_blas_dsymv (CBLAS_UPLO_t Uplo, double alpha, const gsl_matrix * A, const gsl_vector * x, double beta, gsl_vector * y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the matrix-vector product and sum :math:`y = \alpha A x + \beta y`
|
|
Packit |
67cb25 |
for the symmetric matrix :data:`A`. Since the
|
|
Packit |
67cb25 |
matrix :data:`A` is symmetric only its upper half or lower half need to be
|
|
Packit |
67cb25 |
stored. When :data:`Uplo` is :code:`CblasUpper` then the upper triangle
|
|
Packit |
67cb25 |
and diagonal of :data:`A` are used, and when :data:`Uplo` is
|
|
Packit |
67cb25 |
:code:`CblasLower` then the lower triangle and diagonal of :data:`A` are
|
|
Packit |
67cb25 |
used.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: HEMV, Level-2 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_chemv (CBLAS_UPLO_t Uplo, const gsl_complex_float alpha, const gsl_matrix_complex_float * A, const gsl_vector_complex_float * x, const gsl_complex_float beta, gsl_vector_complex_float * y)
|
|
Packit |
67cb25 |
int gsl_blas_zhemv (CBLAS_UPLO_t Uplo, const gsl_complex alpha, const gsl_matrix_complex * A, const gsl_vector_complex * x, const gsl_complex beta, gsl_vector_complex * y)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the matrix-vector product and sum :math:`y = \alpha A x + \beta y`
|
|
Packit |
67cb25 |
for the hermitian matrix :data:`A`. Since the
|
|
Packit |
67cb25 |
matrix :data:`A` is hermitian only its upper half or lower half need to be
|
|
Packit |
67cb25 |
stored. When :data:`Uplo` is :code:`CblasUpper` then the upper triangle
|
|
Packit |
67cb25 |
and diagonal of :data:`A` are used, and when :data:`Uplo` is
|
|
Packit |
67cb25 |
:code:`CblasLower` then the lower triangle and diagonal of :data:`A` are
|
|
Packit |
67cb25 |
used. The imaginary elements of the diagonal are automatically assumed
|
|
Packit |
67cb25 |
to be zero and are not referenced.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: GER, Level-2 BLAS
|
|
Packit |
67cb25 |
single: GERU, Level-2 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_sger (float alpha, const gsl_vector_float * x, const gsl_vector_float * y, gsl_matrix_float * A)
|
|
Packit |
67cb25 |
int gsl_blas_dger (double alpha, const gsl_vector * x, const gsl_vector * y, gsl_matrix * A)
|
|
Packit |
67cb25 |
int gsl_blas_cgeru (const gsl_complex_float alpha, const gsl_vector_complex_float * x, const gsl_vector_complex_float * y, gsl_matrix_complex_float * A)
|
|
Packit |
67cb25 |
int gsl_blas_zgeru (const gsl_complex alpha, const gsl_vector_complex * x, const gsl_vector_complex * y, gsl_matrix_complex * A)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the rank-1 update :math:`A = \alpha x y^T + A` of
|
|
Packit |
67cb25 |
the matrix :data:`A`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: GERC, Level-2 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_cgerc (const gsl_complex_float alpha, const gsl_vector_complex_float * x, const gsl_vector_complex_float * y, gsl_matrix_complex_float * A)
|
|
Packit |
67cb25 |
int gsl_blas_zgerc (const gsl_complex alpha, const gsl_vector_complex * x, const gsl_vector_complex * y, gsl_matrix_complex * A)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the conjugate rank-1 update :math:`A = \alpha x y^H + A`
|
|
Packit |
67cb25 |
of the matrix :data:`A`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: SYR, Level-2 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_ssyr (CBLAS_UPLO_t Uplo, float alpha, const gsl_vector_float * x, gsl_matrix_float * A)
|
|
Packit |
67cb25 |
int gsl_blas_dsyr (CBLAS_UPLO_t Uplo, double alpha, const gsl_vector * x, gsl_matrix * A)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the symmetric rank-1 update :math:`A = \alpha x x^T + A`
|
|
Packit |
67cb25 |
of the symmetric matrix :data:`A`. Since the matrix :data:`A` is
|
|
Packit |
67cb25 |
symmetric only its upper half or lower half need to be stored. When
|
|
Packit |
67cb25 |
:data:`Uplo` is :code:`CblasUpper` then the upper triangle and diagonal of
|
|
Packit |
67cb25 |
:data:`A` are used, and when :data:`Uplo` is :code:`CblasLower` then the
|
|
Packit |
67cb25 |
lower triangle and diagonal of :data:`A` are used.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: HER, Level-2 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_cher (CBLAS_UPLO_t Uplo, float alpha, const gsl_vector_complex_float * x, gsl_matrix_complex_float * A)
|
|
Packit |
67cb25 |
int gsl_blas_zher (CBLAS_UPLO_t Uplo, double alpha, const gsl_vector_complex * x, gsl_matrix_complex * A)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the hermitian rank-1 update :math:`A = \alpha x x^H + A`
|
|
Packit |
67cb25 |
of the hermitian matrix :data:`A`. Since the matrix :data:`A` is
|
|
Packit |
67cb25 |
hermitian only its upper half or lower half need to be stored. When
|
|
Packit |
67cb25 |
:data:`Uplo` is :code:`CblasUpper` then the upper triangle and diagonal of
|
|
Packit |
67cb25 |
:data:`A` are used, and when :data:`Uplo` is :code:`CblasLower` then the
|
|
Packit |
67cb25 |
lower triangle and diagonal of :data:`A` are used. The imaginary elements
|
|
Packit |
67cb25 |
of the diagonal are automatically set to zero.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: SYR2, Level-2 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_ssyr2 (CBLAS_UPLO_t Uplo, float alpha, const gsl_vector_float * x, const gsl_vector_float * y, gsl_matrix_float * A)
|
|
Packit |
67cb25 |
int gsl_blas_dsyr2 (CBLAS_UPLO_t Uplo, double alpha, const gsl_vector * x, const gsl_vector * y, gsl_matrix * A)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the symmetric rank-2 update :math:`A = \alpha x y^T + \alpha y x^T + A`
|
|
Packit |
67cb25 |
of the symmetric matrix :data:`A`. Since the
|
|
Packit |
67cb25 |
matrix :data:`A` is symmetric only its upper half or lower half need to be
|
|
Packit |
67cb25 |
stored. When :data:`Uplo` is :code:`CblasUpper` then the upper triangle
|
|
Packit |
67cb25 |
and diagonal of :data:`A` are used, and when :data:`Uplo` is
|
|
Packit |
67cb25 |
:code:`CblasLower` then the lower triangle and diagonal of :data:`A` are
|
|
Packit |
67cb25 |
used.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: HER2, Level-2 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_cher2 (CBLAS_UPLO_t Uplo, const gsl_complex_float alpha, const gsl_vector_complex_float * x, const gsl_vector_complex_float * y, gsl_matrix_complex_float * A)
|
|
Packit |
67cb25 |
int gsl_blas_zher2 (CBLAS_UPLO_t Uplo, const gsl_complex alpha, const gsl_vector_complex * x, const gsl_vector_complex * y, gsl_matrix_complex * A)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the hermitian rank-2 update :math:`A = \alpha x y^H + \alpha^* y x^H + A`
|
|
Packit |
67cb25 |
of the hermitian matrix :data:`A`. Since the
|
|
Packit |
67cb25 |
matrix :data:`A` is hermitian only its upper half or lower half need to be
|
|
Packit |
67cb25 |
stored. When :data:`Uplo` is :code:`CblasUpper` then the upper triangle
|
|
Packit |
67cb25 |
and diagonal of :data:`A` are used, and when :data:`Uplo` is
|
|
Packit |
67cb25 |
:code:`CblasLower` then the lower triangle and diagonal of :data:`A` are
|
|
Packit |
67cb25 |
used. The imaginary elements of the diagonal are automatically set to zero.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Level 3
|
|
Packit |
67cb25 |
-------
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: GEMM, Level-3 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_sgemm (CBLAS_TRANSPOSE_t TransA, CBLAS_TRANSPOSE_t TransB, float alpha, const gsl_matrix_float * A, const gsl_matrix_float * B, float beta, gsl_matrix_float * C)
|
|
Packit |
67cb25 |
int gsl_blas_dgemm (CBLAS_TRANSPOSE_t TransA, CBLAS_TRANSPOSE_t TransB, double alpha, const gsl_matrix * A, const gsl_matrix * B, double beta, gsl_matrix * C)
|
|
Packit |
67cb25 |
int gsl_blas_cgemm (CBLAS_TRANSPOSE_t TransA, CBLAS_TRANSPOSE_t TransB, const gsl_complex_float alpha, const gsl_matrix_complex_float * A, const gsl_matrix_complex_float * B, const gsl_complex_float beta, gsl_matrix_complex_float * C)
|
|
Packit |
67cb25 |
int gsl_blas_zgemm (CBLAS_TRANSPOSE_t TransA, CBLAS_TRANSPOSE_t TransB, const gsl_complex alpha, const gsl_matrix_complex * A, const gsl_matrix_complex * B, const gsl_complex beta, gsl_matrix_complex * C)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the matrix-matrix product and sum :math:`C = \alpha op(A) op(B) + \beta C`
|
|
Packit |
67cb25 |
where :math:`op(A) = A`, :math:`A^T`,
|
|
Packit |
67cb25 |
:math:`A^H` for :data:`TransA` = :code:`CblasNoTrans`, :code:`CblasTrans`,
|
|
Packit |
67cb25 |
:code:`CblasConjTrans` and similarly for the parameter :data:`TransB`.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: SYMM, Level-3 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_ssymm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, float alpha, const gsl_matrix_float * A, const gsl_matrix_float * B, float beta, gsl_matrix_float * C)
|
|
Packit |
67cb25 |
int gsl_blas_dsymm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, double alpha, const gsl_matrix * A, const gsl_matrix * B, double beta, gsl_matrix * C)
|
|
Packit |
67cb25 |
int gsl_blas_csymm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, const gsl_complex_float alpha, const gsl_matrix_complex_float * A, const gsl_matrix_complex_float * B, const gsl_complex_float beta, gsl_matrix_complex_float * C)
|
|
Packit |
67cb25 |
int gsl_blas_zsymm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, const gsl_complex alpha, const gsl_matrix_complex * A, const gsl_matrix_complex * B, const gsl_complex beta, gsl_matrix_complex * C)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the matrix-matrix product and sum :math:`C = \alpha A B + \beta C`
|
|
Packit |
67cb25 |
for :data:`Side` is :code:`CblasLeft` and :math:`C = \alpha B A + \beta C`
|
|
Packit |
67cb25 |
for :data:`Side` is :code:`CblasRight`, where the
|
|
Packit |
67cb25 |
matrix :data:`A` is symmetric. When :data:`Uplo` is :code:`CblasUpper` then
|
|
Packit |
67cb25 |
the upper triangle and diagonal of :data:`A` are used, and when :data:`Uplo`
|
|
Packit |
67cb25 |
is :code:`CblasLower` then the lower triangle and diagonal of :data:`A` are
|
|
Packit |
67cb25 |
used.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: HEMM, Level-3 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_chemm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, const gsl_complex_float alpha, const gsl_matrix_complex_float * A, const gsl_matrix_complex_float * B, const gsl_complex_float beta, gsl_matrix_complex_float * C)
|
|
Packit |
67cb25 |
int gsl_blas_zhemm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, const gsl_complex alpha, const gsl_matrix_complex * A, const gsl_matrix_complex * B, const gsl_complex beta, gsl_matrix_complex * C)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the matrix-matrix product and sum :math:`C = \alpha A B + \beta C`
|
|
Packit |
67cb25 |
for :data:`Side` is :code:`CblasLeft` and :math:`C = \alpha B A + \beta C`
|
|
Packit |
67cb25 |
for :data:`Side` is :code:`CblasRight`, where the
|
|
Packit |
67cb25 |
matrix :data:`A` is hermitian. When :data:`Uplo` is :code:`CblasUpper` then
|
|
Packit |
67cb25 |
the upper triangle and diagonal of :data:`A` are used, and when :data:`Uplo`
|
|
Packit |
67cb25 |
is :code:`CblasLower` then the lower triangle and diagonal of :data:`A` are
|
|
Packit |
67cb25 |
used. The imaginary elements of the diagonal are automatically set to
|
|
Packit |
67cb25 |
zero.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: TRMM, Level-3 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_strmm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, float alpha, const gsl_matrix_float * A, gsl_matrix_float * B)
|
|
Packit |
67cb25 |
int gsl_blas_dtrmm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, double alpha, const gsl_matrix * A, gsl_matrix * B)
|
|
Packit |
67cb25 |
int gsl_blas_ctrmm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_complex_float alpha, const gsl_matrix_complex_float * A, gsl_matrix_complex_float * B)
|
|
Packit |
67cb25 |
int gsl_blas_ztrmm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_complex alpha, const gsl_matrix_complex * A, gsl_matrix_complex * B)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the matrix-matrix product :math:`B = \alpha op(A) B`
|
|
Packit |
67cb25 |
for :data:`Side` is :code:`CblasLeft` and :math:`B = \alpha B op(A)` for
|
|
Packit |
67cb25 |
:data:`Side` is :code:`CblasRight`. The matrix :data:`A` is triangular and
|
|
Packit |
67cb25 |
:math:`op(A) = A`, :math:`A^T`, :math:`A^H` for :data:`TransA` =
|
|
Packit |
67cb25 |
:code:`CblasNoTrans`, :code:`CblasTrans`, :code:`CblasConjTrans`. When
|
|
Packit |
67cb25 |
:data:`Uplo` is :code:`CblasUpper` then the upper triangle of :data:`A` is
|
|
Packit |
67cb25 |
used, and when :data:`Uplo` is :code:`CblasLower` then the lower triangle
|
|
Packit |
67cb25 |
of :data:`A` is used. If :data:`Diag` is :code:`CblasNonUnit` then the
|
|
Packit |
67cb25 |
diagonal of :data:`A` is used, but if :data:`Diag` is :code:`CblasUnit` then
|
|
Packit |
67cb25 |
the diagonal elements of the matrix :data:`A` are taken as unity and are
|
|
Packit |
67cb25 |
not referenced.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: TRSM, Level-3 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_strsm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, float alpha, const gsl_matrix_float * A, gsl_matrix_float * B)
|
|
Packit |
67cb25 |
int gsl_blas_dtrsm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, double alpha, const gsl_matrix * A, gsl_matrix * B)
|
|
Packit |
67cb25 |
int gsl_blas_ctrsm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_complex_float alpha, const gsl_matrix_complex_float * A, gsl_matrix_complex_float * B)
|
|
Packit |
67cb25 |
int gsl_blas_ztrsm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, const gsl_complex alpha, const gsl_matrix_complex * A, gsl_matrix_complex * B)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute the inverse-matrix matrix product
|
|
Packit |
67cb25 |
:math:`B = \alpha op(inv(A))B` for :data:`Side` is
|
|
Packit |
67cb25 |
:code:`CblasLeft` and :math:`B = \alpha B op(inv(A))` for
|
|
Packit |
67cb25 |
:data:`Side` is :code:`CblasRight`. The matrix :data:`A` is triangular and
|
|
Packit |
67cb25 |
:math:`op(A) = A`, :math:`A^T`, :math:`A^H` for :data:`TransA` =
|
|
Packit |
67cb25 |
:code:`CblasNoTrans`, :code:`CblasTrans`, :code:`CblasConjTrans`. When
|
|
Packit |
67cb25 |
:data:`Uplo` is :code:`CblasUpper` then the upper triangle of :data:`A` is
|
|
Packit |
67cb25 |
used, and when :data:`Uplo` is :code:`CblasLower` then the lower triangle
|
|
Packit |
67cb25 |
of :data:`A` is used. If :data:`Diag` is :code:`CblasNonUnit` then the
|
|
Packit |
67cb25 |
diagonal of :data:`A` is used, but if :data:`Diag` is :code:`CblasUnit` then
|
|
Packit |
67cb25 |
the diagonal elements of the matrix :data:`A` are taken as unity and are
|
|
Packit |
67cb25 |
not referenced.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: SYRK, Level-3 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_ssyrk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, float alpha, const gsl_matrix_float * A, float beta, gsl_matrix_float * C)
|
|
Packit |
67cb25 |
int gsl_blas_dsyrk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, double alpha, const gsl_matrix * A, double beta, gsl_matrix * C)
|
|
Packit |
67cb25 |
int gsl_blas_csyrk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, const gsl_complex_float alpha, const gsl_matrix_complex_float * A, const gsl_complex_float beta, gsl_matrix_complex_float * C)
|
|
Packit |
67cb25 |
int gsl_blas_zsyrk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, const gsl_complex alpha, const gsl_matrix_complex * A, const gsl_complex beta, gsl_matrix_complex * C)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute a rank-k update of the symmetric matrix :data:`C`,
|
|
Packit |
67cb25 |
:math:`C = \alpha A A^T + \beta C` when :data:`Trans` is
|
|
Packit |
67cb25 |
:code:`CblasNoTrans` and :math:`C = \alpha A^T A + \beta C` when
|
|
Packit |
67cb25 |
:data:`Trans` is :code:`CblasTrans`. Since the matrix :data:`C` is symmetric
|
|
Packit |
67cb25 |
only its upper half or lower half need to be stored. When :data:`Uplo` is
|
|
Packit |
67cb25 |
:code:`CblasUpper` then the upper triangle and diagonal of :data:`C` are
|
|
Packit |
67cb25 |
used, and when :data:`Uplo` is :code:`CblasLower` then the lower triangle
|
|
Packit |
67cb25 |
and diagonal of :data:`C` are used.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: HERK, Level-3 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_cherk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, float alpha, const gsl_matrix_complex_float * A, float beta, gsl_matrix_complex_float * C)
|
|
Packit |
67cb25 |
int gsl_blas_zherk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, double alpha, const gsl_matrix_complex * A, double beta, gsl_matrix_complex * C)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute a rank-k update of the hermitian matrix :data:`C`,
|
|
Packit |
67cb25 |
:math:`C = \alpha A A^H + \beta C` when :data:`Trans` is
|
|
Packit |
67cb25 |
:code:`CblasNoTrans` and :math:`C = \alpha A^H A + \beta C` when
|
|
Packit |
67cb25 |
:data:`Trans` is :code:`CblasConjTrans`. Since the matrix :data:`C` is hermitian
|
|
Packit |
67cb25 |
only its upper half or lower half need to be stored. When :data:`Uplo` is
|
|
Packit |
67cb25 |
:code:`CblasUpper` then the upper triangle and diagonal of :data:`C` are
|
|
Packit |
67cb25 |
used, and when :data:`Uplo` is :code:`CblasLower` then the lower triangle
|
|
Packit |
67cb25 |
and diagonal of :data:`C` are used. The imaginary elements of the
|
|
Packit |
67cb25 |
diagonal are automatically set to zero.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: SYR2K, Level-3 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_ssyr2k (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, float alpha, const gsl_matrix_float * A, const gsl_matrix_float * B, float beta, gsl_matrix_float * C)
|
|
Packit |
67cb25 |
int gsl_blas_dsyr2k (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, double alpha, const gsl_matrix * A, const gsl_matrix * B, double beta, gsl_matrix * C)
|
|
Packit |
67cb25 |
int gsl_blas_csyr2k (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, const gsl_complex_float alpha, const gsl_matrix_complex_float * A, const gsl_matrix_complex_float * B, const gsl_complex_float beta, gsl_matrix_complex_float * C)
|
|
Packit |
67cb25 |
int gsl_blas_zsyr2k (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, const gsl_complex alpha, const gsl_matrix_complex * A, const gsl_matrix_complex * B, const gsl_complex beta, gsl_matrix_complex * C)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute a rank-2k update of the symmetric matrix :data:`C`,
|
|
Packit |
67cb25 |
:math:`C = \alpha A B^T + \alpha B A^T + \beta C` when :data:`Trans` is
|
|
Packit |
67cb25 |
:code:`CblasNoTrans` and :math:`C = \alpha A^T B + \alpha B^T A + \beta C` when
|
|
Packit |
67cb25 |
:data:`Trans` is :code:`CblasTrans`. Since the matrix :data:`C` is symmetric
|
|
Packit |
67cb25 |
only its upper half or lower half need to be stored. When :data:`Uplo` is
|
|
Packit |
67cb25 |
:code:`CblasUpper` then the upper triangle and diagonal of :data:`C` are
|
|
Packit |
67cb25 |
used, and when :data:`Uplo` is :code:`CblasLower` then the lower triangle
|
|
Packit |
67cb25 |
and diagonal of :data:`C` are used.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. index::
|
|
Packit |
67cb25 |
single: HER2K, Level-3 BLAS
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. function:: int gsl_blas_cher2k (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, const gsl_complex_float alpha, const gsl_matrix_complex_float * A, const gsl_matrix_complex_float * B, float beta, gsl_matrix_complex_float * C)
|
|
Packit |
67cb25 |
int gsl_blas_zher2k (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, const gsl_complex alpha, const gsl_matrix_complex * A, const gsl_matrix_complex * B, double beta, gsl_matrix_complex * C)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
These functions compute a rank-2k update of the hermitian matrix :data:`C`,
|
|
Packit |
67cb25 |
:math:`C = \alpha A B^H + \alpha^* B A^H + \beta C` when :data:`Trans` is
|
|
Packit |
67cb25 |
:code:`CblasNoTrans` and :math:`C = \alpha A^H B + \alpha^* B^H A + \beta C` when
|
|
Packit |
67cb25 |
:data:`Trans` is :code:`CblasConjTrans`. Since the matrix :data:`C` is hermitian
|
|
Packit |
67cb25 |
only its upper half or lower half need to be stored. When :data:`Uplo` is
|
|
Packit |
67cb25 |
:code:`CblasUpper` then the upper triangle and diagonal of :data:`C` are
|
|
Packit |
67cb25 |
used, and when :data:`Uplo` is :code:`CblasLower` then the lower triangle
|
|
Packit |
67cb25 |
and diagonal of :data:`C` are used. The imaginary elements of the
|
|
Packit |
67cb25 |
diagonal are automatically set to zero.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Examples
|
|
Packit |
67cb25 |
========
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The following program computes the product of two matrices using the
|
|
Packit |
67cb25 |
Level-3 BLAS function DGEMM,
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. only:: not texinfo
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. math::
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
\left(
|
|
Packit |
67cb25 |
\begin{matrix}
|
|
Packit |
67cb25 |
0.11&0.12&0.13 \\
|
|
Packit |
67cb25 |
0.21&0.22&0.23
|
|
Packit |
67cb25 |
\end{matrix}
|
|
Packit |
67cb25 |
\right)
|
|
Packit |
67cb25 |
\left(
|
|
Packit |
67cb25 |
\begin{matrix}
|
|
Packit |
67cb25 |
1011&1012 \\
|
|
Packit |
67cb25 |
1021&1022 \\
|
|
Packit |
67cb25 |
1031&1031
|
|
Packit |
67cb25 |
\end{matrix}
|
|
Packit |
67cb25 |
\right)
|
|
Packit |
67cb25 |
=
|
|
Packit |
67cb25 |
\left(
|
|
Packit |
67cb25 |
\begin{matrix}
|
|
Packit |
67cb25 |
367.76&368.12 \\
|
|
Packit |
67cb25 |
674.06&674.72
|
|
Packit |
67cb25 |
\end{matrix}
|
|
Packit |
67cb25 |
\right)
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. only:: texinfo
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
::
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
[ 0.11 0.12 0.13 ] [ 1011 1012 ] [ 367.76 368.12 ]
|
|
Packit |
67cb25 |
[ 0.21 0.22 0.23 ] [ 1021 1022 ] = [ 674.06 674.72 ]
|
|
Packit |
67cb25 |
[ 1031 1032 ]
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The matrices are stored in row major order, according to the C convention
|
|
Packit |
67cb25 |
for arrays.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. include:: examples/blas.c
|
|
Packit |
67cb25 |
:code:
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Here is the output from the program,
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. include:: examples/blas.txt
|
|
Packit |
67cb25 |
:code:
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. _sec_blas-references:
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
References and Further Reading
|
|
Packit |
67cb25 |
==============================
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Information on the BLAS standards, including both the legacy and
|
|
Packit |
67cb25 |
updated interface standards, is available online from the BLAS
|
|
Packit |
67cb25 |
Homepage and BLAS Technical Forum web-site.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
* BLAS Homepage, http://www.netlib.org/blas/
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
* BLAS Technical Forum, http://www.netlib.org/blas/blast-forum/
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
The following papers contain the specifications for Level 1, Level 2 and
|
|
Packit |
67cb25 |
Level 3 BLAS.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
* C. Lawson, R. Hanson, D. Kincaid, F. Krogh, "Basic Linear Algebra
|
|
Packit |
67cb25 |
Subprograms for Fortran Usage", ACM Transactions on Mathematical
|
|
Packit |
67cb25 |
Software, Vol.: 5 (1979), Pages 308--325.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
* J.J. Dongarra, J. DuCroz, S. Hammarling, R. Hanson, "An Extended Set of
|
|
Packit |
67cb25 |
Fortran Basic Linear Algebra Subprograms", ACM Transactions on
|
|
Packit |
67cb25 |
Mathematical Software, Vol.: 14, No.: 1 (1988), Pages 1--32.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
* J.J. Dongarra, I. Duff, J. DuCroz, S. Hammarling, "A Set of
|
|
Packit |
67cb25 |
Level 3 Basic Linear Algebra Subprograms", ACM Transactions on
|
|
Packit |
67cb25 |
Mathematical Software, Vol.: 16 (1990), Pages 1--28.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
Postscript versions of the latter two papers are available from
|
|
Packit |
67cb25 |
http://www.netlib.org/blas/. A CBLAS wrapper for Fortran BLAS
|
|
Packit |
67cb25 |
libraries is available from the same location.
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. rubric:: Footnotes
|
|
Packit |
67cb25 |
|
|
Packit |
67cb25 |
.. [#f1] In the low-level CBLAS interface, a negative stride accesses the vector elements
|
|
Packit |
67cb25 |
in reverse order, i.e. the :math:`i`-th element is given by
|
|
Packit |
67cb25 |
:math:`(N-i)*|incx|` for :math:`incx < 0`.
|