Ignore:
Timestamp:
Dec 4, 2010, 11:56:28 PM (14 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:
586055
Parents:
f5bca2
git-author:
Frederik Heber <heber@…> (11/22/10 14:57:20)
git-committer:
Frederik Heber <heber@…> (12/04/10 23:56:28)
Message:

New classes Eigenspace and Subspace that contain eigen(sub)spaces.

  • also added new test to SubspaceFactorizerUnitTest::Subspacetext().
    • so far only constructs the full and nested sub spaces.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/SubspaceFactorizerUnittest.cpp

    rf5bca2 r9c5296  
    3232#include "Helpers/toString.hpp"
    3333#include "Helpers/Verbose.hpp"
     34#include "LinearAlgebra/Eigenspace.hpp"
     35#include "LinearAlgebra/MatrixContent.hpp"
     36#include "LinearAlgebra/Subspace.hpp"
    3437#include "LinearAlgebra/VectorContent.hpp"
    35 #include "LinearAlgebra/MatrixContent.hpp"
    3638
    3739#include "SubspaceFactorizerUnittest.hpp"
     
    354356  size_t run=1; // counting iterations
    355357  double threshold = 1.;  // containing threshold value
    356   while ((threshold > 1e-10) && (run < 200)) {
     358  while ((threshold > 1e-10) && (run < 2)) {
    357359    // for every dimension
    358360    for (size_t dim = 0; dim<4;++dim) {
     
    467469}
    468470
     471void SubspaceFactorizerUnittest::SubspaceTest()
     472{
     473  Log() << Verbose(0) << std::endl << std::endl;
     474  // create the total index set
     475  Log() << Verbose(1) << "Generating full space ..." << std::endl;
     476  IndexSet AllIndices;
     477  for (size_t i=0;i<matrixdimension;++i)
     478    AllIndices.insert(i);
     479  Eigenspace FullSpace(AllIndices, *matrix);
     480
     481  Log() << Verbose(1) << "Generating sub spaces ..." << std::endl;
     482  // create all consecutive index subsets for dim 1 to 3
     483  SubspaceMap Dimension_to_Indexset;
     484  for (size_t dim = 0; dim<3;++dim) {
     485    for (size_t i=0;i<matrixdimension;++i) {
     486      IndexSet *indexset = new IndexSet;
     487      for (size_t j=0;j<dim+1;++j) {
     488        const int value = (i+j) % matrixdimension;
     489        //std::cout << "Putting " << value << " into " << i << "th map " << dim << std::endl;
     490        CPPUNIT_ASSERT_MESSAGE("index "+toString(value)+" already present in "+toString(dim)+"-dim "+toString(i)+"th indexset.", indexset->count(value) == 0);
     491        indexset->insert(value);
     492      }
     493      boost::shared_ptr<Subspace> subspace(new Subspace(*indexset, FullSpace));
     494      Log() << Verbose(1) << "Current subspace is " << *subspace << std::endl;
     495      Dimension_to_Indexset.insert( make_pair(dim, boost::shared_ptr<Subspace>(subspace)) );
     496      delete(indexset);
     497
     498      // for through next lower subspace list and add to subspaces if contained.
     499      if (dim != 0) {
     500        Log() << Verbose(1) << "Going through subspace list in dim " << dim-1 << "." << std::endl;
     501        BOOST_FOREACH( SubspaceMap::value_type entry, Dimension_to_Indexset.equal_range(dim-1)) {
     502          if (subspace->contains(*entry.second)) {
     503            Log() << Verbose(2) << "Adding " << *(entry.second) << " to list of contained subspaces." << std::endl;
     504            subspace->addSubset(entry.second);
     505          }
     506        }
     507      } else {
     508        Log() << Verbose(2) << "Subspace with dimension of 1 cannot contain other subspaces." << std::endl;
     509      }
     510    }
     511  }
     512
     513  CPPUNIT_ASSERT_EQUAL(0,0);
     514}
Note: See TracChangeset for help on using the changeset viewer.