
    biX                     V    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
mZ ddlmZ 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)diag)vec)Variable)MaximizeMinimize)form_cone_constraintc                    ddl m}  | | j                  j                         rt        nt
        | j                              }ddi}|j                  |d      }|j                  d d |_        |j                  |      d   }|j                  j                         j                         d d }|j                  j                         j                         d   }|j                  j                         j                  dt        |      dz   fd	
      }	|	d d d df   |	d d df   }}
t               }|d   }|j                   }g }|
j"                  d   dkD  rT|
|z  ||z  z   }d}|j$                  D ]8  }|j&                  }||||z    }t)        ||      }|j+                  |       ||z  }: |j+                  | |z  |z   ||z  z
  dk\         t-        |j.                  j1                               |j"                  d   gz   }| j                  j3                         D ]  }|j.                  |j4                     }||j7                  |      dz      }|j8                  d   r|t;        |      ||| k(  gz  }X|j=                         rE|j&                  dkD  r6|j"                  d   }t?        j@                  |d      }|||   ||| k(  gz  }|j+                  tC        |d	
      ||| k(          | j                  j                         rdnd|z  |fS )Nr   )Problemuse_quad_objFT)solver_opts
ignore_dpp   F)orderr   )k)"cvxpy.problems.problemr
   f	is_convexr   r   _construct_chain
reductionsapplyqtoarrayflattenAreshapelenr   xshapeconstraintssizer   appendsortedvar_id_to_colvalues	variablesidindex
attributesr   is_symmetricnptriu_indicesr   )exprargsr
   aux_probr   chain
prob_canonr   dAbr   btsx_canonr!   x_persiconsz	var_slicepers_constraintend_indsvar	start_indend_indnindss                               u/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/reductions/dcp2cone/canonicalizers/perspective_canon.pyperspective_canonrF      s   . DDFF$4$4$6HdffMNH "5)K%%+$%OE'',EX&q)J 	&&("-A&&(,A					'	'SVAXc	'	BBa"f:r!R%yqA 	
AQAllGKwwqzA~ 7QqS)) 	CBq2I29cBO/GA	 r'zA~!+q01 j..5578GMM!<L;MMHvv! 
R,,SVV4	8>>)4Q67>>&!DI7)CCDDKCHHqL		!A??1*DCI7)CCDDKs3c2gi6PPQ
R !!#AQ.;;    )__doc__numpyr,   cvxpy.atoms.affine.diagr   cvxpy.atoms.affine.vecr   cvxpy.expressions.variabler   cvxpy.problems.objectiver   r   !cvxpy.utilities.perspective_utilsr   rF    rG   rE   <module>rP      s$     ( & / 7 BD<rG   