Changeset ee4f2d for LinearAlgebra/src
- Timestamp:
- Aug 20, 2014, 1:09:40 PM (11 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, 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:
- fc3aff
- Parents:
- 2a03b0 (diff), 343c5a (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. - Location:
- LinearAlgebra/src/LinearAlgebra
- Files:
-
- 5 edited
-
Makefile.am (modified) (2 diffs)
-
Plane.cpp (modified) (1 diff)
-
Vector.cpp (modified) (2 diffs)
-
Vector.hpp (modified) (1 diff)
-
VectorContent.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
LinearAlgebra/src/LinearAlgebra/Makefile.am
r2a03b0 ree4f2d 4 4 INCLUDES = -I$(top_srcdir)/src 5 5 6 AM_LDFLAGS = ${CodePatterns_LIBS}-ldl6 AM_LDFLAGS = -ldl 7 7 AM_CPPFLAGS = $(BOOST_CPPFLAGS) ${CodePatterns_CFLAGS} 8 8 … … 52 52 libLinearAlgebra_la_LIBADD = \ 53 53 $(BOOST_SERIALIZATION_LDFLAGS) $(BOOST_SERIALIZATION_LIBS) \ 54 ${CodePatterns_LIBS} \ 54 55 $(GSL_LIBS) 55 56 nobase_libLinearAlgebra_la_include_HEADERS = ${LINALGHEADER} -
LinearAlgebra/src/LinearAlgebra/Plane.cpp
r2a03b0 ree4f2d 57 57 Vector x1 = y1 - y2; 58 58 Vector x2 = y3 - y2; 59 if ((x1.Norm () <= LINALG_MYEPSILON())) {59 if ((x1.NormSquared() <= LINALG_MYEPSILON())) { 60 60 throw LinearDependenceException() << LinearAlgebraVectorPair( make_pair(&y1, &y2) ); 61 61 } 62 if ((x2.Norm () <= LINALG_MYEPSILON())) {62 if ((x2.NormSquared() <= LINALG_MYEPSILON())) { 63 63 throw LinearDependenceException() << LinearAlgebraVectorPair( make_pair(&y2, &y3) ); 64 64 } 65 if((fabs(x1.Angle(x2)) <= LINALG_MYEPSILON())) { 65 const Vector lineardependent = x1.Projection(x2) - x1; 66 if((lineardependent.NormSquared() <= LINALG_MYEPSILON())) { 66 67 throw LinearDependenceException() << LinearAlgebraVectorPair( make_pair(&x1, &x2) ); 67 68 } -
LinearAlgebra/src/LinearAlgebra/Vector.cpp
r2a03b0 ree4f2d 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 … … 316 320 }; 317 321 322 /** Checks whether vector is parallel to \a *parallel. 323 * @param parallel other supposedly parallel vector 324 * @param epsilon numerical tolerance for equality 325 * @return true - vector is parallel/linear dependent, false - vector is not 326 */ 327 bool Vector::IsParallelTo(const Vector ¶llel, const double _epsilon) const 328 { 329 if (1.-fabs(ScalarProduct(parallel)/parallel.Norm()/this->Norm()) < _epsilon) 330 return true; 331 else 332 return false; 333 }; 334 318 335 /** Checks whether vector is normal to \a *normal. 336 * @param a other vector 337 * @param epsilon numerical tolerance for equality 319 338 * @return true - vector is normalized, false - vector is not 320 339 */ 321 bool Vector::IsEqualTo(const Vector &a ) const340 bool Vector::IsEqualTo(const Vector &a, const double _epsilon) const 322 341 { 323 342 bool status = true; 324 343 for (int i=0;i<NDIM;i++) { 325 if (fabs(at(i) - a[i]) > LINALG_MYEPSILON())344 if (fabs(at(i) - a[i]) > _epsilon) 326 345 status = false; 327 346 } -
LinearAlgebra/src/LinearAlgebra/Vector.hpp
r2a03b0 ree4f2d 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 IsParallelTo(const Vector &normal, const double epsilon = LINALG_MYEPSILON()) const; 52 bool IsEqualTo(const Vector &a, const double epsilon = LINALG_MYEPSILON()) const; 52 53 53 54 void AddVector(const Vector &y); -
LinearAlgebra/src/LinearAlgebra/VectorContent.cpp
r2a03b0 ree4f2d 504 504 { 505 505 double factor = Norm(); 506 (*this) *= 1/factor; 506 if (fabs(factor) > LINALG_MYEPSILON()) 507 (*this) *= 1./factor; 507 508 }; 508 509
Note:
See TracChangeset
for help on using the changeset viewer.
