
    bi.                     Z    d Z ddlmZmZ ddlZddlmZ ddl	m
Z
 ddlm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)AxisAtom)
Constraintc                       e Zd ZdZd Zdeeef   fdZdefdZdefdZ	defdZ
defdZdefd	Zdefd
ZdefdZd ZdefdZdee   fdZd Zd Zy)norm_infTc                    | j                   at        j                  |d         r"|d   j                         j	                         }n?t        j                  |d         j	                         }nt        j                  |d         }t
        j                  j                  |t
        j                  | j                   | j                        S )z#Returns the inf norm of x.
        r   )axiskeepdims)r
   spissparsetoarrayflattennparraylinalgnorminfr   selfvaluess     O/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/atoms/norm_inf.pynumericznorm_inf.numeric   s     99{{6!9%**,446&),446XXfQi(Fyy~~fbff499t}}~UU    returnc                      y)zCReturns sign (is positive, is negative) of the expression.
        )TF r   s    r   sign_from_argsznorm_inf.sign_from_args(   s     r   c                      y)zIs the atom convex?
        Tr   r   s    r   is_atom_convexznorm_inf.is_atom_convex.        r   c                      y)zIs the atom concave?
        Fr   r   s    r   is_atom_concaveznorm_inf.is_atom_concave3        r   c                      y)z$Is the atom log-log convex?
        Tr   r   s    r   is_atom_log_log_convexznorm_inf.is_atom_log_log_convex8   r"   r   c                      y)z%Is the atom log-log concave?
        Fr   r   s    r   is_atom_log_log_concavez norm_inf.is_atom_log_log_concave=   r%   r   c                 <    | j                   d   j                         S )z;Is the composition non-decreasing in argument idx?
        r   )args	is_nonnegr   idxs     r   is_incrznorm_inf.is_incrB        yy|%%''r   c                 <    | j                   d   j                         S )z;Is the composition non-increasing in argument idx?
        r   )r+   	is_nonposr-   s     r   is_decrznorm_inf.is_decrG   r0   r   c                 <    | j                   d   j                         S )z&Is the atom piecewise linear?
        r   )r+   is_pwlr   s    r   r5   znorm_inf.is_pwlL   s     yy|""$$r   c                     | j                   gS )N)r
   r   s    r   get_dataznorm_inf.get_dataQ   s    		{r   c                 p    | j                   j                  d| j                  d   j                         dS )N(r   ))	__class____name__r+   namer   s    r   r=   znorm_inf.nameT   s-    >>2299Q<,,.0 	0r   c                     g S )z?Returns constraints describing the domain of the node.
        r   r   s    r   _domainznorm_inf._domainX   s	     	r   c                 $    | j                  |      S )a+  Gives the (sub/super)gradient of the atom w.r.t. each argument.

        Matrix expressions are vectorized, so the gradient is a matrix.

        Args:
            values: A list of numeric values for the arguments.

        Returns:
            A list of SciPy CSC sparse matrices or None.
        )
_axis_gradr   s     r   _gradznorm_inf._grad]   s     v&&r   c                     t         )a  Gives the (sub/super)gradient of the atom w.r.t. a column argument.

        Matrix expressions are vectorized, so the gradient is a matrix.

        Args:
            value: A numeric value for a column.

        Returns:
            A NumPy ndarray matrix or None.
        )NotImplementedError)r   values     r   _column_gradznorm_inf._column_gradj   s
     "!r   N)r<   
__module____qualname___allow_complexr   r   boolr   r!   r$   r'   r)   r/   r3   r5   r7   strr=   r   r   r?   rB   rF   r   r   r   r   r      s    N
VdDj 1  
 
 
 
(d (
(d (
% %
0c 0j) 
'"r   r   )__doc__typingr   r   numpyr   scipy.sparsesparser   cvxpy.atoms.axis_atomr   cvxpy.constraints.constraintr   r   r   r   r   <module>rS      s)       * 3]"x ]"r   