diff --git a/permutation.cc b/permutation.cc index 5707eae..2663b7b 100644 --- a/permutation.cc +++ b/permutation.cc @@ -2077,6 +2077,11 @@ for(int i=1; i +template template //this works +void NRPerm::testik(U u) +{ +} /***************************************************************************//** * forced instantization in the corresponding object file diff --git a/permutation.h b/permutation.h index 7408492..629af6c 100644 --- a/permutation.h +++ b/permutation.h @@ -28,6 +28,7 @@ typedef unsigned long long PERM_RANK_TYPE; //permutations are always numbered from 1; offset is employed when applied to vectors and matrices +//TODO@@@ change the functions with PermutationAlgebra to nested T,U template functions for PermutationAlgebra namespace LA { @@ -76,6 +77,7 @@ public: PERM_RANK_TYPE generate_all(void (*callback)(const NRPerm&), int parity_select=0); //Algorithm L from Knuth's vol.4, efficient but not in lex order! PermutationAlgebra list_all(int parity_select=0); PermutationAlgebra list_all_lex(); + template void testik(U u); //demostrate that in .cc one has to declare the nested templates separately PERM_RANK_TYPE generate_all_multi(void (*callback)(const NRPerm&)); //Algorithm L2 from Knuth's vol.4, for a multiset (repeated numbers, not really permutations) PERM_RANK_TYPE generate_all2(void (*callback)(const NRPerm&)); //recursive method, also not lexicographic PERM_RANK_TYPE generate_all_lex(void (*callback)(const NRPerm&)); //generate in lex order using next() @@ -179,6 +181,8 @@ public: PermutationAlgebra() {}; PermutationAlgebra(int n) : NRVec >(n) {}; PermutationAlgebra(const NRVec > &x) : NRVec >(x) {}; + template PermutationAlgebra(const PermutationAlgebra &rhs) : NRVec >(rhs.size()) + {for(int i=0; i >::size();}; void copyonwrite() {NRVec >::copyonwrite();}; int sort(int direction = 0, int from = 0, int to = -1, int *permut = NULL, bool stable=false) {return NRVec >::sort(direction,from, to,permut,stable);}; @@ -403,6 +407,16 @@ NRMat RegularRepresentation(const PermutationAlgebra &a, const NRMat PermutationAlgebra general_antisymmetrizer(const NRVec > &groups, int restriction_type=0, bool inverted=false); +template +void cast_permutation_algebra(PermutationAlgebra &lhs, const PermutationAlgebra &rhs) +{ +lhs.resize(rhs.size()); +for(int i=0; i