def r2c(self):
        """Get complex vector.from real one made by ``tensor.c2r()``.

        For tensor :math:`\\tilde{X}(i_1,\\ldots,i_d,i_{d+1})` returns complex tensor

        .. math::
           X(i_1,\\ldots,i_d) = \\tilde{X}(i_1,\\ldots,i_d,0) + i\\tilde{X}(i_1,\\ldots,i_d,1).

        >>> a = tt.rand(2,10,5) + 1j * tt.rand(2,10,5)
        >>> (a.c2r().r2c() - a).norm() / a.norm()
        7.310562016615692e-16

        """
        tmp = self.copy()
        newcore = _np.array(tmp.core, dtype=_np.complex)
        cr = newcore[tmp.ps[-2] - 1:tmp.ps[-1] - 1]
        cr = cr.reshape((tmp.r[-2], tmp.n[-1], tmp.r[-1]), order='F')
        cr[:, 1, :] *= 1j
        newcore[tmp.ps[-2] - 1:tmp.ps[-1] - 1] = cr.flatten('F')
        tmp.core = newcore
        return sum(tmp, axis=tmp.d - 1)
def r2c ( self ) : tmp = self . copy ( ) newcore = _np . array ( tmp . core , dtype = _np . complex ) cr = newcore [ tmp . ps [ - 2 ] - 1 : tmp . ps [ - 1 ] - 1 ] cr = cr . reshape ( ( tmp . r [ - 2 ] , tmp . n [ - 1 ] , tmp . r [ - 1 ] ) , order = 'F' ) cr [ : , 1 , : ] *= 1j newcore [ tmp . ps [ - 2 ] - 1 : tmp . ps [ - 1 ] - 1 ] = cr . flatten ( 'F' ) tmp . core = newcore return sum ( tmp , axis = tmp . d - 1 )
Get complex vector.from real one made by ``tensor.c2r()``.

        For tensor :math:`\\tilde{X}(i_1,\\ldots,i_d,i_{d+1})` returns complex tensor

        .. math::
           X(i_1,\\ldots,i_d) = \\tilde{X}(i_1,\\ldots,i_d,0) + i\\tilde{X}(i_1,\\ldots,i_d,1).

        >>> a = tt.rand(2,10,5) + 1j * tt.rand(2,10,5)
        >>> (a.c2r().r2c() - a).norm() / a.norm()
        7.310562016615692e-16