29 1 (asize, a, ia, ja, ssize, s, is, js, mtype)
31 INTEGER*4,
ALLOCATABLE :: ia(:), ja(:)
32 real*8,
ALLOCATABLE :: a(:)
34 INTEGER,
ALLOCATABLE :: iS(:), jS(:)
35 real*8,
ALLOCATABLE :: s(:)
41 mwpointer plhs(*), prhs(*)
55 mwpointer mxcreatedoublematrix
56 mwpointer mxgetm, mxgetn
71 integer*8,
allocatable :: ia_int8(:), ja_int8(:)
72 integer*4,
allocatable :: ia(:), ja(:)
73 real*8,
allocatable :: a(:)
75 integer,
allocatable :: iS(:), jS(:)
76 real*8,
allocatable :: s(:)
77 real*8,
allocatable :: s_full(:,:)
94 call mexerrmsgidandtxt (
'MATLAB:timestwo:nInput',
95 +
'Two inputs required.')
96 elseif(nlhs .gt. 1)
then 97 call mexerrmsgidandtxt (
'MATLAB:timestwo:nOutput',
98 +
'Too many output arguments.')
104 if ((mxisdouble(prhs(1)) .eq. 0))
then 105 call mexerrmsgidandtxt (
'MATLAB:timestwo:NonDouble',
106 +
'Input must be a double.')
110 if ((mxiscomplex(prhs(1)) .ne. 0) )
then 111 call mexerrmsgidandtxt (
'MATLAB:convec:NonComplex',
112 +
'Inputs must be real.')
116 nonzerosa = mxgetnzmax(prhs(1))
117 sizeam = mxgetm(prhs(1))
118 sizean = mxgetn(prhs(1))
122 allocate(ia_int8(sizean+1))
123 allocate(ja_int8(nonzerosa))
124 allocate(ia(sizean+1))
125 allocate(ja(nonzerosa))
126 allocate(a(nonzerosa))
129 if (.not. (
allocated(ia_int8) .and.
130 +
allocated(ja_int8) .and.
131 +
allocated(ia) .and.
132 +
allocated(ja) .and.
133 +
allocated(a) ))
then 134 call mexerrmsgidandtxt (
'MATLAB:dgetSchur:BadAllocation',
135 +
'The allocation of variables was unsuccesfull.')
139 call mxcopyptrtointeger8(
140 + mxgetjc(prhs(1)), ia_int8, sizean+1 )
141 call mxcopyptrtointeger8(
142 + mxgetir(prhs(1)), ja_int8, nonzerosa )
143 call mxcopyptrtoreal8( mxgetpr(prhs(1)), a, nonzerosa )
145 ia = int(ia_int8, 4) + 1
146 ja = int(ja_int8, 4) + 1
154 call mxcopyptrtointeger4( mxgetpr(prhs(2)), sizes, ndim )
162 CALL getschur(int(sizeam, 4), a, ia, ja,
163 + sizes, s, is, js, mtype)
172 write(line,*) new_line(
'A')
173 tmp = mexprintf(line)
174 write(line,*)
'The Calculated Schur complement:', new_line(
'A')
175 tmp = mexprintf(line)
178 if (j >= is(i+1))
then 182 if (j < is(i+1))
then 183 write(line,*)
'row', i,
'col', js(j),
184 +
'element of S = ', s(j), new_line(
'A')
185 tmp = mexprintf(line)
192 ALLOCATE(s_full(sizes, sizes))
196 if (j >= is(i+1))
then 200 if (j < is(i+1))
then 202 s_full(js(j), i) = s(j)
207 plhs(1) = mxcreatedoublematrix(ndim, ndim,
209 mxs_full = mxgetpr(plhs(1))
210 call mxcopyreal8toptr(s_full, mxs_full,ndim*ndim)
217 if (
allocated(is) )
then 221 if (
allocated(js) )
then 225 if (
allocated(s) )
then 229 if (
allocated(s_full) )
then subroutine mexfunction(nlhs, plhs, nrhs, prhs)