You can print any size matrix to the screen "for checking" by using an ASCII 
viewer with MatView() with the option -mat_ascii_output_large 

   If you want to save a matrix to load later for running in another program 
you should ALWAYS use a binary viewer (ASCII just doesn't make sense for this 
purpose).


On Jan 2, 2011, at 12:43 PM, Peter Wang wrote:

> A matrix with more than 1024 rows was output by calling MatView().  If only 
> one process was used, then no error came out. However, if multi-process were 
> used, the error information like 'ASCII matrix output not allowed for 
> matrices with more than 1024 rows' came out. If the rule of 1024 rows is only 
> for multi-process?

  Apparently, but so what. Just use the flag.
>  
> To my understand,  there should be two approaches: 1 use binary format, 2 use 
> option -mat_ascii_output_large.
> If I need to check the matrix on the monitor, I cannot use MatView() to do 
> this, right?

  You can use MatView() with an ASCII viewer to see it on the monitor.

>  Whether the binary format can  be used to output the matrix to the monitor?

   Binary format is unreadable to the human eye so makes no sense to send it to 
the monitor.

>  
> In FAQ, the answer suggests to use the examples of  ex72.c, ex78.c and 
> ex32.c.  Is there any example for this issue in Fortran?

   You could write similar code in Fortran (no we don't have any examples of 
it), but why bother? This is just a preprocessing step in a tiny standalone 
program to change the matrix format, just use the C code.

  Barry

Why do we have the option -mat_ascii_output_large? Because outputting a large 
sparse matrix in ASCII format is just plain silly so we  force the user to 
acknowledge they really want to do it by using that flag.


>  Thanks.
>  
> The solution in FAQ:
> How can I read in or write out a sparse matrix in Matrix Market, 
> Harwell-Boeing, SLAPC or other ASCII format?See the examples in 
> src/mat/examples/tests, specifically ex72.c, ex78.c, and ex32.c. You will 
> likely need to modify the code slightly to match your required ASCII format. 
> Note: Never read or write in parallel an ASCII matrix file, instead for 
> reading: read in sequentially with a standalone code based on ex72.c, ex78.c, 
> or ex32.c then save the matrix with the binary viewer PetscBinaryViewerOpen() 
> and load the matrix in parallel in your "real" PETSc program with MatLoad(); 
> for writing save with the binary viewer and then load with the sequential 
> code to store it as ASCII.
> 

Reply via email to