Meaning of `A(A == -Inf) = -realmax;`

Viewed 67

I was looking at Octave implementation of expm and fell over this line:

A(A == -Inf) = -realmax;

where A is a matrix.

What is the effect of the command?

1 Answers

It puts the value -realmax in every entry of A which is -Inf.

For instance, let's say

A = [1 -Inf 3; Inf -Inf 4; 0 0 0];

Then the command above would change A to the following:

[1 -realmax 3; Inf -realmax 4; 0 0 0]
Related