
    h/t                        / S Qr SSKrSSKrSSKrSSKrSSKJr  SSKJr  SSK	J
r
JrJr  SSKJr  \R                  " \R                   SS	9rS
 r\" \5      S 5       rS r\" \5      S 5       rS r\" \5      S 5       rS rSSS.S jr\" \5      SSS.S j5       r\" \5      SSS.S j5       rS%SSS.S jjr\" \5      S&SSS.S jj5       r\" \R<                  S\R<                  5      r\" \R@                  S\R@                  5      r!\" \RD                  S\RD                  5      r#S r$/ 4S jr%S r&S r'S r(S'S jr)S'S jr*S  r+\" \+5      S! 5       r,S" r-S# r.S$ r/g)()
atleast_1d
atleast_2d
atleast_3dblockhstackstackvstack    N   )numeric)	overrides)array
asanyarraynormalize_axis_index)fromnumericnumpy)modulec                      U $ N aryss    O/var/www/fran/franai/venv/lib/python3.13/site-packages/numpy/core/shape_base.py_atleast_1d_dispatcherr          K    c                      / nU  HC  n[        U5      nUR                  S:X  a  UR                  S5      nOUnUR                  U5        ME     [	        U5      S:X  a  US   $ U$ )a  
Convert inputs to arrays with at least one dimension.

Scalar inputs are converted to 1-dimensional arrays, whilst
higher-dimensional inputs are preserved.

Parameters
----------
arys1, arys2, ... : array_like
    One or more input arrays.

Returns
-------
ret : ndarray
    An array, or list of arrays, each with ``a.ndim >= 1``.
    Copies are made only if necessary.

See Also
--------
atleast_2d, atleast_3d

Examples
--------
>>> np.atleast_1d(1.0)
array([1.])

>>> x = np.arange(9.0).reshape(3,3)
>>> np.atleast_1d(x)
array([[0., 1., 2.],
       [3., 4., 5.],
       [6., 7., 8.]])
>>> np.atleast_1d(x) is x
True

>>> np.atleast_1d(1, [3, 4])
[array([1]), array([3, 4])]

r	   r
   )r   ndimreshapeappendlenr   resaryresults       r   r   r      sa    P Co88q=[[^FF

6  3x1}1v
r   c                      U $ r   r   r   s    r   _atleast_2d_dispatcherr&   M   r   r   c                     / nU  Hl  n[        U5      nUR                  S:X  a  UR                  SS5      nO*UR                  S:X  a  U[        R                  SS24   nOUnUR                  U5        Mn     [        U5      S:X  a  US   $ U$ )a  
View inputs as arrays with at least two dimensions.

Parameters
----------
arys1, arys2, ... : array_like
    One or more array-like sequences.  Non-array inputs are converted
    to arrays.  Arrays that already have two or more dimensions are
    preserved.

Returns
-------
res, res2, ... : ndarray
    An array, or list of arrays, each with ``a.ndim >= 2``.
    Copies are avoided where possible, and views with two or more
    dimensions are returned.

See Also
--------
atleast_1d, atleast_3d

Examples
--------
>>> np.atleast_2d(3.0)
array([[3.]])

>>> x = np.arange(3.0)
>>> np.atleast_2d(x)
array([[0., 1., 2.]])
>>> np.atleast_2d(x).base is x
True

>>> np.atleast_2d(1, [1, 2], [[1, 2]])
[array([[1]]), array([[1, 2]]), array([[1, 2]])]

r	   r
   Nr   r   r   _nxnewaxisr   r    r!   s       r   r   r   Q   s    L Co88q=[[A&FXX]a(FF

6  3x1}1v
r   c                      U $ r   r   r   s    r   _atleast_3d_dispatcherr,      r   r   c                     / nU  H  n[        U5      nUR                  S:X  a  UR                  SSS5      nOdUR                  S:X  a'  U[        R                  SS2[        R                  4   nO-UR                  S:X  a  USS2SS2[        R                  4   nOUnUR                  U5        M     [        U5      S:X  a  US   $ U$ )ag  
View inputs as arrays with at least three dimensions.

Parameters
----------
arys1, arys2, ... : array_like
    One or more array-like sequences.  Non-array inputs are converted to
    arrays.  Arrays that already have three or more dimensions are
    preserved.

Returns
-------
res1, res2, ... : ndarray
    An array, or list of arrays, each with ``a.ndim >= 3``.  Copies are
    avoided where possible, and views with three or more dimensions are
    returned.  For example, a 1-D array of shape ``(N,)`` becomes a view
    of shape ``(1, N, 1)``, and a 2-D array of shape ``(M, N)`` becomes a
    view of shape ``(M, N, 1)``.

See Also
--------
atleast_1d, atleast_2d

Examples
--------
>>> np.atleast_3d(3.0)
array([[[3.]]])

>>> x = np.arange(3.0)
>>> np.atleast_3d(x).shape
(1, 3, 1)

>>> x = np.arange(12.0).reshape(4,3)
>>> np.atleast_3d(x).shape
(4, 3, 1)
>>> np.atleast_3d(x).base is x.base  # x is a reshape, so not base itself
True

>>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]):
...     print(arr, arr.shape) # doctest: +SKIP
...
[[[1]
  [2]]] (1, 2, 1)
[[[1]
  [2]]] (1, 2, 1)
[[[1 2]]] (1, 1, 2)

r	   r
   N   r(   r!   s       r   r   r      s    d Co88q=[[Aq)FXX]a45FXX]As{{*+FF

6  3x1}1v
r   c                 P    [        U S5      (       d  [        S5      e[        U 5      $ )N__getitem__zJarrays to stack must be passed as a "sequence" type such as list or tuple.)hasattr	TypeErrortuple)arrayss    r   _arrays_for_stack_dispatcherr5      s-    6=)) 1 2 	2 =r   dtypecastingc                    [        U 5      $ r   )r5   )tupr7   r8   s      r   _vhstack_dispatcherr;      s    ',,r   	same_kindc                n    [        U 6 n[        U[        5      (       d  U/n[        R                  " USXS9$ )ar  
Stack arrays in sequence vertically (row wise).

This is equivalent to concatenation along the first axis after 1-D arrays
of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by
`vsplit`.

This function makes most sense for arrays with up to 3 dimensions. For
instance, for pixel-data with a height (first axis), width (second axis),
and r/g/b channels (third axis). The functions `concatenate`, `stack` and
`block` provide more general stacking and concatenation operations.

``np.row_stack`` is an alias for `vstack`. They are the same function.

Parameters
----------
tup : sequence of ndarrays
    The arrays must have the same shape along all but the first axis.
    1-D arrays must have the same length.

dtype : str or dtype
    If provided, the destination array will have this dtype. Cannot be
    provided together with `out`.

.. versionadded:: 1.24

casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional
    Controls what kind of data casting may occur. Defaults to 'same_kind'.

.. versionadded:: 1.24

Returns
-------
stacked : ndarray
    The array formed by stacking the given arrays, will be at least 2-D.

See Also
--------
concatenate : Join a sequence of arrays along an existing axis.
stack : Join a sequence of arrays along a new axis.
block : Assemble an nd-array from nested lists of blocks.
hstack : Stack arrays in sequence horizontally (column wise).
dstack : Stack arrays in sequence depth wise (along third axis).
column_stack : Stack 1-D arrays as columns into a 2-D array.
vsplit : Split an array into multiple sub-arrays vertically (row-wise).

Examples
--------
>>> a = np.array([1, 2, 3])
>>> b = np.array([4, 5, 6])
>>> np.vstack((a,b))
array([[1, 2, 3],
       [4, 5, 6]])

>>> a = np.array([[1], [2], [3]])
>>> b = np.array([[4], [5], [6]])
>>> np.vstack((a,b))
array([[1],
       [2],
       [3],
       [4],
       [5],
       [6]])

r	   r6   )r   
isinstancelistr)   concatenater:   r7   r8   arrss       r   r   r      s6    F sDdD!!v??4%AAr   c                    [        U 6 n[        U[        5      (       d  U/nU(       a)  US   R                  S:X  a  [        R
                  " USXS9$ [        R
                  " USXS9$ )a  
Stack arrays in sequence horizontally (column wise).

This is equivalent to concatenation along the second axis, except for 1-D
arrays where it concatenates along the first axis. Rebuilds arrays divided
by `hsplit`.

This function makes most sense for arrays with up to 3 dimensions. For
instance, for pixel-data with a height (first axis), width (second axis),
and r/g/b channels (third axis). The functions `concatenate`, `stack` and
`block` provide more general stacking and concatenation operations.

Parameters
----------
tup : sequence of ndarrays
    The arrays must have the same shape along all but the second axis,
    except 1-D arrays which can be any length.

dtype : str or dtype
    If provided, the destination array will have this dtype. Cannot be
    provided together with `out`.

.. versionadded:: 1.24

casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional
    Controls what kind of data casting may occur. Defaults to 'same_kind'.

.. versionadded:: 1.24

Returns
-------
stacked : ndarray
    The array formed by stacking the given arrays.

See Also
--------
concatenate : Join a sequence of arrays along an existing axis.
stack : Join a sequence of arrays along a new axis.
block : Assemble an nd-array from nested lists of blocks.
vstack : Stack arrays in sequence vertically (row wise).
dstack : Stack arrays in sequence depth wise (along third axis).
column_stack : Stack 1-D arrays as columns into a 2-D array.
hsplit : Split an array into multiple sub-arrays horizontally (column-wise).

Examples
--------
>>> a = np.array((1,2,3))
>>> b = np.array((4,5,6))
>>> np.hstack((a,b))
array([1, 2, 3, 4, 5, 6])
>>> a = np.array([[1],[2],[3]])
>>> b = np.array([[4],[5],[6]])
>>> np.hstack((a,b))
array([[1, 4],
       [2, 5],
       [3, 6]])

r	   r
   r6   )r   r>   r?   r   r)   r@   rA   s       r   r   r   $  s[    x sDdD!!vQ!tQeEEtQeEEr   c                Z    [        U 5      n Ub  [        U 5      n U R                  U5        U $ r   )r5   r?   r   )r4   axisoutr7   r8   s        r   _stack_dispatcherrG   j  s+    )&1F
fcMr   c                   U  Vs/ s H  n[        U5      PM     n nU (       d  [        S5      eU  Vs1 s H  oUR                  iM     nn[        U5      S:w  a  [        S5      eU S   R                  S-   n[        X5      n[        S5      4U-  [        R                  4-   nU  Vs/ s H  oUU   PM	     n	n[        R                  " XUX4S9$ s  snf s  snf s  snf )a  
Join a sequence of arrays along a new axis.

The ``axis`` parameter specifies the index of the new axis in the
dimensions of the result. For example, if ``axis=0`` it will be the first
dimension and if ``axis=-1`` it will be the last dimension.

.. versionadded:: 1.10.0

Parameters
----------
arrays : sequence of array_like
    Each array must have the same shape.

axis : int, optional
    The axis in the result array along which the input arrays are stacked.

out : ndarray, optional
    If provided, the destination to place the result. The shape must be
    correct, matching that of what stack would have returned if no
    out argument were specified.

dtype : str or dtype
    If provided, the destination array will have this dtype. Cannot be
    provided together with `out`.

    .. versionadded:: 1.24

casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional
    Controls what kind of data casting may occur. Defaults to 'same_kind'.

    .. versionadded:: 1.24


Returns
-------
stacked : ndarray
    The stacked array has one more dimension than the input arrays.

See Also
--------
concatenate : Join a sequence of arrays along an existing axis.
block : Assemble an nd-array from nested lists of blocks.
split : Split array into a list of multiple sub-arrays of equal size.

Examples
--------
>>> arrays = [np.random.randn(3, 4) for _ in range(10)]
>>> np.stack(arrays, axis=0).shape
(10, 3, 4)

>>> np.stack(arrays, axis=1).shape
(3, 10, 4)

>>> np.stack(arrays, axis=2).shape
(3, 4, 10)

>>> a = np.array([1, 2, 3])
>>> b = np.array([4, 5, 6])
>>> np.stack((a, b))
array([[1, 2, 3],
       [4, 5, 6]])

>>> np.stack((a, b), axis=-1)
array([[1, 4],
       [2, 5],
       [3, 6]])

z need at least one array to stackr
   z)all input arrays must have the same shaper	   N)rE   rF   r7   r8   )
r   
ValueErrorshaper    r   r   slicer)   r*   r@   )
r4   rE   rF   r7   r8   arrshapesresult_ndimslexpanded_arrayss
             r   r   r   t  s    N *00#joF0;<<#)*6Cii6F*
6{aDEE)..1$K2D
+$	#++	/B*01&32w&O1???3!&9 9 1 + 2s   CC%C__wrapped__c                 <    SR                  S U  5       5      nSU-   $ )zE
Convert a list of indices ``[0, 1, 2]`` into ``"arrays[0][1][2]"``.
 c              3   L   #    U  H  oc  M  SR                  U5      v   M     g 7f)Nz[{}])format).0is     r   	<genexpr>&_block_format_index.<locals>.<genexpr>  s     G1&fmmA&&s   $$r4   )join)indexidx_strs     r   _block_format_indexr]     s#     ggGGGGgr   c           
      d  ^ [        U 5      [        L a#  [        SR                  [	        T5      5      5      e[        U 5      [
        L a  [        U 5      S:  a  U4S j[        U 5       5       n[        U5      u  p4nU Hj  u  pgnXX-  nXt:  a  Un[        U5      [        U5      :w  a7  [        SR                  [        U5      [        U5      [	        U5      5      5      eUS   b  Mh  UnMl     X4U4$ [        U 5      [
        L a  [        U 5      S:X  a	  TS/-   SS4$ [        U 5      nT[        U 5      U4$ )a8  
Recursive function checking that the depths of nested lists in `arrays`
all match. Mismatch raises a ValueError as described in the block
docstring below.

The entire index (rather than just the depth) needs to be calculated
for each innermost list, in case an error needs to be raised, so that
the index of the offending list can be printed as part of the error.

Parameters
----------
arrays : nested list of arrays
    The arrays to check
parent_index : list of int
    The full index of `arrays` within the nested lists passed to
    `_block_check_depths_match` at the top of the recursion.

Returns
-------
first_index : list of int
    The full index of an element from the bottom of the nesting in
    `arrays`. If any element at the bottom is an empty list, this will
    refer to it, and the last index along the empty axis will be None.
max_arr_ndim : int
    The maximum of the ndims of the arrays nested in `arrays`.
final_size: int
    The number of elements in the final array. This is used the motivate
    the choice of algorithm used using benchmarking wisdom.

z{} is a tuple. Only lists can be used to arrange blocks, and np.block does not allow implicit conversion from tuple to ndarray.r	   c              3   H   >#    U  H  u  p[        UTU/-   5      v   M     g 7fr   )_block_check_depths_match)rV   rW   rL   parent_indexs      r   rX   ,_block_check_depths_match.<locals>.<genexpr>
  s+      7$5&! 0\QC5GHH$5s   "zcList depths are mismatched. First element was at depth {}, but there is an element at depth {} ({})N)typer3   r2   rU   r]   r?   r    	enumeratenextrI   _size_ndim)	r4   ra   
idxs_ndimsfirst_indexmax_arr_ndim
final_sizer[   r   sizes	    `       r   r`   r`     sC   > F|u CCI6#L1D
 	
 
f	#f+/7$-f$57
 15Z0@-:!+EJ"#5zS-- CCI6K(E
+E2D  Ry # "," *44	f	#f+"2tf$a** V}U6]D00r   c                     [        XSSS9$ )NFT)ndmincopysubok)r   )ar   s     r   _atleast_ndrs   )  s     U$77r   c                 @    [        [        R                  " U 5      5      $ r   )r?   	itertools
accumulate)valuess    r   _accumulaterx   /  s    	$$V,--r   c                 ~  ^^	^
 U  Vs/ s H  o"T   PM	     nnU S   nUST m
UTS-   S m	[        UU	U
4S jU  5       5      (       a  [        SR                  T5      5      eT
[        U5      4-   UTS-   S -   n[	        U5      n[        S/U-   U5       VVs/ s H  u  pg[        Xg5      4PM     nnnX(4$ s  snf s  snnf )a  Given array shapes, return the resulting shape and slices prefixes.

These help in nested concatenation.

Returns
-------
shape: tuple of int
    This tuple satisfies::

        shape, _ = _concatenate_shapes([arr.shape for shape in arrs], axis)
        shape == concatenate(arrs, axis).shape

slice_prefixes: tuple of (slice(start, end), )
    For a list of arrays being concatenated, this returns the slice
    in the larger array at axis that needs to be sliced into.

    For example, the following holds::

        ret = concatenate([a, b, c], axis)
        _, (sl_a, sl_b, sl_c) = concatenate_slices([a, b, c], axis)

        ret[(slice(None),) * axis + sl_a] == a
        ret[(slice(None),) * axis + sl_b] == b
        ret[(slice(None),) * axis + sl_c] == c

    These are called slice prefixes since they are used in the recursive
    blocking algorithm to compute the left-most slices during the
    recursion. Therefore, they must be prepended to rest of the slice
    that was computed deeper in the recursion.

    These are returned as tuples to ensure that they can quickly be added
    to existing slice tuple without creating a new tuple every time.

r	   Nr
   c              3   X   >#    U  H  nUS T T:g  =(       d    UTS-   S  T:g  v   M!     g 7f)Nr
   r   )rV   rJ   rE   first_shape_postfirst_shape_pres     r   rX   &_concatenate_shapes.<locals>.<genexpr>^  sA      C;A% $<?* .a>--.;As   '*z/Mismatched array shapes in block along axis {}.)anyrI   rU   sumrx   ziprK   )rM   rE   rJ   shape_at_axisfirst_shapeoffsets_at_axisstartendslice_prefixesr{   r|   s    `       @@r   _concatenate_shapesr   3  s   H /55fU4[fM5 )K!%4(O"467+
 C;AC C C=DDTJL 	L M 244{4677KKE!-0O(+QC/,A,;)=>)=*% U(*)=  >   % 6>s   B4B9c                    X1:  a  [        U  Vs/ s H  n[        XAX#S-   5      PM     sn6 u  pVn X!-
  U-   n[        XW5      u  p[        X5       V
VVs/ s H  u  pU  H  nX-   PM	     M     nnn
n[        R                  " [
        R                  U 5      n XU 4$ [        X5      nUR                  S/U/4$ s  snf s  snnn
f )a  
Returns the shape of the final array, along with a list
of slices and a list of arrays that can be used for assignment inside the
new array

Parameters
----------
arrays : nested list of arrays
    The arrays to check
max_depth : list of int
    The number of nested lists
result_ndim : int
    The number of dimensions in thefinal array.

Returns
-------
shape : tuple of int
    The shape that the final array will take on.
slices: list of tuple of slices
    The slices into the full array required for assignment. These are
    required to be prepended with ``(Ellipsis, )`` to obtain to correct
    final index.
arrays: list of ndarray
    The data to assign to each slice of the full array

r
   r   )	r   _block_info_recursionr   	functoolsreduceoperatoraddrs   rJ   )r4   	max_depthrN   depthrL   rM   slicesrE   rJ   r   slice_prefixinner_slices	the_slices                r   r   r   l  s    6 !$!# $CKqI!"" &. 3F A 584O14O0l#/i *#/ +4O 	 1
 !!(,,7f$$ &.yy2$%%+!1s   B5B:c           
          X1:  a,  U  Vs/ s H  n[        XAX#S-   5      PM     nn[        XQU-
  * S9$ [        X5      $ s  snf )a>  
Internal implementation of block based on repeated concatenation.
`arrays` is the argument passed to
block. `max_depth` is the depth of nested lists within `arrays` and
`result_ndim` is the greatest of the dimensions of the arrays in
`arrays` and the depth of the lists in `arrays` (see block docstring
for details).
r
   )rE   )_block_concatenaters   )r4   r   rN   r   rL   rB   s         r   r   r     sY     !#!C s{!G<! 	 #D5'9:: 6//#s   =c              #   v   #    [        U 5      [        L a  U  H  n[        U5       S h  vN   M     g U v   g  N7fr   )rd   r?   _block_dispatcher)r4   	subarrayss     r   r   r     s7      F|tI(333    4s   &979c                 ^    [        U 5      u  pp#X-  S:  a  [        XU5      $ [        XU5      $ )a  
Assemble an nd-array from nested lists of blocks.

Blocks in the innermost lists are concatenated (see `concatenate`) along
the last dimension (-1), then these are concatenated along the
second-last dimension (-2), and so on until the outermost list is reached.

Blocks can be of any dimension, but will not be broadcasted using the normal
rules. Instead, leading axes of size 1 are inserted, to make ``block.ndim``
the same for all blocks. This is primarily useful for working with scalars,
and means that code like ``np.block([v, 1])`` is valid, where
``v.ndim == 1``.

When the nested list is two levels deep, this allows block matrices to be
constructed from their components.

.. versionadded:: 1.13.0

Parameters
----------
arrays : nested list of array_like or scalars (but not tuples)
    If passed a single ndarray or scalar (a nested list of depth 0), this
    is returned unmodified (and not copied).

    Elements shapes must match along the appropriate axes (without
    broadcasting), but leading 1s will be prepended to the shape as
    necessary to make the dimensions match.

Returns
-------
block_array : ndarray
    The array assembled from the given blocks.

    The dimensionality of the output is equal to the greatest of:
    * the dimensionality of all the inputs
    * the depth to which the input list is nested

Raises
------
ValueError
    * If list depths are mismatched - for instance, ``[[a, b], c]`` is
      illegal, and should be spelt ``[[a, b], [c]]``
    * If lists are empty - for instance, ``[[a, b], []]``

See Also
--------
concatenate : Join a sequence of arrays along an existing axis.
stack : Join a sequence of arrays along a new axis.
vstack : Stack arrays in sequence vertically (row wise).
hstack : Stack arrays in sequence horizontally (column wise).
dstack : Stack arrays in sequence depth wise (along third axis).
column_stack : Stack 1-D arrays as columns into a 2-D array.
vsplit : Split an array into multiple sub-arrays vertically (row-wise).

Notes
-----

When called with only scalars, ``np.block`` is equivalent to an ndarray
call. So ``np.block([[1, 2], [3, 4]])`` is equivalent to
``np.array([[1, 2], [3, 4]])``.

This function does not enforce that the blocks lie on a fixed grid.
``np.block([[a, b], [c, d]])`` is not restricted to arrays of the form::

    AAAbb
    AAAbb
    cccDD

But is also allowed to produce, for some ``a, b, c, d``::

    AAAbb
    AAAbb
    cDDDD

Since concatenation happens along the last axis first, `block` is _not_
capable of producing the following directly::

    AAAbb
    cccbb
    cccDD

Matlab's "square bracket stacking", ``[A, B, ...; p, q, ...]``, is
equivalent to ``np.block([[A, B, ...], [p, q, ...]])``.

Examples
--------
The most common use of this function is to build a block matrix

>>> A = np.eye(2) * 2
>>> B = np.eye(3) * 3
>>> np.block([
...     [A,               np.zeros((2, 3))],
...     [np.ones((3, 2)), B               ]
... ])
array([[2., 0., 0., 0., 0.],
       [0., 2., 0., 0., 0.],
       [1., 1., 3., 0., 0.],
       [1., 1., 0., 3., 0.],
       [1., 1., 0., 0., 3.]])

With a list of depth 1, `block` can be used as `hstack`

>>> np.block([1, 2, 3])              # hstack([1, 2, 3])
array([1, 2, 3])

>>> a = np.array([1, 2, 3])
>>> b = np.array([4, 5, 6])
>>> np.block([a, b, 10])             # hstack([a, b, 10])
array([ 1,  2,  3,  4,  5,  6, 10])

>>> A = np.ones((2, 2), int)
>>> B = 2 * A
>>> np.block([A, B])                 # hstack([A, B])
array([[1, 1, 2, 2],
       [1, 1, 2, 2]])

With a list of depth 2, `block` can be used in place of `vstack`:

>>> a = np.array([1, 2, 3])
>>> b = np.array([4, 5, 6])
>>> np.block([[a], [b]])             # vstack([a, b])
array([[1, 2, 3],
       [4, 5, 6]])

>>> A = np.ones((2, 2), int)
>>> B = 2 * A
>>> np.block([[A], [B]])             # vstack([A, B])
array([[1, 1],
       [1, 1],
       [2, 2],
       [2, 2]])

It can also be used in places of `atleast_1d` and `atleast_2d`

>>> a = np.array(0)
>>> b = np.array([1])
>>> np.block([a])                    # atleast_1d(a)
array([0])
>>> np.block([b])                    # atleast_1d(b)
array([1])

>>> np.block([[a]])                  # atleast_2d(a)
array([[0]])
>>> np.block([[b]])                  # atleast_2d(b)
array([[1]])


i   )_block_setup_block_slicing_block_concatenate)r4   	list_ndimrN   rl   s       r   r   r     s;    l 2>f1E.F{  /f==!&[AAr   c                     [        U 5      u  pn[        U5      nU(       a)  US   c#  [        SR                  [	        U5      5      5      e[        X$5      nXXS4$ )z8
Returns
(`arrays`, list_ndim, result_ndim, final_size)
rc   zList at {} cannot be empty)r`   r    rI   rU   r]   max)r4   bottom_indexarr_ndimrl   r   rN   s         r   r   r   o  se    
 *C6)J&LJL!IR(0(//#L1
 	

 h*Kk55r   c                 ^   [        XU5      u  p4n [        R                  " U  Vs/ s H  oUR                  PM     sn6 n[	        S U  5       5      n[	        S U  5       5      nU(       a	  U(       d  SOSn	[        R
                  " X6U	S9n
[        X@5       H  u  pXZ[        4U-   '   M     U
$ s  snf )Nc              3   >   #    U  H  oR                   S    v   M     g7f)F_CONTIGUOUSNflagsrV   rL   s     r   rX   !_block_slicing.<locals>.<genexpr>       >v))N+v   c              3   >   #    U  H  oR                   S    v   M     g7f)C_CONTIGUOUSNr   r   s     r   rX   r     r   r   FC)rJ   r7   order)r   r)   result_typer7   allemptyr   Ellipsis)r4   r   rN   rJ   r   rL   r7   F_orderC_orderr   r$   r   s               r   r   r     s    1;(E6OO6:6Cii6:;E >v>>G>v>>G7CEYYUu=F
 f-	*-{Y&' .M ;s   B*c                 J    [        XU5      nUS:X  a  UR                  5       nU$ )Nr	   )r   rp   )r4   r   rN   r$   s       r   r   r     s'    F{3FA~
 Mr   )NN)r	   N)r	   )0__all__r   ru   r   warningsrS   r   r)   r   
multiarrayr   r   r   r   _from_nxpartialarray_function_dispatchr   r   r&   r   r,   r   r5   r;   r   r   rG   r   getattrrm   rg   r   rh   r@   r   r]   r`   rs   rx   r   r   r   r   r   r   r   r   r   r   r   <module>r      s         ? ? % $++%%g7  /02 12j /02 12j /0@ 1@F '+D - ,-{ EB .EBP ,-{ BF .BFJ $ *+T9T; T9 ,T9t 	}hmm<}hmm<x++$h&:&:< 46 I1X8.6!r2&j0& *+hB ,hB^6"&r   