indexing_mod Module



Interfaces

public interface fuse_symm_idx

  • private elemental function fuse_symm_idx_int32(p, q) result(pq)

    Fuse an index

    create a composite index out of two indices, assuming they are unordered i.e. their ordering does not matter.

    Note

    Note that this function does not preserve order if we assume lexicographical ordering. If (p_1, q_1) <= (p_2, q_2), then we don’t have necessarily fuse_sym_idx(p_1, q_1) <= fuse_symm_idx(p_2, q_2). @endote

    The ordering looks like this:

    1 2 4 7 3 5 8 6 9 10

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: p

    2d-array indices

    integer(kind=int32), intent(in) :: q

    2d-array indices

    Return Value integer(kind=int32)

    1d-array index assuming the array is symmetric w.r. p<->q

  • private elemental function fuse_symm_idx_int64(p, q) result(pq)

    Fuse an index

    create a composite index out of two indices, assuming they are unordered i.e. their ordering does not matter.

    Note

    Note that this function does not preserve order if we assume lexicographical ordering. If (p_1, q_1) <= (p_2, q_2), then we don’t have necessarily fuse_sym_idx(p_1, q_1) <= fuse_symm_idx(p_2, q_2). @endote

    The ordering looks like this:

    1 2 4 7 3 5 8 6 9 10

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: p

    2d-array indices

    integer(kind=int64), intent(in) :: q

    2d-array indices

    Return Value integer(kind=int64)

    1d-array index assuming the array is symmetric w.r. p<->q

public interface inv_fuse_symm_idx

  • private elemental subroutine inv_fuse_symm_idx_int32(pq, p, q)

    Invert the fuse_symm_idx routine

    Returns index pair x <= y for the fused index xy. This assumes that the underlying matrix is symmetric, i.e. (x, y) and (y, x) map to the same xy.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: pq

    The fused index

    integer(kind=int32), intent(out) :: p

    The index pair x <= y

    integer(kind=int32), intent(out) :: q

    The index pair x <= y

  • private elemental subroutine inv_fuse_symm_idx_int64(pq, p, q)

    Invert the fuse_symm_idx routine

    Returns index pair x <= y for the fused index xy. This assumes that the underlying matrix is symmetric, i.e. (x, y) and (y, x) map to the same xy.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: pq

    The fused index

    integer(kind=int64), intent(out) :: p

    The index pair x <= y

    integer(kind=int64), intent(out) :: q

    The index pair x <= y

public interface fuse_idx

  • private elemental function fuse_idx_int32(p, q, n_dim, fortran) result(pq)

    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

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: p

    2d-array indices

    integer(kind=int32), intent(in) :: q

    2d-array indices

    integer(kind=int32), 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

    Return Value integer(kind=int32)

    contiguous 1d-array index

  • private elemental function fuse_idx_int64(p, q, n_dim, fortran) result(pq)

    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

    Arguments

    Type IntentOptional 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

    Return Value integer(kind=int64)

    contiguous 1d-array index

public interface inv_fuse_idx

  • private elemental subroutine inv_fuse_idx_int32(pq, n_dim, p, q, fortran)

    Fuse p, q into one contiguous index

    This assumes columnwise Fortran order, i.e. the index looks like this:

    1 5 2 6 3 7 4 8

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: pq

    contiguous 1d-array index

    integer(kind=int32), intent(in) :: n_dim

    number of rows

    integer(kind=int32), intent(out) :: p

    2d-array indices

    integer(kind=int32), intent(out) :: q

    2d-array indices

    logical, intent(in) :: fortran

    Use column major order

  • private elemental subroutine inv_fuse_idx_int64(pq, n_dim, p, q, fortran)

    Fuse p, q into one contiguous index

    This assumes columnwise Fortran order, i.e. the index looks like this:

    1 5 2 6 3 7 4 8

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: pq

    contiguous 1d-array index

    integer(kind=int64), intent(in) :: n_dim

    number of rows

    integer(kind=int64), intent(out) :: p

    2d-array indices

    integer(kind=int64), intent(out) :: q

    2d-array indices

    logical, intent(in) :: fortran

    Use column major order

public interface new_fuse_symm_idx

  • private elemental function new_fuse_symm_idx_int32(p, q, n_dim) result(pq)

    Fuse an index

    create a composite index out of two indices, assuming they are unordered i.e. their ordering does not matter.

    Note

    Note that this function does not preserve order if we assume lexicographical ordering. If (p_1, q_1) <= (p_2, q_2), then we don’t have necessarily fuse_sym_idx(p_1, q_1) <= fuse_symm_idx(p_2, q_2). @endote

    The ordering looks like this:

    1 2 3 4 5 6 7 8 9 10

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: p

    2d-array indices

    integer(kind=int32), intent(in) :: q

    2d-array indices

    integer(kind=int32), intent(in) :: n_dim

    2d-array indices

    Return Value integer(kind=int32)

    1d-array index assuming the array is symmetric w.r. p<->q

  • private elemental function new_fuse_symm_idx_int64(p, q, n_dim) result(pq)

    Fuse an index

    create a composite index out of two indices, assuming they are unordered i.e. their ordering does not matter.

    Note

    Note that this function does not preserve order if we assume lexicographical ordering. If (p_1, q_1) <= (p_2, q_2), then we don’t have necessarily fuse_sym_idx(p_1, q_1) <= fuse_symm_idx(p_2, q_2). @endote

    The ordering looks like this:

    1 2 3 4 5 6 7 8 9 10

    Arguments

    Type IntentOptional 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

    2d-array indices

    Return Value integer(kind=int64)

    1d-array index assuming the array is symmetric w.r. p<->q

public interface triangle_number

  • private elemental function triangle_number_int32(n) result(res)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: n

    Return Value integer(kind=int32)

  • private elemental function triangle_number_int64(n) result(res)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: n

    Return Value integer(kind=int64)

public interface inv_triangle_number

  • private elemental function inv_triangle_number_int32(n) result(res)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: n

    Return Value integer(kind=int32)

  • private elemental function inv_triangle_number_int64(n) result(res)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: n

    Return Value integer(kind=int64)


Functions

private elemental function triangle_number_int32(n) result(res)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: n

Return Value integer(kind=int32)

private elemental function inv_triangle_number_int32(n) result(res)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: n

Return Value integer(kind=int32)

private elemental function fuse_symm_idx_int32(p, q) result(pq)

Fuse an index

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: p

2d-array indices

integer(kind=int32), intent(in) :: q

2d-array indices

Return Value integer(kind=int32)

1d-array index assuming the array is symmetric w.r. p<->q

private elemental function new_fuse_symm_idx_int32(p, q, n_dim) result(pq)

Fuse an index

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: p

2d-array indices

integer(kind=int32), intent(in) :: q

2d-array indices

integer(kind=int32), intent(in) :: n_dim

2d-array indices

Return Value integer(kind=int32)

1d-array index assuming the array is symmetric w.r. p<->q

private elemental function fuse_idx_int32(p, q, n_dim, fortran) result(pq)

Fuse p, q into one contiguous index

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: p

2d-array indices

integer(kind=int32), intent(in) :: q

2d-array indices

integer(kind=int32), 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

Return Value integer(kind=int32)

contiguous 1d-array index

private elemental function triangle_number_int64(n) result(res)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: n

Return Value integer(kind=int64)

private elemental function inv_triangle_number_int64(n) result(res)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: n

Return Value integer(kind=int64)

private elemental function fuse_symm_idx_int64(p, q) result(pq)

Fuse an index

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: p

2d-array indices

integer(kind=int64), intent(in) :: q

2d-array indices

Return Value integer(kind=int64)

1d-array index assuming the array is symmetric w.r. p<->q

private elemental function new_fuse_symm_idx_int64(p, q, n_dim) result(pq)

Fuse an index

Read more…

Arguments

Type IntentOptional 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

2d-array indices

Return Value integer(kind=int64)

1d-array index assuming the array is symmetric w.r. p<->q

private elemental function fuse_idx_int64(p, q, n_dim, fortran) result(pq)

Fuse p, q into one contiguous index

Read more…

Arguments

Type IntentOptional 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

Return Value integer(kind=int64)

contiguous 1d-array index


Subroutines

private elemental subroutine inv_fuse_symm_idx_int32(pq, p, q)

Invert the fuse_symm_idx routine

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: pq

The fused index

integer(kind=int32), intent(out) :: p

The index pair x <= y

integer(kind=int32), intent(out) :: q

The index pair x <= y

private elemental subroutine inv_fuse_idx_int32(pq, n_dim, p, q, fortran)

Fuse p, q into one contiguous index

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: pq

contiguous 1d-array index

integer(kind=int32), intent(in) :: n_dim

number of rows

integer(kind=int32), intent(out) :: p

2d-array indices

integer(kind=int32), intent(out) :: q

2d-array indices

logical, intent(in) :: fortran

Use column major order

private elemental subroutine inv_fuse_symm_idx_int64(pq, p, q)

Invert the fuse_symm_idx routine

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: pq

The fused index

integer(kind=int64), intent(out) :: p

The index pair x <= y

integer(kind=int64), intent(out) :: q

The index pair x <= y

private elemental subroutine inv_fuse_idx_int64(pq, n_dim, p, q, fortran)

Fuse p, q into one contiguous index

Read more…

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: pq

contiguous 1d-array index

integer(kind=int64), intent(in) :: n_dim

number of rows

integer(kind=int64), intent(out) :: p

2d-array indices

integer(kind=int64), intent(out) :: q

2d-array indices

logical, intent(in) :: fortran

Use column major order