scipy.linalg.get_blas_funcs¶
- scipy.linalg.get_blas_funcs(names, arrays=(), dtype=None, ilp64=False)[源代码]¶
从名称返回可用的BLAS函数对象。
数组用于确定BLAS例程的最佳前缀。
- 参数
- names字符串或字符串序列
不带类型前缀的BLAS函数的名称。
- arraysndarray序列,可选
可以给出数组来确定BLAS例程的最佳前缀。如果未指定,将使用双精度例程,否则将使用数组中最一般的类型。
- dtype字符串或数据类型,可选
数据类型说明符。在以下情况下不使用 arrays 是非空的。
- ilp64{True,False,‘首选’},可选
是否返回ILP64例程变量。选择“首选”将返回ILP64例程(如果可用),否则返回32位例程。默认值:False
- 退货
- funcs列表
包含找到的函数的列表。
注意事项
此例程自动在Fortran/C接口之间进行选择。只要有可能,Fortran代码就会用于列主顺序的数组。在所有其他情况下,最好使用C代码。
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.
示例
>>> import scipy.linalg as LA >>> rng = np.random.default_rng() >>> a = rng.random((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'