Language Reference


Sign Reversal Operator:   –

  • –matrix;

The sign reversal operator ($-$) computes a new matrix that contains elements that are formed by reversing the sign of each element in matrix. The sign reversal operator is also called the unary minus operator.

When an element of the matrix contains a missing value, the corresponding element of the result also contains a missing value.

The following statements reverse the signs of each element of a matrix, as shown in Figure 25.26:

a = {-1  7  6,
      2  0 -8};
b = -a;
print b;

Figure 25.26: The Result of a Sign Reversal Operator

b
1 -7 -6
-2 0 8