MatGetSubMatrix_MPIDense()

Yujie recrusader at gmail.com
Tue Jan 20 19:27:38 CST 2009


Dear Barry and Matthew:

I always fingure out what's wrong with MatGetSubMatrix_MPIDense() in my
application. Because I use other pacakges based on PETSc, it is difficult to
change my PETSc2.3.3 to 3.0.0. I have to debug my codes to find something.

Now, I have confirmed the question is in "*bv++ = av[irow[j] - rstart];" of

(PETSC2.3.3)

/* Now extract the data pointers and do the copy, column at a time */
245: newmatd = (Mat_MPIDense*)newmat->data;
246: bv = ((Mat_SeqDense *)newmatd->A->data)->v;
247:
248: for (i=0; i<ncols; i++) {
249: av = v + nlrows*icol[i];
250: for (j=0; j<nrows; j++) {
251: *bv++ = av[irow[j] - rstart];
252: }
253: }

The codes generate an error of segmentation violation.

I have checkec PETsc3.0.0 version. the corresponding codes are:

220: /* Now extract the data pointers and do the copy, column at a time */
221: newmatd = (Mat_MPIDense*)newmat->data;
222: bv = ((Mat_SeqDense *)newmatd->A->data)->v;
223:
224: for (i=0; i<ncols; i++) {
225: av = v + ((Mat_SeqDense *)newmatd->A->data)->lda*icol[i];
226: for (j=0; j<nrows; j++) {
227: *bv++ = av[irow[j] - rstart];
228: }
229: }

why change "nlrows" to "((Mat_SeqDense *)newmatd->A->data)->lda"? After I
revise the codes in PETsc2.3.3, the error disappears. However, the results
from my codes become wrong. Could you give me some advice? thanks a lot.

Regards,

Yujie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090120/1c247ee0/attachment.htm>


More information about the petsc-users mailing list