SciPy

scipy.linalg.blas.get_blas_funcs

scipy.linalg.blas.get_blas_funcs(names, arrays=(), dtype=None)[source]

Return available BLAS function objects from names.

Arrays are used to determine the optimal prefix of BLAS routines.

Parameters
namesstr or sequence of str

Name(s) of BLAS functions without type prefix.

arrayssequence of ndarrays, optional

Arrays can be given to determine optimal prefix of BLAS routines. If not given, double-precision routines will be used, otherwise the most generic type in arrays will be used.

dtypestr or dtype, optional

Data-type specifier. Not used if arrays is non-empty.

Returns
funcslist

List containing the found function(s).

Notes

This routine automatically chooses between Fortran/C interfaces. Fortran code is used whenever possible for arrays with column major order. In all other cases, C code is preferred.

In BLAS, the naming convention is that all functions start with a type prefix, which depends on the type of the principal matrix. These can be one of {‘s’, ‘d’, ‘c’, ‘z’} for the numpy types {float32, float64, complex64, complex128} respectively. The code and the dtype are stored in attributes typecode and dtype of the returned functions.

Examples

>>> import scipy.linalg as LA
>>> a = np.random.rand(3,2)
>>> x_gemv = LA.get_blas_funcs('gemv', (a,))
>>> x_gemv.typecode
'd'
>>> x_gemv = LA.get_blas_funcs('gemv',(a*1j,))
>>> x_gemv.typecode
'z'

Previous topic

Low-level BLAS functions (scipy.linalg.blas)

Next topic

scipy.linalg.blas.find_best_blas_type