
    bi                         d Z ddlmZ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ee   fdZ G d d	e      Zy)a+  
Copyright, the CVXPY authors

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OptionalTupleN)AffAtom)
Constraintaxisc                 L    |t        |t              r|dk\  sJ t        | |gz    S )Nr   )
isinstanceintConcatenate)arg_listr   s     Y/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/atoms/affine/concatenate.pyconcatenater      s.    <JtS1dai@@TF*,,    c                        e Zd ZdZd fdZdefdZdefdZdefdZd Z	de
ee      fdZdd	Zdeed
f   fdZ	 ddeed
f   deej$                  e
e   f   fdZ xZS )r   z"Concatenate along an existing axisreturnc                     t        |d   t              s|d   |d   }|d d }|| _        nd | _        t        |   |  y )N)r
   r   r   super__init__)selfargsr   	__class__s      r   r   zConcatenate.__init__#   sI    d2h$R(88D9DDIDI$r   c                      y)NF r   s    r   _supports_cppzConcatenate._supports_cpp-   s    r   c                      yNTr   r   s    r   is_atom_log_log_convexz"Concatenate.is_atom_log_log_convex0       r   c                      yr   r   r   s    r   is_atom_log_log_concavez#Concatenate.is_atom_log_log_concave3   r!   r   c                 D    t        j                  || j                        S )Nr   )npr   r   )r   valuess     r   numericzConcatenate.numeric7   s    ~~f49955r   c                     | j                   gS Nr%   r   s    r   get_datazConcatenate.get_data:   s    		{r   c                     t        j                  | j                  D cg c]6  }t        j                  |j                  t        j
                  g             8 c}| j                         y c c}w N)dtyper%   r&   r   r   emptyshaper.   r   r   args     r   validate_argumentszConcatenate.validate_arguments=   sC     	@D		JRXXciirxx|4J	
Js   ;A-.c                     t        j                  | j                  D cg c]6  }t        j                  |j                  t        j
                  g             8 c}| j                        j                  S c c}w r-   r/   r2   s     r   shape_from_argszConcatenate.shape_from_argsE   sM    ~~@D		JRXXciirxx|4J
 %	Js   ;A6r1   c                 :    t        j                  |||d         g fS )a  Concatenate the expressions along an existing axis.

        Parameters
        ----------
        arg_objs : list
            LinOp for each argument.
        shape : tuple
            The shape of the resulting expression.
        data :
            Additional data required by the atom. In this case data wraps axis

        Returns
        -------
        tuple
            (LinOp for the objective, list of constraints)
        r   )lur   )r   arg_objsr1   datas       r   graph_implementationz Concatenate.graph_implementationK   s     , xQ8"==r   )r   Nr*   )__name__
__module____qualname____doc__r   boolr   r    r#   r(   r   r   r   r+   r4   r   r6   loLinOpr   r;   __classcell__)r   s   @r   r   r       s    , t   6$x}- 
sCx  	> S#X>
 
rxxj))	*>r   r   )r   )r?   typingr   r   r   numpyr&   cvxpy.lin_ops.lin_oplin_opslin_oprA   cvxpy.lin_ops.lin_utils	lin_utilsr8   cvxpy.atoms.affine.affine_atomr   cvxpy.constraints.constraintr   r   r   r   r   r   r   <module>rM      sE     ) (  ! ! $ $ 2 3- -
A>' A>r   