Mathieu MORLIGHEM <mathieu.morlig...@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.

Attachment: pgpMUe2Ag9jSW.pgp
Description: PGP signature

Reply via email to