49 #ifndef PRIVATE_MODULAR_CH 51 #ifndef MODULAR_NUMBER_TYPE 52 #error "MODULAR_NUMBER_TYPE must be defined" 55 #ifdef MODULAR_FIXED_SIZE 56 # define N MODULAR_FIXED_SIZE 57 # define MATRIX_ELEM(mat, i, j) (mat[i][j]) 59 # define MATRIX_ELEM(mat, i, j) (mat[i * N + j]) 60 #endif // MODULAR_FIXED_SIZE 64 #define modMult(a, s, c, m) ((MODULAR_NUMBER_TYPE)(((cl_ulong) a * s + c) % m)) 66 static MODULAR_NUMBER_TYPE
modMult(MODULAR_NUMBER_TYPE a, MODULAR_NUMBER_TYPE s, MODULAR_NUMBER_TYPE c, MODULAR_NUMBER_TYPE
m)
68 MODULAR_NUMBER_TYPE v;
69 v = (MODULAR_NUMBER_TYPE) (((cl_ulong) a * s + c) %
m);
78 #ifdef MODULAR_FIXED_SIZE 79 static void modMatVec (MODULAR_NUMBER_TYPE A[N][N], MODULAR_NUMBER_TYPE s[N], MODULAR_NUMBER_TYPE v[N], MODULAR_NUMBER_TYPE
m)
81 void modMatVec (
size_t N, MODULAR_NUMBER_TYPE* A, MODULAR_NUMBER_TYPE* s, MODULAR_NUMBER_TYPE* v, MODULAR_NUMBER_TYPE
m)
84 MODULAR_NUMBER_TYPE x[MODULAR_FIXED_SIZE];
85 for (
size_t i = 0; i < N; ++i) {
87 for (
size_t j = 0; j < N; j++)
90 for (
size_t i = 0; i < N; ++i)
#define MATRIX_ELEM(mat, i, j)
Definition: modular.c.h:59
void modMatVec(size_t N, MODULAR_NUMBER_TYPE *A, MODULAR_NUMBER_TYPE *s, MODULAR_NUMBER_TYPE *v, MODULAR_NUMBER_TYPE m)
Matrix-vector modular multiplication.
Definition: modular.c.h:81
#define modMult(a, s, c, m)
Compute (a*s + c) % m.
Definition: modular.c.h:64
m
Definition: genn_model.py:117