[petsc-dev] I do not think this is the right solution

Jed Brown jedbrown at mcs.anl.gov
Sun Mar 18 19:05:34 CDT 2012


On Sun, Mar 18, 2012 at 18:54, Matthew Knepley <knepley at gmail.com> wrote:

> That has nothing to do with anything we are talking about.
>

Bull, run your code in parallel, but have it create the matrix in two ways,
one on COMM_SELF and one running on COMM_WORLD. Take the COMM_WORLD one and
MatGetRedundantMatrix(Aworld,...,&Ared) to get the redundant matrix, then
compute the norm of Ared - Aself.

>From looking at your code, this is more intrusive than below.


>
>
>> And if you really want to stay parallel and print all the non-small
>> values, MatDuplicate and fill up the new matrix with the thresholded values.
>>
>
> Neither does this.
>

Imagine a world in which

    ierr = MatChop(JacP, 1.0e-10);CHKERRQ(ierr);
    ierr = MatView(JacP, PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);

was instead written

    Mat Chopped;
    ierr = MatChop(JacP, 1.0e-10, &Chopped);CHKERRQ(ierr);
    ierr = MatView(Chopped, PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(ierr);
    ierr = MatDestroy(&Chopped);CHKERRQ(ierr);

You could MatHeaderReplace(JacP,Chopped); if you were feeling ornery
(considering that the local callback you are using didn't pass a Mat* or
forward the SNES down that far (i.e. an API bug because we assert that you
can change the matrix in a Jacobian evaluation routine)).


>
>
>> Note, there was a request a while back to be able to make an ASCII viewer
>> use a user-defined floating-point format string.
>>
>
> That would not help. For a small number, you do not want ANY significant
> digits.
>

%f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120318/c1d66ac3/attachment.html>


More information about the petsc-dev mailing list