src/norms.rs

branch
dev
changeset 109
943c6b3b9414
parent 106
1256e7f7f7ad
child 113
d97fcf22a61c
equal deleted inserted replaced
108:6be459f08b66 109:943c6b3b9414
174 } 174 }
175 } 175 }
176 } 176 }
177 } 177 }
178 178
179 impl<F: Float, E: Euclidean<F>> Norm<F, HuberL1<F>> for E { 179 impl<F: Float, E: Euclidean<F> + Normed<F, NormExp = L2>> Norm<F, HuberL1<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>> Dist<F, HuberL1<F>> for E { 185 impl<F: Float, E: Euclidean<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

mercurial