
    bi
                     \    d Z ddlmZ ddlZddlmZ ddlm	Z	 ddl
mZ d Z G d de      Zy)	a,  
Copyright 2018 Akshay Agrawal

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.
    )TupleN)multiply)Atomc                 2    t        | t        || z              S )a)  The difference :math:`x - y` with domain `\{x, y : x > y > 0\}`.

    This atom is log-log concave.

    Parameters
    ----------
    x : :class:`~cvxpy.expressions.expression.Expression`
        An Expression.
    y : :class:`~cvxpy.expressions.expression.Expression`
        An Expression.
    )r   one_minus_pos)xys     T/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/atoms/one_minus_pos.pydiff_posr      s     A}QqS)**    c                        e Zd ZdZd fdZd Zd ZdefdZde	e
df   f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 xZS )r   zThe difference :math:`1 - x` with domain `\{x : 0 < x < 1\}`.

    This atom is log-log concave.

    Parameters
    ----------
    x : :class:`~cvxpy.expressions.expression.Expression`
        An Expression.
    returnc                     t         t        |   |       || j                  d<   t	        j
                  | j                  d   j                        | _        y Nr   )superr   __init__argsnponesshape_ones)selfr   	__class__s     r
   r   zone_minus_pos.__init__3   s=    mT+A.		!WWTYYq\//0
r   c                 &    | j                   |d   z
  S r   )r   r   valuess     r
   numericzone_minus_pos.numeric8   s    zzF1I%%r   c                 H    ~t        j                  d| j                  z        S )Ng      )sp	csc_arrayr   r   s     r
   _gradzone_minus_pos._grad;   s    ||D4::-..r   c                 T    | j                   j                  d| j                  d   dS )N(r   ))r   __name__r   r   s    r
   namezone_minus_pos.name?   s    >>22DIIaLAAr   .c                 4    | j                   d   j                  S )z8Returns the (row, col) shape of the expression.
        r   )r   r   r&   s    r
   shape_from_argszone_minus_pos.shape_from_argsB   s     yy|!!!r   c                      y)zCReturns sign (is positive, is negative) of the expression.
        )TF r&   s    r
   sign_from_argszone_minus_pos.sign_from_argsG   s     r   c                      y)zIs the atom convex?
        Fr+   r&   s    r
   is_atom_convexzone_minus_pos.is_atom_convexL        r   c                      y)zIs the atom concave?
        Fr+   r&   s    r
   is_atom_concavezone_minus_pos.is_atom_concaveQ   r/   r   c                      y)z$Is the atom log-log convex?
        Fr+   r&   s    r
   is_atom_log_log_convexz$one_minus_pos.is_atom_log_log_convexV   r/   r   c                      y)z%Is the atom log-log concave?
        Tr+   r&   s    r
   is_atom_log_log_concavez%one_minus_pos.is_atom_log_log_concave[        r   c                      y)z;Is the composition non-decreasing in argument idx?
        Fr+   r   idxs     r
   is_incrzone_minus_pos.is_incr`   r/   r   c                      y)z;Is the composition non-increasing in argument idx?
        Tr+   r8   s     r
   is_decrzone_minus_pos.is_decre   r6   r   )r   N)r%   
__module____qualname____doc__r   r   r!   strr'   r   intr)   boolr,   r.   r1   r3   r5   r:   r<   __classcell__)r   s   @r
   r   r   )   s    1
&/Bc B"sCx "
dDj 1 
 
 
 
 
d 
d r   r   )r?   typingr   numpyr   scipy.sparsesparser   #cvxpy.atoms.affine.binary_operatorsr   cvxpy.atoms.atomr   r   r   r+   r   r
   <module>rJ      s,        8 !+?D ?r   