def _get_hrt(self, *shapes): # noqa: D102 # normalize length of r h, r, t = super()._get_hrt(*shapes) rc = view_complex(r) rl = (rc.abs()**2).sum(dim=-1).sqrt() r = r / rl.unsqueeze(dim=-1) return h, r, t
def _exp_score(self, h, r, t) -> torch.FloatTensor: # noqa: D102 h, r, t = [view_complex(x) for x in (h, r, t)] return (h * r * torch.conj(t)).sum().real
def _exp_score(self, h, r, t) -> torch.FloatTensor: # noqa: D102 h, r, t = strip_dim(*(view_complex(x) for x in (h, r, t))) # check for unit length assert torch.allclose((r.abs()**2).sum(dim=-1).sqrt(), torch.ones(1)) d = h * r - t return -(d.abs()**2).sum(dim=-1).sqrt()