[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: about MatGetRow/MatRestoreRow
- To: petsc-users@xxxxxxxxxxx
- Subject: Re: about MatGetRow/MatRestoreRow
- From: "Matthew Knepley" <knepley@xxxxxxxxx>
- Date: Wed, 14 Nov 2007 06:28:20 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=zr/GiNcYr5IoCUg2GjT872yfd451eeaiKaMmOjU6Chc=; b=T9uSV8IQebS6qOHU0Vsklo5OBhdZO4Wv/dIQ6SOIN8ng6fL+n3CBDXGeELOGGAp5OqcvZQlm5VChV9T36c/2+kK0FPQ+8DUuuSh8ZCtZL9q0gD3m8yDwbirQxlnSWkOt8lBf5iCUh2pGf0/p06ATqF6dUyBrCfZpvg+d6l8mBX8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=t8ViMy/KfZSrprbtgHzLIEtQ5u+gD1gFmZ2ZgJ6NPOV15wCoekCGPnKKr0JJKzglwZxIrnn+/wVFf3097CtCQ55yXtuZRUihjJGV7c8eiGSXheNg8wSeG7jI77JCvT6N5c4b7qmbrbKIugdQCak4tbnEz9iKIXrEgbWpE1ShXFo=
- In-reply-to: <412086.81470.qm@web15808.mail.cnb.yahoo.com>
- References: <412086.81470.qm@web15808.mail.cnb.yahoo.com>
- Reply-to: petsc-users@xxxxxxxxxxx
- Sender: owner-petsc-users@xxxxxxxxxxx
On Nov 14, 2007 4:12 AM, jiaxun hou <jiaxun_hou@xxxxxxxxxxxx> wrote:
> Dear all,
>
> Does anyone have examples of using MatGetRow/MatRestoreRow?
> I failed in using them.
>
> My code is:
>
> PetscInt ncols_A;
> const PetscInt** cols_A_point;
> const PetscScalar **vals_A_point;
This is not proper C usage since you never allocate space for the
pointers. You want
const PetscInt *cols;
const PetscScalar *vals;
> for (i=0;i<row_A;i++){
> ierr = MatGetRow(A,i,&ncols_A,cols_A_point,vals_A_point);CHKERRQ(ierr);
MatGetRow(A,i,&ncols,&cols,&vals);
and so on.
Matt
> //do something
> ierr = MatRestoreRow(A,i,&ncols_A,cols_A_point,vals_A_point);CHKERRQ(ierr);
> }
>
> and it gets errors as below:
>
> Petsc Release Version 2.3.1, Patch 10, Thu Mar 9 22:48:00 CST 2006
> BK revision: balay@xxxxxxxxxxxxxxxxxx 0 in job 61 lab_43825 caused
> collective abort of all ranks
> exit status of rank 0: killed by signal 9
> [cli_0]: aborting job:
> application called MPI_Abort(MPI_COMM_WORLD, 64) - process 0
> l.gov|ChangeSet|20060310044535|22333
> See docs/changes/index.html for recent updates.
> See docs/faq.html for hints about
> trouble shooting.
> See docs/index.html for manual pages.
> ------------------------------------------------------------------------
> ./mytest1 on a linux-gnu named lab by root Wed Nov 14 17:57:00 2007
> Libraries linked from
> /home/software/petsc-2.3.1-p10/lib/linux-gnu-cxx-complex-debug
> Configure run at Thu Jun 15 13:08:29 2006
> Configure options --with-cc=gcc --with-fc=gfortran
> --download-f-blas-lapack=1 --with-mpi-dir=/home/software/mpich2
> --with-scalar-type=complex --with-shared=0
> ------------------------------------------------------------------------
> [0]PETSC ERROR: PetscObjectDestroy() line 88 in src/sys/objects/destroy.c
> [0]PETSC ERROR: Corrupt argument: see
> http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html#Corrupt!
> [0]PETSC ERROR: Invalid type of object: Parameter # 1!
> [0]PETSC ERROR: PetscObjectRegisterDestroyAll() line 228 in
> src/sys/objects/destroy.c
> [0]PETSC ERROR: PetscFinalize() line 599 in
> src/sys/objects/pinit.c
> [0]PETSC ERROR: main() line 329 in /home/myprogram/mypro/mytest1.c
> make: [runmytest1] Error 137 (ignored)
>
> Can anyone tell me where is wrong? THX
>
>
>
> ________________________________
> 雅虎邮箱,终生伙伴!
--
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