
    Vpf&                       d dl mZ d dlmZ d dlmZmZ d dlZd dlm	Z	 d dl
mZ d dlmZmZmZmZmZmZmZmZ d dlmZmZ d dlZg d	ZddZ G d d          Z e            Z G d d          Z e            Zeee e!f         Z" G d d          Z# G d de#          Z$ e$            Z% G d de#          Z& e&            Z'ej(        Z(ej)        Z)dS )    )annotations)Iterable)AnyUnionN)core)promote_dtypes)arangearrayconcatenateexpand_dimslinspacemeshgridstack	transpose)Array	ArrayLike)c_	index_expmgridogridr_s_ssliceop_namestrreturnr   c           	     d   t          j        d | j        d|           pd}t          j        d | j        d|           }t          j        d | j        d|           pd}t          j        |          r,t          ||t          t          |                              }nt          |||          }|S )Nzslice start of jnp.r   zslice stop of jnp.zslice step of jnp.   )r   concrete_or_errorstartstopstepnp	iscomplexr   intabsr	   )r   r   r!   r"   r#   newobjs         [/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/jax/_src/numpy/index_tricks.py_make_1d_grid_from_slicer*   "   s    

 qw!@w!@!@B B GEF 		af >W > >
@ 
@$		af >W > >
@ 
@ 
ECD \$ 'eT3s4yy>>22FFE4&&F	-    c                      e Zd ZdZddZdS )	_Mgrida?  Return dense multi-dimensional "meshgrid".

  LAX-backend implementation of :obj:`numpy.mgrid`. This is a convenience wrapper for
  functionality provided by :func:`jax.numpy.meshgrid` with ``sparse=False``.

  See Also:
    jnp.ogrid: open/sparse version of jnp.mgrid

  Examples:
    Pass ``[start:stop:step]`` to generate values similar to :func:`jax.numpy.arange`:

    >>> jnp.mgrid[0:4:1]
    Array([0, 1, 2, 3], dtype=int32)

    Passing an imaginary step generates values similar to :func:`jax.numpy.linspace`:

    >>> jnp.mgrid[0:1:4j]
    Array([0.        , 0.33333334, 0.6666667 , 1.        ], dtype=float32)

    Multiple slices can be used to create broadcasted grids of indices:

    >>> jnp.mgrid[:2, :3]
    Array([[[0, 0, 0],
            [1, 1, 1]],
           [[0, 1, 2],
            [0, 1, 2]]], dtype=int32)
  keyslice | tuple[slice, ...]r   r   c                N   t          |t                    rt          |d          S d |D             }t          j        d          5  t          | }d d d            n# 1 swxY w Y   t          |ddd}t          |          dk    rt          d          S t          |d          S )	Nr   r   c              3  8   K   | ]}t          |d           V  dS )r   r1   Nr*   .0ks     r)   	<genexpr>z%_Mgrid.__getitem__.<locals>.<genexpr>Q   1      YYPQ77KKKYYYYYYr+   standardijFindexingsparser   )

isinstancer   r*   jaxnumpy_dtype_promotionr   r   lenr	   r   )selfr.   output
output_arrs       r)   __getitem__z_Mgrid.__getitem__N   s    #u <%c7;;;;YYUXYYYF		":	.	. ' 'v&f' ' ' ' ' ' ' ' ' ' ' ' ' ' '6D???J
:!AYYQ   
AA!$A!N)r.   r/   r   r   __name__
__module____qualname____doc__rE    r+   r)   r-   r-   1   s2         8	  	  	  	  	  	 r+   r-   c                      e Zd ZdZddZdS )	_Ogrida  Return open multi-dimensional "meshgrid".

  LAX-backend implementation of :obj:`numpy.ogrid`. This is a convenience wrapper for
  functionality provided by :func:`jax.numpy.meshgrid` with ``sparse=True``.

  See Also:
    jnp.mgrid: dense version of jnp.ogrid

  Examples:
    Pass ``[start:stop:step]`` to generate values similar to :func:`jax.numpy.arange`:

    >>> jnp.ogrid[0:4:1]
    Array([0, 1, 2, 3], dtype=int32)

    Passing an imaginary step generates values similar to :func:`jax.numpy.linspace`:

    >>> jnp.ogrid[0:1:4j]
    Array([0.        , 0.33333334, 0.6666667 , 1.        ], dtype=float32)

    Multiple slices can be used to create sparse grids of indices:

    >>> jnp.ogrid[:2, :3]
    [Array([[0],
            [1]], dtype=int32),
     Array([[0, 1, 2]], dtype=int32)]
  r.   r/   r   Array | list[Array]c                    t          |t                    rt          |d          S d |D             }t          j        d          5  t          | }d d d            n# 1 swxY w Y   t          |dddS )Nr   r1   c              3  8   K   | ]}t          |d           V  dS )r   r1   Nr3   r4   s     r)   r7   z%_Ogrid.__getitem__.<locals>.<genexpr>~   r8   r+   r9   r:   Tr;   )r>   r   r*   r?   r@   r   r   )rB   r.   rC   s      r)   rE   z_Ogrid.__getitem__y   s     #u <%c7;;;;YYUXYYYF		":	.	. ' 'v&f' ' ' ' ' ' ' ' ' ' ' ' ' ' 'Vd48888rF   N)r.   r/   r   rO   rG   rL   r+   r)   rN   rN   ]   s2         69 9 9 9 9 9r+   rN   c                  L    e Zd ZU dZded<   ded<   ded<   ded<   ddZddZdS )_AxisConcatzGConcatenates slices, scalars and array-like objects along a given axis.r&   axisndmintrans1dr   r   r.   #_IndexType | tuple[_IndexType, ...]r   r   c                   t          |t                    r|n|f}| j        | j        | j        dg}|d         }t          |t
                    r|dd          }|dk    rd|d<   n|dk    rd|d<   n|                    d          }t          |          }|dk     r|||d          z  }n|d d         |d         gz   }	 t          t          t          |                    }n%# t          $ r}t          d	|          |d }~ww xY w|\  }}	}
}g }|D ]}t          |t                    rt          || j        
          }d}n<t          |t
                    rt          d          t          |d          }|j        }t          |d|	          }|
dk    rr|	|z
  dk    rit          t#          |	                    }|	t%          |	|
z   dz             |	z  z
  }t          ||d          |d |         z             }t'          ||          }|                    |           t+          t          |          |          }|dk    r|j        dk    rt-          ||          }|S )Nr   r   rc,      zcould not understand directive r1   z0string directive must be placed at the beginningF)copy)r_   rU   )rT   )r>   tuplerT   rU   rV   r   splitrA   listmapr&   
ValueErrorr   r*   r   r
   ndimranger'   r   appendr   r   )rB   r.   key_tupparams	directivevecr6   errrT   rU   rV   matrixrC   itemr(   	item_ndim	shape_objnum_lshiftsress                      r)   rE   z_AxisConcat.__getitem__   s   -7U-C-C&Occ#GiT\26F
I)S!! g	c		r

r

"--HHq55

## BQB6":,&#	C&&&& 	 	 	;i;; 	
 $* D%&F  	D%	 	   )$EEE		dC    KLLLt%(((K	V%u555f	B59,q00%,,''	c%'/A"566>>)KLL1Il{l4KKLL	69--mmF
eFmm$
/
/
/C||AV$$cJs   <"C 
D)C<<Dc                    dS )Nr   rL   )rB   s    r)   __len__z_AxisConcat.__len__   s    1r+   N)r.   rW   r   r   )r   r&   )rH   rI   rJ   rK   __annotations__rE   rt   rL   r+   r)   rS   rS      si         OO)))***,,,,,,; ; ; ;z     r+   rS   c                  "    e Zd ZdZdZdZdZdZdS )RClassaW  Concatenate slices, scalars and array-like objects along the first axis.

  LAX-backend implementation of :obj:`numpy.r_`.

  See Also:
    ``jnp.c_``: Concatenates slices, scalars and array-like objects along the last axis.

  Examples:
    Passing slices in the form ``[start:stop:step]`` generates ``jnp.arange`` objects:

    >>> jnp.r_[-1:5:1, 0, 0, jnp.array([1,2,3])]
    Array([-1,  0,  1,  2,  3,  4,  0,  0,  1,  2,  3], dtype=int32)

    An imaginary value for ``step`` will create a ``jnp.linspace`` object instead,
    which includes the right endpoint:

    >>> jnp.r_[-1:1:6j, 0, jnp.array([1,2,3])]
    Array([-1.        , -0.6       , -0.20000002,  0.20000005,
           0.6       ,  1.        ,  0.        ,  1.        ,
           2.        ,  3.        ], dtype=float32)

    Use a string directive of the form ``"axis,dims,trans1d"`` as the first argument to
    specify concatenation axis, minimum number of dimensions, and the position of the
    upgraded array's original dimensions in the resulting array's shape tuple:

    >>> jnp.r_['0,2', [1,2,3], [4,5,6]] # concatenate along first axis, 2D output
    Array([[1, 2, 3],
           [4, 5, 6]], dtype=int32)

    >>> jnp.r_['0,2,0', [1,2,3], [4,5,6]] # push last input axis to the front
    Array([[1],
           [2],
           [3],
           [4],
           [5],
           [6]], dtype=int32)

    Negative values for ``trans1d`` offset the last axis towards the start
    of the shape tuple:

    >>> jnp.r_['0,2,-2', [1,2,3], [4,5,6]]
    Array([[1],
           [2],
           [3],
           [4],
           [5],
           [6]], dtype=int32)

    Use the special directives ``"r"`` or ``"c"`` as the first argument on flat inputs
    to create an array with an extra row or column axis, respectively:

    >>> jnp.r_['r',[1,2,3], [4,5,6]]
    Array([[1, 2, 3, 4, 5, 6]], dtype=int32)

    >>> jnp.r_['c',[1,2,3], [4,5,6]]
    Array([[1],
           [2],
           [3],
           [4],
           [5],
           [6]], dtype=int32)

    For higher-dimensional inputs (``dim >= 2``), both directives ``"r"`` and ``"c"``
    give the same result.
  r   r   rY   r   NrH   rI   rJ   rK   rT   rU   rV   r   rL   r+   r)   rw   rw      s1        @ @B 
$
%''''r+   rw   c                  "    e Zd ZdZdZdZdZdZdS )CClassaz  Concatenate slices, scalars and array-like objects along the last axis.

  LAX-backend implementation of :obj:`numpy.c_`.

  See Also:
    ``jnp.r_``: Concatenates slices, scalars and array-like objects along the first axis.

  Examples:

    >>> a = jnp.arange(6).reshape((2,3))
    >>> jnp.c_[a,a]
    Array([[0, 1, 2, 0, 1, 2],
           [3, 4, 5, 3, 4, 5]], dtype=int32)

    Use a string directive of the form ``"axis:dims:trans1d"`` as the first argument to specify
    concatenation axis, minimum number of dimensions, and the position of the upgraded array's
    original dimensions in the resulting array's shape tuple:

    >>> jnp.c_['0,2', [1,2,3], [4,5,6]]
    Array([[1],
           [2],
           [3],
           [4],
           [5],
           [6]], dtype=int32)

    >>> jnp.c_['0,2,-1', [1,2,3], [4,5,6]]
    Array([[1, 2, 3],
           [4, 5, 6]], dtype=int32)

    Use the special directives ``"r"`` or ``"c"`` as the first argument on flat inputs
    to create an array with inputs stacked along the last axis:

    >>> jnp.c_['r',[1,2,3], [4,5,6]]
    Array([[1, 4],
           [2, 5],
           [3, 6]], dtype=int32)
  rY      r   r   Nrx   rL   r+   r)   rz   rz     s/        % %L 
$
%''''r+   rz   )r   r   r   r   r   r   )*
__future__r   collections.abcr   typingr   r   r?   jax._srcr   jax._src.numpy.utilr   jax._src.numpy.lax_numpyr	   r
   r   r   r   r   r   r   jax._src.typingr   r   numpyr$   __all__r*   r-   r   rN   r   r   r   
_IndexTyperS   rw   r   rz   r   r   r   rL   r+   r)   <module>r      sU   # " " " " " $ $ $ $ $ $         



       . . . . . .                    - , , , , , , ,     <
;
;   &  &  &  &  &  &  &  & R 	$9 $9 $9 $9 $9 $9 $9 $9N 	 9c5()
E E E E E E E EPE E E E E[ E E EP VXX* * * * *[ * * *Z VXXUL			r+   