Skip to content
Snippets Groups Projects
Commit c75ac3d6 authored by Peter Bannister's avatar Peter Bannister
Browse files

added in_slice option to optimise.[h,cc]

parent 5cd889d8
No related branches found
No related tags found
No related merge requests found
...@@ -247,7 +247,7 @@ namespace MISCMATHS { ...@@ -247,7 +247,7 @@ namespace MISCMATHS {
float optimise(ColumnVector &pt, int numopt, const ColumnVector &tol, float optimise(ColumnVector &pt, int numopt, const ColumnVector &tol,
float (*func)(const ColumnVector &), int &iterations_done, float (*func)(const ColumnVector &), int &iterations_done,
int max_iter, const ColumnVector& boundguess) int max_iter, const ColumnVector& boundguess, const bool in_slice)
{ {
// Calculate dot product of dir by tol // Calculate dot product of dir by tol
// st (x1-x2)*dir_tol = average number of tolerances between x1 and x2 // st (x1-x2)*dir_tol = average number of tolerances between x1 and x2
...@@ -270,8 +270,11 @@ namespace MISCMATHS { ...@@ -270,8 +270,11 @@ namespace MISCMATHS {
for (int n=1; n<=numopt; n++) { for (int n=1; n<=numopt; n++) {
dir = 0.0; dir = 0.0;
dir(n) = 1.0; dir(n) = 1.0;
fval = optimise1d(pt,dir,tol,lit,func,100,fval,bndguess); // if the in_slice flag has been set, only correct in z_rot, x_trans and y_trans
littot += lit; if ((!in_slice) || (n == 3) || (n == 4) || (n == 5)) {
fval = optimise1d(pt,dir,tol,lit,func,100,fval,bndguess);
littot += lit;
}
} }
// check to see if the point has moved more than one average tolerance // check to see if the point has moved more than one average tolerance
float avtol = SP((initpt - pt),inv_tol).SumAbsoluteValue(); float avtol = SP((initpt - pt),inv_tol).SumAbsoluteValue();
......
...@@ -27,7 +27,7 @@ float optimise1d(ColumnVector &pt, const ColumnVector dir, ...@@ -27,7 +27,7 @@ float optimise1d(ColumnVector &pt, const ColumnVector dir,
float optimise(ColumnVector &pt, int numopt, const ColumnVector &tol, float optimise(ColumnVector &pt, int numopt, const ColumnVector &tol,
float (*func)(const ColumnVector &), int &iterations_done, float (*func)(const ColumnVector &), int &iterations_done,
int max_iter, const ColumnVector& boundguess); int max_iter, const ColumnVector& boundguess, const bool in_slice=false);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment