[petsc-users] Reshaping a vector into a matrix

S V N Vishwanathan vishy at stat.purdue.edu
Thu Jan 6 00:02:46 CST 2011


> > If you are curious as to the application where this arises, I am using
> > TAO to solve a machine learning problem. TAO expects the optimization
> > parameters to be a vector, but when I evaluate the objective function I
> > need to reshape them into a matrix. 
> > 
> 
>    Do you mean a two dimensional array or do you mean a matrix -- that is the representation of a linear operator that applies to a vector giving a new vector?

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

vishy



More information about the petsc-users mailing list