Changeset 325390 for src/vector.cpp
- Timestamp:
- Jun 25, 2010, 1:44:07 PM (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, 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:
- c94eeb
- Parents:
- 923b6c
- git-author:
- Tillmann Crueger <crueger@…> (06/25/10 10:52:58)
- git-committer:
- Tillmann Crueger <crueger@…> (06/25/10 13:44:07)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/vector.cpp
r923b6c r325390 8 8 9 9 #include "vector.hpp" 10 #include "Matrix.hpp" 10 11 #include "verbose.hpp" 11 12 #include "World.hpp" 12 13 #include "Helpers/Assert.hpp" 13 14 #include "Helpers/fast_functions.hpp" 15 #include "Exceptions/MathException.hpp" 14 16 15 17 #include <iostream> … … 48 50 gsl_vector_set(content,2,x3); 49 51 }; 52 53 Vector::Vector(gsl_vector *_content) : 54 content(_content) 55 {} 50 56 51 57 /** … … 458 464 }; 459 465 466 Vector &Vector::operator*=(const Matrix &mat){ 467 (*this) = mat*(*this); 468 return *this; 469 } 470 471 Vector operator*(const Matrix &mat,const Vector &vec){ 472 gsl_vector *res = gsl_vector_calloc(NDIM); 473 gsl_blas_dgemv( CblasNoTrans, 1.0, mat.content, vec.content, 0.0, res); 474 return Vector(res); 475 } 476 477 460 478 /** Factors given vector \a a times \a m. 461 479 * \param a vector … … 548 566 void Vector::MatrixMultiplication(const double * const M) 549 567 { 550 Vector tmp; 551 // do the matrix multiplication 552 for(int i=NDIM;i--;) 553 tmp[i] = M[i]*at(0)+M[i+3]*at(1)+M[i+6]*at(2); 554 555 (*this) = tmp; 568 (*this) *= Matrix(M); 556 569 }; 557 570 … … 561 574 bool Vector::InverseMatrixMultiplication(const double * const A) 562 575 { 576 /* 563 577 double B[NDIM*NDIM]; 564 578 double detA = RDET3(A); … … 582 596 return true; 583 597 } else { 598 return false; 599 } 600 */ 601 Matrix mat = Matrix(A); 602 try{ 603 (*this) *= mat.invert(); 604 return true; 605 } 606 catch(MathException &excpt){ 584 607 return false; 585 608 }
Note:
See TracChangeset
for help on using the changeset viewer.