Esempio n. 1
0
    def inverse2(self) -> "ComplexTensor":
        # To avoid cyclic import
        from torch_complex.utils import complex_matrix2real_matrix
        from torch_complex.utils import real_matrix2complex_matrix

        return real_matrix2complex_matrix(
            complex_matrix2real_matrix(self).inverse())
def solve(b: ComplexTensor, a: ComplexTensor) -> ComplexTensor:
    """Solve ax = b"""
    a = complex_matrix2real_matrix(a)
    b = complex_vector2real_vector(b)
    x, LU = torch.solve(b, a)
    return real_vector2complex_vector(x), real_matrix2complex_matrix(LU)