Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

gf.h

Go to the documentation of this file.
00001 #ifndef __galoisgf_h
00002 #define __galoisgf_h
00003 
00004 #include <binary.h>
00005 #include <vector.h>
00006 #include <matrix.h>
00007 #include <array1d.h>
00008 #include <array2d.h>
00009 #include <iostream>
00010 #include <cassert>
00011 namespace SPUC {
00019 class gf {
00020  public:
00022     gf()  
00023                 {
00024                         for (int j=0;j<15;j++) q[j] = (1 << j);
00025                         m=0;
00026                 }
00028     gf(int qvalue) { 
00029                 m=0; 
00030                 for (int j=0;j<15;j++) q[j] = (1 << j);
00031                 if (qvalue==0) // qvalue==0 gives the zeroth element
00032                         value=-1; else set_size(qvalue); 
00033         }
00035     gf(int qvalue, int inexp) { 
00036                 m=0; 
00037                 for (int j=0;j<15;j++) q[j] = (1 << j);
00038                 set(qvalue,inexp); 
00039         }
00041     gf(const gf &ingf) {
00042                 for (int j=0;j<15;j++) q[j] = (1 << j);
00043                 m=ingf.m; value=ingf.value; 
00044         }
00046     void set(int qvalue, int inexp) {
00047                 set_size(qvalue); 
00048                 value=inexp;
00049         }
00054     void set(int qvalue, const bvec &vectorspace);
00056     void set_size(int qvalue);
00058     int get_size() const { return ( (m != 0) ? q[m] : 0 ); }
00059 
00065     bvec get_vectorspace() const;
00067     int  get_value() const;
00069     int operator==(const gf &ingf) const;
00071     int operator!=(const gf &ingf) const;
00072   
00074     void operator=(const gf &ingf);
00076     void operator=(const int inexp);
00078     void operator+=(const gf &ingf);
00080     gf operator+(const gf &ingf) const;
00082     void operator-=(const gf &ingf);
00084     gf operator-(const gf &ingf) const;
00086     void operator*=(const gf &ingf);
00088     gf operator*(const gf &ingf) const;
00090     void operator/=(const gf &ingf);
00092     gf operator/(const gf &ingf) const;
00094     friend ostream &operator<<(ostream &os, const gf &ingf);
00095 
00096  protected:
00097  private:
00098     char m;
00099     int value;
00100     Array2D<int> alphapow,logalpha;
00101     static ivec q;
00102 };
00103 
00104 } // namespace SPUC 
00105 #endif // __galois_h

Generated on Fri Sep 16 11:02:19 2005 for spuc by  doxygen 1.4.4