The following non-member binary operators are available for the matrix class objects. If the sizes of the matrices do not conform and range checking is enabled, i.e., the constant RANGE_CHECK_ is defined, these operators may throw invalid_argument exception; otherwise, the behavior is undefined.
1. matrix<T> operator+ (const matrix<T>& m1, const matrix<T>& m2);
2. matrix<T> operator- (const matrix<T>& m1, const matrix<T>& m2);
3. matrix<T> operator* (const matrix<T>& m1, const matrix<T>& m2);
4. matrix<T> operator* (const matrix<T>& m, const T& e);
5. matrix<T> operator* (const T& e, const matrix<T>& m);
6. matrix<T> operator/ (const matrix<T>& m1, const matrix<T>& m2);
7. matrix<T> operator/ (const matrix<T>& m, const T& e);
8. matrix<T> operator/ (const T& e, const matrix<T>& m);
9. valarray<T> operator* (const matrix<T>& m, const valarray<T>& v);
10. valarray<T> operator* (const valarray<T>& v, const matrix<T>& m);
11. valarray<T> operator/ (const matrix<T>& m, const valarray<T>& v);
12. valarray<T> operator/ (const valarray<T>& v, const matrix<T>& m);
typedef techsoft::matrix<double> Matrix;
typedef std::valarray<double> Vector;
Matrix A(5,5), B(5,5);
A.rand();
B = A;
A += B;
B -= A;
B *= A;
B /= A; // B *= !A;
A *= 1.234;
B /= 2.34;
Matrix C = A * B - B;
Vector V(5), V2(5);
V = B[0];
V2 = V * A;
V2 = B / V;