
    biE                     0    d dl Z d dlmZmZmZ dedefdZy)    N)CPP_CANON_BACKENDNUMPY_CANON_BACKENDSCIPY_CANON_BACKENDcanon_backendreturnc           	         | j                         sS|3t        j                  t        dt         dt
         d             t
        S |t        k(  rt        dt         d      |S | j                         dkD  rQ|,t        j                  t        dt
         d             t
        S |t        k(  rt        dt
         d	t         d
      |S )a  
    This function checks if the problem has expressions of dimension greater
    than 2 or if it lacks C++ support, then raises a warning if the default
    backend is not specified or raises an error if the backend is specified
    as 'CPP'.

    Parameters
    ----------
    problem : Problem
        The problem for which to build a chain.
    canon_backend : str
        'CPP' (default) | 'SCIPY'
        Specifies which backend to use for canonicalization, which can affect
        compilation time. Defaults to None, i.e., selecting the default
        backend.
    Returns
    -------
    canon_backend : str
        The canonicalization backend to use.
    z4The problem includes expressions that don't support z backend. Defaulting to the z backend for canonicalization.zThe zT backend cannot be used with problems that have expressions which do not support it.   zOThe problem has an expression with dimension greater than 2. Defaulting to the z	Only the z and zR backends are supported for problems with expressions of dimension greater than 2.)	_supports_cppwarningswarnUserWarningr   r   
ValueError	_max_ndimr   )problemr   s     g/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/reductions/solvers/solving_chain_utils.pyget_canon_backendr      s   ,   " MM+FGXFY Z%%8$99WYZ [ '&--t$5#6 7N O P PQ MM+%%8$99WYZ [ '&--y)<(=UCVBW X9 : ; ;     )r   cvxpy.settingsr   r   r   strr    r   r   <module>r      s!     V V+c +c +r   