[petsc-users] Reshaping a vector into a matrix

Jed Brown jed at 59A2.org
Thu Jan 6 10:40:09 CST 2011

On Wed, Jan 5, 2011 at 22:02, S V N Vishwanathan <vishy at stat.purdue.edu>wrote:

> I mean a two dimensional array. Basically my parameter vector is of the
> form
> vec = (vec1^t, vec2^t, vec3^t,...veck^t)^t
> which I represent as a Petsc Vector. In my objective function
> calculation I am given a matrix X and need to compute
> fx = (X.vec1, X.vec2, ..., X.veck)^t

1. How big is "k"?

2. Since each vec1,vec2,... is the same size, this is likely to produce poor
memory performance.  If you care about speed, I suggest interlacing the
values in vec1,...,veck.  In that case, you can create an MAIJ matrix that
acts on this "multi-vector".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110106/35633692/attachment.htm>

More information about the petsc-users mailing list