Merge in AR branch dev
authorDmitriy Morozov <morozov@cs.duke.edu>
Fri, 04 Apr 2008 21:14:44 -0400
branchdev
changeset 87 2c2e2f3b5d15
parent 54 8f88bd32153a (diff)
parent 86 73a54447b54a (current diff)
child 88 9e00cf44ea5d
Merge in AR branch
CMakeLists.txt
examples/ar-vineyard/CMakeLists.txt
examples/ar-vineyard/ar-vineyard.h
examples/ar-vineyard/ar-vineyard.hpp
include/geometry/euclidean.h
include/geometry/polynomial.h
include/geometry/polynomial.hpp
include/geometry/simulator.h
include/geometry/simulator.hpp
include/topology/filtration.hpp
include/topology/filtrationcontainer.h
include/topology/filtrationsimplex.h
include/topology/vineyard.h
include/topology/vineyard.hpp
include/utilities/eventqueue.h
tests/geometry/CMakeLists.txt
tests/geometry/Makefile
tests/geometry/polynomial.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.issues/8aa25bcae639fc99	Fri Apr 04 21:14:44 2008 -0400
@@ -0,0 +1,29 @@
+From artemis Fri Apr  4 15:18:37 2008
+From: Dmitriy Morozov <morozov@cs.duke.edu>
+Date: Fri, 04 Apr 2008 11:18:00
+State: fixed
+Subject: Switch in the pairing in Case 1.2
+Message-Id: <8aa25bcae639fc99-0-artemis@moscow>
+
+If simplex i is unpaired in Case 1.2, while i+1 is paired with l, and R[i,l]=1
+there is a switch in the pairing in Case 1.2.
+
+From artemis Fri Apr  4 20:17:02 2008
+From: Dmitriy Morozov <morozov@cs.duke.edu>
+Date: Fri, 04 Apr 2008 16:16:41
+Subject: Handled but mislabeled
+Message-Id: <8aa25bcae639fc99-bbca170318887f06-artemis@moscow>
+References: <8aa25bcae639fc99-0-artemis@moscow>
+In-Reply-To: <8aa25bcae639fc99-0-artemis@moscow>
+
+The situation is already handled in the code, but was mislabeled as Case 1.1.2
+
+From artemis Fri Apr  4 20:17:10 2008
+From: Dmitriy Morozov <morozov@cs.duke.edu>
+Date: Fri, 04 Apr 2008 16:17:10
+Subject: properties changes (state)
+Message-Id: <8aa25bcae639fc99-a4a82c4ab8c0f536-artemis@moscow>
+References: <8aa25bcae639fc99-0-artemis@moscow>
+In-Reply-To: <8aa25bcae639fc99-0-artemis@moscow>
+
+state=fixed
--- a/CMakeLists.txt	Wed Mar 19 13:50:51 2008 -0400
+++ b/CMakeLists.txt	Fri Apr 04 21:14:44 2008 -0400
@@ -5,6 +5,7 @@
 option						(debug				"Build Dionysus with debugging on" 		OFF)
 option						(optimize			"Build Dionysus with optimization"		ON)
 option						(use_dsrpdb			"Build examples that use DSR-PDB"		OFF)
+option						(use_synaps			"Build examples that use SYNAPS"		OFF)
 
 # Find everything that's always required
 find_package				(Boost REQUIRED)
@@ -44,11 +45,13 @@
 														${m_LIBRARY})
 
 # SYNAPS
-add_definitions				(-DBOOST_UBLAS_TYPE_CHECK=0)
-find_library				(synaps_LIBRARY				NAMES synaps)
-set							(synaps_libraries			${synaps_LIBRARY}
+if                          (use_synaps)
+    add_definitions			(-DBOOST_UBLAS_TYPE_CHECK=0)
+    find_library			(synaps_LIBRARY				NAMES synaps)
+    set						(synaps_libraries			${synaps_LIBRARY}
 														${gmp_LIBRARY}
 														${gmpxx_LIBRARY})
+endif                       (use_synaps)
 
 # Debugging
 if							(debug)
--- a/examples/CMakeLists.txt	Wed Mar 19 13:50:51 2008 -0400
+++ b/examples/CMakeLists.txt	Fri Apr 04 21:14:44 2008 -0400
@@ -1,6 +1,10 @@
+find_library                (boost_program_options_LIBRARY      NAME boost_program_options
+                                                                PATHS ${Boost_LIBRARY_DIR})
+
 add_subdirectory			(alphashapes)
 add_subdirectory			(ar-vineyard)
 add_subdirectory			(cech-complex)
 add_subdirectory			(fitness)
 add_subdirectory			(grid)
 add_subdirectory			(triangle)
+add_subdirectory			(poincare)
--- a/examples/ar-vineyard/CMakeLists.txt	Wed Mar 19 13:50:51 2008 -0400
+++ b/examples/ar-vineyard/CMakeLists.txt	Fri Apr 04 21:14:44 2008 -0400
@@ -10,6 +10,6 @@
 foreach 					(t ${targets})
 	add_executable			(${t} ${t}.cpp ${external_sources})
 	target_link_libraries	(${t}   ${libraries} ${cgal_libraries} 
-                                    ${synaps_libraries} ${boost_signals_LIBRARY} 
+                                    ${boost_signals_LIBRARY} 
                                     ${boost_program_options_LIBRARY})
 endforeach 					(t)
--- a/examples/ar-vineyard/ar-vineyard.h	Wed Mar 19 13:50:51 2008 -0400
+++ b/examples/ar-vineyard/ar-vineyard.h	Fri Apr 04 21:14:44 2008 -0400
@@ -85,16 +85,16 @@
         /// @{
         typedef                     ARFunctionKernel                                            FunctionKernel;
         typedef                     FunctionKernel::Function                                    Function;
-        typedef                     Simulator<FunctionKernel>                                   Simulator;
+        typedef                     Simulator<FunctionKernel>                                   SimulatorAR;
         /// @}
 
         /// \name Filtration types
         /// @{    
-        typedef                     ARConeSimplex3D<Simulator>                                  ARConeSimplex3D;
-		typedef						Filtration<ARConeSimplex3D>									Filtration;
-		typedef						Filtration::Simplex										    Simplex;
-		typedef						Filtration::Index											Index;
-		typedef						Filtration::Vineyard										Vineyard;
+        typedef                     ARConeSimplex3D<SimulatorAR>                                ConeSimplex3D;
+		typedef						Filtration<ConeSimplex3D>									FiltrationAR;
+		typedef						FiltrationAR::Simplex										Simplex;
+		typedef						FiltrationAR::Index											Index;
+		typedef						FiltrationAR::Vineyard										Vineyard;
 		typedef						Vineyard::Evaluator											Evaluator;
         /// @}
 		
@@ -103,7 +103,7 @@
         struct 						SimplexTrajectoryExtractor
 		{	Function				operator()(Index i) const									{ return i->max_threshold(); } };
 
-		typedef						KineticSort<Index, SimplexTrajectoryExtractor, Simulator>   SimplexSort;
+		typedef						KineticSort<Index, SimplexTrajectoryExtractor, SimulatorAR> SimplexSort;
 		typedef						SimplexSort::iterator										SimplexSortIterator;
 		
         class                       ThresholdChangeSlot;              // used to notify of change in max threshold
@@ -121,18 +121,18 @@
 		void						compute_pairing();
 		void						compute_vineyard(double max_radius);
 		
-		const Filtration*			filtration() const											{ return filtration_; }
+		const FiltrationAR*			filtration() const											{ return filtration_; }
 		const Vineyard*				vineyard() const											{ return vineyard_; }
 
 	public:
-		void 						swap(Index i, Simulator* simulator);						///< For kinetic sort
+		void 						swap(Index i, SimulatorAR* simulator);						///< For kinetic sort
 	
 	private:
 		void 						add_simplices();
 		void						change_evaluator(Evaluator* eval);
 
 	private:
-		Filtration*				    filtration_;
+		FiltrationAR*				filtration_;
 		Vineyard*					vineyard_;
 		Evaluator*					evaluator_;
 
@@ -164,9 +164,9 @@
 {   
     public:
                                 ThresholdChangeSlot(SimplexSortIterator iter, SimplexSort* sort, 
-                                                    Vineyard* vineyard, Simulator* sort_simulator):
+                                                    Vineyard* vineyard, SimulatorAR* sort_simulator):
                                     iter_(iter), sort_(sort), vineyard_(vineyard), sort_simulator_(sort_simulator)      { iter_->element->new_max_signal().connect(*this); }
-        void                    operator()(Simulator* simulator)                                
+        void                    operator()(SimulatorAR* simulator)                                
         { 
             Count(cARVineyardTrajectoryKnee); 
             sort_->update_trajectory(iter_, sort_simulator_); 
@@ -182,7 +182,7 @@
         Vineyard*               vineyard_;          // currently inefficient since there is
                                                     // only one SimplexSort and one Vineyard, 
                                                     // but each is stored in every slot
-        Simulator*              sort_simulator_;
+        SimulatorAR*              sort_simulator_;
 };
 
 class ARVineyard::StaticEvaluator: public Evaluator
@@ -197,8 +197,8 @@
 class ARVineyard::KineticEvaluator: public Evaluator
 {
 	public:
-									KineticEvaluator(Simulator* simplex_sort_simulator,
-                                                     Simulator* trajectory_sort_simulator): 
+									KineticEvaluator(SimulatorAR* simplex_sort_simulator,
+                                                     SimulatorAR* trajectory_sort_simulator): 
                                         simplex_sort_simulator_(simplex_sort_simulator),
                                         trajectory_sort_simulator_(trajectory_sort_simulator)   {}
 
@@ -206,8 +206,8 @@
 		virtual RealType			value(const Simplex& s)	const								{ return FunctionKernel::value_at(s.max_threshold(), time()); }
 
 	private:
-		Simulator*                  simplex_sort_simulator_;
-        Simulator*                  trajectory_sort_simulator_;
+		SimulatorAR*                simplex_sort_simulator_;
+        SimulatorAR*                trajectory_sort_simulator_;
 };
 
 
--- a/examples/ar-vineyard/ar-vineyard.hpp	Wed Mar 19 13:50:51 2008 -0400
+++ b/examples/ar-vineyard/ar-vineyard.hpp	Fri Apr 04 21:14:44 2008 -0400
@@ -58,11 +58,11 @@
 	evaluator_ = new StaticEvaluator;
 	vineyard_ = new Vineyard(evaluator_);
 
-	filtration_ = new Filtration(vineyard_);
+	filtration_ = new FiltrationAR(vineyard_);
 	for (ARSimplex3DVector::const_iterator cur = alpha_ordering.begin(); cur != alpha_ordering.end(); ++cur)
 	{
-		filtration_->append(ARConeSimplex3D(*cur));         // Delaunay simplex
-		filtration_->append(ARConeSimplex3D(*cur, true));   // Coned off delaunay simplex
+		filtration_->append(ConeSimplex3D(*cur));         // Delaunay simplex
+		filtration_->append(ConeSimplex3D(*cur, true));   // Coned off delaunay simplex
 	}
 }
 
@@ -90,7 +90,7 @@
 {
 	AssertMsg(filtration_->is_paired(), "Simplices must be paired for a vineyard to be computed");
 	
-	Simulator simplex_sort_simulator, trajectory_sort_simulator;
+	SimulatorAR simplex_sort_simulator, trajectory_sort_simulator;
 	SimplexSort	simplex_sort;
 	
 	// Schedule thresholds
@@ -133,7 +133,7 @@
 		
 void 					
 ARVineyard::
-swap(Index i, Simulator* simulator)
+swap(Index i, SimulatorAR* simulator)
 {
     rLog(rlARVineyardSwap, "Transposing %p and %p:", &(*i), &(*boost::next(i)));
     rLog(rlARVineyardSwap, "  %s and", tostring(*i).c_str());
--- a/examples/fitness/CMakeLists.txt	Wed Mar 19 13:50:51 2008 -0400
+++ b/examples/fitness/CMakeLists.txt	Fri Apr 04 21:14:44 2008 -0400
@@ -2,9 +2,6 @@
 							 avida-distance
                              avida-landscape)
 	
-find_library                (boost_program_options_LIBRARY      NAME boost_program_options
-                                                                PATHS ${Boost_LIBRARY_DIR})
-
 foreach 					(t ${targets})
 	add_executable			(${t} ${t}.cpp)
 	target_link_libraries	(${t} ${libraries} ${boost_program_options_LIBRARY})
--- a/examples/grid/grid2D.h	Wed Mar 19 13:50:51 2008 -0400
+++ b/examples/grid/grid2D.h	Fri Apr 04 21:14:44 2008 -0400
@@ -11,6 +11,7 @@
 #include <map>
 #include <set>
 #include <limits>
+#include <iostream>
 //#include <cmath>
 
 #include <boost/serialization/access.hpp>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/poincare/CMakeLists.txt	Fri Apr 04 21:14:44 2008 -0400
@@ -0,0 +1,7 @@
+set							(targets						
+							 poincare)
+							 
+foreach 					(t ${targets})
+	add_executable			(${t} ${t}.cpp)
+	target_link_libraries	(${t} ${libraries} ${boost_program_options_LIBRARY})
+endforeach 					(t ${targets})
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/poincare/poincare-filtration.txt	Fri Apr 04 21:14:44 2008 -0400
@@ -0,0 +1,392 @@
+9
+2
+2 9
+4
+4 9
+2 4
+2 4 9
+1
+1 9
+1 4
+1 4 9
+1 2
+1 2 9
+1 2 4
+1 2 4 9
+15
+2 15
+4 15
+2 4 15
+1 15
+1 4 15
+1 2 15
+1 2 4 15
+14
+2 14
+6
+6 14
+2 6
+2 6 14
+1 14
+1 6
+1 6 14
+1 2 14
+1 2 6
+1 2 6 14
+6 15
+2 6 15
+1 6 15
+1 2 6 15
+9 14
+2 9 14
+1 9 14
+1 2 9 14
+12
+3
+3 12
+4 12
+3 4
+3 4 12
+1 12
+1 4 12
+1 3
+1 3 12
+1 3 4
+1 3 4 12
+3 15
+3 4 15
+1 3 15
+1 3 4 15
+10
+3 10
+7
+7 10
+3 7
+3 7 10
+1 10
+1 7
+1 7 10
+1 3 10
+1 3 7
+1 3 7 10
+7 12
+3 7 12
+1 7 12
+1 3 7 12
+10 15
+3 10 15
+1 10 15
+1 3 10 15
+9 12
+4 9 12
+1 9 12
+1 4 9 12
+13
+5
+5 13
+6 13
+5 6
+5 6 13
+1 13
+1 6 13
+1 5
+1 5 13
+1 5 6
+1 5 6 13
+5 14
+5 6 14
+1 5 14
+1 5 6 14
+11
+5 11
+8
+8 11
+5 8
+5 8 11
+1 11
+1 8
+1 8 11
+1 5 11
+1 5 8
+1 5 8 11
+8 13
+5 8 13
+1 8 13
+1 5 8 13
+11 14
+5 11 14
+1 11 14
+1 5 11 14
+13 15
+6 13 15
+1 13 15
+1 6 13 15
+8 10
+7 8
+7 8 10
+1 8 10
+1 7 8
+1 7 8 10
+7 11
+7 8 11
+1 7 11
+1 7 8 11
+11 12
+7 11 12
+1 11 12
+1 7 11 12
+10 13
+8 10 13
+1 10 13
+1 8 10 13
+9 11
+9 11 12
+1 9 11
+1 9 11 12
+9 11 14
+1 9 11 14
+10 13 15
+1 10 13 15
+5 10
+3 5
+3 5 10
+2 10
+2 5
+2 5 10
+2 3
+2 3 10
+2 3 5
+2 3 5 10
+3 11
+3 5 11
+2 11
+2 5 11
+2 3 11
+2 3 5 11
+2 7
+2 7 10
+2 3 7
+2 3 7 10
+3 13
+7 13
+3 7 13
+2 13
+2 7 13
+2 3 13
+2 3 7 13
+11 13
+3 11 13
+2 11 13
+2 3 11 13
+4 13
+9 13
+4 9 13
+2 9 13
+2 4 13
+2 4 9 13
+4 11
+4 11 13
+2 4 11
+2 4 11 13
+11 15
+4 11 15
+2 11 15
+2 4 11 15
+2 8
+2 8 11
+2 5 8
+2 5 8 11
+5 12
+8 12
+5 8 12
+2 12
+2 8 12
+2 5 12
+2 5 8 12
+10 12
+5 10 12
+2 10 12
+2 5 10 12
+6 12
+6 10
+6 10 12
+2 6 12
+2 6 10
+2 6 10 12
+10 14
+6 10 14
+2 10 14
+2 6 10 14
+12 15
+6 12 15
+2 12 15
+2 6 12 15
+7 9
+7 9 13
+2 7 9
+2 7 9 13
+7 14
+7 9 14
+2 7 14
+2 7 9 14
+7 10 14
+2 7 10 14
+8 15
+8 11 15
+2 8 15
+2 8 11 15
+8 12 15
+2 8 12 15
+4 14
+4 5
+4 5 14
+3 14
+3 5 14
+3 4 14
+3 4 5
+3 4 5 14
+5 15
+4 5 15
+3 5 15
+3 4 5 15
+12 14
+4 12 14
+3 12 14
+3 4 12 14
+5 10 15
+3 5 10 15
+3 11 14
+3 5 11 14
+12 13
+7 12 13
+3 12 13
+3 7 12 13
+13 14
+11 13 14
+3 13 14
+3 11 13 14
+12 13 14
+3 12 13 14
+5 7
+6 7
+5 6 7
+4 7
+4 6
+4 6 7
+4 5 7
+4 5 6
+4 5 6 7
+4 6 14
+4 5 6 14
+7 15
+5 7 15
+4 7 15
+4 5 7 15
+6 11
+6 7 11
+4 7 11
+4 6 11
+4 6 7 11
+10 11
+6 10 11
+4 10
+4 10 11
+4 6 10
+4 6 10 11
+4 10 14
+4 6 10 14
+7 11 15
+4 7 11 15
+8 9
+8 9 12
+4 8
+4 8 12
+4 8 9
+4 8 9 12
+8 9 13
+4 8 13
+4 8 9 13
+4 10 13
+4 8 10
+4 8 10 13
+8 14
+8 10 14
+4 8 14
+4 8 10 14
+8 12 14
+4 8 12 14
+10 11 13
+4 10 11 13
+6 7 13
+5 7 13
+5 6 7 13
+5 9
+5 9 13
+5 7 9
+5 7 9 13
+9 15
+7 9 15
+5 9 15
+5 7 9 15
+5 9 12
+5 8 9
+5 8 9 12
+5 8 9 13
+9 10
+9 10 12
+5 9 10
+5 9 10 12
+9 10 15
+5 9 10 15
+6 11 12
+6 7 12
+6 7 11 12
+6 12 13
+6 7 12 13
+10 11 12
+6 10 11 12
+12 13 15
+6 12 13 15
+7 8 14
+7 8 10 14
+7 8 15
+7 8 11 15
+14 15
+8 14 15
+7 14 15
+7 8 14 15
+9 14 15
+7 9 14 15
+12 14 15
+8 12 14 15
+9 10 11
+9 10 11 12
+16
+10 16
+11 16
+10 11 16
+9 16
+9 11 16
+9 10 16
+9 10 11 16
+15 16
+10 15 16
+9 15 16
+9 10 15 16
+14 16
+11 14 16
+9 14 16
+9 11 14 16
+14 15 16
+9 14 15 16
+13 16
+11 13 16
+10 13 16
+10 11 13 16
+13 15 16
+10 13 15 16
+13 14 16
+11 13 14 16
+13 14 15
+12 13 14 15
+13 14 15 16
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/poincare/poincare.cpp	Fri Apr 04 21:14:44 2008 -0400
@@ -0,0 +1,80 @@
+#include "topology/filtration.h"
+#include "topology/simplex.h"
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <boost/program_options.hpp>
+
+typedef 		SimplexWithValue<int> 			Simplex;
+typedef			Filtration<Simplex>				SimplexFiltration;
+
+namespace po = boost::program_options;
+
+int main(int argc, char** argv)
+{
+    std::string infilename;
+
+    // Parse program options
+    po::options_description hidden("Hidden options");
+    hidden.add_options()
+        ("input-file",  po::value<std::string>(&infilename),
+                        "Filtration filename");
+
+    po::options_description visible("Allowed options");
+    visible.add_options()
+        ("help,h",      "produce help message");
+    po::positional_options_description p;
+    p.add("input-file", 1);
+    
+    po::options_description all; all.add(visible).add(hidden);
+
+    po::variables_map vm;
+    po::store(po::command_line_parser(argc, argv).
+                  options(all).positional(p).run(), vm);
+    po::notify(vm);
+
+    if (vm.count("help") || !vm.count("input-file"))
+    { 
+        std::cout << "Usage: " << argv[0] << " [options] FILENAME" << std::endl;
+        std::cout << visible << std::endl; 
+        return 1; 
+    }
+
+
+	Evaluator<Simplex> e;
+	SimplexFiltration::Vineyard v(&e);
+	SimplexFiltration f(&v);
+
+    std::ifstream in(infilename.c_str());
+    unsigned int i = 0;
+    std::string s;
+    std::getline(in, s);
+    while(in)
+    {
+        std::istringstream linestream(s);
+        Simplex simplex(float(i++));
+        unsigned int vertex;
+        linestream >> vertex;
+        while(linestream)
+        {
+            simplex.add(vertex);
+            linestream >> vertex;
+        }
+        std::cout << simplex << std::endl;
+        f.append(simplex);
+        std::getline(in, s);
+    }
+	
+    f.fill_simplex_index_map();
+	f.pair_simplices();
+	v.start_vines(f.begin(), f.end());
+	
+	std::cout << "Filtration size: " << f.size() << std::endl;
+    for (SimplexFiltration::Index cur = f.begin(); cur != f.end(); ++cur)
+        if (cur->sign()) 
+            std::cout << cur->dimension() << " " 
+                      << cur->get_value() << " " 
+                      << cur->pair()->get_value() << std::endl;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/poincare/poincare.dat	Fri Apr 04 21:14:44 2008 -0400
@@ -0,0 +1,99 @@
+# 16 vertex triangulation of Poincare sphere
+# made by Bjo"rner and Lutz,
+# in "Simplicial manifolds, bistellar flips and a 16-vertex
+#     triangulation of the Poincar\'e homology 3-sphere",
+#     to appear in Experimental Mathematics.
+# This example has f = (1, 16, 106, 180, 90).
+#
+# Found on Masahiro Hachimori's page at
+# http://infoshako.sk.tsukuba.ac.jp/~hachi/math/library/poincare_eng.html
+1 2 4 9
+1 2 4 15
+1 2 6 14
+1 2 6 15
+1 2 9 14
+1 3 4 12
+1 3 4 15
+1 3 7 10
+1 3 7 12
+1 3 10 15
+1 4 9 12
+1 5 6 13
+1 5 6 14
+1 5 8 11
+1 5 8 13
+1 5 11 14
+1 6 13 15
+1 7 8 10
+1 7 8 11
+1 7 11 12
+1 8 10 13
+1 9 11 12
+1 9 11 14
+1 10 13 15
+2 3 5 10
+2 3 5 11
+2 3 7 10
+2 3 7 13
+2 3 11 13
+2 4 9 13
+2 4 11 13
+2 4 11 15
+2 5 8 11
+2 5 8 12
+2 5 10 12
+2 6 10 12
+2 6 10 14
+2 6 12 15
+2 7 9 13
+2 7 9 14
+2 7 10 14
+2 8 11 15
+2 8 12 15
+3 4 5 14
+3 4 5 15
+3 4 12 14
+3 5 10 15
+3 5 11 14
+3 7 12 13
+3 11 13 14
+3 12 13 14
+4 5 6 7
+4 5 6 14
+4 5 7 15
+4 6 7 11
+4 6 10 11
+4 6 10 14
+4 7 11 15
+4 8 9 12
+4 8 9 13
+4 8 10 13
+4 8 10 14
+4 8 12 14
+4 10 11 13
+5 6 7 13
+5 7 9 13
+5 7 9 15
+5 8 9 12
+5 8 9 13
+5 9 10 12
+5 9 10 15
+6 7 11 12
+6 7 12 13
+6 10 11 12
+6 12 13 15
+7 8 10 14
+7 8 11 15
+7 8 14 15
+7 9 14 15
+8 12 14 15
+9 10 11 12
+9 10 11 16
+9 10 15 16
+9 11 14 16
+9 14 15 16
+10 11 13 16
+10 13 15 16
+11 13 14 16
+12 13 14 15
+13 14 15 16
--- a/examples/triangle/triangle.cpp	Wed Mar 19 13:50:51 2008 -0400
+++ b/examples/triangle/triangle.cpp	Fri Apr 04 21:14:44 2008 -0400
@@ -33,7 +33,7 @@
 
 	stdoutLog.subscribeTo(RLOG_CHANNEL("topology/filtration"));
 	//stdoutLog.subscribeTo(RLOG_CHANNEL("topology/cycle"));
-	stdoutLog.subscribeTo(RLOG_CHANNEL("topology/vineyard"));
+	//stdoutLog.subscribeTo(RLOG_CHANNEL("topology/vineyard"));
 #endif
 
 	Evaluator<Simplex> e;
@@ -49,6 +49,12 @@
 	std::cout << tf << std::endl;
 
 #if 1
+	Simplex A;  A.add(0);
+	std::cout << A << std::endl;
+	std::cout << *tf.get_index(A) << std::endl;
+    std::cout << "Transposing A: " << tf.transpose(tf.get_index(A)) << std::endl;
+	std::cout << tf;
+
 	Simplex BC; BC.add(1); BC.add(2);
 	Simplex AB; AB.add(0); AB.add(1);
 	std::cout << BC << std::endl;
--- a/include/geometry/euclidean.h	Wed Mar 19 13:50:51 2008 -0400
+++ b/include/geometry/euclidean.h	Fri Apr 04 21:14:44 2008 -0400
@@ -24,9 +24,9 @@
 	public:
 		typedef 					unsigned int								DimensionType;
 		typedef						NumberType_									NumberType;
-		typedef						LinearAlgebra<NumberType>					LinearAlgebra;
-		typedef						typename LinearAlgebra::MatrixType			MatrixType;
-		typedef						typename LinearAlgebra::VectorType			VectorType;
+		typedef						LinearAlgebra<NumberType>					LinearAlgebraK;
+		typedef						typename LinearAlgebraK::MatrixType			MatrixType;
+		typedef						typename LinearAlgebraK::VectorType			VectorType;
 
 		class						Point;
 		class						Sphere;
--- a/include/geometry/polynomial.h	Wed Mar 19 13:50:51 2008 -0400
+++ b/include/geometry/polynomial.h	Fri Apr 04 21:14:44 2008 -0400
@@ -21,18 +21,18 @@
 {
 	public:
 		typedef						typename SynapsTraits<T>::Polynomial				Polynomial;
-		typedef						RationalFunction<Polynomial>						RationalFunction;
-        typedef                     RationalFunction                                    Function;
+		typedef						RationalFunction<Polynomial>						RationalFunctionP;
+        typedef                     RationalFunctionP                                   Function;
 
 		typedef						typename SynapsTraits<T>::Solver					Solver;
 		typedef						typename SynapsTraits<T>::RootType					RootType;
 		typedef						std::stack<RootType>								RootStack;
 
-		static void					solve(const RationalFunction& rf, RootStack& stack);
+		static void					solve(const RationalFunctionP& rf, RootStack& stack);
 		static RootType				root(const T& r)									{ return SynapsTraits<T>::root(r); }
-		static int					sign_at(const RationalFunction& rf, const RootType& r);
+		static int					sign_at(const RationalFunctionP& rf, const RootType& r);
 		static RootType				between(const RootType& r1, const RootType& r2)		{ return SynapsTraits<T>::between(r1,r2); }
-		static int					sign_at_negative_infinity(const RationalFunction& rf);
+		static int					sign_at_negative_infinity(const RationalFunctionP& rf);
 };
 
 template<class T>
--- a/include/geometry/polynomial.hpp	Wed Mar 19 13:50:51 2008 -0400
+++ b/include/geometry/polynomial.hpp	Fri Apr 04 21:14:44 2008 -0400
@@ -3,7 +3,7 @@
 template<class T>
 void
 UPolynomial<T>::
-solve(const RationalFunction& rf, RootStack& stack)
+solve(const RationalFunctionP& rf, RootStack& stack)
 {
 	typedef SYNAPS::Seq<RootType>		RootSeq;
 
@@ -32,7 +32,7 @@
 template<class T>
 int
 UPolynomial<T>::
-sign_at(const RationalFunction& rf, const RootType& r)
+sign_at(const RationalFunctionP& rf, const RootType& r)
 {
 	return SynapsTraits<T>::sign_at(rf.numerator(), r) * SynapsTraits<T>::sign_at(rf.denominator(), r);
 }
@@ -40,7 +40,7 @@
 template<class T>
 int
 UPolynomial<T>::
-sign_at_negative_infinity(const RationalFunction& rf)
+sign_at_negative_infinity(const RationalFunctionP& rf)
 {
 	const Polynomial& num = rf.numerator();
 	const Polynomial& den = rf.denominator();
--- a/include/geometry/simulator.h	Wed Mar 19 13:50:51 2008 -0400
+++ b/include/geometry/simulator.h	Fri Apr 04 21:14:44 2008 -0400
@@ -27,9 +27,9 @@
 		class Event;
 		typedef						EventComparison_<Event>						EventComparison;
 		typedef						EventQueue<Event*, IndirectComparison<EventComparison> >			
-																				EventQueue;
-		typedef						typename EventQueue::iterator				Key;
-		typedef						typename EventQueue::const_iterator			const_Key;
+																				EventQueueS;
+		typedef						typename EventQueueS::iterator				Key;
+		typedef						typename EventQueueS::const_iterator		const_Key;
 
 
 									Simulator(Time start = FunctionKernel::root(0)):
@@ -60,7 +60,7 @@
 
 	private:
 		Time						current_;
-		EventQueue					queue_;
+		EventQueueS					queue_;
 };
 
 
--- a/include/geometry/simulator.hpp	Wed Mar 19 13:50:51 2008 -0400
+++ b/include/geometry/simulator.hpp	Fri Apr 04 21:14:44 2008 -0400
@@ -88,7 +88,7 @@
 	current_ = e->root_stack().top(); e->root_stack().pop();
 	
     // Get the top element out of the queue, put it back depending on what process() says
-    EventQueue tmp; tmp.prepend(top, queue_);
+    EventQueueS tmp; tmp.prepend(top, queue_);
 
 	if (e->process(this))				{ queue_.prepend(top, tmp); update(top); }
 	else								{ delete e; }
--- a/include/topology/filtration.hpp	Wed Mar 19 13:50:51 2008 -0400
+++ b/include/topology/filtration.hpp	Fri Apr 04 21:14:44 2008 -0400
@@ -25,6 +25,7 @@
 static Counter*  cFiltrationTransposition = 		GetCounter("filtration/transposition");
 static Counter*  cFiltrationTranspositionDiffDim = 	GetCounter("filtration/transposition/diffdim");
 static Counter*  cFiltrationTranspositionCase12 = 	GetCounter("filtration/transposition/case/1/2");
+static Counter*  cFiltrationTranspositionCase12s = 	GetCounter("filtration/transposition/case/1/2/special");
 static Counter*  cFiltrationTranspositionCase112 = 	GetCounter("filtration/transposition/case/1/1/2");
 static Counter*  cFiltrationTranspositionCase111 = 	GetCounter("filtration/transposition/case/1/1/1");
 static Counter*  cFiltrationTranspositionCase22 = 	GetCounter("filtration/transposition/case/2/2");
@@ -259,12 +260,12 @@
 				return false;
 			} else
 			{
-				// Case 1.1.2 --- special version (plain swap, but pairing switches)
+				// Case 1.2 --- special version (plain swap, but pairing switches)
 				swap(i_prev, i);
 				pairing_switch(i_prev, i);
-				rLog(rlFiltrationTranspositions, "Case 1.1.2 --- unpaired");
+				rLog(rlFiltrationTranspositions, "Case 1.2 --- unpaired (pairing switch)");
 				rLog(rlFiltrationTranspositions, tostring(*i_prev).c_str());
-				Count(cFiltrationTranspositionCase112);
+				Count(cFiltrationTranspositionCase12s);
 				return true;
 			}
 		}
--- a/include/topology/filtrationcontainer.h	Wed Mar 19 13:50:51 2008 -0400
+++ b/include/topology/filtrationcontainer.h	Fri Apr 04 21:14:44 2008 -0400
@@ -21,21 +21,21 @@
 {
 	public:
 		typedef		FltrSmplx														FiltrationSimplex;
-		typedef		ConsistencyList<FiltrationSimplex>								ConsistencyList;
+		typedef		ConsistencyList<FiltrationSimplex>								ConsistencyLst;
 		
 		/// \name Cycles and Trails 
 		/// @{
 		/// Index is and therfore acts like an iterator. The name is preserved for historical reasons.
-		typedef		typename ConsistencyList::iterator								Index;
+		typedef		typename ConsistencyLst::iterator								Index;
 		/// const_Index is a const_iterator
-		typedef		typename ConsistencyList::const_iterator						const_Index;
+		typedef		typename ConsistencyLst::const_iterator						    const_Index;
 		/// @}
 
 		/// \name Cycles and Trails 
 		/// @{
-		typedef		typename ConsistencyList::GreaterThanComparison					CyclesComparator;
-		typedef		typename ConsistencyList::LessThanComparison					TrailsComparator;
-		typedef		typename ConsistencyList::ConsistencyComparison 				ConsistencyComparator;
+		typedef		typename ConsistencyLst::GreaterThanComparison					CyclesComparator;
+		typedef		typename ConsistencyLst::LessThanComparison					    TrailsComparator;
+		typedef		typename ConsistencyLst::ConsistencyComparison 				    ConsistencyComparator;
 		typedef		::Cycle<Index, CyclesComparator, ConsistencyComparator>			Cycle;
 		typedef		::Cycle<Index, TrailsComparator, ConsistencyComparator>			Trail;
 		/// @}
--- a/include/topology/filtrationsimplex.h	Wed Mar 19 13:50:51 2008 -0400
+++ b/include/topology/filtrationsimplex.h	Fri Apr 04 21:14:44 2008 -0400
@@ -51,12 +51,12 @@
 		typedef		FiltrationContainer<Self>								Container;
 		typedef		Simplex													Parent;
 		
-		typedef		Vine<Simplex>											Vine;
+		typedef		Vine<Simplex>											VineS;
 		typedef		typename Container::Cycle								Cycle;
 		typedef		typename Container::Trail								Trail;
 		typedef		typename Container::Index								Index;
 
-		typedef		Evaluator<Simplex>										Evaluator;
+		typedef		Evaluator<Simplex>										EvaluatorS;
 		
 		FiltrationSimplex(const Simplex& s): 
 			Simplex(s), vine_(0)											{}
@@ -67,7 +67,7 @@
 		void					set_pair(Index pair)						{ pair_ = pair; }
 		bool					sign() const								{ return cycles_column.empty(); }
 		bool					is_paired() const							{ return pair() != pair()->pair(); }
-		void					set_vine(Vine* v)							{ vine_ = v; }
+		void					set_vine(VineS* v)							{ vine_ = v; }
 		using 					Parent::dimension;
 		/// @}
 
@@ -79,14 +79,14 @@
 		const Cycle&			cycle()	const								{ return cycles_column; }
 		const Trail&			trail()	const								{ return trails_row; }
 		Index					pair() const								{ return pair_; }
-		Vine*					vine() const								{ return vine_; }
+		VineS*					vine() const								{ return vine_; }
 		/// @}
 
 	private:
 		Cycle																cycles_column;
 		Trail																trails_row; 
 		Index																pair_;
-		Vine*																vine_;
+		VineS*																vine_;
 };
 
 #endif // __FILTRATIONSIMPLEX_H__
--- a/include/topology/vineyard.h	Wed Mar 19 13:50:51 2008 -0400
+++ b/include/topology/vineyard.h	Fri Apr 04 21:14:44 2008 -0400
@@ -32,15 +32,15 @@
 	public:
 		typedef							FltrSmplx									FiltrationSimplex;
 		typedef							typename FiltrationSimplex::Simplex			Simplex;
-		typedef							Vine<Simplex>								Vine;
-		typedef							Knee<Simplex>								Knee;
-		typedef							std::list<Vine>								VineList;
+		typedef							Vine<Simplex>								VineS;
+		typedef							Knee<Simplex>								KneeS;
+		typedef							std::list<VineS>						    VineList;
 		typedef							std::list<VineList>						    VineListList;
         typedef                         std::vector<typename VineListList::iterator> VineListVector;
 		typedef							typename FiltrationSimplex::Cycle			Cycle;
 
 		typedef							typename FiltrationSimplex::Index			Index;
-		typedef							typename FiltrationSimplex::Evaluator		Evaluator;
+		typedef							typename FiltrationSimplex::EvaluatorS		Evaluator;
 										
 	public:
 										Vineyard(Evaluator* eval = 0): 
@@ -56,7 +56,7 @@
 		void							save_edges(const std::string& filename) const;
 
 	protected:
-		typename Knee::SimplexList  	resolve_cycle(Index i) const;
+		typename KneeS::SimplexList  	resolve_cycle(Index i) const;
 
 	private:
 		void							start_vine(Index i);
@@ -118,8 +118,8 @@
 {	
 	public:
 		typedef					S												Simplex;
-		typedef					Knee<Simplex>									Knee;
-		typedef					std::list<Knee>							        VineRepresentation;
+		typedef					Knee<Simplex>									KneeS;
+		typedef					std::list<KneeS>								VineRepresentation;
 		typedef					typename VineRepresentation::const_iterator		const_knee_iterator;
 		
 								Vine()											{}
@@ -127,10 +127,10 @@
                                     VineRepresentation(other)	                {}
 								Vine(const VineRepresentation& other): 
                                     VineRepresentation(other)	                {}
-								Vine(const Knee& k)								{ add(k); }
+								Vine(const KneeS& k)						    { add(k); }
 		
-		void 					add(RealType b, RealType d, RealType t)			{ push_back(Knee(b,d,t)); }
-		void 					add(const Knee& k)								{ push_back(k); }
+		void 					add(RealType b, RealType d, RealType t)			{ push_back(KneeS(b,d,t)); }
+		void 					add(const KneeS& k)								{ push_back(k); }
 
         std::ostream&           operator<<(std::ostream& out) const             { for (const_knee_iterator cur = begin(); cur != end(); ++cur) out << *cur; return out; }
 
--- a/include/topology/vineyard.hpp	Wed Mar 19 13:50:51 2008 -0400
+++ b/include/topology/vineyard.hpp	Fri Apr 04 21:14:44 2008 -0400
@@ -37,8 +37,8 @@
 Vineyard<FS>::
 switched(Index i, Index j)
 {
-	Vine* i_vine = i->vine();
-	Vine* j_vine = j->vine();
+	VineS* i_vine = i->vine();
+	VineS* j_vine = j->vine();
 	i->set_vine(j_vine);
 	j->set_vine(i_vine);
 
@@ -61,7 +61,7 @@
 	AssertMsg(i->sign(), "Can only start vines for positive simplices");
 		
 	Dimension dim = i->dimension();
-	vines_vector[dim]->push_back(Vine());
+	vines_vector[dim]->push_back(VineS());
 	i->set_vine(&vines_vector[dim]->back());
 	i->pair()->set_vine(i->vine());
 }
@@ -95,7 +95,7 @@
 		std::string fn = filename + os.str() + ".edg";
 		std::ofstream out(fn.c_str());
 		for (typename VineList::const_iterator vi = vines_vector[i]->begin(); vi != vines_vector[i]->end(); ++vi)
-			for (typename Vine::const_iterator ki = vi->begin(), kiprev = ki++; ki != vi->end(); kiprev = ki++)
+			for (typename VineS::const_iterator ki = vi->begin(), kiprev = ki++; ki != vi->end(); kiprev = ki++)
 			{
 				if (kiprev->is_infinite() || ki->is_infinite()) continue;
 				out << kiprev->birth << ' ' << kiprev->death << ' ' << kiprev->time << std::endl;
@@ -121,7 +121,7 @@
 	else
 	{
 		rLog(rlVineyard, "Creating knee");
-		Knee k(evaluator->value(*i), evaluator->value(*(i->pair())), evaluator->time());
+		KneeS k(evaluator->value(*i), evaluator->value(*(i->pair())), evaluator->time());
 		rLog(rlVineyard, "Knee created: %s", tostring(k).c_str());
         rLog(rlVineyard, "Vine: %s", tostring(*(i->vine())).c_str());
 
@@ -149,7 +149,7 @@
 }
 
 template<class FS>
-typename Vineyard<FS>::Knee::SimplexList  
+typename Vineyard<FS>::KneeS::SimplexList  
 Vineyard<FS>::
 resolve_cycle(Index i) const
 {
@@ -157,7 +157,7 @@
 	const Cycle& cycle = i->cycle();
 	
 	// Resolve simplices
-	typename Knee::SimplexList lst;
+	typename KneeS::SimplexList lst;
 	for (typename Cycle::const_iterator cur = cycle.begin(); cur != cycle.end(); ++cur)
 		lst.push_back(**cur);
 
--- a/include/utilities/eventqueue.h	Wed Mar 19 13:50:51 2008 -0400
+++ b/include/utilities/eventqueue.h	Fri Apr 04 21:14:44 2008 -0400
@@ -8,6 +8,7 @@
 #include <iostream>
 #include <cassert>					// TODO: switch to internal debugging system
 #include <string>
+#include <algorithm>
 
 // TODO: change inefficient list-based implementation to something heap-based
 // Need a queue that supports deleting arbitrary items (given by iterator), 
--- a/tests/geometry/CMakeLists.txt	Wed Mar 19 13:50:51 2008 -0400
+++ b/tests/geometry/CMakeLists.txt	Fri Apr 04 21:14:44 2008 -0400
@@ -1,9 +1,13 @@
 set							(targets
 							 euclidean
-							 polynomial
-							 test-eventqueue
-							 test-kinetic-sort
-							 test-linalg)
+							 test-eventqueue)
+
+if                          (use_synaps)
+    set                     (targets                    ${targets}
+                                                        polynomial
+                                                        test-kinetic-sort
+							                            test-linalg)
+endif                       (use_synaps)
 
 foreach 					(t ${targets})
 	add_executable			(${t} ${t}.cpp)
--- a/tests/geometry/polynomial.cpp	Wed Mar 19 13:50:51 2008 -0400
+++ b/tests/geometry/polynomial.cpp	Fri Apr 04 21:14:44 2008 -0400
@@ -7,7 +7,7 @@
 
 typedef UPolynomial<ZZ>						PolynomialKernel;
 typedef PolynomialKernel::Polynomial		Polynomial;
-typedef PolynomialKernel::RationalFunction	RationalF;
+typedef PolynomialKernel::Function	        RationalF;
 
 typedef Kernel<RationalF>					K;
 typedef K::Point							Point;