Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Added a comentary given credit to the author of CSDP library. At the
[simgrid.git] / include / csdp / index.h
1 /*
2   This file is part of the CSDP 5.0 package developed by Dr. Brian Borchers.
3   Which can be distributed under the LGPL licence. The source code and 
4   manual can be downloaded at http://euler.nmt.edu/~brian/csdp.html.
5
6   Declarations needed to handle indexing into Fortran arrays and packed
7   arrays.
8 */
9
10 #ifndef BIT64
11
12 /*
13   First, to convert fortran i,j indices into a C vector index.
14 */
15
16 #define ijtok(iiii,jjjj,lda) ((jjjj-1)*lda+iiii-1)
17
18 /* 
19    Packed indexing.
20  */
21
22 #define ijtokp(iii,jjj,lda) ((iii+jjj*(jjj-1)/2)-1)
23
24 /*
25   Next, to convert C vector index into Fortran i,j indices.
26 */
27
28 #define ktoi(k,lda) ((k % lda)+1)
29 #define ktoj(k,lda) ((k/lda)+1)
30
31 #else
32
33 /*
34   First, to convert fortran i,j indices into a C vector index.
35 */
36
37 #define ijtok(iiii,jjjj,lda) ((jjjj-1L)*lda+iiii-1L)
38
39 /* 
40    Packed indexing.
41  */
42
43 #define ijtokp(iii,jjj,lda) (((long int)iii+(long int)jjj*(jjj-1L)/2-1L))
44
45 /*
46   Next, to convert C vector index into Fortran i,j indices.
47 */
48
49 #define ktoi(k,lda) (((long int)k % lda)+1L)
50 #define ktoj(k,lda) (((long int)k/lda)+1L)
51
52
53 #endif
54