Changeset 26108c


Ignore:
Timestamp:
Oct 6, 2011, 7:17:47 AM (13 years ago)
Author:
Frederik Heber <heber@…>
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:
dc8827
Parents:
59e063
git-author:
Frederik Heber <heber@…> (04/24/11 22:30:42)
git-committer:
Frederik Heber <heber@…> (10/06/11 07:17:47)
Message:

FIX: Changed ambigious interface for MatrixContent::transpose().

  • now, if we transpose in place, the function is transpose() (active voice).
  • if we transpose to other MatrixContent, it is transposed() (passive voice).
  • this also changed the interface for RealSpaceMatrix::transpose().
  • fixes in several unit tests where before we always had to explicitly cast the matrix to const in order to make use of the passive voice form.
Location:
LinearAlgebra/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • LinearAlgebra/src/LinearAlgebra/MatrixContent.cpp

    r59e063 r26108c  
    2929#include <gsl/gsl_vector.h>
    3030#include <cmath>
    31 #include <cassert>
    3231#include <iostream>
    3332#include <limits>
     
    487486 * \return new matrix that is transposed of this.
    488487 */
    489 MatrixContent MatrixContent::transpose() const
     488MatrixContent MatrixContent::transposed() const
    490489{
    491490  gsl_matrix *res = gsl_matrix_alloc(columns, rows);  // column and row dimensions exchanged!
     
    539538      +toString(V.getRows())+"!="+toString(rows)+".");
    540539  ASSERT(S.getDimension() == columns,
    541       "MatrixContent::performSingularValueDecomposition() - Vector S does not haver the right dimension "
     540      "MatrixContent::performSingularValueDecomposition() - Vector S does not have the right dimension "
    542541      +toString(S.getDimension())+"!="+toString(columns)+".");
    543542  gsl_matrix *A = content;
  • LinearAlgebra/src/LinearAlgebra/MatrixContent.hpp

    r59e063 r26108c  
    9494
    9595  // Transformations
    96   MatrixContent transpose() const;
     96  MatrixContent transposed() const;
    9797  MatrixContent &transpose();
    9898  gsl_vector* transformToEigenbasis();
  • LinearAlgebra/src/LinearAlgebra/RealSpaceMatrix.cpp

    r59e063 r26108c  
    267267}
    268268
    269 RealSpaceMatrix RealSpaceMatrix::transpose() const
    270 {
    271   RealSpaceMatrix res = RealSpaceMatrix(const_cast<const MatrixContent *>(content)->transpose());
     269RealSpaceMatrix RealSpaceMatrix::transposed() const
     270{
     271  RealSpaceMatrix res = RealSpaceMatrix(content->transposed());
    272272  return res;
    273273}
  • LinearAlgebra/src/LinearAlgebra/RealSpaceMatrix.hpp

    r59e063 r26108c  
    138138   * Calculate the transpose of the matrix.
    139139   */
    140   RealSpaceMatrix transpose() const;
     140  RealSpaceMatrix transposed() const;
    141141  RealSpaceMatrix &transpose();
    142142
  • LinearAlgebra/src/unittests/MatrixContentSymmetricUnitTest.cpp

    r59e063 r26108c  
    225225    }
    226226  // transpose
    227   MatrixContent res = ((const MatrixContent)*m).transpose();
     227  MatrixContent res = (*m).transposed();
    228228  CPPUNIT_ASSERT( *n == res );
    229229  // second transpose
  • LinearAlgebra/src/unittests/MatrixContentUnitTest.cpp

    r59e063 r26108c  
    239239    }
    240240  // transpose
    241   MatrixContent res = ((const MatrixContent)(*m)).transpose();
     241  MatrixContent res = (*m).transposed();
    242242  CPPUNIT_ASSERT( *n == res );
    243243  // second transpose
    244   MatrixContent res2 = ((const MatrixContent)res).transpose();
     244  MatrixContent res2 = res.transposed();
    245245  CPPUNIT_ASSERT( *m == res2 );
    246246  delete n;
  • LinearAlgebra/src/unittests/RealSpaceMatrixUnitTest.cpp

    r59e063 r26108c  
    281281  // ... or transposed
    282282  res.setRotation(M_PI/3.,0.,0.);
    283   CPPUNIT_ASSERT_EQUAL(inverse, ((const RealSpaceMatrix) res).transpose());
     283  CPPUNIT_ASSERT_EQUAL(inverse, res.transposed());
    284284}
    285285
Note: See TracChangeset for help on using the changeset viewer.