[petsc-users] Mat.createNest in petsc4py

Matthew Knepley knepley at gmail.com
Fri Apr 4 12:29:04 CDT 2014


On Fri, Apr 4, 2014 at 12:27 PM, Amit Itagi <gcfrai at gmail.com> wrote:

> I need to use the createNest for some application. I am trying it out on a
> toy program. I created four 6x6 AIJ matrices on two processes. I am trying
> to create a nest using
>
> A=PETSc.Mat()
> A.createNest([mA11,mA12,mA21,mA22])
>

I have never run this using petsc4py, but if it were me I would make it
take a 2D array.

   Matt


> I get the following error:
>
>     A.createNest([mA11,mA12,mA21,mA22])
>   File "Mat.pyx", line 409, in petsc4py.PETSc.Mat.createNest
> (src/petsc4py.PETSc.c:85554)
>     A.createNest([mA11,mA12,mA21,mA22])
>   File "Mat.pyx", line 409, in petsc4py.PETSc.Mat.createNest
> (src/petsc4py.PETSc.c:85554)
>   File "Mat.pyx", line 197, in petsc4py.PETSc.Mat.__getitem__
> (src/petsc4py.PETSc.c:81516)
>   File "Mat.pyx", line 197, in petsc4py.PETSc.Mat.__getitem__
> (src/petsc4py.PETSc.c:81516)
>   File "petscmat.pxi", line 870, in petsc4py.PETSc.mat_getitem
> (src/petsc4py.PETSc.c:24830)
>   File "petscmat.pxi", line 870, in petsc4py.PETSc.mat_getitem
> (src/petsc4py.PETSc.c:24830)
> TypeError: 'int' object is not iterable
> TypeError: 'int' object is not iterable
>
> Any ideas ?
>
> Also, is the following the correct way of setting the nest to a 2x2 block ?
>
> ix=PETSc.IS()
> ix.CreateGeneral([0,1])
> A.createNest([mA11,mA12,mA21,mA22],isrows=ix,iscols=ix)
>
> Thanks
>
> Amit
>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140404/3c9a9438/attachment.html>


More information about the petsc-users mailing list