Updated PENV with min/max.

Updated docs on utilities.
psblas3-type-indexed
Salvatore Filippone 18 years ago
parent 60bc82efc1
commit 8bc00d4083

@ -20,7 +20,7 @@ INCDIRS = -I .
psb_realloc_mod.o : psb_error_mod.o psb_realloc_mod.o : psb_error_mod.o
psb_spmat_type.o : psb_realloc_mod.o psb_error_mod.o psb_const_mod.o psb_string_mod.o psb_spmat_type.o : psb_realloc_mod.o psb_error_mod.o psb_const_mod.o psb_string_mod.o
psb_error_mod.o: psb_const_mod.o psb_error_mod.o: psb_const_mod.o
psb_penv_mod.o: psb_const_mod.o psb_error_mod.o psb_penv_mod.o: psb_const_mod.o psb_error_mod.o psb_realloc_mod.o
psi_mod.o: psb_penv_mod.o psb_error_mod.o psb_desc_type.o psi_mod.o: psb_penv_mod.o psb_error_mod.o psb_desc_type.o
psb_desc_type.o: psb_const_mod.o psb_error_mod.o psb_penv_mod.o psb_desc_type.o: psb_const_mod.o psb_error_mod.o psb_penv_mod.o
psb_check_mod.o: psb_desc_type.o psb_check_mod.o: psb_desc_type.o

@ -77,6 +77,17 @@ module psb_penv_mod
& psb_hrcvs, psb_lrcvs & psb_hrcvs, psb_lrcvs
end interface end interface
interface psb_max
module procedure psb_imaxs, psb_imaxv, psb_imaxm,&
& psb_dmaxs, psb_dmaxv, psb_dmaxm
end interface
interface psb_min
module procedure psb_imins, psb_iminv, psb_iminm,&
& psb_dmins, psb_dminv, psb_dminm
end interface
interface psb_amx interface psb_amx
module procedure psb_iamxs, psb_iamxv, psb_iamxm,& module procedure psb_iamxs, psb_iamxv, psb_iamxm,&
@ -96,7 +107,6 @@ module psb_penv_mod
& psb_zsums, psb_zsumv, psb_zsumm & psb_zsums, psb_zsumv, psb_zsumm
end interface end interface
interface gebs2d interface gebs2d
module procedure igebs2ds, igebs2dv, igebs2dm,& module procedure igebs2ds, igebs2dv, igebs2dm,&
@ -482,6 +492,371 @@ contains
end subroutine psb_lbcasts end subroutine psb_lbcasts
subroutine psb_imaxs(ictxt,dat,root)
use mpi
integer, intent(in) :: ictxt
integer, intent(inout) :: dat
integer, intent(in), optional :: root
integer :: root_, dat_
integer :: iam, np, icomm
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call mpi_allreduce(dat,dat_,1,mpi_integer,mpi_max,icomm)
dat = dat_
else
call mpi_reduce(dat,dat_,1,mpi_integer,mpi_max,root_,icomm)
dat = dat_
endif
end subroutine psb_imaxs
subroutine psb_imaxv(ictxt,dat,root)
use mpi
use psb_realloc_mod
integer, intent(in) :: ictxt
integer, intent(inout) :: dat(:)
integer, intent(in), optional :: root
integer :: root_
integer, allocatable :: dat_(:)
integer :: iam, np, icomm, info
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call psb_realloc(size(dat),dat_,info)
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_integer,mpi_max,icomm)
else
if (iam==root_) then
call psb_realloc(size(dat),dat_,info)
call mpi_reduce(dat_,dat,size(dat),mpi_integer,mpi_max,root_,icomm)
else
call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_max,root_,icomm)
end if
endif
end subroutine psb_imaxv
subroutine psb_imaxm(ictxt,dat,root)
use mpi
use psb_realloc_mod
integer, intent(in) :: ictxt
integer, intent(inout) :: dat(:,:)
integer, intent(in), optional :: root
integer :: root_
integer, allocatable :: dat_(:,:)
integer :: iam, np, icomm, info
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_integer,mpi_max,icomm)
else
if (iam==root_) then
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
call mpi_reduce(dat_,dat,size(dat),mpi_integer,mpi_max,root_,icomm)
else
call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_max,root_,icomm)
end if
endif
end subroutine psb_imaxm
subroutine psb_dmaxs(ictxt,dat,root)
use mpi
integer, intent(in) :: ictxt
real(kind(1.d0)), intent(inout) :: dat
integer, intent(in), optional :: root
integer :: root_
real(kind(1.d0)) :: dat_
integer :: iam, np, icomm
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call mpi_allreduce(dat,dat_,1,mpi_double_precision,mpi_max,icomm)
dat = dat_
else
call mpi_reduce(dat,dat_,1,mpi_double_precision,mpi_max,root_,icomm)
dat = dat_
endif
end subroutine psb_dmaxs
subroutine psb_dmaxv(ictxt,dat,root)
use mpi
use psb_realloc_mod
integer, intent(in) :: ictxt
real(kind(1.d0)), intent(inout) :: dat(:)
integer, intent(in), optional :: root
integer :: root_
real(kind(1.d0)), allocatable :: dat_(:)
integer :: iam, np, icomm, info
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call psb_realloc(size(dat),dat_,info)
dat_ = dat
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,icomm)
else
if (iam==root_) then
call psb_realloc(size(dat),dat_,info)
dat_ = dat
call mpi_reduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,root_,icomm)
else
call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_max,root_,icomm)
end if
endif
end subroutine psb_dmaxv
subroutine psb_dmaxm(ictxt,dat,root)
use mpi
use psb_realloc_mod
integer, intent(in) :: ictxt
real(kind(1.d0)), intent(inout) :: dat(:,:)
integer, intent(in), optional :: root
integer :: root_
real(kind(1.d0)), allocatable :: dat_(:,:)
integer :: iam, np, icomm, info
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
dat_ = dat
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,icomm)
else
if (iam==root_) then
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
dat_ = dat
call mpi_reduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,root_,icomm)
else
call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_max,root_,icomm)
end if
endif
end subroutine psb_dmaxm
subroutine psb_imins(ictxt,dat,root)
use mpi
integer, intent(in) :: ictxt
integer, intent(inout) :: dat
integer, intent(in), optional :: root
integer :: root_, dat_
integer :: iam, np, icomm
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call mpi_allreduce(dat,dat_,1,mpi_integer,mpi_min,icomm)
dat = dat_
else
call mpi_reduce(dat,dat_,1,mpi_integer,mpi_min,root_,icomm)
dat = dat_
endif
end subroutine psb_imins
subroutine psb_iminv(ictxt,dat,root)
use mpi
use psb_realloc_mod
integer, intent(in) :: ictxt
integer, intent(inout) :: dat(:)
integer, intent(in), optional :: root
integer :: root_
integer, allocatable :: dat_(:)
integer :: iam, np, icomm, info
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call psb_realloc(size(dat),dat_,info)
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_integer,mpi_min,icomm)
else
if (iam==root_) then
call psb_realloc(size(dat),dat_,info)
call mpi_reduce(dat_,dat,size(dat),mpi_integer,mpi_min,root_,icomm)
else
call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_min,root_,icomm)
end if
endif
end subroutine psb_iminv
subroutine psb_iminm(ictxt,dat,root)
use mpi
use psb_realloc_mod
integer, intent(in) :: ictxt
integer, intent(inout) :: dat(:,:)
integer, intent(in), optional :: root
integer :: root_
integer, allocatable :: dat_(:,:)
integer :: iam, np, icomm, info
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_integer,mpi_min,icomm)
else
if (iam==root_) then
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
call mpi_reduce(dat_,dat,size(dat),mpi_integer,mpi_min,root_,icomm)
else
call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_min,root_,icomm)
end if
endif
end subroutine psb_iminm
subroutine psb_dmins(ictxt,dat,root)
use mpi
integer, intent(in) :: ictxt
real(kind(1.d0)), intent(inout) :: dat
integer, intent(in), optional :: root
integer :: root_
real(kind(1.d0)) :: dat_
integer :: iam, np, icomm
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call mpi_allreduce(dat,dat_,1,mpi_double_precision,mpi_min,icomm)
dat = dat_
else
call mpi_reduce(dat,dat_,1,mpi_double_precision,mpi_min,root_,icomm)
dat = dat_
endif
end subroutine psb_dmins
subroutine psb_dminv(ictxt,dat,root)
use mpi
use psb_realloc_mod
integer, intent(in) :: ictxt
real(kind(1.d0)), intent(inout) :: dat(:)
integer, intent(in), optional :: root
integer :: root_
real(kind(1.d0)), allocatable :: dat_(:)
integer :: iam, np, icomm, info
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call psb_realloc(size(dat),dat_,info)
dat_ = dat
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,icomm)
else
if (iam==root_) then
call psb_realloc(size(dat),dat_,info)
dat_ = dat
call mpi_reduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,root_,icomm)
else
call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_min,root_,icomm)
end if
endif
end subroutine psb_dminv
subroutine psb_dminm(ictxt,dat,root)
use mpi
use psb_realloc_mod
integer, intent(in) :: ictxt
real(kind(1.d0)), intent(inout) :: dat(:,:)
integer, intent(in), optional :: root
integer :: root_
real(kind(1.d0)), allocatable :: dat_(:,:)
integer :: iam, np, icomm, info
call psb_info(ictxt,iam,np)
call psb_get_mpicomm(ictxt,icomm)
if (present(root)) then
root_ = root
else
root_ = -1
endif
if (root_ == -1) then
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
dat_ = dat
if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,icomm)
else
if (iam==root_) then
call psb_realloc(size(dat,1),size(dat,2),dat_,info)
dat_ = dat
call mpi_reduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,root_,icomm)
else
call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_min,root_,icomm)
end if
endif
end subroutine psb_dminm
subroutine psb_iamxs(ictxt,dat,root,ia) subroutine psb_iamxs(ictxt,dat,root,ia)
integer, intent(in) :: ictxt integer, intent(in) :: ictxt
integer, intent(inout) :: dat integer, intent(inout) :: dat

@ -75,8 +75,8 @@ Contains
use psb_error_mod use psb_error_mod
! ...Subroutine Arguments ! ...Subroutine Arguments
Integer,allocatable,intent(in) :: vin(:) Integer,allocatable, intent(in) :: vin(:)
Integer,allocatable,intent(out) :: vout(:) Integer,allocatable, intent(out) :: vout(:)
integer :: info integer :: info
! ...Local Variables ! ...Local Variables
@ -122,7 +122,8 @@ Contains
use psb_error_mod use psb_error_mod
! ...Subroutine Arguments ! ...Subroutine Arguments
Integer,allocatable :: vin(:,:),vout(:,:) Integer, allocatable, intent(in) :: vin(:,:)
Integer, allocatable, intent(out) :: vout(:,:)
integer :: info integer :: info
! ...Local Variables ! ...Local Variables
@ -170,7 +171,8 @@ Contains
use psb_error_mod use psb_error_mod
! ...Subroutine Arguments ! ...Subroutine Arguments
real(kind(1.d0)),allocatable :: vin(:),vout(:) real(kind(1.d0)), allocatable, intent(in) :: vin(:)
real(kind(1.d0)), allocatable, intent(out) :: vout(:)
integer :: info integer :: info
! ...Local Variables ! ...Local Variables
@ -216,7 +218,8 @@ Contains
use psb_error_mod use psb_error_mod
! ...Subroutine Arguments ! ...Subroutine Arguments
real(kind(1.d0)),allocatable :: vin(:,:),vout(:,:) real(kind(1.d0)), allocatable, intent(in) :: vin(:,:)
real(kind(1.d0)), allocatable, intent(out) :: vout(:,:)
integer :: info integer :: info
! ...Local Variables ! ...Local Variables
@ -264,7 +267,8 @@ Contains
use psb_error_mod use psb_error_mod
! ...Subroutine Arguments ! ...Subroutine Arguments
complex(kind(1.d0)),allocatable :: vin(:),vout(:) complex(kind(1.d0)), allocatable, intent(in) :: vin(:)
complex(kind(1.d0)), allocatable, intent(out) :: vout(:)
integer :: info integer :: info
! ...Local Variables ! ...Local Variables
@ -310,7 +314,8 @@ Contains
use psb_error_mod use psb_error_mod
! ...Subroutine Arguments ! ...Subroutine Arguments
complex(kind(1.d0)),allocatable :: vin(:,:),vout(:,:) complex(kind(1.d0)), allocatable, intent(in) :: vin(:,:)
complex(kind(1.d0)), allocatable, intent(out) :: vout(:,:)
integer :: info integer :: info
! ...Local Variables ! ...Local Variables

@ -30,6 +30,7 @@
!!$ !!$
module psb_string_mod module psb_string_mod
public tolower, toupper, touppers
interface tolower interface tolower
module procedure tolowerc module procedure tolowerc
end interface end interface
@ -42,13 +43,15 @@ module psb_string_mod
module procedure sub_toupperc module procedure sub_toupperc
end interface end interface
private
character(len=*), parameter :: lcase='abcdefghijklmnopqrstuvwxyz'
character(len=*), parameter :: ucase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
contains contains
function tolowerc(string) function tolowerc(string)
character(len=*), intent(in) :: string character(len=*), intent(in) :: string
character(len=len(string)) :: tolowerc character(len=len(string)) :: tolowerc
character(len=*), parameter :: lcase='abcdefghijklmnopqrstuvwxyz'
character(len=*), parameter :: ucase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
integer :: i,k integer :: i,k
do i=1,len(string) do i=1,len(string)
@ -64,8 +67,6 @@ contains
function toupperc(string) function toupperc(string)
character(len=*), intent(in) :: string character(len=*), intent(in) :: string
character(len=len(string)) :: toupperc character(len=len(string)) :: toupperc
character(len=*), parameter :: lcase='abcdefghijklmnopqrstuvwxyz'
character(len=*), parameter :: ucase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
integer :: i,k integer :: i,k
do i=1,len(string) do i=1,len(string)
@ -81,8 +82,6 @@ contains
subroutine sub_toupperc(string,strout) subroutine sub_toupperc(string,strout)
character(len=*), intent(in) :: string character(len=*), intent(in) :: string
character(len=*), intent(out) :: strout character(len=*), intent(out) :: strout
character(len=*), parameter :: lcase='abcdefghijklmnopqrstuvwxyz'
character(len=*), parameter :: ucase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
integer :: i,k integer :: i,k
do i=1,len(string) do i=1,len(string)

@ -17,10 +17,12 @@ the Krylov-Subspace family methods implemented in PSBLAS-2.0.
The stopping criterion is the normwise backward error, in the infinity The stopping criterion is the normwise backward error, in the infinity
norm, i.e. the iteration is stopped when norm, i.e. the iteration is stopped when
\[ \frac{\|r\|}{(\|A\|\|x\|+\|b\|)} < eps \] \[ err = \frac{\|r_i\|}{(\|A\|\|x_i\|+\|b\|)} < eps \]
or or the 2-norm residual reduction
\[ \frac{\|r_i\|}{\|b\|_2} < eps \] \[ err = \frac{\|r_i\|}{\|b\|_2} < eps \]
according to the value passed through the istop argument (see later). according to the value passed through the istop argument (see
later). In the above formulae, $x_i$ is the tentative solution and
$r_i=b-Ax_i$ the corresponding residual at the $i$-th iteration.
\syntax{call psb\_krylov}{method,a,prec,b,x,eps,desc\_a,info,itmax,iter,err,itrace,istop} \syntax{call psb\_krylov}{method,a,prec,b,x,eps,desc\_a,info,itmax,iter,err,itrace,istop}
@ -74,8 +76,9 @@ Scope: {\bf global} \\
Type: {\bf optional}\\ Type: {\bf optional}\\
\item[istop] An integer specifying the stopping criterion.\\ \item[istop] An integer specifying the stopping criterion.\\
Scope: {\bf global} \\ Scope: {\bf global} \\
Type: {\bf optional}\\ Type: {\bf optional}.\\
Values: 1: use the normwise backward error, 2: use the scaled 2-norm
of the residual. Default: 1.
\item[\bf On Return] \item[\bf On Return]
\item[x] The computed solution. \\ \item[x] The computed solution. \\
Scope: {\bf local} \\ Scope: {\bf local} \\

@ -292,6 +292,96 @@ Type, rank and size must agree on all processes.
\subroutine{psb\_max}{Global maximum}
\syntax{call psb\_max}{icontxt, dat, root}
This subroutine implements a maximum valuereduction
operation based on the underlying communication library.
\begin{description}
\item[\bf On Entry ]
\item[icontxt] the communication context identifying the virtual
parallel machine.\\
Scope:{\bf global}.\\
Type:{\bf required}.\\
Specified as: an integer variable.
\item[dat] The local contribution to the global maximum.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Specified as: an integer or real variable, which may be a
scalar, or a rank 1 or 2 array. \
Type, rank and size must agree on all processes.
\item[root] Process to hold the final maximum, or $-1$ to make it available
on all processes.\\
Scope:{\bf global}.\\
Type:{\bf optional}.\\
Specified as: an integer value $-1<= root <= np-1$, default -1. \\
\end{description}
\begin{description}
\item[\bf On Return]
\item[dat] On destination process(es), the result of the maximum operation.\\
Scope:{\bf global}.\\
Type:{\bf required}.\\
Specified as: an integer or real variable, which may be a
scalar, or a rank 1 or 2 array. \
Type, rank and size must agree on all processes.
\end{description}
\section*{Notes}
\begin{enumerate}
\item The \verb|dat| argument is both input and output, and its
value may be changed even on processes different from the final
result destination.
\end{enumerate}
\subroutine{psb\_min}{Global minimum}
\syntax{call psb\_min}{icontxt, dat, root}
This subroutine implements a minimum value reduction
operation based on the underlying communication library.
\begin{description}
\item[\bf On Entry ]
\item[icontxt] the communication context identifying the virtual
parallel machine.\\
Scope:{\bf global}.\\
Type:{\bf required}.\\
Specified as: an integer variable.
\item[dat] The local contribution to the global minimum.\\
Scope:{\bf local}.\\
Type:{\bf required}.\\
Specified as: an integer or real variable, which may be a
scalar, or a rank 1 or 2 array. \
Type, rank and size must agree on all processes.
\item[root] Process to hold the final value, or $-1$ to make it available
on all processes.\\
Scope:{\bf global}.\\
Type:{\bf optional}.\\
Specified as: an integer value $-1<= root <= np-1$, default -1. \\
\end{description}
\begin{description}
\item[\bf On Return]
\item[dat] On destination process(es), the result of the minimum operation.\\
Scope:{\bf global}.\\
Type:{\bf required}.\\
Specified as: an integer or real variable, which may be a
scalar, or a rank 1 or 2 array. \\
Type, rank and size must agree on all processes.
\end{description}
\section*{Notes}
\begin{enumerate}
\item The \verb|dat| argument is both input and output, and its
value may be changed even on processes different from the final
result destination.
\end{enumerate}
\subroutine{psb\_amx}{Global maximum absolute value} \subroutine{psb\_amx}{Global maximum absolute value}
\syntax{call psb\_amx}{icontxt, dat, root} \syntax{call psb\_amx}{icontxt, dat, root}
@ -311,7 +401,7 @@ Type:{\bf required}.\\
Specified as: an integer, real or complex variable, which may be a Specified as: an integer, real or complex variable, which may be a
scalar, or a rank 1 or 2 array. \ scalar, or a rank 1 or 2 array. \
Type, rank and size must agree on all processes. Type, rank and size must agree on all processes.
\item[root] Process to hold the final sum, or $-1$ to make it available \item[root] Process to hold the final value, or $-1$ to make it available
on all processes.\\ on all processes.\\
Scope:{\bf global}.\\ Scope:{\bf global}.\\
Type:{\bf optional}.\\ Type:{\bf optional}.\\
@ -356,7 +446,7 @@ Type:{\bf required}.\\
Specified as: an integer, real or complex variable, which may be a Specified as: an integer, real or complex variable, which may be a
scalar, or a rank 1 or 2 array. \ scalar, or a rank 1 or 2 array. \
Type, rank and size must agree on all processes. Type, rank and size must agree on all processes.
\item[root] Process to hold the final sum, or $-1$ to make it available \item[root] Process to hold the final value, or $-1$ to make it available
on all processes.\\ on all processes.\\
Scope:{\bf global}.\\ Scope:{\bf global}.\\
Type:{\bf optional}.\\ Type:{\bf optional}.\\

@ -35,7 +35,9 @@
\newcounter{subroutine}[subsection] \newcounter{subroutine}[subsection]
\newcounter{example}[subroutine] \newcounter{example}[subroutine]
\newcommand{\subroutine}[2]{\clearpage% \makeatletter
\def\subroutine{\@ifstar{\@subroutine}{\clearpage\@subroutine}}%
\def\@subroutine#1#2{%
\stepcounter{subroutine}% \stepcounter{subroutine}%
\section*{\flushleft #1---#2 \endflushleft}% \section*{\flushleft #1---#2 \endflushleft}%
\addcontentsline{toc}{subsection}{#1}% \addcontentsline{toc}{subsection}{#1}%
@ -47,7 +49,6 @@
\markright{#1}}% \markright{#1}}%
\newcommand{\examplename}{Example} \newcommand{\examplename}{Example}
\newcommand{\syntaxname}{Syntax} \newcommand{\syntaxname}{Syntax}
\makeatletter
\def\syntax{\@ifstar{\@ssyntax}{\@syntax}}% \def\syntax{\@ifstar{\@ssyntax}{\@syntax}}%
\def\@syntax{\section*{\syntaxname}% \def\@syntax{\section*{\syntaxname}%
\@ssyntax}% \@ssyntax}%

@ -2,6 +2,148 @@
\label{sec:util} \label{sec:util}
\subroutine{PSB\_HBIO\_MOD}{Input/Output in Harwell-Boeing format}
\subroutine*{hb\_read}{Read a sparse matrix from a file}
\syntax{call hb\_read}{a, iret, iunit, filename, b, mtitle}
\begin{description}
\item[\bf On Entry ]
\item[filename] The name of the file to be read.\\
Type:{\bf optional}.\\
Specified as: a character variable containing a valid file name, or
\verb|-|, in which case the default input unit 5 (i.e. standard input
in Unix jargon) is used. Default: \verb|-|.
\item[iunit] The Fortran file unit number.\\
Type:{\bf optional}.\\
Specified as: an integer value. Only meaningful if filename is not \verb|-|.
\end{description}
\begin{description}
\item[\bf On Return]
\item[a] the sparse matrix read from file.\\
Type:{\bf required}.\\
Specified as: a structured data of type \spdata.
\item[b] Rigth hand side.\\
Type: {\bf Optional} \\
An array of type real or complex, rank 1 and having the ALLOCATABLE
attribute; will be allocated and filled in if the input file contains
a right hand side.
\item[mtitle] Matrix title.\\
Type: {\bf Optional} \\
A charachter variable of length 72 holding a copy of the
matrix title as specified by the Harwell-Boeing format and contained
in the input file.
\item[iret] Error code.\\
Type: {\bf required} \\
An integer value; 0 means no error has been detected.
\end{description}
\subroutine*{hb\_write}{Write a sparse matrix to a file}
\syntax{call hb\_write}{a, iret, iunit, filename, key, rhs, mtitle}
\begin{description}
\item[\bf On Entry ]
\item[a] the sparse matrix to be written.\\
Type:{\bf required}.\\
Specified as: a structured data of type \spdata.
\item[b] Rigth hand side.\\
Type: {\bf Optional} \\
An array of type real or complex, rank 1 and having the ALLOCATABLE
attribute; will be allocated and filled in if the input file contains
a right hand side.
\item[filename] The name of the file to be written to.\\
Type:{\bf optional}.\\
Specified as: a character variable containing a valid file name, or
\verb|-|, in which case the default output unit 6 (i.e. standard output
in Unix jargon) is used. Default: \verb|-|.
\item[iunit] The Fortran file unit number.\\
Type:{\bf optional}.\\
Specified as: an integer value. Only meaningful if filename is not \verb|-|.
\item[key] Matrix key.\\
Type: {\bf Optional} \\
A charachter variable of length 8 holding the
matrix key as specified by the Harwell-Boeing format and to be
written to file.
\item[mtitle] Matrix title.\\
Type: {\bf Optional} \\
A charachter variable of length 72 holding the
matrix title as specified by the Harwell-Boeing format and to be
written to file.
\end{description}
\begin{description}
\item[\bf On Return]
\item[iret] Error code.\\
Type: {\bf required} \\
An integer value; 0 means no error has been detected.
\end{description}
\subroutine{PSB\_MMIO\_MOD}{Input/Output in MatrixMarket format}
\subroutine*{mm\_mat\_read}{Read a sparse matrix from a file}
\syntax{call mm\_mat\_read}{a, iret, iunit, filename}
\begin{description}
\item[\bf On Entry ]
\item[filename] The name of the file to be read.\\
Type:{\bf optional}.\\
Specified as: a character variable containing a valid file name, or
\verb|-|, in which case the default input unit 5 (i.e. standard input
in Unix jargon) is used. Default: \verb|-|.
\item[iunit] The Fortran file unit number.\\
Type:{\bf optional}.\\
Specified as: an integer value. Only meaningful if filename is not \verb|-|.
\end{description}
\begin{description}
\item[\bf On Return]
\item[a] the sparse matrix read from file.\\
Type:{\bf required}.\\
Specified as: a structured data of type \spdata.
\item[iret] Error code.\\
Type: {\bf required} \\
An integer value; 0 means no error has been detected.
\end{description}
\subroutine*{mm\_mat\_write}{Write a sparse matrix to a file}
\syntax{call mm\_mat\_write}{a, mtitle, iret, iunit, filename}
\begin{description}
\item[\bf On Entry ]
\item[a] the sparse matrix to be written.\\
Type:{\bf required}.\\
Specified as: a structured data of type \spdata.
\item[mtitle] Matrix title.\\
Type: {\bf required} \\
A charachter variable holding a descriptive title for the matrix to be
written to file.
\item[filename] The name of the file to be written to.\\
Type:{\bf optional}.\\
Specified as: a character variable containing a valid file name, or
\verb|-|, in which case the default output unit 6 (i.e. standard output
in Unix jargon) is used. Default: \verb|-|.
\item[iunit] The Fortran file unit number.\\
Type:{\bf optional}.\\
Specified as: an integer value. Only meaningful if filename is not \verb|-|.
\end{description}
\begin{description}
\item[\bf On Return]
\item[iret] Error code.\\
Type: {\bf required} \\
An integer value; 0 means no error has been detected.
\end{description}
%%% Local Variables: %%% Local Variables:
%%% mode: latex %%% mode: latex

File diff suppressed because one or more lines are too long

@ -179,13 +179,13 @@ contains
subroutine dhb_write(a,iret,eiout,filename,key,rhs,mtitle) subroutine dhb_write(a,iret,iunit,filename,key,rhs,mtitle)
use psb_base_mod use psb_base_mod
implicit none implicit none
type(psb_dspmat_type), intent(in) :: a type(psb_dspmat_type), intent(in) :: a
integer, intent(out) :: iret integer, intent(out) :: iret
character(len=*), optional, intent(in) :: mtitle character(len=*), optional, intent(in) :: mtitle
integer, optional, intent(in) :: eiout integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename character(len=*), optional, intent(in) :: filename
character(len=*), optional, intent(in) :: key character(len=*), optional, intent(in) :: key
real(kind(1.d0)), optional :: rhs(:) real(kind(1.d0)), optional :: rhs(:)
@ -213,16 +213,16 @@ contains
if (filename=='-') then if (filename=='-') then
iout=6 iout=6
else else
if (present(eiout)) then if (present(iunit)) then
iout = eiout iout = iunit
else else
iout=99 iout=99
endif endif
open(iout,file=filename, err=901, action='WRITE') open(iout,file=filename, err=901, action='WRITE')
endif endif
else else
if (present(eiout)) then if (present(iunit)) then
iout = eiout iout = iunit
else else
iout=6 iout=6
endif endif
@ -520,13 +520,13 @@ contains
subroutine zhb_write(a,iret,eiout,filename,key,rhs,mtitle) subroutine zhb_write(a,iret,iunit,filename,key,rhs,mtitle)
use psb_base_mod use psb_base_mod
implicit none implicit none
type(psb_zspmat_type), intent(in) :: a type(psb_zspmat_type), intent(in) :: a
integer, intent(out) :: iret integer, intent(out) :: iret
character(len=*), optional, intent(in) :: mtitle character(len=*), optional, intent(in) :: mtitle
integer, optional, intent(in) :: eiout integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename character(len=*), optional, intent(in) :: filename
character(len=*), optional, intent(in) :: key character(len=*), optional, intent(in) :: key
complex(kind(1.d0)), optional :: rhs(:) complex(kind(1.d0)), optional :: rhs(:)
@ -554,16 +554,16 @@ contains
if (filename=='-') then if (filename=='-') then
iout=6 iout=6
else else
if (present(eiout)) then if (present(iunit)) then
iout = eiout iout = iunit
else else
iout=99 iout=99
endif endif
open(iout,file=filename, err=901, action='WRITE') open(iout,file=filename, err=901, action='WRITE')
endif endif
else else
if (present(eiout)) then if (present(iunit)) then
iout = eiout iout = iunit
else else
iout=6 iout=6
endif endif

@ -148,13 +148,13 @@ contains
subroutine dmm_mat_write(a,mtitle,iret,eiout,filename) subroutine dmm_mat_write(a,mtitle,iret,iunit,filename)
use psb_base_mod use psb_base_mod
implicit none implicit none
type(psb_dspmat_type), intent(in) :: a type(psb_dspmat_type), intent(in) :: a
integer, intent(out) :: iret integer, intent(out) :: iret
character(len=*), intent(in) :: mtitle character(len=*), intent(in) :: mtitle
integer, optional, intent(in) :: eiout integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename character(len=*), optional, intent(in) :: filename
integer :: iout integer :: iout
@ -165,16 +165,16 @@ contains
if (filename=='-') then if (filename=='-') then
iout=6 iout=6
else else
if (present(eiout)) then if (present(iunit)) then
iout = eiout iout = iunit
else else
iout=99 iout=99
endif endif
open(iout,file=filename, err=901, action='WRITE') open(iout,file=filename, err=901, action='WRITE')
endif endif
else else
if (present(eiout)) then if (present(iunit)) then
iout = eiout iout = iunit
else else
iout=6 iout=6
endif endif
@ -330,13 +330,13 @@ contains
subroutine zmm_mat_write(a,mtitle,iret,eiout,filename) subroutine zmm_mat_write(a,mtitle,iret,iunit,filename)
use psb_base_mod use psb_base_mod
implicit none implicit none
type(psb_zspmat_type), intent(in) :: a type(psb_zspmat_type), intent(in) :: a
integer, intent(out) :: iret integer, intent(out) :: iret
character(len=*), intent(in) :: mtitle character(len=*), intent(in) :: mtitle
integer, optional, intent(in) :: eiout integer, optional, intent(in) :: iunit
character(len=*), optional, intent(in) :: filename character(len=*), optional, intent(in) :: filename
integer :: iout integer :: iout
@ -347,16 +347,16 @@ contains
if (filename=='-') then if (filename=='-') then
iout=6 iout=6
else else
if (present(eiout)) then if (present(iunit)) then
iout = eiout iout = iunit
else else
iout=99 iout=99
endif endif
open(iout,file=filename, err=901, action='WRITE') open(iout,file=filename, err=901, action='WRITE')
endif endif
else else
if (present(eiout)) then if (present(iunit)) then
iout = eiout iout = iunit
else else
iout=6 iout=6
endif endif

Loading…
Cancel
Save