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.
This is a patch for the expsu3 function for the edge case of an input zero matrix. In that situation the algorithm would return
NaN
s instead of unity matrix. This is because of illigal operations such thelog(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 wheretmp
may get a zero value). Finally unity matrix is returned.