base/modules/psb_c_base_mat_mod.f90
 base/modules/psb_c_base_vect_mod.f90
 base/modules/psb_c_csc_mat_mod.f90
 base/modules/psb_c_csr_mat_mod.f90
 base/modules/psb_c_mat_mod.f90
 base/modules/psb_d_base_mat_mod.f90
 base/modules/psb_d_base_vect_mod.f90
 base/modules/psb_d_csc_mat_mod.f90
 base/modules/psb_d_csr_mat_mod.f90
 base/modules/psb_d_mat_mod.f90
 base/modules/psb_s_base_mat_mod.f90
 base/modules/psb_s_base_vect_mod.f90
 base/modules/psb_s_csc_mat_mod.f90
 base/modules/psb_s_csr_mat_mod.f90
 base/modules/psb_s_mat_mod.f90
 base/modules/psb_z_base_mat_mod.f90
 base/modules/psb_z_base_vect_mod.f90
 base/modules/psb_z_csc_mat_mod.f90
 base/modules/psb_z_csr_mat_mod.f90
 base/modules/psb_z_mat_mod.f90

Comments fixes with preprocessing.
psblas3-type-indexed
Salvatore Filippone 13 years ago
parent 807148c3a4
commit 17ebee0184

@ -32,14 +32,15 @@
! !
! package: psb_c_base_mat_mod ! package: psb_c_base_mat_mod
! !
! This module contains the implementation of the ! This module contains the implementation of the psb_c_base_sparse_mat
! psb_c_base_sparse_mat, derived from the psb_base_sparse_mat to ! type, derived from the psb_base_sparse_mat one to define a middle
! define a middle level definition of a complex, single-precision sparse ! level definition of a complex(psb_spk_) sparse matrix
! matrix object.This class object itself does not have any additional ! object.This class object itself does not have any additional members
! members with respect to those of the base class. No methods can be ! with respect to those of the base class. No methods can be fully
! fully implemented at this level, but we can define the interface for ! implemented at this level, but we can define the interface for the
! the computational methods requiring the knowledge of the underlying ! computational methods requiring the knowledge of the underlying
! field, such as the matrix-vector product; this interface is defined, ! field, such as the matrix-vector product; this interface is defined,
! but is supposed to be overridden at the leaf level.
! !
! This module also contains the implementation of the ! This module also contains the implementation of the
! psb_c_coo_sparse_mat type and the related methods. This is the ! psb_c_coo_sparse_mat type and the related methods. This is the
@ -49,11 +50,9 @@
! psb_c_base_sparse_mat one. ! psb_c_base_sparse_mat one.
! !
! About the method MOLD: this has been defined for those compilers ! About the method MOLD: this has been defined for those compilers
! not yet supporting ALLOCATE( ...MOLD=...); it's otherwise silly to ! not yet supporting ALLOCATE( ...,MOLD=...); it's otherwise silly to
! duplicate "by hand" what is specified in the language (in this case F2008) ! duplicate "by hand" what is specified in the language (in this case F2008)
! !
module psb_c_base_mat_mod module psb_c_base_mat_mod
use psb_base_mat_mod use psb_base_mat_mod
@ -133,13 +132,6 @@ module psb_c_base_mat_mod
procedure, pass(a) :: c_inner_cssv => psb_c_coo_cssv procedure, pass(a) :: c_inner_cssv => psb_c_coo_cssv
procedure, pass(a) :: c_scals => psb_c_coo_scals procedure, pass(a) :: c_scals => psb_c_coo_scals
procedure, pass(a) :: c_scal => psb_c_coo_scal procedure, pass(a) :: c_scal => psb_c_coo_scal
procedure, pass(a) :: maxval => psb_c_coo_maxval
procedure, pass(a) :: csnmi => psb_c_coo_csnmi
procedure, pass(a) :: csnm1 => psb_c_coo_csnm1
procedure, pass(a) :: rowsum => psb_c_coo_rowsum
procedure, pass(a) :: arwsum => psb_c_coo_arwsum
procedure, pass(a) :: colsum => psb_c_coo_colsum
procedure, pass(a) :: aclsum => psb_c_coo_aclsum
procedure, pass(a) :: reallocate_nz => psb_c_coo_reallocate_nz procedure, pass(a) :: reallocate_nz => psb_c_coo_reallocate_nz
procedure, pass(a) :: allocate_mnnz => psb_c_coo_allocate_mnnz procedure, pass(a) :: allocate_mnnz => psb_c_coo_allocate_mnnz
procedure, pass(a) :: cp_to_coo => psb_c_cp_coo_to_coo procedure, pass(a) :: cp_to_coo => psb_c_cp_coo_to_coo
@ -151,6 +143,13 @@ module psb_c_base_mat_mod
procedure, pass(a) :: mv_to_fmt => psb_c_mv_coo_to_fmt procedure, pass(a) :: mv_to_fmt => psb_c_mv_coo_to_fmt
procedure, pass(a) :: mv_from_fmt => psb_c_mv_coo_from_fmt procedure, pass(a) :: mv_from_fmt => psb_c_mv_coo_from_fmt
procedure, pass(a) :: csput => psb_c_coo_csput procedure, pass(a) :: csput => psb_c_coo_csput
procedure, pass(a) :: maxval => psb_c_coo_maxval
procedure, pass(a) :: csnmi => psb_c_coo_csnmi
procedure, pass(a) :: csnm1 => psb_c_coo_csnm1
procedure, pass(a) :: rowsum => psb_c_coo_rowsum
procedure, pass(a) :: arwsum => psb_c_coo_arwsum
procedure, pass(a) :: colsum => psb_c_coo_colsum
procedure, pass(a) :: aclsum => psb_c_coo_aclsum
procedure, pass(a) :: get_diag => psb_c_coo_get_diag procedure, pass(a) :: get_diag => psb_c_coo_get_diag
procedure, pass(a) :: c_csgetrow => psb_c_coo_csgetrow procedure, pass(a) :: c_csgetrow => psb_c_coo_csgetrow
procedure, pass(a) :: csgetptn => psb_c_coo_csgetptn procedure, pass(a) :: csgetptn => psb_c_coo_csgetptn
@ -304,7 +303,6 @@ module psb_c_base_mat_mod
end subroutine psb_c_base_scal end subroutine psb_c_base_scal
end interface end interface
interface interface
function psb_c_base_maxval(a) result(res) function psb_c_base_maxval(a) result(res)
import :: psb_c_base_sparse_mat, psb_spk_ import :: psb_c_base_sparse_mat, psb_spk_
@ -435,6 +433,7 @@ module psb_c_base_mat_mod
end subroutine psb_c_base_mold end subroutine psb_c_base_mold
end interface end interface
interface interface
subroutine psb_c_base_cp_to_coo(a,b,info) subroutine psb_c_base_cp_to_coo(a,b,info)
import :: psb_c_base_sparse_mat, psb_c_coo_sparse_mat, psb_spk_ import :: psb_c_base_sparse_mat, psb_c_coo_sparse_mat, psb_spk_
@ -587,6 +586,7 @@ module psb_c_base_mat_mod
end subroutine psb_c_coo_mold end subroutine psb_c_coo_mold
end interface end interface
interface interface
subroutine psb_c_coo_print(iout,a,iv,eirs,eics,head,ivr,ivc) subroutine psb_c_coo_print(iout,a,iv,eirs,eics,head,ivr,ivc)
import :: psb_c_coo_sparse_mat import :: psb_c_coo_sparse_mat
@ -802,6 +802,7 @@ module psb_c_base_mat_mod
end subroutine psb_c_coo_csmm end subroutine psb_c_coo_csmm
end interface end interface
interface interface
function psb_c_coo_maxval(a) result(res) function psb_c_coo_maxval(a) result(res)
import :: psb_c_coo_sparse_mat, psb_spk_ import :: psb_c_coo_sparse_mat, psb_spk_
@ -938,7 +939,7 @@ contains
class(psb_c_coo_sparse_mat), intent(in) :: a class(psb_c_coo_sparse_mat), intent(in) :: a
integer(psb_long_int_k_) :: res integer(psb_long_int_k_) :: res
res = 8 + 1 res = 8 + 1
res = res + 2 * psb_sizeof_sp * size(a%val) res = res + (2*psb_sizeof_sp) * size(a%val)
res = res + psb_sizeof_int * size(a%ia) res = res + psb_sizeof_int * size(a%ia)
res = res + psb_sizeof_int * size(a%ja) res = res + psb_sizeof_int * size(a%ja)
@ -1018,8 +1019,6 @@ contains
! !
! == ================================== ! == ==================================
subroutine c_coo_free(a) subroutine c_coo_free(a)
implicit none implicit none
@ -1071,13 +1070,15 @@ contains
end subroutine c_coo_transp_1mat end subroutine c_coo_transp_1mat
subroutine c_coo_transc_1mat(a) subroutine c_coo_transc_1mat(a)
implicit none implicit none
class(psb_c_coo_sparse_mat), intent(inout) :: a class(psb_c_coo_sparse_mat), intent(inout) :: a
call a%transp() call a%transp()
a%val(:) = conjg(a%val) ! This will morph into conjg() for C and Z
! and into a no-op for S and D, so a conditional
! on a constant ought to take it out completely.
if (psb_c_is_complex_) a%val(:) = conjg(a%val(:))
end subroutine c_coo_transc_1mat end subroutine c_coo_transc_1mat

@ -7,7 +7,6 @@ module psb_c_base_vect_mod
complex(psb_spk_), allocatable :: v(:) complex(psb_spk_), allocatable :: v(:)
contains contains
procedure, pass(x) :: get_nrows => c_base_get_nrows procedure, pass(x) :: get_nrows => c_base_get_nrows
procedure, pass(x) :: sizeof => c_base_sizeof
procedure, pass(x) :: dot_v => c_base_dot_v procedure, pass(x) :: dot_v => c_base_dot_v
procedure, pass(x) :: dot_a => c_base_dot_a procedure, pass(x) :: dot_a => c_base_dot_a
generic, public :: dot => dot_v, dot_a generic, public :: dot => dot_v, dot_a
@ -72,12 +71,10 @@ contains
subroutine c_base_bld_n(x,n) subroutine c_base_bld_n(x,n)
use psb_realloc_mod
integer, intent(in) :: n integer, intent(in) :: n
class(psb_c_base_vect_type), intent(inout) :: x class(psb_c_base_vect_type), intent(inout) :: x
integer :: info integer :: info
call psb_realloc(n,x%v,info)
call x%asb(n,info) call x%asb(n,info)
end subroutine c_base_bld_n end subroutine c_base_bld_n
@ -116,14 +113,10 @@ contains
subroutine c_base_set_vect(x,val) subroutine c_base_set_vect(x,val)
class(psb_c_base_vect_type), intent(inout) :: x class(psb_c_base_vect_type), intent(inout) :: x
complex(psb_spk_), intent(in) :: val(:) complex(psb_spk_), intent(in) :: val(:)
integer :: nr
integer :: info integer :: info
if (allocated(x%v)) then
nr = min(size(x%v),size(val))
x%v(1:nr) = val(1:nr)
else
x%v = val x%v = val
end if
end subroutine c_base_set_vect end subroutine c_base_set_vect
@ -146,21 +139,15 @@ contains
end function size_const end function size_const
function c_base_get_nrows(x) result(res) function c_base_get_nrows(x) result(res)
implicit none implicit none
class(psb_c_base_vect_type), intent(in) :: x class(psb_c_base_vect_type), intent(in) :: x
integer :: res integer :: res
res = 0 res = -1
if (allocated(x%v)) res = size(x%v) if (allocated(x%v)) res = size(x%v)
end function c_base_get_nrows end function c_base_get_nrows
function c_base_sizeof(x) result(res)
implicit none
class(psb_c_base_vect_type), intent(in) :: x
integer(psb_long_int_k_) :: res
res = (2*psb_sizeof_sp)*x%get_nrows()
end function c_base_sizeof
function c_base_dot_v(n,x,y) result(res) function c_base_dot_v(n,x,y) result(res)
implicit none implicit none
class(psb_c_base_vect_type), intent(inout) :: x, y class(psb_c_base_vect_type), intent(inout) :: x, y
@ -273,8 +260,6 @@ contains
complex(psb_spk_), intent(in) :: x(:) complex(psb_spk_), intent(in) :: x(:)
class(psb_c_base_vect_type), intent(inout) :: z class(psb_c_base_vect_type), intent(inout) :: z
integer, intent(out) :: info integer, intent(out) :: info
! character(len=1), intent(in), optional :: conjgx, conjgy
integer :: i, n integer :: i, n
info = 0 info = 0
@ -335,32 +320,19 @@ contains
end if end if
end subroutine c_base_mlt_a_2 end subroutine c_base_mlt_a_2
subroutine c_base_mlt_v_2(alpha,x,y,beta,z,info,conjgx,conjgy) subroutine c_base_mlt_v_2(alpha,x,y,beta,z,info)
use psi_serial_mod use psi_serial_mod
use psb_string_mod
implicit none implicit none
complex(psb_spk_), intent(in) :: alpha,beta complex(psb_spk_), intent(in) :: alpha,beta
class(psb_c_base_vect_type), intent(inout) :: x class(psb_c_base_vect_type), intent(inout) :: x
class(psb_c_base_vect_type), intent(inout) :: y class(psb_c_base_vect_type), intent(inout) :: y
class(psb_c_base_vect_type), intent(inout) :: z class(psb_c_base_vect_type), intent(inout) :: z
integer, intent(out) :: info integer, intent(out) :: info
character(len=1), intent(in), optional :: conjgx, conjgy
integer :: i, n integer :: i, n
info = 0 info = 0
if (present(conjgx)) then
if (psb_toupper(conjgx)=='C') x%v=conjg(x%v)
end if
if (present(conjgy)) then
if (psb_toupper(conjgy)=='C') y%v=conjg(y%v)
end if
call z%mlt(alpha,x%v,y%v,beta,info) call z%mlt(alpha,x%v,y%v,beta,info)
if (present(conjgx)) then
if (psb_toupper(conjgx)=='C') x%v=conjg(x%v)
end if
if (present(conjgy)) then
if (psb_toupper(conjgy)=='C') y%v=conjg(y%v)
end if
end subroutine c_base_mlt_v_2 end subroutine c_base_mlt_v_2

@ -38,7 +38,6 @@
! specific to the type and could not be defined higher in the ! specific to the type and could not be defined higher in the
! hierarchy). We are at the bottom level of the inheritance chain. ! hierarchy). We are at the bottom level of the inheritance chain.
! !
module psb_c_csc_mat_mod module psb_c_csc_mat_mod
use psb_c_base_mat_mod use psb_c_base_mat_mod
@ -80,7 +79,7 @@ module psb_c_csc_mat_mod
procedure, pass(a) :: get_diag => psb_c_csc_get_diag procedure, pass(a) :: get_diag => psb_c_csc_get_diag
procedure, pass(a) :: csgetptn => psb_c_csc_csgetptn procedure, pass(a) :: csgetptn => psb_c_csc_csgetptn
procedure, pass(a) :: c_csgetrow => psb_c_csc_csgetrow procedure, pass(a) :: c_csgetrow => psb_c_csc_csgetrow
!!$ procedure, pass(a) :: get_nz_col => c_csc_get_nz_col procedure, pass(a) :: get_nz_col => c_csc_get_nz_col
procedure, pass(a) :: reinit => psb_c_csc_reinit procedure, pass(a) :: reinit => psb_c_csc_reinit
procedure, pass(a) :: trim => psb_c_csc_trim procedure, pass(a) :: trim => psb_c_csc_trim
procedure, pass(a) :: print => psb_c_csc_print procedure, pass(a) :: print => psb_c_csc_print
@ -94,7 +93,7 @@ module psb_c_csc_mat_mod
end type psb_c_csc_sparse_mat end type psb_c_csc_sparse_mat
private :: c_csc_get_nzeros, c_csc_free, c_csc_get_fmt, & private :: c_csc_get_nzeros, c_csc_free, c_csc_get_fmt, &
& c_csc_get_size, c_csc_sizeof, c_csc_get_nc_col & c_csc_get_size, c_csc_sizeof, c_csc_get_nz_col
interface interface
subroutine psb_c_csc_reallocate_nz(nz,a) subroutine psb_c_csc_reallocate_nz(nz,a)
@ -336,6 +335,7 @@ module psb_c_csc_mat_mod
end subroutine psb_c_csc_csmm end subroutine psb_c_csc_csmm
end interface end interface
interface interface
function psb_c_csc_maxval(a) result(res) function psb_c_csc_maxval(a) result(res)
import :: psb_c_csc_sparse_mat, psb_spk_ import :: psb_c_csc_sparse_mat, psb_spk_
@ -440,7 +440,7 @@ contains
class(psb_c_csc_sparse_mat), intent(in) :: a class(psb_c_csc_sparse_mat), intent(in) :: a
integer(psb_long_int_k_) :: res integer(psb_long_int_k_) :: res
res = 8 res = 8
res = res + 2 * psb_sizeof_sp * size(a%val) res = res + (2*psb_sizeof_sp) * size(a%val)
res = res + psb_sizeof_int * size(a%icp) res = res + psb_sizeof_int * size(a%icp)
res = res + psb_sizeof_int * size(a%ia) res = res + psb_sizeof_int * size(a%ia)
@ -464,7 +464,7 @@ contains
class(psb_c_csc_sparse_mat), intent(in) :: a class(psb_c_csc_sparse_mat), intent(in) :: a
integer :: res integer :: res
res = -1 res = 0
if (allocated(a%ia)) then if (allocated(a%ia)) then
if (res >= 0) then if (res >= 0) then
@ -485,7 +485,7 @@ contains
function c_csc_get_nc_col(idx,a) result(res) function c_csc_get_nz_col(idx,a) result(res)
use psb_const_mod use psb_const_mod
implicit none implicit none
@ -499,7 +499,7 @@ contains
res = a%icp(idx+1)-a%icp(idx) res = a%icp(idx+1)-a%icp(idx)
end if end if
end function c_csc_get_nc_col end function c_csc_get_nz_col

@ -79,7 +79,7 @@ module psb_c_csr_mat_mod
procedure, pass(a) :: get_diag => psb_c_csr_get_diag procedure, pass(a) :: get_diag => psb_c_csr_get_diag
procedure, pass(a) :: csgetptn => psb_c_csr_csgetptn procedure, pass(a) :: csgetptn => psb_c_csr_csgetptn
procedure, pass(a) :: c_csgetrow => psb_c_csr_csgetrow procedure, pass(a) :: c_csgetrow => psb_c_csr_csgetrow
!!$ procedure, pass(a) :: get_nz_row => c_csr_get_nz_row procedure, pass(a) :: get_nz_row => c_csr_get_nz_row
procedure, pass(a) :: reinit => psb_c_csr_reinit procedure, pass(a) :: reinit => psb_c_csr_reinit
procedure, pass(a) :: trim => psb_c_csr_trim procedure, pass(a) :: trim => psb_c_csr_trim
procedure, pass(a) :: print => psb_c_csr_print procedure, pass(a) :: print => psb_c_csr_print
@ -93,7 +93,7 @@ module psb_c_csr_mat_mod
end type psb_c_csr_sparse_mat end type psb_c_csr_sparse_mat
private :: c_csr_get_nzeros, c_csr_free, c_csr_get_fmt, & private :: c_csr_get_nzeros, c_csr_free, c_csr_get_fmt, &
& c_csr_get_size, c_csr_sizeof, c_csr_get_nc_row & c_csr_get_size, c_csr_sizeof, c_csr_get_nz_row
interface interface
subroutine psb_c_csr_reallocate_nz(nz,a) subroutine psb_c_csr_reallocate_nz(nz,a)
@ -335,6 +335,7 @@ module psb_c_csr_mat_mod
end subroutine psb_c_csr_csmm end subroutine psb_c_csr_csmm
end interface end interface
interface interface
function psb_c_csr_maxval(a) result(res) function psb_c_csr_maxval(a) result(res)
import :: psb_c_csr_sparse_mat, psb_spk_ import :: psb_c_csr_sparse_mat, psb_spk_
@ -440,7 +441,7 @@ contains
class(psb_c_csr_sparse_mat), intent(in) :: a class(psb_c_csr_sparse_mat), intent(in) :: a
integer(psb_long_int_k_) :: res integer(psb_long_int_k_) :: res
res = 8 res = 8
res = res + 2 * psb_sizeof_sp * size(a%val) res = res + (2*psb_sizeof_sp) * size(a%val)
res = res + psb_sizeof_int * size(a%irp) res = res + psb_sizeof_int * size(a%irp)
res = res + psb_sizeof_int * size(a%ja) res = res + psb_sizeof_int * size(a%ja)
@ -464,7 +465,7 @@ contains
class(psb_c_csr_sparse_mat), intent(in) :: a class(psb_c_csr_sparse_mat), intent(in) :: a
integer :: res integer :: res
res = -1 res = 0
if (allocated(a%ja)) then if (allocated(a%ja)) then
if (res >= 0) then if (res >= 0) then
@ -485,7 +486,7 @@ contains
function c_csr_get_nc_row(idx,a) result(res) function c_csr_get_nz_row(idx,a) result(res)
implicit none implicit none
@ -499,7 +500,7 @@ contains
res = a%irp(idx+1)-a%irp(idx) res = a%irp(idx+1)-a%irp(idx)
end if end if
end function c_csr_get_nc_row end function c_csr_get_nz_row

@ -109,7 +109,6 @@ module psb_c_mat_mod
procedure, pass(a) :: c_cscnv_ip => psb_c_cscnv_ip procedure, pass(a) :: c_cscnv_ip => psb_c_cscnv_ip
procedure, pass(a) :: c_cscnv_base => psb_c_cscnv_base procedure, pass(a) :: c_cscnv_base => psb_c_cscnv_base
generic, public :: cscnv => c_cscnv, c_cscnv_ip, c_cscnv_base generic, public :: cscnv => c_cscnv, c_cscnv_ip, c_cscnv_base
procedure, pass(a) :: clone => psb_cspmat_type_clone
procedure, pass(a) :: reinit => psb_c_reinit procedure, pass(a) :: reinit => psb_c_reinit
procedure, pass(a) :: print_i => psb_c_sparse_print procedure, pass(a) :: print_i => psb_c_sparse_print
procedure, pass(a) :: print_n => psb_c_n_sparse_print procedure, pass(a) :: print_n => psb_c_n_sparse_print
@ -154,9 +153,9 @@ module psb_c_mat_mod
end type psb_cspmat_type end type psb_cspmat_type
private :: psb_c_get_nrows, psb_c_get_ncols, psb_c_get_nzeros, psb_c_get_size, & private :: psb_c_get_nrows, psb_c_get_ncols, psb_c_get_nzeros, psb_c_get_size, &
& psb_c_get_state, psb_c_get_dupl, psb_c_is_null, psb_c_is_bld, psb_c_is_upd, & & psb_c_get_state, psb_c_get_dupl, psb_c_is_null, psb_c_is_bld, &
& psb_c_is_asb, psb_c_is_sorted, psb_c_is_upper, psb_c_is_lower, psb_c_is_triangle,& & psb_c_is_upd, psb_c_is_asb, psb_c_is_sorted, psb_c_is_upper, &
& psb_c_get_nz_row & psb_c_is_lower, psb_c_is_triangle, psb_c_get_nz_row
interface psb_sizeof interface psb_sizeof
module procedure psb_c_sizeof module procedure psb_c_sizeof
@ -347,9 +346,9 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) subroutine psb_c_csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(inout) :: a class(psb_cspmat_type), intent(inout) :: a
complex(psb_spk_), intent(in) :: val(:) complex(psb_dpk_), intent(in) :: val(:)
integer, intent(in) :: nz, ia(:), ja(:), imin,imax,jmin,jmax integer, intent(in) :: nz, ia(:), ja(:), imin,imax,jmin,jmax
integer, intent(out) :: info integer, intent(out) :: info
integer, intent(in), optional :: gtl(:) integer, intent(in), optional :: gtl(:)
@ -359,7 +358,7 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_csgetptn(imin,imax,a,nz,ia,ja,info,& subroutine psb_c_csgetptn(imin,imax,a,nz,ia,ja,info,&
& jmin,jmax,iren,append,nzin,rscale,cscale) & jmin,jmax,iren,append,nzin,rscale,cscale)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
integer, intent(in) :: imin,imax integer, intent(in) :: imin,imax
integer, intent(out) :: nz integer, intent(out) :: nz
@ -375,12 +374,12 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_csgetrow(imin,imax,a,nz,ia,ja,val,info,& subroutine psb_c_csgetrow(imin,imax,a,nz,ia,ja,val,info,&
& jmin,jmax,iren,append,nzin,rscale,cscale) & jmin,jmax,iren,append,nzin,rscale,cscale)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
integer, intent(in) :: imin,imax integer, intent(in) :: imin,imax
integer, intent(out) :: nz integer, intent(out) :: nz
integer, allocatable, intent(inout) :: ia(:), ja(:) integer, allocatable, intent(inout) :: ia(:), ja(:)
complex(psb_spk_), allocatable, intent(inout) :: val(:) complex(psb_dpk_), allocatable, intent(inout) :: val(:)
integer,intent(out) :: info integer,intent(out) :: info
logical, intent(in), optional :: append logical, intent(in), optional :: append
integer, intent(in), optional :: iren(:) integer, intent(in), optional :: iren(:)
@ -392,7 +391,7 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_csgetblk(imin,imax,a,b,info,& subroutine psb_c_csgetblk(imin,imax,a,b,info,&
& jmin,jmax,iren,append,rscale,cscale) & jmin,jmax,iren,append,rscale,cscale)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
class(psb_cspmat_type), intent(out) :: b class(psb_cspmat_type), intent(out) :: b
integer, intent(in) :: imin,imax integer, intent(in) :: imin,imax
@ -407,7 +406,7 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_csclip(a,b,info,& subroutine psb_c_csclip(a,b,info,&
& imin,imax,jmin,jmax,rscale,cscale) & imin,imax,jmin,jmax,rscale,cscale)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
class(psb_cspmat_type), intent(out) :: b class(psb_cspmat_type), intent(out) :: b
integer,intent(out) :: info integer,intent(out) :: info
@ -419,7 +418,7 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_b_csclip(a,b,info,& subroutine psb_c_b_csclip(a,b,info,&
& imin,imax,jmin,jmax,rscale,cscale) & imin,imax,jmin,jmax,rscale,cscale)
import :: psb_cspmat_type, psb_spk_, psb_c_coo_sparse_mat import :: psb_cspmat_type, psb_dpk_, psb_c_coo_sparse_mat
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
type(psb_c_coo_sparse_mat), intent(out) :: b type(psb_c_coo_sparse_mat), intent(out) :: b
integer,intent(out) :: info integer,intent(out) :: info
@ -430,7 +429,7 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_cscnv(a,b,info,type,mold,upd,dupl) subroutine psb_c_cscnv(a,b,info,type,mold,upd,dupl)
import :: psb_cspmat_type, psb_spk_, psb_c_base_sparse_mat import :: psb_cspmat_type, psb_dpk_, psb_c_base_sparse_mat
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
class(psb_cspmat_type), intent(out) :: b class(psb_cspmat_type), intent(out) :: b
integer, intent(out) :: info integer, intent(out) :: info
@ -443,7 +442,7 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_cscnv_ip(a,iinfo,type,mold,dupl) subroutine psb_c_cscnv_ip(a,iinfo,type,mold,dupl)
import :: psb_cspmat_type, psb_spk_, psb_c_base_sparse_mat import :: psb_cspmat_type, psb_dpk_, psb_c_base_sparse_mat
class(psb_cspmat_type), intent(inout) :: a class(psb_cspmat_type), intent(inout) :: a
integer, intent(out) :: iinfo integer, intent(out) :: iinfo
integer,optional, intent(in) :: dupl integer,optional, intent(in) :: dupl
@ -455,7 +454,7 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_cscnv_base(a,b,info,dupl) subroutine psb_c_cscnv_base(a,b,info,dupl)
import :: psb_cspmat_type, psb_spk_, psb_c_base_sparse_mat import :: psb_cspmat_type, psb_dpk_, psb_c_base_sparse_mat
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
class(psb_c_base_sparse_mat), intent(out) :: b class(psb_c_base_sparse_mat), intent(out) :: b
integer, intent(out) :: info integer, intent(out) :: info
@ -482,7 +481,7 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_mv_from(a,b) subroutine psb_c_mv_from(a,b)
import :: psb_cspmat_type, psb_spk_, psb_c_base_sparse_mat import :: psb_cspmat_type, psb_dpk_, psb_c_base_sparse_mat
class(psb_cspmat_type), intent(out) :: a class(psb_cspmat_type), intent(out) :: a
class(psb_c_base_sparse_mat), intent(inout) :: b class(psb_c_base_sparse_mat), intent(inout) :: b
end subroutine psb_c_mv_from end subroutine psb_c_mv_from
@ -490,15 +489,15 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_cp_from(a,b) subroutine psb_c_cp_from(a,b)
import :: psb_cspmat_type, psb_spk_, psb_c_base_sparse_mat import :: psb_cspmat_type, psb_dpk_, psb_c_base_sparse_mat
class(psb_cspmat_type), intent(out) :: a class(psb_cspmat_type), intent(out) :: a
class(psb_c_base_sparse_mat), intent(in) :: b class(psb_c_base_sparse_mat), intent(inout), allocatable :: b
end subroutine psb_c_cp_from end subroutine psb_c_cp_from
end interface end interface
interface interface
subroutine psb_c_mv_to(a,b) subroutine psb_c_mv_to(a,b)
import :: psb_cspmat_type, psb_spk_, psb_c_base_sparse_mat import :: psb_cspmat_type, psb_dpk_, psb_c_base_sparse_mat
class(psb_cspmat_type), intent(inout) :: a class(psb_cspmat_type), intent(inout) :: a
class(psb_c_base_sparse_mat), intent(out) :: b class(psb_c_base_sparse_mat), intent(out) :: b
end subroutine psb_c_mv_to end subroutine psb_c_mv_to
@ -506,7 +505,7 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_cp_to(a,b) subroutine psb_c_cp_to(a,b)
import :: psb_cspmat_type, psb_spk_, psb_c_base_sparse_mat import :: psb_cspmat_type, psb_dpk_, psb_c_base_sparse_mat
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
class(psb_c_base_sparse_mat), intent(out) :: b class(psb_c_base_sparse_mat), intent(out) :: b
end subroutine psb_c_cp_to end subroutine psb_c_cp_to
@ -594,26 +593,26 @@ module psb_c_mat_mod
interface psb_csmm interface psb_csmm
subroutine psb_c_csmm(alpha,a,x,beta,y,info,trans) subroutine psb_c_csmm(alpha,a,x,beta,y,info,trans)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
complex(psb_spk_), intent(in) :: alpha, beta, x(:,:) complex(psb_dpk_), intent(in) :: alpha, beta, x(:,:)
complex(psb_spk_), intent(inout) :: y(:,:) complex(psb_dpk_), intent(inout) :: y(:,:)
integer, intent(out) :: info integer, intent(out) :: info
character, optional, intent(in) :: trans character, optional, intent(in) :: trans
end subroutine psb_c_csmm end subroutine psb_c_csmm
subroutine psb_c_csmv(alpha,a,x,beta,y,info,trans) subroutine psb_c_csmv(alpha,a,x,beta,y,info,trans)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
complex(psb_spk_), intent(in) :: alpha, beta, x(:) complex(psb_dpk_), intent(in) :: alpha, beta, x(:)
complex(psb_spk_), intent(inout) :: y(:) complex(psb_dpk_), intent(inout) :: y(:)
integer, intent(out) :: info integer, intent(out) :: info
character, optional, intent(in) :: trans character, optional, intent(in) :: trans
end subroutine psb_c_csmv end subroutine psb_c_csmv
subroutine psb_c_csmv_vect(alpha,a,x,beta,y,info,trans) subroutine psb_c_csmv_vect(alpha,a,x,beta,y,info,trans)
use psb_c_vect_mod, only : psb_c_vect_type use psb_c_vect_mod, only : psb_c_vect_type
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
complex(psb_spk_), intent(in) :: alpha, beta complex(psb_dpk_), intent(in) :: alpha, beta
type(psb_c_vect_type), intent(inout) :: x type(psb_c_vect_type), intent(inout) :: x
type(psb_c_vect_type), intent(inout) :: y type(psb_c_vect_type), intent(inout) :: y
integer, intent(out) :: info integer, intent(out) :: info
@ -623,28 +622,28 @@ module psb_c_mat_mod
interface psb_cssm interface psb_cssm
subroutine psb_c_cssm(alpha,a,x,beta,y,info,trans,scale,d) subroutine psb_c_cssm(alpha,a,x,beta,y,info,trans,scale,d)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
complex(psb_spk_), intent(in) :: alpha, beta, x(:,:) complex(psb_dpk_), intent(in) :: alpha, beta, x(:,:)
complex(psb_spk_), intent(inout) :: y(:,:) complex(psb_dpk_), intent(inout) :: y(:,:)
integer, intent(out) :: info integer, intent(out) :: info
character, optional, intent(in) :: trans, scale character, optional, intent(in) :: trans, scale
complex(psb_spk_), intent(in), optional :: d(:) complex(psb_dpk_), intent(in), optional :: d(:)
end subroutine psb_c_cssm end subroutine psb_c_cssm
subroutine psb_c_cssv(alpha,a,x,beta,y,info,trans,scale,d) subroutine psb_c_cssv(alpha,a,x,beta,y,info,trans,scale,d)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
complex(psb_spk_), intent(in) :: alpha, beta, x(:) complex(psb_dpk_), intent(in) :: alpha, beta, x(:)
complex(psb_spk_), intent(inout) :: y(:) complex(psb_dpk_), intent(inout) :: y(:)
integer, intent(out) :: info integer, intent(out) :: info
character, optional, intent(in) :: trans, scale character, optional, intent(in) :: trans, scale
complex(psb_spk_), intent(in), optional :: d(:) complex(psb_dpk_), intent(in), optional :: d(:)
end subroutine psb_c_cssv end subroutine psb_c_cssv
subroutine psb_c_cssv_vect(alpha,a,x,beta,y,info,trans,scale,d) subroutine psb_c_cssv_vect(alpha,a,x,beta,y,info,trans,scale,d)
use psb_c_vect_mod, only : psb_c_vect_type use psb_c_vect_mod, only : psb_c_vect_type
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
complex(psb_spk_), intent(in) :: alpha, beta complex(psb_dpk_), intent(in) :: alpha, beta
type(psb_c_vect_type), intent(inout) :: x type(psb_c_vect_type), intent(inout) :: x
type(psb_c_vect_type), intent(inout) :: y type(psb_c_vect_type), intent(inout) :: y
integer, intent(out) :: info integer, intent(out) :: info
@ -655,60 +654,60 @@ module psb_c_mat_mod
interface interface
function psb_c_maxval(a) result(res) function psb_c_maxval(a) result(res)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
real(psb_spk_) :: res real(psb_dpk_) :: res
end function psb_c_maxval end function psb_c_maxval
end interface end interface
interface interface
function psb_c_csnmi(a) result(res) function psb_c_csnmi(a) result(res)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
real(psb_spk_) :: res real(psb_dpk_) :: res
end function psb_c_csnmi end function psb_c_csnmi
end interface end interface
interface interface
function psb_c_csnm1(a) result(res) function psb_c_csnm1(a) result(res)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
real(psb_spk_) :: res real(psb_dpk_) :: res
end function psb_c_csnm1 end function psb_c_csnm1
end interface end interface
interface interface
subroutine psb_c_rowsum(d,a,info) subroutine psb_c_rowsum(d,a,info)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
complex(psb_spk_), intent(out) :: d(:) complex(psb_dpk_), intent(out) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_c_rowsum end subroutine psb_c_rowsum
end interface end interface
interface interface
subroutine psb_c_arwsum(d,a,info) subroutine psb_c_arwsum(d,a,info)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
real(psb_spk_), intent(out) :: d(:) real(psb_dpk_), intent(out) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_c_arwsum end subroutine psb_c_arwsum
end interface end interface
interface interface
subroutine psb_c_colsum(d,a,info) subroutine psb_c_colsum(d,a,info)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
complex(psb_spk_), intent(out) :: d(:) complex(psb_dpk_), intent(out) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_c_colsum end subroutine psb_c_colsum
end interface end interface
interface interface
subroutine psb_c_aclsum(d,a,info) subroutine psb_c_aclsum(d,a,info)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
real(psb_spk_), intent(out) :: d(:) real(psb_dpk_), intent(out) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_c_aclsum end subroutine psb_c_aclsum
end interface end interface
@ -716,24 +715,24 @@ module psb_c_mat_mod
interface interface
subroutine psb_c_get_diag(a,d,info) subroutine psb_c_get_diag(a,d,info)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a
complex(psb_spk_), intent(out) :: d(:) complex(psb_dpk_), intent(out) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_c_get_diag end subroutine psb_c_get_diag
end interface end interface
interface psb_scal interface psb_scal
subroutine psb_c_scal(d,a,info) subroutine psb_c_scal(d,a,info)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(inout) :: a class(psb_cspmat_type), intent(inout) :: a
complex(psb_spk_), intent(in) :: d(:) complex(psb_dpk_), intent(in) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_c_scal end subroutine psb_c_scal
subroutine psb_c_scals(d,a,info) subroutine psb_c_scals(d,a,info)
import :: psb_cspmat_type, psb_spk_ import :: psb_cspmat_type, psb_dpk_
class(psb_cspmat_type), intent(inout) :: a class(psb_cspmat_type), intent(inout) :: a
complex(psb_spk_), intent(in) :: d complex(psb_dpk_), intent(in) :: d
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_c_scals end subroutine psb_c_scals
end interface end interface
@ -768,7 +767,6 @@ contains
end function psb_c_sizeof end function psb_c_sizeof
function psb_c_get_fmt(a) result(res) function psb_c_get_fmt(a) result(res)
implicit none implicit none
class(psb_cspmat_type), intent(in) :: a class(psb_cspmat_type), intent(in) :: a

@ -34,7 +34,7 @@
! !
! This module contains the implementation of the psb_d_base_sparse_mat ! This module contains the implementation of the psb_d_base_sparse_mat
! type, derived from the psb_base_sparse_mat one to define a middle ! type, derived from the psb_base_sparse_mat one to define a middle
! level definition of a real, double-precision sparse matrix ! level definition of a real(psb_dpk_) sparse matrix
! object.This class object itself does not have any additional members ! object.This class object itself does not have any additional members
! with respect to those of the base class. No methods can be fully ! with respect to those of the base class. No methods can be fully
! implemented at this level, but we can define the interface for the ! implemented at this level, but we can define the interface for the
@ -50,11 +50,9 @@
! psb_d_base_sparse_mat one. ! psb_d_base_sparse_mat one.
! !
! About the method MOLD: this has been defined for those compilers ! About the method MOLD: this has been defined for those compilers
! not yet supporting ALLOCATE( ...MOLD=...); it's otherwise silly to ! not yet supporting ALLOCATE( ...,MOLD=...); it's otherwise silly to
! duplicate "by hand" what is specified in the language (in this case F2008) ! duplicate "by hand" what is specified in the language (in this case F2008)
! !
module psb_d_base_mat_mod module psb_d_base_mat_mod
use psb_base_mat_mod use psb_base_mat_mod
@ -1077,6 +1075,11 @@ contains
class(psb_d_coo_sparse_mat), intent(inout) :: a class(psb_d_coo_sparse_mat), intent(inout) :: a
call a%transp() call a%transp()
! This will morph into conjg() for C and Z
! and into a no-op for S and D, so a conditional
! on a constant ought to take it out completely.
if (psb_d_is_complex_) a%val(:) = (a%val(:))
end subroutine d_coo_transc_1mat end subroutine d_coo_transc_1mat

@ -7,7 +7,6 @@ module psb_d_base_vect_mod
real(psb_dpk_), allocatable :: v(:) real(psb_dpk_), allocatable :: v(:)
contains contains
procedure, pass(x) :: get_nrows => d_base_get_nrows procedure, pass(x) :: get_nrows => d_base_get_nrows
procedure, pass(x) :: sizeof => d_base_sizeof
procedure, pass(x) :: dot_v => d_base_dot_v procedure, pass(x) :: dot_v => d_base_dot_v
procedure, pass(x) :: dot_a => d_base_dot_a procedure, pass(x) :: dot_a => d_base_dot_a
generic, public :: dot => dot_v, dot_a generic, public :: dot => dot_v, dot_a
@ -72,12 +71,10 @@ contains
subroutine d_base_bld_n(x,n) subroutine d_base_bld_n(x,n)
use psb_realloc_mod
integer, intent(in) :: n integer, intent(in) :: n
class(psb_d_base_vect_type), intent(inout) :: x class(psb_d_base_vect_type), intent(inout) :: x
integer :: info integer :: info
call psb_realloc(n,x%v,info)
call x%asb(n,info) call x%asb(n,info)
end subroutine d_base_bld_n end subroutine d_base_bld_n
@ -116,14 +113,10 @@ contains
subroutine d_base_set_vect(x,val) subroutine d_base_set_vect(x,val)
class(psb_d_base_vect_type), intent(inout) :: x class(psb_d_base_vect_type), intent(inout) :: x
real(psb_dpk_), intent(in) :: val(:) real(psb_dpk_), intent(in) :: val(:)
integer :: nr
integer :: info integer :: info
if (allocated(x%v)) then
nr = min(size(x%v),size(val))
x%v(1:nr) = val(1:nr)
else
x%v = val x%v = val
end if
end subroutine d_base_set_vect end subroutine d_base_set_vect
@ -146,21 +139,15 @@ contains
end function size_const end function size_const
function d_base_get_nrows(x) result(res) function d_base_get_nrows(x) result(res)
implicit none implicit none
class(psb_d_base_vect_type), intent(in) :: x class(psb_d_base_vect_type), intent(in) :: x
integer :: res integer :: res
res = 0 res = -1
if (allocated(x%v)) res = size(x%v) if (allocated(x%v)) res = size(x%v)
end function d_base_get_nrows end function d_base_get_nrows
function d_base_sizeof(x) result(res)
implicit none
class(psb_d_base_vect_type), intent(in) :: x
integer(psb_long_int_k_) :: res
res = psb_sizeof_dp*x%get_nrows()
end function d_base_sizeof
function d_base_dot_v(n,x,y) result(res) function d_base_dot_v(n,x,y) result(res)
implicit none implicit none
class(psb_d_base_vect_type), intent(inout) :: x, y class(psb_d_base_vect_type), intent(inout) :: x, y
@ -227,24 +214,15 @@ contains
end subroutine d_base_axpby_a end subroutine d_base_axpby_a
subroutine d_base_mlt_v(x, y, info, xconj) subroutine d_base_mlt_v(x, y, info)
use psi_serial_mod use psi_serial_mod
use psb_string_mod
implicit none implicit none
class(psb_d_base_vect_type), intent(inout) :: x class(psb_d_base_vect_type), intent(inout) :: x
class(psb_d_base_vect_type), intent(inout) :: y class(psb_d_base_vect_type), intent(inout) :: y
integer, intent(out) :: info integer, intent(out) :: info
character, intent(in), optional :: xconj
integer :: i, n integer :: i, n
character :: xconj_
info = 0 info = 0
if (present(xconj)) then
xconj_ = (psb_toupper(xconj))
else
xconj_ = 'N'
end if
select type(xx => x) select type(xx => x)
type is (psb_d_base_vect_type) type is (psb_d_base_vect_type)
n = min(size(y%v), size(xx%v)) n = min(size(y%v), size(xx%v))

@ -464,7 +464,7 @@ contains
class(psb_d_csc_sparse_mat), intent(in) :: a class(psb_d_csc_sparse_mat), intent(in) :: a
integer :: res integer :: res
res = -1 res = 0
if (allocated(a%ia)) then if (allocated(a%ia)) then
if (res >= 0) then if (res >= 0) then

@ -465,7 +465,7 @@ contains
class(psb_d_csr_sparse_mat), intent(in) :: a class(psb_d_csr_sparse_mat), intent(in) :: a
integer :: res integer :: res
res = -1 res = 0
if (allocated(a%ja)) then if (allocated(a%ja)) then
if (res >= 0) then if (res >= 0) then

@ -41,6 +41,7 @@
! methods of the psb_d_mat_mod simply call the methods of the ! methods of the psb_d_mat_mod simply call the methods of the
! encapsulated class. ! encapsulated class.
module psb_d_mat_mod module psb_d_mat_mod
use psb_d_base_mat_mod use psb_d_base_mat_mod
@ -108,7 +109,6 @@ module psb_d_mat_mod
procedure, pass(a) :: d_cscnv_ip => psb_d_cscnv_ip procedure, pass(a) :: d_cscnv_ip => psb_d_cscnv_ip
procedure, pass(a) :: d_cscnv_base => psb_d_cscnv_base procedure, pass(a) :: d_cscnv_base => psb_d_cscnv_base
generic, public :: cscnv => d_cscnv, d_cscnv_ip, d_cscnv_base generic, public :: cscnv => d_cscnv, d_cscnv_ip, d_cscnv_base
procedure, pass(a) :: clone => psb_dspmat_type_clone
procedure, pass(a) :: reinit => psb_d_reinit procedure, pass(a) :: reinit => psb_d_reinit
procedure, pass(a) :: print_i => psb_d_sparse_print procedure, pass(a) :: print_i => psb_d_sparse_print
procedure, pass(a) :: print_n => psb_d_n_sparse_print procedure, pass(a) :: print_n => psb_d_n_sparse_print
@ -129,8 +129,6 @@ module psb_d_mat_mod
procedure, pass(a) :: d_transc_2mat => psb_d_transc_2mat procedure, pass(a) :: d_transc_2mat => psb_d_transc_2mat
generic, public :: transc => d_transc_1mat, d_transc_2mat generic, public :: transc => d_transc_1mat, d_transc_2mat
! Computational routines ! Computational routines
procedure, pass(a) :: get_diag => psb_d_get_diag procedure, pass(a) :: get_diag => psb_d_get_diag
procedure, pass(a) :: maxval => psb_d_maxval procedure, pass(a) :: maxval => psb_d_maxval
@ -155,9 +153,9 @@ module psb_d_mat_mod
end type psb_dspmat_type end type psb_dspmat_type
private :: psb_d_get_nrows, psb_d_get_ncols, psb_d_get_nzeros, psb_d_get_size, & private :: psb_d_get_nrows, psb_d_get_ncols, psb_d_get_nzeros, psb_d_get_size, &
& psb_d_get_state, psb_d_get_dupl, psb_d_is_null, psb_d_is_bld, psb_d_is_upd, & & psb_d_get_state, psb_d_get_dupl, psb_d_is_null, psb_d_is_bld, &
& psb_d_is_asb, psb_d_is_sorted, psb_d_is_upper, psb_d_is_lower,& & psb_d_is_upd, psb_d_is_asb, psb_d_is_sorted, psb_d_is_upper, &
& psb_d_is_triangle, psb_d_get_nz_row & psb_d_is_lower, psb_d_is_triangle, psb_d_get_nz_row
interface psb_sizeof interface psb_sizeof
module procedure psb_d_sizeof module procedure psb_d_sizeof
@ -278,7 +276,6 @@ module psb_d_mat_mod
end subroutine psb_d_set_upper end subroutine psb_d_set_upper
end interface end interface
interface interface
subroutine psb_d_sparse_print(iout,a,iv,eirs,eics,head,ivr,ivc) subroutine psb_d_sparse_print(iout,a,iv,eirs,eics,head,ivr,ivc)
import :: psb_dspmat_type import :: psb_dspmat_type
@ -494,7 +491,7 @@ module psb_d_mat_mod
subroutine psb_d_cp_from(a,b) subroutine psb_d_cp_from(a,b)
import :: psb_dspmat_type, psb_dpk_, psb_d_base_sparse_mat import :: psb_dspmat_type, psb_dpk_, psb_d_base_sparse_mat
class(psb_dspmat_type), intent(out) :: a class(psb_dspmat_type), intent(out) :: a
class(psb_d_base_sparse_mat), intent(in) :: b class(psb_d_base_sparse_mat), intent(inout), allocatable :: b
end subroutine psb_d_cp_from end subroutine psb_d_cp_from
end interface end interface
@ -580,6 +577,7 @@ module psb_d_mat_mod
end interface end interface
! == =================================== ! == ===================================
! !
! !
@ -769,7 +767,6 @@ contains
end function psb_d_sizeof end function psb_d_sizeof
function psb_d_get_fmt(a) result(res) function psb_d_get_fmt(a) result(res)
implicit none implicit none
class(psb_dspmat_type), intent(in) :: a class(psb_dspmat_type), intent(in) :: a
@ -993,4 +990,5 @@ contains
end function psb_d_get_nz_row end function psb_d_get_nz_row
end module psb_d_mat_mod end module psb_d_mat_mod

@ -32,13 +32,13 @@
! !
! package: psb_s_base_mat_mod ! package: psb_s_base_mat_mod
! !
! This module contains the implementation of the ! This module contains the implementation of the psb_s_base_sparse_mat
! psb_s_base_sparse_mat, derived from the psb_base_sparse_mat to ! type, derived from the psb_base_sparse_mat one to define a middle
! define a middle level definition of a real, single-precision sparse ! level definition of a real(psb_spk_) sparse matrix
! matrix object.This class object itself does not have any additional ! object.This class object itself does not have any additional members
! members with respect to those of the base class. No methods can be ! with respect to those of the base class. No methods can be fully
! fully implemented at this level, but we can define the interface for ! implemented at this level, but we can define the interface for the
! the computational methods requiring the knowledge of the underlying ! computational methods requiring the knowledge of the underlying
! field, such as the matrix-vector product; this interface is defined, ! field, such as the matrix-vector product; this interface is defined,
! but is supposed to be overridden at the leaf level. ! but is supposed to be overridden at the leaf level.
! !
@ -50,11 +50,9 @@
! psb_s_base_sparse_mat one. ! psb_s_base_sparse_mat one.
! !
! About the method MOLD: this has been defined for those compilers ! About the method MOLD: this has been defined for those compilers
! not yet supporting ALLOCATE( ...MOLD=...); it's otherwise silly to ! not yet supporting ALLOCATE( ...,MOLD=...); it's otherwise silly to
! duplicate "by hand" what is specified in the language (in this case F2008) ! duplicate "by hand" what is specified in the language (in this case F2008)
! !
module psb_s_base_mat_mod module psb_s_base_mat_mod
use psb_base_mat_mod use psb_base_mat_mod
@ -134,13 +132,6 @@ module psb_s_base_mat_mod
procedure, pass(a) :: s_inner_cssv => psb_s_coo_cssv procedure, pass(a) :: s_inner_cssv => psb_s_coo_cssv
procedure, pass(a) :: s_scals => psb_s_coo_scals procedure, pass(a) :: s_scals => psb_s_coo_scals
procedure, pass(a) :: s_scal => psb_s_coo_scal procedure, pass(a) :: s_scal => psb_s_coo_scal
procedure, pass(a) :: maxval => psb_s_coo_maxval
procedure, pass(a) :: csnmi => psb_s_coo_csnmi
procedure, pass(a) :: csnm1 => psb_s_coo_csnm1
procedure, pass(a) :: rowsum => psb_s_coo_rowsum
procedure, pass(a) :: arwsum => psb_s_coo_arwsum
procedure, pass(a) :: colsum => psb_s_coo_colsum
procedure, pass(a) :: aclsum => psb_s_coo_aclsum
procedure, pass(a) :: reallocate_nz => psb_s_coo_reallocate_nz procedure, pass(a) :: reallocate_nz => psb_s_coo_reallocate_nz
procedure, pass(a) :: allocate_mnnz => psb_s_coo_allocate_mnnz procedure, pass(a) :: allocate_mnnz => psb_s_coo_allocate_mnnz
procedure, pass(a) :: cp_to_coo => psb_s_cp_coo_to_coo procedure, pass(a) :: cp_to_coo => psb_s_cp_coo_to_coo
@ -152,6 +143,13 @@ module psb_s_base_mat_mod
procedure, pass(a) :: mv_to_fmt => psb_s_mv_coo_to_fmt procedure, pass(a) :: mv_to_fmt => psb_s_mv_coo_to_fmt
procedure, pass(a) :: mv_from_fmt => psb_s_mv_coo_from_fmt procedure, pass(a) :: mv_from_fmt => psb_s_mv_coo_from_fmt
procedure, pass(a) :: csput => psb_s_coo_csput procedure, pass(a) :: csput => psb_s_coo_csput
procedure, pass(a) :: maxval => psb_s_coo_maxval
procedure, pass(a) :: csnmi => psb_s_coo_csnmi
procedure, pass(a) :: csnm1 => psb_s_coo_csnm1
procedure, pass(a) :: rowsum => psb_s_coo_rowsum
procedure, pass(a) :: arwsum => psb_s_coo_arwsum
procedure, pass(a) :: colsum => psb_s_coo_colsum
procedure, pass(a) :: aclsum => psb_s_coo_aclsum
procedure, pass(a) :: get_diag => psb_s_coo_get_diag procedure, pass(a) :: get_diag => psb_s_coo_get_diag
procedure, pass(a) :: s_csgetrow => psb_s_coo_csgetrow procedure, pass(a) :: s_csgetrow => psb_s_coo_csgetrow
procedure, pass(a) :: csgetptn => psb_s_coo_csgetptn procedure, pass(a) :: csgetptn => psb_s_coo_csgetptn
@ -588,6 +586,7 @@ module psb_s_base_mat_mod
end subroutine psb_s_coo_mold end subroutine psb_s_coo_mold
end interface end interface
interface interface
subroutine psb_s_coo_print(iout,a,iv,eirs,eics,head,ivr,ivc) subroutine psb_s_coo_print(iout,a,iv,eirs,eics,head,ivr,ivc)
import :: psb_s_coo_sparse_mat import :: psb_s_coo_sparse_mat
@ -1076,6 +1075,11 @@ contains
class(psb_s_coo_sparse_mat), intent(inout) :: a class(psb_s_coo_sparse_mat), intent(inout) :: a
call a%transp() call a%transp()
! This will morph into conjg() for C and Z
! and into a no-op for S and D, so a conditional
! on a constant ought to take it out completely.
if (psb_s_is_complex_) a%val(:) = (a%val(:))
end subroutine s_coo_transc_1mat end subroutine s_coo_transc_1mat

@ -7,7 +7,6 @@ module psb_s_base_vect_mod
real(psb_spk_), allocatable :: v(:) real(psb_spk_), allocatable :: v(:)
contains contains
procedure, pass(x) :: get_nrows => s_base_get_nrows procedure, pass(x) :: get_nrows => s_base_get_nrows
procedure, pass(x) :: sizeof => s_base_sizeof
procedure, pass(x) :: dot_v => s_base_dot_v procedure, pass(x) :: dot_v => s_base_dot_v
procedure, pass(x) :: dot_a => s_base_dot_a procedure, pass(x) :: dot_a => s_base_dot_a
generic, public :: dot => dot_v, dot_a generic, public :: dot => dot_v, dot_a
@ -72,12 +71,10 @@ contains
subroutine s_base_bld_n(x,n) subroutine s_base_bld_n(x,n)
use psb_realloc_mod
integer, intent(in) :: n integer, intent(in) :: n
class(psb_s_base_vect_type), intent(inout) :: x class(psb_s_base_vect_type), intent(inout) :: x
integer :: info integer :: info
call psb_realloc(n,x%v,info)
call x%asb(n,info) call x%asb(n,info)
end subroutine s_base_bld_n end subroutine s_base_bld_n
@ -116,14 +113,10 @@ contains
subroutine s_base_set_vect(x,val) subroutine s_base_set_vect(x,val)
class(psb_s_base_vect_type), intent(inout) :: x class(psb_s_base_vect_type), intent(inout) :: x
real(psb_spk_), intent(in) :: val(:) real(psb_spk_), intent(in) :: val(:)
integer :: nr
integer :: info integer :: info
if (allocated(x%v)) then
nr = min(size(x%v),size(val))
x%v(1:nr) = val(1:nr)
else
x%v = val x%v = val
end if
end subroutine s_base_set_vect end subroutine s_base_set_vect
@ -146,21 +139,15 @@ contains
end function size_const end function size_const
function s_base_get_nrows(x) result(res) function s_base_get_nrows(x) result(res)
implicit none implicit none
class(psb_s_base_vect_type), intent(in) :: x class(psb_s_base_vect_type), intent(in) :: x
integer :: res integer :: res
res = 0 res = -1
if (allocated(x%v)) res = size(x%v) if (allocated(x%v)) res = size(x%v)
end function s_base_get_nrows end function s_base_get_nrows
function s_base_sizeof(x) result(res)
implicit none
class(psb_s_base_vect_type), intent(in) :: x
integer(psb_long_int_k_) :: res
res = psb_sizeof_sp*x%get_nrows()
end function s_base_sizeof
function s_base_dot_v(n,x,y) result(res) function s_base_dot_v(n,x,y) result(res)
implicit none implicit none
class(psb_s_base_vect_type), intent(inout) :: x, y class(psb_s_base_vect_type), intent(inout) :: x, y

@ -464,7 +464,7 @@ contains
class(psb_s_csc_sparse_mat), intent(in) :: a class(psb_s_csc_sparse_mat), intent(in) :: a
integer :: res integer :: res
res = -1 res = 0
if (allocated(a%ia)) then if (allocated(a%ia)) then
if (res >= 0) then if (res >= 0) then

@ -465,7 +465,7 @@ contains
class(psb_s_csr_sparse_mat), intent(in) :: a class(psb_s_csr_sparse_mat), intent(in) :: a
integer :: res integer :: res
res = -1 res = 0
if (allocated(a%ja)) then if (allocated(a%ja)) then
if (res >= 0) then if (res >= 0) then

@ -109,7 +109,6 @@ module psb_s_mat_mod
procedure, pass(a) :: s_cscnv_ip => psb_s_cscnv_ip procedure, pass(a) :: s_cscnv_ip => psb_s_cscnv_ip
procedure, pass(a) :: s_cscnv_base => psb_s_cscnv_base procedure, pass(a) :: s_cscnv_base => psb_s_cscnv_base
generic, public :: cscnv => s_cscnv, s_cscnv_ip, s_cscnv_base generic, public :: cscnv => s_cscnv, s_cscnv_ip, s_cscnv_base
procedure, pass(a) :: clone => psb_sspmat_type_clone
procedure, pass(a) :: reinit => psb_s_reinit procedure, pass(a) :: reinit => psb_s_reinit
procedure, pass(a) :: print_i => psb_s_sparse_print procedure, pass(a) :: print_i => psb_s_sparse_print
procedure, pass(a) :: print_n => psb_s_n_sparse_print procedure, pass(a) :: print_n => psb_s_n_sparse_print
@ -130,8 +129,6 @@ module psb_s_mat_mod
procedure, pass(a) :: s_transc_2mat => psb_s_transc_2mat procedure, pass(a) :: s_transc_2mat => psb_s_transc_2mat
generic, public :: transc => s_transc_1mat, s_transc_2mat generic, public :: transc => s_transc_1mat, s_transc_2mat
! Computational routines ! Computational routines
procedure, pass(a) :: get_diag => psb_s_get_diag procedure, pass(a) :: get_diag => psb_s_get_diag
procedure, pass(a) :: maxval => psb_s_maxval procedure, pass(a) :: maxval => psb_s_maxval
@ -156,9 +153,9 @@ module psb_s_mat_mod
end type psb_sspmat_type end type psb_sspmat_type
private :: psb_s_get_nrows, psb_s_get_ncols, psb_s_get_nzeros, psb_s_get_size, & private :: psb_s_get_nrows, psb_s_get_ncols, psb_s_get_nzeros, psb_s_get_size, &
& psb_s_get_state, psb_s_get_dupl, psb_s_is_null, psb_s_is_bld, psb_s_is_upd, & & psb_s_get_state, psb_s_get_dupl, psb_s_is_null, psb_s_is_bld, &
& psb_s_is_asb, psb_s_is_sorted, psb_s_is_upper, psb_s_is_lower, psb_s_is_triangle,& & psb_s_is_upd, psb_s_is_asb, psb_s_is_sorted, psb_s_is_upper, &
& psb_s_get_nz_row & psb_s_is_lower, psb_s_is_triangle, psb_s_get_nz_row
interface psb_sizeof interface psb_sizeof
module procedure psb_s_sizeof module procedure psb_s_sizeof
@ -279,7 +276,6 @@ module psb_s_mat_mod
end subroutine psb_s_set_upper end subroutine psb_s_set_upper
end interface end interface
interface interface
subroutine psb_s_sparse_print(iout,a,iv,eirs,eics,head,ivr,ivc) subroutine psb_s_sparse_print(iout,a,iv,eirs,eics,head,ivr,ivc)
import :: psb_sspmat_type import :: psb_sspmat_type
@ -350,9 +346,9 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl) subroutine psb_s_csput(nz,ia,ja,val,a,imin,imax,jmin,jmax,info,gtl)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(inout) :: a class(psb_sspmat_type), intent(inout) :: a
real(psb_spk_), intent(in) :: val(:) real(psb_dpk_), intent(in) :: val(:)
integer, intent(in) :: nz, ia(:), ja(:), imin,imax,jmin,jmax integer, intent(in) :: nz, ia(:), ja(:), imin,imax,jmin,jmax
integer, intent(out) :: info integer, intent(out) :: info
integer, intent(in), optional :: gtl(:) integer, intent(in), optional :: gtl(:)
@ -362,7 +358,7 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_csgetptn(imin,imax,a,nz,ia,ja,info,& subroutine psb_s_csgetptn(imin,imax,a,nz,ia,ja,info,&
& jmin,jmax,iren,append,nzin,rscale,cscale) & jmin,jmax,iren,append,nzin,rscale,cscale)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
integer, intent(in) :: imin,imax integer, intent(in) :: imin,imax
integer, intent(out) :: nz integer, intent(out) :: nz
@ -378,12 +374,12 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_csgetrow(imin,imax,a,nz,ia,ja,val,info,& subroutine psb_s_csgetrow(imin,imax,a,nz,ia,ja,val,info,&
& jmin,jmax,iren,append,nzin,rscale,cscale) & jmin,jmax,iren,append,nzin,rscale,cscale)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
integer, intent(in) :: imin,imax integer, intent(in) :: imin,imax
integer, intent(out) :: nz integer, intent(out) :: nz
integer, allocatable, intent(inout) :: ia(:), ja(:) integer, allocatable, intent(inout) :: ia(:), ja(:)
real(psb_spk_), allocatable, intent(inout) :: val(:) real(psb_dpk_), allocatable, intent(inout) :: val(:)
integer,intent(out) :: info integer,intent(out) :: info
logical, intent(in), optional :: append logical, intent(in), optional :: append
integer, intent(in), optional :: iren(:) integer, intent(in), optional :: iren(:)
@ -395,7 +391,7 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_csgetblk(imin,imax,a,b,info,& subroutine psb_s_csgetblk(imin,imax,a,b,info,&
& jmin,jmax,iren,append,rscale,cscale) & jmin,jmax,iren,append,rscale,cscale)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
class(psb_sspmat_type), intent(out) :: b class(psb_sspmat_type), intent(out) :: b
integer, intent(in) :: imin,imax integer, intent(in) :: imin,imax
@ -410,7 +406,7 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_csclip(a,b,info,& subroutine psb_s_csclip(a,b,info,&
& imin,imax,jmin,jmax,rscale,cscale) & imin,imax,jmin,jmax,rscale,cscale)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
class(psb_sspmat_type), intent(out) :: b class(psb_sspmat_type), intent(out) :: b
integer,intent(out) :: info integer,intent(out) :: info
@ -422,7 +418,7 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_b_csclip(a,b,info,& subroutine psb_s_b_csclip(a,b,info,&
& imin,imax,jmin,jmax,rscale,cscale) & imin,imax,jmin,jmax,rscale,cscale)
import :: psb_sspmat_type, psb_spk_, psb_s_coo_sparse_mat import :: psb_sspmat_type, psb_dpk_, psb_s_coo_sparse_mat
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
type(psb_s_coo_sparse_mat), intent(out) :: b type(psb_s_coo_sparse_mat), intent(out) :: b
integer,intent(out) :: info integer,intent(out) :: info
@ -433,7 +429,7 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_cscnv(a,b,info,type,mold,upd,dupl) subroutine psb_s_cscnv(a,b,info,type,mold,upd,dupl)
import :: psb_sspmat_type, psb_spk_, psb_s_base_sparse_mat import :: psb_sspmat_type, psb_dpk_, psb_s_base_sparse_mat
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
class(psb_sspmat_type), intent(out) :: b class(psb_sspmat_type), intent(out) :: b
integer, intent(out) :: info integer, intent(out) :: info
@ -446,7 +442,7 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_cscnv_ip(a,iinfo,type,mold,dupl) subroutine psb_s_cscnv_ip(a,iinfo,type,mold,dupl)
import :: psb_sspmat_type, psb_spk_, psb_s_base_sparse_mat import :: psb_sspmat_type, psb_dpk_, psb_s_base_sparse_mat
class(psb_sspmat_type), intent(inout) :: a class(psb_sspmat_type), intent(inout) :: a
integer, intent(out) :: iinfo integer, intent(out) :: iinfo
integer,optional, intent(in) :: dupl integer,optional, intent(in) :: dupl
@ -458,7 +454,7 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_cscnv_base(a,b,info,dupl) subroutine psb_s_cscnv_base(a,b,info,dupl)
import :: psb_sspmat_type, psb_spk_, psb_s_base_sparse_mat import :: psb_sspmat_type, psb_dpk_, psb_s_base_sparse_mat
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
class(psb_s_base_sparse_mat), intent(out) :: b class(psb_s_base_sparse_mat), intent(out) :: b
integer, intent(out) :: info integer, intent(out) :: info
@ -485,7 +481,7 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_mv_from(a,b) subroutine psb_s_mv_from(a,b)
import :: psb_sspmat_type, psb_spk_, psb_s_base_sparse_mat import :: psb_sspmat_type, psb_dpk_, psb_s_base_sparse_mat
class(psb_sspmat_type), intent(out) :: a class(psb_sspmat_type), intent(out) :: a
class(psb_s_base_sparse_mat), intent(inout) :: b class(psb_s_base_sparse_mat), intent(inout) :: b
end subroutine psb_s_mv_from end subroutine psb_s_mv_from
@ -493,15 +489,15 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_cp_from(a,b) subroutine psb_s_cp_from(a,b)
import :: psb_sspmat_type, psb_spk_, psb_s_base_sparse_mat import :: psb_sspmat_type, psb_dpk_, psb_s_base_sparse_mat
class(psb_sspmat_type), intent(out) :: a class(psb_sspmat_type), intent(out) :: a
class(psb_s_base_sparse_mat), intent(in) :: b class(psb_s_base_sparse_mat), intent(inout), allocatable :: b
end subroutine psb_s_cp_from end subroutine psb_s_cp_from
end interface end interface
interface interface
subroutine psb_s_mv_to(a,b) subroutine psb_s_mv_to(a,b)
import :: psb_sspmat_type, psb_spk_, psb_s_base_sparse_mat import :: psb_sspmat_type, psb_dpk_, psb_s_base_sparse_mat
class(psb_sspmat_type), intent(inout) :: a class(psb_sspmat_type), intent(inout) :: a
class(psb_s_base_sparse_mat), intent(out) :: b class(psb_s_base_sparse_mat), intent(out) :: b
end subroutine psb_s_mv_to end subroutine psb_s_mv_to
@ -509,7 +505,7 @@ module psb_s_mat_mod
interface interface
subroutine psb_s_cp_to(a,b) subroutine psb_s_cp_to(a,b)
import :: psb_sspmat_type, psb_spk_, psb_s_base_sparse_mat import :: psb_sspmat_type, psb_dpk_, psb_s_base_sparse_mat
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
class(psb_s_base_sparse_mat), intent(out) :: b class(psb_s_base_sparse_mat), intent(out) :: b
end subroutine psb_s_cp_to end subroutine psb_s_cp_to
@ -522,7 +518,7 @@ module psb_s_mat_mod
class(psb_sspmat_type), intent(out) :: b class(psb_sspmat_type), intent(out) :: b
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_sspmat_type_move end subroutine psb_sspmat_type_move
end interface psb_move_alloc end interface
interface psb_clone interface psb_clone
subroutine psb_sspmat_type_clone(a,b,info) subroutine psb_sspmat_type_clone(a,b,info)
@ -581,6 +577,7 @@ module psb_s_mat_mod
end interface end interface
! == =================================== ! == ===================================
! !
! !
@ -596,26 +593,26 @@ module psb_s_mat_mod
interface psb_csmm interface psb_csmm
subroutine psb_s_csmm(alpha,a,x,beta,y,info,trans) subroutine psb_s_csmm(alpha,a,x,beta,y,info,trans)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_), intent(in) :: alpha, beta, x(:,:) real(psb_dpk_), intent(in) :: alpha, beta, x(:,:)
real(psb_spk_), intent(inout) :: y(:,:) real(psb_dpk_), intent(inout) :: y(:,:)
integer, intent(out) :: info integer, intent(out) :: info
character, optional, intent(in) :: trans character, optional, intent(in) :: trans
end subroutine psb_s_csmm end subroutine psb_s_csmm
subroutine psb_s_csmv(alpha,a,x,beta,y,info,trans) subroutine psb_s_csmv(alpha,a,x,beta,y,info,trans)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_), intent(in) :: alpha, beta, x(:) real(psb_dpk_), intent(in) :: alpha, beta, x(:)
real(psb_spk_), intent(inout) :: y(:) real(psb_dpk_), intent(inout) :: y(:)
integer, intent(out) :: info integer, intent(out) :: info
character, optional, intent(in) :: trans character, optional, intent(in) :: trans
end subroutine psb_s_csmv end subroutine psb_s_csmv
subroutine psb_s_csmv_vect(alpha,a,x,beta,y,info,trans) subroutine psb_s_csmv_vect(alpha,a,x,beta,y,info,trans)
use psb_s_vect_mod, only : psb_s_vect_type use psb_s_vect_mod, only : psb_s_vect_type
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_), intent(in) :: alpha, beta real(psb_dpk_), intent(in) :: alpha, beta
type(psb_s_vect_type), intent(inout) :: x type(psb_s_vect_type), intent(inout) :: x
type(psb_s_vect_type), intent(inout) :: y type(psb_s_vect_type), intent(inout) :: y
integer, intent(out) :: info integer, intent(out) :: info
@ -625,28 +622,28 @@ module psb_s_mat_mod
interface psb_cssm interface psb_cssm
subroutine psb_s_cssm(alpha,a,x,beta,y,info,trans,scale,d) subroutine psb_s_cssm(alpha,a,x,beta,y,info,trans,scale,d)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_), intent(in) :: alpha, beta, x(:,:) real(psb_dpk_), intent(in) :: alpha, beta, x(:,:)
real(psb_spk_), intent(inout) :: y(:,:) real(psb_dpk_), intent(inout) :: y(:,:)
integer, intent(out) :: info integer, intent(out) :: info
character, optional, intent(in) :: trans, scale character, optional, intent(in) :: trans, scale
real(psb_spk_), intent(in), optional :: d(:) real(psb_dpk_), intent(in), optional :: d(:)
end subroutine psb_s_cssm end subroutine psb_s_cssm
subroutine psb_s_cssv(alpha,a,x,beta,y,info,trans,scale,d) subroutine psb_s_cssv(alpha,a,x,beta,y,info,trans,scale,d)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_), intent(in) :: alpha, beta, x(:) real(psb_dpk_), intent(in) :: alpha, beta, x(:)
real(psb_spk_), intent(inout) :: y(:) real(psb_dpk_), intent(inout) :: y(:)
integer, intent(out) :: info integer, intent(out) :: info
character, optional, intent(in) :: trans, scale character, optional, intent(in) :: trans, scale
real(psb_spk_), intent(in), optional :: d(:) real(psb_dpk_), intent(in), optional :: d(:)
end subroutine psb_s_cssv end subroutine psb_s_cssv
subroutine psb_s_cssv_vect(alpha,a,x,beta,y,info,trans,scale,d) subroutine psb_s_cssv_vect(alpha,a,x,beta,y,info,trans,scale,d)
use psb_s_vect_mod, only : psb_s_vect_type use psb_s_vect_mod, only : psb_s_vect_type
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_), intent(in) :: alpha, beta real(psb_dpk_), intent(in) :: alpha, beta
type(psb_s_vect_type), intent(inout) :: x type(psb_s_vect_type), intent(inout) :: x
type(psb_s_vect_type), intent(inout) :: y type(psb_s_vect_type), intent(inout) :: y
integer, intent(out) :: info integer, intent(out) :: info
@ -657,84 +654,85 @@ module psb_s_mat_mod
interface interface
function psb_s_maxval(a) result(res) function psb_s_maxval(a) result(res)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_) :: res real(psb_dpk_) :: res
end function psb_s_maxval end function psb_s_maxval
end interface end interface
interface interface
function psb_s_csnmi(a) result(res) function psb_s_csnmi(a) result(res)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_) :: res real(psb_dpk_) :: res
end function psb_s_csnmi end function psb_s_csnmi
end interface end interface
interface interface
function psb_s_csnm1(a) result(res) function psb_s_csnm1(a) result(res)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_) :: res real(psb_dpk_) :: res
end function psb_s_csnm1 end function psb_s_csnm1
end interface end interface
interface interface
subroutine psb_s_rowsum(d,a,info) subroutine psb_s_rowsum(d,a,info)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_), intent(out) :: d(:) real(psb_dpk_), intent(out) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_s_rowsum end subroutine psb_s_rowsum
end interface end interface
interface interface
subroutine psb_s_arwsum(d,a,info) subroutine psb_s_arwsum(d,a,info)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_), intent(out) :: d(:) real(psb_dpk_), intent(out) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_s_arwsum end subroutine psb_s_arwsum
end interface end interface
interface interface
subroutine psb_s_colsum(d,a,info) subroutine psb_s_colsum(d,a,info)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_), intent(out) :: d(:) real(psb_dpk_), intent(out) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_s_colsum end subroutine psb_s_colsum
end interface end interface
interface interface
subroutine psb_s_aclsum(d,a,info) subroutine psb_s_aclsum(d,a,info)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_), intent(out) :: d(:) real(psb_dpk_), intent(out) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_s_aclsum end subroutine psb_s_aclsum
end interface end interface
interface interface
subroutine psb_s_get_diag(a,d,info) subroutine psb_s_get_diag(a,d,info)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
real(psb_spk_), intent(out) :: d(:) real(psb_dpk_), intent(out) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_s_get_diag end subroutine psb_s_get_diag
end interface end interface
interface psb_scal interface psb_scal
subroutine psb_s_scal(d,a,info) subroutine psb_s_scal(d,a,info)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(inout) :: a class(psb_sspmat_type), intent(inout) :: a
real(psb_spk_), intent(in) :: d(:) real(psb_dpk_), intent(in) :: d(:)
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_s_scal end subroutine psb_s_scal
subroutine psb_s_scals(d,a,info) subroutine psb_s_scals(d,a,info)
import :: psb_sspmat_type, psb_spk_ import :: psb_sspmat_type, psb_dpk_
class(psb_sspmat_type), intent(inout) :: a class(psb_sspmat_type), intent(inout) :: a
real(psb_spk_), intent(in) :: d real(psb_dpk_), intent(in) :: d
integer, intent(out) :: info integer, intent(out) :: info
end subroutine psb_s_scals end subroutine psb_s_scals
end interface end interface
@ -769,7 +767,6 @@ contains
end function psb_s_sizeof end function psb_s_sizeof
function psb_s_get_fmt(a) result(res) function psb_s_get_fmt(a) result(res)
implicit none implicit none
class(psb_sspmat_type), intent(in) :: a class(psb_sspmat_type), intent(in) :: a
@ -993,4 +990,5 @@ contains
end function psb_s_get_nz_row end function psb_s_get_nz_row
end module psb_s_mat_mod end module psb_s_mat_mod

@ -32,16 +32,15 @@
! !
! package: psb_z_base_mat_mod ! package: psb_z_base_mat_mod
! !
! This module contains the implementation of the ! This module contains the implementation of the psb_z_base_sparse_mat
! psb_z_base_sparse_mat, derived from the psb_base_sparse_mat to ! type, derived from the psb_base_sparse_mat one to define a middle
! define a middle level definition of a complex, double-precision ! level definition of a complex(psb_dpk_) sparse matrix
! sparse matrix object.This class object itself does not have any ! object.This class object itself does not have any additional members
! additional members with respect to those of the base class. No ! with respect to those of the base class. No methods can be fully
! methods can be fully implemented at this level, but we can define ! implemented at this level, but we can define the interface for the
! the interface for the computational methods requiring the knowledge ! computational methods requiring the knowledge of the underlying
! of the underlying field, such as the matrix-vector product; this ! field, such as the matrix-vector product; this interface is defined,
! interface is defined, but is supposed to be overridden at the leaf ! but is supposed to be overridden at the leaf level.
! level.
! !
! This module also contains the implementation of the ! This module also contains the implementation of the
! psb_z_coo_sparse_mat type and the related methods. This is the ! psb_z_coo_sparse_mat type and the related methods. This is the
@ -51,11 +50,9 @@
! psb_z_base_sparse_mat one. ! psb_z_base_sparse_mat one.
! !
! About the method MOLD: this has been defined for those compilers ! About the method MOLD: this has been defined for those compilers
! not yet supporting ALLOCATE( ...MOLD=...); it's otherwise silly to ! not yet supporting ALLOCATE( ...,MOLD=...); it's otherwise silly to
! duplicate "by hand" what is specified in the language (in this case F2008) ! duplicate "by hand" what is specified in the language (in this case F2008)
! !
module psb_z_base_mat_mod module psb_z_base_mat_mod
use psb_base_mat_mod use psb_base_mat_mod
@ -135,13 +132,6 @@ module psb_z_base_mat_mod
procedure, pass(a) :: z_inner_cssv => psb_z_coo_cssv procedure, pass(a) :: z_inner_cssv => psb_z_coo_cssv
procedure, pass(a) :: z_scals => psb_z_coo_scals procedure, pass(a) :: z_scals => psb_z_coo_scals
procedure, pass(a) :: z_scal => psb_z_coo_scal procedure, pass(a) :: z_scal => psb_z_coo_scal
procedure, pass(a) :: maxval => psb_z_coo_maxval
procedure, pass(a) :: csnmi => psb_z_coo_csnmi
procedure, pass(a) :: csnm1 => psb_z_coo_csnm1
procedure, pass(a) :: rowsum => psb_z_coo_rowsum
procedure, pass(a) :: arwsum => psb_z_coo_arwsum
procedure, pass(a) :: colsum => psb_z_coo_colsum
procedure, pass(a) :: aclsum => psb_z_coo_aclsum
procedure, pass(a) :: reallocate_nz => psb_z_coo_reallocate_nz procedure, pass(a) :: reallocate_nz => psb_z_coo_reallocate_nz
procedure, pass(a) :: allocate_mnnz => psb_z_coo_allocate_mnnz procedure, pass(a) :: allocate_mnnz => psb_z_coo_allocate_mnnz
procedure, pass(a) :: cp_to_coo => psb_z_cp_coo_to_coo procedure, pass(a) :: cp_to_coo => psb_z_cp_coo_to_coo
@ -153,6 +143,13 @@ module psb_z_base_mat_mod
procedure, pass(a) :: mv_to_fmt => psb_z_mv_coo_to_fmt procedure, pass(a) :: mv_to_fmt => psb_z_mv_coo_to_fmt
procedure, pass(a) :: mv_from_fmt => psb_z_mv_coo_from_fmt procedure, pass(a) :: mv_from_fmt => psb_z_mv_coo_from_fmt
procedure, pass(a) :: csput => psb_z_coo_csput procedure, pass(a) :: csput => psb_z_coo_csput
procedure, pass(a) :: maxval => psb_z_coo_maxval
procedure, pass(a) :: csnmi => psb_z_coo_csnmi
procedure, pass(a) :: csnm1 => psb_z_coo_csnm1
procedure, pass(a) :: rowsum => psb_z_coo_rowsum
procedure, pass(a) :: arwsum => psb_z_coo_arwsum
procedure, pass(a) :: colsum => psb_z_coo_colsum
procedure, pass(a) :: aclsum => psb_z_coo_aclsum
procedure, pass(a) :: get_diag => psb_z_coo_get_diag procedure, pass(a) :: get_diag => psb_z_coo_get_diag
procedure, pass(a) :: z_csgetrow => psb_z_coo_csgetrow procedure, pass(a) :: z_csgetrow => psb_z_coo_csgetrow
procedure, pass(a) :: csgetptn => psb_z_coo_csgetptn procedure, pass(a) :: csgetptn => psb_z_coo_csgetptn
@ -589,6 +586,7 @@ module psb_z_base_mat_mod
end subroutine psb_z_coo_mold end subroutine psb_z_coo_mold
end interface end interface
interface interface
subroutine psb_z_coo_print(iout,a,iv,eirs,eics,head,ivr,ivc) subroutine psb_z_coo_print(iout,a,iv,eirs,eics,head,ivr,ivc)
import :: psb_z_coo_sparse_mat import :: psb_z_coo_sparse_mat
@ -804,6 +802,7 @@ module psb_z_base_mat_mod
end subroutine psb_z_coo_csmm end subroutine psb_z_coo_csmm
end interface end interface
interface interface
function psb_z_coo_maxval(a) result(res) function psb_z_coo_maxval(a) result(res)
import :: psb_z_coo_sparse_mat, psb_dpk_ import :: psb_z_coo_sparse_mat, psb_dpk_
@ -940,7 +939,7 @@ contains
class(psb_z_coo_sparse_mat), intent(in) :: a class(psb_z_coo_sparse_mat), intent(in) :: a
integer(psb_long_int_k_) :: res integer(psb_long_int_k_) :: res
res = 8 + 1 res = 8 + 1
res = res + 2 * psb_sizeof_dp * size(a%val) res = res + (2*psb_sizeof_dp) * size(a%val)
res = res + psb_sizeof_int * size(a%ia) res = res + psb_sizeof_int * size(a%ia)
res = res + psb_sizeof_int * size(a%ja) res = res + psb_sizeof_int * size(a%ja)
@ -1020,8 +1019,6 @@ contains
! !
! == ================================== ! == ==================================
subroutine z_coo_free(a) subroutine z_coo_free(a)
implicit none implicit none
@ -1073,13 +1070,15 @@ contains
end subroutine z_coo_transp_1mat end subroutine z_coo_transp_1mat
subroutine z_coo_transc_1mat(a) subroutine z_coo_transc_1mat(a)
implicit none implicit none
class(psb_z_coo_sparse_mat), intent(inout) :: a class(psb_z_coo_sparse_mat), intent(inout) :: a
call a%transp() call a%transp()
a%val(:) = conjg(a%val) ! This will morph into conjg() for C and Z
! and into a no-op for S and D, so a conditional
! on a constant ought to take it out completely.
if (psb_z_is_complex_) a%val(:) = conjg(a%val(:))
end subroutine z_coo_transc_1mat end subroutine z_coo_transc_1mat

@ -7,7 +7,6 @@ module psb_z_base_vect_mod
complex(psb_dpk_), allocatable :: v(:) complex(psb_dpk_), allocatable :: v(:)
contains contains
procedure, pass(x) :: get_nrows => z_base_get_nrows procedure, pass(x) :: get_nrows => z_base_get_nrows
procedure, pass(x) :: sizeof => z_base_sizeof
procedure, pass(x) :: dot_v => z_base_dot_v procedure, pass(x) :: dot_v => z_base_dot_v
procedure, pass(x) :: dot_a => z_base_dot_a procedure, pass(x) :: dot_a => z_base_dot_a
generic, public :: dot => dot_v, dot_a generic, public :: dot => dot_v, dot_a
@ -72,12 +71,10 @@ contains
subroutine z_base_bld_n(x,n) subroutine z_base_bld_n(x,n)
use psb_realloc_mod
integer, intent(in) :: n integer, intent(in) :: n
class(psb_z_base_vect_type), intent(inout) :: x class(psb_z_base_vect_type), intent(inout) :: x
integer :: info integer :: info
call psb_realloc(n,x%v,info)
call x%asb(n,info) call x%asb(n,info)
end subroutine z_base_bld_n end subroutine z_base_bld_n
@ -116,16 +113,11 @@ contains
subroutine z_base_set_vect(x,val) subroutine z_base_set_vect(x,val)
class(psb_z_base_vect_type), intent(inout) :: x class(psb_z_base_vect_type), intent(inout) :: x
complex(psb_dpk_), intent(in) :: val(:) complex(psb_dpk_), intent(in) :: val(:)
integer :: nr
integer :: info integer :: info
if (allocated(x%v)) then
nr = min(size(x%v),size(val))
x%v(1:nr) = val(1:nr)
else
x%v = val x%v = val
end if
end subroutine z_base_set_vect
end subroutine z_base_set_vect
function constructor(x) result(this) function constructor(x) result(this)
@ -147,21 +139,15 @@ contains
end function size_const end function size_const
function z_base_get_nrows(x) result(res) function z_base_get_nrows(x) result(res)
implicit none implicit none
class(psb_z_base_vect_type), intent(in) :: x class(psb_z_base_vect_type), intent(in) :: x
integer :: res integer :: res
res = 0 res = -1
if (allocated(x%v)) res = size(x%v) if (allocated(x%v)) res = size(x%v)
end function z_base_get_nrows end function z_base_get_nrows
function z_base_sizeof(x) result(res)
implicit none
class(psb_z_base_vect_type), intent(in) :: x
integer(psb_long_int_k_) :: res
res = (2*psb_sizeof_dp)*x%get_nrows()
end function z_base_sizeof
function z_base_dot_v(n,x,y) result(res) function z_base_dot_v(n,x,y) result(res)
implicit none implicit none
class(psb_z_base_vect_type), intent(inout) :: x, y class(psb_z_base_vect_type), intent(inout) :: x, y
@ -228,72 +214,41 @@ contains
end subroutine z_base_axpby_a end subroutine z_base_axpby_a
subroutine z_base_mlt_v(x, y, info, xconj) subroutine z_base_mlt_v(x, y, info)
use psi_serial_mod use psi_serial_mod
use psb_string_mod
implicit none implicit none
class(psb_z_base_vect_type), intent(inout) :: x class(psb_z_base_vect_type), intent(inout) :: x
class(psb_z_base_vect_type), intent(inout) :: y class(psb_z_base_vect_type), intent(inout) :: y
integer, intent(out) :: info integer, intent(out) :: info
character, intent(in), optional :: xconj
integer :: i, n integer :: i, n
character :: xconj_
info = 0 info = 0
if (present(xconj)) then
xconj_ = (psb_toupper(xconj))
else
xconj_ = 'N'
end if
select type(xx => x) select type(xx => x)
type is (psb_z_base_vect_type) type is (psb_z_base_vect_type)
n = min(size(y%v), size(xx%v)) n = min(size(y%v), size(xx%v))
select case (xconj_)
case ('C')
do i=1, n
y%v(i) = y%v(i)*conjg(xx%v(i))
end do
case default
do i=1, n do i=1, n
y%v(i) = y%v(i)*xx%v(i) y%v(i) = y%v(i)*xx%v(i)
end do end do
end select
class default class default
call y%mlt(x%v,info,xconj) call y%mlt(x%v,info)
end select end select
end subroutine z_base_mlt_v end subroutine z_base_mlt_v
subroutine z_base_mlt_a(x, y, info, xconj) subroutine z_base_mlt_a(x, y, info)
use psi_serial_mod use psi_serial_mod
use psb_string_mod
implicit none implicit none
complex(psb_dpk_), intent(in) :: x(:) complex(psb_dpk_), intent(in) :: x(:)
class(psb_z_base_vect_type), intent(inout) :: y class(psb_z_base_vect_type), intent(inout) :: y
integer, intent(out) :: info integer, intent(out) :: info
character, intent(in), optional :: xconj
character :: xconj_
integer :: i, n integer :: i, n
info = 0 info = 0
if (present(xconj)) then
xconj_ = (psb_toupper(xconj))
else
xconj_ = 'N'
end if
n = min(size(y%v), size(x)) n = min(size(y%v), size(x))
select case (xconj_)
case ('C')
do i=1, n
y%v(i) = y%v(i)*conjg(x(i))
end do
case default
do i=1, n do i=1, n
y%v(i) = y%v(i)*x(i) y%v(i) = y%v(i)*x(i)
end do end do
end select
end subroutine z_base_mlt_a end subroutine z_base_mlt_a
@ -365,36 +320,23 @@ contains
end if end if
end subroutine z_base_mlt_a_2 end subroutine z_base_mlt_a_2
subroutine z_base_mlt_v_2(alpha,x,y,beta,z,info,xconj,yconj) subroutine z_base_mlt_v_2(alpha,x,y,beta,z,info)
use psi_serial_mod use psi_serial_mod
use psb_string_mod
implicit none implicit none
complex(psb_dpk_), intent(in) :: alpha,beta complex(psb_dpk_), intent(in) :: alpha,beta
class(psb_z_base_vect_type), intent(inout) :: x class(psb_z_base_vect_type), intent(inout) :: x
class(psb_z_base_vect_type), intent(inout) :: y class(psb_z_base_vect_type), intent(inout) :: y
class(psb_z_base_vect_type), intent(inout) :: z class(psb_z_base_vect_type), intent(inout) :: z
integer, intent(out) :: info integer, intent(out) :: info
character(len=1), intent(in), optional :: xconj, yconj
integer :: i, n integer :: i, n
info = 0 info = 0
if (present(xconj)) then
if (psb_toupper(xconj)=='C') x%v=conjg(x%v)
end if
if (present(yconj)) then
if (psb_toupper(yconj)=='C') y%v=conjg(y%v)
end if
call z%mlt(alpha,x%v,y%v,beta,info) call z%mlt(alpha,x%v,y%v,beta,info)
if (present(xconj)) then
if (psb_toupper(xconj)=='C') x%v=conjg(x%v)
end if
if (present(yconj)) then
if (psb_toupper(yconj)=='C') y%v=conjg(y%v)
end if
end subroutine z_base_mlt_v_2 end subroutine z_base_mlt_v_2
subroutine z_base_mlt_av(alpha,x,y,beta,z,info,xconj,yconj) subroutine z_base_mlt_av(alpha,x,y,beta,z,info)
use psi_serial_mod use psi_serial_mod
implicit none implicit none
complex(psb_dpk_), intent(in) :: alpha,beta complex(psb_dpk_), intent(in) :: alpha,beta
@ -402,7 +344,6 @@ contains
class(psb_z_base_vect_type), intent(inout) :: y class(psb_z_base_vect_type), intent(inout) :: y
class(psb_z_base_vect_type), intent(inout) :: z class(psb_z_base_vect_type), intent(inout) :: z
integer, intent(out) :: info integer, intent(out) :: info
character(len=1), intent(in), optional :: xconj, yconj
integer :: i, n integer :: i, n
info = 0 info = 0
@ -411,7 +352,7 @@ contains
end subroutine z_base_mlt_av end subroutine z_base_mlt_av
subroutine z_base_mlt_va(alpha,x,y,beta,z,info,xconj,yconj) subroutine z_base_mlt_va(alpha,x,y,beta,z,info)
use psi_serial_mod use psi_serial_mod
implicit none implicit none
complex(psb_dpk_), intent(in) :: alpha,beta complex(psb_dpk_), intent(in) :: alpha,beta
@ -419,12 +360,11 @@ contains
class(psb_z_base_vect_type), intent(inout) :: x class(psb_z_base_vect_type), intent(inout) :: x
class(psb_z_base_vect_type), intent(inout) :: z class(psb_z_base_vect_type), intent(inout) :: z
integer, intent(out) :: info integer, intent(out) :: info
character(len=1), intent(in), optional :: xconj, yconj
integer :: i, n integer :: i, n
info = 0 info = 0
call z%mlt(alpha,y,x,beta,info,xconj=yconj,yconj=xconj) call z%mlt(alpha,y,x,beta,info)
end subroutine z_base_mlt_va end subroutine z_base_mlt_va

@ -440,7 +440,7 @@ contains
class(psb_z_csc_sparse_mat), intent(in) :: a class(psb_z_csc_sparse_mat), intent(in) :: a
integer(psb_long_int_k_) :: res integer(psb_long_int_k_) :: res
res = 8 res = 8
res = res + 2 * psb_sizeof_dp * size(a%val) res = res + (2*psb_sizeof_dp) * size(a%val)
res = res + psb_sizeof_int * size(a%icp) res = res + psb_sizeof_int * size(a%icp)
res = res + psb_sizeof_int * size(a%ia) res = res + psb_sizeof_int * size(a%ia)
@ -464,7 +464,7 @@ contains
class(psb_z_csc_sparse_mat), intent(in) :: a class(psb_z_csc_sparse_mat), intent(in) :: a
integer :: res integer :: res
res = -1 res = 0
if (allocated(a%ia)) then if (allocated(a%ia)) then
if (res >= 0) then if (res >= 0) then

@ -441,7 +441,7 @@ contains
class(psb_z_csr_sparse_mat), intent(in) :: a class(psb_z_csr_sparse_mat), intent(in) :: a
integer(psb_long_int_k_) :: res integer(psb_long_int_k_) :: res
res = 8 res = 8
res = res + 2 * psb_sizeof_dp * size(a%val) res = res + (2*psb_sizeof_dp) * size(a%val)
res = res + psb_sizeof_int * size(a%irp) res = res + psb_sizeof_int * size(a%irp)
res = res + psb_sizeof_int * size(a%ja) res = res + psb_sizeof_int * size(a%ja)
@ -465,7 +465,7 @@ contains
class(psb_z_csr_sparse_mat), intent(in) :: a class(psb_z_csr_sparse_mat), intent(in) :: a
integer :: res integer :: res
res = -1 res = 0
if (allocated(a%ja)) then if (allocated(a%ja)) then
if (res >= 0) then if (res >= 0) then

@ -109,7 +109,6 @@ module psb_z_mat_mod
procedure, pass(a) :: z_cscnv_ip => psb_z_cscnv_ip procedure, pass(a) :: z_cscnv_ip => psb_z_cscnv_ip
procedure, pass(a) :: z_cscnv_base => psb_z_cscnv_base procedure, pass(a) :: z_cscnv_base => psb_z_cscnv_base
generic, public :: cscnv => z_cscnv, z_cscnv_ip, z_cscnv_base generic, public :: cscnv => z_cscnv, z_cscnv_ip, z_cscnv_base
procedure, pass(a) :: clone => psb_zspmat_type_clone
procedure, pass(a) :: reinit => psb_z_reinit procedure, pass(a) :: reinit => psb_z_reinit
procedure, pass(a) :: print_i => psb_z_sparse_print procedure, pass(a) :: print_i => psb_z_sparse_print
procedure, pass(a) :: print_n => psb_z_n_sparse_print procedure, pass(a) :: print_n => psb_z_n_sparse_print
@ -154,9 +153,9 @@ module psb_z_mat_mod
end type psb_zspmat_type end type psb_zspmat_type
private :: psb_z_get_nrows, psb_z_get_ncols, psb_z_get_nzeros, psb_z_get_size, & private :: psb_z_get_nrows, psb_z_get_ncols, psb_z_get_nzeros, psb_z_get_size, &
& psb_z_get_state, psb_z_get_dupl, psb_z_is_null, psb_z_is_bld, psb_z_is_upd, & & psb_z_get_state, psb_z_get_dupl, psb_z_is_null, psb_z_is_bld, &
& psb_z_is_asb, psb_z_is_sorted, psb_z_is_upper, psb_z_is_lower, psb_z_is_triangle,& & psb_z_is_upd, psb_z_is_asb, psb_z_is_sorted, psb_z_is_upper, &
& psb_z_get_nz_row & psb_z_is_lower, psb_z_is_triangle, psb_z_get_nz_row
interface psb_sizeof interface psb_sizeof
module procedure psb_z_sizeof module procedure psb_z_sizeof
@ -492,7 +491,7 @@ module psb_z_mat_mod
subroutine psb_z_cp_from(a,b) subroutine psb_z_cp_from(a,b)
import :: psb_zspmat_type, psb_dpk_, psb_z_base_sparse_mat import :: psb_zspmat_type, psb_dpk_, psb_z_base_sparse_mat
class(psb_zspmat_type), intent(out) :: a class(psb_zspmat_type), intent(out) :: a
class(psb_z_base_sparse_mat), intent(in) :: b class(psb_z_base_sparse_mat), intent(inout), allocatable :: b
end subroutine psb_z_cp_from end subroutine psb_z_cp_from
end interface end interface

Loading…
Cancel
Save