
    uki^                        d dl Z d dlmZmZ d dlmZmZ d dlZd dl	Z	d dl
mZ d dl
mZ d dl
mZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZmZ d dlmZmZmZ d dlmZmZm Z   ed      Z! G d de	jD                  jF                        Z$eddddejJ                  ddde&deddde&e'z  e(e)e*df      z  dejV                  dedz  dedef   defd       Z,eddddejJ                  dddedee   deee   z  ddde&e'z  e(e)e*df      z  dejV                  dedz  dedef   defd       Z,e!ddddejJ                  ddddde&e'z  e(e)e*df      z  dejV                  dedz  dedef   defd        Z,i Z-d! Z.edd"d#e&dede'e&z  e(e)e*df      z  de)e(e)e*df      ef   fd$       Z/edd"dedee   deee   z  de'e&z  e(e)e*df      z  de)e(e)e*df      ef   f
d%       Z/e!dd"de'e&z  e(e)e*df      z  de)e(e)e*df      ef   fd&       Z/d' Z0ejJ                  dfde(e   d(ee)e)e*df   e1e&   e&f      fd)Z2d* Z3ejh                  e-ejj                  <   y)+    N)overloadAny)CallableSequence)api)core)dtypes)
shape_poly)lax)util)	auto_axes)canonicalize_shardingNamedSharding)Array	ArrayLike	DTypeLike)partition_list
set_moduleunzip2z	jax.numpyc                       e Zd ZdZd Zy)UnoptimizedzUnoptimized path for einsum.c                 &    dgt        |      dz
  z  S )N)r      r   )len)selfinputsargskwargss       P/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/jax/_src/numpy/einsum.py__call__zUnoptimized.__call__'   s    8s6{Q''    N)__name__
__module____qualname____doc__r     r!   r   r   r   %   s
    $(r!   r   auto)outoptimize	precisionpreferred_element_type_dot_generalout_sharding	subscriptoperandsr(   r)   .r*   r+   r,   returnc                    y Nr&   )r.   r(   r)   r*   r+   r,   r-   r/   s           r   einsumr3   *   s     r!   arraxesc                    y r2   r&   )	r4   r5   r(   r)   r*   r+   r,   r-   r/   s	            r   r3   r3   6   s     r!   c                  | g|}|t        d      t        |d   t              r|d   nd}|du rdn|du r
t               n|}	t	        d |D              }|D 
ch c]M  }
t        |
t              rt        j                  |
      D ]"  }t        j                  |      st        |      $ O }}
}|st        j                  }n.t        t        |            }t        j                  |t               } ||dd|	d\  }}t	        d	 |D              }t#        |      }t%        |d
      }|t        |t&              st        d      t)        j*                  t,        dd      }|t)        j.                  ||      }t1        t3        j4                  d
|            }|dkD  r0|. t7        ||j8                  j:                  |      |||||d      S  |||||||      S c c}}
w )aY  Einstein summation

  JAX implementation of :func:`numpy.einsum`.

  ``einsum`` is a powerful and generic API for computing various reductions,
  inner products, outer products, axis reorderings, and combinations thereof
  across one or more input arrays. It has a somewhat complicated overloaded API;
  the arguments below reflect the most common calling convention. The Examples
  section below demonstrates some of the alternative calling conventions.

  Args:
    subscripts: string containing axes names separated by commas.
    *operands: sequence of one or more arrays corresponding to the subscripts.
    optimize: specify how to optimize the order of computation. In JAX this defaults
      to ``"auto"`` which produces optimized expressions via the opt_einsum_
      package. Other options are ``True`` (same as ``"optimal"``), ``False``
      (unoptimized), or any string supported by ``opt_einsum``, which
      includes ``"optimal"``, ``"greedy"``, ``"eager"``, and others. It may also
      be a pre-computed path (see :func:`~jax.numpy.einsum_path`).
    precision: either ``None`` (default), which means the default precision for
      the backend, a :class:`~jax.lax.Precision` enum value (``Precision.DEFAULT``,
      ``Precision.HIGH`` or ``Precision.HIGHEST``).
    preferred_element_type: either ``None`` (default), which means the default
      accumulation type for the input types, or a datatype, indicating to
      accumulate results to and return a result with that datatype.
    out: unsupported by JAX
    _dot_general: optionally override the ``dot_general`` callable used by ``einsum``.
      This parameter is experimental, and may be removed without warning at any time.

  Returns:
    array containing the result of the einstein summation.

  See also:
    :func:`jax.numpy.einsum_path`

  Examples:
    The mechanics of ``einsum`` are perhaps best demonstrated by example. Here we
    show how to use ``einsum`` to compute a number of quantities from one or more
    arrays. For more discussion and examples of ``einsum``, see the documentation
    of :func:`numpy.einsum`.

    >>> M = jnp.arange(16).reshape(4, 4)
    >>> x = jnp.arange(4)
    >>> y = jnp.array([5, 4, 3, 2])

    **Vector product**

    >>> jnp.einsum('i,i', x, y)
    Array(16, dtype=int32)
    >>> jnp.vecdot(x, y)
    Array(16, dtype=int32)

    Here are some alternative ``einsum`` calling conventions to compute the same
    result:

    >>> jnp.einsum('i,i->', x, y)  # explicit form
    Array(16, dtype=int32)
    >>> jnp.einsum(x, (0,), y, (0,))  # implicit form via indices
    Array(16, dtype=int32)
    >>> jnp.einsum(x, (0,), y, (0,), ())  # explicit form via indices
    Array(16, dtype=int32)

    **Matrix product**

    >>> jnp.einsum('ij,j->i', M, x)  # explicit form
    Array([14, 38, 62, 86], dtype=int32)
    >>> jnp.matmul(M, x)
    Array([14, 38, 62, 86], dtype=int32)

    Here are some alternative ``einsum`` calling conventions to compute the same
    result:

    >>> jnp.einsum('ij,j', M, x) # implicit form
    Array([14, 38, 62, 86], dtype=int32)
    >>> jnp.einsum(M, (0, 1), x, (1,), (0,)) # explicit form via indices
    Array([14, 38, 62, 86], dtype=int32)
    >>> jnp.einsum(M, (0, 1), x, (1,))  # implicit form via indices
    Array([14, 38, 62, 86], dtype=int32)

    **Outer product**

    >>> jnp.einsum("i,j->ij", x, y)
    Array([[ 0,  0,  0,  0],
           [ 5,  4,  3,  2],
           [10,  8,  6,  4],
           [15, 12,  9,  6]], dtype=int32)
    >>> jnp.outer(x, y)
    Array([[ 0,  0,  0,  0],
           [ 5,  4,  3,  2],
           [10,  8,  6,  4],
           [15, 12,  9,  6]], dtype=int32)

    Some other ways of computing outer products:

    >>> jnp.einsum("i,j", x, y)  # implicit form
    Array([[ 0,  0,  0,  0],
           [ 5,  4,  3,  2],
           [10,  8,  6,  4],
           [15, 12,  9,  6]], dtype=int32)
    >>> jnp.einsum(x, (0,), y, (1,), (0, 1))  # explicit form via indices
    Array([[ 0,  0,  0,  0],
           [ 5,  4,  3,  2],
           [10,  8,  6,  4],
           [15, 12,  9,  6]], dtype=int32)
    >>> jnp.einsum(x, (0,), y, (1,))  # implicit form via indices
    Array([[ 0,  0,  0,  0],
           [ 5,  4,  3,  2],
           [10,  8,  6,  4],
           [15, 12,  9,  6]], dtype=int32)

    **1D array sum**

    >>> jnp.einsum("i->", x)  # requires explicit form
    Array(6, dtype=int32)
    >>> jnp.einsum(x, (0,), ())  # explicit form via indices
    Array(6, dtype=int32)
    >>> jnp.sum(x)
    Array(6, dtype=int32)

    **Sum along an axis**

    >>> jnp.einsum("...j->...", M)  # requires explicit form
    Array([ 6, 22, 38, 54], dtype=int32)
    >>> jnp.einsum(M, (..., 0), (...,))  # explicit form via indices
    Array([ 6, 22, 38, 54], dtype=int32)
    >>> M.sum(-1)
    Array([ 6, 22, 38, 54], dtype=int32)

    **Matrix transpose**

    >>> y = jnp.array([[1, 2, 3],
    ...                [4, 5, 6]])
    >>> jnp.einsum("ij->ji", y)  # explicit form
    Array([[1, 4],
           [2, 5],
           [3, 6]], dtype=int32)
    >>> jnp.einsum("ji", y)  # implicit form
    Array([[1, 4],
           [2, 5],
           [3, 6]], dtype=int32)
    >>> jnp.einsum(y, (1, 0))  # implicit form via indices
    Array([[1, 4],
           [2, 5],
           [3, 6]], dtype=int32)
    >>> jnp.einsum(y, (0, 1), (1, 0))  # explicit form via indices
    Array([[1, 4],
           [2, 5],
           [3, 6]], dtype=int32)
    >>> jnp.transpose(y)
    Array([[1, 4],
           [2, 5],
           [3, 6]], dtype=int32)

    **Matrix diagonal**

    >>> jnp.einsum("ii->i", M)
    Array([ 0,  5, 10, 15], dtype=int32)
    >>> jnp.diagonal(M)
    Array([ 0,  5, 10, 15], dtype=int32)

    **Matrix trace**

    >>> jnp.einsum("ii", M)
    Array(30, dtype=int32)
    >>> jnp.trace(M)
    Array(30, dtype=int32)

    **Tensor products**

    >>> x = jnp.arange(30).reshape(2, 3, 5)
    >>> y = jnp.arange(60).reshape(3, 4, 5)
    >>> jnp.einsum('ijk,jlk->il', x, y)  # explicit form
    Array([[ 3340,  3865,  4390,  4915],
           [ 8290,  9940, 11590, 13240]], dtype=int32)
    >>> jnp.tensordot(x, y, axes=[(1, 2), (0, 2)])
    Array([[ 3340,  3865,  4390,  4915],
           [ 8290,  9940, 11590, 13240]], dtype=int32)
    >>> jnp.einsum('ijk,jlk', x, y)  # implicit form
    Array([[ 3340,  3865,  4390,  4915],
           [ 8290,  9940, 11590, 13240]], dtype=int32)
    >>> jnp.einsum(x, (0, 1, 2), y, (1, 3, 2), (0, 3))  # explicit form via indices
    Array([[ 3340,  3865,  4390,  4915],
           [ 8290,  9940, 11590, 13240]], dtype=int32)
    >>> jnp.einsum(x, (0, 1, 2), y, (1, 3, 2))  # implicit form via indices
    Array([[ 3340,  3865,  4390,  4915],
           [ 8290,  9940, 11590, 13240]], dtype=int32)

    **Chained dot products**

    >>> w = jnp.arange(5, 9).reshape(2, 2)
    >>> x = jnp.arange(6).reshape(2, 3)
    >>> y = jnp.arange(-2, 4).reshape(3, 2)
    >>> z = jnp.array([[2, 4, 6], [3, 5, 7]])
    >>> jnp.einsum('ij,jk,kl,lm->im', w, x, y, z)
    Array([[ 481,  831, 1181],
           [ 651, 1125, 1599]], dtype=int32)
    >>> jnp.einsum(w, (0, 1), x, (1, 2), y, (2, 3), z, (3, 4))  # implicit, via indices
    Array([[ 481,  831, 1181],
           [ 651, 1125, 1599]], dtype=int32)
    >>> w @ x @ y @ z  # direct chain of matmuls
    Array([[ 481,  831, 1181],
           [ 651, 1125, 1599]], dtype=int32)
    >>> jnp.linalg.multi_dot([w, x, y, z])
    Array([[ 481,  831, 1181],
           [ 651, 1125, 1599]], dtype=int32)

  .. _opt_einsum: https://github.com/dgasmith/opt_einsum
  Nz2The 'out' argument to jnp.einsum is not supported.r   ToptimalFc              3   X   K   | ]"  }t        |d       r|j                         n| $ yw)__jax_array__N)hasattrr:   ).0ops     r   	<genexpr>zeinsum.<locals>.<genexpr>%  s/      ' *1_)E2##%2M 's   (*)einsum_calluse_blasr)   c              3   @   K   | ]  ^}}}}|t        |      |f  y wr2   )	frozenset)r<   abc_s        r   r>   zeinsum.<locals>.<genexpr>6  s#     L1a!9Q<+Ls   r3   zJ`out_sharding` argument of `einsum` only supports NamedSharding instances.)r               )static_argnumsinline)namer   )r5   r-   )contractionsr*   r+   r,   r-   )NotImplementedError
isinstancestrr   tuplenpshaper   is_constant_dimtype
opt_einsumcontract_pathnextiter_poly_einsum_handlersget_default_poly_einsum_handlerr   r   r   r   jit_einsum
named_calllistr   ensure_arraylike_tupler   meshexplicit_axes)
subscriptsr(   r)   r*   r+   r,   r-   r/   spec	path_typer=   dnon_constant_dim_typesrX   tyrN   num_contractions
jit_einsumoperand_arrayss                      r   r3   r3   C   s   v $8$(_
R
SS"8A;4!$$#t+i(eBSYa)  '%' '(
 !
2s(;xx|
4#7#7#: 1g  
 ,,M	d)*	+B)--b2NOM(	tdYH(L L|LL,&&|X>,j}&M
	  wwwtL*	
6J33HhGH.l69,,! <93,  nlI,lLJ JOs   G1<Gc            	         t        j                  dddg      }| D cg c]=  }t        |d      r- |t        d |j                  D              |j
                        n|? }}t        |      D ci c]  \  }}t        |      | }}}t        j                  |i |\  }}	|D cg c]  }| |t        |             }
}|
|	fS c c}w c c}}w c c}w )NdummyrT   dtypec              3   F   K   | ]  }t        |      t        u r|nd   yw)   N)rV   int)r<   rh   s     r   r>   z/_default_poly_einsum_handler.<locals>.<genexpr>Z  s     Ed1gn!3Es   !)
collections
namedtupler;   rR   rT   rp   	enumerateidrW   rX   )r/   r   ro   xdummiesirh   mappingout_dummiesrN   contract_operandss              r   r]   r]   X  s    

 
 7G*<
=%4<>/07# 5EQWWEEqwwO)*+ >' >"+G"45$!QRUAX5'5(66J6J+|9DEAx1/EE	L	((>5Es   AC/C$C)r)   re   c                    y r2   r&   re   r)   r/   s      r   einsum_pathr   a  s    
 ),r!   c                    y r2   r&   )r4   r5   r)   r/   s       r   r   r   h  s     ),r!   c               p    t        |t              r|rdn	t               }t        j                  | g|d|iS )a  Evaluates the optimal contraction path without evaluating the einsum.

  JAX implementation of :func:`numpy.einsum_path`. This function calls into
  the opt_einsum_ package, and makes use of its optimization routines.

  Args:
    subscripts: string containing axes names separated by commas.
    *operands: sequence of one or more arrays corresponding to the subscripts.
    optimize: specify how to optimize the order of computation. In JAX this defaults
      to ``"auto"``. Other options are ``True`` (same as ``"optimize"``), ``False``
      (unoptimized), or any string supported by ``opt_einsum``, which
      includes ``"optimize"``,, ``"greedy"``, ``"eager"``, and others.

  Returns:
    A tuple containing the path that may be passed to :func:`~jax.numpy.einsum`, and a
    printable object representing this optimal path.

  Examples:
    >>> key1, key2, key3 = jax.random.split(jax.random.key(0), 3)
    >>> x = jax.random.randint(key1, minval=-5, maxval=5, shape=(2, 3))
    >>> y = jax.random.randint(key2, minval=-5, maxval=5, shape=(3, 100))
    >>> z = jax.random.randint(key3, minval=-5, maxval=5, shape=(100, 5))
    >>> path, path_info = jnp.einsum_path("ij,jk,kl", x, y, z, optimize="optimal")
    >>> print(path)
    [(1, 2), (0, 1)]
    >>> print(path_info)
          Complete contraction:  ij,jk,kl->il
                Naive scaling:  4
            Optimized scaling:  3
              Naive FLOP count:  9.000e+3
          Optimized FLOP count:  3.060e+3
          Theoretical speedup:  2.941e+0
          Largest intermediate:  1.500e+1 elements
        --------------------------------------------------------------------------------
        scaling        BLAS                current                             remaining
        --------------------------------------------------------------------------------
          3           GEMM              kl,jk->lj                             ij,lj->il
          3           GEMM              lj,ij->il                                il->il

    Use the computed path in :func:`~jax.numpy.einsum`:

    >>> jnp.einsum("ij,jk,kl", x, y, z, optimize=path)
    Array([[-754,  324, -142,   82,   50],
           [ 408,  -50,   87,  -29,    7]], dtype=int32)

  .. _opt_einsum: https://github.com/dgasmith/opt_einsum
  r8   r)   )rP   boolr   rW   rX   r   s      r   r   r   p  s5    j $$y+-H		!	!*	Kx	K(	KKr!   c                 p    | j                  t        j                  t        j	                  |                  S r2   )	translaterQ   	maketransdictfromkeys)scharss     r   _removecharsr     s#    	
S]]4==#78	99r!   rN   c           
        ()*+,- t        j                  | ddi\  }nt        j                  d      d}fd--fd}-fd}d }	|D ]  \  }
}}t        |      }|j	                  d	      \  }}|j	                  d
      }t        |
      dk(  rb| j                  |
d         }|\  *t        j                  *      }|D cg c]  }||   dk(  s| }} ||*|      \  }* ||*||      \  }*nt        |
      dk(  rnt        | j                  |
      \  (+|\  ), |	()t        j                  +      ,      \  () |	+,t        j                  (      )      \  +,t        j                  )      }t        j                  ,      }|D cg c]  }||   dk(  r
||   dk(  r| }} |()|      \  ()|D cg c]  }||   dk(  r
||   dk(  r| }} |+,|      \  +, |()||,z         \  () |+,||)z         \  +,t        )      t        ,      z  }|D cg c]	  }||v s| }}t        )      t        ,      z  }|D cg c]	  }||v s| }}t        ),fd|D              \  }}t        ()+,fd|D              s'J d(j                   d) d+j                   d,        dj                  |      }t        ),fd|D              \  } }!|dj                  |      z   }"t!        )|"      }#t!        ,|"      }$||$z   |#z   **|k(  r|!| f||ff}%i ndi}& |+(|%|fdi|&}nH||#z   |$z   *| |!f||ff}%*|k7  rt#        *|      ni ndi}& |(+|%|fdi|&}nt%        d      t        *      t        |      cxk(  rt        t        *            k(  sJ  J t        *      t        |      k(  sJ *|k7  r*t'        *fd|D              }'t)        j*                  ||'      }| j-                  |        t)        j.                  | d   |      S c c}w c c}w c c}w c c}w c c}w )Nreturn_weak_type_flagTr3   Fc                 H   t        j                  |       | j                  k7  r| j                        } t	        j
                  | t        j                  d| j                        | j                  t        k7  rt        j                  |      S t        j                  |      S )Nr   )r	   result_typerp   astyper   reducerS   arrayr   add
bitwise_or)rx   r5   r-   r+   s     r   sumz_einsum.<locals>.sum  s|    !34?
(()
*a::	288AqwwAGGtOl ADl r!   c                     |r3|D cg c]  }|j                  |       }} | |      } t        ||      }| |fS c c}w r2   )indexr   )operandnamesuniquesrM   r5   r   s        r   sum_uniquesz_einsum.<locals>.sum_uniques  sI    ,34Dekk$4d4GT"g5'*eE> 5s   ;c           	         |j                         D ]  \  }}|dkD  st        |      D cg c]  \  }}||k(  s| }}}t        j                  t	        j
                  d      | j                  |      }	t        j                  |	| t        j                  | d            } ||vr 
| |      } |j                  |d      } 
| |d d       } |j                  |d|dz
        } | |fS c c}}w )Nr   r   r    )
itemsrv   r   _deltarS   rp   rT   select	full_likereplace)r   r   counts
keep_namesrM   countrz   nr5   eyer   s             r   sum_repeatsz_einsum.<locals>.sum_repeats  s    ||~ 
5e	'.<da!t)<<jj&)7==$?**S'3==!+DEz!&'--b)%cr+'--b%!)4%
5 E> =s
   C(C(c                    t         j                  }t        t        |j                              D cg c]1  \  }} || j
                  |   d       xs |dk(  xs  |||   d      3 }}}t        |t        t        | j                                    \  }}	t        j                  | |      dj                  fd|	D              fS c c}}w )Nr   r   r   c              3   (   K   | ]	  }|     y wr2   r&   )r<   rz   r   s     r   r>   z9_einsum.<locals>.filter_singleton_dims.<locals>.<genexpr>  s     3PE!H3Ps   )r   definitely_equalrv   mapfindrT   r   ra   rangendimr   squeezejoin)
r   r   other_shapeother_nameseqrz   jkeep	sqez_axes	keep_axess
    `        r   filter_singleton_dimsz&_einsum.<locals>.filter_singleton_dims  s    			B!#k&6&6">?A1 7==#Q''K17KbQ6KK AD A)$U7<<5H0IJIy;;w	*BGG3Pi3P,PPPAs   6Cz->,r   r   rG   c              3   b   K   | ]&  }j                  |      j                  |      f ( y wr2   )r   r<   r   	lhs_names	rhs_namess     r   r>   z_einsum.<locals>.<genexpr>  s0      $:() &/^^A%6	q8I$J $:   ,/c              3      K   | ]M  }|v xrC |v xr= j                   j                  |         j                   j                  |         k(   O y wr2   )rT   r   )r<   rM   lhsr   rhsr   s     r   r>   z_einsum.<locals>.<genexpr>  se      &  		 	Mdi/ 	M		)//$'(CIIiood6K,LL	M&s   AAz-Incompatible reduction dimensions: lhs.shape=z lhs_names=z rhs.shape=z rhs_names=r   c              3   b   K   | ]&  }j                  |      j                  |      f ( y wr2   r   r   s     r   r>   z_einsum.<locals>.<genexpr>%  s0      "=&' $-??1#5yq7I"J "=r   r-   r+   zjax.numpy.einsum does not support simultaneous contraction of 3 or more operands. Typically this means you've passed an unsupported path to the einsum optimize parameter.c              3   @   K   | ]  }j                  |        y wr2   r   )r<   rM   r   s     r   r>   z_einsum.<locals>.<genexpr>L  s     >5;;t$>s   )r	   r   !check_and_canonicalize_user_dtypesortedsplitr   poprt   Counterr   rS   rT   setr   allr   r   _get_inverse_shardingrO   rR   r   	transposeappend_convert_element_type).r/   rN   r*   r+   r,   r-   output_weak_typer   r   r   operand_indicescontracted_names_seteinstrcontracted_names	input_strresult_namesinput_namesr   r   rM   r   
lhs_counts
rhs_countslhs_uniquesrhs_uniqueslhs_or_rhs_namesrx   lhs_and_rhs_namesbatch_names	lhs_batch	rhs_batchbatch_names_strlhs_contrhs_contdeleted_namesremaining_lhs_namesremaining_rhs_namesdimension_numbersdot_out_shardingpermr   r   r   r   r   r   s.      ` `                                  @@@@@@r   r_   r_     sj    #/5/A/A	0/)-0/,, $EE Q 8D m3o+V23$ll40I|//#&K ?q _Q/0gfe""5)f #3H$fTla6GHgH"7E7;ngu #7E6<Hngu	_		"X\\?3hc3(i -S)RXXc]-68nc9,S)RXXc]-68nc9 &&y1j&&y1j '7 Id"4(A-*T2Ba2G  Ik I"3	;?nc9&6 Id"4(A-*T2Ba2G  Ik I"3	;?nc9 #3	:#/)#;=nc9"3	:#/)#;=nc9 Y#i.8%5O>N9N!OOi.3y>9 ,G15F0FQGkG# $:-8$: :i
  & %& & :yykYK 8yykYK9	: & ,o! "=+;"= =h%0@(AAm(MB(MB
  336IIe	,	&1Iy3IJ"."6B+\: 	sC):I 36L3!13  "558KK&1Iy3IJ'38M .lE<P) 	 #/"6B+\: 	sC):I 47M4"24  	*+ + u:\*=c#e*o=====u:\****>>>dgt,gOOG[m^ 
	"	"8A;0F#3
5 5E I*II PGs0   P+P+P0P5'	P:1P:	P?P?c                 >   t              t        | j                        kD  r4| j                  | j                  j                  t                          } | j                  t	        fd|D              }t        | j                  j                  |            S )N)rf   c              3   F   K   | ]  }j                  |           y wr2   r   )r<   rM   r   rf   s     r   r>   z(_get_inverse_sharding.<locals>.<genexpr>X  s!     H$tL..t45Hs   !)
partitions)r   rf   update_normalized_spec_for_avalrR   r   rc   )r-   r   r   inverse_specrf   s     ` @r   r   r   S  s    \..//&&33C4EF ' HL			$H%HH,	|(($+++*N	OOr!   )6rt   typingr   r   collections.abcr   r   numpyrS   rW   jax._srcr   r   r	   jax._src.exportr
   jax._src.laxr   jax._src.numpyr   jax._src.pjitr   jax._src.sharding_implsr   r   jax._src.typingr   r   r   jax._src.utilr   r   r   exportpathsPathOptimizerr   dot_generalrQ   r   ra   rR   rs   PrecisionLiker3   r[   r]   r   r   rB   r_   r   _einsum_contract_path_DimExprr&   r!   r   <module>r     s      .      &   # H 7 7 < < 
K	 (*""00 (
 
 39#'/3),			 
	 Dj4c3h00		
   	 &,	 3:&	 	 
	 

 39#'/3),
	

3-
 8C=(
 
	

 Dj4c3h00
   
 &,
 3:&
 
 

  39#'/3),MJ 
MJ Dj4c3h00	MJ
   MJ &,MJ 3:&MJ MJ MJd  ) 
 58,,, Sj4c3h00, 4c3h #%&	, 
, 

 58	,	,
3-, 8C=(, Sj4c3h00	,
 4c3h #%&, 
,  4:6L Sj4c3h006L T%S/"C'(	6L 6Lp: d55kd55sCx)C.#!EFGd5LP .8-M-M j)) *r!   