Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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()