o
    wOiB                     @   sh   d dl Z d dlmZ dede jfddZdede jfddZde jdefd	d
Zde jdefddZdS )    N)ComplexTensorcreturnc                 C   sX   |  d|  dksJ |   tjtj| j| j gddtj| j| jgddgddS )Ndim)sizetorchcatrealimagr    r   G/home/ubuntu/.local/lib/python3.10/site-packages/torch_complex/utils.pycomplex_matrix2real_matrix   s
    ,r   c                 C   s   t j| j| jgddS )Nr   r   )r
   r   r   r   r   r   r   r   complex_vector2real_vector   s   r   c                 C   s   |  d|  dksJ |   |  d}|d dksJ || dd |d d |d f }| d|d d d |d f }t||S )Nr   r      r   .r	   r   r   nr   r   r   r   r   real_matrix2complex_matrix    s    

r   c                 C   s\   |  d}|d dksJ || dd |d d d f }| d|d d d d f }t||S )Nr   r   r   .r   r   r   r   r   real_vector2complex_vector*   s
   

r   )r
   torch_complex.tensorr   Tensorr   r   r   r   r   r   r   r   <module>   s    
