
    bi                         d 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 dededefd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

    https://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.
    N)Variable)
Constraint)ExpCone)NonNeg)	PowCone3D)PSD)SOC)Zeroz
constraintreturnc                    t        |t              rt        | d   | dd       S t        |t              rt        |       S t        |t              rP| j                  d   }t        | j                        dk(  sJ |dz  dk(  sJ |dz  }t        | d| | ||  | | d       S t        |t              rt        |       S t        |t              rkt        | j                        dk(  sJ | j                  d   }t        |dz        }||dz  k(  sJ d       t        j                  | ||fd	
      }t        |      S t        |t              rt        t        )zv
    Given a constraint represented as Ax+b in K for K a cvxpy cone, return an
    instantiated cvxpy constraint.
    r      N)tX   g      ?   z*argument is not a vectorized square matrixF)order)
isinstancer	   r   r   shapelenr
   r   intcpreshaper   NotImplementedError)r   r   nstepNz_mats         \/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/utilities/perspective_utils.pyform_cone_constraintr"      s?   
 *c" QqTQqrU##	J	'ay	J	(GGAJ177|q   1uzz!tq$x44%&	::	J	%Aw	J	$177|q   GGAJ2JAqDyFFFy

1q!fC05z	J		*!!!!    )__doc__cvxpyr   r   cvxpy.constraints.constraintr   cvxpy.constraints.exponentialr   cvxpy.constraints.nonposr   cvxpy.constraints.powerr   cvxpy.constraints.psdr   cvxpy.constraints.second_orderr	   cvxpy.constraints.zeror
   r"    r#   r!   <module>r.      sA       3 1 + - % . '"H "* " "r#   