diff --git a/base/modules/psb_c_base_mat_mod.f90 b/base/modules/psb_c_base_mat_mod.f90 index 84e9e511..8a800f7e 100644 --- a/base/modules/psb_c_base_mat_mod.f90 +++ b/base/modules/psb_c_base_mat_mod.f90 @@ -510,16 +510,16 @@ module psb_c_base_mat_mod interface subroutine psb_c_base_transp_2mat(a,b) import :: psb_c_base_sparse_mat, psb_base_sparse_mat, psb_spk_ - class(psb_c_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_c_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b end subroutine psb_c_base_transp_2mat end interface interface subroutine psb_c_base_transc_2mat(a,b) import :: psb_c_base_sparse_mat, psb_base_sparse_mat, psb_spk_ - class(psb_c_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_c_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b end subroutine psb_c_base_transc_2mat end interface diff --git a/base/modules/psb_c_mat_mod.f90 b/base/modules/psb_c_mat_mod.f90 index 2f726969..904755a4 100644 --- a/base/modules/psb_c_mat_mod.f90 +++ b/base/modules/psb_c_mat_mod.f90 @@ -547,8 +547,8 @@ module psb_c_mat_mod interface subroutine psb_c_transp_2mat(a,b) import :: psb_cspmat_type - class(psb_cspmat_type), intent(out) :: a - class(psb_cspmat_type), intent(in) :: b + class(psb_cspmat_type), intent(in) :: a + class(psb_cspmat_type), intent(out) :: b end subroutine psb_c_transp_2mat end interface @@ -562,8 +562,8 @@ module psb_c_mat_mod interface subroutine psb_c_transc_2mat(a,b) import :: psb_cspmat_type - class(psb_cspmat_type), intent(out) :: a - class(psb_cspmat_type), intent(in) :: b + class(psb_cspmat_type), intent(in) :: a + class(psb_cspmat_type), intent(out) :: b end subroutine psb_c_transc_2mat end interface diff --git a/base/modules/psb_d_base_mat_mod.f90 b/base/modules/psb_d_base_mat_mod.f90 index a84b4e99..406fc6ce 100644 --- a/base/modules/psb_d_base_mat_mod.f90 +++ b/base/modules/psb_d_base_mat_mod.f90 @@ -511,16 +511,16 @@ module psb_d_base_mat_mod interface subroutine psb_d_base_transp_2mat(a,b) import :: psb_d_base_sparse_mat, psb_base_sparse_mat, psb_dpk_ - class(psb_d_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_d_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b end subroutine psb_d_base_transp_2mat end interface interface subroutine psb_d_base_transc_2mat(a,b) import :: psb_d_base_sparse_mat, psb_base_sparse_mat, psb_dpk_ - class(psb_d_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_d_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b end subroutine psb_d_base_transc_2mat end interface diff --git a/base/modules/psb_d_mat_mod.f90 b/base/modules/psb_d_mat_mod.f90 index 5c1d4249..80e1f00a 100644 --- a/base/modules/psb_d_mat_mod.f90 +++ b/base/modules/psb_d_mat_mod.f90 @@ -108,6 +108,7 @@ module psb_d_mat_mod procedure, pass(a) :: d_cscnv_ip => psb_d_cscnv_ip procedure, pass(a) :: d_cscnv_base => psb_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) :: print_i => psb_d_sparse_print procedure, pass(a) :: print_n => psb_d_n_sparse_print @@ -549,8 +550,8 @@ module psb_d_mat_mod interface subroutine psb_d_transp_2mat(a,b) import :: psb_dspmat_type - class(psb_dspmat_type), intent(out) :: a - class(psb_dspmat_type), intent(in) :: b + class(psb_dspmat_type), intent(in) :: a + class(psb_dspmat_type), intent(out) :: b end subroutine psb_d_transp_2mat end interface @@ -564,8 +565,8 @@ module psb_d_mat_mod interface subroutine psb_d_transc_2mat(a,b) import :: psb_dspmat_type - class(psb_dspmat_type), intent(out) :: a - class(psb_dspmat_type), intent(in) :: b + class(psb_dspmat_type), intent(in) :: a + class(psb_dspmat_type), intent(out) :: b end subroutine psb_d_transc_2mat end interface diff --git a/base/modules/psb_s_base_mat_mod.f90 b/base/modules/psb_s_base_mat_mod.f90 index 0e67ad63..caded0fa 100644 --- a/base/modules/psb_s_base_mat_mod.f90 +++ b/base/modules/psb_s_base_mat_mod.f90 @@ -511,16 +511,16 @@ module psb_s_base_mat_mod interface subroutine psb_s_base_transp_2mat(a,b) import :: psb_s_base_sparse_mat, psb_base_sparse_mat, psb_spk_ - class(psb_s_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_s_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b end subroutine psb_s_base_transp_2mat end interface interface subroutine psb_s_base_transc_2mat(a,b) import :: psb_s_base_sparse_mat, psb_base_sparse_mat, psb_spk_ - class(psb_s_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_s_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b end subroutine psb_s_base_transc_2mat end interface diff --git a/base/modules/psb_s_mat_mod.f90 b/base/modules/psb_s_mat_mod.f90 index 465cafb9..20790f9f 100644 --- a/base/modules/psb_s_mat_mod.f90 +++ b/base/modules/psb_s_mat_mod.f90 @@ -550,8 +550,8 @@ module psb_s_mat_mod interface subroutine psb_s_transp_2mat(a,b) import :: psb_sspmat_type - class(psb_sspmat_type), intent(out) :: a - class(psb_sspmat_type), intent(in) :: b + class(psb_sspmat_type), intent(in) :: a + class(psb_sspmat_type), intent(out) :: b end subroutine psb_s_transp_2mat end interface @@ -565,8 +565,8 @@ module psb_s_mat_mod interface subroutine psb_s_transc_2mat(a,b) import :: psb_sspmat_type - class(psb_sspmat_type), intent(out) :: a - class(psb_sspmat_type), intent(in) :: b + class(psb_sspmat_type), intent(in) :: a + class(psb_sspmat_type), intent(out) :: b end subroutine psb_s_transc_2mat end interface diff --git a/base/modules/psb_z_base_mat_mod.f90 b/base/modules/psb_z_base_mat_mod.f90 index b898d739..412fefcb 100644 --- a/base/modules/psb_z_base_mat_mod.f90 +++ b/base/modules/psb_z_base_mat_mod.f90 @@ -512,16 +512,16 @@ module psb_z_base_mat_mod interface subroutine psb_z_base_transp_2mat(a,b) import :: psb_z_base_sparse_mat, psb_base_sparse_mat, psb_dpk_ - class(psb_z_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_z_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b end subroutine psb_z_base_transp_2mat end interface interface subroutine psb_z_base_transc_2mat(a,b) import :: psb_z_base_sparse_mat, psb_base_sparse_mat, psb_dpk_ - class(psb_z_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_z_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b end subroutine psb_z_base_transc_2mat end interface diff --git a/base/modules/psb_z_mat_mod.f90 b/base/modules/psb_z_mat_mod.f90 index fe6f8909..f5e33266 100644 --- a/base/modules/psb_z_mat_mod.f90 +++ b/base/modules/psb_z_mat_mod.f90 @@ -547,8 +547,8 @@ module psb_z_mat_mod interface subroutine psb_z_transp_2mat(a,b) import :: psb_zspmat_type - class(psb_zspmat_type), intent(out) :: a - class(psb_zspmat_type), intent(in) :: b + class(psb_zspmat_type), intent(in) :: a + class(psb_zspmat_type), intent(out) :: b end subroutine psb_z_transp_2mat end interface @@ -562,8 +562,8 @@ module psb_z_mat_mod interface subroutine psb_z_transc_2mat(a,b) import :: psb_zspmat_type - class(psb_zspmat_type), intent(out) :: a - class(psb_zspmat_type), intent(in) :: b + class(psb_zspmat_type), intent(in) :: a + class(psb_zspmat_type), intent(out) :: b end subroutine psb_z_transc_2mat end interface diff --git a/base/serial/impl/psb_c_base_mat_impl.f90 b/base/serial/impl/psb_c_base_mat_impl.f90 index 64545a65..87811d4b 100644 --- a/base/serial/impl/psb_c_base_mat_impl.f90 +++ b/base/serial/impl/psb_c_base_mat_impl.f90 @@ -473,8 +473,8 @@ subroutine psb_c_base_transp_2mat(a,b) use psb_error_mod implicit none - class(psb_c_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_c_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b type(psb_c_coo_sparse_mat) :: tmp integer err_act, info @@ -485,9 +485,9 @@ subroutine psb_c_base_transp_2mat(a,b) info = psb_success_ select type(b) class is (psb_c_base_sparse_mat) - call b%cp_to_coo(tmp,info) + call a%cp_to_coo(tmp,info) if (info == psb_success_) call tmp%transp() - if (info == psb_success_) call a%mv_from_coo(tmp,info) + if (info == psb_success_) call b%mv_from_coo(tmp,info) class default info = psb_err_invalid_dynamic_type_ end select @@ -511,8 +511,8 @@ subroutine psb_c_base_transc_2mat(a,b) use psb_c_base_mat_mod, psb_protect_name => psb_c_base_transc_2mat implicit none - class(psb_c_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_c_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b type(psb_c_coo_sparse_mat) :: tmp integer err_act, info @@ -523,9 +523,9 @@ subroutine psb_c_base_transc_2mat(a,b) info = psb_success_ select type(b) class is (psb_c_base_sparse_mat) - call b%cp_to_coo(tmp,info) + call a%cp_to_coo(tmp,info) if (info == psb_success_) call tmp%transc() - if (info == psb_success_) call a%mv_from_coo(tmp,info) + if (info == psb_success_) call b%mv_from_coo(tmp,info) class default info = psb_err_invalid_dynamic_type_ end select diff --git a/base/serial/impl/psb_c_mat_impl.F90 b/base/serial/impl/psb_c_mat_impl.F90 index 5a241a47..c691d4bc 100644 --- a/base/serial/impl/psb_c_mat_impl.F90 +++ b/base/serial/impl/psb_c_mat_impl.F90 @@ -1589,8 +1589,8 @@ subroutine psb_c_transp_2mat(a,b) use psb_string_mod use psb_c_mat_mod, psb_protect_name => psb_c_transp_2mat implicit none - class(psb_cspmat_type), intent(out) :: a - class(psb_cspmat_type), intent(in) :: b + class(psb_cspmat_type), intent(in) :: a + class(psb_cspmat_type), intent(out) :: b Integer :: err_act, info character(len=20) :: name='transp' @@ -1598,22 +1598,22 @@ subroutine psb_c_transp_2mat(a,b) call psb_erractionsave(err_act) - if (b%is_null()) then + if (a%is_null()) then info = psb_err_invalid_mat_state_ call psb_errpush(info,name) goto 9999 endif #if defined(HAVE_MOLD) - allocate(a%a,mold=b%a,stat=info) + allocate(b%a,mold=a%a,stat=info) #else - call b%a%mold(a%a,info) + call a%a%mold(b%a,info) #endif if (info /= psb_success_) then info = psb_err_alloc_dealloc_ goto 9999 end if - call a%a%transp(b%a) + call a%a%transp_2mat(b%a) call psb_erractionrestore(err_act) return @@ -1670,8 +1670,8 @@ subroutine psb_c_transc_2mat(a,b) use psb_string_mod use psb_c_mat_mod, psb_protect_name => psb_c_transc_2mat implicit none - class(psb_cspmat_type), intent(out) :: a - class(psb_cspmat_type), intent(in) :: b + class(psb_cspmat_type), intent(in) :: a + class(psb_cspmat_type), intent(out) :: b Integer :: err_act, info character(len=20) :: name='transc' @@ -1679,22 +1679,22 @@ subroutine psb_c_transc_2mat(a,b) call psb_erractionsave(err_act) - if (b%is_null()) then + if (a%is_null()) then info = psb_err_invalid_mat_state_ call psb_errpush(info,name) goto 9999 endif #if defined(HAVE_MOLD) - allocate(a%a,mold=b%a,stat=info) + allocate(b%a,mold=a%a,stat=info) #else - call b%a%mold(a%a,info) + call a%a%mold(b%a,info) #endif if (info /= psb_success_) then info = psb_err_alloc_dealloc_ goto 9999 end if - call a%a%transc(b%a) + call a%a%transc_2mat(b%a) call psb_erractionrestore(err_act) return diff --git a/base/serial/impl/psb_d_base_mat_impl.f90 b/base/serial/impl/psb_d_base_mat_impl.f90 index 72169623..0a5f0763 100644 --- a/base/serial/impl/psb_d_base_mat_impl.f90 +++ b/base/serial/impl/psb_d_base_mat_impl.f90 @@ -473,8 +473,8 @@ subroutine psb_d_base_transp_2mat(a,b) use psb_error_mod implicit none - class(psb_d_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_d_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b type(psb_d_coo_sparse_mat) :: tmp integer err_act, info @@ -485,9 +485,9 @@ subroutine psb_d_base_transp_2mat(a,b) info = psb_success_ select type(b) class is (psb_d_base_sparse_mat) - call b%cp_to_coo(tmp,info) + call a%cp_to_coo(tmp,info) if (info == psb_success_) call tmp%transp() - if (info == psb_success_) call a%mv_from_coo(tmp,info) + if (info == psb_success_) call b%mv_from_coo(tmp,info) class default info = psb_err_invalid_dynamic_type_ end select @@ -511,10 +511,36 @@ subroutine psb_d_base_transc_2mat(a,b) use psb_d_base_mat_mod, psb_protect_name => psb_d_base_transc_2mat implicit none - class(psb_d_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_d_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b + type(psb_d_coo_sparse_mat) :: tmp + integer err_act, info + character(len=*), parameter :: name='d_base_transc' - call a%transp(b) + call psb_erractionsave(err_act) + + info = psb_success_ + select type(b) + class is (psb_d_base_sparse_mat) + call a%cp_to_coo(tmp,info) + if (info == psb_success_) call tmp%transc() + if (info == psb_success_) call b%mv_from_coo(tmp,info) + class default + info = psb_err_invalid_dynamic_type_ + end select + if (info /= psb_success_) then + call psb_errpush(info,name,a_err=b%get_fmt(),i_err=(/1,0,0,0,0/)) + goto 9999 + end if + call psb_erractionrestore(err_act) + + return +9999 continue + if (err_act /= psb_act_ret_) then + call psb_error() + end if + + return end subroutine psb_d_base_transc_2mat subroutine psb_d_base_transp_1mat(a) diff --git a/base/serial/impl/psb_d_mat_impl.F90 b/base/serial/impl/psb_d_mat_impl.F90 index 02ab411b..c7a78fd5 100644 --- a/base/serial/impl/psb_d_mat_impl.F90 +++ b/base/serial/impl/psb_d_mat_impl.F90 @@ -1588,8 +1588,8 @@ subroutine psb_d_transp_2mat(a,b) use psb_string_mod use psb_d_mat_mod, psb_protect_name => psb_d_transp_2mat implicit none - class(psb_dspmat_type), intent(out) :: a - class(psb_dspmat_type), intent(in) :: b + class(psb_dspmat_type), intent(in) :: a + class(psb_dspmat_type), intent(out) :: b Integer :: err_act, info character(len=20) :: name='transp' @@ -1597,22 +1597,22 @@ subroutine psb_d_transp_2mat(a,b) call psb_erractionsave(err_act) - if (b%is_null()) then + if (a%is_null()) then info = psb_err_invalid_mat_state_ call psb_errpush(info,name) goto 9999 endif #if defined(HAVE_MOLD) - allocate(a%a,mold=b%a,stat=info) + allocate(b%a,mold=a%a,stat=info) #else - call b%a%mold(a%a,info) + call a%a%mold(b%a,info) #endif if (info /= psb_success_) then info = psb_err_alloc_dealloc_ goto 9999 end if - call a%a%transp(b%a) + call a%a%transp_2mat(b%a) call psb_erractionrestore(err_act) return @@ -1669,8 +1669,8 @@ subroutine psb_d_transc_2mat(a,b) use psb_string_mod use psb_d_mat_mod, psb_protect_name => psb_d_transc_2mat implicit none - class(psb_dspmat_type), intent(out) :: a - class(psb_dspmat_type), intent(in) :: b + class(psb_dspmat_type), intent(in) :: a + class(psb_dspmat_type), intent(out) :: b Integer :: err_act, info character(len=20) :: name='transc' @@ -1678,22 +1678,22 @@ subroutine psb_d_transc_2mat(a,b) call psb_erractionsave(err_act) - if (b%is_null()) then + if (a%is_null()) then info = psb_err_invalid_mat_state_ call psb_errpush(info,name) goto 9999 endif #if defined(HAVE_MOLD) - allocate(a%a,mold=b%a,stat=info) + allocate(b%a,mold=a%a,stat=info) #else - call b%a%mold(a%a,info) + call a%a%mold(b%a,info) #endif if (info /= psb_success_) then info = psb_err_alloc_dealloc_ goto 9999 end if - call a%a%transc(b%a) + call a%a%transc_2mat(b%a) call psb_erractionrestore(err_act) return diff --git a/base/serial/impl/psb_s_base_mat_impl.f90 b/base/serial/impl/psb_s_base_mat_impl.f90 index ca6391e1..f4f455c9 100644 --- a/base/serial/impl/psb_s_base_mat_impl.f90 +++ b/base/serial/impl/psb_s_base_mat_impl.f90 @@ -473,8 +473,8 @@ subroutine psb_s_base_transp_2mat(a,b) use psb_error_mod implicit none - class(psb_s_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_s_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b type(psb_s_coo_sparse_mat) :: tmp integer err_act, info @@ -485,9 +485,9 @@ subroutine psb_s_base_transp_2mat(a,b) info = psb_success_ select type(b) class is (psb_s_base_sparse_mat) - call b%cp_to_coo(tmp,info) + call a%cp_to_coo(tmp,info) if (info == psb_success_) call tmp%transp() - if (info == psb_success_) call a%mv_from_coo(tmp,info) + if (info == psb_success_) call b%mv_from_coo(tmp,info) class default info = psb_err_invalid_dynamic_type_ end select @@ -511,10 +511,36 @@ subroutine psb_s_base_transc_2mat(a,b) use psb_s_base_mat_mod, psb_protect_name => psb_s_base_transc_2mat implicit none - class(psb_s_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_s_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b + type(psb_s_coo_sparse_mat) :: tmp + integer err_act, info + character(len=*), parameter :: name='s_base_transc' - call a%transp(b) + call psb_erractionsave(err_act) + + info = psb_success_ + select type(b) + class is (psb_s_base_sparse_mat) + call a%cp_to_coo(tmp,info) + if (info == psb_success_) call tmp%transc() + if (info == psb_success_) call b%mv_from_coo(tmp,info) + class default + info = psb_err_invalid_dynamic_type_ + end select + if (info /= psb_success_) then + call psb_errpush(info,name,a_err=b%get_fmt(),i_err=(/1,0,0,0,0/)) + goto 9999 + end if + call psb_erractionrestore(err_act) + + return +9999 continue + if (err_act /= psb_act_ret_) then + call psb_error() + end if + + return end subroutine psb_s_base_transc_2mat subroutine psb_s_base_transp_1mat(a) diff --git a/base/serial/impl/psb_s_mat_impl.F90 b/base/serial/impl/psb_s_mat_impl.F90 index 76045c54..14ad0d1c 100644 --- a/base/serial/impl/psb_s_mat_impl.F90 +++ b/base/serial/impl/psb_s_mat_impl.F90 @@ -1587,8 +1587,8 @@ subroutine psb_s_transp_2mat(a,b) use psb_string_mod use psb_s_mat_mod, psb_protect_name => psb_s_transp_2mat implicit none - class(psb_sspmat_type), intent(out) :: a - class(psb_sspmat_type), intent(in) :: b + class(psb_sspmat_type), intent(in) :: a + class(psb_sspmat_type), intent(out) :: b Integer :: err_act, info character(len=20) :: name='transp' @@ -1596,22 +1596,22 @@ subroutine psb_s_transp_2mat(a,b) call psb_erractionsave(err_act) - if (b%is_null()) then + if (a%is_null()) then info = psb_err_invalid_mat_state_ call psb_errpush(info,name) goto 9999 endif #if defined(HAVE_MOLD) - allocate(a%a,mold=b%a,stat=info) + allocate(b%a,mold=a%a,stat=info) #else - call b%a%mold(a%a,info) + call a%a%mold(b%a,info) #endif if (info /= psb_success_) then info = psb_err_alloc_dealloc_ goto 9999 end if - call a%a%transp(b%a) + call a%a%transp_2mat(b%a) call psb_erractionrestore(err_act) return @@ -1668,8 +1668,8 @@ subroutine psb_s_transc_2mat(a,b) use psb_string_mod use psb_s_mat_mod, psb_protect_name => psb_s_transc_2mat implicit none - class(psb_sspmat_type), intent(out) :: a - class(psb_sspmat_type), intent(in) :: b + class(psb_sspmat_type), intent(in) :: a + class(psb_sspmat_type), intent(out) :: b Integer :: err_act, info character(len=20) :: name='transc' @@ -1677,22 +1677,22 @@ subroutine psb_s_transc_2mat(a,b) call psb_erractionsave(err_act) - if (b%is_null()) then + if (a%is_null()) then info = psb_err_invalid_mat_state_ call psb_errpush(info,name) goto 9999 endif #if defined(HAVE_MOLD) - allocate(a%a,mold=b%a,stat=info) + allocate(b%a,mold=a%a,stat=info) #else - call b%a%mold(a%a,info) + call a%a%mold(b%a,info) #endif if (info /= psb_success_) then info = psb_err_alloc_dealloc_ goto 9999 end if - call a%a%transc(b%a) + call a%a%transc_2mat(b%a) call psb_erractionrestore(err_act) return diff --git a/base/serial/impl/psb_z_base_mat_impl.f90 b/base/serial/impl/psb_z_base_mat_impl.f90 index 822de2b5..85c4df76 100644 --- a/base/serial/impl/psb_z_base_mat_impl.f90 +++ b/base/serial/impl/psb_z_base_mat_impl.f90 @@ -474,8 +474,8 @@ subroutine psb_z_base_transp_2mat(a,b) use psb_error_mod implicit none - class(psb_z_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_z_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b type(psb_z_coo_sparse_mat) :: tmp integer err_act, info @@ -486,9 +486,9 @@ subroutine psb_z_base_transp_2mat(a,b) info = psb_success_ select type(b) class is (psb_z_base_sparse_mat) - call b%cp_to_coo(tmp,info) + call a%cp_to_coo(tmp,info) if (info == psb_success_) call tmp%transp() - if (info == psb_success_) call a%mv_from_coo(tmp,info) + if (info == psb_success_) call b%mv_from_coo(tmp,info) class default info = psb_err_invalid_dynamic_type_ end select @@ -512,8 +512,8 @@ subroutine psb_z_base_transc_2mat(a,b) use psb_z_base_mat_mod, psb_protect_name => psb_z_base_transc_2mat implicit none - class(psb_z_base_sparse_mat), intent(out) :: a - class(psb_base_sparse_mat), intent(in) :: b + class(psb_z_base_sparse_mat), intent(in) :: a + class(psb_base_sparse_mat), intent(out) :: b type(psb_z_coo_sparse_mat) :: tmp integer err_act, info character(len=*), parameter :: name='z_base_transc' @@ -523,9 +523,9 @@ subroutine psb_z_base_transc_2mat(a,b) info = psb_success_ select type(b) class is (psb_z_base_sparse_mat) - call b%cp_to_coo(tmp,info) + call a%cp_to_coo(tmp,info) if (info == psb_success_) call tmp%transc() - if (info == psb_success_) call a%mv_from_coo(tmp,info) + if (info == psb_success_) call b%mv_from_coo(tmp,info) class default info = psb_err_invalid_dynamic_type_ end select diff --git a/base/serial/impl/psb_z_mat_impl.F90 b/base/serial/impl/psb_z_mat_impl.F90 index 4dcfb7ad..e196d3f9 100644 --- a/base/serial/impl/psb_z_mat_impl.F90 +++ b/base/serial/impl/psb_z_mat_impl.F90 @@ -1587,8 +1587,8 @@ subroutine psb_z_transp_2mat(a,b) use psb_string_mod use psb_z_mat_mod, psb_protect_name => psb_z_transp_2mat implicit none - class(psb_zspmat_type), intent(out) :: a - class(psb_zspmat_type), intent(in) :: b + class(psb_zspmat_type), intent(in) :: a + class(psb_zspmat_type), intent(out) :: b Integer :: err_act, info character(len=20) :: name='transp' @@ -1596,22 +1596,22 @@ subroutine psb_z_transp_2mat(a,b) call psb_erractionsave(err_act) - if (b%is_null()) then + if (a%is_null()) then info = psb_err_invalid_mat_state_ call psb_errpush(info,name) goto 9999 endif #if defined(HAVE_MOLD) - allocate(a%a,mold=b%a,stat=info) + allocate(b%a,mold=a%a,stat=info) #else - call b%a%mold(a%a,info) + call a%a%mold(b%a,info) #endif if (info /= psb_success_) then info = psb_err_alloc_dealloc_ goto 9999 end if - call a%a%transp(b%a) + call a%a%transp_2mat(b%a) call psb_erractionrestore(err_act) return @@ -1668,8 +1668,8 @@ subroutine psb_z_transc_2mat(a,b) use psb_string_mod use psb_z_mat_mod, psb_protect_name => psb_z_transc_2mat implicit none - class(psb_zspmat_type), intent(out) :: a - class(psb_zspmat_type), intent(in) :: b + class(psb_zspmat_type), intent(in) :: a + class(psb_zspmat_type), intent(out) :: b Integer :: err_act, info character(len=20) :: name='transc' @@ -1677,22 +1677,22 @@ subroutine psb_z_transc_2mat(a,b) call psb_erractionsave(err_act) - if (b%is_null()) then + if (a%is_null()) then info = psb_err_invalid_mat_state_ call psb_errpush(info,name) goto 9999 endif #if defined(HAVE_MOLD) - allocate(a%a,mold=b%a,stat=info) + allocate(b%a,mold=a%a,stat=info) #else - call b%a%mold(a%a,info) + call a%a%mold(b%a,info) #endif if (info /= psb_success_) then info = psb_err_alloc_dealloc_ goto 9999 end if - call a%a%transc(b%a) + call a%a%transc_2mat(b%a) call psb_erractionrestore(err_act) return