ソースを参照

Trnsform semigroup struct into a class

Jean Fromentin 1 年間 前
コミット
27678c3c0d
4 ファイル変更25 行追加6 行削除
  1. 2 2
      c++/Makefile
  2. 2 2
      c++/src/config.hpp
  3. 14 0
      c++/src/semigroup.cpp
  4. 7 2
      c++/src/semigroup.hpp

+ 2 - 2
c++/Makefile

@@ -3,8 +3,8 @@ EXE_S 		= wilf-server
 EXE_I 		= wilf-interface
 EXE_A   	= wilf-alone
 EXE_C		= wilf-cilk
-CPP 		= g++-6  -g
-CPP_CILK	= g++-6 -g
+CPP 		= g++-7  -g
+CPP_CILK	= g++-7 -g
 CFLAGS		= --std=c++11 -march=corei7 -O3 -DNDEBUG
 
 all: $(EXE_S) $(EXE_W) $(EXE_I) $(EXE_A) $(EXE_C)

+ 2 - 2
c++/src/config.hpp

@@ -10,9 +10,9 @@ using namespace std;
 #define MAX_CLIENTS 2048
 #define MAX_WORKERS 2048
 
-#define MAX_GENUS 40
+#define MAX_GENUS 100
 #define STACK_BOUND 10
-#define CILK_WORKERS "128"
+#define CILK_WORKERS "8"
 #define K_MANUEL 4
 
 

+ 14 - 0
c++/src/semigroup.cpp

@@ -2,6 +2,20 @@
 #include <cstring>
 #include "semigroup.hpp"
 
+Semigroup::Semigroup(const Semigroup& S){
+  for(auto i=0;i<NBLOCKS;++i){
+    blocks[i]=S.blocks[i];
+  }
+  conductor=S.conductor;
+  min=S.min;
+  genus=S.genus;
+  left_primitive=S.left_primitive;
+  left=S.left;
+  e=S.e;
+  wilf=S.wilf;
+}
+
+
 void init_full_N(Semigroup &m){
   epi8 block ={1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8};
   for(auto i=0; i<NBLOCKS; i++){

+ 7 - 2
c++/src/semigroup.hpp

@@ -22,16 +22,21 @@ typedef uint_fast64_t ind_t;  // The type used for array indexes
 
 using namespace std;
 
-struct Semigroup
-{
+class Semigroup{
+public:
   union {
     dec_numbers decs;
     dec_blocks blocks;
   };
   // Dont use char as they have to be promoted to 64 bits to do pointer arithmetic.
   ind_t conductor, min, genus,left_primitive,left,e,wilf;
+  Semigroup();
+  Semigroup(const Semigroup& S);
 };
 
+inline Semigroup::Semigroup(){
+}
+
 void init_full_N(Semigroup &);
 void init(Semigroup&,char,char,char,char*);
 void print_Semigroup(const Semigroup &);