From c74f2fa4d2ff291ad747d38ae5d05dc0f6155b3a Mon Sep 17 00:00:00 2001 From: robertloewe Date: Tue, 9 Jun 2015 12:32:51 +0200 Subject: [PATCH 01/10] problem --- .project | 17 +++++++++++++++++ .pydevproject | 8 ++++++++ 2 files changed, 25 insertions(+) create mode 100644 .project create mode 100644 .pydevproject diff --git a/.project b/.project new file mode 100644 index 0000000..15c30f6 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + 2015-algorithms + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..037bd25 --- /dev/null +++ b/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 2.7 +Default + From 85902f9b50dba84c5dcd3042d24de982c12c4ed6 Mon Sep 17 00:00:00 2001 From: robertloewe Date: Tue, 9 Jun 2015 12:38:35 +0200 Subject: [PATCH 02/10] test --- .pydevproject.bak | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .pydevproject.bak diff --git a/.pydevproject.bak b/.pydevproject.bak new file mode 100644 index 0000000..e72eb2a --- /dev/null +++ b/.pydevproject.bak @@ -0,0 +1,16 @@ +<<<<<<< HEAD + + + +/${PROJECT_DIR_NAME} + +python 2.7 +Default + +======= + + +Default +python 2.7 + +>>>>>>> upstream/master From e56912687c7468e90d9c27e15291ab6364d0c897 Mon Sep 17 00:00:00 2001 From: robertloewe Date: Tue, 9 Jun 2015 12:38:35 +0200 Subject: [PATCH 03/10] test --- .pydevproject.bak | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .pydevproject.bak diff --git a/.pydevproject.bak b/.pydevproject.bak new file mode 100644 index 0000000..e72eb2a --- /dev/null +++ b/.pydevproject.bak @@ -0,0 +1,16 @@ +<<<<<<< HEAD + + + +/${PROJECT_DIR_NAME} + +python 2.7 +Default + +======= + + +Default +python 2.7 + +>>>>>>> upstream/master From a39a3c7521eaa0dacd2e4204838bad582a41254a Mon Sep 17 00:00:00 2001 From: robertloewe Date: Tue, 9 Jun 2015 12:51:56 +0200 Subject: [PATCH 04/10] committed --- coxeter_group_orbits/.DS_Store | Bin 0 -> 6148 bytes coxeter_group_orbits/RobertRaoul/.DS_Store | Bin 0 -> 6148 bytes coxeter_group_orbits/RobertRaoul/main.cpp | 54 +++++++ coxeter_group_orbits/RobertRaoul/orbit.h | 162 +++++++++++++++++++++ 4 files changed, 216 insertions(+) create mode 100644 coxeter_group_orbits/.DS_Store create mode 100644 coxeter_group_orbits/RobertRaoul/.DS_Store create mode 100644 coxeter_group_orbits/RobertRaoul/main.cpp create mode 100644 coxeter_group_orbits/RobertRaoul/orbit.h diff --git a/coxeter_group_orbits/.DS_Store b/coxeter_group_orbits/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..40876e0fbe06105288ab5170c9412e2934f56bb6 GIT binary patch literal 6148 zcmeHK&1%~~5T13MMvgBkO(4+AUIRWjO@ir7b&_Mi#3i9L#g&l23qorwxh5Ec&Ut`5 zK>pt&wC~VI=`Az6TT|oqR!T85V&z}%PJ?<7^G0NNF@S_>2IEkF!35)(u|Gn1f%nzeem5h7-#(~a?P-V&R zm(ueymBo78)}t)W&%1WMGZh#8p1;`{CSS0$6K2V&%2lLNRa|&AdV2oWWU{~ewjp=k zG^Y(YX|y-d%eB??)bxCdU<_wdw2iv`1IB8i69zCURjvgZ!?b_W`G%B z29}5ccj$TbC0Y|Ng&AN5{tg3lK1fu;z+q|8935y(3xHU~uo3jBm!KNyFmPB}#5X9y zmLl3x;aUt~%P}rpUf{5_Xv;yk=0mtI3)i6t^L3nGnsg9>MYhZUGceD(p9{LY6Rnw9K^t3 TX%QnR{3Bp!V8aajQwE*^JPTjh literal 0 HcmV?d00001 diff --git a/coxeter_group_orbits/RobertRaoul/.DS_Store b/coxeter_group_orbits/RobertRaoul/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 +#include +#include +#include "orbit.h" + +using namespace std; + +string printVector(VectorType v){ + std::string output; + for(int i = 0; i < v.size(); i++){ + std::ostringstream os; + os << v[i]; + std::string str = os.str(); + output.append(str); + output.append(" "); + } + return output; +} + +int main(){ + + + VectorType v = {1, 5, 9, 13, 17}; + GeneratorList B2 = createMatrixB(5); + for (int i = 0; i < B2.size(); i++){ + cout << printVector(B2[i]) << endl; + } + cout << B2.size() << endl; + Orbit solution = orbit(B2, v); + cout << "size: " << solution.size() << endl; + for(auto s : solution){ + cout << printVector(s) << endl; + } + + /* + VectorType normal = { 16, -1, -0.5}; + VectorType v = {1, 2, 3}; + VectorType vector = reflection(normal, v); + cout << printVector(vector) << endl; + cout << printVector(reflection(normal, vector)) << endl; + + */ + return 0; +} + + diff --git a/coxeter_group_orbits/RobertRaoul/orbit.h b/coxeter_group_orbits/RobertRaoul/orbit.h new file mode 100644 index 0000000..d964360 --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/orbit.h @@ -0,0 +1,162 @@ +// +// orbit.h +// Coxeter_Orbit +// +// Created by Robert Loewe on 07.06.15. +// Copyright (c) 2015 Robert Loewe. All rights reserved. +// +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + -------------------------------------------------------------------------------- + */ + + +#ifndef Coxeter_Orbit_orbit_h +#define Coxeter_Orbit_orbit_h + + +#include +#include +#include + +class NotImplementedException : public std::exception {}; + +template +class coxeterVector : public std::vector{ + //using std::vector::std::vector; +}; + + +typedef double NumberType; +typedef std::vector VectorType; +typedef std::vector GeneratorList; +typedef std::set Orbit; + + +std::set orbitSet; + + +VectorType vectorAddition(VectorType v1, VectorType v2){ + VectorType v = VectorType(v1.size()); + for(int i = 0; i < v1.size(); i++){ + v[i] = v1[i] + v2[i]; + } + return v; +} + +VectorType scalarMultiplication(double a, VectorType v1){ + VectorType v = VectorType(v1.size()); + for(int i = 0; i < v1.size(); i++){ + v[i] = a*v1[i]; + } + return v; +} + +double scalarProduct(VectorType v1, VectorType v2){ + double sum = 0; + for(int i = 0; i < v1.size(); i++){ + sum += v1[i]*v2[i]; + } + return sum; +} + +VectorType reflection(VectorType normal, VectorType vector){ + VectorType reflected = VectorType(vector.size()); + double rs = (-2)*scalarProduct(vector, normal)/scalarProduct(normal, normal); + reflected = vectorAddition(vector, scalarMultiplication(rs,normal)); + return reflected; +} + +GeneratorList createMatrixB(int dim){ + GeneratorList Matrix; + for (int i = 0; i < dim-1; i++){ + std::vector normal = VectorType(dim); + normal[i] = 1; + normal[i+1]= -1; + Matrix.push_back(normal); + } + std::vector normal = VectorType(dim); + normal[dim-1] = 1; + Matrix.push_back(normal); + return Matrix; +} + +GeneratorList createMatrixA(int dim){ + GeneratorList Matrix; + for (int i = 0; i < dim; i++){ + std::vector normal = VectorType(dim+1); + normal[i] = 1; + normal[i+1]= -1; + Matrix.push_back(normal); + } + return Matrix; +} + +GeneratorList createMatrixEsix(){ + GeneratorList Matrix = { + {1,-1,0,0,0,0}, + {0,1,-1,0,0,0}, + {0,0,1,-1,0,0}, + {0,0,0,1,1,0}, + {-.5,-.5,-.5,-.5,-.5,sqrt(3)/2}, + {0,0,0,1,-1,0}, + }; + return Matrix; +} + + + +GeneratorList simple_roots(char type, int dim) +{ + switch(type) { + case 'B': + return createMatrixB(dim); + case 'A': + return createMatrixA(dim); + + default: + throw new NotImplementedException(); + } +} + +void recursion(const GeneratorList& generators, VectorType v){ + for(int i = 0; i < generators.size(); i++){ + if (orbitSet.find(reflection(generators[i], v)) == orbitSet.end()) { //orbitSet contains reflection(generators[i], v) + orbitSet.insert(reflection(generators[i], v)); + recursion(generators, reflection(generators[i], v)); + } + } +} + +Orbit orbit(const GeneratorList& generators, const VectorType& v) +{ + orbitSet.clear(); + orbitSet.insert(v); + recursion(generators,v); + return orbitSet; +} + + +#endif // __ORBIT_H_ + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: + + + + + From c337f336ba59a760d1cad8379d68096d285fd8f8 Mon Sep 17 00:00:00 2001 From: robertloewe Date: Tue, 9 Jun 2015 12:53:17 +0200 Subject: [PATCH 05/10] wert --- .DS_Store | Bin 0 -> 6148 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5419ab93eed77b96f70d7e39e4852b9b167613af GIT binary patch literal 6148 zcmeHK%}OId5U!4KccPbBRzcWHUxggvPsnvP>QM+}QAC&Qj5C;qFdZ@zqlCbmeSm!c zb${MtS>M4&@n%(b8x-}p3z4d!>Z|^#p6RckdkO$Va~Q7y_yFLc5|%1xUJx25eI_N> zBM?z>jT{mfKnG6HvdjVll)EK31`TJJyT|#{FoZtlQe!S7P&k%FqpTnGbc8W?QNO3M zyjHsvrMdF_yZ2sYVUZsH!@}2gSC86xm=CjNI5;#d6(^DNTVdXP@V{u?oBCn2r;<^} zU)s`X9;!4MJPJM9S81$AO+8HG?5J(m+gEYk?fA>BL2`~QS)&vnl^3lT7 z-b_7qm;q*h8JJlH+!5z3&g>5O!+2~&C!9zlmLij>^6cv)e;mV z9R>~yi#UQJY$&1)6|Te(HXQq~_fEjqo zz?^ORbpP+XUjIK0;ubT&47@1@M0vZt-NY@qyY<=T=&qHh-%v?tUSV+>f{wY0aV}lO cE2u`WUy_3uI4mq;4+{SX7#i3x1OJtQdn$Wl@c;k- literal 0 HcmV?d00001 From 7912c18173a10c499e4fa2d6a4ea8550d98a3028 Mon Sep 17 00:00:00 2001 From: robertloewe Date: Wed, 10 Jun 2015 16:12:33 +0200 Subject: [PATCH 06/10] committed --- coxeter_group_orbits/RobertRaoul/main.cpp | 4 +- coxeter_group_orbits/RobertRaoul/orbit.h | 69 +++++++++++----- coxeter_group_orbits/RobertRaoul/types.h | 55 +++++++++++++ coxeter_group_orbits/test_orbits.cc | 98 ----------------------- 4 files changed, 107 insertions(+), 119 deletions(-) create mode 100644 coxeter_group_orbits/RobertRaoul/types.h delete mode 100644 coxeter_group_orbits/test_orbits.cc diff --git a/coxeter_group_orbits/RobertRaoul/main.cpp b/coxeter_group_orbits/RobertRaoul/main.cpp index 414e80c..92d509a 100644 --- a/coxeter_group_orbits/RobertRaoul/main.cpp +++ b/coxeter_group_orbits/RobertRaoul/main.cpp @@ -28,8 +28,8 @@ string printVector(VectorType v){ int main(){ - VectorType v = {1, 5, 9, 13, 17}; - GeneratorList B2 = createMatrixB(5); + VectorType v = {0., 0.5, 0., 0., 0., 0.5}; + GeneratorList B2 = createMatrixA(5); for (int i = 0; i < B2.size(); i++){ cout << printVector(B2[i]) << endl; } diff --git a/coxeter_group_orbits/RobertRaoul/orbit.h b/coxeter_group_orbits/RobertRaoul/orbit.h index d964360..d28ce9c 100644 --- a/coxeter_group_orbits/RobertRaoul/orbit.h +++ b/coxeter_group_orbits/RobertRaoul/orbit.h @@ -32,14 +32,41 @@ class NotImplementedException : public std::exception {}; -template + +typedef double E; + +const static E epsilon = 0.001; + class coxeterVector : public std::vector{ - //using std::vector::std::vector; + +public: + + coxeterVector(){} + + explicit coxeterVector(int dim): std::vector(dim){} + + template + coxeterVector(std::initializer_list init) + : std::vector(init) {} + + + bool operator==(const coxeterVector& rhs) const { + E sum =0; + coxeterVector a(*this); + for (int i =0; i < rhs.size(); i++) { + a[i] -= rhs[i]; + sum += a[i]*a[i]; + } + return (sum < epsilon); + + } + + }; typedef double NumberType; -typedef std::vector VectorType; +typedef coxeterVector VectorType; typedef std::vector GeneratorList; typedef std::set Orbit; @@ -81,13 +108,13 @@ VectorType reflection(VectorType normal, VectorType vector){ GeneratorList createMatrixB(int dim){ GeneratorList Matrix; for (int i = 0; i < dim-1; i++){ - std::vector normal = VectorType(dim); - normal[i] = 1; - normal[i+1]= -1; + VectorType normal (dim); + normal[i] = 1.; + normal[i+1]= -1.; Matrix.push_back(normal); } - std::vector normal = VectorType(dim); - normal[dim-1] = 1; + VectorType normal (dim); + normal[dim-1] = 1.; Matrix.push_back(normal); return Matrix; } @@ -95,9 +122,9 @@ GeneratorList createMatrixB(int dim){ GeneratorList createMatrixA(int dim){ GeneratorList Matrix; for (int i = 0; i < dim; i++){ - std::vector normal = VectorType(dim+1); - normal[i] = 1; - normal[i+1]= -1; + VectorType normal (dim+1); + normal[i] = 1.; + normal[i+1]= -1.; Matrix.push_back(normal); } return Matrix; @@ -105,12 +132,12 @@ GeneratorList createMatrixA(int dim){ GeneratorList createMatrixEsix(){ GeneratorList Matrix = { - {1,-1,0,0,0,0}, - {0,1,-1,0,0,0}, - {0,0,1,-1,0,0}, - {0,0,0,1,1,0}, + {1.,-1.,0.,0.,0.,0.}, + {0.,1.,-1.,0.,0.,0.}, + {0.,0.,1.,-1.,0.,0.}, + {0.,0.,0.,1.,1.,0.}, {-.5,-.5,-.5,-.5,-.5,sqrt(3)/2}, - {0,0,0,1,-1,0}, + {0.,0.,0.,1.,-1.,0.}, }; return Matrix; } @@ -130,11 +157,15 @@ GeneratorList simple_roots(char type, int dim) } } -void recursion(const GeneratorList& generators, VectorType v){ +void recursion(const GeneratorList& generators, VectorType v, int counter){ for(int i = 0; i < generators.size(); i++){ + std:: cout << i << std::endl; if (orbitSet.find(reflection(generators[i], v)) == orbitSet.end()) { //orbitSet contains reflection(generators[i], v) orbitSet.insert(reflection(generators[i], v)); - recursion(generators, reflection(generators[i], v)); + + counter += 1; + std::cout << "counter " << counter << std::endl; + recursion(generators, reflection(generators[i], v), counter); } } } @@ -143,7 +174,7 @@ Orbit orbit(const GeneratorList& generators, const VectorType& v) { orbitSet.clear(); orbitSet.insert(v); - recursion(generators,v); + recursion(generators,v,0); return orbitSet; } diff --git a/coxeter_group_orbits/RobertRaoul/types.h b/coxeter_group_orbits/RobertRaoul/types.h new file mode 100644 index 0000000..665360a --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/types.h @@ -0,0 +1,55 @@ +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +-------------------------------------------------------------------------------- +*/ + +#ifndef __TYPES_H_ +#define __TYPES_H_ + +#include +#include + +class NotImplementedException : public std::exception {}; +class InvalidGroupException : public std::exception {}; + +typedef long double NumberType; // this might work +typedef std::vector VectorType; +typedef std::set Orbit; + +class GeneratorList : public std::vector { +public: + GeneratorList(int r, int c) + : std::vector(r) + { + for (int i=0; i - -#include "orbit.h" -#include "stl_wrappers.h" - -BOOST_AUTO_TEST_CASE( generators ) -{ - std::ostringstream oss; - oss << simple_roots_type_A(4) << std::endl - << simple_roots_type_B(4) << std::endl - << simple_roots_type_C(4) << std::endl - << simple_roots_type_D(4) << std::endl - << simple_roots_type_E6() << std::endl - << simple_roots_type_E7() << std::endl - << simple_roots_type_E8() << std::endl - << simple_roots_type_F4() << std::endl - << simple_roots_type_H3() << std::endl - << simple_roots_type_H4() << std::endl; - - BOOST_CHECK_EQUAL(oss.str(), - "{{1,-1,0,0,0},{0,1,-1,0,0},{0,0,1,-1,0},{0,0,0,1,-1}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,1}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,2}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,1,1}}\n" - "{{1,-1,0,0,0,0},{0,1,-1,0,0,0},{0,0,1,-1,0,0},{0,0,0,1,-1,0},{0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,0.866025}}\n" - "{{1,-1,0,0,0,0,0},{0,1,-1,0,0,0,0},{0,0,1,-1,0,0,0},{0,0,0,1,-1,0,0},{0,0,0,0,1,-1,0},{0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.707107}}\n" - "{{1,-1,0,0,0,0,0,0},{0,1,-1,0,0,0,0,0},{0,0,1,-1,0,0,0,0},{0,0,0,1,-1,0,0,0},{0,0,0,0,1,-1,0,0},{0,0,0,0,0,1,-1,0},{0,0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,0},{-0.5,-0.5,-0.5,-0.5}}\n" - "{{2,0,0},{-1.61803,0.618034,-1},{0,0,2}}\n" - "{{1.30902,-0.309017,-0.309017,-0.309017},{-1,1,0,0},{0,-1,1,0},{0,0,-1,1}}\n" - ); -} - -struct b3_fixture { - b3_fixture() - : generators(simple_roots('B', 3)) - {} - GeneratorList generators; -}; - -BOOST_FIXTURE_TEST_CASE( b3_orbit_012, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 3}).size(), (size_t) 48); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_12, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 3}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_02, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 2}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_01, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 0}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_0, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 0, 0}).size(), (size_t) 6); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_1, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 0}).size(), (size_t) 12); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_2, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 1}).size(), (size_t) 8); -} - - -// Local Variables: -// mode:C++ -// c-basic-offset:3 -// indent-tabs-mode:nil -// End: From 10384b0a6455f566b22f1e3eca4d22d41cb784ec Mon Sep 17 00:00:00 2001 From: robertloewe Date: Thu, 11 Jun 2015 11:06:13 +0200 Subject: [PATCH 07/10] committed11 --- .../Coxeter_Orbit.xcodeproj/project.pbxproj | 242 +++++++++++ .../contents.xcworkspacedata | 7 + .../UserInterfaceState.xcuserstate | Bin 0 -> 4079 bytes .../xcschemes/Coxeter_Orbit.xcscheme | 43 ++ .../Coxeter_Orbit/Coxeter_Orbit/generators.h | 378 ++++++++++++++++++ .../Coxeter_Orbit/Coxeter_Orbit/main.cpp | 54 +++ .../Coxeter_Orbit/Coxeter_Orbit/orbit.h | 193 +++++++++ .../Coxeter_Orbit/stl_wrappers.h | 83 ++++ .../Coxeter_Orbit/test_orbits.cc | 98 +++++ .../Coxeter_Orbit/Coxeter_Orbit/types.h | 55 +++ .../coxeter_test.xcodeproj/project.pbxproj | 67 ++++ .../contents.xcworkspacedata | 7 + .../UserInterfaceState.xcuserstate | Bin 0 -> 4079 bytes .../RobertRaoul/coxeter_test/generators.h | 378 ++++++++++++++++++ .../RobertRaoul/coxeter_test/main.cpp | 54 +++ .../RobertRaoul/coxeter_test/orbit.h | 193 +++++++++ .../RobertRaoul/coxeter_test/stl_wrappers.h | 83 ++++ .../RobertRaoul/coxeter_test/test_orbits.cc | 98 +++++ .../RobertRaoul/coxeter_test/types.h | 55 +++ coxeter_group_orbits/test_orbits.cc | 98 +++++ 20 files changed, 2186 insertions(+) create mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.pbxproj create mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/xcuserdata/robertloewe.xcuserdatad/xcschemes/Coxeter_Orbit.xcscheme create mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/generators.h create mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/main.cpp create mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/orbit.h create mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/stl_wrappers.h create mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/test_orbits.cc create mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/types.h create mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/coxeter_test.xcodeproj/project.pbxproj create mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/coxeter_test.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/coxeter_test.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/generators.h create mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/main.cpp create mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/orbit.h create mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/stl_wrappers.h create mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/test_orbits.cc create mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/types.h create mode 100644 coxeter_group_orbits/test_orbits.cc diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.pbxproj b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c72ebde --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.pbxproj @@ -0,0 +1,242 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 8527E7481B29804600EE0C42 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8527E7471B29804600EE0C42 /* main.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 8527E7421B29804600EE0C42 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 8527E7441B29804600EE0C42 /* Coxeter_Orbit */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Coxeter_Orbit; sourceTree = BUILT_PRODUCTS_DIR; }; + 8527E7471B29804600EE0C42 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8527E7411B29804600EE0C42 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 8527E73B1B29804600EE0C42 = { + isa = PBXGroup; + children = ( + 8527E7461B29804600EE0C42 /* Coxeter_Orbit */, + 8527E7451B29804600EE0C42 /* Products */, + ); + sourceTree = ""; + }; + 8527E7451B29804600EE0C42 /* Products */ = { + isa = PBXGroup; + children = ( + 8527E7441B29804600EE0C42 /* Coxeter_Orbit */, + ); + name = Products; + sourceTree = ""; + }; + 8527E7461B29804600EE0C42 /* Coxeter_Orbit */ = { + isa = PBXGroup; + children = ( + 8527E7471B29804600EE0C42 /* main.cpp */, + ); + path = Coxeter_Orbit; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 8527E7431B29804600EE0C42 /* Coxeter_Orbit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8527E74B1B29804600EE0C42 /* Build configuration list for PBXNativeTarget "Coxeter_Orbit" */; + buildPhases = ( + 8527E7401B29804600EE0C42 /* Sources */, + 8527E7411B29804600EE0C42 /* Frameworks */, + 8527E7421B29804600EE0C42 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Coxeter_Orbit; + productName = Coxeter_Orbit; + productReference = 8527E7441B29804600EE0C42 /* Coxeter_Orbit */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 8527E73C1B29804600EE0C42 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0630; + ORGANIZATIONNAME = "Robert Loewe"; + TargetAttributes = { + 8527E7431B29804600EE0C42 = { + CreatedOnToolsVersion = 6.3.1; + }; + }; + }; + buildConfigurationList = 8527E73F1B29804600EE0C42 /* Build configuration list for PBXProject "Coxeter_Orbit" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 8527E73B1B29804600EE0C42; + productRefGroup = 8527E7451B29804600EE0C42 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8527E7431B29804600EE0C42 /* Coxeter_Orbit */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8527E7401B29804600EE0C42 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8527E7481B29804600EE0C42 /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 8527E7491B29804600EE0C42 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 8527E74A1B29804600EE0C42 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 8527E74C1B29804600EE0C42 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 8527E74D1B29804600EE0C42 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 8527E73F1B29804600EE0C42 /* Build configuration list for PBXProject "Coxeter_Orbit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8527E7491B29804600EE0C42 /* Debug */, + 8527E74A1B29804600EE0C42 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8527E74B1B29804600EE0C42 /* Build configuration list for PBXNativeTarget "Coxeter_Orbit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8527E74C1B29804600EE0C42 /* Debug */, + 8527E74D1B29804600EE0C42 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 8527E73C1B29804600EE0C42 /* Project object */; +} diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..e7e05ca --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..e5b0281f1e5ab9ddefecb289c2dbdd6966dc8e39 GIT binary patch literal 4079 zcma)9d3aRS6+b6$e{Y0gNk~{sU_uZ{;$%-)gsc)sLXt^B5|&|-c}X4&GsAl?#1PR- zYuzns-K~;^N{Wc6RRj@ftwl-^K|n=ot#xZFU#osvm)5WM&C3Kv{lnz@=Dj=j+_V0E z=bmW`2Q);l+6Yhcs;URb!cEB(kfal;KJP(K9x9~f70e%lJ!U;GD zufi!f4S$7q;cxIBybmA2Kj7c+3497)!vBy%9>?HVoPbGqF{a@xyae5th1ob4%dirw zu?`!t1=nE!*JBVv7{(2#<3`-nm>TR31YQLRWKh5XV`2RA8c*grwby8+&yj>QrM3rr zhA{{i!59)pm_cyDIKmPyN%lHZ3*GMA!ZLSxMs|L7Sw?P2eqlyQPDyzNT@@9$%k#=} z%JRI(!tcHJkt!L)s3Q1c{IYlVJ)>g=vH%JQ0XUBq9@K z2P8uZOs5_sLMqH84ssD$O?}}>0x2S{)s}WG=nwT&=)U!;*LnGc<{Er$rJlc{)dyGeod!y3KLBuil=jD}Ds(B{)CjV8^| z+5$A9#PfT;wvw2wguXs^dP;uo=Jb@ltn5PiUXYcud2=+oZYZ>}n+4gB1G$g~`A|T{ zkg>!`#*y)40-3l2ifC5n!F*Uip9@Jm&FUnQN@mfgo4CBrgkr;>^zjAFa=&JVbfe1G z8|pT_PAB!s(-rEe@om&PeRRj`%&;7dRyrnSjiwgR%-&*M^?4{A%_dFlu~m#7xAwl1 z*ccUMs-blTe?WufgsopwjaAeI+fhr>2~so_OQ9Ol2B3;04nPe_vO*hI*3>ZSO{J-> zH%>;#P!ElR;DH7*nWT^zQ3cDP6~+%jGqjK?Wa=QSfR$t#xtJucqG~QIwv(={_^N%K zLCx&;tF^90oBF}}I|=RJ2NgP6ZC(W_Vw>$()mT~MDbpxOLP4M2J4mHEn`=DFB8@5P zg9d@`_z0=wW* z*bR@t9(bH&k!+Gfa!DS^Ck3Q%7-mvZ7195_@C@vO{j^~vP>RKqxnvosCCyeQofdw} z)VA)sn>U}*;zCgE1qnaGM zI|5WsdninEl@hZVIUdq!+KhHx3tRn-w!9dTi1vowuxf+!1Ng9?l-v9<;qQYMtD+J7 z6V6$<{+L`b0G78_kD=Fs5eldkTEJ9wD-BMJihl;5kJ8`^vLs4_udMd-HGD&slIrsm z_!cn+u7{DKm8i0S-Sf_cz(xV(7|EB=K`T}hk-RNN(uw0Bt-qhRMm)lam=N^{Cy}}l zk8m>e2&dpwQcoI3J;G$1aiJY_VJh*E29n%D%WT8bwMbhNV{ta7$DGN)OwvS_TcjHs z0r7bnxE8HE6ghheb1)b4K*4-0z(OqYI>+mwkZB{!LTXKf1(Q0}pw?~JmaW@Zz0$OI z62rQ-o;KC*ZIM<2q=l?HgY$4cHLw6L$A#2LK9;~ISOANg=`uRtm?4zINigrtH z(6sPCvE(0_W{M+IqXo!VimeFgT9j_oQY%?WAl6nnwN?U)En8#-6`=wVoZ%AqZ~zOb zb2iqn2A6rAvuKWf_=1g1#vs;0=Z_bUpc(7Y<8``zgoQzDu(baeQ9G6<8Ve-SiLE>e zv{r1Rg9)y{mADF5qZikpkE|g+(ni{epQxl`2c)7Oim(GaX$P1|dEZGH)kQSg2k6*G z+hPgra_hn&Eod5%*~&+6BTD{}u4mWULtC9{RD|@#`YOuoNp`=}f}QrPRibv$>BSmd z#zqHIdxOd*)~oHbcDA1A?ueS=aJYh&-lz;#Ye8*PDRnAlJ;MEH&<2_|-R!LNK;r;h zL?_u9_PP%m`^gOIN{wf!+N=6)P^tO}yaq{QBoc!3he#64pg%wIU@k1g1e}Vq>A*i9 zOK~wS!74iNd+5l&9IwW^a1bBIC-EuVi~I0dd=8(-m+=)miKp-kzK&<{Eqoi##bw6T z$8CulihDlpY}{uIFk_i<%mgN$nZzV9Q*%b|G8E*0CP8k!@vHva8uOY>?f;{)D}m zy_4O>4zo|O``H)RSJ>0+YwR2B+w42+yX<@HIra;V;~d;XZW@=v&E>A(mT*~A zh6g^5XL+6<%TMK}^DcfSe<`2NXYy{ol&|7j__ch15AtDN=S_YieS65Bwz zTIqJ_Zs}g>ercODAPq^slJ-i6q!ZEyGRRZpX>zhWU3SUy<#M@7ZkGGx>*X8eo8?>O zt@5zEQ{E--miNf}{!IQ-nW4;4>XatsD&=R&4a!Z*Ey{h$u(DIxrR-Mr zC{HNAQJz*_R1Pagl%vWq<+yS}c~v>BeC&`ME=QiD*0I*H#qo2;R>y6QI~)%<9&+?M g1|5$$b~$!C4mnR literal 0 HcmV?d00001 diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/xcuserdata/robertloewe.xcuserdatad/xcschemes/Coxeter_Orbit.xcscheme b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/xcuserdata/robertloewe.xcuserdatad/xcschemes/Coxeter_Orbit.xcscheme new file mode 100644 index 0000000..6b19159 --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/xcuserdata/robertloewe.xcuserdatad/xcschemes/Coxeter_Orbit.xcscheme @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/generators.h b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/generators.h new file mode 100644 index 0000000..b45947f --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/generators.h @@ -0,0 +1,378 @@ +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + -------------------------------------------------------------------------------- + */ + +#ifndef __GENERATORS_H_ +#define __GENERATORS_H_ + +#include +#include +#include +#include "types.h" + +GeneratorList simple_roots_type_A (const int n) +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 ... 0 0 + 0 1 -1 0 ... 0 0 + ... + 0 0 0 0 ... 1 -1 + In particular, they lie in the plane (sum of coordinates = 0) + */ + GeneratorList R(n, n+1); + for (int i=0; i n-1, + */ + VectorType v(n); + v[n-1] = 1; + GeneratorList G = simple_roots_type_A(n-1); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_C (const int n) +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 ... 0 0 + 0 1 -1 0 ... 0 0 + ... + 0 0 0 0 ... 1 -1 + 0 0 0 0 ... 0 2 + + The Dynkin diagram is: + + 0 ---- 1 ---- ... ---- n-2 <--(4)-- n-1, + */ + VectorType v(n); + v[n-1] = 2; + GeneratorList G = simple_roots_type_A(n-1); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_D (const int n) +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 ... 0 0 + 0 1 -1 0 ... 0 0 + ... + 0 0 0 0 ... 1 -1 + 0 0 0 0 ... 1 1 + The indexing of the Dynkin diagram is + + n-2 + / + 0 - 1 - 2 - ... - n-3 + \ + n-1 + + */ + VectorType v(n); + v[n-2] = v[n-1] = 1; + GeneratorList G = simple_roots_type_A(n-1); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_E6() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 0 0 + 0 1 -1 0 0 0 + 0 0 1 -1 0 0 + 0 0 0 1 -1 0 + 0 0 0 1 1 0 + -1/2(1 1 1 1 1 -sqrt(3)) + + The indexing of the Dynkin diagram is + + + 3 + | + | + 0 ---- 1 ---- 2 ---- 4 ---- 5 + + */ + VectorType v(6); + for (int i=0; i<5; ++i) + v[i] = -0.5; + v[5] = 0.5 * sqrt(3); + GeneratorList G = simple_roots_type_D(5); + for (int i=0; i<5; ++i) + G[i].push_back(0); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_E7() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 0 0 0 + 0 1 -1 0 0 0 0 + 0 0 1 -1 0 0 0 + 0 0 0 1 -1 0 0 + 0 0 0 0 1 -1 0 + 0 0 0 0 1 1 0 + -1/2(1 1 1 1 1 1 -sqrt(2)) + + The indexing of the Dynkin diagram is + + + 4 + | + | + 0 ---- 1 ---- 2 ---- 3 ---- 5 ---- 6 + + */ + VectorType v(7); + for (int i=0; i<6; ++i) + v[i] = -0.5; + v[6] = 0.5 * sqrt(2); + GeneratorList G = simple_roots_type_D(6); + for (int i=0; i<6; ++i) + G[i].push_back(0); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_E8() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 0 0 0 0 + 0 1 -1 0 0 0 0 0 + ... + 0 0 0 0 0 1 -1 0 + 0 0 0 0 0 1 1 0 + -1/2(1 1 1 1 1 1 1 1) + + These are the coordinates in the even coordinate system. + The indexing of the Dynkin diagram is + + + 5 + | + | + 0 ---- 1 ---- 2 ---- 3 ---- 4 ---- 6 ---- 7 + + */ + VectorType v(8); + for (int i=0; i<8; ++i) + v[i] = -0.5; + GeneratorList G = simple_roots_type_D(7); + for (int i=0; i<7; ++i) + G[i].push_back(0); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_F4() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 + 0 1 -1 0 + 0 0 1 0 + -1/2 -1/2 -1/2 -1/2 + + The Dynkin diagram is: + + 0 ---- 1 --(4)--> 2 ---- 3 + */ + GeneratorList R(4,4); + R(0,0) = R(1,1) = R(2,2) = 1; + R(0,1) = R(1,2) = -1; + R(3,0) = R(3,1) = R(3,2) = R(3,3) = -0.5; + return R; +} + +GeneratorList simple_roots_type_G2() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 + -1 2 -1 + + Notice that each row sums to zero. + + The Dynkin diagram is: + + 0 <--(6)-- 1 + */ + GeneratorList R(2,3); + R(0,0) = 1; + R(0,1) = R(1,0) = R(1,2) = -1; + R(1,1) = 2; + return R; +} + +GeneratorList simple_roots_type_H3() +{ + const NumberType tau(0.5 + 0.5 * sqrt(5)); // golden ratio + + /* + For H_3, the Dynkin diagram is + + 0 --(5)-- 1 ---- 2, + + and the simple root vectors are, + + 2 0 0 + a b -1 + 0 0 2 + + with a=-tau and b=1/tau. Notice they all have length 2. + + */ + + GeneratorList R(3,3); + R(0,0) = R(2,2) = 2; + R(1,0) = -tau; R(1,1) = tau - 1; R(1,2) = -1; + return R; +} + +GeneratorList simple_roots_type_H4() +{ + const NumberType tau(0.5 + 0.5 * sqrt(5)); // golden ratio + + /* + For H_4, the Dynkin diagram is + + 0 --(5)-- 1 ---- 2 ---- 3, + + and the simple root vectors are, according to + [John H. Stembridge, A construction of H_4 without miracles, + Discrete Comput. Geom. 22, No.3, 425-427 (1999)], + + a b b b + -1 1 0 0 + 0 -1 1 0 + 0 0 -1 1 + + with a=(1+tau)/2 and b=(1-tau)/2, so that the length of each root is sqrt{2}. + + */ + GeneratorList R(4, 4); + + R(0,0) = (1+tau) * 0.5; + R(0,1) = R(0,2) = R(0,3) = (1-tau) * 0.5; + + for (int i=0; i<3; ++i) { + R(i+1, i) = -1; + R(i+1, i+1) = 1; + } + return R; +} + + + +GeneratorList simple_roots(char type, int dim) +{ + switch(type) { + case 'a': + case 'A': + return simple_roots_type_A(dim); + + case 'b': + case 'B': + return simple_roots_type_B(dim); + + case 'c': + case 'C': + return simple_roots_type_C(dim); + + case 'd': + case 'D': + return simple_roots_type_D(dim); + + case 'e': + case 'E': + switch(dim) { + case 6: + return simple_roots_type_E6(); + case 7: + return simple_roots_type_E7(); + case 8: + return simple_roots_type_E8(); + default: + throw InvalidGroupException(); + } + + case 'f': + case 'F': + switch(dim) { + case 4: + return simple_roots_type_F4(); + default: + throw InvalidGroupException(); + } + + case 'g': + case 'G': + switch(dim) { + case 2: + return simple_roots_type_G2(); + default: + throw InvalidGroupException(); + } + + case 'h': + case 'H': + switch(dim) { + case 3: + return simple_roots_type_H3(); + case 4: + return simple_roots_type_H4(); + default: + throw InvalidGroupException(); + } + + default: + throw NotImplementedException(); + } +} + +#endif // __GENERATORS_H_ + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/main.cpp b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/main.cpp new file mode 100644 index 0000000..82f1147 --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/main.cpp @@ -0,0 +1,54 @@ +// +// main.cpp +// orbit_h +// +// Created by Robert Loewe on 07.06.15. +// Copyright (c) 2015 Robert Loewe. All rights reserved. +// + +#include +#include +#include +#include "orbit.h" + +using namespace std; + +string printVector(VectorType v){ + std::string output; + for(int i = 0; i < v.size(); i++){ + std::ostringstream os; + os << v[i]; + std::string str = os.str(); + output.append(str); + output.append(" "); + } + return output; +} + +int main(){ + + + VectorType v = {0., 0.5, 0., 0., 0., 0.5}; + GeneratorList B2 = createMatrixA(5); + for (int i = 0; i < B2.size(); i++){ + cout << printVector(B2[i]) << endl; + } + cout << B2.size() << endl; + Orbit solution = orbit(B2, v); + cout << "size: " << solution.size() << endl; + for(auto s : solution){ + cout << printVector(s) << endl; + } + + /* + VectorType normal = { 16, -1, -0.5}; + VectorType v = {1, 2, 3}; + VectorType vector = reflection(normal, v); + cout << printVector(vector) << endl; + cout << printVector(reflection(normal, vector)) << endl; + + */ + return 0; +} + + diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/orbit.h b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/orbit.h new file mode 100644 index 0000000..5d2a25a --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/orbit.h @@ -0,0 +1,193 @@ +// +// orbit.h +// Coxeter_Orbit +// +// Created by Robert Loewe on 07.06.15. +// Copyright (c) 2015 Robert Loewe. All rights reserved. +// +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + -------------------------------------------------------------------------------- + */ + + +#ifndef Coxeter_Orbit_orbit_h +#define Coxeter_Orbit_orbit_h + + +#include +#include +#include + +class NotImplementedException : public std::exception {}; + + +typedef double E; + +const static E epsilon = 0.001; + +class coxeterVector : public std::vector{ + +public: + + coxeterVector(){} + + explicit coxeterVector(int dim): std::vector(dim){} + + template + coxeterVector(std::initializer_list init) + : std::vector(init) {} + + + bool operator==(const coxeterVector& rhs) const { + E sum =0; + coxeterVector a(*this); + for (int i =0; i < rhs.size(); i++) { + a[i] -= rhs[i]; + sum += a[i]*a[i]; + } + return (sum < epsilon); + + } + + +}; + + +typedef double NumberType; +typedef coxeterVector VectorType; +typedef std::vector GeneratorList; +typedef std::set Orbit; + + +std::set orbitSet; + + +VectorType vectorAddition(VectorType v1, VectorType v2){ + VectorType v = VectorType(v1.size()); + for(int i = 0; i < v1.size(); i++){ + v[i] = v1[i] + v2[i]; + } + return v; +} + +VectorType scalarMultiplication(double a, VectorType v1){ + VectorType v = VectorType(v1.size()); + for(int i = 0; i < v1.size(); i++){ + v[i] = a*v1[i]; + } + return v; +} + +double scalarProduct(VectorType v1, VectorType v2){ + double sum = 0; + for(int i = 0; i < v1.size(); i++){ + sum += v1[i]*v2[i]; + } + return sum; +} + +VectorType reflection(VectorType normal, VectorType vector){ + VectorType reflected = VectorType(vector.size()); + double rs = (-2)*scalarProduct(vector, normal)/scalarProduct(normal, normal); + reflected = vectorAddition(vector, scalarMultiplication(rs,normal)); + return reflected; +} + +GeneratorList createMatrixB(int dim){ + GeneratorList Matrix; + for (int i = 0; i < dim-1; i++){ + VectorType normal (dim); + normal[i] = 1.; + normal[i+1]= -1.; + Matrix.push_back(normal); + } + VectorType normal (dim); + normal[dim-1] = 1.; + Matrix.push_back(normal); + return Matrix; +} + +GeneratorList createMatrixA(int dim){ + GeneratorList Matrix; + for (int i = 0; i < dim; i++){ + VectorType normal (dim+1); + normal[i] = 1.; + normal[i+1]= -1.; + Matrix.push_back(normal); + } + return Matrix; +} + +GeneratorList createMatrixEsix(){ + GeneratorList Matrix = { + {1.,-1.,0.,0.,0.,0.}, + {0.,1.,-1.,0.,0.,0.}, + {0.,0.,1.,-1.,0.,0.}, + {0.,0.,0.,1.,1.,0.}, + {-.5,-.5,-.5,-.5,-.5,sqrt(3)/2}, + {0.,0.,0.,1.,-1.,0.}, + }; + return Matrix; +} + + + +GeneratorList simple_roots(char type, int dim) +{ + switch(type) { + case 'B': + return createMatrixB(dim); + case 'A': + return createMatrixA(dim); + + default: + throw new NotImplementedException(); + } +} + +void recursion(const GeneratorList& generators, VectorType v, int counter){ + for(int i = 0; i < generators.size(); i++){ + std:: cout << i << std::endl; + if (orbitSet.find(reflection(generators[i], v)) == orbitSet.end()) { //orbitSet contains reflection(generators[i], v) + orbitSet.insert(reflection(generators[i], v)); + + counter += 1; + std::cout << "counter " << counter << std::endl; + recursion(generators, reflection(generators[i], v), counter); + } + } +} + +Orbit orbit(const GeneratorList& generators, const VectorType& v) +{ + orbitSet.clear(); + orbitSet.insert(v); + recursion(generators,v,0); + return orbitSet; +} + + +#endif // __ORBIT_H_ + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: + + + + + diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/stl_wrappers.h b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/stl_wrappers.h new file mode 100644 index 0000000..ad29de5 --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/stl_wrappers.h @@ -0,0 +1,83 @@ +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + -------------------------------------------------------------------------------- + */ + +//#ifndef __STL_WRAPPERS_H__ +//#define __STL_WRAPPERS_H__ + +#include +#include +#include +#include + + +template +inline std::ostream& +operator<<(std::ostream& wrapped, const std::array& item) +{ + wrapped << '{'; + bool first = true; + for (auto const& element : item) { + wrapped << (!first ? "," : "") << element; + first = false; + } + return wrapped << '}'; +} + + +// teach Boost.Test how to print std::vector +template +inline std::ostream& +operator<<(std::ostream& wrapped, std::vector const& item) +{ + wrapped << '{'; + bool first = true; + for (auto const& element : item) { + wrapped << (!first ? "," : "") << element; + first = false; + } + return wrapped << '}'; +} + +template +inline std::ostream& +operator<<(std::ostream& wrapped, std::pair const& item) +{ + return wrapped << '<' << item.first << ',' << item.second << '>'; +} + +template +inline std::ostream& +operator<<(std::ostream& wrapped, std::map const& item) +{ + wrapped << '{'; + bool first = true; + for (auto const& element : item) { + wrapped << (!first ? "," : "") << element; + first = false; + } + return wrapped << '}'; +} + + +//#endif // __STL_WRAPPERS_H__ + + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: + diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/test_orbits.cc b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/test_orbits.cc new file mode 100644 index 0000000..9e4bb22 --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/test_orbits.cc @@ -0,0 +1,98 @@ +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + -------------------------------------------------------------------------------- + */ + +#define BOOST_TEST_MODULE orbits +#include + +#include "orbit.h" +#include "stl_wrappers.h" + +BOOST_AUTO_TEST_CASE( generators ) +{ + std::ostringstream oss; + oss << simple_roots_type_A(4) << std::endl + << simple_roots_type_B(4) << std::endl + << simple_roots_type_C(4) << std::endl + << simple_roots_type_D(4) << std::endl + << simple_roots_type_E6() << std::endl + << simple_roots_type_E7() << std::endl + << simple_roots_type_E8() << std::endl + << simple_roots_type_F4() << std::endl + << simple_roots_type_H3() << std::endl + << simple_roots_type_H4() << std::endl; + + BOOST_CHECK_EQUAL(oss.str(), + "{{1,-1,0,0,0},{0,1,-1,0,0},{0,0,1,-1,0},{0,0,0,1,-1}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,1}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,2}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,1,1}}\n" + "{{1,-1,0,0,0,0},{0,1,-1,0,0,0},{0,0,1,-1,0,0},{0,0,0,1,-1,0},{0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,0.866025}}\n" + "{{1,-1,0,0,0,0,0},{0,1,-1,0,0,0,0},{0,0,1,-1,0,0,0},{0,0,0,1,-1,0,0},{0,0,0,0,1,-1,0},{0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.707107}}\n" + "{{1,-1,0,0,0,0,0,0},{0,1,-1,0,0,0,0,0},{0,0,1,-1,0,0,0,0},{0,0,0,1,-1,0,0,0},{0,0,0,0,1,-1,0,0},{0,0,0,0,0,1,-1,0},{0,0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,0},{-0.5,-0.5,-0.5,-0.5}}\n" + "{{2,0,0},{-1.61803,0.618034,-1},{0,0,2}}\n" + "{{1.30902,-0.309017,-0.309017,-0.309017},{-1,1,0,0},{0,-1,1,0},{0,0,-1,1}}\n" + ); +} + +struct b3_fixture { + b3_fixture() + : generators(simple_roots('B', 3)) + {} + GeneratorList generators; +}; + +BOOST_FIXTURE_TEST_CASE( b3_orbit_012, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 3}).size(), (size_t) 48); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_12, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 3}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_02, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 2}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_01, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 0}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_0, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 0, 0}).size(), (size_t) 6); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_1, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 0}).size(), (size_t) 12); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_2, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 1}).size(), (size_t) 8); +} + + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/types.h b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/types.h new file mode 100644 index 0000000..0b56f98 --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/types.h @@ -0,0 +1,55 @@ +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + -------------------------------------------------------------------------------- + */ + +#ifndef __TYPES_H_ +#define __TYPES_H_ + +#include +#include + +class NotImplementedException : public std::exception {}; +class InvalidGroupException : public std::exception {}; + +typedef long double NumberType; // this might work +typedef std::vector VectorType; +typedef std::set Orbit; + +class GeneratorList : public std::vector { +public: + GeneratorList(int r, int c) + : std::vector(r) + { + for (int i=0; i + + + + diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/coxeter_test.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate b/coxeter_group_orbits/RobertRaoul/coxeter_test/coxeter_test.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..5ee47b7f5371c24ae7a523298fe3451a59af0fa6 GIT binary patch literal 4079 zcma)9d3aRS6+b6$e{Xr^D-f${^88`&0Frd=XaLh zIrmIsIH;MCtgJJDkOT~{zyXizaYJ4DI@K^WJye&jH?CHjBIdGmztPmH(bv`K5j{Kz z@TML6oU1_q5eCB$7zz_$B3uQNU@}Yr7fgj|kPC&d5XzwfDq#^Uh9yu1UZ{q8SPrY8 z6*O24Yaj?Zw8OQ~2^-)BxDjrGJK%2kHEe^OunQi6M`17g5ng~7;VAqGUV@k56?hen z!Q1c-ybEXHJ@^>@0q5bLZ~;Dr&*2NW3|}Lngfb4o!I+GraXe1K$v6e`FdwJm9Gs68 zxCCo(8Lq(~wqXc$4C7ifa2;M(lOBo&gQr0P85D5902s8i(mQpH+F{nyYfnIG)0={R z)9i+R(4Qm`rW>3vkg&u@#`&D-#RcyCd7cuFt0b>*o-41|o$D$r_7u7b3QCIeW_a>E zrMYgOb4XdqyrsIa#ti$L)DpcZ+NOpgao}Mv1~PX;G7N_l7y%<;6pSVu;fX**A`zJ= zyJ0M(!Z>O{3Zz2@agcsw0JTLR!^td?vC`76g#vneso`%^ea><8#Udl18fu^ywc6k4 z(L)hK4+d$*ea<<3O-fkwmE?G)=jWCbyYk(+#jZS0zS~upn_b{4DK5+_EX>X+n2|Nz z=bX}4fen8JpeCfPjjCk<>ZaDLsfN!vmWsQZB9vG^Zj#TLVkwNdQLXF2M!!*J)@r8K z7^EHzzq00UEKXP&*4ddgC3Sk<`YEZM)HZrQBRhBf`Zr=p&4QdRNTGr1{|4kiK1_!h z^>#i(G*Wf;t!mP=yA8wN(M<&k>MFg9Vzm%Y&`c<{5;O~D!__bc=0Xv;iIWT@gUDbq zgbXFac7ul|W*(HnHS}6Wl4)X6NG7?8UUNu>&pFI(nzRD_p~$>|7SRo}+~1)`BR;2- zI_7QF+bjL+v=%>I@i|?VuW_;@WTqyf1+_?r+fe;pTG5eOO>MVT^lrD-zL%Q>6(y>v zwS;~|gJp!RUsKH$)CAj5OVSBaJQOvs6f(P@mW=3vIx^C7ZD2`lb+0vL5w*>XKG!O z9#E&!;4ai6Q+pStdLu@(DH1i*xcN83t-WEsjZ7jLc1V8)zMXI<+yz_6Wa1*zu7vd$ zaBqUYb6_jw<`m1{a8b^FLF>gszt6$*a2Srz zb~c<=PcoTJ7Lz4pnH5Q=Ma>emG1}6i8WxzvPV1e`P}*H$<<^InM;axQKFuPGw>#HlWRyBSwJ%C%GKsr)h?^jT3Taw^>!z) z?Hp=(7O(7HOXD!-;6n@M&+tC{1wJ6f#6wERyj?Vg9{32-Y3!0oDUBbE*~nVIp;?@! zEmUo{f@N0u+iU&7s7k#Wk+|AJRBw|Wrm;#*Sd4Ag4H`DH$!RH(K_sTVx+ARG zB>e<(c98yYn=iq?Ehhhq%=6$DJ4#{}24Pm-t_ig>mA4 zWA&16;X6`JDtk$fNysG-^f(GM_7xVD+dt?_WmK?#g5(Kw(i|;{Np4Ay9D+k3bH@&n z(PI$~#}RRha3rbfu?WXdi*PKa5-+K}Vo@4q_Qk;oIFVG78ZvGfO{`7Gv?6U)0-_7E z682^wKi1+>pEKO*g|VOgI0D6t)Nz-(MqRd zA8mZaw2!R`>slyc#%3!&J#T1v_w+S8w_e)JRI^k!YO2aJ(mx_8FrNPX$cLFQ7l+{}yb7~v z6?o{lzW~eW!0)9a|5Dt5zr=3bj|cD|K7~)?v-lhy#uIoF-@r5Y7QTaL@f^O77n24i zRV8go+L?4X>1@(xNna;@#~{Nn4knpNWhOE%W;)|xs+ek~mZ@XvnFeMhvx?D~wT#I` znRcdw>15V38=0-l!_0fkr|f7pi=D$3v2M1KUBY_VTDFd@XG3f|dp)~>CG2MQF7_Vw zUUn;cKf9gnVt2Cp*%#TP>A1_W#c{V|o8z~R i9gc3t!;VKBdmTp{M;*svX8 +#include +#include +#include "types.h" + +GeneratorList simple_roots_type_A (const int n) +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 ... 0 0 + 0 1 -1 0 ... 0 0 + ... + 0 0 0 0 ... 1 -1 + In particular, they lie in the plane (sum of coordinates = 0) + */ + GeneratorList R(n, n+1); + for (int i=0; i n-1, + */ + VectorType v(n); + v[n-1] = 1; + GeneratorList G = simple_roots_type_A(n-1); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_C (const int n) +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 ... 0 0 + 0 1 -1 0 ... 0 0 + ... + 0 0 0 0 ... 1 -1 + 0 0 0 0 ... 0 2 + + The Dynkin diagram is: + + 0 ---- 1 ---- ... ---- n-2 <--(4)-- n-1, + */ + VectorType v(n); + v[n-1] = 2; + GeneratorList G = simple_roots_type_A(n-1); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_D (const int n) +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 ... 0 0 + 0 1 -1 0 ... 0 0 + ... + 0 0 0 0 ... 1 -1 + 0 0 0 0 ... 1 1 + The indexing of the Dynkin diagram is + + n-2 + / + 0 - 1 - 2 - ... - n-3 + \ + n-1 + + */ + VectorType v(n); + v[n-2] = v[n-1] = 1; + GeneratorList G = simple_roots_type_A(n-1); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_E6() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 0 0 + 0 1 -1 0 0 0 + 0 0 1 -1 0 0 + 0 0 0 1 -1 0 + 0 0 0 1 1 0 +-1/2(1 1 1 1 1 -sqrt(3)) + + The indexing of the Dynkin diagram is + + + 3 + | + | + 0 ---- 1 ---- 2 ---- 4 ---- 5 + + */ + VectorType v(6); + for (int i=0; i<5; ++i) + v[i] = -0.5; + v[5] = 0.5 * sqrt(3); + GeneratorList G = simple_roots_type_D(5); + for (int i=0; i<5; ++i) + G[i].push_back(0); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_E7() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 0 0 0 + 0 1 -1 0 0 0 0 + 0 0 1 -1 0 0 0 + 0 0 0 1 -1 0 0 + 0 0 0 0 1 -1 0 + 0 0 0 0 1 1 0 +-1/2(1 1 1 1 1 1 -sqrt(2)) + + The indexing of the Dynkin diagram is + + + 4 + | + | + 0 ---- 1 ---- 2 ---- 3 ---- 5 ---- 6 + + */ + VectorType v(7); + for (int i=0; i<6; ++i) + v[i] = -0.5; + v[6] = 0.5 * sqrt(2); + GeneratorList G = simple_roots_type_D(6); + for (int i=0; i<6; ++i) + G[i].push_back(0); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_E8() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 0 0 0 0 + 0 1 -1 0 0 0 0 0 + ... + 0 0 0 0 0 1 -1 0 + 0 0 0 0 0 1 1 0 +-1/2(1 1 1 1 1 1 1 1) + + These are the coordinates in the even coordinate system. + The indexing of the Dynkin diagram is + + + 5 + | + | + 0 ---- 1 ---- 2 ---- 3 ---- 4 ---- 6 ---- 7 + + */ + VectorType v(8); + for (int i=0; i<8; ++i) + v[i] = -0.5; + GeneratorList G = simple_roots_type_D(7); + for (int i=0; i<7; ++i) + G[i].push_back(0); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_F4() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 + 0 1 -1 0 + 0 0 1 0 + -1/2 -1/2 -1/2 -1/2 + + The Dynkin diagram is: + + 0 ---- 1 --(4)--> 2 ---- 3 + */ + GeneratorList R(4,4); + R(0,0) = R(1,1) = R(2,2) = 1; + R(0,1) = R(1,2) = -1; + R(3,0) = R(3,1) = R(3,2) = R(3,3) = -0.5; + return R; +} + +GeneratorList simple_roots_type_G2() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 + -1 2 -1 + + Notice that each row sums to zero. + + The Dynkin diagram is: + + 0 <--(6)-- 1 + */ + GeneratorList R(2,3); + R(0,0) = 1; + R(0,1) = R(1,0) = R(1,2) = -1; + R(1,1) = 2; + return R; +} + +GeneratorList simple_roots_type_H3() +{ + const NumberType tau(0.5 + 0.5 * sqrt(5)); // golden ratio + + /* + For H_3, the Dynkin diagram is + + 0 --(5)-- 1 ---- 2, + + and the simple root vectors are, + + 2 0 0 + a b -1 + 0 0 2 + + with a=-tau and b=1/tau. Notice they all have length 2. + + */ + + GeneratorList R(3,3); + R(0,0) = R(2,2) = 2; + R(1,0) = -tau; R(1,1) = tau - 1; R(1,2) = -1; + return R; +} + +GeneratorList simple_roots_type_H4() +{ + const NumberType tau(0.5 + 0.5 * sqrt(5)); // golden ratio + + /* + For H_4, the Dynkin diagram is + + 0 --(5)-- 1 ---- 2 ---- 3, + + and the simple root vectors are, according to + [John H. Stembridge, A construction of H_4 without miracles, + Discrete Comput. Geom. 22, No.3, 425-427 (1999)], + + a b b b + -1 1 0 0 + 0 -1 1 0 + 0 0 -1 1 + + with a=(1+tau)/2 and b=(1-tau)/2, so that the length of each root is sqrt{2}. + + */ + GeneratorList R(4, 4); + + R(0,0) = (1+tau) * 0.5; + R(0,1) = R(0,2) = R(0,3) = (1-tau) * 0.5; + + for (int i=0; i<3; ++i) { + R(i+1, i) = -1; + R(i+1, i+1) = 1; + } + return R; +} + + + +GeneratorList simple_roots(char type, int dim) +{ + switch(type) { + case 'a': + case 'A': + return simple_roots_type_A(dim); + + case 'b': + case 'B': + return simple_roots_type_B(dim); + + case 'c': + case 'C': + return simple_roots_type_C(dim); + + case 'd': + case 'D': + return simple_roots_type_D(dim); + + case 'e': + case 'E': + switch(dim) { + case 6: + return simple_roots_type_E6(); + case 7: + return simple_roots_type_E7(); + case 8: + return simple_roots_type_E8(); + default: + throw InvalidGroupException(); + } + + case 'f': + case 'F': + switch(dim) { + case 4: + return simple_roots_type_F4(); + default: + throw InvalidGroupException(); + } + + case 'g': + case 'G': + switch(dim) { + case 2: + return simple_roots_type_G2(); + default: + throw InvalidGroupException(); + } + + case 'h': + case 'H': + switch(dim) { + case 3: + return simple_roots_type_H3(); + case 4: + return simple_roots_type_H4(); + default: + throw InvalidGroupException(); + } + + default: + throw NotImplementedException(); + } +} + +#endif // __GENERATORS_H_ + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/main.cpp b/coxeter_group_orbits/RobertRaoul/coxeter_test/main.cpp new file mode 100644 index 0000000..92d509a --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/coxeter_test/main.cpp @@ -0,0 +1,54 @@ +// +// main.cpp +// orbit_h +// +// Created by Robert Loewe on 07.06.15. +// Copyright (c) 2015 Robert Loewe. All rights reserved. +// + +#include +#include +#include +#include "orbit.h" + +using namespace std; + +string printVector(VectorType v){ + std::string output; + for(int i = 0; i < v.size(); i++){ + std::ostringstream os; + os << v[i]; + std::string str = os.str(); + output.append(str); + output.append(" "); + } + return output; +} + +int main(){ + + + VectorType v = {0., 0.5, 0., 0., 0., 0.5}; + GeneratorList B2 = createMatrixA(5); + for (int i = 0; i < B2.size(); i++){ + cout << printVector(B2[i]) << endl; + } + cout << B2.size() << endl; + Orbit solution = orbit(B2, v); + cout << "size: " << solution.size() << endl; + for(auto s : solution){ + cout << printVector(s) << endl; + } + + /* + VectorType normal = { 16, -1, -0.5}; + VectorType v = {1, 2, 3}; + VectorType vector = reflection(normal, v); + cout << printVector(vector) << endl; + cout << printVector(reflection(normal, vector)) << endl; + + */ + return 0; +} + + diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/orbit.h b/coxeter_group_orbits/RobertRaoul/coxeter_test/orbit.h new file mode 100644 index 0000000..34ae90b --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/coxeter_test/orbit.h @@ -0,0 +1,193 @@ +// Hallo Raoul +// orbit.h +// Coxeter_Orbit +// +// Created by Robert Loewe on 07.06.15. +// Copyright (c) 2015 Robert Loewe. All rights reserved. +// +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + -------------------------------------------------------------------------------- + */ + + +#ifndef Coxeter_Orbit_orbit_h +#define Coxeter_Orbit_orbit_h + + +#include +#include +#include + +class NotImplementedException : public std::exception {}; + + +typedef double E; + +const static E epsilon = 0.001; + +class coxeterVector : public std::vector{ + +public: + + coxeterVector(){} + + explicit coxeterVector(int dim): std::vector(dim){} + + template + coxeterVector(std::initializer_list init) + : std::vector(init) {} + + + bool operator==(const coxeterVector& rhs) const { + E sum =0; + coxeterVector a(*this); + for (int i =0; i < rhs.size(); i++) { + a[i] -= rhs[i]; + sum += a[i]*a[i]; + } + return (sum < epsilon); + + } + + +}; + + +typedef double NumberType; +typedef coxeterVector VectorType; +typedef std::vector GeneratorList; +typedef std::set Orbit; + + +std::set orbitSet; + + +VectorType vectorAddition(VectorType v1, VectorType v2){ + VectorType v = VectorType(v1.size()); + for(int i = 0; i < v1.size(); i++){ + v[i] = v1[i] + v2[i]; + } + return v; +} + +VectorType scalarMultiplication(double a, VectorType v1){ + VectorType v = VectorType(v1.size()); + for(int i = 0; i < v1.size(); i++){ + v[i] = a*v1[i]; + } + return v; +} + +double scalarProduct(VectorType v1, VectorType v2){ + double sum = 0; + for(int i = 0; i < v1.size(); i++){ + sum += v1[i]*v2[i]; + } + return sum; +} + +VectorType reflection(VectorType normal, VectorType vector){ + VectorType reflected = VectorType(vector.size()); + double rs = (-2)*scalarProduct(vector, normal)/scalarProduct(normal, normal); + reflected = vectorAddition(vector, scalarMultiplication(rs,normal)); + return reflected; +} + +GeneratorList createMatrixB(int dim){ + GeneratorList Matrix; + for (int i = 0; i < dim-1; i++){ + VectorType normal (dim); + normal[i] = 1.; + normal[i+1]= -1.; + Matrix.push_back(normal); + } + VectorType normal (dim); + normal[dim-1] = 1.; + Matrix.push_back(normal); + return Matrix; +} + +GeneratorList createMatrixA(int dim){ + GeneratorList Matrix; + for (int i = 0; i < dim; i++){ + VectorType normal (dim+1); + normal[i] = 1.; + normal[i+1]= -1.; + Matrix.push_back(normal); + } + return Matrix; +} + +GeneratorList createMatrixEsix(){ + GeneratorList Matrix = { + {1.,-1.,0.,0.,0.,0.}, + {0.,1.,-1.,0.,0.,0.}, + {0.,0.,1.,-1.,0.,0.}, + {0.,0.,0.,1.,1.,0.}, + {-.5,-.5,-.5,-.5,-.5,sqrt(3)/2}, + {0.,0.,0.,1.,-1.,0.}, + }; + return Matrix; +} + + + +GeneratorList simple_roots(char type, int dim) +{ + switch(type) { + case 'B': + return createMatrixB(dim); + case 'A': + return createMatrixA(dim); + + default: + throw new NotImplementedException(); + } +} + +void recursion(const GeneratorList& generators, VectorType v, int counter){ + for(int i = 0; i < generators.size(); i++){ + std:: cout << i << std::endl; + if (orbitSet.find(reflection(generators[i], v)) == orbitSet.end()) { //orbitSet contains reflection(generators[i], v) + orbitSet.insert(reflection(generators[i], v)); + + counter += 1; + std::cout << "counter " << counter << std::endl; + recursion(generators, reflection(generators[i], v), counter); + } + } +} + +Orbit orbit(const GeneratorList& generators, const VectorType& v) +{ + orbitSet.clear(); + orbitSet.insert(v); + recursion(generators,v,0); + return orbitSet; +} + + +#endif // __ORBIT_H_ + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: + + + + + diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/stl_wrappers.h b/coxeter_group_orbits/RobertRaoul/coxeter_test/stl_wrappers.h new file mode 100644 index 0000000..581011f --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/coxeter_test/stl_wrappers.h @@ -0,0 +1,83 @@ +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +-------------------------------------------------------------------------------- +*/ + +//#ifndef __STL_WRAPPERS_H__ +//#define __STL_WRAPPERS_H__ + +#include +#include +#include +#include + + +template +inline std::ostream& +operator<<(std::ostream& wrapped, const std::array& item) +{ + wrapped << '{'; + bool first = true; + for (auto const& element : item) { + wrapped << (!first ? "," : "") << element; + first = false; + } + return wrapped << '}'; +} + + +// teach Boost.Test how to print std::vector +template +inline std::ostream& +operator<<(std::ostream& wrapped, std::vector const& item) +{ + wrapped << '{'; + bool first = true; + for (auto const& element : item) { + wrapped << (!first ? "," : "") << element; + first = false; + } + return wrapped << '}'; +} + +template +inline std::ostream& +operator<<(std::ostream& wrapped, std::pair const& item) +{ + return wrapped << '<' << item.first << ',' << item.second << '>'; +} + +template +inline std::ostream& +operator<<(std::ostream& wrapped, std::map const& item) +{ + wrapped << '{'; + bool first = true; + for (auto const& element : item) { + wrapped << (!first ? "," : "") << element; + first = false; + } + return wrapped << '}'; +} + + +//#endif // __STL_WRAPPERS_H__ + + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: + diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/test_orbits.cc b/coxeter_group_orbits/RobertRaoul/coxeter_test/test_orbits.cc new file mode 100644 index 0000000..d061d0c --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/coxeter_test/test_orbits.cc @@ -0,0 +1,98 @@ +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +-------------------------------------------------------------------------------- +*/ + +#define BOOST_TEST_MODULE orbits +#include + +#include "orbit.h" +#include "stl_wrappers.h" + +BOOST_AUTO_TEST_CASE( generators ) +{ + std::ostringstream oss; + oss << simple_roots_type_A(4) << std::endl + << simple_roots_type_B(4) << std::endl + << simple_roots_type_C(4) << std::endl + << simple_roots_type_D(4) << std::endl + << simple_roots_type_E6() << std::endl + << simple_roots_type_E7() << std::endl + << simple_roots_type_E8() << std::endl + << simple_roots_type_F4() << std::endl + << simple_roots_type_H3() << std::endl + << simple_roots_type_H4() << std::endl; + + BOOST_CHECK_EQUAL(oss.str(), + "{{1,-1,0,0,0},{0,1,-1,0,0},{0,0,1,-1,0},{0,0,0,1,-1}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,1}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,2}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,1,1}}\n" + "{{1,-1,0,0,0,0},{0,1,-1,0,0,0},{0,0,1,-1,0,0},{0,0,0,1,-1,0},{0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,0.866025}}\n" + "{{1,-1,0,0,0,0,0},{0,1,-1,0,0,0,0},{0,0,1,-1,0,0,0},{0,0,0,1,-1,0,0},{0,0,0,0,1,-1,0},{0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.707107}}\n" + "{{1,-1,0,0,0,0,0,0},{0,1,-1,0,0,0,0,0},{0,0,1,-1,0,0,0,0},{0,0,0,1,-1,0,0,0},{0,0,0,0,1,-1,0,0},{0,0,0,0,0,1,-1,0},{0,0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,0},{-0.5,-0.5,-0.5,-0.5}}\n" + "{{2,0,0},{-1.61803,0.618034,-1},{0,0,2}}\n" + "{{1.30902,-0.309017,-0.309017,-0.309017},{-1,1,0,0},{0,-1,1,0},{0,0,-1,1}}\n" + ); +} + +struct b3_fixture { + b3_fixture() + : generators(simple_roots('B', 3)) + {} + GeneratorList generators; +}; + +BOOST_FIXTURE_TEST_CASE( b3_orbit_012, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 3}).size(), (size_t) 48); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_12, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 3}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_02, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 2}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_01, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 0}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_0, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 0, 0}).size(), (size_t) 6); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_1, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 0}).size(), (size_t) 12); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_2, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 1}).size(), (size_t) 8); +} + + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/types.h b/coxeter_group_orbits/RobertRaoul/coxeter_test/types.h new file mode 100644 index 0000000..665360a --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/coxeter_test/types.h @@ -0,0 +1,55 @@ +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. +-------------------------------------------------------------------------------- +*/ + +#ifndef __TYPES_H_ +#define __TYPES_H_ + +#include +#include + +class NotImplementedException : public std::exception {}; +class InvalidGroupException : public std::exception {}; + +typedef long double NumberType; // this might work +typedef std::vector VectorType; +typedef std::set Orbit; + +class GeneratorList : public std::vector { +public: + GeneratorList(int r, int c) + : std::vector(r) + { + for (int i=0; i + +#include "orbit.h" +#include "stl_wrappers.h" + +BOOST_AUTO_TEST_CASE( generators ) +{ + std::ostringstream oss; + oss << simple_roots_type_A(4) << std::endl + << simple_roots_type_B(4) << std::endl + << simple_roots_type_C(4) << std::endl + << simple_roots_type_D(4) << std::endl + << simple_roots_type_E6() << std::endl + << simple_roots_type_E7() << std::endl + << simple_roots_type_E8() << std::endl + << simple_roots_type_F4() << std::endl + << simple_roots_type_H3() << std::endl + << simple_roots_type_H4() << std::endl; + + BOOST_CHECK_EQUAL(oss.str(), + "{{1,-1,0,0,0},{0,1,-1,0,0},{0,0,1,-1,0},{0,0,0,1,-1}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,1}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,2}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,1,1}}\n" + "{{1,-1,0,0,0,0},{0,1,-1,0,0,0},{0,0,1,-1,0,0},{0,0,0,1,-1,0},{0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,0.866025}}\n" + "{{1,-1,0,0,0,0,0},{0,1,-1,0,0,0,0},{0,0,1,-1,0,0,0},{0,0,0,1,-1,0,0},{0,0,0,0,1,-1,0},{0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.707107}}\n" + "{{1,-1,0,0,0,0,0,0},{0,1,-1,0,0,0,0,0},{0,0,1,-1,0,0,0,0},{0,0,0,1,-1,0,0,0},{0,0,0,0,1,-1,0,0},{0,0,0,0,0,1,-1,0},{0,0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,0},{-0.5,-0.5,-0.5,-0.5}}\n" + "{{2,0,0},{-1.61803,0.618034,-1},{0,0,2}}\n" + "{{1.30902,-0.309017,-0.309017,-0.309017},{-1,1,0,0},{0,-1,1,0},{0,0,-1,1}}\n" + ); +} + +struct b3_fixture { + b3_fixture() + : generators(simple_roots('B', 3)) + {} + GeneratorList generators; +}; + +BOOST_FIXTURE_TEST_CASE( b3_orbit_012, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 3}).size(), (size_t) 48); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_12, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 3}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_02, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 2}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_01, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 0}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_0, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 0, 0}).size(), (size_t) 6); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_1, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 0}).size(), (size_t) 12); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_2, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 1}).size(), (size_t) 8); +} + + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: From ecb48bdb535617650aeafebae91e973c3711d467 Mon Sep 17 00:00:00 2001 From: robertloewe Date: Thu, 11 Jun 2015 11:21:19 +0200 Subject: [PATCH 08/10] nochmal --- coxeter_group_orbits/RobertRaoul/generators.h | 378 ++++++++++++++++++ coxeter_group_orbits/RobertRaoul/main.cpp | 16 +- coxeter_group_orbits/RobertRaoul/orbit.h | 4 +- .../RobertRaoul/stl_wrappers.h | 83 ++++ .../RobertRaoul/test_orbits.cc | 98 +++++ coxeter_group_orbits/RobertRaoul/types.h | 56 +-- 6 files changed, 597 insertions(+), 38 deletions(-) create mode 100644 coxeter_group_orbits/RobertRaoul/generators.h create mode 100644 coxeter_group_orbits/RobertRaoul/stl_wrappers.h create mode 100644 coxeter_group_orbits/RobertRaoul/test_orbits.cc diff --git a/coxeter_group_orbits/RobertRaoul/generators.h b/coxeter_group_orbits/RobertRaoul/generators.h new file mode 100644 index 0000000..b45947f --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/generators.h @@ -0,0 +1,378 @@ +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + -------------------------------------------------------------------------------- + */ + +#ifndef __GENERATORS_H_ +#define __GENERATORS_H_ + +#include +#include +#include +#include "types.h" + +GeneratorList simple_roots_type_A (const int n) +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 ... 0 0 + 0 1 -1 0 ... 0 0 + ... + 0 0 0 0 ... 1 -1 + In particular, they lie in the plane (sum of coordinates = 0) + */ + GeneratorList R(n, n+1); + for (int i=0; i n-1, + */ + VectorType v(n); + v[n-1] = 1; + GeneratorList G = simple_roots_type_A(n-1); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_C (const int n) +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 ... 0 0 + 0 1 -1 0 ... 0 0 + ... + 0 0 0 0 ... 1 -1 + 0 0 0 0 ... 0 2 + + The Dynkin diagram is: + + 0 ---- 1 ---- ... ---- n-2 <--(4)-- n-1, + */ + VectorType v(n); + v[n-1] = 2; + GeneratorList G = simple_roots_type_A(n-1); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_D (const int n) +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 ... 0 0 + 0 1 -1 0 ... 0 0 + ... + 0 0 0 0 ... 1 -1 + 0 0 0 0 ... 1 1 + The indexing of the Dynkin diagram is + + n-2 + / + 0 - 1 - 2 - ... - n-3 + \ + n-1 + + */ + VectorType v(n); + v[n-2] = v[n-1] = 1; + GeneratorList G = simple_roots_type_A(n-1); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_E6() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 0 0 + 0 1 -1 0 0 0 + 0 0 1 -1 0 0 + 0 0 0 1 -1 0 + 0 0 0 1 1 0 + -1/2(1 1 1 1 1 -sqrt(3)) + + The indexing of the Dynkin diagram is + + + 3 + | + | + 0 ---- 1 ---- 2 ---- 4 ---- 5 + + */ + VectorType v(6); + for (int i=0; i<5; ++i) + v[i] = -0.5; + v[5] = 0.5 * sqrt(3); + GeneratorList G = simple_roots_type_D(5); + for (int i=0; i<5; ++i) + G[i].push_back(0); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_E7() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 0 0 0 + 0 1 -1 0 0 0 0 + 0 0 1 -1 0 0 0 + 0 0 0 1 -1 0 0 + 0 0 0 0 1 -1 0 + 0 0 0 0 1 1 0 + -1/2(1 1 1 1 1 1 -sqrt(2)) + + The indexing of the Dynkin diagram is + + + 4 + | + | + 0 ---- 1 ---- 2 ---- 3 ---- 5 ---- 6 + + */ + VectorType v(7); + for (int i=0; i<6; ++i) + v[i] = -0.5; + v[6] = 0.5 * sqrt(2); + GeneratorList G = simple_roots_type_D(6); + for (int i=0; i<6; ++i) + G[i].push_back(0); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_E8() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 0 0 0 0 + 0 1 -1 0 0 0 0 0 + ... + 0 0 0 0 0 1 -1 0 + 0 0 0 0 0 1 1 0 + -1/2(1 1 1 1 1 1 1 1) + + These are the coordinates in the even coordinate system. + The indexing of the Dynkin diagram is + + + 5 + | + | + 0 ---- 1 ---- 2 ---- 3 ---- 4 ---- 6 ---- 7 + + */ + VectorType v(8); + for (int i=0; i<8; ++i) + v[i] = -0.5; + GeneratorList G = simple_roots_type_D(7); + for (int i=0; i<7; ++i) + G[i].push_back(0); + G.push_back(v); + return G; +} + +GeneratorList simple_roots_type_F4() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 0 + 0 1 -1 0 + 0 0 1 0 + -1/2 -1/2 -1/2 -1/2 + + The Dynkin diagram is: + + 0 ---- 1 --(4)--> 2 ---- 3 + */ + GeneratorList R(4,4); + R(0,0) = R(1,1) = R(2,2) = 1; + R(0,1) = R(1,2) = -1; + R(3,0) = R(3,1) = R(3,2) = R(3,3) = -0.5; + return R; +} + +GeneratorList simple_roots_type_G2() +{ + /* + Read rowwise, these simple root vectors are + 1 -1 0 + -1 2 -1 + + Notice that each row sums to zero. + + The Dynkin diagram is: + + 0 <--(6)-- 1 + */ + GeneratorList R(2,3); + R(0,0) = 1; + R(0,1) = R(1,0) = R(1,2) = -1; + R(1,1) = 2; + return R; +} + +GeneratorList simple_roots_type_H3() +{ + const NumberType tau(0.5 + 0.5 * sqrt(5)); // golden ratio + + /* + For H_3, the Dynkin diagram is + + 0 --(5)-- 1 ---- 2, + + and the simple root vectors are, + + 2 0 0 + a b -1 + 0 0 2 + + with a=-tau and b=1/tau. Notice they all have length 2. + + */ + + GeneratorList R(3,3); + R(0,0) = R(2,2) = 2; + R(1,0) = -tau; R(1,1) = tau - 1; R(1,2) = -1; + return R; +} + +GeneratorList simple_roots_type_H4() +{ + const NumberType tau(0.5 + 0.5 * sqrt(5)); // golden ratio + + /* + For H_4, the Dynkin diagram is + + 0 --(5)-- 1 ---- 2 ---- 3, + + and the simple root vectors are, according to + [John H. Stembridge, A construction of H_4 without miracles, + Discrete Comput. Geom. 22, No.3, 425-427 (1999)], + + a b b b + -1 1 0 0 + 0 -1 1 0 + 0 0 -1 1 + + with a=(1+tau)/2 and b=(1-tau)/2, so that the length of each root is sqrt{2}. + + */ + GeneratorList R(4, 4); + + R(0,0) = (1+tau) * 0.5; + R(0,1) = R(0,2) = R(0,3) = (1-tau) * 0.5; + + for (int i=0; i<3; ++i) { + R(i+1, i) = -1; + R(i+1, i+1) = 1; + } + return R; +} + + + +GeneratorList simple_roots(char type, int dim) +{ + switch(type) { + case 'a': + case 'A': + return simple_roots_type_A(dim); + + case 'b': + case 'B': + return simple_roots_type_B(dim); + + case 'c': + case 'C': + return simple_roots_type_C(dim); + + case 'd': + case 'D': + return simple_roots_type_D(dim); + + case 'e': + case 'E': + switch(dim) { + case 6: + return simple_roots_type_E6(); + case 7: + return simple_roots_type_E7(); + case 8: + return simple_roots_type_E8(); + default: + throw InvalidGroupException(); + } + + case 'f': + case 'F': + switch(dim) { + case 4: + return simple_roots_type_F4(); + default: + throw InvalidGroupException(); + } + + case 'g': + case 'G': + switch(dim) { + case 2: + return simple_roots_type_G2(); + default: + throw InvalidGroupException(); + } + + case 'h': + case 'H': + switch(dim) { + case 3: + return simple_roots_type_H3(); + case 4: + return simple_roots_type_H4(); + default: + throw InvalidGroupException(); + } + + default: + throw NotImplementedException(); + } +} + +#endif // __GENERATORS_H_ + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: diff --git a/coxeter_group_orbits/RobertRaoul/main.cpp b/coxeter_group_orbits/RobertRaoul/main.cpp index 92d509a..82f1147 100644 --- a/coxeter_group_orbits/RobertRaoul/main.cpp +++ b/coxeter_group_orbits/RobertRaoul/main.cpp @@ -40,14 +40,14 @@ int main(){ cout << printVector(s) << endl; } - /* - VectorType normal = { 16, -1, -0.5}; - VectorType v = {1, 2, 3}; - VectorType vector = reflection(normal, v); - cout << printVector(vector) << endl; - cout << printVector(reflection(normal, vector)) << endl; - - */ + /* + VectorType normal = { 16, -1, -0.5}; + VectorType v = {1, 2, 3}; + VectorType vector = reflection(normal, v); + cout << printVector(vector) << endl; + cout << printVector(reflection(normal, vector)) << endl; + + */ return 0; } diff --git a/coxeter_group_orbits/RobertRaoul/orbit.h b/coxeter_group_orbits/RobertRaoul/orbit.h index d28ce9c..5d2a25a 100644 --- a/coxeter_group_orbits/RobertRaoul/orbit.h +++ b/coxeter_group_orbits/RobertRaoul/orbit.h @@ -38,7 +38,7 @@ typedef double E; const static E epsilon = 0.001; class coxeterVector : public std::vector{ - + public: coxeterVector(){} @@ -139,7 +139,7 @@ GeneratorList createMatrixEsix(){ {-.5,-.5,-.5,-.5,-.5,sqrt(3)/2}, {0.,0.,0.,1.,-1.,0.}, }; - return Matrix; + return Matrix; } diff --git a/coxeter_group_orbits/RobertRaoul/stl_wrappers.h b/coxeter_group_orbits/RobertRaoul/stl_wrappers.h new file mode 100644 index 0000000..ad29de5 --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/stl_wrappers.h @@ -0,0 +1,83 @@ +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + -------------------------------------------------------------------------------- + */ + +//#ifndef __STL_WRAPPERS_H__ +//#define __STL_WRAPPERS_H__ + +#include +#include +#include +#include + + +template +inline std::ostream& +operator<<(std::ostream& wrapped, const std::array& item) +{ + wrapped << '{'; + bool first = true; + for (auto const& element : item) { + wrapped << (!first ? "," : "") << element; + first = false; + } + return wrapped << '}'; +} + + +// teach Boost.Test how to print std::vector +template +inline std::ostream& +operator<<(std::ostream& wrapped, std::vector const& item) +{ + wrapped << '{'; + bool first = true; + for (auto const& element : item) { + wrapped << (!first ? "," : "") << element; + first = false; + } + return wrapped << '}'; +} + +template +inline std::ostream& +operator<<(std::ostream& wrapped, std::pair const& item) +{ + return wrapped << '<' << item.first << ',' << item.second << '>'; +} + +template +inline std::ostream& +operator<<(std::ostream& wrapped, std::map const& item) +{ + wrapped << '{'; + bool first = true; + for (auto const& element : item) { + wrapped << (!first ? "," : "") << element; + first = false; + } + return wrapped << '}'; +} + + +//#endif // __STL_WRAPPERS_H__ + + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: + diff --git a/coxeter_group_orbits/RobertRaoul/test_orbits.cc b/coxeter_group_orbits/RobertRaoul/test_orbits.cc new file mode 100644 index 0000000..9e4bb22 --- /dev/null +++ b/coxeter_group_orbits/RobertRaoul/test_orbits.cc @@ -0,0 +1,98 @@ +/* Copyright (c) 2015 + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + -------------------------------------------------------------------------------- + */ + +#define BOOST_TEST_MODULE orbits +#include + +#include "orbit.h" +#include "stl_wrappers.h" + +BOOST_AUTO_TEST_CASE( generators ) +{ + std::ostringstream oss; + oss << simple_roots_type_A(4) << std::endl + << simple_roots_type_B(4) << std::endl + << simple_roots_type_C(4) << std::endl + << simple_roots_type_D(4) << std::endl + << simple_roots_type_E6() << std::endl + << simple_roots_type_E7() << std::endl + << simple_roots_type_E8() << std::endl + << simple_roots_type_F4() << std::endl + << simple_roots_type_H3() << std::endl + << simple_roots_type_H4() << std::endl; + + BOOST_CHECK_EQUAL(oss.str(), + "{{1,-1,0,0,0},{0,1,-1,0,0},{0,0,1,-1,0},{0,0,0,1,-1}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,1}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,2}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,1,1}}\n" + "{{1,-1,0,0,0,0},{0,1,-1,0,0,0},{0,0,1,-1,0,0},{0,0,0,1,-1,0},{0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,0.866025}}\n" + "{{1,-1,0,0,0,0,0},{0,1,-1,0,0,0,0},{0,0,1,-1,0,0,0},{0,0,0,1,-1,0,0},{0,0,0,0,1,-1,0},{0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.707107}}\n" + "{{1,-1,0,0,0,0,0,0},{0,1,-1,0,0,0,0,0},{0,0,1,-1,0,0,0,0},{0,0,0,1,-1,0,0,0},{0,0,0,0,1,-1,0,0},{0,0,0,0,0,1,-1,0},{0,0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5}}\n" + "{{1,-1,0,0},{0,1,-1,0},{0,0,1,0},{-0.5,-0.5,-0.5,-0.5}}\n" + "{{2,0,0},{-1.61803,0.618034,-1},{0,0,2}}\n" + "{{1.30902,-0.309017,-0.309017,-0.309017},{-1,1,0,0},{0,-1,1,0},{0,0,-1,1}}\n" + ); +} + +struct b3_fixture { + b3_fixture() + : generators(simple_roots('B', 3)) + {} + GeneratorList generators; +}; + +BOOST_FIXTURE_TEST_CASE( b3_orbit_012, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 3}).size(), (size_t) 48); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_12, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 3}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_02, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 2}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_01, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 0}).size(), (size_t) 24); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_0, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 0, 0}).size(), (size_t) 6); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_1, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 0}).size(), (size_t) 12); +} + +BOOST_FIXTURE_TEST_CASE( b3_orbit_2, b3_fixture ) +{ + BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 1}).size(), (size_t) 8); +} + + +// Local Variables: +// mode:C++ +// c-basic-offset:3 +// indent-tabs-mode:nil +// End: diff --git a/coxeter_group_orbits/RobertRaoul/types.h b/coxeter_group_orbits/RobertRaoul/types.h index 665360a..0b56f98 100644 --- a/coxeter_group_orbits/RobertRaoul/types.h +++ b/coxeter_group_orbits/RobertRaoul/types.h @@ -1,18 +1,18 @@ /* Copyright (c) 2015 - Julian Pfeifle - julian.pfeifle@upc.edu - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version: http://www.gnu.org/licenses/gpl.txt. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. --------------------------------------------------------------------------------- -*/ + Julian Pfeifle + julian.pfeifle@upc.edu + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version: http://www.gnu.org/licenses/gpl.txt. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + -------------------------------------------------------------------------------- + */ #ifndef __TYPES_H_ #define __TYPES_H_ @@ -29,20 +29,20 @@ typedef std::set Orbit; class GeneratorList : public std::vector { public: - GeneratorList(int r, int c) - : std::vector(r) - { - for (int i=0; i(r) + { + for (int i=0; i Date: Wed, 17 Jun 2015 16:15:10 +0200 Subject: [PATCH 09/10] message 1 --- coxeter_group_orbits/.DS_Store | Bin 6148 -> 6148 bytes .../Coxeter_Orbit.xcodeproj/project.pbxproj | 242 ----------- .../contents.xcworkspacedata | 7 - .../UserInterfaceState.xcuserstate | Bin 4079 -> 0 bytes .../xcschemes/Coxeter_Orbit.xcscheme | 43 -- .../Coxeter_Orbit/Coxeter_Orbit/generators.h | 378 ------------------ .../Coxeter_Orbit/Coxeter_Orbit/main.cpp | 54 --- .../Coxeter_Orbit/Coxeter_Orbit/orbit.h | 193 --------- .../Coxeter_Orbit/stl_wrappers.h | 83 ---- .../Coxeter_Orbit/test_orbits.cc | 98 ----- .../Coxeter_Orbit/Coxeter_Orbit/types.h | 55 --- .../RobertRaoul/Makefile.template | 18 + .../coxeter_test.xcodeproj/project.pbxproj | 67 ---- .../contents.xcworkspacedata | 7 - .../UserInterfaceState.xcuserstate | Bin 4079 -> 0 bytes .../RobertRaoul/coxeter_test/generators.h | 378 ------------------ .../RobertRaoul/coxeter_test/main.cpp | 54 --- .../RobertRaoul/coxeter_test/orbit.h | 193 --------- .../RobertRaoul/coxeter_test/stl_wrappers.h | 83 ---- .../RobertRaoul/coxeter_test/test_orbits.cc | 98 ----- .../RobertRaoul/coxeter_test/types.h | 55 --- coxeter_group_orbits/RobertRaoul/main.cpp | 22 +- coxeter_group_orbits/RobertRaoul/orbit.h | 176 ++++++-- .../RobertRaoul/test_orbits.cc | 98 ----- 24 files changed, 186 insertions(+), 2216 deletions(-) delete mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.pbxproj delete mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate delete mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/xcuserdata/robertloewe.xcuserdatad/xcschemes/Coxeter_Orbit.xcscheme delete mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/generators.h delete mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/main.cpp delete mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/orbit.h delete mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/stl_wrappers.h delete mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/test_orbits.cc delete mode 100644 coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/types.h create mode 100644 coxeter_group_orbits/RobertRaoul/Makefile.template delete mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/coxeter_test.xcodeproj/project.pbxproj delete mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/coxeter_test.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/coxeter_test.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate delete mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/generators.h delete mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/main.cpp delete mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/orbit.h delete mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/stl_wrappers.h delete mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/test_orbits.cc delete mode 100644 coxeter_group_orbits/RobertRaoul/coxeter_test/types.h delete mode 100644 coxeter_group_orbits/RobertRaoul/test_orbits.cc diff --git a/coxeter_group_orbits/.DS_Store b/coxeter_group_orbits/.DS_Store index 40876e0fbe06105288ab5170c9412e2934f56bb6..5364cd43ae226e589c36cb045e9d4fc65867f1c2 100644 GIT binary patch delta 303 zcmZoMXfc=|#>B!ku~2NHo+2aj#(>?7iyfGm7?~&YFkR*_GBwpvFfuos{G7?Xo{yn~ zA(f#RNX9edGZZl-F=PVS#SD53$qdN_B}qP|#U(`y3=C!rp+M18po(G!eIS_+R0-mh zFysK)sSM>ntk2*AWG6F}GUNhzd0=z&f%@`*X6iFUFgOEcQ^4xrHpKz0%>YWm1)zKe v20{+=gE|bay3K~ne;7BjbMSKjg9FI<&ODi4#F2xMfq@C=Cx*=tB5Rld$$3C{ delta 79 zcmZoMXfc=|#>B)qu~2NHo+2aT#(>?7jEs|cST1vz8e8fp7#bN&e$L{)S%gEFWn#mz h&Fmcf96;rp1v$PmPv#eK - - - - diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index e5b0281f1e5ab9ddefecb289c2dbdd6966dc8e39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4079 zcma)9d3aRS6+b6$e{Y0gNk~{sU_uZ{;$%-)gsc)sLXt^B5|&|-c}X4&GsAl?#1PR- zYuzns-K~;^N{Wc6RRj@ftwl-^K|n=ot#xZFU#osvm)5WM&C3Kv{lnz@=Dj=j+_V0E z=bmW`2Q);l+6Yhcs;URb!cEB(kfal;KJP(K9x9~f70e%lJ!U;GD zufi!f4S$7q;cxIBybmA2Kj7c+3497)!vBy%9>?HVoPbGqF{a@xyae5th1ob4%dirw zu?`!t1=nE!*JBVv7{(2#<3`-nm>TR31YQLRWKh5XV`2RA8c*grwby8+&yj>QrM3rr zhA{{i!59)pm_cyDIKmPyN%lHZ3*GMA!ZLSxMs|L7Sw?P2eqlyQPDyzNT@@9$%k#=} z%JRI(!tcHJkt!L)s3Q1c{IYlVJ)>g=vH%JQ0XUBq9@K z2P8uZOs5_sLMqH84ssD$O?}}>0x2S{)s}WG=nwT&=)U!;*LnGc<{Er$rJlc{)dyGeod!y3KLBuil=jD}Ds(B{)CjV8^| z+5$A9#PfT;wvw2wguXs^dP;uo=Jb@ltn5PiUXYcud2=+oZYZ>}n+4gB1G$g~`A|T{ zkg>!`#*y)40-3l2ifC5n!F*Uip9@Jm&FUnQN@mfgo4CBrgkr;>^zjAFa=&JVbfe1G z8|pT_PAB!s(-rEe@om&PeRRj`%&;7dRyrnSjiwgR%-&*M^?4{A%_dFlu~m#7xAwl1 z*ccUMs-blTe?WufgsopwjaAeI+fhr>2~so_OQ9Ol2B3;04nPe_vO*hI*3>ZSO{J-> zH%>;#P!ElR;DH7*nWT^zQ3cDP6~+%jGqjK?Wa=QSfR$t#xtJucqG~QIwv(={_^N%K zLCx&;tF^90oBF}}I|=RJ2NgP6ZC(W_Vw>$()mT~MDbpxOLP4M2J4mHEn`=DFB8@5P zg9d@`_z0=wW* z*bR@t9(bH&k!+Gfa!DS^Ck3Q%7-mvZ7195_@C@vO{j^~vP>RKqxnvosCCyeQofdw} z)VA)sn>U}*;zCgE1qnaGM zI|5WsdninEl@hZVIUdq!+KhHx3tRn-w!9dTi1vowuxf+!1Ng9?l-v9<;qQYMtD+J7 z6V6$<{+L`b0G78_kD=Fs5eldkTEJ9wD-BMJihl;5kJ8`^vLs4_udMd-HGD&slIrsm z_!cn+u7{DKm8i0S-Sf_cz(xV(7|EB=K`T}hk-RNN(uw0Bt-qhRMm)lam=N^{Cy}}l zk8m>e2&dpwQcoI3J;G$1aiJY_VJh*E29n%D%WT8bwMbhNV{ta7$DGN)OwvS_TcjHs z0r7bnxE8HE6ghheb1)b4K*4-0z(OqYI>+mwkZB{!LTXKf1(Q0}pw?~JmaW@Zz0$OI z62rQ-o;KC*ZIM<2q=l?HgY$4cHLw6L$A#2LK9;~ISOANg=`uRtm?4zINigrtH z(6sPCvE(0_W{M+IqXo!VimeFgT9j_oQY%?WAl6nnwN?U)En8#-6`=wVoZ%AqZ~zOb zb2iqn2A6rAvuKWf_=1g1#vs;0=Z_bUpc(7Y<8``zgoQzDu(baeQ9G6<8Ve-SiLE>e zv{r1Rg9)y{mADF5qZikpkE|g+(ni{epQxl`2c)7Oim(GaX$P1|dEZGH)kQSg2k6*G z+hPgra_hn&Eod5%*~&+6BTD{}u4mWULtC9{RD|@#`YOuoNp`=}f}QrPRibv$>BSmd z#zqHIdxOd*)~oHbcDA1A?ueS=aJYh&-lz;#Ye8*PDRnAlJ;MEH&<2_|-R!LNK;r;h zL?_u9_PP%m`^gOIN{wf!+N=6)P^tO}yaq{QBoc!3he#64pg%wIU@k1g1e}Vq>A*i9 zOK~wS!74iNd+5l&9IwW^a1bBIC-EuVi~I0dd=8(-m+=)miKp-kzK&<{Eqoi##bw6T z$8CulihDlpY}{uIFk_i<%mgN$nZzV9Q*%b|G8E*0CP8k!@vHva8uOY>?f;{)D}m zy_4O>4zo|O``H)RSJ>0+YwR2B+w42+yX<@HIra;V;~d;XZW@=v&E>A(mT*~A zh6g^5XL+6<%TMK}^DcfSe<`2NXYy{ol&|7j__ch15AtDN=S_YieS65Bwz zTIqJ_Zs}g>ercODAPq^slJ-i6q!ZEyGRRZpX>zhWU3SUy<#M@7ZkGGx>*X8eo8?>O zt@5zEQ{E--miNf}{!IQ-nW4;4>XatsD&=R&4a!Z*Ey{h$u(DIxrR-Mr zC{HNAQJz*_R1Pagl%vWq<+yS}c~v>BeC&`ME=QiD*0I*H#qo2;R>y6QI~)%<9&+?M g1|5$$b~$!C4mnR diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/xcuserdata/robertloewe.xcuserdatad/xcschemes/Coxeter_Orbit.xcscheme b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/xcuserdata/robertloewe.xcuserdatad/xcschemes/Coxeter_Orbit.xcscheme deleted file mode 100644 index 6b19159..0000000 --- a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit.xcodeproj/xcuserdata/robertloewe.xcuserdatad/xcschemes/Coxeter_Orbit.xcscheme +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/generators.h b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/generators.h deleted file mode 100644 index b45947f..0000000 --- a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/generators.h +++ /dev/null @@ -1,378 +0,0 @@ -/* Copyright (c) 2015 - Julian Pfeifle - julian.pfeifle@upc.edu - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version: http://www.gnu.org/licenses/gpl.txt. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -------------------------------------------------------------------------------- - */ - -#ifndef __GENERATORS_H_ -#define __GENERATORS_H_ - -#include -#include -#include -#include "types.h" - -GeneratorList simple_roots_type_A (const int n) -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 ... 0 0 - 0 1 -1 0 ... 0 0 - ... - 0 0 0 0 ... 1 -1 - In particular, they lie in the plane (sum of coordinates = 0) - */ - GeneratorList R(n, n+1); - for (int i=0; i n-1, - */ - VectorType v(n); - v[n-1] = 1; - GeneratorList G = simple_roots_type_A(n-1); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_C (const int n) -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 ... 0 0 - 0 1 -1 0 ... 0 0 - ... - 0 0 0 0 ... 1 -1 - 0 0 0 0 ... 0 2 - - The Dynkin diagram is: - - 0 ---- 1 ---- ... ---- n-2 <--(4)-- n-1, - */ - VectorType v(n); - v[n-1] = 2; - GeneratorList G = simple_roots_type_A(n-1); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_D (const int n) -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 ... 0 0 - 0 1 -1 0 ... 0 0 - ... - 0 0 0 0 ... 1 -1 - 0 0 0 0 ... 1 1 - The indexing of the Dynkin diagram is - - n-2 - / - 0 - 1 - 2 - ... - n-3 - \ - n-1 - - */ - VectorType v(n); - v[n-2] = v[n-1] = 1; - GeneratorList G = simple_roots_type_A(n-1); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_E6() -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 0 0 - 0 1 -1 0 0 0 - 0 0 1 -1 0 0 - 0 0 0 1 -1 0 - 0 0 0 1 1 0 - -1/2(1 1 1 1 1 -sqrt(3)) - - The indexing of the Dynkin diagram is - - - 3 - | - | - 0 ---- 1 ---- 2 ---- 4 ---- 5 - - */ - VectorType v(6); - for (int i=0; i<5; ++i) - v[i] = -0.5; - v[5] = 0.5 * sqrt(3); - GeneratorList G = simple_roots_type_D(5); - for (int i=0; i<5; ++i) - G[i].push_back(0); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_E7() -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 0 0 0 - 0 1 -1 0 0 0 0 - 0 0 1 -1 0 0 0 - 0 0 0 1 -1 0 0 - 0 0 0 0 1 -1 0 - 0 0 0 0 1 1 0 - -1/2(1 1 1 1 1 1 -sqrt(2)) - - The indexing of the Dynkin diagram is - - - 4 - | - | - 0 ---- 1 ---- 2 ---- 3 ---- 5 ---- 6 - - */ - VectorType v(7); - for (int i=0; i<6; ++i) - v[i] = -0.5; - v[6] = 0.5 * sqrt(2); - GeneratorList G = simple_roots_type_D(6); - for (int i=0; i<6; ++i) - G[i].push_back(0); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_E8() -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 0 0 0 0 - 0 1 -1 0 0 0 0 0 - ... - 0 0 0 0 0 1 -1 0 - 0 0 0 0 0 1 1 0 - -1/2(1 1 1 1 1 1 1 1) - - These are the coordinates in the even coordinate system. - The indexing of the Dynkin diagram is - - - 5 - | - | - 0 ---- 1 ---- 2 ---- 3 ---- 4 ---- 6 ---- 7 - - */ - VectorType v(8); - for (int i=0; i<8; ++i) - v[i] = -0.5; - GeneratorList G = simple_roots_type_D(7); - for (int i=0; i<7; ++i) - G[i].push_back(0); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_F4() -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 - 0 1 -1 0 - 0 0 1 0 - -1/2 -1/2 -1/2 -1/2 - - The Dynkin diagram is: - - 0 ---- 1 --(4)--> 2 ---- 3 - */ - GeneratorList R(4,4); - R(0,0) = R(1,1) = R(2,2) = 1; - R(0,1) = R(1,2) = -1; - R(3,0) = R(3,1) = R(3,2) = R(3,3) = -0.5; - return R; -} - -GeneratorList simple_roots_type_G2() -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 - -1 2 -1 - - Notice that each row sums to zero. - - The Dynkin diagram is: - - 0 <--(6)-- 1 - */ - GeneratorList R(2,3); - R(0,0) = 1; - R(0,1) = R(1,0) = R(1,2) = -1; - R(1,1) = 2; - return R; -} - -GeneratorList simple_roots_type_H3() -{ - const NumberType tau(0.5 + 0.5 * sqrt(5)); // golden ratio - - /* - For H_3, the Dynkin diagram is - - 0 --(5)-- 1 ---- 2, - - and the simple root vectors are, - - 2 0 0 - a b -1 - 0 0 2 - - with a=-tau and b=1/tau. Notice they all have length 2. - - */ - - GeneratorList R(3,3); - R(0,0) = R(2,2) = 2; - R(1,0) = -tau; R(1,1) = tau - 1; R(1,2) = -1; - return R; -} - -GeneratorList simple_roots_type_H4() -{ - const NumberType tau(0.5 + 0.5 * sqrt(5)); // golden ratio - - /* - For H_4, the Dynkin diagram is - - 0 --(5)-- 1 ---- 2 ---- 3, - - and the simple root vectors are, according to - [John H. Stembridge, A construction of H_4 without miracles, - Discrete Comput. Geom. 22, No.3, 425-427 (1999)], - - a b b b - -1 1 0 0 - 0 -1 1 0 - 0 0 -1 1 - - with a=(1+tau)/2 and b=(1-tau)/2, so that the length of each root is sqrt{2}. - - */ - GeneratorList R(4, 4); - - R(0,0) = (1+tau) * 0.5; - R(0,1) = R(0,2) = R(0,3) = (1-tau) * 0.5; - - for (int i=0; i<3; ++i) { - R(i+1, i) = -1; - R(i+1, i+1) = 1; - } - return R; -} - - - -GeneratorList simple_roots(char type, int dim) -{ - switch(type) { - case 'a': - case 'A': - return simple_roots_type_A(dim); - - case 'b': - case 'B': - return simple_roots_type_B(dim); - - case 'c': - case 'C': - return simple_roots_type_C(dim); - - case 'd': - case 'D': - return simple_roots_type_D(dim); - - case 'e': - case 'E': - switch(dim) { - case 6: - return simple_roots_type_E6(); - case 7: - return simple_roots_type_E7(); - case 8: - return simple_roots_type_E8(); - default: - throw InvalidGroupException(); - } - - case 'f': - case 'F': - switch(dim) { - case 4: - return simple_roots_type_F4(); - default: - throw InvalidGroupException(); - } - - case 'g': - case 'G': - switch(dim) { - case 2: - return simple_roots_type_G2(); - default: - throw InvalidGroupException(); - } - - case 'h': - case 'H': - switch(dim) { - case 3: - return simple_roots_type_H3(); - case 4: - return simple_roots_type_H4(); - default: - throw InvalidGroupException(); - } - - default: - throw NotImplementedException(); - } -} - -#endif // __GENERATORS_H_ - -// Local Variables: -// mode:C++ -// c-basic-offset:3 -// indent-tabs-mode:nil -// End: diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/main.cpp b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/main.cpp deleted file mode 100644 index 82f1147..0000000 --- a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/main.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -// main.cpp -// orbit_h -// -// Created by Robert Loewe on 07.06.15. -// Copyright (c) 2015 Robert Loewe. All rights reserved. -// - -#include -#include -#include -#include "orbit.h" - -using namespace std; - -string printVector(VectorType v){ - std::string output; - for(int i = 0; i < v.size(); i++){ - std::ostringstream os; - os << v[i]; - std::string str = os.str(); - output.append(str); - output.append(" "); - } - return output; -} - -int main(){ - - - VectorType v = {0., 0.5, 0., 0., 0., 0.5}; - GeneratorList B2 = createMatrixA(5); - for (int i = 0; i < B2.size(); i++){ - cout << printVector(B2[i]) << endl; - } - cout << B2.size() << endl; - Orbit solution = orbit(B2, v); - cout << "size: " << solution.size() << endl; - for(auto s : solution){ - cout << printVector(s) << endl; - } - - /* - VectorType normal = { 16, -1, -0.5}; - VectorType v = {1, 2, 3}; - VectorType vector = reflection(normal, v); - cout << printVector(vector) << endl; - cout << printVector(reflection(normal, vector)) << endl; - - */ - return 0; -} - - diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/orbit.h b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/orbit.h deleted file mode 100644 index 5d2a25a..0000000 --- a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/orbit.h +++ /dev/null @@ -1,193 +0,0 @@ -// -// orbit.h -// Coxeter_Orbit -// -// Created by Robert Loewe on 07.06.15. -// Copyright (c) 2015 Robert Loewe. All rights reserved. -// -/* Copyright (c) 2015 - Julian Pfeifle - julian.pfeifle@upc.edu - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version: http://www.gnu.org/licenses/gpl.txt. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -------------------------------------------------------------------------------- - */ - - -#ifndef Coxeter_Orbit_orbit_h -#define Coxeter_Orbit_orbit_h - - -#include -#include -#include - -class NotImplementedException : public std::exception {}; - - -typedef double E; - -const static E epsilon = 0.001; - -class coxeterVector : public std::vector{ - -public: - - coxeterVector(){} - - explicit coxeterVector(int dim): std::vector(dim){} - - template - coxeterVector(std::initializer_list init) - : std::vector(init) {} - - - bool operator==(const coxeterVector& rhs) const { - E sum =0; - coxeterVector a(*this); - for (int i =0; i < rhs.size(); i++) { - a[i] -= rhs[i]; - sum += a[i]*a[i]; - } - return (sum < epsilon); - - } - - -}; - - -typedef double NumberType; -typedef coxeterVector VectorType; -typedef std::vector GeneratorList; -typedef std::set Orbit; - - -std::set orbitSet; - - -VectorType vectorAddition(VectorType v1, VectorType v2){ - VectorType v = VectorType(v1.size()); - for(int i = 0; i < v1.size(); i++){ - v[i] = v1[i] + v2[i]; - } - return v; -} - -VectorType scalarMultiplication(double a, VectorType v1){ - VectorType v = VectorType(v1.size()); - for(int i = 0; i < v1.size(); i++){ - v[i] = a*v1[i]; - } - return v; -} - -double scalarProduct(VectorType v1, VectorType v2){ - double sum = 0; - for(int i = 0; i < v1.size(); i++){ - sum += v1[i]*v2[i]; - } - return sum; -} - -VectorType reflection(VectorType normal, VectorType vector){ - VectorType reflected = VectorType(vector.size()); - double rs = (-2)*scalarProduct(vector, normal)/scalarProduct(normal, normal); - reflected = vectorAddition(vector, scalarMultiplication(rs,normal)); - return reflected; -} - -GeneratorList createMatrixB(int dim){ - GeneratorList Matrix; - for (int i = 0; i < dim-1; i++){ - VectorType normal (dim); - normal[i] = 1.; - normal[i+1]= -1.; - Matrix.push_back(normal); - } - VectorType normal (dim); - normal[dim-1] = 1.; - Matrix.push_back(normal); - return Matrix; -} - -GeneratorList createMatrixA(int dim){ - GeneratorList Matrix; - for (int i = 0; i < dim; i++){ - VectorType normal (dim+1); - normal[i] = 1.; - normal[i+1]= -1.; - Matrix.push_back(normal); - } - return Matrix; -} - -GeneratorList createMatrixEsix(){ - GeneratorList Matrix = { - {1.,-1.,0.,0.,0.,0.}, - {0.,1.,-1.,0.,0.,0.}, - {0.,0.,1.,-1.,0.,0.}, - {0.,0.,0.,1.,1.,0.}, - {-.5,-.5,-.5,-.5,-.5,sqrt(3)/2}, - {0.,0.,0.,1.,-1.,0.}, - }; - return Matrix; -} - - - -GeneratorList simple_roots(char type, int dim) -{ - switch(type) { - case 'B': - return createMatrixB(dim); - case 'A': - return createMatrixA(dim); - - default: - throw new NotImplementedException(); - } -} - -void recursion(const GeneratorList& generators, VectorType v, int counter){ - for(int i = 0; i < generators.size(); i++){ - std:: cout << i << std::endl; - if (orbitSet.find(reflection(generators[i], v)) == orbitSet.end()) { //orbitSet contains reflection(generators[i], v) - orbitSet.insert(reflection(generators[i], v)); - - counter += 1; - std::cout << "counter " << counter << std::endl; - recursion(generators, reflection(generators[i], v), counter); - } - } -} - -Orbit orbit(const GeneratorList& generators, const VectorType& v) -{ - orbitSet.clear(); - orbitSet.insert(v); - recursion(generators,v,0); - return orbitSet; -} - - -#endif // __ORBIT_H_ - -// Local Variables: -// mode:C++ -// c-basic-offset:3 -// indent-tabs-mode:nil -// End: - - - - - diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/stl_wrappers.h b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/stl_wrappers.h deleted file mode 100644 index ad29de5..0000000 --- a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/stl_wrappers.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2015 - Julian Pfeifle - julian.pfeifle@upc.edu - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version: http://www.gnu.org/licenses/gpl.txt. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -------------------------------------------------------------------------------- - */ - -//#ifndef __STL_WRAPPERS_H__ -//#define __STL_WRAPPERS_H__ - -#include -#include -#include -#include - - -template -inline std::ostream& -operator<<(std::ostream& wrapped, const std::array& item) -{ - wrapped << '{'; - bool first = true; - for (auto const& element : item) { - wrapped << (!first ? "," : "") << element; - first = false; - } - return wrapped << '}'; -} - - -// teach Boost.Test how to print std::vector -template -inline std::ostream& -operator<<(std::ostream& wrapped, std::vector const& item) -{ - wrapped << '{'; - bool first = true; - for (auto const& element : item) { - wrapped << (!first ? "," : "") << element; - first = false; - } - return wrapped << '}'; -} - -template -inline std::ostream& -operator<<(std::ostream& wrapped, std::pair const& item) -{ - return wrapped << '<' << item.first << ',' << item.second << '>'; -} - -template -inline std::ostream& -operator<<(std::ostream& wrapped, std::map const& item) -{ - wrapped << '{'; - bool first = true; - for (auto const& element : item) { - wrapped << (!first ? "," : "") << element; - first = false; - } - return wrapped << '}'; -} - - -//#endif // __STL_WRAPPERS_H__ - - -// Local Variables: -// mode:C++ -// c-basic-offset:3 -// indent-tabs-mode:nil -// End: - diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/test_orbits.cc b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/test_orbits.cc deleted file mode 100644 index 9e4bb22..0000000 --- a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/test_orbits.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright (c) 2015 - Julian Pfeifle - julian.pfeifle@upc.edu - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version: http://www.gnu.org/licenses/gpl.txt. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -------------------------------------------------------------------------------- - */ - -#define BOOST_TEST_MODULE orbits -#include - -#include "orbit.h" -#include "stl_wrappers.h" - -BOOST_AUTO_TEST_CASE( generators ) -{ - std::ostringstream oss; - oss << simple_roots_type_A(4) << std::endl - << simple_roots_type_B(4) << std::endl - << simple_roots_type_C(4) << std::endl - << simple_roots_type_D(4) << std::endl - << simple_roots_type_E6() << std::endl - << simple_roots_type_E7() << std::endl - << simple_roots_type_E8() << std::endl - << simple_roots_type_F4() << std::endl - << simple_roots_type_H3() << std::endl - << simple_roots_type_H4() << std::endl; - - BOOST_CHECK_EQUAL(oss.str(), - "{{1,-1,0,0,0},{0,1,-1,0,0},{0,0,1,-1,0},{0,0,0,1,-1}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,1}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,2}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,1,1}}\n" - "{{1,-1,0,0,0,0},{0,1,-1,0,0,0},{0,0,1,-1,0,0},{0,0,0,1,-1,0},{0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,0.866025}}\n" - "{{1,-1,0,0,0,0,0},{0,1,-1,0,0,0,0},{0,0,1,-1,0,0,0},{0,0,0,1,-1,0,0},{0,0,0,0,1,-1,0},{0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.707107}}\n" - "{{1,-1,0,0,0,0,0,0},{0,1,-1,0,0,0,0,0},{0,0,1,-1,0,0,0,0},{0,0,0,1,-1,0,0,0},{0,0,0,0,1,-1,0,0},{0,0,0,0,0,1,-1,0},{0,0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,0},{-0.5,-0.5,-0.5,-0.5}}\n" - "{{2,0,0},{-1.61803,0.618034,-1},{0,0,2}}\n" - "{{1.30902,-0.309017,-0.309017,-0.309017},{-1,1,0,0},{0,-1,1,0},{0,0,-1,1}}\n" - ); -} - -struct b3_fixture { - b3_fixture() - : generators(simple_roots('B', 3)) - {} - GeneratorList generators; -}; - -BOOST_FIXTURE_TEST_CASE( b3_orbit_012, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 3}).size(), (size_t) 48); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_12, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 3}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_02, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 2}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_01, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 0}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_0, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 0, 0}).size(), (size_t) 6); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_1, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 0}).size(), (size_t) 12); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_2, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 1}).size(), (size_t) 8); -} - - -// Local Variables: -// mode:C++ -// c-basic-offset:3 -// indent-tabs-mode:nil -// End: diff --git a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/types.h b/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/types.h deleted file mode 100644 index 0b56f98..0000000 --- a/coxeter_group_orbits/RobertRaoul/Coxeter_Orbit/Coxeter_Orbit/types.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 2015 - Julian Pfeifle - julian.pfeifle@upc.edu - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version: http://www.gnu.org/licenses/gpl.txt. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -------------------------------------------------------------------------------- - */ - -#ifndef __TYPES_H_ -#define __TYPES_H_ - -#include -#include - -class NotImplementedException : public std::exception {}; -class InvalidGroupException : public std::exception {}; - -typedef long double NumberType; // this might work -typedef std::vector VectorType; -typedef std::set Orbit; - -class GeneratorList : public std::vector { -public: - GeneratorList(int r, int c) - : std::vector(r) - { - for (int i=0; i - - - - diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/coxeter_test.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate b/coxeter_group_orbits/RobertRaoul/coxeter_test/coxeter_test.xcodeproj/project.xcworkspace/xcuserdata/robertloewe.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 5ee47b7f5371c24ae7a523298fe3451a59af0fa6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4079 zcma)9d3aRS6+b6$e{Xr^D-f${^88`&0Frd=XaLh zIrmIsIH;MCtgJJDkOT~{zyXizaYJ4DI@K^WJye&jH?CHjBIdGmztPmH(bv`K5j{Kz z@TML6oU1_q5eCB$7zz_$B3uQNU@}Yr7fgj|kPC&d5XzwfDq#^Uh9yu1UZ{q8SPrY8 z6*O24Yaj?Zw8OQ~2^-)BxDjrGJK%2kHEe^OunQi6M`17g5ng~7;VAqGUV@k56?hen z!Q1c-ybEXHJ@^>@0q5bLZ~;Dr&*2NW3|}Lngfb4o!I+GraXe1K$v6e`FdwJm9Gs68 zxCCo(8Lq(~wqXc$4C7ifa2;M(lOBo&gQr0P85D5902s8i(mQpH+F{nyYfnIG)0={R z)9i+R(4Qm`rW>3vkg&u@#`&D-#RcyCd7cuFt0b>*o-41|o$D$r_7u7b3QCIeW_a>E zrMYgOb4XdqyrsIa#ti$L)DpcZ+NOpgao}Mv1~PX;G7N_l7y%<;6pSVu;fX**A`zJ= zyJ0M(!Z>O{3Zz2@agcsw0JTLR!^td?vC`76g#vneso`%^ea><8#Udl18fu^ywc6k4 z(L)hK4+d$*ea<<3O-fkwmE?G)=jWCbyYk(+#jZS0zS~upn_b{4DK5+_EX>X+n2|Nz z=bX}4fen8JpeCfPjjCk<>ZaDLsfN!vmWsQZB9vG^Zj#TLVkwNdQLXF2M!!*J)@r8K z7^EHzzq00UEKXP&*4ddgC3Sk<`YEZM)HZrQBRhBf`Zr=p&4QdRNTGr1{|4kiK1_!h z^>#i(G*Wf;t!mP=yA8wN(M<&k>MFg9Vzm%Y&`c<{5;O~D!__bc=0Xv;iIWT@gUDbq zgbXFac7ul|W*(HnHS}6Wl4)X6NG7?8UUNu>&pFI(nzRD_p~$>|7SRo}+~1)`BR;2- zI_7QF+bjL+v=%>I@i|?VuW_;@WTqyf1+_?r+fe;pTG5eOO>MVT^lrD-zL%Q>6(y>v zwS;~|gJp!RUsKH$)CAj5OVSBaJQOvs6f(P@mW=3vIx^C7ZD2`lb+0vL5w*>XKG!O z9#E&!;4ai6Q+pStdLu@(DH1i*xcN83t-WEsjZ7jLc1V8)zMXI<+yz_6Wa1*zu7vd$ zaBqUYb6_jw<`m1{a8b^FLF>gszt6$*a2Srz zb~c<=PcoTJ7Lz4pnH5Q=Ma>emG1}6i8WxzvPV1e`P}*H$<<^InM;axQKFuPGw>#HlWRyBSwJ%C%GKsr)h?^jT3Taw^>!z) z?Hp=(7O(7HOXD!-;6n@M&+tC{1wJ6f#6wERyj?Vg9{32-Y3!0oDUBbE*~nVIp;?@! zEmUo{f@N0u+iU&7s7k#Wk+|AJRBw|Wrm;#*Sd4Ag4H`DH$!RH(K_sTVx+ARG zB>e<(c98yYn=iq?Ehhhq%=6$DJ4#{}24Pm-t_ig>mA4 zWA&16;X6`JDtk$fNysG-^f(GM_7xVD+dt?_WmK?#g5(Kw(i|;{Np4Ay9D+k3bH@&n z(PI$~#}RRha3rbfu?WXdi*PKa5-+K}Vo@4q_Qk;oIFVG78ZvGfO{`7Gv?6U)0-_7E z682^wKi1+>pEKO*g|VOgI0D6t)Nz-(MqRd zA8mZaw2!R`>slyc#%3!&J#T1v_w+S8w_e)JRI^k!YO2aJ(mx_8FrNPX$cLFQ7l+{}yb7~v z6?o{lzW~eW!0)9a|5Dt5zr=3bj|cD|K7~)?v-lhy#uIoF-@r5Y7QTaL@f^O77n24i zRV8go+L?4X>1@(xNna;@#~{Nn4knpNWhOE%W;)|xs+ek~mZ@XvnFeMhvx?D~wT#I` znRcdw>15V38=0-l!_0fkr|f7pi=D$3v2M1KUBY_VTDFd@XG3f|dp)~>CG2MQF7_Vw zUUn;cKf9gnVt2Cp*%#TP>A1_W#c{V|o8z~R i9gc3t!;VKBdmTp{M;*svX8 -#include -#include -#include "types.h" - -GeneratorList simple_roots_type_A (const int n) -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 ... 0 0 - 0 1 -1 0 ... 0 0 - ... - 0 0 0 0 ... 1 -1 - In particular, they lie in the plane (sum of coordinates = 0) - */ - GeneratorList R(n, n+1); - for (int i=0; i n-1, - */ - VectorType v(n); - v[n-1] = 1; - GeneratorList G = simple_roots_type_A(n-1); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_C (const int n) -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 ... 0 0 - 0 1 -1 0 ... 0 0 - ... - 0 0 0 0 ... 1 -1 - 0 0 0 0 ... 0 2 - - The Dynkin diagram is: - - 0 ---- 1 ---- ... ---- n-2 <--(4)-- n-1, - */ - VectorType v(n); - v[n-1] = 2; - GeneratorList G = simple_roots_type_A(n-1); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_D (const int n) -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 ... 0 0 - 0 1 -1 0 ... 0 0 - ... - 0 0 0 0 ... 1 -1 - 0 0 0 0 ... 1 1 - The indexing of the Dynkin diagram is - - n-2 - / - 0 - 1 - 2 - ... - n-3 - \ - n-1 - - */ - VectorType v(n); - v[n-2] = v[n-1] = 1; - GeneratorList G = simple_roots_type_A(n-1); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_E6() -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 0 0 - 0 1 -1 0 0 0 - 0 0 1 -1 0 0 - 0 0 0 1 -1 0 - 0 0 0 1 1 0 --1/2(1 1 1 1 1 -sqrt(3)) - - The indexing of the Dynkin diagram is - - - 3 - | - | - 0 ---- 1 ---- 2 ---- 4 ---- 5 - - */ - VectorType v(6); - for (int i=0; i<5; ++i) - v[i] = -0.5; - v[5] = 0.5 * sqrt(3); - GeneratorList G = simple_roots_type_D(5); - for (int i=0; i<5; ++i) - G[i].push_back(0); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_E7() -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 0 0 0 - 0 1 -1 0 0 0 0 - 0 0 1 -1 0 0 0 - 0 0 0 1 -1 0 0 - 0 0 0 0 1 -1 0 - 0 0 0 0 1 1 0 --1/2(1 1 1 1 1 1 -sqrt(2)) - - The indexing of the Dynkin diagram is - - - 4 - | - | - 0 ---- 1 ---- 2 ---- 3 ---- 5 ---- 6 - - */ - VectorType v(7); - for (int i=0; i<6; ++i) - v[i] = -0.5; - v[6] = 0.5 * sqrt(2); - GeneratorList G = simple_roots_type_D(6); - for (int i=0; i<6; ++i) - G[i].push_back(0); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_E8() -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 0 0 0 0 - 0 1 -1 0 0 0 0 0 - ... - 0 0 0 0 0 1 -1 0 - 0 0 0 0 0 1 1 0 --1/2(1 1 1 1 1 1 1 1) - - These are the coordinates in the even coordinate system. - The indexing of the Dynkin diagram is - - - 5 - | - | - 0 ---- 1 ---- 2 ---- 3 ---- 4 ---- 6 ---- 7 - - */ - VectorType v(8); - for (int i=0; i<8; ++i) - v[i] = -0.5; - GeneratorList G = simple_roots_type_D(7); - for (int i=0; i<7; ++i) - G[i].push_back(0); - G.push_back(v); - return G; -} - -GeneratorList simple_roots_type_F4() -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 0 - 0 1 -1 0 - 0 0 1 0 - -1/2 -1/2 -1/2 -1/2 - - The Dynkin diagram is: - - 0 ---- 1 --(4)--> 2 ---- 3 - */ - GeneratorList R(4,4); - R(0,0) = R(1,1) = R(2,2) = 1; - R(0,1) = R(1,2) = -1; - R(3,0) = R(3,1) = R(3,2) = R(3,3) = -0.5; - return R; -} - -GeneratorList simple_roots_type_G2() -{ - /* - Read rowwise, these simple root vectors are - 1 -1 0 - -1 2 -1 - - Notice that each row sums to zero. - - The Dynkin diagram is: - - 0 <--(6)-- 1 - */ - GeneratorList R(2,3); - R(0,0) = 1; - R(0,1) = R(1,0) = R(1,2) = -1; - R(1,1) = 2; - return R; -} - -GeneratorList simple_roots_type_H3() -{ - const NumberType tau(0.5 + 0.5 * sqrt(5)); // golden ratio - - /* - For H_3, the Dynkin diagram is - - 0 --(5)-- 1 ---- 2, - - and the simple root vectors are, - - 2 0 0 - a b -1 - 0 0 2 - - with a=-tau and b=1/tau. Notice they all have length 2. - - */ - - GeneratorList R(3,3); - R(0,0) = R(2,2) = 2; - R(1,0) = -tau; R(1,1) = tau - 1; R(1,2) = -1; - return R; -} - -GeneratorList simple_roots_type_H4() -{ - const NumberType tau(0.5 + 0.5 * sqrt(5)); // golden ratio - - /* - For H_4, the Dynkin diagram is - - 0 --(5)-- 1 ---- 2 ---- 3, - - and the simple root vectors are, according to - [John H. Stembridge, A construction of H_4 without miracles, - Discrete Comput. Geom. 22, No.3, 425-427 (1999)], - - a b b b - -1 1 0 0 - 0 -1 1 0 - 0 0 -1 1 - - with a=(1+tau)/2 and b=(1-tau)/2, so that the length of each root is sqrt{2}. - - */ - GeneratorList R(4, 4); - - R(0,0) = (1+tau) * 0.5; - R(0,1) = R(0,2) = R(0,3) = (1-tau) * 0.5; - - for (int i=0; i<3; ++i) { - R(i+1, i) = -1; - R(i+1, i+1) = 1; - } - return R; -} - - - -GeneratorList simple_roots(char type, int dim) -{ - switch(type) { - case 'a': - case 'A': - return simple_roots_type_A(dim); - - case 'b': - case 'B': - return simple_roots_type_B(dim); - - case 'c': - case 'C': - return simple_roots_type_C(dim); - - case 'd': - case 'D': - return simple_roots_type_D(dim); - - case 'e': - case 'E': - switch(dim) { - case 6: - return simple_roots_type_E6(); - case 7: - return simple_roots_type_E7(); - case 8: - return simple_roots_type_E8(); - default: - throw InvalidGroupException(); - } - - case 'f': - case 'F': - switch(dim) { - case 4: - return simple_roots_type_F4(); - default: - throw InvalidGroupException(); - } - - case 'g': - case 'G': - switch(dim) { - case 2: - return simple_roots_type_G2(); - default: - throw InvalidGroupException(); - } - - case 'h': - case 'H': - switch(dim) { - case 3: - return simple_roots_type_H3(); - case 4: - return simple_roots_type_H4(); - default: - throw InvalidGroupException(); - } - - default: - throw NotImplementedException(); - } -} - -#endif // __GENERATORS_H_ - -// Local Variables: -// mode:C++ -// c-basic-offset:3 -// indent-tabs-mode:nil -// End: diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/main.cpp b/coxeter_group_orbits/RobertRaoul/coxeter_test/main.cpp deleted file mode 100644 index 92d509a..0000000 --- a/coxeter_group_orbits/RobertRaoul/coxeter_test/main.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -// main.cpp -// orbit_h -// -// Created by Robert Loewe on 07.06.15. -// Copyright (c) 2015 Robert Loewe. All rights reserved. -// - -#include -#include -#include -#include "orbit.h" - -using namespace std; - -string printVector(VectorType v){ - std::string output; - for(int i = 0; i < v.size(); i++){ - std::ostringstream os; - os << v[i]; - std::string str = os.str(); - output.append(str); - output.append(" "); - } - return output; -} - -int main(){ - - - VectorType v = {0., 0.5, 0., 0., 0., 0.5}; - GeneratorList B2 = createMatrixA(5); - for (int i = 0; i < B2.size(); i++){ - cout << printVector(B2[i]) << endl; - } - cout << B2.size() << endl; - Orbit solution = orbit(B2, v); - cout << "size: " << solution.size() << endl; - for(auto s : solution){ - cout << printVector(s) << endl; - } - - /* - VectorType normal = { 16, -1, -0.5}; - VectorType v = {1, 2, 3}; - VectorType vector = reflection(normal, v); - cout << printVector(vector) << endl; - cout << printVector(reflection(normal, vector)) << endl; - - */ - return 0; -} - - diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/orbit.h b/coxeter_group_orbits/RobertRaoul/coxeter_test/orbit.h deleted file mode 100644 index 34ae90b..0000000 --- a/coxeter_group_orbits/RobertRaoul/coxeter_test/orbit.h +++ /dev/null @@ -1,193 +0,0 @@ -// Hallo Raoul -// orbit.h -// Coxeter_Orbit -// -// Created by Robert Loewe on 07.06.15. -// Copyright (c) 2015 Robert Loewe. All rights reserved. -// -/* Copyright (c) 2015 - Julian Pfeifle - julian.pfeifle@upc.edu - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version: http://www.gnu.org/licenses/gpl.txt. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -------------------------------------------------------------------------------- - */ - - -#ifndef Coxeter_Orbit_orbit_h -#define Coxeter_Orbit_orbit_h - - -#include -#include -#include - -class NotImplementedException : public std::exception {}; - - -typedef double E; - -const static E epsilon = 0.001; - -class coxeterVector : public std::vector{ - -public: - - coxeterVector(){} - - explicit coxeterVector(int dim): std::vector(dim){} - - template - coxeterVector(std::initializer_list init) - : std::vector(init) {} - - - bool operator==(const coxeterVector& rhs) const { - E sum =0; - coxeterVector a(*this); - for (int i =0; i < rhs.size(); i++) { - a[i] -= rhs[i]; - sum += a[i]*a[i]; - } - return (sum < epsilon); - - } - - -}; - - -typedef double NumberType; -typedef coxeterVector VectorType; -typedef std::vector GeneratorList; -typedef std::set Orbit; - - -std::set orbitSet; - - -VectorType vectorAddition(VectorType v1, VectorType v2){ - VectorType v = VectorType(v1.size()); - for(int i = 0; i < v1.size(); i++){ - v[i] = v1[i] + v2[i]; - } - return v; -} - -VectorType scalarMultiplication(double a, VectorType v1){ - VectorType v = VectorType(v1.size()); - for(int i = 0; i < v1.size(); i++){ - v[i] = a*v1[i]; - } - return v; -} - -double scalarProduct(VectorType v1, VectorType v2){ - double sum = 0; - for(int i = 0; i < v1.size(); i++){ - sum += v1[i]*v2[i]; - } - return sum; -} - -VectorType reflection(VectorType normal, VectorType vector){ - VectorType reflected = VectorType(vector.size()); - double rs = (-2)*scalarProduct(vector, normal)/scalarProduct(normal, normal); - reflected = vectorAddition(vector, scalarMultiplication(rs,normal)); - return reflected; -} - -GeneratorList createMatrixB(int dim){ - GeneratorList Matrix; - for (int i = 0; i < dim-1; i++){ - VectorType normal (dim); - normal[i] = 1.; - normal[i+1]= -1.; - Matrix.push_back(normal); - } - VectorType normal (dim); - normal[dim-1] = 1.; - Matrix.push_back(normal); - return Matrix; -} - -GeneratorList createMatrixA(int dim){ - GeneratorList Matrix; - for (int i = 0; i < dim; i++){ - VectorType normal (dim+1); - normal[i] = 1.; - normal[i+1]= -1.; - Matrix.push_back(normal); - } - return Matrix; -} - -GeneratorList createMatrixEsix(){ - GeneratorList Matrix = { - {1.,-1.,0.,0.,0.,0.}, - {0.,1.,-1.,0.,0.,0.}, - {0.,0.,1.,-1.,0.,0.}, - {0.,0.,0.,1.,1.,0.}, - {-.5,-.5,-.5,-.5,-.5,sqrt(3)/2}, - {0.,0.,0.,1.,-1.,0.}, - }; - return Matrix; -} - - - -GeneratorList simple_roots(char type, int dim) -{ - switch(type) { - case 'B': - return createMatrixB(dim); - case 'A': - return createMatrixA(dim); - - default: - throw new NotImplementedException(); - } -} - -void recursion(const GeneratorList& generators, VectorType v, int counter){ - for(int i = 0; i < generators.size(); i++){ - std:: cout << i << std::endl; - if (orbitSet.find(reflection(generators[i], v)) == orbitSet.end()) { //orbitSet contains reflection(generators[i], v) - orbitSet.insert(reflection(generators[i], v)); - - counter += 1; - std::cout << "counter " << counter << std::endl; - recursion(generators, reflection(generators[i], v), counter); - } - } -} - -Orbit orbit(const GeneratorList& generators, const VectorType& v) -{ - orbitSet.clear(); - orbitSet.insert(v); - recursion(generators,v,0); - return orbitSet; -} - - -#endif // __ORBIT_H_ - -// Local Variables: -// mode:C++ -// c-basic-offset:3 -// indent-tabs-mode:nil -// End: - - - - - diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/stl_wrappers.h b/coxeter_group_orbits/RobertRaoul/coxeter_test/stl_wrappers.h deleted file mode 100644 index 581011f..0000000 --- a/coxeter_group_orbits/RobertRaoul/coxeter_test/stl_wrappers.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright (c) 2015 - Julian Pfeifle - julian.pfeifle@upc.edu - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version: http://www.gnu.org/licenses/gpl.txt. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. --------------------------------------------------------------------------------- -*/ - -//#ifndef __STL_WRAPPERS_H__ -//#define __STL_WRAPPERS_H__ - -#include -#include -#include -#include - - -template -inline std::ostream& -operator<<(std::ostream& wrapped, const std::array& item) -{ - wrapped << '{'; - bool first = true; - for (auto const& element : item) { - wrapped << (!first ? "," : "") << element; - first = false; - } - return wrapped << '}'; -} - - -// teach Boost.Test how to print std::vector -template -inline std::ostream& -operator<<(std::ostream& wrapped, std::vector const& item) -{ - wrapped << '{'; - bool first = true; - for (auto const& element : item) { - wrapped << (!first ? "," : "") << element; - first = false; - } - return wrapped << '}'; -} - -template -inline std::ostream& -operator<<(std::ostream& wrapped, std::pair const& item) -{ - return wrapped << '<' << item.first << ',' << item.second << '>'; -} - -template -inline std::ostream& -operator<<(std::ostream& wrapped, std::map const& item) -{ - wrapped << '{'; - bool first = true; - for (auto const& element : item) { - wrapped << (!first ? "," : "") << element; - first = false; - } - return wrapped << '}'; -} - - -//#endif // __STL_WRAPPERS_H__ - - -// Local Variables: -// mode:C++ -// c-basic-offset:3 -// indent-tabs-mode:nil -// End: - diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/test_orbits.cc b/coxeter_group_orbits/RobertRaoul/coxeter_test/test_orbits.cc deleted file mode 100644 index d061d0c..0000000 --- a/coxeter_group_orbits/RobertRaoul/coxeter_test/test_orbits.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright (c) 2015 - Julian Pfeifle - julian.pfeifle@upc.edu - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version: http://www.gnu.org/licenses/gpl.txt. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. --------------------------------------------------------------------------------- -*/ - -#define BOOST_TEST_MODULE orbits -#include - -#include "orbit.h" -#include "stl_wrappers.h" - -BOOST_AUTO_TEST_CASE( generators ) -{ - std::ostringstream oss; - oss << simple_roots_type_A(4) << std::endl - << simple_roots_type_B(4) << std::endl - << simple_roots_type_C(4) << std::endl - << simple_roots_type_D(4) << std::endl - << simple_roots_type_E6() << std::endl - << simple_roots_type_E7() << std::endl - << simple_roots_type_E8() << std::endl - << simple_roots_type_F4() << std::endl - << simple_roots_type_H3() << std::endl - << simple_roots_type_H4() << std::endl; - - BOOST_CHECK_EQUAL(oss.str(), - "{{1,-1,0,0,0},{0,1,-1,0,0},{0,0,1,-1,0},{0,0,0,1,-1}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,1}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,2}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,1,1}}\n" - "{{1,-1,0,0,0,0},{0,1,-1,0,0,0},{0,0,1,-1,0,0},{0,0,0,1,-1,0},{0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,0.866025}}\n" - "{{1,-1,0,0,0,0,0},{0,1,-1,0,0,0,0},{0,0,1,-1,0,0,0},{0,0,0,1,-1,0,0},{0,0,0,0,1,-1,0},{0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.707107}}\n" - "{{1,-1,0,0,0,0,0,0},{0,1,-1,0,0,0,0,0},{0,0,1,-1,0,0,0,0},{0,0,0,1,-1,0,0,0},{0,0,0,0,1,-1,0,0},{0,0,0,0,0,1,-1,0},{0,0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,0},{-0.5,-0.5,-0.5,-0.5}}\n" - "{{2,0,0},{-1.61803,0.618034,-1},{0,0,2}}\n" - "{{1.30902,-0.309017,-0.309017,-0.309017},{-1,1,0,0},{0,-1,1,0},{0,0,-1,1}}\n" - ); -} - -struct b3_fixture { - b3_fixture() - : generators(simple_roots('B', 3)) - {} - GeneratorList generators; -}; - -BOOST_FIXTURE_TEST_CASE( b3_orbit_012, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 3}).size(), (size_t) 48); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_12, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 3}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_02, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 2}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_01, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 0}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_0, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 0, 0}).size(), (size_t) 6); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_1, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 0}).size(), (size_t) 12); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_2, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 1}).size(), (size_t) 8); -} - - -// Local Variables: -// mode:C++ -// c-basic-offset:3 -// indent-tabs-mode:nil -// End: diff --git a/coxeter_group_orbits/RobertRaoul/coxeter_test/types.h b/coxeter_group_orbits/RobertRaoul/coxeter_test/types.h deleted file mode 100644 index 665360a..0000000 --- a/coxeter_group_orbits/RobertRaoul/coxeter_test/types.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 2015 - Julian Pfeifle - julian.pfeifle@upc.edu - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version: http://www.gnu.org/licenses/gpl.txt. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. --------------------------------------------------------------------------------- -*/ - -#ifndef __TYPES_H_ -#define __TYPES_H_ - -#include -#include - -class NotImplementedException : public std::exception {}; -class InvalidGroupException : public std::exception {}; - -typedef long double NumberType; // this might work -typedef std::vector VectorType; -typedef std::set Orbit; - -class GeneratorList : public std::vector { -public: - GeneratorList(int r, int c) - : std::vector(r) - { - for (int i=0; i #include #include @@ -28,17 +29,28 @@ string printVector(VectorType v){ int main(){ - VectorType v = {0., 0.5, 0., 0., 0., 0.5}; - GeneratorList B2 = createMatrixA(5); + + VectorType v = {0., 0., 0., 0., 0., 0., 0., 0.}; + + GeneratorList B2 = createMatrixE(8); for (int i = 0; i < B2.size(); i++){ cout << printVector(B2[i]) << endl; } cout << B2.size() << endl; + + timestamp_t t0 = get_timestamp(); + Orbit solution = orbit(B2, v); + + timestamp_t t1 = get_timestamp(); + cout << "size: " << solution.size() << endl; - for(auto s : solution){ - cout << printVector(s) << endl; - } + cout << "time: " << (t1 - t0) / 1000000.0L << "secs" << endl; + cout << "time: " << (t1 - t0) / 60000000.0L << "mins" << endl; + + // for(auto s : solution){ + // cout << printVector(s) << endl; + // } /* VectorType normal = { 16, -1, -0.5}; diff --git a/coxeter_group_orbits/RobertRaoul/orbit.h b/coxeter_group_orbits/RobertRaoul/orbit.h index 5d2a25a..7c7cee9 100644 --- a/coxeter_group_orbits/RobertRaoul/orbit.h +++ b/coxeter_group_orbits/RobertRaoul/orbit.h @@ -29,13 +29,25 @@ #include #include #include +#include + +typedef unsigned long long timestamp_t; +static timestamp_t +get_timestamp (){ + struct timeval now; + gettimeofday (&now, NULL); + return now.tv_usec + (timestamp_t)now.tv_sec * 1000000; +} + + + class NotImplementedException : public std::exception {}; typedef double E; -const static E epsilon = 0.001; +const static E epsilon = 0.0001; class coxeterVector : public std::vector{ @@ -50,17 +62,38 @@ class coxeterVector : public std::vector{ : std::vector(init) {} - bool operator==(const coxeterVector& rhs) const { - E sum =0; + + bool operator==(const coxeterVector& rhs) const + { coxeterVector a(*this); - for (int i =0; i < rhs.size(); i++) { - a[i] -= rhs[i]; - sum += a[i]*a[i]; + for ( int i = 0; i < rhs.size() ; i++) { + if ( a[i] < rhs[i] - epsilon || a[i] > rhs[i] + epsilon ) + return false; } - return (sum < epsilon); - + return true; } + bool operator < (const coxeterVector& rhs) const + { + for ( int i = 0; i < rhs.size() ; i++) { + if ( this->at(i) < rhs[i] - epsilon ) { + return true; + } else { + if ( this->at(i) > rhs[i] + epsilon ) + return false; + } + } + return false; + } + + friend std::ostream& operator << (std::ostream& os, const coxeterVector& v) + { + for (const auto& x : v) + os << x << " "; + return os; + } + + }; @@ -130,41 +163,134 @@ GeneratorList createMatrixA(int dim){ return Matrix; } -GeneratorList createMatrixEsix(){ - GeneratorList Matrix = { - {1.,-1.,0.,0.,0.,0.}, - {0.,1.,-1.,0.,0.,0.}, - {0.,0.,1.,-1.,0.,0.}, - {0.,0.,0.,1.,1.,0.}, - {-.5,-.5,-.5,-.5,-.5,sqrt(3)/2}, - {0.,0.,0.,1.,-1.,0.}, - }; +GeneratorList createMatrixE(int dim) +{ + GeneratorList Matrix; + for ( int i = 0 ; i < dim-2 ; i++ ) { + VectorType vec(dim); + vec[i]=1; + vec[i+1]=-1; + Matrix.push_back(vec); + } + if (dim == 6) + Matrix.push_back({-0.5,-0.5,-0.5,-0.5,-0.5,sqrt(3)/2.}); + if (dim == 7) + Matrix.push_back({-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,sqrt(2)/2.}); + if (dim == 8) + Matrix.push_back({-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5}); + VectorType vec1 (dim); vec1[dim-3] = 1; vec1[dim-2] = 1; + Matrix.push_back(vec1); return Matrix; } +GeneratorList createMatrixF(){ + GeneratorList Matrix={ {0.5,-0.5,-0.5,-0.5} , + {0.,1.,-1.,0.}, + {0.,0.,1.,-1.}, + {0.,0.,0.,1.} + }; + return Matrix; +} + +GeneratorList createMatrixG(){ + GeneratorList Matrix= { {0.,1.,-1.}, + {1.,-2.,1.} }; + return Matrix; +} + +GeneratorList createMatrixI(int dim) +{ + GeneratorList Matrix {{1., 0.},{0.,1.}}; + double cosine = cos(M_PI/dim); + Matrix[1][0]= cosine/sqrt(1.0-pow(cosine, 2)); + return Matrix; +} + +GeneratorList createMatrixD(){ + GeneratorList Matrix ={ + {1.,-1.,0.,0.}, + {0.,1.,-1.,0.}, + {0.,0.,1.,-1.}, + {0.,0.,1.,1.} + }; + return Matrix; +} + GeneratorList simple_roots(char type, int dim) { switch(type) { - case 'B': - return createMatrixB(dim); case 'A': - return createMatrixA(dim); - + if (dim > 0) + return createMatrixA(dim); + else throw new NotImplementedException(); + case 'B': + if (dim > 0) + return createMatrixB(dim); + else throw new NotImplementedException(); + case 'C': + if (dim > 0) + return createMatrixB(dim); + else throw new NotImplementedException(); + case 'D': + if (dim > 4) throw new NotImplementedException(); + else throw new NotImplementedException(); + case 'E': + if (dim == 6) + return createMatrixE(dim); + else if (dim == 7) + return createMatrixE(dim); + else if (dim == 8) + return createMatrixE(dim); + else throw new NotImplementedException(); + case 'F': + if (dim == 4) return createMatrixF(); + throw new NotImplementedException(); + case 'G': + if (dim == 2) return createMatrixG(); + throw new NotImplementedException(); + case 'H': + if (dim == 2) throw new NotImplementedException(); + if (dim == 3) throw new NotImplementedException(); + if (dim == 4) throw new NotImplementedException(); + else throw new NotImplementedException(); + case 'I': + if (dim < 1) throw new NotImplementedException(); + else return createMatrixI(dim); default: throw new NotImplementedException(); } } -void recursion(const GeneratorList& generators, VectorType v, int counter){ + +Orbit orbit(const GeneratorList& generators, const VectorType& v ) +{ + Orbit orb; + Orbit tmpPoints {v}; + while (tmpPoints.empty() == false ){ + Orbit::iterator it = tmpPoints.begin(); + VectorType vec = *it; + tmpPoints.erase(it); + if ( std::get<1>(orb.insert(vec)) ){ + //std::cout << vec << '\n'; + for (int i = 0 ; i < generators.size() ; i++) + tmpPoints.insert(reflection(generators[i], vec)); + } // endif + } // endwhile + return orb; +} + + + +/*void recursion(const GeneratorList& generators, VectorType v, int counter){ for(int i = 0; i < generators.size(); i++){ - std:: cout << i << std::endl; + //std:: cout << i << std::endl; if (orbitSet.find(reflection(generators[i], v)) == orbitSet.end()) { //orbitSet contains reflection(generators[i], v) orbitSet.insert(reflection(generators[i], v)); counter += 1; - std::cout << "counter " << counter << std::endl; + //std::cout << "counter " << counter << std::endl; recursion(generators, reflection(generators[i], v), counter); } } @@ -176,7 +302,7 @@ Orbit orbit(const GeneratorList& generators, const VectorType& v) orbitSet.insert(v); recursion(generators,v,0); return orbitSet; -} +}*/ #endif // __ORBIT_H_ diff --git a/coxeter_group_orbits/RobertRaoul/test_orbits.cc b/coxeter_group_orbits/RobertRaoul/test_orbits.cc deleted file mode 100644 index 9e4bb22..0000000 --- a/coxeter_group_orbits/RobertRaoul/test_orbits.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright (c) 2015 - Julian Pfeifle - julian.pfeifle@upc.edu - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 3, or (at your option) any - later version: http://www.gnu.org/licenses/gpl.txt. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -------------------------------------------------------------------------------- - */ - -#define BOOST_TEST_MODULE orbits -#include - -#include "orbit.h" -#include "stl_wrappers.h" - -BOOST_AUTO_TEST_CASE( generators ) -{ - std::ostringstream oss; - oss << simple_roots_type_A(4) << std::endl - << simple_roots_type_B(4) << std::endl - << simple_roots_type_C(4) << std::endl - << simple_roots_type_D(4) << std::endl - << simple_roots_type_E6() << std::endl - << simple_roots_type_E7() << std::endl - << simple_roots_type_E8() << std::endl - << simple_roots_type_F4() << std::endl - << simple_roots_type_H3() << std::endl - << simple_roots_type_H4() << std::endl; - - BOOST_CHECK_EQUAL(oss.str(), - "{{1,-1,0,0,0},{0,1,-1,0,0},{0,0,1,-1,0},{0,0,0,1,-1}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,1}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,0,2}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,-1},{0,0,1,1}}\n" - "{{1,-1,0,0,0,0},{0,1,-1,0,0,0},{0,0,1,-1,0,0},{0,0,0,1,-1,0},{0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,0.866025}}\n" - "{{1,-1,0,0,0,0,0},{0,1,-1,0,0,0,0},{0,0,1,-1,0,0,0},{0,0,0,1,-1,0,0},{0,0,0,0,1,-1,0},{0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.707107}}\n" - "{{1,-1,0,0,0,0,0,0},{0,1,-1,0,0,0,0,0},{0,0,1,-1,0,0,0,0},{0,0,0,1,-1,0,0,0},{0,0,0,0,1,-1,0,0},{0,0,0,0,0,1,-1,0},{0,0,0,0,0,1,1,0},{-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5}}\n" - "{{1,-1,0,0},{0,1,-1,0},{0,0,1,0},{-0.5,-0.5,-0.5,-0.5}}\n" - "{{2,0,0},{-1.61803,0.618034,-1},{0,0,2}}\n" - "{{1.30902,-0.309017,-0.309017,-0.309017},{-1,1,0,0},{0,-1,1,0},{0,0,-1,1}}\n" - ); -} - -struct b3_fixture { - b3_fixture() - : generators(simple_roots('B', 3)) - {} - GeneratorList generators; -}; - -BOOST_FIXTURE_TEST_CASE( b3_orbit_012, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 3}).size(), (size_t) 48); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_12, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 3}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_02, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 2}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_01, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 2, 0}).size(), (size_t) 24); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_0, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 0, 0}).size(), (size_t) 6); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_1, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 0}).size(), (size_t) 12); -} - -BOOST_FIXTURE_TEST_CASE( b3_orbit_2, b3_fixture ) -{ - BOOST_CHECK_EQUAL(orbit(generators, {1, 1, 1}).size(), (size_t) 8); -} - - -// Local Variables: -// mode:C++ -// c-basic-offset:3 -// indent-tabs-mode:nil -// End: From e7f4aac54d9d3abcf3ef7fc7e93f515bb1463032 Mon Sep 17 00:00:00 2001 From: robertloewe Date: Thu, 18 Jun 2015 14:07:21 +0200 Subject: [PATCH 10/10] committed2 --- .DS_Store | Bin 6148 -> 6148 bytes coxeter_group_orbits/.DS_Store | Bin 6148 -> 6148 bytes coxeter_group_orbits/RobertRaoul/main.cpp | 14 ++++---- coxeter_group_orbits/RobertRaoul/orbit.h | 40 ++++++++++++++++++---- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/.DS_Store b/.DS_Store index 5419ab93eed77b96f70d7e39e4852b9b167613af..5be2eb9ccfb1e66d9c89b0e871ecbaf8035616e4 100644 GIT binary patch delta 20 bcmZoMXffFEk%`^Vz)(j)*KqR>CLU1$M#lyn delta 20 bcmZoMXffFEk%`^N)Ko{o$b9n;CLU1$M|lP^ diff --git a/coxeter_group_orbits/.DS_Store b/coxeter_group_orbits/.DS_Store index 5364cd43ae226e589c36cb045e9d4fc65867f1c2..201a43d44c9001b7e7f7c16f0c6be8dc5cdfeec3 100644 GIT binary patch delta 20 bcmZoMXffDupM~Afz)(j)*KqSQ7CB)6MYRSE delta 20 bcmZoMXffDupM~AX)Ko{o$b9oN7CB)6MrQ^h diff --git a/coxeter_group_orbits/RobertRaoul/main.cpp b/coxeter_group_orbits/RobertRaoul/main.cpp index 2a2a341..76d9b8c 100644 --- a/coxeter_group_orbits/RobertRaoul/main.cpp +++ b/coxeter_group_orbits/RobertRaoul/main.cpp @@ -29,10 +29,10 @@ string printVector(VectorType v){ int main(){ - - VectorType v = {0., 0., 0., 0., 0., 0., 0., 0.}; - GeneratorList B2 = createMatrixE(8); + VectorType v = {/*0.3, -0.123, 17.9, 42.3,*/0., 0., 0., 0.}; + + GeneratorList B2 = createMatrixH4(); for (int i = 0; i < B2.size(); i++){ cout << printVector(B2[i]) << endl; } @@ -43,14 +43,14 @@ int main(){ Orbit solution = orbit(B2, v); timestamp_t t1 = get_timestamp(); - + cout << "size: " << solution.size() << endl; cout << "time: " << (t1 - t0) / 1000000.0L << "secs" << endl; cout << "time: " << (t1 - t0) / 60000000.0L << "mins" << endl; - // for(auto s : solution){ - // cout << printVector(s) << endl; - // } + // for(auto s : solution){ + // cout << printVector(s) << endl; + // } /* VectorType normal = { 16, -1, -0.5}; diff --git a/coxeter_group_orbits/RobertRaoul/orbit.h b/coxeter_group_orbits/RobertRaoul/orbit.h index 7c7cee9..d69793d 100644 --- a/coxeter_group_orbits/RobertRaoul/orbit.h +++ b/coxeter_group_orbits/RobertRaoul/orbit.h @@ -207,17 +207,43 @@ GeneratorList createMatrixI(int dim) return Matrix; } -GeneratorList createMatrixD(){ - GeneratorList Matrix ={ - {1.,-1.,0.,0.}, - {0.,1.,-1.,0.}, - {0.,0.,1.,-1.}, - {0.,0.,1.,1.} - }; +GeneratorList createMatrixD(int dim) + { + VectorType v(dim); + v[dim - 2] = v[dim - 1] = 1; + GeneratorList list = createMatrixA(dim - 1); + std::cout << list.back() << '\n'; + list.push_back(v); + return list; + } + + +GeneratorList createMatrixH3() +{ + const NumberType tau(0.5 + 0.5 * sqrt(5)); + GeneratorList Matrix = {{2., 0., 0.}, + {-tau, 1./tau , -1.}, + {0., 0., 2.}}; + return Matrix; +} + + + +GeneratorList createMatrixH4() +{ + const NumberType tau(0.5 + 0.5 * sqrt(5)); + std::cout << "bl2" << std::endl; + GeneratorList Matrix = {{tau, 1./tau, 1./tau, 1./tau}, + {-1., 1., 0., 0.}, + {0., -1., 1., 0.}, + {0., 0., -1., 1.}}; return Matrix; + } + + GeneratorList simple_roots(char type, int dim) { switch(type) {