
    \h                     L   S r SSKJrJrJr  SSKJr  SSKJr  SSK	J
r
  SSKJrJrJr   " S S5      r\" S	\" S
S	5      SS9r\" 5       r\R%                  S\
" SS/SS//5      5        \R%                  S\
" SS/SS//5      5        \R%                  S\
" SS/SS//5      5        \R%                  S\
" SS/SS//5      5        \R%                  S\
" SS/SS//5      5        \R%                  S\
" SS/SS//5      5        \R%                  S\
" S\* /\S//5      5        \R%                  S\
" SS/SS
//5      5        \R%                  S\
" SS/S\//5      5        \R%                  S\
" SS/S\" \\-  S-  5      //5      5        \R%                  S\\
" SS/SS
//5      -  5        \R%                  S\
" SS/SS
//5      5        \R%                  S\
" / SQ/ SQ/ SQ/ SQ/5      5        \R%                  S \\
" SS/SS
//5      -  5        \R%                  S!\
" \S/S\* //5      5        g")#z7A cache for storing small matrices in multiple formats.    )IRationalpi)Pow)exp)Matrix)to_sympyto_numpyto_scipy_sparsec                   F    \ rS rSrSrSS jrS rS rS rS r	S r
S	 rS
rg)MatrixCache   a
  A cache for small matrices in different formats.

This class takes small matrices in the standard ``sympy.Matrix`` format,
and then converts these to both ``numpy.matrix`` and
``scipy.sparse.csr_matrix`` matrices. These matrices are then stored for
future recovery.
c                     0 U l         Xl        g N_cachedtype)selfr   s     Y/var/www/auris/envauris/lib/python3.13/site-packages/sympy/physics/quantum/matrixcache.py__init__MatrixCache.__init__   s    
    c                      U R                  X5         U R                  X5         U R                  X5        g! [         a     N1f = f! [         a     N/f = f! [         a     gf = f)zCache a matrix by its name.

Parameters
----------
name : str
    A descriptive name for the matrix, like "identity2".
m : list of lists
    The raw matrix data as a SymPy Matrix.
N)_sympy_matrixImportError_numpy_matrix_scipy_sparse_matrixr   namems      r   cache_matrixMatrixCache.cache_matrix   su    	t'	t'	%%d.  		  		  		s1   8 A A 
AA
AA
A%$A%c                 l    U R                   R                  X45      nUb  U$ [        SU< SU< S35      e)zGet a cached matrix by name and format.

Parameters
----------
name : str
    A descriptive name for the matrix, like "identity2".
format : str
    The format desired ('sympy', 'numpy', 'scipy.sparse')
zMatrix with name z and format z is not available.)r   getNotImplementedErrorr   r   formatr    s       r   
get_matrixMatrixCache.get_matrix1   s9     KKOOTN+=H!6
 	
r   c                 "    X0R                   X4'   g r   )r   r&   s       r   _store_matrixMatrixCache._store_matrixC   s    &'TN#r   c                 <    U R                  US[        U5      5        g )Nsympy)r+   r	   r   s      r   r   MatrixCache._sympy_matrixF   s    4(1+6r   c                 P    [        X R                  S9nU R                  USU5        g )Nr   numpy)r
   r   r+   r   s      r   r   MatrixCache._numpy_matrixI   s"    Qjj)4!,r   c                 P    [        X R                  S9nU R                  USU5        g )Nr1   zscipy.sparse)r   r   r+   r   s      r   r    MatrixCache._scipy_sparse_matrixM   s$     AZZ043r   r   N)complex)__name__
__module____qualname____firstlineno____doc__r   r!   r(   r+   r   r   r   __static_attributes__ r   r   r   r      s*    .
$(7-4r   r      F)evaluateeye2   op11op00op10op01XYZST   HHsqrt2SWAP)rB   r   r   r   )r   r   rB   r   )r   rB   r   r   )r   r   r   rB   ZXZYN)r;   sympy.core.numbersr   r   r   sympy.core.powerr   &sympy.functions.elementary.exponentialr   sympy.matrices.denser   !sympy.physics.quantum.matrixutilsr	   r
   r   r   	sqrt2_invmatrix_cacher!   r=   r   r   <module>rY      sf   = 0 0   6 ' 
D4 D4N 8B?U3	 }   &&1a&1a&)9": ;   &&1a&1a&)9": ;   &&1a&1a&)9": ;   &&1a&1a&)9": ;   &&1a&1a&)9": ;   #v1v1v&67 8   #vA2wA&78 9   #v1v2w&78 9   #v1v1v&67 8   #v1v3qtAv;/?&@A B   #y!Q!R0A)BB C   (FQFQG+<$= >   
FL,lKLN   $	&1a&1b'1B*C C D   $AQB'8 9 :r   