[Insight-developers] Conjugate Gradient Algorithm !

Ashish Poddar ahpoddar at gmail.com
Tue Jun 28 18:26:44 EDT 2005


in Conjugate Grandient algorithm [cg.c] i think there is a bug..

L190:
    ++na;
    if (na > 25) {
        goto L630;
    }
    q *= a4;
    p = fv_(&q, x, h, n, value);
    ins_(&q, &p, &a, &b, &c, &fa, &fb, &fc, &j, y, z);
    if (p - f > v * q) {
        goto L190;
    }
    goto L250;


    if (p - f > v * q) {
//should be replaced by something like this
    if ( (p - f) - (v * q) >= (1e-8) ) {

when i run conjugate algorithm it starts repeating the metric value
for a long time and then suddenly starts moving is some extreme
direction, on debugging, I traced it back to this loop where it was
stuck !

similar change needs to be carried at more places in the same file !

I just want to confirm if this change is correct or not !!

regards,
Ashish.

-- 
Ashish Poddar
Have an acceptable reason for accepting anything.
Y:ashish_poddar | MSN:ashish_poddar at yahoo.com


More information about the Insight-developers mailing list