File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,15 +144,13 @@ pub fn mixture_discrete(
144144
145145 for ( & function_value, & support_value) in function. iter ( ) . zip ( support. iter ( ) ) {
146146 let partial_probability = function_value * mix_weight;
147- if raw_mixture_support. contains ( & support_value) {
147+ if let Some ( support_index) =
148+ raw_mixture_support. iter ( ) . position ( |& x| x == support_value)
149+ {
150+ raw_mixture_function[ support_index] += partial_probability;
151+ } else {
148152 raw_mixture_support. push ( support_value) ;
149153 raw_mixture_function. push ( partial_probability) ;
150- } else {
151- let support_index = support
152- . iter ( )
153- . position ( |& x| x == support_value)
154- . expect ( "support value not found in mixture support" ) ;
155- raw_mixture_function[ support_index] += partial_probability;
156154 }
157155 }
158156 }
You can’t perform that action at this time.
0 commit comments