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