Prev | Up | Next

Unary operators

The following unary operators are available for the matrix class objects.

1. matrix<T> operator+ () const;
2. matrix<T> operator- () const;
3. matrix<T> operator~ () const;
4. matrix<T> operator! () const;

  1. Returns the same matrix object.


  2. Returns a new matrix object constructed after applying the negative operator on all of the matrix elements.


  3. Returns the transpose of the matrix object.


  4. Returns the inverse of the matrix object.


Examples
typedef techsoft::matrix<double> Matrix;

Matrix A(5,5), B(5,5);

A.rand();

B = +A;
B = -A;
B = ~A;         // Returns the transpose of A
B = !A;         // Returns the inverse of A