lattice / quda

QUDA is a library for performing calculations in lattice QCD on GPUs.
https://lattice.github.io/quda
Other
289 stars 97 forks source link

Fixing expsu3 for special case of zero input #1346

Closed sbacchio closed 1 year ago

sbacchio commented 1 year ago

This is a patch for the expsu3 function for the edge case of an input zero matrix. In that situation the algorithm would return NaNs instead of unity matrix. This is because of illigal operations such the log(0) below.

The fix proposed adds only one extra if-statement for non-zero cases where the value of tmp is checked. If that is zero then I make sure that the whole matrix is zero (just to catch other edge cases where tmp may get a zero value). Finally unity matrix is returned.