[petsc-users] Matricize a vector
    elam at cs.toronto.edu 
    elam at cs.toronto.edu
       
    Tue Sep  6 05:52:31 CDT 2011
    
    
  
Hello,
Is it possible to reshape a vector into a matrix in PETSc?  I need to do
this to compute a matrix vector multiplication (Ax) where the matrix A can
be decomposed into Kronecker tensor format.  For example, A = A1 kron A2
kron A3, where A1, A2, A3 are smaller sparse matrices.
Essentially, I need to matricize the vector x and perform a series of
matrix matrix multiplications to compute Ax.  In Matlab the function to
perform the matricization is reshape.  Is there a similar function in
PETSc?
I could implement the (tensor product) matrix vector multiplication by
creating temporary matrices to store each of the intermediate matrix
matrix multiplication results.  But this seems inefficient.  I was
wondering if there is a more efficient way to implement this in PETSc? 
Can I simply reset the size of a matrix (as long as the number of elements
remain the same) to reshape it?  Any suggestions would be appreciated.
Thank you for your help.
Best regards,
Elizabeth
    
    
More information about the petsc-users
mailing list