o
    ×°“iÀ  ã                   @   s>   d dl Z dd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zddd„ZdS )é    Nc                 C   s   | d u r	t  d¡S | S )N©r   r   )ÚcupyÚzeros©Úarg© r   úV/home/ubuntu/.local/lib/python3.10/site-packages/cupyx/scipy/signal/_lti_conversion.pyÚ_none_to_empty_2d   s   
r	   c                 C   s   | d ur	t  | ¡S d S ©N)r   Ú
atleast_2dr   r   r   r   Ú_atleast_2d_or_none   s   
ÿr   c                 C   s   | d ur| j S dS )N)NN)Úshape)ÚMr   r   r   Ú_shape_or_none   s   r   c                  G   s   | D ]
}|d ur|  S qd S r
   r   )Úargsr   r   r   r   Ú_choice_not_none   s
   ÿÿr   c                 C   s*   | j dkr
t |¡S | j |krtdƒ‚| S )Nr   z*The input arrays have incompatible shapes.)r   r   r   Ú
ValueError)r   r   r   r   r   Ú_restore   s
   


r   c                 C   sè   t t| |||fƒ\} }}}t| ƒ\}}t|ƒ\}}t|ƒ\}}	t|ƒ\}
}t|||	ƒ}t||ƒ}t||
ƒ}|du sA|du sA|du rEtdƒ‚t t| |||fƒ\} }}}t| ||fƒ} t|||fƒ}t|||fƒ}t|||fƒ}| |||fS )a³  Check state-space matrices and ensure they are 2-D.

    If enough information on the system is provided, that is, enough
    properly-shaped arrays are passed to the function, the missing ones
    are built from this information, ensuring the correct number of
    rows and columns. Otherwise a ValueError is raised.

    Parameters
    ----------
    A, B, C, D : array_like, optional
        State-space matrices. All of them are None (missing) by default.
        See `ss2tf` for format.

    Returns
    -------
    A, B, C, D : array
        Properly shaped state-space matrices.

    Raises
    ------
    ValueError
        If not enough information on the system was provided.

    Nz%Not enough information on the system.)Úmapr   r   r   r   r	   r   )ÚAÚBÚCÚDÚMAÚNAÚMBÚNBÚMCÚNCÚMDÚNDÚpÚqÚrr   r   r   Úabcd_normalize&   s    

r$   )NNNN)r   r	   r   r   r   r   r$   r   r   r   r   Ú<module>   s    	