Changeset 4b94bb


Ignore:
Timestamp:
Jul 1, 2010, 2:48:50 PM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
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:
456341
Parents:
c550dd
Message:

Moved Vector-Matrix operations to matrix class

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Matrix.cpp

    rc550dd r4b94bb  
    1111#include "Helpers/fast_functions.hpp"
    1212#include "Helpers/Assert.hpp"
     13#include "vector.hpp"
    1314
    1415#include <gsl/gsl_blas.h>
     
    192193  return ost;
    193194}
     195
     196Vector operator*(const Matrix &mat,const Vector &vec){
     197  gsl_vector *res = gsl_vector_calloc(NDIM);
     198  gsl_blas_dgemv( CblasNoTrans, 1.0, mat.content, vec.content, 0.0, res);
     199  return Vector(res);
     200}
     201
     202Vector &operator*=(Vector& lhs,const Matrix &mat){
     203  lhs = mat*lhs;
     204  return lhs;
     205}
     206
  • src/Matrix.hpp

    rc550dd r4b94bb  
    5959
    6060std::ostream &operator<<(std::ostream&,const Matrix&);
     61Vector operator*(const Matrix&,const Vector&);
     62Vector& operator*=(Vector&,const Matrix&);
    6163
    6264#endif /* MATRIX_HPP_ */
  • src/vector.cpp

    rc550dd r4b94bb  
    88
    99#include "vector.hpp"
    10 #include "Matrix.hpp"
    1110#include "verbose.hpp"
    1211#include "World.hpp"
     
    361360  return x;
    362361};
    363 
    364 Vector &Vector::operator*=(const Matrix &mat){
    365   (*this) = mat*(*this);
    366   return *this;
    367 }
    368 
    369 Vector operator*(const Matrix &mat,const Vector &vec){
    370   gsl_vector *res = gsl_vector_calloc(NDIM);
    371   gsl_blas_dgemv( CblasNoTrans, 1.0, mat.content, vec.content, 0.0, res);
    372   return Vector(res);
    373 }
    374 
    375362
    376363/** Factors given vector \a a times \a m.
  • src/vector.hpp

    rc550dd r4b94bb  
    9090  Vector const operator+(const Vector& b) const;
    9191  Vector const operator-(const Vector& b) const;
    92   Vector& operator*=(const Matrix&);
    9392
    9493  // Methods inherited from Space
     
    114113Vector const operator*(const Vector& a, const double m);
    115114Vector const operator*(const double m, const Vector& a);
    116 Vector operator*(const Matrix&,const Vector&);
    117 
    118115
    119116#endif /*VECTOR_HPP_*/
Note: See TracChangeset for help on using the changeset viewer.