Changeset d03292 for src/FunctionApproximation
- Timestamp:
- Dec 19, 2012, 3:26:11 PM (12 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 17b3598
- Parents:
- f48ad3
- git-author:
- Frederik Heber <heber@…> (10/05/12 19:18:28)
- git-committer:
- Frederik Heber <heber@…> (12/19/12 15:26:11)
- Location:
- src/FunctionApproximation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/FunctionApproximation/FunctionApproximation.cpp
rf48ad3 rd03292 169 169 // give this pointer as additional data to construct function pointer in 170 170 // LevMarCallback and call 171 if (mode == FiniteDifferences) { 172 ret=dlevmar_dif( 173 &FunctionApproximation::LevMarCallback, 174 p, x, m, n, 1000, opts, info, work, covar, this); // no Jacobian, caller allocates work memory, covariance estimated 175 } else if (mode == ParameterDerivative) { 176 ret=dlevmar_der( 177 &FunctionApproximation::LevMarCallback, 178 &FunctionApproximation::LevMarDerivativeCallback, 179 p, x, m, n, 1000, opts, info, work, covar, this); // no Jacobian, caller allocates work memory, covariance estimated 171 if (model.isBoxConstraint()) { 172 FunctionModel::parameters_t lowerbound = model.getLowerBoxConstraints(); 173 FunctionModel::parameters_t upperbound = model.getUpperBoxConstraints(); 174 double *lb = new double[m]; 175 double *ub = new double[m]; 176 for (size_t i=0;i<m;++i) { 177 lb[i] = lowerbound[i]; 178 ub[i] = upperbound[i]; 179 } 180 if (mode == FiniteDifferences) { 181 ret=dlevmar_bc_dif( 182 &FunctionApproximation::LevMarCallback, 183 p, x, m, n, lb, ub, NULL, 1000, opts, info, work, covar, this); // no Jacobian, caller allocates work memory, covariance estimated 184 } else if (mode == ParameterDerivative) { 185 ret=dlevmar_bc_der( 186 &FunctionApproximation::LevMarCallback, 187 &FunctionApproximation::LevMarDerivativeCallback, 188 p, x, m, n, lb, ub, NULL, 1000, opts, info, work, covar, this); // no Jacobian, caller allocates work memory, covariance estimated 189 } else { 190 ASSERT(0, "FunctionApproximation::operator() - Unknown jacobian method chosen."); 191 } 192 delete[] lb; 193 delete[] ub; 180 194 } else { 181 195 ASSERT(0, "FunctionApproximation::operator() - Unknown jacobian method chosen."); 196 if (mode == FiniteDifferences) { 197 ret=dlevmar_dif( 198 &FunctionApproximation::LevMarCallback, 199 p, x, m, n, 1000, opts, info, work, covar, this); // no Jacobian, caller allocates work memory, covariance estimated 200 } else if (mode == ParameterDerivative) { 201 ret=dlevmar_der( 202 &FunctionApproximation::LevMarCallback, 203 &FunctionApproximation::LevMarDerivativeCallback, 204 p, x, m, n, 1000, opts, info, work, covar, this); // no Jacobian, caller allocates work memory, covariance estimated 205 } else { 206 ASSERT(0, "FunctionApproximation::operator() - Unknown jacobian method chosen."); 207 } 182 208 } 183 209 -
src/FunctionApproximation/FunctionModel.hpp
rf48ad3 rd03292 78 78 */ 79 79 virtual results_t parameter_derivative(const arguments_t &arguments, const size_t index) const=0; 80 81 /** States whether lower and upper boundaries should be used to constraint 82 * the parameter search for this function model. 83 * 84 * \return true - constraints should be used, false - else 85 */ 86 virtual bool isBoxConstraint() const=0; 87 88 /** Returns a vector which are the lower boundaries for each parameter_t 89 * of this FunctionModel. 90 * 91 * \return vector of parameter_t resembling lowest allowed values 92 */ 93 virtual parameters_t getLowerBoxConstraints() const=0; 94 95 /** Returns a vector which are the upper boundaries for each parameter_t 96 * of this FunctionModel. 97 * 98 * \return vector of parameter_t resembling highest allowed values 99 */ 100 virtual parameters_t getUpperBoxConstraints() const=0; 80 101 }; 81 102
Note:
See TracChangeset
for help on using the changeset viewer.