<br><br><div class="gmail_quote">On Thu, Sep 29, 2011 at 3:22 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im"><br>
On Sep 29, 2011, at 2:56 PM, Shiyuan wrote:<br>
<br>
> What about a direct access to seqaijcusp Mat? Is there a function call which return the pointed to the cusp::csr_matrix ?<br>
<br>
</div> No. But look at the source code to MatMult_SeqAIJCusp and you will see how it may be accessed.<br>
<div class="im"><br></div></blockquote><div> </div>In MatMult_SeqAIJCUSP, if the mat is CSR, the result first is stored in tmpvec, and then is permuted before stored to the final destination yy. What's the reason for doing that? <br>
Does petsc also support other format than csr?<br>The part of the code is attached:<br><br><br> if (usecprow){ /* use compressed row format */<br> try {<br> cusp::multiply(*cuspstruct->mat,*xarray,*cuspstruct->tempvec);<br>
ierr = VecSet_SeqCUSP(yy,0.0);CHKERRQ(ierr);<br> thrust::copy(cuspstruct->tempvec->begin(),cuspstruct->tempvec->end(),thrust::make_permutation_iterator(yarray->begin(),cuspstruct->indices->begin()));<br>
} catch (char* ex) {<br> SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"CUSP error: %s", ex);<br> }<br> } else { /* do not use compressed row format */<br> try {<br> cusp::multiply(*cuspstruct->mat,*xarray,*yarray);<br>
} catch(char* ex) {<br> SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"CUSP error: %s", ex);<br> } <br> }<br><br></div>