35 #include "qrm_common.h" 60 character(len=*),
intent(in) :: matfile
62 logical,
optional :: fakec
64 character(len=20) :: rep, field, symm, typ, fmt
65 integer :: m, n, nnz, ival, i, myid, info, nprocs
66 logical :: values, ifakec
67 real(kind(1.d0)) :: rnds(2), re, im
70 character(len=*),
parameter :: name=
'qrm_read_mat' 74 __qrm_prnt_msg(
'("Reading Matrix: ",a20)')matfile
82 if(
present(fakec))
then 88 open(4,file=matfile, status=
'OLD', action=
'READ', iostat=info)
94 read(4,*)rep,typ,fmt,field,symm
98 if(rep(1:1) .ne.
'%')
exit 106 values = field .ne.
'pattern' 112 call qrm_palloc( qrm_mat%irn, qrm_mat%nz )
113 call qrm_palloc( qrm_mat%jcn, qrm_mat%nz )
114 call qrm_palloc( qrm_mat%val, qrm_mat%nz )
115 __qrm_check_ret(name,
'qrm_palloc',9999)
118 #if defined (cprec) || defined(zprec) 119 if(field .eq.
'complex')
then 120 read(4,*)qrm_mat%irn(i), qrm_mat%jcn(i), re, im
121 qrm_mat%val(i) = cmplx(re,im,kind(1.d0))
122 else if((field.eq.
'real') .or. (field.eq.
'integer'))
then 123 read(4,*)qrm_mat%irn(i), qrm_mat%jcn(i), re
125 qrm_mat%val(i) = cmplx(re,re,kind(1.d0))
127 qrm_mat%val(i) = cmplx(re,0.d0,kind(1.d0))
130 #elif defined (sprec) || defined(dprec) 131 if(field .eq.
'complex')
then 132 read(4,*)qrm_mat%irn(i), qrm_mat%jcn(i), qrm_mat%val(i), im
133 else if((field.eq.
'real') .or. (field.eq.
'integer'))
then 134 read(4,*)qrm_mat%irn(i), qrm_mat%jcn(i), qrm_mat%val(i)
140 read(4,*)qrm_mat%irn(i),qrm_mat%jcn(i)
142 #if defined (cprec) || defined(zprec) 144 #elif defined (sprec) || defined(dprec) 150 __qrm_prnt_msg(
'("Matrix read.")')
subroutine dqrm_readmat(matfile, qrm_mat, fakec)
This subroutine reads a Matrix Market matrix from a file and stores it on the host processor...
subroutine qrm_err_push(code, sub, ied, aed)
This subroutine pushes an error on top of the stack.
subroutine qrm_err_act_save(err_act)
Saves a copy of the qrm_err_act variable.
This module contains all the error management routines and data.
This module contains the definition of the basic sparse matrix type and of the associated methods...
integer, parameter qrm_abort_
Possible actions to be performed upon detection of an error.
subroutine qrm_err_check()
This subroutine checks the errors stack. If something is found all the entries in the stack are poppe...
This type defines the data structure used to store a matrix.
subroutine qrm_err_act_restore(err_act)
Restores the value of the qrm_err_act variable.