
    bi                     z    d Z ddlmZmZ ddlZddlmc mZ	 ddl
mc mZ ddlmZ ddlmZ d	dZ G d de      Zy)
a,  
Copyright 2013 Steven Diamond

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
    )ListTupleN)AffAtom)
ConstraintVstackc                     t        |  S )z/Wrapper on vstack to ensure list argument.
    )r   )arg_lists    T/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/atoms/affine/vstack.pyvstackr      s     8    c                       e Zd ZdZdefdZdefdZej                  d        Z	de
edf   fdZdd	Z	 dd
e
edf   de
ej                  ee   f   fdZy)r   zVertical concatenationreturnc                      y)z$Is the atom log-log convex?
        T selfs    r
   is_atom_log_log_convexzVstack.is_atom_log_log_convex"        r   c                      y)z%Is the atom log-log concave?
        Tr   r   s    r
   is_atom_log_log_concavezVstack.is_atom_log_log_concave'   r   r   c                 ,    t        j                  |      S N)npr   )r   valuess     r
   numericzVstack.numeric-   s    yy  r   .c                    | j                   d   j                   | j                   d   j                  dk(  rt        | j                         dfS | j                   d   j                  dk(  r1t        | j                         | j                   d   j                  d   fS t	        d | j                   D              }|f| j                   d   j                  dd  z   S )Nr      c              3   :   K   | ]  }|j                   d      yw)r   N)shape).0args     r
   	<genexpr>z)Vstack.shape_from_args.<locals>.<genexpr>9   s     9syy|9s   )argsr   ndimlensum)r   rowss     r
   shape_from_argszVstack.shape_from_args2   s    		!99Q<!		NA&&YYq\!#		NDIIaL$6$6q$9::9tyy99D7TYYq\//333r   Nc                 0   | j                   d   j                  }|dk(  rd}| j                   dd  D ]d  }|j                  }|dk(  rd}t        |      t        |      k7  s.t        |      dkD  r|dd  |dd  k7  st        |      dk  sU||k7  s[t        d       y )Nr   r   )r   r   z>All the input dimensions except for axis 0 must match exactly.)r#   r   r%   
ValueError)r   modelr!   	arg_shapes       r
   validate_argumentszVstack.validate_arguments=   s    		!""B;E99QR= 		FC		IB 	9~U+E
Q59	!"#=E
aEY$6  #D F F		Fr   r   c                 2    t        j                  ||      g fS )a  Stack the expressions vertically.

        Parameters
        ----------
        arg_objs : list
            LinExpr for each argument.
        shape : tuple
            The shape of the resulting expression.
        data :
            Additional data required by the atom.

        Returns
        -------
        tuple
            (LinOp for objective, list of constraints)
        )lur   )r   arg_objsr   datas       r
   graph_implementationzVstack.graph_implementationM   s    & 		(E*B//r   )r   Nr   )__name__
__module____qualname____doc__boolr   r   r   numpy_numericr   r   intr(   r-   loLinOpr   r   r2   r   r   r
   r   r       s      
  ! !4sCx 4F" 6:0$S#X0	rxxj))	*0r   )r   r   )r6   typingr   r   numpyr   cvxpy.lin_ops.lin_oplin_opslin_opr:   cvxpy.lin_ops.lin_utils	lin_utilsr/   cvxpy.atoms.affine.affine_atomr   cvxpy.constraints.constraintr   r   r   r   r   r
   <module>rE      s7      ! ! $ $ 2 3@0W @0r   