xref: /petsc/src/mat/interface/ftn-custom/zmatrixf.c (revision 79ab67a34e24ffe79d2fdfccb4206de89a5e4b2d)
1 #include <petsc/private/fortranimpl.h>
2 #include <petsc/private/f90impl.h>
3 #include <petscmat.h>
4 #include <petscviewer.h>
5 
6 #if defined(PETSC_HAVE_FORTRAN_CAPS)
7   #define matgetvalues_                MATGETVALUES
8   #define matgetvalues0_               MATGETVALUES0
9   #define matgetvaluesnn1_             MATGETVALUESnn1
10   #define matgetvaluesnnnn_            MATGETVALUESnnnn
11   #define matgetvalues11_              MATGETVALUES11
12   #define matgetvalues11a_             MATGETVALUES11A
13   #define matgetvalues1n_              MATGETVALUES1N
14   #define matgetvaluesn1_              MATGETVALUESN1
15   #define matgetvalueslocal_           MATGETVALUESLOCAL
16   #define matgetvalueslocal0_          MATGETVALUESLOCAL0
17   #define matgetvalueslocalnn1_        MATGETVALUESLOCALNN1
18   #define matgetvalueslocalnnnn_       MATGETVALUESLOCALNNNN
19   #define matgetvalueslocal11_         MATGETVALUESLOCAL11
20   #define matgetvalueslocal11a_        MATGETVALUESLOCAL11A
21   #define matgetvalueslocal1n_         MATGETVALUESLOCAL1N
22   #define matgetvalueslocaln1_         MATGETVALUESLOCALN1
23   #define matsetvalues_                MATSETVALUES
24   #define matsetvaluesnnnn_            MATSETVALUESNNNN
25   #define matsetvalues0_               MATSETVALUES0
26   #define matsetvaluesnn1_             MATSETVALUESNN1
27   #define matsetvalues11_              MATSETVALUES11
28   #define matsetvalues1n_              MATSETVALUES1N
29   #define matsetvaluesn1_              MATSETVALUESN1
30   #define matsetvaluesblocked0_        MATSETVALUESBLOCKED0
31   #define matsetvaluesblocked2_        MATSETVALUESBLOCKED2
32   #define matsetvaluesblocked11_       MATSETVALUESBLOCKED11
33   #define matsetvaluesblocked111_      MATSETVALUESBLOCKED111
34   #define matsetvaluesblocked1n_       MATSETVALUESBLOCKED1N
35   #define matsetvaluesblockedn1_       MATSETVALUESBLOCKEDN1
36   #define matsetvaluesblockedlocal_    MATSETVALUESBLOCKEDLOCAL
37   #define matsetvaluesblockedlocal0_   MATSETVALUESBLOCKEDLOCAL0
38   #define matsetvaluesblockedlocal11_  MATSETVALUESBLOCKEDLOCAL11
39   #define matsetvaluesblockedlocal111_ MATSETVALUESBLOCKEDLOCAL111
40   #define matsetvaluesblockedlocal1n_  MATSETVALUESBLOCKEDLOCAL1N
41   #define matsetvaluesblockedlocaln1_  MATSETVALUESBLOCKEDLOCALN1
42   #define matsetvalueslocal_           MATSETVALUESLOCAL
43   #define matsetvalueslocal0_          MATSETVALUESLOCAL0
44   #define matsetvalueslocal11_         MATSETVALUESLOCAL11
45   #define matsetvalueslocal11nn_       MATSETVALUESLOCAL11NN
46   #define matsetvalueslocal111_        MATSETVALUESLOCAL111
47   #define matsetvalueslocal1n_         MATSETVALUESLOCAL1N
48   #define matsetvalueslocaln1_         MATSETVALUESLOCALN1
49   #define matdestroymatrices_          MATDESTROYMATRICES
50   #define matdestroysubmatrices_       MATDESTROYSUBMATRICES
51   #define matfactorgetsolverpackage_   MATFACTORGETSOLVERPACKAGE
52   #define matgetrowij_                 MATGETROWIJ
53   #define matrestorerowij_             MATRESTOREROWIJ
54   #define matgetrow_                   MATGETROW
55   #define matrestorerow_               MATRESTOREROW
56   #define matseqaijgetarray_           MATSEQAIJGETARRAY
57   #define matseqaijrestorearray_       MATSEQAIJRESTOREARRAY
58   #define matdensegetarray_            MATDENSEGETARRAY
59   #define matdensegetarrayread_        MATDENSEGETARRAYREAD
60   #define matdenserestorearray_        MATDENSERESTOREARRAY
61   #define matdenserestorearrayread_    MATDENSERESTOREARRAYREAD
62   #define matcreatesubmatrices_        MATCREATESUBMATRICES
63   #define matcreatesubmatricesmpi_     MATCREATESUBMATRICESMPI
64   #define matzerorowscolumns_          MATZEROROWSCOLUMNS
65   #define matzerorowscolumnsis_        MATZEROROWSCOLUMNSIS
66   #define matzerorowsstencil_          MATZEROROWSSTENCIL
67   #define matzerorowscolumnsstencil_   MATZEROROWSCOLUMNSSTENCIL
68   #define matzerorows_                 MATZEROROWS
69   #define matzerorowsis_               MATZEROROWSIS
70   #define matzerorowslocal_            MATZEROROWSLOCAL
71   #define matzerorowslocal0_           MATZEROROWSLOCAL0
72   #define matzerorowslocal1_           MATZEROROWSLOCAL1
73   #define matzerorowslocalis_          MATZEROROWSLOCALIS
74   #define matzerorowscolumnslocal_     MATZEROROWSCOLUMNSLOCAL
75   #define matzerorowscolumnslocalis_   MATZEROROWSCOLUMNSLOCALIS
76   #define matcreatevecs_               MATCREATEVECS
77   #define matnullspaceremove_          MATNULLSPACEREMOVE
78   #define matgetinfo_                  MATGETINFO
79   #define matlufactor_                 MATLUFACTOR
80   #define matilufactor_                MATILUFACTOR
81   #define matlufactorsymbolic_         MATLUFACTORSYMBOLIC
82   #define matlufactornumeric_          MATLUFACTORNUMERIC
83   #define matcholeskyfactor_           MATCHOLESKYFACTOR
84   #define matcholeskyfactorsymbolic_   MATCHOLESKYFACTORSYMBOLIC
85   #define matcholeskyfactornumeric_    MATCHOLESKYFACTORNUMERIC
86   #define matilufactorsymbolic_        MATILUFACTORSYMBOLIC
87   #define maticcfactorsymbolic_        MATICCFACTORSYMBOLIC
88   #define maticcfactor_                MATICCFACTOR
89   #define matfactorinfoinitialize_     MATFACTORINFOINITIALIZE
90   #define matnullspacesetfunction_     MATNULLSPACESETFUNCTION
91   #define matfindnonzerorows_          MATFINDNONZEROROWS
92   #define matgetsize_                  MATGETSIZE
93   #define matgetsize00_                MATGETSIZE00
94   #define matgetsize10_                MATGETSIZE10
95   #define matgetsize01_                MATGETSIZE01
96   #define matgetlocalsize_             MATGETLOCALSIZE
97   #define matgetlocalsize00_           MATGETLOCALSIZE00
98   #define matgetlocalsize10_           MATGETLOCALSIZE10
99   #define matgetlocalsize01_           MATGETLOCALSIZE01
100   #define matsetnullspace_             MATSETNULLSPACE
101   #define matgetownershiprange_        MATGETOWNERSHIPRANGE
102   #define matgetownershiprange00_      MATGETOWNERSHIPRANGE00
103   #define matgetownershiprange10_      MATGETOWNERSHIPRANGE10
104   #define matgetownershiprange01_      MATGETOWNERSHIPRANGE01
105   #define matgetownershiprange11_      MATGETOWNERSHIPRANGE11
106   #define matgetownershipis_           MATGETOWNERSHIPIS
107   #define matdestroy_                  MATDESTROY
108 #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
109   #define matsetvalues_                matsetvalues
110   #define matsetvaluesnnnn_            matsetvaluesnnnn
111   #define matsetvalues0_               matsetvalues0
112   #define matsetvaluesnn1_             matsetvaluesnn1
113   #define matsetvalues11_              matsetvalues11
114   #define matsetvaluesn1_              matsetvaluesn1
115   #define matsetvalues1n_              matsetvalues1n
116   #define matsetvalueslocal_           matsetvalueslocal
117   #define matsetvalueslocal0_          matsetvalueslocal0
118   #define matsetvalueslocal11_         matsetvalueslocal11
119   #define matsetvalueslocal11nn_       matsetvalueslocal11nn
120   #define matsetvalueslocal111_        matsetvalueslocal111
121   #define matsetvalueslocal1n_         matsetvalueslocal1n
122   #define matsetvalueslocaln1_         matsetvalueslocaln1
123   #define matsetvaluesblocked_         matsetvaluesblocked
124   #define matsetvaluesblocked0_        matsetvaluesblocked0
125   #define matsetvaluesblocked2_        matsetvaluesblocked2
126   #define matsetvaluesblocked11_       matsetvaluesblocked11
127   #define matsetvaluesblocked111_      matsetvaluesblocked111
128   #define matsetvaluesblocked1n_       matsetvaluesblocked1n
129   #define matsetvaluesblockedn1_       matsetvaluesblockedn1
130   #define matsetvaluesblockedlocal_    matsetvaluesblockedlocal
131   #define matsetvaluesblockedlocal0_   matsetvaluesblockedlocal0
132   #define matsetvaluesblockedlocal11_  matsetvaluesblockedlocal11
133   #define matsetvaluesblockedlocal111_ matsetvaluesblockedlocal111
134   #define matsetvaluesblockedlocal1n_  matsetvaluesblockedlocal1n
135   #define matsetvaluesblockedlocaln1_  matsetvaluesblockedlocaln1
136   #define matdestroymatrices_          matdestroymatrices
137   #define matdestroysubmatrices_       matdestroysubmatrices
138   #define matfactorgetsolverpackage_   matfactorgetsolverpackage
139   #define matcreatevecs_               matcreatevecs
140   #define matgetrowij_                 matgetrowij
141   #define matrestorerowij_             matrestorerowij
142   #define matgetrow_                   matgetrow
143   #define matrestorerow_               matrestorerow
144   #define matseqaijgetarray_           matseqaijgetarray
145   #define matseqaijrestorearray_       matseqaijrestorearray
146   #define matdensegetarray_            matdensegetarray
147   #define matdensegetarrayread_        matdensegetarrayread
148   #define matdenserestorearray_        matdenserestorearray
149   #define matdenserestorearrayread_    matdenserestorearrayread
150   #define matcreatesubmatrices_        matcreatesubmatrices
151   #define matcreatesubmatricesmpi_     matcreatesubmatricesmpi
152   #define matzerorowscolumns_          matzerorowscolumns
153   #define matzerorowscolumnsis_        matzerorowscolumnsis
154   #define matzerorowsstencil_          matzerorowsstencil
155   #define matzerorowscolumnsstencil_   matzerorowscolumnsstencil
156   #define matzerorows_                 matzerorows
157   #define matzerorowsis_               matzerorowsis
158   #define matzerorowslocal_            matzerorowslocal
159   #define matzerorowslocalis_          matzerorowslocalis
160   #define matzerorowscolumnslocal_     matzerorowscolumnslocal
161   #define matzerorowscolumnslocalis_   matzerorowscolumnslocalis
162   #define matnullspaceremove_          matnullspaceremove
163   #define matgetinfo_                  matgetinfo
164   #define matlufactor_                 matlufactor
165   #define matilufactor_                matilufactor
166   #define matlufactorsymbolic_         matlufactorsymbolic
167   #define matlufactornumeric_          matlufactornumeric
168   #define matcholeskyfactor_           matcholeskyfactor
169   #define matcholeskyfactorsymbolic_   matcholeskyfactorsymbolic
170   #define matcholeskyfactornumeric_    matcholeskyfactornumeric
171   #define matilufactorsymbolic_        matilufactorsymbolic
172   #define maticcfactorsymbolic_        maticcfactorsymbolic
173   #define maticcfactor_                maticcfactor
174   #define matfactorinfoinitialize_     matfactorinfoinitialize
175   #define matnullspacesetfunction_     matnullspacesetfunction
176   #define matfindnonzerorows_          matfindnonzerorows
177   #define matgetsize_                  matgetsize
178   #define matgetsize00_                matgetsize00
179   #define matgetsize10_                matgetsize10
180   #define matgetsize01_                matgetsize01
181   #define matgetlocalsize_             matgetlocalsize
182   #define matgetlocalsize00_           matgetlocalsize00
183   #define matgetlocalsize10_           matgetlocalsize10
184   #define matgetlocalsize01_           matgetlocalsize01
185   #define matgetvalues_                matgetvalues
186   #define matgetvalues0_               matgetvalues0
187   #define matgetvaluesnn1_             matgetvaluesnn1
188   #define matgetvaluesnnnn_            matgetvaluesnnnn
189   #define matgetvalues11_              matgetvalues11
190   #define matgetvalues11a_             matgetvalues11a
191   #define matgetvalues1n_              matgetvalues1n
192   #define matgetvaluesn1_              matgetvaluesn1
193   #define matgetvalueslocal_           matgetvalueslocal
194   #define matgetvalueslocal0_          matgetvalueslocal0
195   #define matgetvalueslocalnn1_        matgetvalueslocalnn1
196   #define matgetvalueslocalnnnn_       matgetvalueslocalnnnn
197   #define matgetvalueslocal11_         matgetvalueslocal11
198   #define matgetvalueslocal1n_         matgetvalueslocal1n
199   #define matgetvalueslocaln1_         matgetvalueslocaln1
200   #define matsetnullspace_             matsetnullspace
201   #define matgetownershiprange_        matgetownershiprange
202   #define matgetownershiprange00_      matgetownershiprange00
203   #define matgetownershiprange10_      matgetownershiprange10
204   #define matgetownershiprange01_      matgetownershiprange01
205   #define matgetownershiprange11_      matgetownershiprange11
206   #define matgetownershipis_           matgetownershipis
207   #define matdestroy_                  matdestroy
208 #endif
209 
210 PETSC_EXTERN void matgetvalues_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
211 {
212   *ierr = MatGetValues(*mat, *m, idxm, *n, idxn, v);
213 }
214 
215 PETSC_EXTERN void matgetvalues0_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
216 {
217   matgetvalues_(mat, m, idxm, n, idxn, v, ierr);
218 }
219 
220 PETSC_EXTERN void matgetvaluesnn1_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
221 {
222   matgetvalues_(mat, m, idxm, n, idxn, v, ierr);
223 }
224 
225 PETSC_EXTERN void matgetvaluesnnnn_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
226 {
227   matgetvalues_(mat, m, idxm, n, idxn, v, ierr);
228 }
229 
230 PETSC_EXTERN void matgetvalues11_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
231 {
232   matgetvalues_(mat, m, idxm, n, idxn, v, ierr);
233 }
234 
235 PETSC_EXTERN void matgetvalues11a_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
236 {
237   matgetvalues_(mat, m, idxm, n, idxn, v, ierr);
238 }
239 
240 PETSC_EXTERN void matgetvalues1n_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
241 {
242   matgetvalues_(mat, m, idxm, n, idxn, v, ierr);
243 }
244 
245 PETSC_EXTERN void matgetvaluesn1_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
246 {
247   matgetvalues_(mat, m, idxm, n, idxn, v, ierr);
248 }
249 
250 PETSC_EXTERN void matgetvalueslocal_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
251 {
252   *ierr = MatGetValuesLocal(*mat, *m, idxm, *n, idxn, v);
253 }
254 
255 PETSC_EXTERN void matgetvalueslocal0_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
256 {
257   matgetvalueslocal_(mat, m, idxm, n, idxn, v, ierr);
258 }
259 
260 PETSC_EXTERN void matgetvalueslocalnn1_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
261 {
262   matgetvalueslocal_(mat, m, idxm, n, idxn, v, ierr);
263 }
264 
265 PETSC_EXTERN void matgetvalueslocalnnnn_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
266 {
267   matgetvalueslocal_(mat, m, idxm, n, idxn, v, ierr);
268 }
269 
270 PETSC_EXTERN void matgetvalueslocal11_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
271 {
272   matgetvalueslocal_(mat, m, idxm, n, idxn, v, ierr);
273 }
274 
275 PETSC_EXTERN void matgetvalueslocal11a_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
276 {
277   matgetvalueslocal_(mat, m, idxm, n, idxn, v, ierr);
278 }
279 
280 PETSC_EXTERN void matgetvalueslocal1n_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
281 {
282   matgetvalueslocal_(mat, m, idxm, n, idxn, v, ierr);
283 }
284 
285 PETSC_EXTERN void matgetvalueslocaln1_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], int *ierr)
286 {
287   matgetvalueslocal_(mat, m, idxm, n, idxn, v, ierr);
288 }
289 
290 PETSC_EXTERN void matgetownershiprange_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
291 {
292   CHKFORTRANNULLINTEGER(m);
293   CHKFORTRANNULLINTEGER(n);
294   *ierr = MatGetOwnershipRange(*mat, m, n);
295 }
296 
297 PETSC_EXTERN void matgetownershiprange00_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
298 {
299   CHKFORTRANNULLINTEGER(m);
300   CHKFORTRANNULLINTEGER(n);
301   *ierr = MatGetOwnershipRange(*mat, m, n);
302 }
303 
304 PETSC_EXTERN void matgetownershiprange10_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
305 {
306   CHKFORTRANNULLINTEGER(m);
307   CHKFORTRANNULLINTEGER(n);
308   *ierr = MatGetOwnershipRange(*mat, m, n);
309 }
310 
311 PETSC_EXTERN void matgetownershiprange01_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
312 {
313   CHKFORTRANNULLINTEGER(m);
314   CHKFORTRANNULLINTEGER(n);
315   *ierr = MatGetOwnershipRange(*mat, m, n);
316 }
317 
318 PETSC_EXTERN void matgetownershiprange11_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
319 {
320   CHKFORTRANNULLINTEGER(m);
321   CHKFORTRANNULLINTEGER(n);
322   *ierr = MatGetOwnershipRange(*mat, m, n);
323 }
324 
325 PETSC_EXTERN void matgetownershipis_(Mat *mat, IS *m, IS *n, int *ierr)
326 {
327   CHKFORTRANNULLOBJECT(m);
328   CHKFORTRANNULLOBJECT(n);
329   *ierr = MatGetOwnershipIS(*mat, m, n);
330 }
331 
332 PETSC_EXTERN void matgetsize_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
333 {
334   CHKFORTRANNULLINTEGER(m);
335   CHKFORTRANNULLINTEGER(n);
336   *ierr = MatGetSize(*mat, m, n);
337 }
338 
339 PETSC_EXTERN void matgetsize00_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
340 {
341   matgetsize_(mat, m, n, ierr);
342 }
343 
344 PETSC_EXTERN void matgetsize10_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
345 {
346   matgetsize_(mat, m, n, ierr);
347 }
348 
349 PETSC_EXTERN void matgetsize01_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
350 {
351   matgetsize_(mat, m, n, ierr);
352 }
353 
354 PETSC_EXTERN void matgetlocalsize_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
355 {
356   CHKFORTRANNULLINTEGER(m);
357   CHKFORTRANNULLINTEGER(n);
358   *ierr = MatGetLocalSize(*mat, m, n);
359 }
360 
361 PETSC_EXTERN void matgetlocalsize00_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
362 {
363   matgetlocalsize_(mat, m, n, ierr);
364 }
365 
366 PETSC_EXTERN void matgetlocalsize10_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
367 {
368   matgetlocalsize_(mat, m, n, ierr);
369 }
370 
371 PETSC_EXTERN void matgetlocalsize01_(Mat *mat, PetscInt *m, PetscInt *n, int *ierr)
372 {
373   matgetlocalsize_(mat, m, n, ierr);
374 }
375 
376 PETSC_EXTERN void matsetvaluesblocked_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
377 {
378   *ierr = MatSetValuesBlocked(*mat, *m, idxm, *n, idxn, v, *addv);
379 }
380 
381 PETSC_EXTERN void matsetvaluesblocked2_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], F90Array2d *y, InsertMode *addv, int *ierr PETSC_F90_2PTR_PROTO(ptrd))
382 {
383   PetscScalar *fa;
384   *ierr = F90Array2dAccess(y, MPIU_SCALAR, (void **)&fa PETSC_F90_2PTR_PARAM(ptrd));
385   if (*ierr) return;
386   matsetvaluesblocked_(mat, m, idxm, n, idxn, fa, addv, ierr);
387 }
388 
389 PETSC_EXTERN void matsetvaluesblocked0_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
390 {
391   matsetvaluesblocked_(mat, m, idxm, n, idxn, v, addv, ierr);
392 }
393 
394 PETSC_EXTERN void matsetvaluesblocked11_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
395 {
396   matsetvaluesblocked_(mat, m, idxm, n, idxn, v, addv, ierr);
397 }
398 
399 PETSC_EXTERN void matsetvaluesblocked111_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
400 {
401   matsetvaluesblocked_(mat, m, idxm, n, idxn, v, addv, ierr);
402 }
403 
404 PETSC_EXTERN void matsetvaluesblocked1n_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
405 {
406   matsetvaluesblocked_(mat, m, idxm, n, idxn, v, addv, ierr);
407 }
408 
409 PETSC_EXTERN void matsetvaluesblockedn1_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
410 {
411   matsetvaluesblocked_(mat, m, idxm, n, idxn, v, addv, ierr);
412 }
413 
414 PETSC_EXTERN void matsetvaluesblockedlocal_(Mat *mat, PetscInt *nrow, PetscInt irow[], PetscInt *ncol, PetscInt icol[], PetscScalar y[], InsertMode *addv, int *ierr)
415 {
416   *ierr = MatSetValuesBlockedLocal(*mat, *nrow, irow, *ncol, icol, y, *addv);
417 }
418 
419 PETSC_EXTERN void matsetvaluesblockedlocal0_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
420 {
421   matsetvaluesblockedlocal_(mat, m, idxm, n, idxn, v, addv, ierr);
422 }
423 
424 PETSC_EXTERN void matsetvaluesblockedlocal11_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
425 {
426   matsetvaluesblockedlocal_(mat, m, idxm, n, idxn, v, addv, ierr);
427 }
428 
429 PETSC_EXTERN void matsetvaluesblockedlocal111_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
430 {
431   matsetvaluesblockedlocal_(mat, m, idxm, n, idxn, v, addv, ierr);
432 }
433 
434 PETSC_EXTERN void matsetvaluesblockedlocal1n_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
435 {
436   matsetvaluesblockedlocal_(mat, m, idxm, n, idxn, v, addv, ierr);
437 }
438 
439 PETSC_EXTERN void matsetvaluesblockedlocaln1_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
440 {
441   matsetvaluesblockedlocal_(mat, m, idxm, n, idxn, v, addv, ierr);
442 }
443 
444 PETSC_EXTERN void matsetvalues_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
445 {
446   *ierr = MatSetValues(*mat, *m, idxm, *n, idxn, v, *addv);
447 }
448 
449 PETSC_EXTERN void matsetvaluesnnnn_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
450 {
451   matsetvalues_(mat, m, idxm, n, idxn, v, addv, ierr);
452 }
453 
454 PETSC_EXTERN void matsetvalues0_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
455 {
456   matsetvalues_(mat, m, idxm, n, idxn, v, addv, ierr);
457 }
458 
459 PETSC_EXTERN void matsetvaluesnn1_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
460 {
461   matsetvalues_(mat, m, idxm, n, idxn, v, addv, ierr);
462 }
463 
464 PETSC_EXTERN void matsetvalues11_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
465 {
466   matsetvalues_(mat, m, idxm, n, idxn, v, addv, ierr);
467 }
468 
469 PETSC_EXTERN void matsetvaluesn1_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
470 {
471   matsetvalues_(mat, m, idxm, n, idxn, v, addv, ierr);
472 }
473 
474 PETSC_EXTERN void matsetvalues1n_(Mat *mat, PetscInt *m, PetscInt idxm[], PetscInt *n, PetscInt idxn[], PetscScalar v[], InsertMode *addv, int *ierr)
475 {
476   matsetvalues_(mat, m, idxm, n, idxn, v, addv, ierr);
477 }
478 
479 PETSC_EXTERN void matsetvalueslocal_(Mat *mat, PetscInt *nrow, PetscInt irow[], PetscInt *ncol, PetscInt icol[], PetscScalar y[], InsertMode *addv, int *ierr)
480 {
481   *ierr = MatSetValuesLocal(*mat, *nrow, irow, *ncol, icol, y, *addv);
482 }
483 
484 PETSC_EXTERN void matsetvalueslocal0_(Mat *mat, PetscInt *nrow, PetscInt irow[], PetscInt *ncol, PetscInt icol[], PetscScalar y[], InsertMode *addv, int *ierr)
485 {
486   matsetvalueslocal_(mat, nrow, irow, ncol, icol, y, addv, ierr);
487 }
488 
489 PETSC_EXTERN void matsetvalueslocal11_(Mat *mat, PetscInt *nrow, PetscInt irow[], PetscInt *ncol, PetscInt icol[], PetscScalar y[], InsertMode *addv, int *ierr)
490 {
491   matsetvalueslocal_(mat, nrow, irow, ncol, icol, y, addv, ierr);
492 }
493 
494 PETSC_EXTERN void matsetvalueslocal11nn_(Mat *mat, PetscInt *nrow, PetscInt irow[], PetscInt *ncol, PetscInt icol[], PetscScalar y[], InsertMode *addv, int *ierr)
495 {
496   matsetvalueslocal_(mat, nrow, irow, ncol, icol, y, addv, ierr);
497 }
498 
499 PETSC_EXTERN void matsetvalueslocal111_(Mat *mat, PetscInt *nrow, PetscInt irow[], PetscInt *ncol, PetscInt icol[], PetscScalar y[], InsertMode *addv, int *ierr)
500 {
501   matsetvalueslocal_(mat, nrow, irow, ncol, icol, y, addv, ierr);
502 }
503 
504 PETSC_EXTERN void matsetvalueslocal1n_(Mat *mat, PetscInt *nrow, PetscInt irow[], PetscInt *ncol, PetscInt icol[], PetscScalar y[], InsertMode *addv, int *ierr)
505 {
506   matsetvalueslocal_(mat, nrow, irow, ncol, icol, y, addv, ierr);
507 }
508 
509 PETSC_EXTERN void matsetvalueslocaln1_(Mat *mat, PetscInt *nrow, PetscInt irow[], PetscInt *ncol, PetscInt icol[], PetscScalar y[], InsertMode *addv, int *ierr)
510 {
511   matsetvalueslocal_(mat, nrow, irow, ncol, icol, y, addv, ierr);
512 }
513 
514 static PetscErrorCode ournullfunction(MatNullSpace sp, Vec x, void *ctx)
515 {
516   PetscCallFortranVoidFunction((*(void (*)(MatNullSpace *, Vec *, void *, PetscErrorCode *))(((PetscObject)sp)->fortran_func_pointers[0]))(&sp, &x, ctx, &ierr));
517   return PETSC_SUCCESS;
518 }
519 
520 PETSC_EXTERN void matnullspacesetfunction_(MatNullSpace *sp, PetscErrorCode (*rem)(MatNullSpace, Vec, void *), void *ctx, PetscErrorCode *ierr)
521 {
522   PetscObjectAllocateFortranPointers(*sp, 1);
523   ((PetscObject)*sp)->fortran_func_pointers[0] = (PetscVoidFn *)rem;
524 
525   *ierr = MatNullSpaceSetFunction(*sp, ournullfunction, ctx);
526 }
527 
528 PETSC_EXTERN void matcreatevecs_(Mat *mat, Vec *right, Vec *left, int *ierr)
529 {
530   CHKFORTRANNULLOBJECT(right);
531   CHKFORTRANNULLOBJECT(left);
532   *ierr = MatCreateVecs(*mat, right, left);
533 }
534 
535 PETSC_EXTERN void matgetrowij_(Mat *B, PetscInt *shift, PetscBool *sym, PetscBool *blockcompressed, PetscInt *n, PetscInt *ia, size_t *iia, PetscInt *ja, size_t *jja, PetscBool *done, PetscErrorCode *ierr)
536 {
537   const PetscInt *IA, *JA;
538   *ierr = MatGetRowIJ(*B, *shift, *sym, *blockcompressed, n, &IA, &JA, done);
539   if (*ierr) return;
540   *iia = PetscIntAddressToFortran(ia, (PetscInt *)IA);
541   *jja = PetscIntAddressToFortran(ja, (PetscInt *)JA);
542 }
543 
544 PETSC_EXTERN void matrestorerowij_(Mat *B, PetscInt *shift, PetscBool *sym, PetscBool *blockcompressed, PetscInt *n, PetscInt *ia, size_t *iia, PetscInt *ja, size_t *jja, PetscBool *done, PetscErrorCode *ierr)
545 {
546   const PetscInt *IA = PetscIntAddressFromFortran(ia, *iia), *JA = PetscIntAddressFromFortran(ja, *jja);
547   *ierr = MatRestoreRowIJ(*B, *shift, *sym, *blockcompressed, n, &IA, &JA, done);
548 }
549 
550 /*
551    This is a poor way of storing the column and value pointers
552   generated by MatGetRow() to be returned with MatRestoreRow()
553   but there is not natural,good place else to store them. Hence
554   Fortran programmers can only have one outstanding MatGetRows()
555   at a time.
556 */
557 static int                matgetrowactive = 0;
558 static const PetscInt    *my_ocols        = NULL;
559 static const PetscScalar *my_ovals        = NULL;
560 
561 PETSC_EXTERN void matgetrow_(Mat *mat, PetscInt *row, PetscInt *ncols, PetscInt *cols, PetscScalar *vals, PetscErrorCode *ierr)
562 {
563   const PetscInt    **oocols = &my_ocols;
564   const PetscScalar **oovals = &my_ovals;
565 
566   if (matgetrowactive) {
567     *ierr = PetscError(PETSC_COMM_SELF, __LINE__, "MatGetRow_Fortran", __FILE__, PETSC_ERR_ARG_WRONGSTATE, PETSC_ERROR_INITIAL, "Cannot have two MatGetRow() active simultaneously\n\
568                call MatRestoreRow() before calling MatGetRow() a second time");
569     *ierr = PETSC_ERR_ARG_WRONGSTATE;
570     return;
571   }
572 
573   CHKFORTRANNULLINTEGER(cols);
574   if (!cols) oocols = NULL;
575   CHKFORTRANNULLSCALAR(vals);
576   if (!vals) oovals = NULL;
577 
578   *ierr = MatGetRow(*mat, *row, ncols, oocols, oovals);
579   if (*ierr) return;
580 
581   if (oocols) {
582     *ierr = PetscArraycpy(cols, my_ocols, *ncols);
583     if (*ierr) return;
584   }
585   if (oovals) {
586     *ierr = PetscArraycpy(vals, my_ovals, *ncols);
587     if (*ierr) return;
588   }
589   matgetrowactive = 1;
590 }
591 
592 PETSC_EXTERN void matrestorerow_(Mat *mat, PetscInt *row, PetscInt *ncols, PetscInt *cols, PetscScalar *vals, PetscErrorCode *ierr)
593 {
594   const PetscInt    **oocols = &my_ocols;
595   const PetscScalar **oovals = &my_ovals;
596 
597   if (!matgetrowactive) {
598     *ierr = PetscError(PETSC_COMM_SELF, __LINE__, "MatRestoreRow_Fortran", __FILE__, PETSC_ERR_ARG_WRONGSTATE, PETSC_ERROR_INITIAL, "Must call MatGetRow() first");
599     *ierr = PETSC_ERR_ARG_WRONGSTATE;
600     return;
601   }
602   CHKFORTRANNULLINTEGER(cols);
603   if (!cols) oocols = NULL;
604   CHKFORTRANNULLSCALAR(vals);
605   if (!vals) oovals = NULL;
606 
607   *ierr           = MatRestoreRow(*mat, *row, ncols, oocols, oovals);
608   matgetrowactive = 0;
609 }
610 
611 PETSC_EXTERN void matseqaijgetarray_(Mat *mat, PetscScalar *fa, size_t *ia, PetscErrorCode *ierr)
612 {
613   PetscScalar *mm;
614   PetscInt     m, n;
615 
616   *ierr = MatSeqAIJGetArray(*mat, &mm);
617   if (*ierr) return;
618   *ierr = MatGetSize(*mat, &m, &n);
619   if (*ierr) return;
620   *ierr = PetscScalarAddressToFortran((PetscObject)*mat, 1, fa, mm, m * n, ia);
621   if (*ierr) return;
622 }
623 
624 PETSC_EXTERN void matseqaijrestorearray_(Mat *mat, PetscScalar *fa, size_t *ia, PetscErrorCode *ierr)
625 {
626   PetscScalar *lx;
627   PetscInt     m, n;
628 
629   *ierr = MatGetSize(*mat, &m, &n);
630   if (*ierr) return;
631   *ierr = PetscScalarAddressFromFortran((PetscObject)*mat, fa, *ia, m * n, &lx);
632   if (*ierr) return;
633   *ierr = MatSeqAIJRestoreArray(*mat, &lx);
634   if (*ierr) return;
635 }
636 
637 PETSC_EXTERN void matdensegetarray_(Mat *mat, PetscScalar *fa, size_t *ia, PetscErrorCode *ierr)
638 {
639   PetscScalar *mm;
640   PetscInt     m, n;
641 
642   *ierr = MatDenseGetArray(*mat, &mm);
643   if (*ierr) return;
644   *ierr = MatGetSize(*mat, &m, &n);
645   if (*ierr) return;
646   *ierr = PetscScalarAddressToFortran((PetscObject)*mat, 1, fa, mm, m * n, ia);
647   if (*ierr) return;
648 }
649 
650 PETSC_EXTERN void matdenserestorearray_(Mat *mat, PetscScalar *fa, size_t *ia, PetscErrorCode *ierr)
651 {
652   PetscScalar *lx;
653   PetscInt     m, n;
654 
655   *ierr = MatGetSize(*mat, &m, &n);
656   if (*ierr) return;
657   *ierr = PetscScalarAddressFromFortran((PetscObject)*mat, fa, *ia, m * n, &lx);
658   if (*ierr) return;
659   *ierr = MatDenseRestoreArray(*mat, &lx);
660   if (*ierr) return;
661 }
662 
663 PETSC_EXTERN void matdensegetarrayread_(Mat *mat, PetscScalar *fa, size_t *ia, PetscErrorCode *ierr)
664 {
665   const PetscScalar *mm;
666   PetscInt           m, n;
667 
668   *ierr = MatDenseGetArrayRead(*mat, &mm);
669   if (*ierr) return;
670   *ierr = MatGetSize(*mat, &m, &n);
671   if (*ierr) return;
672   *ierr = PetscScalarAddressToFortran((PetscObject)*mat, 1, fa, (PetscScalar *)mm, m * n, ia);
673   if (*ierr) return;
674 }
675 
676 PETSC_EXTERN void matdenserestorearrayread_(Mat *mat, PetscScalar *fa, size_t *ia, PetscErrorCode *ierr)
677 {
678   const PetscScalar *lx;
679   PetscInt           m, n;
680 
681   *ierr = MatGetSize(*mat, &m, &n);
682   if (*ierr) return;
683   *ierr = PetscScalarAddressFromFortran((PetscObject)*mat, fa, *ia, m * n, (PetscScalar **)&lx);
684   if (*ierr) return;
685   *ierr = MatDenseRestoreArrayRead(*mat, &lx);
686   if (*ierr) return;
687 }
688 
689 PETSC_EXTERN void matfactorgetsolverpackage_(Mat *mat, char *name, PetscErrorCode *ierr, PETSC_FORTRAN_CHARLEN_T len)
690 {
691   const char *tname;
692 
693   *ierr = MatFactorGetSolverType(*mat, &tname);
694   if (*ierr) return;
695   if (name != PETSC_NULL_CHARACTER_Fortran) {
696     *ierr = PetscStrncpy(name, tname, len);
697     if (*ierr) return;
698   }
699   FIXRETURNCHAR(PETSC_TRUE, name, len);
700 }
701 
702 /*
703     MatCreateSubmatrices() is slightly different from C since the
704     Fortran provides the array to hold the submatrix objects,while in C that
705     array is allocated by the MatCreateSubmatrices()
706 */
707 PETSC_EXTERN void matcreatesubmatrices_(Mat *mat, PetscInt *n, IS *isrow, IS *iscol, MatReuse *scall, Mat *smat, PetscErrorCode *ierr)
708 {
709   Mat     *lsmat;
710   PetscInt i;
711 
712   if (*scall == MAT_INITIAL_MATRIX) {
713     *ierr = MatCreateSubMatrices(*mat, *n, isrow, iscol, *scall, &lsmat);
714     for (i = 0; i <= *n; i++) { /* lsmat[*n] might be a dummy matrix for saving data structure */
715       smat[i] = lsmat[i];
716     }
717     *ierr = PetscFree(lsmat);
718   } else {
719     *ierr = MatCreateSubMatrices(*mat, *n, isrow, iscol, *scall, &smat);
720   }
721 }
722 
723 /*
724     MatCreateSubmatrices() is slightly different from C since the
725     Fortran provides the array to hold the submatrix objects,while in C that
726     array is allocated by the MatCreateSubmatrices()
727 */
728 PETSC_EXTERN void matcreatesubmatricesmpi_(Mat *mat, PetscInt *n, IS *isrow, IS *iscol, MatReuse *scall, Mat *smat, PetscErrorCode *ierr)
729 {
730   Mat     *lsmat;
731   PetscInt i;
732 
733   if (*scall == MAT_INITIAL_MATRIX) {
734     *ierr = MatCreateSubMatricesMPI(*mat, *n, isrow, iscol, *scall, &lsmat);
735     for (i = 0; i <= *n; i++) { /* lsmat[*n] might be a dummy matrix for saving data structure */
736       smat[i] = lsmat[i];
737     }
738     *ierr = PetscFree(lsmat);
739   } else {
740     *ierr = MatCreateSubMatricesMPI(*mat, *n, isrow, iscol, *scall, &smat);
741   }
742 }
743 
744 /*
745     MatDestroyMatrices() is slightly different from C since the
746     Fortran does not free the array of matrix objects, while in C that
747     the array is freed
748 */
749 PETSC_EXTERN void matdestroymatrices_(PetscInt *n, Mat *smat, PetscErrorCode *ierr)
750 {
751   PetscInt i;
752 
753   for (i = 0; i < *n; i++) {
754     PETSC_FORTRAN_OBJECT_F_DESTROYED_TO_C_NULL(&smat[i]);
755     *ierr = MatDestroy(&smat[i]);
756     if (*ierr) return;
757     PETSC_FORTRAN_OBJECT_C_NULL_TO_F_DESTROYED(&smat[i]);
758   }
759 }
760 
761 /*
762     MatDestroySubMatrices() is slightly different from C since the
763     Fortran provides the array to hold the submatrix objects, while in C that
764     array is allocated by the MatCreateSubmatrices()
765 */
766 PETSC_EXTERN void matdestroysubmatrices_(PetscInt *n, Mat *smat, PetscErrorCode *ierr)
767 {
768   Mat     *lsmat;
769   PetscInt i;
770 
771   *ierr = PetscMalloc1(*n + 1, &lsmat);
772   for (i = 0; i <= *n; i++) {
773     PETSC_FORTRAN_OBJECT_F_DESTROYED_TO_C_NULL(&smat[i]);
774     lsmat[i] = smat[i];
775   }
776   *ierr = MatDestroySubMatrices(*n, &lsmat);
777   for (i = 0; i <= *n; i++) { PETSC_FORTRAN_OBJECT_C_NULL_TO_F_DESTROYED(&smat[i]); }
778 }
779 
780 PETSC_EXTERN void matdestroy_(Mat *x, int *ierr)
781 {
782   PETSC_FORTRAN_OBJECT_F_DESTROYED_TO_C_NULL(x);
783   *ierr = MatDestroy(x);
784   if (*ierr) return;
785   PETSC_FORTRAN_OBJECT_C_NULL_TO_F_DESTROYED(x);
786 }
787 
788 PETSC_EXTERN void matnullspaceremove_(MatNullSpace *sp, Vec *vec, PetscErrorCode *ierr)
789 {
790   CHKFORTRANNULLOBJECT(*sp);
791   *ierr = MatNullSpaceRemove(*sp, *vec);
792 }
793 
794 PETSC_EXTERN void matgetinfo_(Mat *mat, MatInfoType *flag, MatInfo *info, int *ierr)
795 {
796   *ierr = MatGetInfo(*mat, *flag, info);
797 }
798 
799 PETSC_EXTERN void matlufactor_(Mat *mat, IS *row, IS *col, const MatFactorInfo *info, int *ierr)
800 {
801   CHKFORTRANNULLOBJECT(row);
802   CHKFORTRANNULLOBJECT(col);
803   *ierr = MatLUFactor(*mat, row ? *row : NULL, col ? *col : NULL, info);
804 }
805 
806 PETSC_EXTERN void matilufactor_(Mat *mat, IS *row, IS *col, const MatFactorInfo *info, int *ierr)
807 {
808   CHKFORTRANNULLOBJECT(row);
809   CHKFORTRANNULLOBJECT(col);
810   *ierr = MatILUFactor(*mat, row ? *row : NULL, col ? *col : NULL, info);
811 }
812 
813 PETSC_EXTERN void matlufactorsymbolic_(Mat *fact, Mat *mat, IS *row, IS *col, const MatFactorInfo *info, int *ierr)
814 {
815   CHKFORTRANNULLOBJECT(row);
816   CHKFORTRANNULLOBJECT(col);
817   *ierr = MatLUFactorSymbolic(*fact, *mat, row ? *row : NULL, col ? *col : NULL, info);
818 }
819 
820 PETSC_EXTERN void matlufactornumeric_(Mat *fact, Mat *mat, const MatFactorInfo *info, int *ierr)
821 {
822   *ierr = MatLUFactorNumeric(*fact, *mat, info);
823 }
824 
825 PETSC_EXTERN void matcholeskyfactor_(Mat *mat, IS *perm, const MatFactorInfo *info, int *ierr)
826 {
827   CHKFORTRANNULLOBJECT(perm);
828   *ierr = MatCholeskyFactor(*mat, perm ? *perm : NULL, info);
829 }
830 
831 PETSC_EXTERN void matcholeskyfactorsymbolic_(Mat *fact, Mat *mat, IS *perm, const MatFactorInfo *info, int *ierr)
832 {
833   CHKFORTRANNULLOBJECT(perm);
834   *ierr = MatCholeskyFactorSymbolic(*fact, *mat, perm ? *perm : NULL, info);
835 }
836 
837 PETSC_EXTERN void matcholeskyfactornumeric_(Mat *fact, Mat *mat, const MatFactorInfo *info, int *ierr)
838 {
839   *ierr = MatCholeskyFactorNumeric(*fact, *mat, info);
840 }
841 
842 PETSC_EXTERN void matilufactorsymbolic_(Mat *fact, Mat *mat, IS *row, IS *col, const MatFactorInfo *info, int *ierr)
843 {
844   CHKFORTRANNULLOBJECT(row);
845   CHKFORTRANNULLOBJECT(col);
846   *ierr = MatILUFactorSymbolic(*fact, *mat, row ? *row : NULL, col ? *col : NULL, info);
847 }
848 
849 PETSC_EXTERN void maticcfactorsymbolic_(Mat *fact, Mat *mat, IS *perm, const MatFactorInfo *info, int *ierr)
850 {
851   CHKFORTRANNULLOBJECT(perm);
852   *ierr = MatICCFactorSymbolic(*fact, *mat, perm ? *perm : NULL, info);
853 }
854 
855 PETSC_EXTERN void maticcfactor_(Mat *mat, IS *perm, const MatFactorInfo *info, int *ierr)
856 {
857   CHKFORTRANNULLOBJECT(perm);
858   *ierr = MatICCFactor(*mat, perm ? *perm : NULL, info);
859 }
860 
861 PETSC_EXTERN void matfactorinfoinitialize_(MatFactorInfo *info, int *ierr)
862 {
863   *ierr = MatFactorInfoInitialize(info);
864 }
865 PETSC_EXTERN void matzerorowslocal_(Mat *mat, PetscInt *numRows, PetscInt rows[], PetscScalar *diag, Vec *x, Vec *b, int *ierr)
866 {
867   *ierr = MatZeroRowsLocal(*mat, *numRows, rows, *diag, *x, *b);
868 }
869 PETSC_EXTERN void matzerorowslocal0_(Mat *mat, PetscInt *numRows, PetscInt rows[], PetscScalar *diag, Vec *x, Vec *b, int *ierr)
870 {
871   matzerorowslocal_(mat, numRows, rows, diag, x, b, ierr);
872 }
873 PETSC_EXTERN void matzerorowslocal1_(Mat *mat, PetscInt *numRows, PetscInt rows[], PetscScalar *diag, Vec *x, Vec *b, int *ierr)
874 {
875   matzerorowslocal_(mat, numRows, rows, diag, x, b, ierr);
876 }
877