Non-member binary operators

XXXMatrix operator + (const XXXMatrix& left,
                      const XXXMatrix& right)

Example: A = B + C;
Return a new matrix which is the sum of the first two. The left and right source matrices must have the same dimensions.

XXXMatrix operator + (const xxx& scalar,
                      const XXXMatrix& matrix)

Example: A = 5 + B;
Return a new matrix that has entries of the source matrix added to a scalar value.

XXXMatrix operator + (const XXXMatrix& matrix,
                      const xxx& scalar)

Example: A = B + 5;
Return a new matrix that has entries of the source matrix added to a scalar value. (This is the same as the previous operator but with the scalar on the right.)

XXXMatrix operator - (const XXXMatrix& left,
                      const XXXMatrix& right)

Example: A = B - C;
Return a new matrix which is the difference of the first two. The left and right source matrices must have the same dimensions.

XXXMatrix operator - (const xxx& scalar,
                      const XXXMatrix& matrix)

Example: A = 5 - B;
Return a new matrix that has the negative of the entries of the source matrix added to a scalar value.

 

XXXMatrix operator - (const XXXMatrix& matrix,
                      const xxx& scalar)

Example: A = B - 5;
Return a new matrix such that each entry is the corresponding entry of the source matrix minus the scalar value.

XXXMatrix operator * (const XXXMatrix& left,
                      const XXXMatrix& right)

Example: A = B * C;
Return a new matrix which is the matrix product of the first two. The left and right source matrices must have compatible dimensions, i.e., A.numCols() == B.numRows().

XXXMatrix operator * (const xxx& scalar,
                      const XXXMatrix& matrix)

Example: A = 5 * B;
Return a new matrix that has entries of the source matrix multiplied by a scalar value.

XXXMatrix operator * (const XXXMatrix& matrix,
                      const xxx& scalar)

Example: A = B * 5;
Return a new matrix that has entries of the source matrix multiplied by a scalar value. (This is the same as the previous operator but with the scalar on the right.)