PARALUTION  1.0.0
PARALUTION
matrix_formats_ind.hpp
Go to the documentation of this file.
1 #ifndef PARALUTION_MATRIX_FORMATS_IND_HPP_
2 #define PARALUTION_MATRIX_FORMATS_IND_HPP_
3 
4 // Matrix indexing
5 
6 // DENSE indexing
7 #define DENSE_IND(ai, aj, nrow, ncol) (ai) + (aj) * (nrow)
8 //#define DENSE_IND(ai, aj, nrow, ncol) (aj) + (ai) * (ncol)
9 
10 // DENSE_IND_BASE == 0 - column-major
11 // DENSE_IND_BASE == 1 - row-major
12 #define DENSE_IND_BASE (DENSE_IND(2,2,10,0) == 22 ? 0 : 1)
13 
14 // ELL indexing
15 #define ELL_IND_ROW(row, el, nrow, max_row) (el) * (nrow) + (row)
16 #define ELL_IND_EL(row, el, nrow, max_row) (el) + (max_row) * (row)
17 
18 #ifdef SUPPORT_MIC
19 #define ELL_IND(row, el, nrow, max_row) ELL_IND_EL(row, el, nrow, max_row)
20 #else
21 #define ELL_IND(row, el, nrow, max_row) ELL_IND_ROW(row, el, nrow, max_row)
22 #endif
23 
24 // DIA indexing
25 #define DIA_IND_ROW(row, el, nrow, ndiag) (el) * (nrow) + (row)
26 #define DIA_IND_EL(row, el, nrow, ndiag) (el) + (ndiag) * (row)
27 
28 #ifdef SUPPORT_MIC
29 #define DIA_IND(row, el, nrow, ndiag) DIA_IND_EL(row, el, nrow, ndiag)
30 #else
31 #define DIA_IND(row, el, nrow, ndiag) DIA_IND_ROW(row, el, nrow, ndiag)
32 #endif
33 
34 
35 #endif // PARALUTION_MATRIX_FORMATS_IND_HPP_