> On Aug 26, 2015, at 3:06 PM, Nicolas Pozin <nicolas.po...@inria.fr> wrote:
> 
> Thank you for this answer.
> 
> What I want to do is to get the lines of this matrix and store them in 
> vectors.

  If you want to treat the columns of the dense matrix as vectors then use 
MatDenseGetArray() and call VecCreateMPIWithArray() with a pointer to the first 
row of each column of the obtained array (PETSc dense matrices are stored by 
column; same as for example LAPACK).

  But if you explained more why you want to treat something sometimes as a Mat 
(which is a linear operator on vectors) and sometimes as vectors we might be 
able to suggest how to organize your code.

   Barry

> 
> 
> ----- Mail original -----
>> De: "Jed Brown" <j...@jedbrown.org>
>> À: "Nicolas Pozin" <nicolas.po...@inria.fr>, petsc-users@mcs.anl.gov
>> Envoyé: Mercredi 26 Août 2015 20:38:37
>> Objet: Re: [petsc-users]  forming a matrix from a set of vectors
>> 
>> Nicolas Pozin <nicolas.po...@inria.fr> writes:
>>> Given a set of vectors V1, V2,...,Vn, is there an efficient way to form the
>>> dense matrix [V1 V2 ... Vn]?
>> 
>> What do you want to do with that matrix?  The vector representation is
>> pretty flexible and the memory semantics are similar unless you store
>> the dense matrix row-aligned (not the default).
>> 

Reply via email to