[petsc-users] Pointwise max for matrices

Jed Brown jed at jedbrown.org
Wed Aug 6 17:49:36 CDT 2014


Mathieu MORLIGHEM <Mathieu.Morlighem at uci.edu> writes:

> Hello,
>
> I am trying to implement a Flux Correction Transport method for advection equations (e.g. http://www.mathematik.uni-dortmund.de/~kuzmin/linfct.pdf).
> One of the steps consists of calculating a matrix D which is such that
>
> d_ij = max{ 0 , -k_ij , -kJi }
>
> where k_ij are the components of a transport operator K.
> Is there a way to do that without serializing K, which could be memory intensive.

You can't avoid getting the off-diagonal part of the transpose, but what
I would suggest is to just use MatTranspose() and then MatGetRow() to
walk through rows and columns of K.  This should be very efficient (no
searching and good locality) and doesn't use that much memory in the
scheme of what else is probably in your code.

Anything that doesn't transpose will need a search or a more expensive
data structure with worse locality.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140806/aea6f1ba/attachment.pgp>


More information about the petsc-users mailing list