
    bi_	                     X    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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)AffAtom)AxisAtom)
Expressionc                        e Zd ZdZddededdf fdZej                  de	j                  fd       Zdeed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 )cumprodz
    Cumulative product of the elements of an expression.

    Attributes
    ----------
    expr : CVXPY expression
        The expression being multiplied.
    axis : int
        The axis to multiply across.
    expraxisreturnNc                 .    t         t        |   ||       y )N)superr   __init__)selfr	   r
   	__class__s      N/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/atoms/cumprod.pyr   zcumprod.__init__$   s    gt%dD1    c                 J    t        j                  |d   | j                        S )zS
        Returns the cumulative product of the elements of the expression.
        r   r
   )npr   r
   r   valuess     r   numericzcumprod.numeric'   s    
 zz&)$))44r   .c                 4    | j                   d   j                  S )zThe same as the input.r   )argsshaper   s    r   shape_from_argszcumprod.shape_from_args.   s    yy|!!!r   c                      y)zIs the atom convex?F r   s    r   is_atom_convexzcumprod.is_atom_convex2       r   c                      y)zIs the atom concave?Fr   r   s    r   is_atom_concavezcumprod.is_atom_concave6   r!   r   c                      y)zIs the atom log-log convex?Tr   r   s    r   is_atom_log_log_convexzcumprod.is_atom_log_log_convex:       r   c                      y)zIs the atom log-log concave?Tr   r   s    r   is_atom_log_log_concavezcumprod.is_atom_log_log_concave>   r&   r   c                     g 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   r   s     r   _gradzcumprod._gradB   s	     	r   c                     | j                   gS )z"Returns the axis being multiplied.r   r   s    r   get_datazcumprod.get_dataP   s    		{r   )r   )__name__
__module____qualname____doc__r   intr   r   numpy_numericr   ndarrayr   r   r   boolr    r#   r%   r(   listr*   r,   __classcell__)r   s   @r   r   r      s    	2Z 2s 24 2 5 5 5"sCx "    t $ r   r   )r0   typingr   numpyr   cvxpy.atoms.affine.affine_atomr   cvxpy.atoms.axis_atomr   cvxpy.expressions.expressionr   r   r   r   r   <module>r<      s)      2 * 39gx 9r   