Changeset 6c438f for src/unittests/MatrixUnittest.cpp
- Timestamp:
- Aug 28, 2010, 3:21:11 AM (15 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, Candidate_v1.7.0, Candidate_v1.7.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:
- a6e6b5, f8982c
- Parents:
- 2ad482 (diff), fd4905 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Frederik Heber <heber@…> (08/28/10 03:17:48)
- git-committer:
- Frederik Heber <heber@…> (08/28/10 03:21:11)
- File:
-
- 1 edited
-
src/unittests/MatrixUnittest.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/MatrixUnittest.cpp
r2ad482 r6c438f 1 /* 2 * Project: MoleCuilder 3 * Description: creates and alters molecular systems 4 * Copyright (C) 2010 University of Bonn. All rights reserved. 5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. 6 */ 7 1 8 /* 2 9 * MatrixUnittest.cpp … … 6 13 */ 7 14 15 // include config.h 16 #ifdef HAVE_CONFIG_H 17 #include <config.h> 18 #endif 19 8 20 #include <cppunit/CompilerOutputter.h> 9 21 #include <cppunit/extensions/TestFactoryRegistry.h> 10 22 #include <cppunit/ui/text/TestRunner.h> 11 23 24 #include <cmath> 25 12 26 #include "MatrixUnittest.hpp" 13 #include " Matrix.hpp"14 #include " vector.hpp"27 #include "LinearAlgebra/Vector.hpp" 28 #include "LinearAlgebra/Matrix.hpp" 15 29 #include "Exceptions/NotInvertibleException.hpp" 16 30 … … 151 165 } 152 166 } 167 } 168 169 void MatrixUnittest::TransposeTest(){ 170 Matrix res; 171 172 // transpose of unit is unit 173 res.one(); 174 (const Matrix)res.transpose(); 175 CPPUNIT_ASSERT_EQUAL(res,*one); 176 177 // transpose of transpose is same matrix 178 res.zero(); 179 res.set(2,2, 1.); 180 CPPUNIT_ASSERT_EQUAL(res.transpose().transpose(),res); 153 181 } 154 182 … … 225 253 } 226 254 255 void MatrixUnittest::RotationTest(){ 256 Matrix res; 257 Matrix inverse; 258 259 // zero rotation angles yields unity matrix 260 res.rotation(0,0,0); 261 CPPUNIT_ASSERT_EQUAL(*one, res); 262 263 // arbitrary rotation matrix has det = 1 264 res.rotation(M_PI/3.,1.,M_PI/7.); 265 CPPUNIT_ASSERT(fabs(fabs(res.determinant()) -1.) < MYEPSILON); 266 267 // inverse is rotation matrix with negative angles 268 res.rotation(M_PI/3.,0.,0.); 269 inverse.rotation(-M_PI/3.,0.,0.); 270 CPPUNIT_ASSERT_EQUAL(*one, res * inverse); 271 272 // ... or transposed 273 res.rotation(M_PI/3.,0.,0.); 274 CPPUNIT_ASSERT_EQUAL(inverse, ((const Matrix) res).transpose()); 275 } 227 276 228 277 void MatrixUnittest::InvertTest(){
Note:
See TracChangeset
for help on using the changeset viewer.
