From bbb90c2f911b071adca3e4cafec36913ae6d3599 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 4 Feb 2011 17:07:10 +0100 Subject: Remove unnecessary iteration --- src/hrs-scaling.c | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'src/hrs-scaling.c') diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c index 7661cb5f..f2ddaaba 100644 --- a/src/hrs-scaling.c +++ b/src/hrs-scaling.c @@ -35,38 +35,28 @@ static void s_uhavha(signed int hat, signed int kat, signed int lat, - struct image *images, int n, const char *sym, int a, - double *uha, double *vha) + struct image *image, double *uha, double *vha) { - int k; double uha_val = 0.0; double vha_val = 0.0; + struct cpeak *spots = image->cpeaks; + int hi; - for ( k=0; kn_cpeaks; hi++ ) { - int hi; - struct image *image = &images[k]; - struct cpeak *spots = image->cpeaks; + double ic, sigi; - if ( k != a ) continue; + if ( !spots[hi].scalable ) continue; - for ( hi=0; hin_cpeaks; hi++ ) { + if ( spots[hi].h != hat ) continue; + if ( spots[hi].k != kat ) continue; + if ( spots[hi].l != lat ) continue; - double ic, sigi; + ic = spots[hi].intensity / spots[hi].p; + sigi = sqrt(fabs(ic)); - if ( !spots[hi].scalable ) continue; - - if ( spots[hi].h != hat ) continue; - if ( spots[hi].k != kat ) continue; - if ( spots[hi].l != lat ) continue; - - ic = spots[hi].intensity / spots[hi].p; - sigi = sqrt(fabs(ic)); - - uha_val += 1.0 / pow(sigi, 2.0); - vha_val += ic / pow(sigi, 2.0); - - } + uha_val += 1.0 / pow(sigi, 2.0); + vha_val += ic / pow(sigi, 2.0); } @@ -83,7 +73,7 @@ static double s_uh(struct image *images, int n, for ( a=0; a