proj home

Files   Classes   Functions   Hierarchy  

permutationfunc.cpp

Go to the documentation of this file.
00001 #include <cassert>
00002 using namespace std;
00003 
00004 #include <permutationfunc.h>
00005 
00006 // Linear search to match the permutation with the
00007 //   index.
00008 uintc permutationfunc::inverse(bool & found, uintc * x) const
00009 {
00010   for (uint i=0; i<N; ++i)
00011   {
00012     found=true;
00013     for (uint k=0; k<dim; ++k)
00014     {
00015       if (x[k]!=fop[i*dim+k])
00016       {
00017         found=false;
00018         k=dim;
00019       }
00020     }
00021     
00022     if (found==false)
00023       continue;
00024 
00025     return i;
00026   }
00027 
00028   return 0;
00029 }
00030 
00031 
00032 void permutationfunc::ik(uint * x, uintc i, uintc k) const
00033 {
00034   assert(i<N);
00035   assert(k<N);
00036   for (uint w=0; w<dim; ++w)
00037     x[w] = fop[ i*dim + fop[ k*dim + w ] ];
00038 }
00039 
00040 uintc permutationfunc::ik(bool & found, uintc i, uintc k) const
00041 {
00042   uint x[dim];
00043   ik(x,i,k);
00044 
00045   return inverse(found,x);
00046 }
00047 
00048 
00049 void permutationfunc::writeBinaryOperator
00050 (
00051   bool & result, 
00052   uint * mat
00053 ) const
00054 {
00055   result=true;
00056   bool found;
00057   for (uint i=0; i<N; ++i)
00058     for (uint k=0; k<N; ++k)
00059     {
00060       mat[i*N+k] = ik(found,i,k);
00061       result &= found;
00062     }
00063 }
00064 
00065 
00066 
00067 
00068 
00069       
00070 

Generated on Fri Mar 4 00:49:28 2011 for Chelton Evans Source by  doxygen 1.5.8