�
<��g�- � �� � d Z ddgZddlZddlZddlmZ ddlmZ n
# e$ r dZY nw xY w ddlm Z dZ
n# e$ r d Z
dZ Y nw xY wdZdd
lT [d� dD � � Z
e
� d
� dD � � � � e
� ddddd�� � d ej d� � fd ej d� � fd ej d� � fd ej d� � fd�Zddddd d!d"d"d#d#d$�
Zd*d&�Z d+d'�Zd(� Zed,d)�� � ZdS )-a
Low-level BLAS functions (:mod:`scipy.linalg.blas`)
===================================================
This module contains low-level functions from the BLAS library.
.. versionadded:: 0.12.0
.. note::
The common ``overwrite_<>`` option in many routines, allows the
input arrays to be overwritten to avoid extra memory allocation.
However this requires the array to satisfy two conditions
which are memory order and the data type to match exactly the
order and the type expected by the routine.
As an example, if you pass a double precision float array to any
``S....`` routine which expects single precision arguments, f2py
will create an intermediate array to match the argument types and
overwriting will be performed on that intermediate array.
Similarly, if a C-contiguous array is passed, f2py will pass a
FORTRAN-contiguous array internally. Please make sure that these
details are satisfied. More information can be found in the f2py
documentation.
.. warning::
These functions do little to no error checking.
It is possible to cause crashes by mis-using them,
so prefer using the higher-level routines in `scipy.linalg`.
Finding functions
-----------------
.. autosummary::
:toctree: generated/
get_blas_funcs
find_best_blas_type
BLAS Level 1 functions
----------------------
.. autosummary::
:toctree: generated/
caxpy
ccopy
cdotc
cdotu
crotg
cscal
csrot
csscal
cswap
dasum
daxpy
dcopy
ddot
dnrm2
drot
drotg
drotm
drotmg
dscal
dswap
dzasum
dznrm2
icamax
idamax
isamax
izamax
sasum
saxpy
scasum
scnrm2
scopy
sdot
snrm2
srot
srotg
srotm
srotmg
sscal
sswap
zaxpy
zcopy
zdotc
zdotu
zdrot
zdscal
zrotg
zscal
zswap
BLAS Level 2 functions
----------------------
.. autosummary::
:toctree: generated/
sgbmv
sgemv
sger
ssbmv
sspr
sspr2
ssymv
ssyr
ssyr2
stbmv
stpsv
strmv
strsv
dgbmv
dgemv
dger
dsbmv
dspr
dspr2
dsymv
dsyr
dsyr2
dtbmv
dtpsv
dtrmv
dtrsv
cgbmv
cgemv
cgerc
cgeru
chbmv
chemv
cher
cher2
chpmv
chpr
chpr2
ctbmv
ctbsv
ctpmv
ctpsv
ctrmv
ctrsv
csyr
zgbmv
zgemv
zgerc
zgeru
zhbmv
zhemv
zher
zher2
zhpmv
zhpr
zhpr2
ztbmv
ztbsv
ztpmv
ztrmv
ztrsv
zsyr
BLAS Level 3 functions
----------------------
.. autosummary::
:toctree: generated/
sgemm
ssymm
ssyr2k
ssyrk
strmm
strsm
dgemm
dsymm
dsyr2k
dsyrk
dtrmm
dtrsm
cgemm
chemm
cher2k
cherk
csymm
csyr2k
csyrk
ctrmm
ctrsm
zgemm
zhemm
zher2k
zherk
zsymm
zsyr2k
zsyrk
ztrmm
ztrsm
�get_blas_funcs�find_best_blas_type� N)�_fblas)�_cblas)� _fblas_64TF)�*c � � i | ]}|d ��S )� � ��.0�xs �a/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/scipy/linalg/blas.py�
<dictcomp>r � s � �'�'�'��q�!�'�'�'� z?bBhHefc � � i | ]}|d ��S )� r r s r r r � s � �,�,�,�Q�A�q�,�,�,r �iIlLqQd� � r )�F�D�g�G�s�float32�d�float64�c� complex64�z�
complex128)r
r r r �scnrm2�dznrm2�cdotc�zdotc�cgerc�zgerc�sdot�ddot)
�cnrm2�znrm2�cdot�zdot�cger�zger�sdotc�sdotu�ddotc�ddotur c �& � t j |� � }t � |j d� � }d}| r�t | � � dk r?t � | d j j d� � }| d j d }nQd� | D � � }t |� � }|� |� � }|dk rd|v rd }| | j d rd
}t � |dt j d� � f� � \ }}|||fS )
a� Find best-matching BLAS/LAPACK type.
Arrays are used to determine the optimal prefix of BLAS routines.
Parameters
----------
arrays : sequence 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.
dtype : str or dtype, optional
Data-type specifier. Not used if `arrays` is non-empty.
Returns
-------
prefix : str
BLAS/LAPACK prefix character.
dtype : dtype
Inferred Numpy data type.
prefer_fortran : bool
Whether to prefer Fortran order routines over C order.
Examples
--------
>>> 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)
� Fr
r �FORTRANc �X � g | ]'}t � |j j d � � ��(S )r6 )�_type_score�get�dtype�charr s r �
<listcomp>z'find_best_blas_type.<locals>.<listcomp>4 s* � �G�G�G�1�k�o�o�a�g�l�A�6�6�G�G�Gr r r r Tr r )
�npr; r9 r: r<