[petsc-users] Set matrix column to vector

Matthew Knepley knepley at gmail.com
Mon Sep 1 05:45:38 CDT 2014


On Mon, Sep 1, 2014 at 4:10 AM, Florian Lindner <mailinglists at xgm.de> wrote:

> Hello,
>
> I want to set the entire column of a N x M matrix to a N vector. What is
> the best way to do that?
>
> My first guess would be to VecGetArray and use that array for
> MatSetValuesLocal with nrow = VecGetLocalSize. What is the best to say
> MatSetValuesLocal that I want to set all rows continuesly (same like
> passing irow = [0, 1, ..., VecGetLocalSize-1]?
>
> Any better way?
>

You are assuming dense storage above, so you can use


http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatDenseGetArray.html

     Matt


> Thanks,
> Florian
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140901/76496fd7/attachment.html>


More information about the petsc-users mailing list