[petsc-users] direct access of seqcusp Vec
Shiyuan
gshy2014 at gmail.com
Sun Oct 2 23:13:23 CDT 2011
On Thu, Sep 29, 2011 at 3:22 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> On Sep 29, 2011, at 2:56 PM, Shiyuan wrote:
>
> > What about a direct access to seqaijcusp Mat? Is there a function call
> which return the pointed to the cusp::csr_matrix ?
>
> No. But look at the source code to MatMult_SeqAIJCusp and you will see
> how it may be accessed.
>
>
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?
Does petsc also support other format than csr?
The part of the code is attached:
if (usecprow){ /* use compressed row format */
try {
cusp::multiply(*cuspstruct->mat,*xarray,*cuspstruct->tempvec);
ierr = VecSet_SeqCUSP(yy,0.0);CHKERRQ(ierr);
thrust::copy(cuspstruct->tempvec->begin(),cuspstruct->tempvec->end(),thrust::make_permutation_iterator(yarray->begin(),cuspstruct->indices->begin()));
} catch (char* ex) {
SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"CUSP error: %s", ex);
}
} else { /* do not use compressed row format */
try {
cusp::multiply(*cuspstruct->mat,*xarray,*yarray);
} catch(char* ex) {
SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB,"CUSP error: %s", ex);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111002/663c8c1a/attachment.htm>
More information about the petsc-users
mailing list