proj home

Files   Classes   Functions   Hierarchy  

binoppropertiestest Class Reference

Test binopproperties and permutationfunc classes. More...

#include <binoppropertiestest.h>

Collaboration diagram for binoppropertiestest:

List of all members.

Static Public Member Functions

static void test01 ()
 User prompted to apply two operators in fop.
static void test02 ()
 Generate the Binary Operator Table for the triangles with rotation and flipping.
static void test03 ()
 Test given a perm find its integer index.
static void test04 ()
 Investigating (i+k) mod 6.
static void test05 ()
 Test if flipping a triange and rotating it form a group.

Static Public Attributes

static uint fop []
 Triangle rotation and flip operators.


Detailed Description

Test binopproperties and permutationfunc classes.

Definition at line 9 of file binoppropertiestest.h.


Member Function Documentation

void binoppropertiestest::test01 (  )  [static]

User prompted to apply two operators in fop.

Definition at line 20 of file binoppropertiestest.cpp.

References fop.

Referenced by main().

00021 {
00022   cout << "Enter i k to calculate  k(i(w)). " << endl;
00023   uint i;
00024   uint k;
00025 
00026   //i=1; k=3;
00027   cin >> i;
00028   cin >> k;
00029 
00030   uint x[3];
00031 
00032   for (uint w=0; w<3; ++w)
00033     x[w] = fop[i*3+w];
00034 
00035   for (uint w=0; w<3; ++w)
00036     cout << x[w] << " ";
00037   cout << endl; 
00038 
00039   uint x2[3];
00040   
00041   for (uint w=0; w<3; ++w)
00042     x2[w] = fop[ i*3 + fop[ k*3 + w ] ];
00043 
00044   for (uint w=0; w<3; ++w)
00045     cout << x2[w] << " ";
00046   cout << endl; 
00047 
00048 }

void binoppropertiestest::test02 (  )  [static]

Generate the Binary Operator Table for the triangles with rotation and flipping.

Definition at line 51 of file binoppropertiestest.cpp.

References fop.

Referenced by main().

00052 {
00053   cout << "Generate the Binary Operator Table" << endl;
00054 
00055   uint x2[3];
00056 
00057   for (uint i=0; i<6; ++i)
00058   {
00059     for (uint k=0; k<6; ++k)
00060     { 
00061       cout << "{";
00062       for (uint w=0; w<3; ++w)
00063       {
00064         x2[w] = fop[ i*3 + fop[ k*3 + w ] ];
00065         cout << x2[w] << " "; 
00066       }
00067       cout << "}";
00068     }
00069     cout << endl;
00070   }
00071 
00072 }

void binoppropertiestest::test03 (  )  [static]

Test given a perm find its integer index.

Definition at line 75 of file binoppropertiestest.cpp.

References fop, and permutationfunc::inverse().

Referenced by main().

00076 {
00077   permutationfunc pf(fop,6,3);
00078 
00079   uint k;
00080 
00081   bool found;
00082   cout << "Test the inverse function" << endl;
00083   cout << "Iterate over the states, the numbers 0..5 should";
00084   cout <<  " be displayed where the state is matched with an";
00085   cout <<  " integer." << endl;
00086   for (uint i=0; i<6; ++i)
00087   {
00088     k = pf.inverse(found,fop + 3*i);
00089     cout << k << endl;
00090   }
00091 
00092   cout << endl << endl;
00093 }

void binoppropertiestest::test04 (  )  [static]

Investigating (i+k) mod 6.

Definition at line 96 of file binoppropertiestest.cpp.

References binopproperties::identityfind(), binopproperties::isAssociative(), binopproperties::isClosed(), binopproperties::isCommutative(), and binopproperties::isGroup().

Referenced by main().

00097 {
00098   cout << "Investigating (i+k) mod 6." << endl;
00099   uint mat[] = 
00100   {
00101     0,1,2,3,4,5,
00102     1,2,3,4,5,0,
00103     2,3,4,5,0,1,
00104     3,4,5,0,1,2,
00105     4,5,0,1,2,3,
00106     5,0,1,2,3,4
00107   };
00108 
00109   binopproperties gt(mat,6);
00110 
00111   cout << "isClosed()=" << gt.isClosed() << endl;
00112   cout << "isCommutative()=" << gt.isCommutative() << endl;
00113   cout << "isAssociative()=" << gt.isAssociative() << endl;
00114   cout << "isGroup()=" << gt.isGroup() << endl;
00115   bool found;
00116   cout << "identityfind(found)=" << gt.identityfind(found) << endl;
00117   cout << "  found=" << found << endl;
00118 }

void binoppropertiestest::test05 (  )  [static]

Test if flipping a triange and rotating it form a group.

Definition at line 121 of file binoppropertiestest.cpp.

References fop, binopproperties::identityfind(), binopproperties::isAssociative(), binopproperties::isClosed(), binopproperties::isCommutative(), binopproperties::isGroup(), and permutationfunc::writeBinaryOperator().

Referenced by main().

00122 {
00123   cout << "Test if flipping a triange and rotating it form a group." << endl;
00124 
00125   cout << "The rotation and flip operators described by 6 permutation." << endl;
00126 
00127   permutationfunc pf(fop,6,3);
00128 
00129   cout << "Generate the binary table from the operators." << endl;
00130 
00131   uint mat[6*6];
00132 
00133   bool result;
00134   pf.writeBinaryOperator(result,mat);
00135   if (result==false)
00136   {
00137     cout << "Failed to form a binary operator." << endl;
00138     return;
00139   }
00140 
00141   for (uint i=0; i<6; ++i)
00142   {
00143     for (uint k=0; k<6; ++k)
00144     { 
00145       cout << " ";
00146       cout << mat[i*6+k];
00147       cout << " ";
00148     }
00149     cout << endl;
00150   }
00151 
00152   binopproperties gt(mat,6);
00153 
00154   cout << "isClosed()=" << gt.isClosed() << endl;
00155   cout << "isCommutative()=" << gt.isCommutative() << endl;
00156   cout << "isAssociative()=" << gt.isAssociative() << endl;
00157   cout << "isGroup()=" << gt.isGroup() << endl;
00158   bool found;
00159   cout << "identityfind(found)=" << gt.identityfind(found) << endl;
00160   cout << "  found=" << found << endl;
00161 }


Member Data Documentation

Initial value:

 
{
  0,1,2,
  1,2,0,
  2,0,1,
  0,2,1,
  2,1,0,
  1,0,2
}
Triangle rotation and flip operators.

Definition at line 14 of file binoppropertiestest.h.

Referenced by test01(), test02(), test03(), and test05().


The documentation for this class was generated from the following files:

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