/******************************************************************************* * * TRIQS: a Toolbox for Research in Interacting Quantum Systems * * Copyright (C) 2011 by O. Parcollet * * TRIQS 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 of the License, or (at your option) any later * version. * * TRIQS 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. * * You should have received a copy of the GNU General Public License along with * TRIQS. If not, see . * ******************************************************************************/ #include "./common.hpp" #include #include using namespace triqs::arrays; using namespace triqs::arrays::permutations; template struct P { static constexpr ull value = F; friend std::ostream & operator <<( std::ostream & out, P const & s) { //out << "Permutation of size " << permutations::size(s.value) << " : "<< std::hex; out << std::hex; s.print(out, std::integral_constant()); return out << std::dec; } template void print( std::ostream & out, std::integral_constant) const { out << apply(this->value,c); print(out, std::integral_constant());} void print( std::ostream & out, std::integral_constant) const {} }; int main(int argc, char **argv) { constexpr auto p0= permutation(0,1); constexpr auto p= permutation(0,2,1); constexpr auto p2= permutation(2,1,0,3); constexpr auto pc= permutation(1,2,3,0); std::cout << P() << std::endl; std::cout << P() << std::endl; std::cout << P

() << std::endl; std::cout << P() << std::endl; std::cout << P() << std::endl; #define COMPOSE(P1,P2)\ std::cout << " composing " << P() << " and "<< P() << " = "<< P() << std::endl ; #define INVERSE(P1)\ std::cout << "inverse of "<< P() << " = "<< P() << std::endl;\ std::cout << " checking "<< P() << std::endl; COMPOSE(p,p); COMPOSE(p2,p2); INVERSE(p); INVERSE(p2); INVERSE(pc); #define ID(n)\ std::cout << " identity :" << P() << std::endl ;\ std::cout << " ridentity :" << P() << std::endl<