On Nov 29, 2009, at 9:49 PM, ming zhu wrote:

> Thank you
> I know that you are trying to let me know to match the vector  
> element with the matrix.
> But it seems, the total number of rows (suppose m) has to satisfy
>    m = N * r,where N is the number of process and r is the local  
> range.
> Am I right?

    Yes, if all the local ranges are the same. In general different  
processors could have a different number of rows.

   Barry

>
>
>
> --- 09?11?30????, Barry Smith <bsmith at mcs.anl.gov> ? 
> ??
>
> ???: Barry Smith <bsmith at mcs.anl.gov>
> ??: Re: How to fill a matrix with a vector parallelly
> ???: "PETSc users list" <petsc-users at mcs.anl.gov>
> ??: 2009?11?30?,??,??11:33
>
>
> On Nov 29, 2009, at 9:21 PM, ming zhu wrote:
>
> > OK.
> > may I ask , I think Petsc matrix is row -based. That means,
> > MatGetArray(Mat mat,PetscScalar *v[])
> > v[0] is the pointer to the first row. v[0][0] is the value of  
> mat[0][0].
> > Am I right?
>
>    No. It is column based and there is just one array for the who  
> thing so v[0:m-1] is the first column v[m:2m-1] is the next column etc
> > And do you mean that, each time I got a vector, I create a sub  
> matrix to store it.
>
> No. Just create the full matrix and copy over each vector as you get  
> it..
>
>   Barry
>
> > Later on, the merging will be a problem.
> >
> > --- 09?11?30????, Barry Smith <bsmith at mcs.anl.gov> ? 
> ??
> >
> > ???: Barry Smith <bsmith at mcs.anl.gov>
> > ??: Re: How to fill a matrix with a vector parallelly
> > ???: "PETSc users list" <petsc-users at mcs.anl.gov>
> > ??: 2009?11?30?,??,??11:12
> >
> >
> > On Nov 29, 2009, at 9:09 PM, ming zhu wrote:
> >
> > > Thank you for your quick reply.
> > > Two questions:
> > > one,     how do I know which part belongs to the present  
> processor?
> >
> >   Call VecGetOwnershipRange() to know what rows of the vector  
> belong to the process. Then create the MPIDense matrix with the same  
> number of local rows.
> >
> > > second, is there any examples for this kind of question?
> > >
> > > Thank you
> > >
> > > --- 09?11?30????, Barry Smith <bsmith at mcs.anl.gov> ? 
> ??
> > >
> > > ???: Barry Smith <bsmith at mcs.anl.gov>
> > > ??: Re: How to fill a matrix with a vector parallelly
> > > ???: "PETSc users list" <petsc-users at mcs.anl.gov>
> > > ??: 2009?11?30?,??,??9:53
> > >
> > >
> > >   Since evenvectors will (almost always) be dense vectors you  
> will want to use a MPIDENSE matrix to store them. So create a  
> MPIDENSE matrix with the same row layout as the eigenvector then on  
> each process use VecGetArray() to access that processes part of the  
> vector and MatGetArray() to access that part of the matrix and copy  
> the values over from the vector array to the matrix array.
> > >
> > >    Barry
> > >
> > > On Nov 29, 2009, at 7:41 PM, ming zhu wrote:
> > >
> > > > HI
> > > > I am trying to solve an eigenvalue problem.. A = U *  
> LAMBDA*U'.  While SLEPC proivdes a solver to get an eigenvector and  
> the related eigenvalue, I have to fill the eigenvector to form the  
> eigen matrix. However, there seems no such function to do this  
> directly. I was trying to use VecGetValues and filled the matrix one  
> by one. Howevevr, it can not do that in parallel.
> > > >
> > > >    Is there anyone can help me ?
> > > >
> > > > Thank you
> > > >
> > > >
> > > > ?????????????????
> > >
> > >
> > > ?????????????????
> >
> >
> > ?????????????????
>
>
> ?????????????????

Reply via email to