o
    װi	                     @   s   d dl ZdddZdS )    NTc                 C   st   | j d | j d krtd| j d |j d krtd|r&tj| | jd} tj| |}| |}|| S )a  
    Minimum variance distortionless response (MVDR) beamformer weights

    Parameters
    ----------
    x : ndarray
        Received signal or input covariance matrix, assume 2D array with
        size [num_sensors, num_samples]

    sv: ndarray
        Steering vector, assume 1D array with size [num_sensors, 1]

    calc_cov : bool
        Determine whether to calculate covariance matrix. Simply put, calc_cov
        defines whether x input is made of sensor/observation data or is
        a precalculated covariance matrix

    Note: Unlike MATLAB where input matrix x is of size MxN where N represents
    the number of array elements, we assume row-major formatted data where each
    row is assumed to be complex-valued data from a given sensor (i.e. NxM)
    r      zxMatrix has more sensors than samples. Consider             transposing and remember cuSignal is row-major, unlike MATLABz+Steering Vector and input data do not align)dtype)	shape
ValueErrorcpcovr   linalginvdotconj)xsvcalc_covwBwA r   Y/home/ubuntu/.local/lib/python3.10/site-packages/cupyx/signal/_radartools/_beamformers.pymvdr   s   r   )T)cupyr   r   r   r   r   r   <module>   s   