| 144 fn norm(&self, _p : L2) -> F { self.norm2() } |
144 fn norm(&self, _p : L2) -> F { self.norm2() } |
| 145 |
145 |
| 146 fn dist(&self, other : &Self, _p : L2) -> F { self.dist2(other) } |
146 fn dist(&self, other : &Self, _p : L2) -> F { self.dist2(other) } |
| 147 }*/ |
147 }*/ |
| 148 |
148 |
| 149 impl<F: Float, E: Euclidean<F> + Norm<L2, F>> Projection<F, L2> for E { |
149 impl<F: Float, E: Euclidean<Field = F> + Norm<L2, F>> Projection<F, L2> for E { |
| 150 #[inline] |
150 #[inline] |
| 151 fn proj_ball(self, ρ: F, _p: L2) -> Self { |
151 fn proj_ball(self, ρ: F, _p: L2) -> Self { |
| 152 self.proj_ball2(ρ) |
152 self.proj_ball2(ρ) |
| 153 } |
153 } |
| 154 |
154 |
| 174 } |
174 } |
| 175 } |
175 } |
| 176 } |
176 } |
| 177 } |
177 } |
| 178 |
178 |
| 179 impl<F: Float, E: Euclidean<F> + Normed<F, NormExp = L2>> Norm<HuberL1<F>, F> for E { |
179 impl<F: Float, E: Euclidean<Field = F> + Normed<F, NormExp = L2>> Norm<HuberL1<F>, F> for E { |
| 180 fn norm(&self, huber: HuberL1<F>) -> F { |
180 fn norm(&self, huber: HuberL1<F>) -> F { |
| 181 huber.apply(self.norm2_squared()) |
181 huber.apply(self.norm2_squared()) |
| 182 } |
182 } |
| 183 } |
183 } |
| 184 |
184 |
| 185 impl<F: Float, E: Euclidean<F> + Normed<F, NormExp = L2>> Dist<F, HuberL1<F>> for E { |
185 impl<F: Float, E: Euclidean<Field = F> + Normed<F, NormExp = L2>> Dist<F, HuberL1<F>> for E { |
| 186 fn dist<I: Instance<Self>>(&self, other: I, huber: HuberL1<F>) -> F { |
186 fn dist<I: Instance<Self>>(&self, other: I, huber: HuberL1<F>) -> F { |
| 187 huber.apply(self.dist2_squared(other)) |
187 huber.apply(self.dist2_squared(other)) |
| 188 } |
188 } |
| 189 } |
189 } |
| 190 |
190 |