
    bi                     l    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  G d de      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.
    )TupleN)Elementwisec                        e Zd ZdZd fdZej                  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e	fdZd Z xZS )ceilzElementwise ceiling.returnc                 *    t         t        |   |      S N)superr   __init__selfx	__class__s     W/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/atoms/elementwise/ceil.pyr   zceil.__init__   s    T4)!,,    c                     t        t        j                  t        j                  t        j
                                    }t        j                  t        j                  |d   |            S )Nr   )decimals)intnpabslog10sATOM_EVAL_TOLr   around)r   valuesr   s      r   numericzceil.numeric   s@    rvvbhhq789wwryyX>??r   c                     | j                   d   j                         r| j                   d   j                         ry| j                   d   j                         ry| j                   d   j                         ryyzCReturns sign (is positive, is negative) of the expression.
        r   )TT)TF)FT)FFargs	is_nonneg	is_nonposr   s    r   sign_from_argszceil.sign_from_args$   _     99Q<!!#		!(>(>(@YYq\##% YYq\##% !r   c                      yzIs the atom convex?
        F r#   s    r   is_atom_convexzceil.is_atom_convex0        r   c                      yzIs the atom concave?
        Fr(   r#   s    r   is_atom_concavezceil.is_atom_concave5   r*   r   c                      yz$Is the atom log-log convex?
        Fr(   r#   s    r   is_atom_log_log_convexzceil.is_atom_log_log_convex:   r*   r   c                      yz%Is the atom log-log concave?
        Fr(   r#   s    r   is_atom_log_log_concavezceil.is_atom_log_log_concave?   r*   r   c                      yz!Is the atom quasiconvex?
        Tr(   r#   s    r   is_atom_quasiconvexzceil.is_atom_quasiconvexD        r   c                      yz"Is the atom quasiconcave?
        Tr(   r#   s    r   is_atom_quasiconcavezceil.is_atom_quasiconcaveI   r7   r   c                      yz;Is the composition non-decreasing in argument idx?
        Tr(   r   idxs     r   is_incrzceil.is_incrN   r7   r   c                      yz;Is the composition non-increasing in argument idx?
        Fr(   r=   s     r   is_decrzceil.is_decrS   r*   r   c                 Z    t        j                  | j                  d   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.
        r   sp	csc_arrayr    shaper   r   s     r   _gradz
ceil._gradX   !     ||DIIaL..//r   r   N__name__
__module____qualname____doc__r   r   numpy_numericr   r   boolr$   r)   r-   r0   r3   r6   r:   r?   rB   rJ   __classcell__r   s   @r   r   r      s    - @ @
"dDj 1 
" 
 
 
 
T 
d 
d 
d 
0r   r   c                        e Zd ZdZd fdZej                  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e	fdZd Z xZS )floorzElementwise floor.r   c                 *    t         t        |   |      S r	   )r
   rW   r   r   s     r   r   zfloor.__init__i   s    UD*1--r   c                 2    t        j                  |d         S )Nr   )r   rW   rI   s     r   r   zfloor.numericl   s    xxq	""r   c                     | j                   d   j                         r| j                   d   j                         ry| j                   d   j                         ry| j                   d   j                         ryyr   r   r#   s    r   r$   zfloor.sign_from_argsp   r%   r   c                      yr'   r(   r#   s    r   r)   zfloor.is_atom_convex|   r*   r   c                      yr,   r(   r#   s    r   r-   zfloor.is_atom_concave   r*   r   c                      yr/   r(   r#   s    r   r0   zfloor.is_atom_log_log_convex   r*   r   c                      yr2   r(   r#   s    r   r3   zfloor.is_atom_log_log_concave   r*   r   c                      yr5   r(   r#   s    r   r6   zfloor.is_atom_quasiconvex   r7   r   c                      yr9   r(   r#   s    r   r:   zfloor.is_atom_quasiconcave   r7   r   c                      yr<   r(   r=   s     r   r?   zfloor.is_incr   r7   r   c                      yrA   r(   r=   s     r   rB   zfloor.is_decr   r*   r   c                 Z    t        j                  | j                  d   j                        S rD   rE   rI   s     r   rJ   zfloor._grad   rK   r   rL   rM   rU   s   @r   rW   rW   f   s    . # #
"dDj 1 
" 
 
 
 
T 
d 
d 
d 
0r   rW   )rQ   typingr   numpyr   scipy.sparsesparserF   cvxpy.settingssettingsr   #cvxpy.atoms.elementwise.elementwiser   r   rW   r(   r   r   <module>rk      s8        ;J0; J0ZI0K I0r   