Changeset 31021ab for LinearAlgebra
- Timestamp:
- Mar 22, 2013, 12:04:17 AM (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:
- d948b4
- Parents:
- cf1183
- git-author:
- Frederik Heber <heber@…> (03/01/13 19:25:36)
- git-committer:
- Frederik Heber <heber@…> (03/22/13 00:04:17)
- Location:
- LinearAlgebra
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
LinearAlgebra/configure.ac
rcf1183 r31021ab 34 34 # refer to the libtool manual, section "Updating library version information": 35 35 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html 36 AC_SUBST([LINEARALGEBRA_SO_VERSION], [3: 1:0])37 AC_SUBST([LINEARALGEBRA_API_VERSION], [1.0. 4])36 AC_SUBST([LINEARALGEBRA_SO_VERSION], [3:2:0]) 37 AC_SUBST([LINEARALGEBRA_API_VERSION], [1.0.5]) 38 38 39 39 dnl this macro is used to get the arguments supplied -
LinearAlgebra/src/LinearAlgebra/VectorSet.hpp
rcf1183 r31021ab 82 82 if(!this->size()) 83 83 return zeroVec; 84 std::vector<Vector> helper; 85 helper.resize(this->size()); 86 std::transform(this->begin(),this->end(), 87 helper.begin(), 88 std::bind2nd(std::mem_fun_ref(&Vector::operator-),point)); 89 return *min_element(helper.begin(),helper.end(), 90 boost::lambda::_1 < boost::lambda::_2); 91 //(boost::lambda::bind(Vector::NormSquared,boost::lambda::_1) < boost::lambda::bind(Vector::NormSquared,boost::lambda::_2))); 92 } 93 94 /** Return the length of the Vector that is closest to \a point. 95 * 96 * @param point 97 * @return 98 */ 99 double minDistSquared(const Vector &point){ 100 if(!this->size()) 101 return std::numeric_limits<double>::infinity(); 102 std::vector<double> helper; 103 helper.resize(this->size()); 104 std::transform(this->begin(),this->end(), 105 helper.begin(), 106 std::bind2nd(std::mem_fun_ref(&Vector::DistanceSquared),point)); 107 return *min_element(helper.begin(),helper.end()); 84 translate(-1.*point); 85 // std::transform(this->begin(),this->end(), 86 // this->begin(), 87 // std::bind2nd(std::mem_fun_ref(&Vector::operator-),point)); 88 return *min_element(this->begin(),this->end(), 89 // boost::lambda::_1 < boost::lambda::_2); 90 (boost::lambda::bind(&Vector::NormSquared,boost::lambda::_1) < boost::lambda::bind(&Vector::NormSquared,boost::lambda::_2))); 108 91 } 109 92 }; -
LinearAlgebra/src/unittests/VectorSetUnitTest.cpp
rcf1183 r31021ab 127 127 Vector mindist = somelist.minDistance(center); 128 128 CPPUNIT_ASSERT_EQUAL (Vector(1., 0., 0.), mindist); 129 // check that vector has changed (by nothing) 130 for (size_t i=0;i<somelist.size();++i) 131 CPPUNIT_ASSERT_EQUAL (Vector(i+1.,0.,0.), somelist[i]); 129 132 } 130 133 { 131 134 Vector center(5.,0.,0.); 132 Vector mindist = worklist.minDistance(center); 135 VECTORSET(std::vector) somelist(worklist); 136 Vector mindist = somelist.minDistance(center); 133 137 CPPUNIT_ASSERT_EQUAL (Vector(2., 1., 0.)-center, mindist); 138 // check that vector has changed 139 for (size_t i=0;i<somelist.size();++i) 140 CPPUNIT_ASSERT_EQUAL (somelist[i], worklist[i]-center); 134 141 } 135 142 { 136 143 for (VECTORSET(std::vector)::const_iterator iter = worklist.begin(); 137 144 iter != worklist.end(); ++iter) { 138 Vector mindist = worklist.minDistance(*iter); 145 // copy list as we change it 146 VECTORSET(std::vector) somelist(worklist); 147 Vector mindist = somelist.minDistance(*iter); 139 148 CPPUNIT_ASSERT_EQUAL( Vector(0.,0.,0.), mindist ); 140 149 } … … 142 151 } 143 152 144 /** UnitTest for minDistance()145 */146 void VectorSetTest::minDistSquaredTest()147 {148 VECTORSET(std::vector) worklist(list);149 {150 Vector center(5.,0.,0.);151 double mindist = worklist.minDistSquared(center);152 double check = Vector(2., 1., 0.).DistanceSquared(center);153 CPPUNIT_ASSERT_EQUAL( check, mindist );154 }155 {156 for (VECTORSET(std::vector)::const_iterator iter = worklist.begin();157 iter != worklist.end(); ++iter) {158 double mindist = worklist.minDistSquared(*iter);159 CPPUNIT_ASSERT_EQUAL( 0., mindist );160 }161 }162 } -
LinearAlgebra/src/unittests/VectorSetUnitTest.hpp
rcf1183 r31021ab 30 30 CPPUNIT_TEST ( transformTest ); 31 31 CPPUNIT_TEST ( minDistanceTest ); 32 CPPUNIT_TEST ( minDistSquaredTest );33 32 CPPUNIT_TEST_SUITE_END(); 34 33
Note:
See TracChangeset
for help on using the changeset viewer.