src/euclidean.rs

branch
dev
changeset 64
4f6ca107ccb1
parent 63
f7b87d84864d
equal deleted inserted replaced
63:f7b87d84864d 64:4f6ca107ccb1
46 fn norm2(&self) -> F { 46 fn norm2(&self) -> F {
47 self.norm2_squared().sqrt() 47 self.norm2_squared().sqrt()
48 } 48 }
49 49
50 /// Calculate the 2-distance squared $\\|x-y\\|_2^2$, where `self` is $x$. 50 /// Calculate the 2-distance squared $\\|x-y\\|_2^2$, where `self` is $x$.
51 fn dist2_squared(&self, y : &Self) -> F; 51 fn dist2_squared<I : Instance<Self>>(&self, y : I) -> F;
52 52
53 /// Calculate the 2-distance $\\|x-y\\|_2$, where `self` is $x$. 53 /// Calculate the 2-distance $\\|x-y\\|_2$, where `self` is $x$.
54 #[inline] 54 #[inline]
55 fn dist2(&self, y : &Self) -> F { 55 fn dist2<I : Instance<Self>>(&self, y : I) -> F {
56 self.dist2_squared(y).sqrt() 56 self.dist2_squared(y).sqrt()
57 } 57 }
58 58
59 /// Projection to the 2-ball. 59 /// Projection to the 2-ball.
60 #[inline] 60 #[inline]

mercurial