On Thu, Mar 10, 2011 at 8:39 AM, Tim Kroeger <[email protected]> wrote: > Dear all, > > I'm trying to write a sparse matrix to a file. > > SparseMatrix::print() does this, but it prints all the 0 entries, > which results in a huge file that is practically useless (besides from > exceeding my disk quota). > > PetscMatrix::print_matlab() is supposed to do better, but PETSc says: > > [2]PETSC ERROR: ASCII matrix output not allowed for matrices with more > than 1024 rows, use binary format instead.
Hmm, I didn't realize the Matlab printing in PETSc had this limitation. I've only used the SparseMatrix printing capability to print test matrices much smaller in size. > PetscMatrix::print_personal() can only print to stdout, which makes it > difficult for me to cut out the correct part of the output, in > particular if I'm writing more than one matrix. I think we should try to fix/update the PetscMatrix implementation of print_personal. I don't think there's any limitation of MatView which prevents its contents from being written to file instead of stdout. > I would like to implement a method, e.g. called > SparseMatrix::print_sparse(), which works the same way as > SparseMatrix::print() does, but does not print all the 0 entries. It > would e.g. rather print one entry per line in the format > > row column value > > Any objections or thoughts? I'd prefer not adding yet another print* function to SparseMatrix if possible. If it turns out that print_personal() can't be fixed up the way you want, I think it'd be easier to pass an additional flag (with default value) to print() to make it do what you want. You'd have to duplicate a lot of code from print() to implement print_sparse() anyway, wouldn't you? -- John ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Libmesh-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libmesh-devel
