When we're talking about matrices or a matrix, what does "unary minus" stand for as an arithmetic operator?
+3
A:
The matrix A with all the elements negated.
That way, A + (-A) == 0.
Edit: here's the source from JAMA:
/** Unary minus
@return -A
*/
public Matrix uminus () {
Matrix X = new Matrix(m,n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
C[i][j] = -A[i][j];
}
}
return X;
}
Edit 2: if A is
1 2
3 4
then unary minus of A is
-1 -2
-3 -4
Grandpa
2009-10-21 17:58:53
Let's say we have a matrix such that:A=| 1 2 || 3 4 |Is -A =| -1 -2 || -3 -4 |?
Ahmet Alp Balkan
2009-10-21 18:01:10
Yes, since A + (-A) == 0.
Grandpa
2009-10-21 18:27:01
But (| 1 2 |\n| 3 4 |))+ |-1 -2 |\n|-3 -4 |) is not 0 ? (\n=newline)
Ahmet Alp Balkan
2009-10-21 18:33:11
Maybe I'm getting confused by your formatting, but I think it is...
Grandpa
2009-10-21 18:43:54
the point is that 0 = | 0 0| \n | 0 0|
Brian Postow
2009-10-22 19:43:25
+1
A:
If M is your matrix, -M is the new matrix where unary minus has been applied
(-M)[i, j] = - (M [i, j])
tom greene
2009-10-21 17:59:05
+1
A:
"unary minus" for a matrix is an element by element negation as others has said.
More generally, in computer science, a "unary operator" is one that operates on a single operand. Other common examples from C include the '++' or '=*' unary operators.
Paul
2009-10-22 16:09:22