29 1 (asize, a, ia, ja, sizeinv, inva)
31 INTEGER*4,
ALLOCATABLE :: ia(:), ja(:)
32 real*8,
ALLOCATABLE :: a(:)
34 real*8,
ALLOCATABLE :: inva(:,:)
39 mwpointer plhs(*), prhs(*)
53 mwpointer mxcreatedoublematrix
54 mwpointer mxgetm, mxgetn
68 integer*8,
allocatable :: ia_int8(:), ja_int8(:)
69 integer*4,
allocatable :: ia(:), ja(:)
70 real*8,
allocatable :: a(:)
71 real*8,
allocatable :: inva(:,:)
86 call mexerrmsgidandtxt (
'MATLAB:timestwo:nInput',
87 +
'Two inputs required.')
88 elseif(nlhs .gt. 1)
then 89 call mexerrmsgidandtxt (
'MATLAB:timestwo:nOutput',
90 +
'Too many output arguments.')
96 if ((mxisdouble(prhs(1)) .eq. 0))
then 97 call mexerrmsgidandtxt (
'MATLAB:timestwo:NonDouble',
98 +
'Input must be a double.')
102 if ((mxiscomplex(prhs(1)) .ne. 0) )
then 103 call mexerrmsgidandtxt (
'MATLAB:convec:NonComplex',
104 +
'Inputs must be real.')
108 nonzerosa = mxgetnzmax(prhs(1))
109 sizeam = mxgetm(prhs(1))
110 sizean = mxgetn(prhs(1))
114 allocate(ia_int8(sizean+1))
115 allocate(ja_int8(nonzerosa))
116 allocate(ia(sizean+1))
117 allocate(ja(nonzerosa))
118 allocate(a(nonzerosa))
121 if (.not. (
allocated(ia_int8) .and.
122 +
allocated(ja_int8) .and.
123 +
allocated(ia) .and.
124 +
allocated(ja) .and.
125 +
allocated(a) ))
then 126 call mexerrmsgidandtxt (
'MATLAB:dgetSchur:BadAllocation',
127 +
'The allocation of variables was unsuccesfull.')
131 call mxcopyptrtointeger8(
132 + mxgetjc(prhs(1)), ia_int8, sizean+1 )
133 call mxcopyptrtointeger8(
134 + mxgetir(prhs(1)), ja_int8, nonzerosa )
135 call mxcopyptrtoreal8( mxgetpr(prhs(1)), a, nonzerosa )
137 ia = int(ia_int8, 4) + 1
138 ja = int(ja_int8, 4) + 1
145 call mxcopyptrtointeger4( mxgetpr(prhs(2)), sizeinv, ndim )
149 ALLOCATE(inva(sizeinv, sizeinv))
160 write(*,*)
'diagonal Elements of the partial solution' 162 write(line,*) inva(i,i), new_line(
'A')
163 tmp = mexprintf( line )
168 ndim = int(sizeinv, 8)
170 plhs(1) = mxcreatedoublematrix(ndim, ndim,
172 mxinva = mxgetpr(plhs(1))
173 call mxcopyreal8toptr(inva, mxinva,ndim*ndim)
179 if (
allocated(inva) )
then Module to calculate the partial inverse of a real/complex sparse matrix via the PARDISO libraries.
subroutine mexfunction(nlhs, plhs, nrhs, prhs)