General methods for testing DBCSR tensors.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=*), | private, | parameter | :: | moduleN | = | 'dbcsr_tensor_test' | |
integer, | private, | SAVE | :: | randmat_counter | = | 0 | |
integer, | private, | parameter | :: | rand_seed_init | = | 12341313 |
Transform a distributed sparse tensor to a replicated dense array. This is only useful for testing tensor contraction by matrix multiplication of dense arrays.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_t_type), | intent(inout) | :: | tensor | |||
real(kind=real_8), | intent(out), | ALLOCATABLE, DIMENSION(:,:) | :: | array |
Transform a distributed sparse tensor to a replicated dense array. This is only useful for testing tensor contraction by matrix multiplication of dense arrays.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_t_type), | intent(inout) | :: | tensor | |||
real(kind=real_8), | intent(out), | ALLOCATABLE, DIMENSION(:,:,:) | :: | array |
Transform a distributed sparse tensor to a replicated dense array. This is only useful for testing tensor contraction by matrix multiplication of dense arrays.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_t_type), | intent(inout) | :: | tensor | |||
real(kind=real_8), | intent(out), | ALLOCATABLE, DIMENSION(:,:,:,:) | :: | array |
check if two (arbitrarily mapped and distributed) tensors are equal.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_t_type), | intent(inout) | :: | tensor1 | |||
type(dbcsr_t_type), | intent(inout) | :: | tensor2 |
Compute factorial
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n |
mapped sizes in 2d
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | DIMENSION(:) | :: | nd_sizes | ||
integer, | intent(in), | DIMENSION(:) | :: | map1 | ||
integer, | intent(in), | DIMENSION(:) | :: | map2 |
checksum of a tensor consistent with dbcsr_checksum
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_t_type), | intent(in) | :: | tensor | |||
logical, | intent(in), | optional | :: | local | ||
logical, | intent(in), | optional | :: | pos |
Compute all permutations p of (1, 2, ..., n)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n | |||
integer, | intent(out), | DIMENSION(n, factorial(n)) | :: | p |
Test equivalence of all tensor formats, using a random distribution.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | ndims |
tensor rank |
||
type(mp_comm_type), | intent(in) | :: | mp_comm | |||
integer, | intent(in) | :: | unit_nr |
output unit, needs to be a valid unit number on all mpi ranks |
||
logical, | intent(in) | :: | verbose |
if .TRUE., print all tensor blocks |
||
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_size_1 |
block sizes along respective dimension |
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_size_2 |
block sizes along respective dimension |
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_size_3 |
block sizes along respective dimension |
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_size_4 |
block sizes along respective dimension |
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_ind_1 |
index along respective dimension of non-zero blocks |
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_ind_2 |
index along respective dimension of non-zero blocks |
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_ind_3 |
index along respective dimension of non-zero blocks |
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_ind_4 |
index along respective dimension of non-zero blocks |
Allocate and fill test tensor - entries are enumerated by their index s.t. they only depend on global properties of the tensor but not on distribution, matrix representation, etc.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_t_type), | intent(inout) | :: | tensor | |||
type(mp_comm_type), | intent(in) | :: | mp_comm |
communicator |
||
logical, | intent(in) | :: | enumerate | |||
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_ind_1 |
index along respective dimension of non-zero blocks |
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_ind_2 |
index along respective dimension of non-zero blocks |
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_ind_3 |
index along respective dimension of non-zero blocks |
integer, | intent(in), | optional, | DIMENSION(:) | :: | blk_ind_4 |
index along respective dimension of non-zero blocks |
Enumerate tensor entries in block \blk_2 block values for 2 dimensions \blk_3 block values for 3 dimensions
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | DIMENSION(:) | :: | blk_size |
size of block block offset (indices of first element) global tensor sizes |
|
integer, | intent(in), | DIMENSION(:) | :: | blk_offset |
size of block block offset (indices of first element) global tensor sizes |
|
integer, | intent(in), | DIMENSION(:) | :: | tensor_size |
size of block block offset (indices of first element) global tensor sizes |
|
real(kind=real_8), | intent(out), | optional, | DIMENSION(:,:) | :: | blk_2 | |
real(kind=real_8), | intent(out), | optional, | DIMENSION(:,:,:) | :: | blk_3 | |
real(kind=real_8), | intent(out), | optional, | DIMENSION(:,:,:,:) | :: | blk_4 |
Transform a distributed sparse tensor to a replicated dense array. This is only useful for testing tensor contraction by matrix multiplication of dense arrays.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_t_type), | intent(inout) | :: | tensor | |||
real(kind=real_8), | intent(out), | ALLOCATABLE, DIMENSION(:,:) | :: | array |
Transform a distributed sparse tensor to a replicated dense array. This is only useful for testing tensor contraction by matrix multiplication of dense arrays.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_t_type), | intent(inout) | :: | tensor | |||
real(kind=real_8), | intent(out), | ALLOCATABLE, DIMENSION(:,:,:) | :: | array |
Transform a distributed sparse tensor to a replicated dense array. This is only useful for testing tensor contraction by matrix multiplication of dense arrays.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_t_type), | intent(inout) | :: | tensor | |||
real(kind=real_8), | intent(out), | ALLOCATABLE, DIMENSION(:,:,:,:) | :: | array |
test tensor contraction
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_scalar_type), | intent(in) | :: | alpha | |||
type(dbcsr_t_type), | intent(inout) | :: | tensor_1 | |||
type(dbcsr_t_type), | intent(inout) | :: | tensor_2 | |||
type(dbcsr_scalar_type), | intent(in) | :: | beta | |||
type(dbcsr_t_type), | intent(inout) | :: | tensor_3 | |||
integer, | intent(in), | DIMENSION(:) | :: | contract_1 | ||
integer, | intent(in), | DIMENSION(:) | :: | notcontract_1 | ||
integer, | intent(in), | DIMENSION(:) | :: | contract_2 | ||
integer, | intent(in), | DIMENSION(:) | :: | notcontract_2 | ||
integer, | intent(in), | DIMENSION(:) | :: | map_1 | ||
integer, | intent(in), | DIMENSION(:) | :: | map_2 | ||
integer, | intent(in) | :: | unit_nr | |||
integer, | optional, | DIMENSION(2, SIZE(contract_1)) | :: | bounds_1 | ||
integer, | optional, | DIMENSION(2, SIZE(notcontract_1)) | :: | bounds_2 | ||
integer, | optional, | DIMENSION(2, SIZE(notcontract_2)) | :: | bounds_3 | ||
logical, | intent(in), | optional | :: | log_verbose | ||
logical, | intent(in), | optional | :: | write_int |
Reset the seed used for generating random matrices to default value