reshape_mm_compatible Subroutine

private subroutine reshape_mm_compatible(tensor1, tensor2, tensor1_out, tensor2_out, ind1_free, ind1_linked, ind2_free, ind2_linked, trans1, trans2, new1, new2, ref_tensor, nodata1, nodata2, move_data_1, move_data_2, optimize_dist, unit_nr)

Prepare tensor for contraction: redistribute to a 2d format which can be contracted by matrix multiplication. This routine reshapes the two largest of the three tensors. Redistribution is avoided if tensors already in a consistent layout.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_t_type), intent(inout), TARGET :: tensor1

tensor 1 in

type(dbcsr_t_type), intent(inout), TARGET :: tensor2

tensor 2 in

type(dbcsr_t_type), intent(out), POINTER :: tensor1_out

tensor 1 out tensor 2 out

type(dbcsr_t_type), intent(out), POINTER :: tensor2_out

tensor 1 out tensor 2 out

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

indices of tensor 1 that are "free" (not linked to any index of tensor 2)

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

indices of tensor 1 that are linked to indices of tensor 2 1:1 correspondence with ind1_linked

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

indices of tensor 1 that are "free" (not linked to any index of tensor 2)

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

indices of tensor 1 that are linked to indices of tensor 2 1:1 correspondence with ind1_linked

character(len=1), intent(out) :: trans1

transpose flag of matrix rep. of tensor 1 transpose flag of matrix rep. tensor 2

character(len=1), intent(out) :: trans2

transpose flag of matrix rep. of tensor 1 transpose flag of matrix rep. tensor 2

logical, intent(out) :: new1

whether a new tensor 1 was created whether a new tensor 2 was created

logical, intent(out) :: new2

whether a new tensor 1 was created whether a new tensor 2 was created

integer, intent(out) :: ref_tensor
logical, intent(in), optional :: nodata1

don't copy data of tensor 1 don't copy data of tensor 2

logical, intent(in), optional :: nodata2

don't copy data of tensor 1 don't copy data of tensor 2

logical, intent(inout), optional :: move_data_1

memory optimization: transfer data s.t. tensor1 may be empty on return memory optimization: transfer data s.t. tensor2 may be empty on return

logical, intent(inout), optional :: move_data_2

memory optimization: transfer data s.t. tensor1 may be empty on return memory optimization: transfer data s.t. tensor2 may be empty on return

logical, intent(in), optional :: optimize_dist

experimental: optimize distribution

integer, intent(in), optional :: unit_nr

output unit