audio_zen/acoustics/beamforming.py
def trace(
        complex_matrix: ComplexTensor
) -> ComplexTensor:
    """
    Return trace of a complex matrices
    """
    mat_size = complex_matrix.size()
    diag_index = torch.eye(mat_size[-1], dtype=torch.bool, device=complex_matrix.device).expand(*mat_size)
    return complex_matrix.masked_select(diag_index).view(*mat_size[:-1]).sum(-1)

    Return trace of a complex matrices
    
Return trace of a complex matrices
Return trace of a complex matrices
def trace(
        complex_matrix: ComplexTensor
) -> ComplexTensor:
    mat_size = complex_matrix.size()
    diag_index = torch.eye(mat_size[-1], dtype=torch.bool, device=complex_matrix.device).expand(*mat_size)
    return complex_matrix.masked_select(diag_index).view(*mat_size[:-1]).sum(-1)
def trace ( complex_matrix : ComplexTensor ) -> ComplexTensor : mat_size = complex_matrix . size ( ) diag_index = torch . eye ( mat_size [ - 1 ] , dtype = torch . bool , device = complex_matrix . device ) . expand ( * mat_size ) return complex_matrix . masked_select ( diag_index ) . view ( * mat_size [ : - 1 ] ) . sum ( - 1 )
Return trace of a complex matrices
Return trace of a complex matrices
"""
    Return trace of a complex matrices
    """
complex_matrix
ComplexTensor