mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-19 04:12:09 +00:00
psblas3:
base/Makefile base/newserial/psbn_base_mat_mod.f03 base/newserial/psbn_d_base_mat_mod.f03 base/newserial/psbn_d_coo_impl.f03 base/newserial/psbn_d_csr_impl.f03 base/newserial/psbn_d_csr_mat_mod.f03 base/newserial/psbn_mat_impl.f03 base/newserial/psbn_mat_mod.f03 test/serial/Makefile test/serial/d_matgen.f03 test/serial/psbn_d_cxx_impl.f03 test/serial/psbn_d_cxx_mat_mod.f03 Improved error messages. Various cosmetic fixes.
This commit is contained in:
@@ -38,7 +38,8 @@ spde: spde.o
|
||||
|
||||
|
||||
clean:
|
||||
/bin/rm -f d_coo_matgen.o d_matgen.o tpg.o ppde.o spde.o $(EXEDIR)/ppde
|
||||
/bin/rm -f d_coo_matgen.o d_matgen.o tpg.o ppde.o spde.o \
|
||||
psbn_d_cxx_mat_mod.o psbn_d_cxx_impl.o $(EXEDIR)/ppde
|
||||
verycleanlib:
|
||||
(cd ../..; make veryclean)
|
||||
lib:
|
||||
|
||||
@@ -161,7 +161,7 @@ contains
|
||||
type(psbn_d_cxx_sparse_mat) :: acxx
|
||||
! deltah dimension of each grid cell
|
||||
! deltat discretization time
|
||||
real(psb_dpk_) :: deltah
|
||||
real(psb_dpk_) :: deltah, anorm
|
||||
real(psb_dpk_),parameter :: rhs=0.d0,one=1.d0,zero=0.d0
|
||||
real(psb_dpk_) :: t0, t1, t2, t3, tasb, talc, ttot, tgen, tcpy, tmov
|
||||
real(psb_dpk_) :: a1, a2, a3, a4, b1, b2, b3
|
||||
@@ -172,7 +172,7 @@ contains
|
||||
|
||||
info = 0
|
||||
name = 'create_matrix'
|
||||
call psb_erractionsave(err_act)
|
||||
!!$ call psb_erractionsave(err_act)
|
||||
|
||||
call psb_info(ictxt, iam, np)
|
||||
|
||||
@@ -380,6 +380,8 @@ contains
|
||||
end if
|
||||
tasb = psb_wtime()-t1
|
||||
call a_n%print(20)
|
||||
anorm = a_n%csnmi()
|
||||
write(0,*) 'Nrm infinity ',anorm
|
||||
!!$
|
||||
t1 = psb_wtime()
|
||||
call a_n%cscnv(info,mold=acxx)
|
||||
@@ -392,6 +394,8 @@ contains
|
||||
end if
|
||||
tmov = psb_wtime()-t1
|
||||
call a_n%print(21)
|
||||
anorm = a_n%csnmi()
|
||||
write(0,*) 'Nrm infinity ',anorm
|
||||
!!$
|
||||
|
||||
if(iam == psb_root_) then
|
||||
@@ -404,7 +408,7 @@ contains
|
||||
!!$ write(*,'("-total time : ",es12.5)') ttot
|
||||
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
!!$ call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!
|
||||
!
|
||||
!
|
||||
! Computational routines
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
subroutine d_cxx_csmv_impl(alpha,a,x,beta,y,info,trans)
|
||||
use psb_error_mod
|
||||
use psbn_d_cxx_mat_mod, psb_protect_name => d_cxx_csmv_impl
|
||||
@@ -940,6 +953,45 @@ contains
|
||||
|
||||
end subroutine d_cxx_cssm_impl
|
||||
|
||||
function d_cxx_csnmi_impl(a) result(res)
|
||||
use psb_error_mod
|
||||
use psbn_d_cxx_mat_mod, psb_protect_name => d_cxx_csnmi_impl
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
real(psb_dpk_) :: res
|
||||
|
||||
integer :: i,j,k,m,n, nr, ir, jc, nc
|
||||
real(psb_dpk_) :: acc
|
||||
logical :: tra
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='d_csnmi'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
|
||||
res = dzero
|
||||
|
||||
do i = 1, a%get_nrows()
|
||||
acc = dzero
|
||||
do j=a%irp(i),a%irp(i+1)-1
|
||||
acc = acc + abs(a%val(j))
|
||||
end do
|
||||
res = max(res,acc)
|
||||
end do
|
||||
|
||||
end function d_cxx_csnmi_impl
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!
|
||||
!
|
||||
!
|
||||
! Data management
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
|
||||
|
||||
subroutine d_cxx_csput_impl(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl)
|
||||
@@ -1449,7 +1501,6 @@ subroutine d_mv_cxx_to_fmt_impl(a,b,info)
|
||||
end subroutine d_mv_cxx_to_fmt_impl
|
||||
|
||||
|
||||
|
||||
subroutine d_cp_cxx_to_fmt_impl(a,b,info)
|
||||
use psb_const_mod
|
||||
use psb_realloc_mod
|
||||
@@ -1471,6 +1522,7 @@ subroutine d_cp_cxx_to_fmt_impl(a,b,info)
|
||||
|
||||
info = 0
|
||||
|
||||
|
||||
select type (b)
|
||||
class is (psbn_d_coo_sparse_mat)
|
||||
call a%cp_to_coo(b,info)
|
||||
@@ -1478,9 +1530,43 @@ subroutine d_cp_cxx_to_fmt_impl(a,b,info)
|
||||
call tmp%cp_from_fmt(a,info)
|
||||
if (info == 0) call b%mv_from_coo(tmp,info)
|
||||
end select
|
||||
|
||||
end subroutine d_cp_cxx_to_fmt_impl
|
||||
|
||||
|
||||
subroutine d_mv_cxx_from_fmt_impl(a,b,info)
|
||||
use psb_const_mod
|
||||
use psb_realloc_mod
|
||||
use psbn_d_base_mat_mod
|
||||
use psbn_d_cxx_mat_mod, psb_protect_name => d_mv_cxx_from_fmt_impl
|
||||
implicit none
|
||||
|
||||
class(psbn_d_cxx_sparse_mat), intent(inout) :: a
|
||||
class(psbn_d_base_sparse_mat), intent(inout) :: b
|
||||
integer, intent(out) :: info
|
||||
|
||||
!locals
|
||||
type(psbn_d_coo_sparse_mat) :: tmp
|
||||
logical :: rwshr_
|
||||
Integer :: nza, nr, i,j,irw, idl,err_act, nc
|
||||
Integer, Parameter :: maxtry=8
|
||||
integer :: debug_level, debug_unit
|
||||
character(len=20) :: name
|
||||
|
||||
info = 0
|
||||
|
||||
select type (b)
|
||||
class is (psbn_d_coo_sparse_mat)
|
||||
call a%mv_from_coo(b,info)
|
||||
class default
|
||||
call tmp%mv_from_fmt(b,info)
|
||||
if (info == 0) call a%mv_from_coo(tmp,info)
|
||||
end select
|
||||
|
||||
end subroutine d_mv_cxx_from_fmt_impl
|
||||
|
||||
|
||||
|
||||
subroutine d_cp_cxx_from_fmt_impl(a,b,info)
|
||||
use psb_const_mod
|
||||
use psb_realloc_mod
|
||||
@@ -1510,35 +1596,3 @@ subroutine d_cp_cxx_from_fmt_impl(a,b,info)
|
||||
if (info == 0) call a%mv_from_coo(tmp,info)
|
||||
end select
|
||||
end subroutine d_cp_cxx_from_fmt_impl
|
||||
|
||||
|
||||
subroutine d_mv_cxx_from_fmt_impl(a,b,info)
|
||||
use psb_const_mod
|
||||
use psb_realloc_mod
|
||||
use psbn_d_base_mat_mod
|
||||
use psbn_d_cxx_mat_mod, psb_protect_name => d_mv_cxx_from_fmt_impl
|
||||
implicit none
|
||||
|
||||
class(psbn_d_cxx_sparse_mat), intent(inout) :: a
|
||||
class(psbn_d_base_sparse_mat), intent(inout) :: b
|
||||
integer, intent(out) :: info
|
||||
|
||||
!locals
|
||||
type(psbn_d_coo_sparse_mat) :: tmp
|
||||
logical :: rwshr_
|
||||
Integer :: nza, nr, i,j,irw, idl,err_act, nc
|
||||
Integer, Parameter :: maxtry=8
|
||||
integer :: debug_level, debug_unit
|
||||
character(len=20) :: name
|
||||
|
||||
info = 0
|
||||
|
||||
select type (b)
|
||||
class is (psbn_d_coo_sparse_mat)
|
||||
call a%mv_from_coo(b,info)
|
||||
class default
|
||||
call tmp%mv_from_fmt(b,info)
|
||||
if (info == 0) call a%mv_from_coo(tmp,info)
|
||||
end select
|
||||
end subroutine d_mv_cxx_from_fmt_impl
|
||||
|
||||
|
||||
+317
-250
@@ -8,29 +8,30 @@ module psbn_d_cxx_mat_mod
|
||||
real(psb_dpk_), allocatable :: val(:)
|
||||
|
||||
contains
|
||||
procedure, pass(a) :: get_nzeros => d_cxx_get_nzeros
|
||||
procedure, pass(a) :: d_base_csmm => d_cxx_csmm
|
||||
procedure, pass(a) :: d_base_csmv => d_cxx_csmv
|
||||
procedure, pass(a) :: d_base_cssm => d_cxx_cssm
|
||||
procedure, pass(a) :: d_base_cssv => d_cxx_cssv
|
||||
procedure, pass(a) :: reallocate_nz => d_cxx_reallocate_nz
|
||||
procedure, pass(a) :: csput => d_cxx_csput
|
||||
procedure, pass(a) :: allocate_mnnz => d_cxx_allocate_mnnz
|
||||
procedure, pass(a) :: cp_to_coo => d_cp_cxx_to_coo
|
||||
procedure, pass(a) :: cp_from_coo => d_cp_cxx_from_coo
|
||||
procedure, pass(a) :: cp_to_fmt => d_cp_cxx_to_fmt
|
||||
procedure, pass(a) :: cp_from_fmt => d_cp_cxx_from_fmt
|
||||
procedure, pass(a) :: mv_to_coo => d_mv_cxx_to_coo
|
||||
procedure, pass(a) :: mv_from_coo => d_mv_cxx_from_coo
|
||||
procedure, pass(a) :: mv_to_fmt => d_mv_cxx_to_fmt
|
||||
procedure, pass(a) :: mv_from_fmt => d_mv_cxx_from_fmt
|
||||
procedure, pass(a) :: free => d_cxx_free
|
||||
procedure, pass(a) :: print => d_cxx_print
|
||||
procedure, pass(a) :: get_fmt => d_cxx_get_fmt
|
||||
procedure, pass(a) :: get_nzeros => d_cxx_get_nzeros
|
||||
procedure, pass(a) :: get_fmt => d_cxx_get_fmt
|
||||
procedure, pass(a) :: d_base_csmm => d_cxx_csmm
|
||||
procedure, pass(a) :: d_base_csmv => d_cxx_csmv
|
||||
procedure, pass(a) :: d_base_cssm => d_cxx_cssm
|
||||
procedure, pass(a) :: d_base_cssv => d_cxx_cssv
|
||||
procedure, pass(a) :: csnmi => d_cxx_csnmi
|
||||
procedure, pass(a) :: reallocate_nz => d_cxx_reallocate_nz
|
||||
procedure, pass(a) :: csput => d_cxx_csput
|
||||
procedure, pass(a) :: allocate_mnnz => d_cxx_allocate_mnnz
|
||||
procedure, pass(a) :: cp_to_coo => d_cp_cxx_to_coo
|
||||
procedure, pass(a) :: cp_from_coo => d_cp_cxx_from_coo
|
||||
procedure, pass(a) :: cp_to_fmt => d_cp_cxx_to_fmt
|
||||
procedure, pass(a) :: cp_from_fmt => d_cp_cxx_from_fmt
|
||||
procedure, pass(a) :: mv_to_coo => d_mv_cxx_to_coo
|
||||
procedure, pass(a) :: mv_from_coo => d_mv_cxx_from_coo
|
||||
procedure, pass(a) :: mv_to_fmt => d_mv_cxx_to_fmt
|
||||
procedure, pass(a) :: mv_from_fmt => d_mv_cxx_from_fmt
|
||||
procedure, pass(a) :: free => d_cxx_free
|
||||
procedure, pass(a) :: print => d_cxx_print
|
||||
end type psbn_d_cxx_sparse_mat
|
||||
private :: d_cxx_get_nzeros, d_cxx_csmm, d_cxx_csmv, d_cxx_cssm, d_cxx_cssv, &
|
||||
& d_cxx_csput, d_cxx_reallocate_nz, d_cxx_allocate_mnnz, &
|
||||
& d_cxx_free, d_cxx_print, d_cxx_get_fmt, &
|
||||
& d_cxx_free, d_cxx_print, d_cxx_get_fmt, d_cxx_csnmi, &
|
||||
& d_cp_cxx_to_coo, d_cp_cxx_from_coo, &
|
||||
& d_mv_cxx_to_coo, d_mv_cxx_from_coo, &
|
||||
& d_cp_cxx_to_fmt, d_cp_cxx_from_fmt, &
|
||||
@@ -181,10 +182,31 @@ module psbn_d_cxx_mat_mod
|
||||
end subroutine d_cxx_csmm_impl
|
||||
end interface
|
||||
|
||||
interface d_cxx_csnmi_impl
|
||||
function d_cxx_csnmi_impl(a) result(res)
|
||||
use psb_const_mod
|
||||
import psbn_d_cxx_sparse_mat
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
real(psb_dpk_) :: res
|
||||
end function d_cxx_csnmi_impl
|
||||
end interface
|
||||
|
||||
|
||||
|
||||
contains
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!
|
||||
!
|
||||
!
|
||||
! Getters
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
function d_cxx_get_fmt(a) result(res)
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
@@ -192,6 +214,26 @@ contains
|
||||
res = 'CXX'
|
||||
end function d_cxx_get_fmt
|
||||
|
||||
function d_cxx_get_nzeros(a) result(res)
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
integer :: res
|
||||
res = a%irp(a%m+1)-1
|
||||
end function d_cxx_get_nzeros
|
||||
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!
|
||||
!
|
||||
!
|
||||
! Data management
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
|
||||
subroutine d_cxx_reallocate_nz(nz,a)
|
||||
use psb_error_mod
|
||||
@@ -227,14 +269,6 @@ contains
|
||||
|
||||
end subroutine d_cxx_reallocate_nz
|
||||
|
||||
function d_cxx_get_nzeros(a) result(res)
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
integer :: res
|
||||
res = a%irp(a%m+1)-1
|
||||
end function d_cxx_get_nzeros
|
||||
|
||||
|
||||
subroutine d_cxx_csput(nz,val,ia,ja,a,imin,imax,jmin,jmax,info,gtl)
|
||||
use psb_const_mod
|
||||
use psb_error_mod
|
||||
@@ -299,195 +333,6 @@ contains
|
||||
end subroutine d_cxx_csput
|
||||
|
||||
|
||||
subroutine d_cxx_csmv(alpha,a,x,beta,y,info,trans)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
real(psb_dpk_), intent(in) :: alpha, beta, x(:)
|
||||
real(psb_dpk_), intent(inout) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
character, optional, intent(in) :: trans
|
||||
|
||||
character :: trans_
|
||||
integer :: i,j,k,m,n, nnz, ir, jc
|
||||
real(psb_dpk_) :: acc
|
||||
logical :: tra
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='d_cxx_csmv'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (.not.a%is_asb()) then
|
||||
info = 1121
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
call d_cxx_csmm_impl(alpha,a,x,beta,y,info,trans)
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine d_cxx_csmv
|
||||
|
||||
subroutine d_cxx_csmm(alpha,a,x,beta,y,info,trans)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
real(psb_dpk_), intent(in) :: alpha, beta, x(:,:)
|
||||
real(psb_dpk_), intent(inout) :: y(:,:)
|
||||
integer, intent(out) :: info
|
||||
character, optional, intent(in) :: trans
|
||||
|
||||
character :: trans_
|
||||
integer :: i,j,k,m,n, nnz, ir, jc, nc
|
||||
real(psb_dpk_), allocatable :: acc(:)
|
||||
logical :: tra
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='d_cxx_csmm'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
|
||||
|
||||
call d_cxx_csmm_impl(alpha,a,x,beta,y,info,trans)
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine d_cxx_csmm
|
||||
|
||||
|
||||
subroutine d_cxx_cssv(alpha,a,x,beta,y,info,trans)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
real(psb_dpk_), intent(in) :: alpha, beta, x(:)
|
||||
real(psb_dpk_), intent(inout) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
character, optional, intent(in) :: trans
|
||||
|
||||
character :: trans_
|
||||
integer :: i,j,k,m,n, nnz, ir, jc
|
||||
real(psb_dpk_) :: acc
|
||||
real(psb_dpk_), allocatable :: tmp(:)
|
||||
logical :: tra
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='d_cxx_cssv'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (.not.a%is_asb()) then
|
||||
info = 1121
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
if (.not. (a%is_triangle())) then
|
||||
write(0,*) 'Called SM on a non-triangular mat!'
|
||||
info = 1121
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call d_cxx_cssm_impl(alpha,a,x,beta,y,info,trans)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
|
||||
end subroutine d_cxx_cssv
|
||||
|
||||
|
||||
|
||||
subroutine d_cxx_cssm(alpha,a,x,beta,y,info,trans)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
real(psb_dpk_), intent(in) :: alpha, beta, x(:,:)
|
||||
real(psb_dpk_), intent(inout) :: y(:,:)
|
||||
integer, intent(out) :: info
|
||||
character, optional, intent(in) :: trans
|
||||
|
||||
character :: trans_
|
||||
integer :: i,j,k,m,n, nnz, ir, jc, nc
|
||||
real(psb_dpk_) :: acc
|
||||
real(psb_dpk_), allocatable :: tmp(:,:)
|
||||
logical :: tra
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='d_cxx_csmm'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (.not.a%is_asb()) then
|
||||
info = 1121
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
if (.not. (a%is_triangle())) then
|
||||
write(0,*) 'Called SM on a non-triangular mat!'
|
||||
info = 1121
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call d_cxx_cssm_impl(alpha,a,x,beta,y,info,trans)
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine d_cxx_cssm
|
||||
|
||||
|
||||
subroutine d_cxx_free(a)
|
||||
implicit none
|
||||
|
||||
@@ -601,39 +446,6 @@ contains
|
||||
return
|
||||
|
||||
end subroutine d_cp_cxx_to_fmt
|
||||
|
||||
subroutine d_mv_cxx_to_coo(a,b,info)
|
||||
use psb_error_mod
|
||||
use psb_realloc_mod
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(inout) :: a
|
||||
class(psbn_d_coo_sparse_mat), intent(out) :: b
|
||||
integer, intent(out) :: info
|
||||
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='to_coo'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = 0
|
||||
call d_mv_cxx_to_coo_impl(a,b,info)
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
call psb_errpush(info,name)
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine d_mv_cxx_to_coo
|
||||
|
||||
|
||||
subroutine d_cp_cxx_from_fmt(a,b,info)
|
||||
use psb_error_mod
|
||||
@@ -667,6 +479,39 @@ contains
|
||||
|
||||
end subroutine d_cp_cxx_from_fmt
|
||||
|
||||
|
||||
subroutine d_mv_cxx_to_coo(a,b,info)
|
||||
use psb_error_mod
|
||||
use psb_realloc_mod
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(inout) :: a
|
||||
class(psbn_d_coo_sparse_mat), intent(out) :: b
|
||||
integer, intent(out) :: info
|
||||
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='to_coo'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = 0
|
||||
call d_mv_cxx_to_coo_impl(a,b,info)
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
call psb_errpush(info,name)
|
||||
|
||||
if (err_act /= psb_act_ret_) then
|
||||
call psb_error()
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine d_mv_cxx_to_coo
|
||||
|
||||
subroutine d_mv_cxx_from_coo(a,b,info)
|
||||
use psb_error_mod
|
||||
use psb_realloc_mod
|
||||
@@ -907,4 +752,226 @@ contains
|
||||
end subroutine d_cxx_print
|
||||
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!
|
||||
!
|
||||
!
|
||||
! Computational routines
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
|
||||
subroutine d_cxx_csmv(alpha,a,x,beta,y,info,trans)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
real(psb_dpk_), intent(in) :: alpha, beta, x(:)
|
||||
real(psb_dpk_), intent(inout) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
character, optional, intent(in) :: trans
|
||||
|
||||
character :: trans_
|
||||
integer :: i,j,k,m,n, nnz, ir, jc
|
||||
real(psb_dpk_) :: acc
|
||||
logical :: tra
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='d_cxx_csmv'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (.not.a%is_asb()) then
|
||||
info = 1121
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
call d_cxx_csmm_impl(alpha,a,x,beta,y,info,trans)
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine d_cxx_csmv
|
||||
|
||||
subroutine d_cxx_csmm(alpha,a,x,beta,y,info,trans)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
real(psb_dpk_), intent(in) :: alpha, beta, x(:,:)
|
||||
real(psb_dpk_), intent(inout) :: y(:,:)
|
||||
integer, intent(out) :: info
|
||||
character, optional, intent(in) :: trans
|
||||
|
||||
character :: trans_
|
||||
integer :: i,j,k,m,n, nnz, ir, jc, nc
|
||||
real(psb_dpk_), allocatable :: acc(:)
|
||||
logical :: tra
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='d_cxx_csmm'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
|
||||
|
||||
call d_cxx_csmm_impl(alpha,a,x,beta,y,info,trans)
|
||||
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine d_cxx_csmm
|
||||
|
||||
|
||||
subroutine d_cxx_cssv(alpha,a,x,beta,y,info,trans)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
real(psb_dpk_), intent(in) :: alpha, beta, x(:)
|
||||
real(psb_dpk_), intent(inout) :: y(:)
|
||||
integer, intent(out) :: info
|
||||
character, optional, intent(in) :: trans
|
||||
|
||||
character :: trans_
|
||||
integer :: i,j,k,m,n, nnz, ir, jc
|
||||
real(psb_dpk_) :: acc
|
||||
real(psb_dpk_), allocatable :: tmp(:)
|
||||
logical :: tra
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='d_cxx_cssv'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (.not.a%is_asb()) then
|
||||
info = 1121
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
if (.not. (a%is_triangle())) then
|
||||
write(0,*) 'Called SM on a non-triangular mat!'
|
||||
info = 1121
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call d_cxx_cssm_impl(alpha,a,x,beta,y,info,trans)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
|
||||
end subroutine d_cxx_cssv
|
||||
|
||||
|
||||
|
||||
subroutine d_cxx_cssm(alpha,a,x,beta,y,info,trans)
|
||||
use psb_error_mod
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
real(psb_dpk_), intent(in) :: alpha, beta, x(:,:)
|
||||
real(psb_dpk_), intent(inout) :: y(:,:)
|
||||
integer, intent(out) :: info
|
||||
character, optional, intent(in) :: trans
|
||||
|
||||
character :: trans_
|
||||
integer :: i,j,k,m,n, nnz, ir, jc, nc
|
||||
real(psb_dpk_) :: acc
|
||||
real(psb_dpk_), allocatable :: tmp(:,:)
|
||||
logical :: tra
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='d_cxx_csmm'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (.not.a%is_asb()) then
|
||||
info = 1121
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
if (.not. (a%is_triangle())) then
|
||||
write(0,*) 'Called SM on a non-triangular mat!'
|
||||
info = 1121
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
call d_cxx_cssm_impl(alpha,a,x,beta,y,info,trans)
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine d_cxx_cssm
|
||||
|
||||
function d_cxx_csnmi(a) result(res)
|
||||
use psb_error_mod
|
||||
use psb_const_mod
|
||||
implicit none
|
||||
class(psbn_d_cxx_sparse_mat), intent(in) :: a
|
||||
real(psb_dpk_) :: res
|
||||
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='csnmi'
|
||||
logical, parameter :: debug=.false.
|
||||
|
||||
|
||||
res = d_cxx_csnmi_impl(a)
|
||||
|
||||
return
|
||||
|
||||
end function d_cxx_csnmi
|
||||
|
||||
|
||||
|
||||
end module psbn_d_cxx_mat_mod
|
||||
|
||||
Reference in New Issue
Block a user