dbcsr_tensor_index Module

tensor index and mapping to DBCSR index



Variables

Type Visibility Attributes Name Initial
character(len=*), private, parameter :: moduleN = 'dbcsr_tensor_index'

Derived Types

type, public ::  nd_to_2d_mapping

Components

Type Visibility Attributes Name Initial
integer, public :: ndim_nd = -1
integer, public :: ndim1_2d = -1
integer, public :: ndim2_2d = -1
integer, public, DIMENSION(:), ALLOCATABLE :: dims_nd
integer(kind=int_8), public, DIMENSION(2) :: dims_2d = -1_int_8
integer, public, DIMENSION(:), ALLOCATABLE :: dims1_2d
integer, public, DIMENSION(:), ALLOCATABLE :: dims2_2d
integer, public, DIMENSION(:), ALLOCATABLE :: map1_2d
integer, public, DIMENSION(:), ALLOCATABLE :: map2_2d
integer, public, DIMENSION(:), ALLOCATABLE :: map_nd
integer, public :: base = -1
logical, public :: col_major = .FALSE.

Functions

public pure function ndims_mapping(map)

Arguments

Type IntentOptional Attributes Name
type(nd_to_2d_mapping), intent(in) :: map

Return Value integer

public pure function ndims_mapping_row(map)

how many tensor dimensions are mapped to matrix row

Arguments

Type IntentOptional Attributes Name
type(nd_to_2d_mapping), intent(in) :: map

Return Value integer

public pure function ndims_mapping_column(map)

how many tensor dimensions are mapped to matrix column

Arguments

Type IntentOptional Attributes Name
type(nd_to_2d_mapping), intent(in) :: map

Return Value integer

public pure function combine_tensor_index(ind_in, dims) result(ind_out)

transform nd index to flat index

Arguments

Type IntentOptional Attributes Name
integer, intent(in), DIMENSION(:) :: ind_in

nd index nd dimensions

integer, intent(in), DIMENSION(:) :: dims

nd index nd dimensions

Return Value integer(kind=int_8)

flat index

public pure function combine_pgrid_index(ind_in, dims) result(ind_out)

transform nd index to flat index

Arguments

Type IntentOptional Attributes Name
integer, intent(in), DIMENSION(:) :: ind_in

nd index nd dimensions

integer, intent(in), DIMENSION(:) :: dims

nd index nd dimensions

Return Value integer

flat index

public pure function split_tensor_index(ind_in, dims) result(ind_out)

transform flat index to nd index

Arguments

Type IntentOptional Attributes Name
integer(kind=int_8), intent(in) :: ind_in

flat index

integer, intent(in), DIMENSION(:) :: dims

nd dimensions

Return Value integer, DIMENSION(SIZE(dims))

nd index

public pure function split_pgrid_index(ind_in, dims) result(ind_out)

transform flat index to nd index

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: ind_in

flat index

integer, intent(in), DIMENSION(:) :: dims

nd dimensions

Return Value integer, DIMENSION(SIZE(dims))

nd index

public pure function get_2d_indices_tensor(map, ind_in) result(ind_out)

transform nd index to 2d index, using info from index mapping.

Arguments

Type IntentOptional Attributes Name
type(nd_to_2d_mapping), intent(in) :: map

index mapping

integer, intent(in), DIMENSION(map%ndim_nd) :: ind_in

nd index

Return Value integer(kind=int_8), DIMENSION(2)

2d index

public pure function get_2d_indices_pgrid(map, ind_in) result(ind_out)

transform nd index to 2d index, using info from index mapping.

Arguments

Type IntentOptional Attributes Name
type(nd_to_2d_mapping), intent(in) :: map

index mapping

integer, intent(in), DIMENSION(map%ndim_nd) :: ind_in

nd index

Return Value integer, DIMENSION(2)

2d index

public pure function get_nd_indices_tensor(map, ind_in) result(ind_out)

transform 2d index to nd index, using info from index mapping.

Arguments

Type IntentOptional Attributes Name
type(nd_to_2d_mapping), intent(in) :: map

index mapping

integer(kind=int_8), intent(in), DIMENSION(2) :: ind_in

2d index

Return Value integer, DIMENSION(map%ndim_nd)

nd index

public pure function get_nd_indices_pgrid(map, ind_in) result(ind_out)

transform 2d index to nd index, using info from index mapping.

Arguments

Type IntentOptional Attributes Name
type(nd_to_2d_mapping), intent(in) :: map

index mapping

integer, intent(in), DIMENSION(2) :: ind_in

2d index

Return Value integer, DIMENSION(map%ndim_nd)

nd index

public pure function dbcsr_t_inverse_order(order)

Invert order

Arguments

Type IntentOptional Attributes Name
integer, intent(in), DIMENSION(:) :: order

Return Value integer, DIMENSION(SIZE(order))


Subroutines

public subroutine create_nd_to_2d_mapping(map, dims, map1_2d, map2_2d, base, col_major)

Create all data needed to quickly map between nd index and 2d index.

Arguments

Type IntentOptional Attributes Name
type(nd_to_2d_mapping), intent(out) :: map

index mapping data

integer, intent(in), DIMENSION(:) :: dims

nd sizes which nd-indices map to first matrix index and in which order which nd-indices map to second matrix index and in which order

integer, intent(in), DIMENSION(:) :: map1_2d

nd sizes which nd-indices map to first matrix index and in which order which nd-indices map to second matrix index and in which order

integer, intent(in), DIMENSION(:) :: map2_2d

nd sizes which nd-indices map to first matrix index and in which order which nd-indices map to second matrix index and in which order

integer, intent(in), optional :: base

base index (1 for Fortran-style, 0 for C-style, default is 1)

logical, intent(in), optional :: col_major

whether index should be column major order (.TRUE. for Fortran-style, .FALSE. for C-style, default is .TRUE.).

public subroutine destroy_nd_to_2d_mapping(map)

Arguments

Type IntentOptional Attributes Name
type(nd_to_2d_mapping), intent(inout) :: map

public pure subroutine dbcsr_t_get_mapping_info(map, ndim_nd, ndim1_2d, ndim2_2d, dims_2d_i8, dims_2d, dims_nd, dims1_2d, dims2_2d, map1_2d, map2_2d, map_nd, base, col_major)

get mapping info

Arguments

Type IntentOptional Attributes Name
type(nd_to_2d_mapping), intent(in) :: map

index mapping data.

integer, intent(out), optional :: ndim_nd

number of dimensions number of dimensions that map to first 2d index number of dimensions that map to first 2d index

integer, intent(out), optional :: ndim1_2d

number of dimensions number of dimensions that map to first 2d index number of dimensions that map to first 2d index

integer, intent(out), optional :: ndim2_2d

number of dimensions number of dimensions that map to first 2d index number of dimensions that map to first 2d index

integer(kind=int_8), intent(out), optional, DIMENSION(2) :: dims_2d_i8
integer, intent(out), optional, DIMENSION(2) :: dims_2d

2d dimensions

integer, intent(out), optional, DIMENSION(ndims_mapping(map)) :: dims_nd

nd dimensions

integer, intent(out), optional, DIMENSION(ndims_mapping_row(map)) :: dims1_2d

dimensions that map to first 2d index

integer, intent(out), optional, DIMENSION(ndims_mapping_column(map)) :: dims2_2d

dimensions that map to second 2d index

integer, intent(out), optional, DIMENSION(ndims_mapping_row(map)) :: map1_2d

indices that map to first 2d index

integer, intent(out), optional, DIMENSION(ndims_mapping_column(map)) :: map2_2d

indices that map to second 2d index

integer, intent(out), optional, DIMENSION(ndims_mapping(map)) :: map_nd

inverse of [map1_2d, map2_2d]

integer, intent(out), optional :: base

base index

logical, intent(out), optional :: col_major

is index in column major order

public subroutine permute_index(map_in, map_out, order)

reorder tensor index (no data)

Arguments

Type IntentOptional Attributes Name
type(nd_to_2d_mapping), intent(in) :: map_in
type(nd_to_2d_mapping), intent(out) :: map_out
integer, intent(in), DIMENSION(ndims_mapping(map_in)) :: order