scipy.linalg.
find_best_blas_type#
- scipy.linalg.find_best_blas_type(arrays=(), dtype=None)[源码]#
查找最匹配的 BLAS/LAPACK 类型。
数组用于确定 BLAS 例程的最佳前缀。
- 参数:
- arraysndarray 序列,可选
可以提供数组以确定 BLAS 例程的最佳前缀。如果未提供,将使用双精度例程;否则,将使用数组中最通用的类型。
- dtype字符串或 dtype,可选
数据类型指定符。如果 arrays 非空,则不使用。
- 返回:
- prefix字符串
BLAS/LAPACK 前缀字符。
- dtypedtype
推断出的 Numpy 数据类型。
- prefer_fortranbool
是否优先选择 Fortran 顺序例程而非 C 顺序例程。
示例
>>> import numpy as np >>> import scipy.linalg.blas as bla >>> rng = np.random.default_rng() >>> a = rng.random((10,15)) >>> b = np.asfortranarray(a) # Change the memory layout order >>> bla.find_best_blas_type((a,)) ('d', dtype('float64'), False) >>> bla.find_best_blas_type((a*1j,)) ('z', dtype('complex128'), False) >>> bla.find_best_blas_type((b,)) ('d', dtype('float64'), True)