help in capturing matrix patterns to files

Barry Smith bsmith at mcs.anl.gov
Thu May 4 21:39:19 CDT 2006


   You can simply use -mat_view_draw -draw_type ps and it will save the
image in defaultps0.ps

   Draw backs:
1) only generates color postscript

2) silly file name defaultps0.ps

3) the file can get large, megabytes for moderately large matrices (cause it
draws EVERY non-zero matrix element).

   I have added to 
http://www-unix.mcs.anl.gov/petsc/petsc-as/developers/projects.html
1) -draw_ps_monochrome (and corresponding function) to get black and white ps

2) -draw_ps_filename for allowing changing the name of the file.

   (volunteers?)

Actually this also needs to be added to the FAQ, Satish could you add it
with all the options you listed below as well as the postsript approach? Thanks!

    Barry

The image looks fine, but I do think that Matlab's spy() function
does generate a more visually appealing image. Heck they have graphics
experts while I learned my limited postscript by reverse engineering
postscript files in the early 90's :-(



On Thu, 4 May 2006, Satish Balay wrote:

> There are already tools to do get this dump
>
> xwd | xpr -device ps > foo.ps
> [now when the curser changes - click on the window to be dumped]
>
> xv
> [use the grab option, and then save as tiff/jpg/ps format]
>
> Perhaps there are other tools that can be used. Hence there is
> no extra tools in PETSc to do the capture part.
>
> Satish
>
> On Thu, 4 May 2006, Harald Pfeiffer wrote:
>
>> Hello,
>>
>> That's a pity that this is not implemented.  As soon as I saw Razi's question,
>> I thought that this would be a really useful feature.  I have found myself
>> many times saying in talks that my matrix is non-symmetric for this-or-that
>> reason.  Having a picture of the matrix to make the point would be very
>> powerful.
>>
>> I guess, outputting a picture with as many pixels as the matrix-size in a
>> non-compressed format (tiff?) should be straightforward: You iterate through
>> all matrix entries, if the entry is non-zero, you output "1", otherwise "0".
>> You could even output different colors depending on the size or sign of an
>> entry.  This will result in huge files, but any image-software should be able
>> to down-size and convert to more efficient formats.
>>
>> Harald
>>
>>
>> Matthew Knepley wrote:
>>> There is nothing built into PETSc to do this. It is also X-Windows
>>> render commands inside. I used a screen capture program on
>>> the Window it pops up.
>>>
>>>   Thanks,
>>>
>>>      Matt
>>>
>>> On 5/4/06, *abdul-rahman at tu-harburg.de <mailto:abdul-rahman at tu-harburg.de>*
>>> <abdul-rahman at tu-harburg.de <mailto:abdul-rahman at tu-harburg.de>> wrote:
>>>
>>>     Hi all,
>>>
>>>     I'd appreciate if anyone can point to a tutorial/example on how to
>>>     direct
>>>     the matrix pattern plot (one with -mat_view_draw) to a file
>>>     (preferrably
>>>     PNG for presentation and postscript for publications)
>>>
>>>     I want to be able to capture the patterns in monochrome and also
>>>     resize
>>>     the graphics size.
>>>
>>>     Thanks so much.
>>>
>>>
>>>     Razi
>>>
>>>
>>>
>>>
>>> --
>>> "Failure has a thousand explanations. Success doesn't need one" -- Sir Alec
>>> Guiness
>>
>>
>
>




More information about the petsc-users mailing list