[Insight-developers] Re: Conjugate Gradient Algorithm !

Ashish Poddar ahpoddar at gmail.com
Tue Jun 28 21:13:41 EDT 2005


in Conjugate Gradient Optimizer.cxx around Line number 81 in function 

void ConjugateGradientOptimizer::SetCostFunction(
SingleValuedCostFunction * costFunction )

    m_VnlOptimizer = new vnl_conjugate_gradient( *adaptor );
// should be replaced by this
    if (!m_VnlOptimizer) m_VnlOptimizer = new vnl_conjugate_gradient(
*adaptor );

This was causing the initialization which I did to disappear and that
was probably the reason why my iterations were not terminating !!

regards,
Ashish.

On 6/28/05, Ashish Poddar <ahpoddar at gmail.com> wrote:
> 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
> 


-- 
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