Commit 70c71d7d authored by Andreas Marek's avatar Andreas Marek
Browse files

New interface: add multipy_a_b generic procedure

parent a4eb3f95
......@@ -67,6 +67,11 @@ module elpa_type
elpa_solve_real_single, &
elpa_solve_complex_double, &
elpa_solve_complex_single
generic, public :: multiply_a_b => elpa_multiply_at_b_double, &
elpa_multiply_ah_b_double, &
elpa_multiply_at_b_single, &
elpa_multiply_ah_b_single
procedure, public :: destroy => elpa_destroy
......@@ -78,6 +83,10 @@ module elpa_type
procedure, private :: elpa_solve_real_single
procedure, private :: elpa_solve_complex_double
procedure, private :: elpa_solve_complex_single
procedure, private :: elpa_multiply_at_b_double
procedure, private :: elpa_multiply_at_b_single
procedure, private :: elpa_multiply_ah_b_double
procedure, private :: elpa_multiply_ah_b_single
end type elpa_t
......@@ -533,6 +542,128 @@ module elpa_type
end subroutine
subroutine elpa_multiply_at_b_double (self,uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, &
c, ldc, ldcCols, success)
use iso_c_binding
use elpa1_auxiliary_new
implicit none
class(elpa_t) :: self
character*1 :: uplo_a, uplo_c
integer(kind=c_int), intent(in) :: na, lda, ldaCols, ldb, ldbCols, ldc, ldcCols, ncb
!#ifdef USE_ASSUMED_SIZE
! real(kind=REAL_DATATYPE) :: a(lda,*), b(ldb,*), c(ldc,*)
!#else
real(kind=c_double) :: a(lda,ldaCols), b(ldb,ldbCols), c(ldc,ldcCols)
!#endif
integer, optional :: success
logical :: success_l
success_l = elpa_mult_at_b_real_double_new(uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, self%nblk, &
self%mpi_comm_rows, self%mpi_comm_cols, c, ldc, ldcCols)
if (present(success)) then
if (success_l) then
success = ELPA_OK
else
success = ELPA_ERROR
endif
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in multiply_a_b() and you did not check for errors!"
endif
end subroutine
subroutine elpa_multiply_at_b_single (self,uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, &
c, ldc, ldcCols, success)
use iso_c_binding
use elpa1_auxiliary_new
implicit none
class(elpa_t) :: self
character*1 :: uplo_a, uplo_c
integer(kind=c_int), intent(in) :: na, lda, ldaCols, ldb, ldbCols, ldc, ldcCols, ncb
!#ifdef USE_ASSUMED_SIZE
! real(kind=REAL_DATATYPE) :: a(lda,*), b(ldb,*), c(ldc,*)
!#else
real(kind=c_float) :: a(lda,ldaCols), b(ldb,ldbCols), c(ldc,ldcCols)
!#endif
integer, optional :: success
logical :: success_l
#ifdef WANT_SINGLE_PRECISION_REAL
success_l = elpa_mult_at_b_real_single_new(uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, self%nblk, &
self%mpi_comm_rows, self%mpi_comm_cols, c, ldc, ldcCols)
if (present(success)) then
if (success_l) then
success = ELPA_OK
else
success = ELPA_ERROR
endif
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in multiply_a_b() and you did not check for errors!"
endif
#endif
end subroutine
subroutine elpa_multiply_ah_b_double (self,uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, &
c, ldc, ldcCols, success)
use iso_c_binding
use elpa1_auxiliary_new
implicit none
class(elpa_t) :: self
character*1 :: uplo_a, uplo_c
integer(kind=c_int), intent(in) :: na, lda, ldaCols, ldb, ldbCols, ldc, ldcCols, ncb
!#ifdef USE_ASSUMED_SIZE
! complex(kind=REAL_DATATYPE) :: a(lda,*), b(ldb,*), c(ldc,*)
!#else
complex(kind=c_double_complex) :: a(lda,ldaCols), b(ldb,ldbCols), c(ldc,ldcCols)
!#endif
integer, optional :: success
logical :: success_l
success_l = elpa_mult_ah_b_complex_double_new(uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, self%nblk, &
self%mpi_comm_rows, self%mpi_comm_cols, c, ldc, ldcCols)
if (present(success)) then
if (success_l) then
success = ELPA_OK
else
success = ELPA_ERROR
endif
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in multiply_a_b() and you did not check for errors!"
endif
end subroutine
subroutine elpa_multiply_ah_b_single (self,uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, &
c, ldc, ldcCols, success)
use iso_c_binding
use elpa1_auxiliary_new
implicit none
class(elpa_t) :: self
character*1 :: uplo_a, uplo_c
integer(kind=c_int), intent(in) :: na, lda, ldaCols, ldb, ldbCols, ldc, ldcCols, ncb
!#ifdef USE_ASSUMED_SIZE
! real(kind=REAL_DATATYPE) :: a(lda,*), b(ldb,*), c(ldc,*)
!#else
complex(kind=c_float_complex) :: a(lda,ldaCols), b(ldb,ldbCols), c(ldc,ldcCols)
!#endif
integer, optional :: success
logical :: success_l
#ifdef WANT_SINGLE_PRECISION_COMPLEX
success_l = elpa_mult_ah_b_complex_single_new(uplo_a, uplo_c, na, ncb, a, lda, ldaCols, b, ldb, ldbCols, self%nblk, &
self%mpi_comm_rows, self%mpi_comm_cols, c, ldc, ldcCols)
if (present(success)) then
if (success_l) then
success = ELPA_OK
else
success = ELPA_ERROR
endif
else if (.not. success_l) then
write(error_unit,'(a)') "ELPA: Error in multiply_a_b() and you did not check for errors!"
endif
#endif
end subroutine
subroutine elpa_destroy(self)
class(elpa_t) :: self
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment