r.gori at cineca.it
Mon Feb 6 05:41:34 CST 2006
I'm trying to solve a linear system with M equations and N unknowns (M >> N) using the LSQR method.
I have a C parallel sparse matrix MxN with NZ nonzero elements stored in this way:
double values[NZ]; // the nonzero values
int idxn[NZ]; // the column indices
int nz[M]; // the number of nonzero values for each row
what is the best way to create a PETSc matrix?
Do exists a statement like VecCreateMPIWithArray for already distributed vectors that could do all the work in one shot without copy?
Just another detail. Initially M is unknown.
All my structures are allocated dynamically because the number of rows M (and the number of nonzero NZ also) is determined just before to solve the system, so I think it's no feasible for me to call MatCreateMPIAIJ at the begin of my code and to perform the MatSetValues loop.
| Roberto Gori CINECA
| High Performance System Group Via Magnanelli 6/3 40033
| e-mail: r.gori at cineca.it Casalecchio di Reno
| Tel: 051/6171522 Bologna - ITALY
| Fax: 051/6132198 http://www.cineca.it
More information about the petsc-users