Skip to content
Snippets Groups Projects
Commit f775bba0 authored by Radek Hušek's avatar Radek Hušek Committed by Radek Hušek
Browse files

Split ring definitions into separate file

parent ec94a288
No related branches found
No related tags found
No related merge requests found
default: groupConnectivity.so clean_obj
groupConnectivity.so: groupConnectivity.pyx group-connectivity.h setup.py compileTimeOptions.h parmap.py
groupConnectivity.so: groupConnectivity.pyx group-connectivity.h setup.py compileTimeOptions.h rings.h parmap.py
python setup.py build_ext
cp build/lib*/groupConnectivity.so .
......
#ifndef __GROUP_CONNECTIVITY_H__
#define __GROUP_CONNECTIVITY_H__
#include <vector>
#include "compileTimeOptions.h"
#include "rings.h"
namespace Ring {
#define MakeRing(Name, Size, Plus, Negate, Multiply, One) \
template < typename T_ > struct Name { \
typedef T_ T; \
enum { size = Size }; \
static T plus(T a, T b) { return Plus; } \
static T negate(T a) { return Negate; } \
static T multiply(T a, T b) { return Multiply; } \
static const T one = One; \
static const T zero = 0; \
}
MakeRing(Z5, 5, (a + b) % 5, (5 - a) % 5, (a * b) % 5, 1);
MakeRing(Z4, 4, (a + b) & 3, (4 - a) & 3, (a * b) & 3, 1);
MakeRing(Z2_2, 4, a^b, a, a&b, 3);
}
#include <vector>
typedef int EdgeId;
typedef int DirectedEdgeId;
......
rings.h 0 → 100644
#ifndef __RINGS_H__
#define __RINGS_H__
namespace Ring {
#define MakeRing(Name, Size, Plus, Negate, Multiply, One) \
template < typename T_ > struct Name { \
typedef T_ T; \
enum { size = Size }; \
static T plus(T a, T b) { return Plus; } \
static T negate(T a) { return Negate; } \
static T multiply(T a, T b) { return Multiply; } \
static const T one = One; \
static const T zero = 0; \
}
MakeRing(Z5, 5, (a + b) % 5, (5 - a) % 5, (a * b) % 5, 1);
MakeRing(Z4, 4, (a + b) & 3, (4 - a) & 3, (a * b) & 3, 1);
MakeRing(Z2_2, 4, a^b, a, a&b, 3);
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment