src/mfemopt/examples/tests/ex1.cpp
void ImageFunctional::Update(int it, const Vector& F, const Vector& X,
                             const Vector& dX, const Vector& pX)
{
   if (!tv) return;
   if (!it)
   {
      tv->UpdateDual(X);
   }
   else
   {
      double lambda = 0.0;
      for (int i = 0; i < pX.Size(); i++)
      {
         if (dX[i] != 0.0)
         {
            lambda = (pX[i] - X[i])/dX[i];
            break;
         }
      }
      tv->UpdateDual(pX,dX,lambda);
   }
}
/* This method is called at the beginning of each nonlinear step
   We use it to update the dual variables for the TV regularizer */
This method is called at the beginning of each nonlinear step
We use it to update the dual variables for the TV regularizer
This method is called at the beginning of each nonlinear step We use it to update the dual variables for the TV regularizer
void ImageFunctional::Update(int it, const Vector& F, const Vector& X,
                             const Vector& dX, const Vector& pX)
{
   if (!tv) return;
   if (!it)
   {
      tv->UpdateDual(X);
   }
   else
   {
      double lambda = 0.0;
      for (int i = 0; i < pX.Size(); i++)
      {
         if (dX[i] != 0.0)
         {
            lambda = (pX[i] - X[i])/dX[i];
            break;
         }
      }
      tv->UpdateDual(pX,dX,lambda);
   }
}
void ImageFunctional :: Update ( int it , const Vector & F , const Vector & X , const Vector & dX , const Vector & pX ) { if ( ! tv ) return ; if ( ! it ) { tv -> UpdateDual ( X ) ; } else { double lambda = 0.0 ; for ( int i = 0 ; i < pX . Size ( ) ; i ++ ) { if ( dX [ i ] != 0.0 ) { lambda = ( pX [ i ] - X [ i ] ) / dX [ i ] ; break ; } } tv -> UpdateDual ( pX , dX , lambda ) ; } }
This method is called at the beginning of each nonlinear step
We use it to update the dual variables for the TV regularizer
This method is called at the beginning of each nonlinear step We use it to update the dual variables for the TV regularizer