\hypertarget{structConjugateGradientOnly}{
\subsection{ConjugateGradientOnly$<$ Size, Precision $>$ Struct Template Reference}
\label{structConjugateGradientOnly}\index{ConjugateGradientOnly@{ConjugateGradientOnly}}
}


Class for performing optimization with Conjugate Gradient, where only the derivatives are available.  




{\ttfamily \#include $<$conjugate\_\-gradient\_\-only.h$>$}

\subsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\footnotesize template$<$class Deriv $>$ }\\\hyperlink{structConjugateGradientOnly_a571d17b88326f8f0b9e9ef4cf1539219}{ConjugateGradientOnly} (const TooN::Vector$<$ Size $>$ \&start, const Deriv \&deriv, const TooN::Vector$<$ Size $>$ \&d)
\item 
{\footnotesize template$<$int S, class P , class B $>$ }\\void \hyperlink{structConjugateGradientOnly_a1f3e750a75e62a3be0bd697ad8b922b1}{init} (const TooN::Vector$<$ Size $>$ \&start, const TooN::Vector$<$ S, P, B $>$ \&deriv)
\item 
{\footnotesize template$<$class Deriv $>$ }\\void \hyperlink{structConjugateGradientOnly_a5cae1179600fac8cdb958dca32d63511}{init} (const TooN::Vector$<$ Size $>$ \&start, const Deriv \&deriv)
\item 
{\footnotesize template$<$class Deriv $>$ }\\void \hyperlink{structConjugateGradientOnly_a36f4303999ffc508ced7fd3c194a2a5b}{find\_\-next\_\-point} (const Deriv \&deriv)
\item 
bool \hyperlink{structConjugateGradientOnly_a83fe3a7e01c67027102d532a229f649e}{finished} ()
\item 
void \hyperlink{structConjugateGradientOnly_a71e53fe43ae841f6b6c3882d47b1862d}{update\_\-vectors\_\-PR} (const TooN::Vector$<$ Size $>$ \&grad)
\item 
{\footnotesize template$<$class Deriv $>$ }\\bool \hyperlink{structConjugateGradientOnly_ab3dd69246b6592f5bd5298129c3a8ec1}{iterate} (const Deriv \&deriv)
\end{DoxyCompactItemize}
\subsubsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
const int \hyperlink{structConjugateGradientOnly_ae916ee66d6484fd220b3a5528f12e838}{size}
\item 
TooN::Vector$<$ Size $>$ \hyperlink{structConjugateGradientOnly_a94ce06cc56719043d0c3ef8e0c3c28fc}{g}
\item 
TooN::Vector$<$ Size $>$ \hyperlink{structConjugateGradientOnly_ad7ef8a68a0519cae4351f0196dd6999c}{new\_\-g}
\item 
TooN::Vector$<$ Size $>$ \hyperlink{structConjugateGradientOnly_ae5caa046b9f3ac7654c4bac793f8cdcc}{h}
\item 
TooN::Vector$<$ Size $>$ \hyperlink{structConjugateGradientOnly_a48cad2fb91fa2ad32e8b1a98af26ef65}{minus\_\-h}
\item 
TooN::Vector$<$ Size $>$ \hyperlink{structConjugateGradientOnly_a1965a6c9ae69d3f6c1718077558a7cd3}{old\_\-g}
\item 
TooN::Vector$<$ Size $>$ \hyperlink{structConjugateGradientOnly_a90ee7b10afd09b2543d6a025daa79136}{old\_\-h}
\item 
TooN::Vector$<$ Size $>$ \hyperlink{structConjugateGradientOnly_a9a8b8534ab07c632fa41d9030977ee44}{x}
\item 
TooN::Vector$<$ Size $>$ \hyperlink{structConjugateGradientOnly_a8cc2c8b3b1daabbf75104d86ff054568}{old\_\-x}
\item 
Precision \hyperlink{structConjugateGradientOnly_acaad884ef03d0dcbc59a8d14f860c197}{tolerance}
\item 
int \hyperlink{structConjugateGradientOnly_a1df9c47b0be7a837c9732f4cf4f798ec}{max\_\-iterations}
\item 
TooN::Vector$<$ Size $>$ \hyperlink{structConjugateGradientOnly_ae4cc06d64b328af965eade49cc86f311}{delta\_\-max}
\item 
Precision \hyperlink{structConjugateGradientOnly_aef8dc155ef9e48ff76a221f3fb715e8d}{linesearch\_\-tolerance}
\item 
Precision \hyperlink{structConjugateGradientOnly_a2aa4e7a67ce5952df3cec03c0f893850}{linesearch\_\-epsilon}
\item 
int \hyperlink{structConjugateGradientOnly_afeea8299d906bd33adb548dcac78b9ea}{iterations}
\end{DoxyCompactItemize}


\subsubsection{Detailed Description}
\subsubsection*{template$<$int Size = -\/1, class Precision = double$>$struct ConjugateGradientOnly$<$ Size, Precision $>$}

Class for performing optimization with Conjugate Gradient, where only the derivatives are available. 

Definition at line 28 of file conjugate\_\-gradient\_\-only.h.



\subsubsection{Constructor \& Destructor Documentation}
\hypertarget{structConjugateGradientOnly_a571d17b88326f8f0b9e9ef4cf1539219}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{ConjugateGradientOnly}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ template$<$class Deriv $>$ {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf ConjugateGradientOnly} (
\begin{DoxyParamCaption}
\item[{const TooN::Vector$<$ Size $>$ \&}]{start, }
\item[{const Deriv \&}]{deriv, }
\item[{const TooN::Vector$<$ Size $>$ \&}]{d}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{structConjugateGradientOnly_a571d17b88326f8f0b9e9ef4cf1539219}


Initialize the ConjugateGradient class with sensible values. 


\begin{DoxyParams}{Parameters}
{\em start} & Starting point, {\itshape x\/} \\
\hline
{\em deriv} & Function to compute $\nabla f(x)$ \\
\hline
{\em d} & Maximum allowed movement (delta) in any dimension \\
\hline
\end{DoxyParams}


Definition at line 55 of file conjugate\_\-gradient\_\-only.h.



References ConjugateGradientOnly$<$ Size, Precision $>$::init().


\begin{DoxyCode}
    : size(start.size()),
      g(size),new_g(size),h(size),minus_h(size),old_g(size),old_h(size),x(start),
      old_x(size),delta_max(d)
    {
        init(start, deriv);
    }
\end{DoxyCode}


\subsubsection{Member Function Documentation}
\hypertarget{structConjugateGradientOnly_a1f3e750a75e62a3be0bd697ad8b922b1}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!init@{init}}
\index{init@{init}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{init}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ template$<$int S, class P , class B $>$ void {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::init (
\begin{DoxyParamCaption}
\item[{const TooN::Vector$<$ Size $>$ \&}]{start, }
\item[{const TooN::Vector$<$ S, P, B $>$ \&}]{deriv}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{structConjugateGradientOnly_a1f3e750a75e62a3be0bd697ad8b922b1}


Initialise given a starting point and the derivative at the starting point. 


\begin{DoxyParams}{Parameters}
{\em start} & starting point \\
\hline
{\em deriv} & derivative at starting point \\
\hline
\end{DoxyParams}


Definition at line 65 of file conjugate\_\-gradient\_\-only.h.



References ConjugateGradientOnly$<$ Size, Precision $>$::g, ConjugateGradientOnly$<$ Size, Precision $>$::h, ConjugateGradientOnly$<$ Size, Precision $>$::iterations, ConjugateGradientOnly$<$ Size, Precision $>$::linesearch\_\-epsilon, ConjugateGradientOnly$<$ Size, Precision $>$::linesearch\_\-tolerance, ConjugateGradientOnly$<$ Size, Precision $>$::max\_\-iterations, ConjugateGradientOnly$<$ Size, Precision $>$::minus\_\-h, ConjugateGradientOnly$<$ Size, Precision $>$::size, ConjugateGradientOnly$<$ Size, Precision $>$::tolerance, and ConjugateGradientOnly$<$ Size, Precision $>$::x.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::ConjugateGradientOnly(), ConjugateGradientOnly$<$ Size, Precision $>$::init(), and FitSpots::try\_\-modifying\_\-model().


\begin{DoxyCode}
    {

        using std::numeric_limits;
        x = start;

        //Start with the conjugate direction aligned with
        //the gradient
        g = deriv;
        h = g;
        minus_h=-h;

        tolerance = sqrt(numeric_limits<Precision>::epsilon());
        max_iterations = size * 100;


        linesearch_tolerance =  sqrt(numeric_limits<Precision>::epsilon());
        linesearch_epsilon = 1e-20;

        iterations=0;
    }
\end{DoxyCode}
\hypertarget{structConjugateGradientOnly_a5cae1179600fac8cdb958dca32d63511}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!init@{init}}
\index{init@{init}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{init}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ template$<$class Deriv $>$ void {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::init (
\begin{DoxyParamCaption}
\item[{const TooN::Vector$<$ Size $>$ \&}]{start, }
\item[{const Deriv \&}]{deriv}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{structConjugateGradientOnly_a5cae1179600fac8cdb958dca32d63511}


Initialise given a starting point and a functor for computing derivatives. 


\begin{DoxyParams}{Parameters}
{\em start} & starting point \\
\hline
{\em deriv} & derivative computing functor \\
\hline
\end{DoxyParams}


Definition at line 90 of file conjugate\_\-gradient\_\-only.h.



References ConjugateGradientOnly$<$ Size, Precision $>$::init().


\begin{DoxyCode}
    {
        init(start, deriv(start));
    }
\end{DoxyCode}
\hypertarget{structConjugateGradientOnly_a36f4303999ffc508ced7fd3c194a2a5b}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!find\_\-next\_\-point@{find\_\-next\_\-point}}
\index{find\_\-next\_\-point@{find\_\-next\_\-point}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{find\_\-next\_\-point}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ template$<$class Deriv $>$ void {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::find\_\-next\_\-point (
\begin{DoxyParamCaption}
\item[{const Deriv \&}]{deriv}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{structConjugateGradientOnly_a36f4303999ffc508ced7fd3c194a2a5b}


Perform a linesearch from the current point (x) along the current conjugate vector (h). 

The linesearch does not make use of values. You probably do not want to call this function directly. See \hyperlink{structConjugateGradientOnly_ab3dd69246b6592f5bd5298129c3a8ec1}{iterate()} instead. This function updates:
\begin{DoxyItemize}
\item x
\item old\_\-c
\item iterations Note that the conjugate direction and gradient are not updated. If bracket\_\-minimum\_\-forward detects a local maximum, then essentially a zero sized step is taken. 
\begin{DoxyParams}{Parameters}
{\em deriv} & Functor returning the derivative value at a given point. \\
\hline
\end{DoxyParams}

\end{DoxyItemize}

Definition at line 106 of file conjugate\_\-gradient\_\-only.h.



References ConjugateGradientOnly$<$ Size, Precision $>$::delta\_\-max, ConjugateGradientOnly$<$ Size, Precision $>$::g, ConjugateGradientOnly$<$ Size, Precision $>$::h, ConjugateGradientOnly$<$ Size, Precision $>$::iterations, ConjugateGradientOnly$<$ Size, Precision $>$::linesearch\_\-epsilon, ConjugateGradientOnly$<$ Size, Precision $>$::linesearch\_\-tolerance, ConjugateGradientOnly$<$ Size, Precision $>$::minus\_\-h, ConjugateGradientOnly$<$ Size, Precision $>$::new\_\-g, and ConjugateGradientOnly$<$ Size, Precision $>$::x.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::iterate().


\begin{DoxyCode}
    {
        iterations++;
        using std::abs;
        //Conjugate direction is -h
        //grad.-h is (should be negative)

        //We should have that f1 is negative.
        new_g = g;
        double f1 = g * minus_h;
        //If f1 is positive, then the conjugate vector points agains the
        //newly computed gradient. This can only happen if there is an error
        //in the computation of the gradient (eg we're using a stochastic method)
      
        //not much to do here except to stop.
        if(f1 > 0)
        {
            //Return, so try to search in a direction conjugate to the current on
      e.
            return;
        }
        //What step size takes us up to the maximum length
        Precision max_step = HUGE_VAL;
        for(int i=0; i < minus_h.size(); i++)
            max_step = min(max_step, abs(delta_max[i]/h[i]));

        //Taking the maximum step size may result in NaNs.
        //Try the maximum step size, and seccessively reduce it.
        Precision full_max_step = max_step;
        
        for(;;)
        {
            new_g = deriv(x + max_step * minus_h);

            if(!TooN::isnan(new_g))
            {
//  cout << "new_g is NAN free :)\n";
                break;
            }
            else
                max_step /=2;

            //If the step size gets too small then 
            //return as we can't really do anything
            if(max_step < full_max_step * linesearch_tolerance)
                return;
        }

        double f2 = new_g * minus_h;


        //If f2 hasn't gone negative, then the largest allowed step is not large 
      enough.
        //So, take a full step, then keep going in the same direction
        if(f2 < 0)
        {   
            //Take a full step
            x += max_step * minus_h;
            return;
        }

        //Now, x1 and x2 bracket a root, and find the root using bisection
        //x1 and x2 are represented by the scalars s1 and s2
        double s1 = 0;
        double s2 = max_step;
        double s_new = max_step;

        int updates[2] = {0,0};

        while(abs(s1 - s2) > abs(s1 + s2) * linesearch_tolerance + 
      linesearch_epsilon)
        {
            if(updates[0] != updates[1] && updates[0] != 0)
            {

                //Compute the new point using false position.
                s_new = s1 + f1 * (s2 - s1)/(f1 - f2);
                new_g = deriv(x + s_new * minus_h);
                double f_new = new_g*minus_h;

                updates[0] = updates[1];

                if(f_new == 0)
                    break;

                if(f_new < 0) 
                {
                    s1 = s_new;
                    f1 = f_new;
                    updates[1] = 1;
                }
                else
                {
                    s2 = s_new;
                    f2 = f_new;
                    updates[1] = 2;
                }
            }
            else
            {
                //Compute the new point
                
                s_new = (s1 + s2) / 2;

                new_g = deriv(x + s_new * minus_h);
                double f_new = new_g*minus_h;

                if(f_new < 0) 
                {
                    s1 = s_new;
                    f1 = f_new;
                    updates[0] = 1;
                }
                else
                {
                    s2 = s_new;
                    f2 = f_new;
                    updates[0] = 2;
                }
            
            }

        }

        //Update the current position and value
        //The most recent gradient computation is at s_new
        x += minus_h * s_new;

    }
\end{DoxyCode}
\hypertarget{structConjugateGradientOnly_a83fe3a7e01c67027102d532a229f649e}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!finished@{finished}}
\index{finished@{finished}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{finished}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ bool {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::finished (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{structConjugateGradientOnly_a83fe3a7e01c67027102d532a229f649e}


Check to see it iteration should stop. 

You probably do not want to use this function. See \hyperlink{structConjugateGradientOnly_ab3dd69246b6592f5bd5298129c3a8ec1}{iterate()} instead. This function updates nothing. 

Definition at line 234 of file conjugate\_\-gradient\_\-only.h.



References ConjugateGradientOnly$<$ Size, Precision $>$::iterations, ConjugateGradientOnly$<$ Size, Precision $>$::max\_\-iterations, ConjugateGradientOnly$<$ Size, Precision $>$::new\_\-g, and ConjugateGradientOnly$<$ Size, Precision $>$::tolerance.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::iterate().


\begin{DoxyCode}
    {
        using std::abs;
        return iterations > max_iterations || norm_inf(new_g) < tolerance;
    }
\end{DoxyCode}
\hypertarget{structConjugateGradientOnly_a71e53fe43ae841f6b6c3882d47b1862d}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!update\_\-vectors\_\-PR@{update\_\-vectors\_\-PR}}
\index{update\_\-vectors\_\-PR@{update\_\-vectors\_\-PR}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{update\_\-vectors\_\-PR}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ void {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::update\_\-vectors\_\-PR (
\begin{DoxyParamCaption}
\item[{const TooN::Vector$<$ Size $>$ \&}]{grad}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{structConjugateGradientOnly_a71e53fe43ae841f6b6c3882d47b1862d}


After an iteration, update the gradient and conjugate using the Polak-\/Ribiere equations. 

This function updates:
\begin{DoxyItemize}
\item g
\item old\_\-g
\item h
\item old\_\-h 
\begin{DoxyParams}{Parameters}
{\em grad} & The derivatives of the function at {\itshape x\/} \\
\hline
\end{DoxyParams}

\end{DoxyItemize}

Definition at line 248 of file conjugate\_\-gradient\_\-only.h.



References ConjugateGradientOnly$<$ Size, Precision $>$::g, ConjugateGradientOnly$<$ Size, Precision $>$::h, ConjugateGradientOnly$<$ Size, Precision $>$::minus\_\-h, ConjugateGradientOnly$<$ Size, Precision $>$::old\_\-g, and ConjugateGradientOnly$<$ Size, Precision $>$::old\_\-h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::iterate().


\begin{DoxyCode}
    {
        //Update the position, gradient and conjugate directions
        old_g = g;
        old_h = h;

        g = grad;
        //Precision gamma = (g * g - oldg*g)/(oldg * oldg);
        Precision gamma = (g * g - old_g*g)/(old_g * old_g);
        h = g + gamma * old_h;
        minus_h=-h;
    }
\end{DoxyCode}
\hypertarget{structConjugateGradientOnly_ab3dd69246b6592f5bd5298129c3a8ec1}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!iterate@{iterate}}
\index{iterate@{iterate}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{iterate}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ template$<$class Deriv $>$ bool {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::iterate (
\begin{DoxyParamCaption}
\item[{const Deriv \&}]{deriv}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{structConjugateGradientOnly_ab3dd69246b6592f5bd5298129c3a8ec1}


Use this function to iterate over the optimization. 

Note that after iterate returns false, g, h, old\_\-g and old\_\-h will not have been updated. This function updates:
\begin{DoxyItemize}
\item x
\item old\_\-c
\item iterations
\item g$\ast$
\item old\_\-g$\ast$
\item h$\ast$
\item old\_\-h$\ast$ 'd variables not updated on the last iteration. 
\begin{DoxyParams}{Parameters}
{\em deriv} & Functor to compute derivatives at the specified point. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Whether to continue. 
\end{DoxyReturn}

\end{DoxyItemize}

Definition at line 275 of file conjugate\_\-gradient\_\-only.h.



References ConjugateGradientOnly$<$ Size, Precision $>$::find\_\-next\_\-point(), ConjugateGradientOnly$<$ Size, Precision $>$::finished(), ConjugateGradientOnly$<$ Size, Precision $>$::new\_\-g, and ConjugateGradientOnly$<$ Size, Precision $>$::update\_\-vectors\_\-PR().



Referenced by FitSpots::optimize\_\-each\_\-spot\_\-in\_\-turn\_\-for\_\-several\_\-passes(), and FitSpots::try\_\-modifying\_\-model().


\begin{DoxyCode}
    {
        find_next_point(deriv);

        if(!finished())
        {
            update_vectors_PR(new_g);
            return 1;
        }
        else
            return 0;
    }
\end{DoxyCode}


\subsubsection{Member Data Documentation}
\hypertarget{structConjugateGradientOnly_ae916ee66d6484fd220b3a5528f12e838}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!size@{size}}
\index{size@{size}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{size}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ const int {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf size}}}
\label{structConjugateGradientOnly_ae916ee66d6484fd220b3a5528f12e838}


Dimensionality of the space. 



Definition at line 30 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::init().

\hypertarget{structConjugateGradientOnly_a94ce06cc56719043d0c3ef8e0c3c28fc}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!g@{g}}
\index{g@{g}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{g}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ TooN::Vector$<$Size$>$ {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf g}}}
\label{structConjugateGradientOnly_a94ce06cc56719043d0c3ef8e0c3c28fc}


Gradient vector used by the next call to \hyperlink{structConjugateGradientOnly_ab3dd69246b6592f5bd5298129c3a8ec1}{iterate()} 



Definition at line 31 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::find\_\-next\_\-point(), ConjugateGradientOnly$<$ Size, Precision $>$::init(), and ConjugateGradientOnly$<$ Size, Precision $>$::update\_\-vectors\_\-PR().

\hypertarget{structConjugateGradientOnly_ad7ef8a68a0519cae4351f0196dd6999c}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!new\_\-g@{new\_\-g}}
\index{new\_\-g@{new\_\-g}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{new\_\-g}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ TooN::Vector$<$Size$>$ {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf new\_\-g}}}
\label{structConjugateGradientOnly_ad7ef8a68a0519cae4351f0196dd6999c}


The new gradient set at the end of \hyperlink{structConjugateGradientOnly_ab3dd69246b6592f5bd5298129c3a8ec1}{iterate()} 



Definition at line 32 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::find\_\-next\_\-point(), ConjugateGradientOnly$<$ Size, Precision $>$::finished(), and ConjugateGradientOnly$<$ Size, Precision $>$::iterate().

\hypertarget{structConjugateGradientOnly_ae5caa046b9f3ac7654c4bac793f8cdcc}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!h@{h}}
\index{h@{h}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{h}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ TooN::Vector$<$Size$>$ {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf h}}}
\label{structConjugateGradientOnly_ae5caa046b9f3ac7654c4bac793f8cdcc}


Conjugate vector to be searched along in the next call to \hyperlink{structConjugateGradientOnly_ab3dd69246b6592f5bd5298129c3a8ec1}{iterate()} 



Definition at line 33 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::find\_\-next\_\-point(), ConjugateGradientOnly$<$ Size, Precision $>$::init(), and ConjugateGradientOnly$<$ Size, Precision $>$::update\_\-vectors\_\-PR().

\hypertarget{structConjugateGradientOnly_a48cad2fb91fa2ad32e8b1a98af26ef65}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!minus\_\-h@{minus\_\-h}}
\index{minus\_\-h@{minus\_\-h}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{minus\_\-h}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ TooN::Vector$<$Size$>$ {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf minus\_\-h}}}
\label{structConjugateGradientOnly_a48cad2fb91fa2ad32e8b1a98af26ef65}


negative of h as this is required to be passed into a function which uses references (so can't be temporary) 



Definition at line 34 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::find\_\-next\_\-point(), ConjugateGradientOnly$<$ Size, Precision $>$::init(), and ConjugateGradientOnly$<$ Size, Precision $>$::update\_\-vectors\_\-PR().

\hypertarget{structConjugateGradientOnly_a1965a6c9ae69d3f6c1718077558a7cd3}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!old\_\-g@{old\_\-g}}
\index{old\_\-g@{old\_\-g}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{old\_\-g}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ TooN::Vector$<$Size$>$ {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf old\_\-g}}}
\label{structConjugateGradientOnly_a1965a6c9ae69d3f6c1718077558a7cd3}


Gradient vector used to compute \$h\$ in the last call to \hyperlink{structConjugateGradientOnly_ab3dd69246b6592f5bd5298129c3a8ec1}{iterate()} 



Definition at line 35 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::update\_\-vectors\_\-PR().

\hypertarget{structConjugateGradientOnly_a90ee7b10afd09b2543d6a025daa79136}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!old\_\-h@{old\_\-h}}
\index{old\_\-h@{old\_\-h}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{old\_\-h}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ TooN::Vector$<$Size$>$ {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf old\_\-h}}}
\label{structConjugateGradientOnly_a90ee7b10afd09b2543d6a025daa79136}


Conjugate vector searched along in the last call to \hyperlink{structConjugateGradientOnly_ab3dd69246b6592f5bd5298129c3a8ec1}{iterate()} 



Definition at line 36 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::update\_\-vectors\_\-PR().

\hypertarget{structConjugateGradientOnly_a9a8b8534ab07c632fa41d9030977ee44}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!x@{x}}
\index{x@{x}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{x}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ TooN::Vector$<$Size$>$ {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf x}}}
\label{structConjugateGradientOnly_a9a8b8534ab07c632fa41d9030977ee44}


Current position (best known point) 



Definition at line 37 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::find\_\-next\_\-point(), ConjugateGradientOnly$<$ Size, Precision $>$::init(), FitSpots::optimize\_\-each\_\-spot\_\-in\_\-turn\_\-for\_\-several\_\-passes(), and FitSpots::try\_\-modifying\_\-model().

\hypertarget{structConjugateGradientOnly_a8cc2c8b3b1daabbf75104d86ff054568}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!old\_\-x@{old\_\-x}}
\index{old\_\-x@{old\_\-x}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{old\_\-x}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ TooN::Vector$<$Size$>$ {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf old\_\-x}}}
\label{structConjugateGradientOnly_a8cc2c8b3b1daabbf75104d86ff054568}


Previous point (not set at construction) 



Definition at line 38 of file conjugate\_\-gradient\_\-only.h.

\hypertarget{structConjugateGradientOnly_acaad884ef03d0dcbc59a8d14f860c197}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!tolerance@{tolerance}}
\index{tolerance@{tolerance}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{tolerance}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ Precision {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf tolerance}}}
\label{structConjugateGradientOnly_acaad884ef03d0dcbc59a8d14f860c197}


Tolerance used to determine if the optimization is complete. Defaults to square root of machine precision. 



Definition at line 40 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::finished(), and ConjugateGradientOnly$<$ Size, Precision $>$::init().

\hypertarget{structConjugateGradientOnly_a1df9c47b0be7a837c9732f4cf4f798ec}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!max\_\-iterations@{max\_\-iterations}}
\index{max\_\-iterations@{max\_\-iterations}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{max\_\-iterations}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ int {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf max\_\-iterations}}}
\label{structConjugateGradientOnly_a1df9c47b0be7a837c9732f4cf4f798ec}


Maximum number of iterations. Defaults to {\ttfamily size} $*100$. 



Definition at line 41 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::finished(), ConjugateGradientOnly$<$ Size, Precision $>$::init(), and FitSpots::optimize\_\-each\_\-spot\_\-in\_\-turn\_\-for\_\-several\_\-passes().

\hypertarget{structConjugateGradientOnly_ae4cc06d64b328af965eade49cc86f311}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!delta\_\-max@{delta\_\-max}}
\index{delta\_\-max@{delta\_\-max}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{delta\_\-max}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ TooN::Vector$<$Size$>$ {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf delta\_\-max}}}
\label{structConjugateGradientOnly_ae4cc06d64b328af965eade49cc86f311}


Maximum distance to travel along all axes in line search. 



Definition at line 43 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::find\_\-next\_\-point().

\hypertarget{structConjugateGradientOnly_aef8dc155ef9e48ff76a221f3fb715e8d}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!linesearch\_\-tolerance@{linesearch\_\-tolerance}}
\index{linesearch\_\-tolerance@{linesearch\_\-tolerance}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{linesearch\_\-tolerance}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ Precision {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf linesearch\_\-tolerance}}}
\label{structConjugateGradientOnly_aef8dc155ef9e48ff76a221f3fb715e8d}


Tolerance used to determine if the linesearch is complete. Defaults to square root of machine precision. 



Definition at line 45 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::find\_\-next\_\-point(), and ConjugateGradientOnly$<$ Size, Precision $>$::init().

\hypertarget{structConjugateGradientOnly_a2aa4e7a67ce5952df3cec03c0f893850}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!linesearch\_\-epsilon@{linesearch\_\-epsilon}}
\index{linesearch\_\-epsilon@{linesearch\_\-epsilon}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{linesearch\_\-epsilon}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ Precision {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf linesearch\_\-epsilon}}}
\label{structConjugateGradientOnly_a2aa4e7a67ce5952df3cec03c0f893850}


Additive term in tolerance to prevent excessive iterations if $x_\mathrm{optimal} = 0$. Known as {\ttfamily ZEPS} in numerical recipies. Defaults to 1e-\/20. 



Definition at line 46 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::find\_\-next\_\-point(), and ConjugateGradientOnly$<$ Size, Precision $>$::init().

\hypertarget{structConjugateGradientOnly_afeea8299d906bd33adb548dcac78b9ea}{
\index{ConjugateGradientOnly@{ConjugateGradientOnly}!iterations@{iterations}}
\index{iterations@{iterations}!ConjugateGradientOnly@{ConjugateGradientOnly}}
\paragraph[{iterations}]{\setlength{\rightskip}{0pt plus 5cm}template$<$int Size = -\/1, class Precision = double$>$ int {\bf ConjugateGradientOnly}$<$ Size, Precision $>$::{\bf iterations}}}
\label{structConjugateGradientOnly_afeea8299d906bd33adb548dcac78b9ea}


Number of iterations performed. 



Definition at line 49 of file conjugate\_\-gradient\_\-only.h.



Referenced by ConjugateGradientOnly$<$ Size, Precision $>$::find\_\-next\_\-point(), ConjugateGradientOnly$<$ Size, Precision $>$::finished(), and ConjugateGradientOnly$<$ Size, Precision $>$::init().



The documentation for this struct was generated from the following file:\begin{DoxyCompactItemize}
\item 
\hyperlink{conjugate__gradient__only_8h}{conjugate\_\-gradient\_\-only.h}\end{DoxyCompactItemize}
