Changeset 9fd44f
- Timestamp:
- Aug 14, 2014, 2:49:51 PM (10 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:
- 06804b
- Parents:
- 74d179
- git-author:
- Frederik Heber <heber@…> (07/10/14 17:06:56)
- git-committer:
- Frederik Heber <heber@…> (08/14/14 14:49:51)
- Location:
- LinearAlgebra/src/LinearAlgebra
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LinearAlgebra/src/LinearAlgebra/Vector.cpp
r74d179 r9fd44f 290 290 291 291 /** Checks whether vector has all components zero. 292 * @param epsilon numerical tolerance for equality 292 293 * @return true - vector is zero, false - vector is not 293 294 */ 294 bool Vector::IsZero( ) const295 { 296 return (fabs(at(0))+fabs(at(1))+fabs(at(2)) < LINALG_MYEPSILON());295 bool Vector::IsZero(const double _epsilon) const 296 { 297 return (fabs(at(0))+fabs(at(1))+fabs(at(2)) < _epsilon); 297 298 }; 298 299 299 300 /** Checks whether vector has length of 1. 301 * @param epsilon numerical tolerance for equality 300 302 * @return true - vector is normalized, false - vector is not 301 303 */ 302 bool Vector::IsOne( ) const303 { 304 return (fabs(Norm() - 1.) < LINALG_MYEPSILON());304 bool Vector::IsOne(const double _epsilon) const 305 { 306 return (fabs(Norm() - 1.) < _epsilon); 305 307 }; 306 308 307 309 /** Checks whether vector is normal to \a *normal. 310 * @param normal other supposedly normal vector 311 * @param epsilon numerical tolerance for equality 308 312 * @return true - vector is normalized, false - vector is not 309 313 */ 310 bool Vector::IsNormalTo(const Vector &normal ) const311 { 312 if (ScalarProduct(normal) < LINALG_MYEPSILON())314 bool Vector::IsNormalTo(const Vector &normal, const double _epsilon) const 315 { 316 if (ScalarProduct(normal) < _epsilon) 313 317 return true; 314 318 else … … 317 321 318 322 /** Checks whether vector is normal to \a *normal. 323 * @param a other vector 324 * @param epsilon numerical tolerance for equality 319 325 * @return true - vector is normalized, false - vector is not 320 326 */ 321 bool Vector::IsEqualTo(const Vector &a ) const327 bool Vector::IsEqualTo(const Vector &a, const double _epsilon) const 322 328 { 323 329 bool status = true; 324 330 for (int i=0;i<NDIM;i++) { 325 if (fabs(at(i) - a[i]) > LINALG_MYEPSILON())331 if (fabs(at(i) - a[i]) > _epsilon) 326 332 status = false; 327 333 } -
LinearAlgebra/src/LinearAlgebra/Vector.hpp
r74d179 r9fd44f 46 46 double ScalarProduct(const Vector &y) const; 47 47 double Angle(const Vector &y) const; 48 bool IsZero( ) const;49 bool IsOne( ) const;50 bool IsNormalTo(const Vector &normal ) const;51 bool IsEqualTo(const Vector &a ) const;48 bool IsZero(const double epsilon = LINALG_MYEPSILON()) const; 49 bool IsOne(const double epsilon = LINALG_MYEPSILON()) const; 50 bool IsNormalTo(const Vector &normal, const double epsilon = LINALG_MYEPSILON()) const; 51 bool IsEqualTo(const Vector &a, const double epsilon = LINALG_MYEPSILON()) const; 52 52 53 53 void AddVector(const Vector &y);
Note:
See TracChangeset
for help on using the changeset viewer.