Fuse p, q into one contiguous index
If fortran is true, then this assumes columnwise Fortran order, i.e. the index looks like this:
1 5 2 6 3 7 4 8
Otherwise it is C-order, i.e. row major (but still one-indexed).
Note
Note that this function does preserve lexicographical ordering, if fortran == .false..
If (p_1, q_1) <= (p_2, q_2)
fuse_idx(p_1, q_1, n_dim, fortran=.false.) <= fuse_idx(p_2, q_2, fortran=.false.).
@endote
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | p |
2d-array indices |
||
| integer(kind=int64), | intent(in) | :: | q |
2d-array indices |
||
| integer(kind=int64), | intent(in) | :: | n_dim |
number of rows for Fortran (column-major), number of columns for C (row-major). |
||
| logical, | intent(in) | :: | fortran |
Use column major order |
contiguous 1d-array index