<p>Dear Barry and Matthew:<br></p><p>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. </p>
<p>Now, I have confirmed the question is in "*bv++ = av[irow[j] - rstart];" of</p><p>(PETSC2.3.3)</p><p>/* Now extract the data pointers and do the copy, column at a time */<br>245: newmatd = (Mat_MPIDense*)newmat->data;<br>
246: bv = ((Mat_SeqDense *)newmatd->A->data)->v;<br>247: <br>248: for (i=0; i<ncols; i++) {<br>249: av = v + nlrows*icol[i]; <br>250: for (j=0; j<nrows; j++) {<br>251: *bv++ = av[irow[j] - rstart];<br>
252: }<br>253: }</p><p>The codes generate an error of segmentation violation.</p><p>I have checkec PETsc3.0.0 version. the corresponding codes are:</p><p>220: /* Now extract the data pointers and do the copy, column at a time */<br>
221: newmatd = (Mat_MPIDense*)newmat->data;<br>222: bv = ((Mat_SeqDense *)newmatd->A->data)->v;<br>223: <br>224: for (i=0; i<ncols; i++) {<br>225: av = v + ((Mat_SeqDense *)newmatd->A->data)->lda*icol[i];<br>
226: for (j=0; j<nrows; j++) {<br>227: *bv++ = av[irow[j] - rstart];<br>228: }<br>229: }<br></p><p>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.</p>
<p>Regards,</p><p>Yujie<br><br></p>