go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkPreconditionedGradientDescentOptimizer.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef __itkPreconditionedGradientDescentOptimizer_h
19#define __itkPreconditionedGradientDescentOptimizer_h
20
22#include "itkArray2D.h"
23#include "vnl/vnl_sparse_matrix.h"
24#include "cholmod.h"
25
26namespace itk
27{
57{
58public:
63 typedef SmartPointer<const Self> ConstPointer;
64
66 itkNewMacro(Self);
67
70
79
81 typedef DerivativeType::ValueType PreconditionValueType;
82 //typedef Array2D<PreconditionValueType> PreconditionType;
83 //typedef vnl_symmetric_eigensystem<
84 // PreconditionValueType > EigenSystemType;
85 typedef vnl_sparse_matrix< PreconditionValueType > PreconditionType;
86
91 typedef enum {
95
97 virtual void AdvanceOneStep( void );
98
100 virtual void StartOptimization( void );
101
105 virtual void ResumeOptimization( void );
106
108 virtual void MetricErrorResponse( ExceptionObject & err );
109
112 virtual void StopOptimization( void );
113
115 itkSetMacro( LearningRate, double );
116
118 itkGetConstReferenceMacro( LearningRate, double);
119
121 itkSetMacro( NumberOfIterations, unsigned long );
122
124 itkGetConstReferenceMacro( NumberOfIterations, unsigned long );
125
127 itkGetConstMacro( CurrentIteration, unsigned int );
128
130 itkGetConstReferenceMacro( Value, double );
131
133 itkGetConstReferenceMacro( StopCondition, StopConditionType );
134
136 itkGetConstReferenceMacro( Gradient, DerivativeType );
137
139 itkGetConstReferenceMacro( SearchDirection, DerivativeType );
140
147 virtual void SetPreconditionMatrix( PreconditionType & precondition );
148
150 const cholmod_common * GetCholmodCommon( void ) const
151 {
152 return this->m_CholmodCommon;
153 }
154
155
156 const cholmod_factor * GetCholmodFactor( void ) const
157 {
158 return this->m_CholmodFactor;
159 }
160
162 itkSetMacro( DiagonalWeight, double );
163 itkGetConstMacro( DiagonalWeight, double );
164
166 itkSetMacro( MinimumGradientElementMagnitude, double );
167 itkGetConstMacro( MinimumGradientElementMagnitude, double );
168
171 itkGetConstMacro( ConditionNumber, double );
172
175 itkGetConstMacro( LargestEigenValue, double );
176
181 itkGetConstMacro( Sparsity, double );
182
183protected:
186
187 void PrintSelf(std::ostream& os, Indent indent) const;
188
190 typedef int CInt; // change to UF_long if using cholmod_l;
191
192 // made protected so subclass can access
200
201 cholmod_common * m_CholmodCommon;
202 cholmod_factor * m_CholmodFactor;
203 cholmod_sparse * m_CholmodGradient;
204
209 virtual void CholmodSolve( const DerivativeType & gradient,
210 DerivativeType & searchDirection, int solveType = CHOLMOD_A );
211
212private:
213 PreconditionedGradientDescentOptimizer(const Self&); // purposely not implemented
214 void operator=(const Self&); // purposely not implemented
215
216 bool m_Stop;
217 double m_Value;
218
219 unsigned long m_NumberOfIterations;
220 unsigned long m_CurrentIteration;
221
224
225};
226
227} // end namespace itk
228
229
230#endif
virtual void SetPreconditionMatrix(PreconditionType &precondition)
void PrintSelf(std::ostream &os, Indent indent) const
virtual void MetricErrorResponse(ExceptionObject &err)
virtual void CholmodSolve(const DerivativeType &gradient, DerivativeType &searchDirection, int solveType=CHOLMOD_A)


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo