@@ -219,13 +219,13 @@ where
219
219
if simplex. is_empty ( ) {
220
220
// Simplex initialization.
221
221
simplex. push ( x. clone_owned ( ) ) ;
222
- errors. push ( f. apply_mut_norm_squared ( x, fx) ?) ;
222
+ errors. push ( f. apply_norm_squared ( x, fx) ?) ;
223
223
224
224
for j in 0 ..n {
225
225
let mut xi = x. clone_owned ( ) ;
226
226
xi[ j] = dom. vars ( ) [ j] . clamp ( xi[ j] + scale[ j] ) ;
227
227
228
- errors. push ( f. apply_mut_norm_squared ( & xi, fx) ?) ;
228
+ errors. push ( f. apply_norm_squared ( & xi, fx) ?) ;
229
229
simplex. push ( xi) ;
230
230
}
231
231
@@ -268,7 +268,7 @@ where
268
268
// Perform one of possible simplex transformations.
269
269
reflection. on_line2_mut ( centroid, & simplex[ sort_perm[ n] ] , reflection_coeff) ;
270
270
let reflection_not_feasible = reflection. project ( dom) ;
271
- let reflection_error = f. apply_mut_norm_squared ( reflection, fx) ?;
271
+ let reflection_error = f. apply_norm_squared ( reflection, fx) ?;
272
272
273
273
#[ allow( clippy:: suspicious_else_formatting) ]
274
274
let ( transformation, not_feasible) = if errors[ sort_perm[ 0 ] ] <= reflection_error
@@ -284,7 +284,7 @@ where
284
284
// farther along this direction.
285
285
expansion. on_line2_mut ( centroid, & simplex[ sort_perm[ n] ] , expansion_coeff) ;
286
286
let expansion_not_feasible = expansion. project ( dom) ;
287
- let expansion_error = f. apply_mut_norm_squared ( expansion, fx) ?;
287
+ let expansion_error = f. apply_norm_squared ( expansion, fx) ?;
288
288
289
289
if expansion_error < reflection_error {
290
290
// Expansion indeed help, replace the worst point.
@@ -309,7 +309,7 @@ where
309
309
// Try to perform outer contraction.
310
310
contraction. on_line2_mut ( centroid, & simplex[ sort_perm[ n] ] , outer_contraction_coeff) ;
311
311
let contraction_not_feasible = contraction. project ( dom) ;
312
- let contraction_error = f. apply_mut_norm_squared ( contraction, fx) ?;
312
+ let contraction_error = f. apply_norm_squared ( contraction, fx) ?;
313
313
314
314
if contraction_error <= reflection_error {
315
315
// Use the contracted point instead of the reflected point
@@ -327,7 +327,7 @@ where
327
327
// Try to perform inner contraction.
328
328
contraction. on_line2_mut ( centroid, & simplex[ sort_perm[ n] ] , inner_contraction_coeff) ;
329
329
let contraction_not_feasible = contraction. project ( dom) ;
330
- let contraction_error = f. apply_mut_norm_squared ( contraction, fx) ?;
330
+ let contraction_error = f. apply_norm_squared ( contraction, fx) ?;
331
331
332
332
if contraction_error <= errors[ sort_perm[ n] ] {
333
333
// The contracted point is better than the worst point.
@@ -352,7 +352,7 @@ where
352
352
for i in 1 ..=n {
353
353
let xi = & mut simplex[ sort_perm[ i] ] ;
354
354
xi. on_line_mut ( contraction, shrink_coeff) ;
355
- errors[ sort_perm[ i] ] = f. apply_mut_norm_squared ( xi, fx) ?;
355
+ errors[ sort_perm[ i] ] = f. apply_norm_squared ( xi, fx) ?;
356
356
}
357
357
358
358
( Transformation :: Shrinkage , false )
@@ -377,7 +377,7 @@ where
377
377
378
378
// Return the best simplex point.
379
379
x. copy_from ( & simplex[ sort_perm[ 0 ] ] ) ;
380
- f. apply_mut ( x, fx) ?;
380
+ f. apply ( x, fx) ?;
381
381
382
382
if transformation == Transformation :: Shrinkage || not_feasible {
383
383
// Check whether the simplex collapsed or not. It can happen only
0 commit comments