aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2008-04-25 12:02:17 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2008-04-25 12:02:17 +0000
commitb03577734a774e1c4a03573dafb0b696cbb9d297 (patch)
treefca0d209dece3d523677d284fe1eca1cfd805915
parent5b828c42c58e48ac98d2c606df84a18cfd2652ae (diff)
Working 2D minimisation (remove mugwatch)
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@275 bf6ca9ba-c028-0410-8290-897cf20841d1
-rw-r--r--src/refine.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/refine.c b/src/refine.c
index fc983ab..e92939d 100644
--- a/src/refine.c
+++ b/src/refine.c
@@ -29,7 +29,7 @@
#include "gtk-valuegraph.h"
#include "utils.h"
-#define DISPFACTOR 1.0
+#define DISPFACTOR 1.0e9
/* A simplex is an array of ten of these */
typedef struct {
@@ -126,9 +126,9 @@ static double refine_mean_dev(Deviation *d, int nf, SimplexVertex *s, int i) {
}
- return fabs(s[i].dax-10.0) + fabs(s[i].day-20.0) + fabs(s[i].dbx-30.0) + fabs(s[i].dby-40.0);
+// return fabs(s[i].dax-10.0) + fabs(s[i].day-20.0) + fabs(s[i].dbx-30.0) + fabs(s[i].dby-40.0);
-// return fom/nf;
+ return fom/nf;
}
@@ -169,11 +169,11 @@ static void refine_simplex_transform(SimplexVertex *s, int v_worst, double fac)
centre.dbx /= nv; centre.dby /= nv; centre.dbz /= nv;
centre.dcx /= nv; centre.dcy /= nv; centre.dcz /= nv;
- printf("Before transformation: ");
- refine_display_simplex(s[v_worst]);
+// printf("Before transformation: ");
+// refine_display_simplex(s[v_worst]);
- printf(" Midpoint: ");
- refine_display_simplex(centre);
+// printf(" Midpoint: ");
+// refine_display_simplex(centre);
/* Do the transformation */
s[v_worst].dax = centre.dax + fac * (s[v_worst].dax - centre.dax);
@@ -304,8 +304,8 @@ double refine_do_cell(ControlContext *ctx) {
Deviation *d;
double delta;
int i, nf, f, it, maxiter;
- //const double tol = 0.001e9; /* Stopping condition */
- const double tol = 0.001; /* For testing */
+ const double tol = 0.0001e9; /* Stopping condition */
+ //const double tol = 0.001; /* For testing */
int debug = 1;
if ( !ctx->cell_lattice ) {
@@ -385,7 +385,7 @@ double refine_do_cell(ControlContext *ctx) {
assert( f == nf );
/* Initialise the simplex */
- delta = 5.0;//0.01e9;
+ delta = 0.01e9;
s[0].dax = 0.0; s[0].dbx = 0.0; s[0].dcx = 0.0;
s[0].day = 0.0; s[0].dby = 0.0; s[0].dcy = 0.0;
s[0].daz = 0.0; s[0].dbz = 0.0; s[0].dcz = 0.0;
@@ -406,9 +406,9 @@ double refine_do_cell(ControlContext *ctx) {
double conv;
- for ( i=0; i<5; i++ ) {
- refine_display_simplex(s[i]);
- }
+ //for ( i=0; i<5; i++ ) {
+ // refine_display_simplex(s[i]);
+ //}
if ( debug ) printf("------------------- Simplex method iteration %i -------------------\n", it);
conv = refine_iteration(s, d, nf, debug);