R package can now be installed (compilation OK)
[valse.git] / src / sources / utils.h
CommitLineData
8e92c49c
BA
1#ifndef valse_utils_H
2#define valse_utils_H
3
4/*******************
5 * tune parallelism
6 *******************/
7
8// Number of OpenMP threads
9#define OMP_NUM_THREADS 8
10
11// CHUNK_SIZE = number of lambda values to be treated sequentially by a single core
12#define CHUNK_SIZE 1
13
14/*******************************
15 * Matrix and arrays indexation
16 *******************************/
17
18// Matrix Index ; TODO? ncol unused
19#define mi(i,j,nrow,ncol)\
20 j*nrow + i
21
22// Array Index ; TODO? d3 unused
23#define ai(i,j,k,d1,d2,d3)\
24 k*d1*d2 + j*d1 + i
25
26// Array4 Index ; TODO? ...
27#define ai4(i,j,k,m,d1,d2,d3,d4)\
28 m*d1*d2*d3 + k*d1*d2 + j*d1 + i
29
30// Array5 Index ; TODO? ...
31#define ai5(i,j,k,m,n,d1,d2,d3,d4,d5)\
32 n*d1*d2*d3*d4 + m*d1*d2*d3 + k*d1*d2 + j*d1 + i
33
34/*************************
35 * Array copy & "zeroing"
36 ************************/
37
38// Fill an array with zeros
39#define zeroArray(array, size)\
40{\
41 for (int u=0; u<size; u++)\
42 array[u] = 0;\
43}
44
45// Copy an 1D array
46#define copyArray(array, copy, size)\
47{\
48 for (int u=0; u<size; u++)\
49 copy[u] = array[u];\
50}
51
52#endif