Test the conversion by converting to CSR format and converting back, where the CSR sparsity is defined by some filtering threshold eps. The maximum norm of the differences between the original and the back-converted matrix is calculated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(in) | :: | dbcsr_mat | |||
type(dbcsr_csr_type), | intent(out) | :: | csr_mat | |||
real(kind=real_8), | intent(out) | :: | norm | |||
real(kind=real_8), | intent(in) | :: | eps |
SUBROUTINE csr_conversion_test(dbcsr_mat, csr_mat, norm, eps) !! Test the conversion by converting to CSR format and converting back, !! where the CSR sparsity is defined by some filtering threshold eps. !! The maximum norm of the differences between the original and the !! back-converted matrix is calculated. TYPE(dbcsr_type), INTENT(IN) :: dbcsr_mat TYPE(dbcsr_csr_type), INTENT(OUT) :: csr_mat REAL(KIND=real_8), INTENT(OUT) :: norm REAL(KIND=real_8), INTENT(IN) :: eps TYPE(dbcsr_type) :: csr_sparsity, dbcsr_mat_conv CALL dbcsr_to_csr_filter(dbcsr_mat, csr_sparsity, eps) CALL dbcsr_csr_create_from_dbcsr(dbcsr_mat, csr_mat, dbcsr_csr_eqrow_ceil_dist, csr_sparsity) CALL dbcsr_convert_dbcsr_to_csr(dbcsr_mat, csr_mat) CALL dbcsr_copy(dbcsr_mat_conv, dbcsr_mat) CALL dbcsr_convert_csr_to_dbcsr(dbcsr_mat_conv, csr_mat) CALL dbcsr_add(dbcsr_mat_conv, dbcsr_mat, 1.0_dp, -1.0_dp) CALL dbcsr_norm(dbcsr_mat_conv, dbcsr_norm_maxabsnorm, norm_scalar=norm) CALL dbcsr_release(dbcsr_mat_conv) CALL dbcsr_release(csr_sparsity) END SUBROUTINE csr_conversion_test