Matrix Library. v1.6.4
Dependents: Matrix_class Wizardsneverdie TwoTank mbed_multiplex_matrix ... more
Diff: Matrix.h
- Revision:
- 5:a4014ab0a8cf
- Parent:
- 4:c0c8f3edd60e
diff -r c0c8f3edd60e -r a4014ab0a8cf Matrix.h --- a/Matrix.h Sat Oct 22 23:19:51 2011 +0000 +++ b/Matrix.h Sun Oct 30 16:29:23 2011 +0000 @@ -1,6 +1,8 @@ /** + * @brief API for Matrix Library * @file Matrix.h * @author Ernesto Palacios + * * Created on 13 de septiembre de 2011, 03:49 PM * * Develop Under GPL v3.0 License @@ -9,17 +11,16 @@ */ #ifndef MATRIX_H -#define MATRIX_H +#define MATRIX_H #include <vector> class MatrixMath; -using namespace std; /** * @brief This class provide basic manipulation for 2D matrices see Log.c for more info - * version 1.6.2. + * version 1.6.4. * */ class Matrix{ @@ -45,6 +46,25 @@ friend class MatrixMath; + /**@brief + * Subindex for Matrix elements assignation. + * @param row + * @param col + * @return pointer to the element. + */ + float& operator() ( int row, int col ); + + + /**@brief + *Subindex for Matrix element. + * @param row + * @param col + * @return the element. + */ + float operator() ( int row, int col ) const; + + + /** @brief * Overwrites all data. To be used Carefully! */ @@ -57,7 +77,7 @@ * @param rightM * @return Boolean 'false' if different. */ - bool operator == ( const Matrix& rightM ); + friend bool operator == ( const Matrix& leftM, const Matrix& rightM ); /** @brief @@ -66,7 +86,7 @@ * @param rightM * @return Boolean 'true' if different */ - bool operator != ( const Matrix& rightM ); + friend bool operator != ( const Matrix& leftM, const Matrix& rightM ); /** @brief @@ -74,7 +94,7 @@ * @param rightM * @return A new Matrix to be assigned to itself. */ - Matrix& operator += ( const Matrix& rightM ); + friend Matrix& operator += ( Matrix& leftM, const Matrix& rightM ); /** @brief @@ -82,7 +102,7 @@ * @param rightM Right hand matrix * @return A new Matrix to be assigned to itself */ - Matrix& operator -= ( const Matrix& rightM ); + friend Matrix& operator -= ( Matrix& leftM, const Matrix& rightM ); /** @brief @@ -90,7 +110,7 @@ * @param rightM * @return */ - Matrix& operator *=( const Matrix& rightM ); + friend Matrix& operator *=( Matrix& leftM, const Matrix& rightM ); /** @brief @@ -98,7 +118,7 @@ * @param number * @return */ - Matrix& operator *=( float number ); + friend Matrix& operator *=( Matrix& leftM, float number ); @@ -208,13 +228,13 @@ * Returns TRUE if the matrix is zero, FALSE otherwhise * @param mat: Matrix to be tested */ - bool isZero(); + bool isZero() const; /** @brief * Determines weather a Matrix is a Single Column or Row. */ - bool isVector(); + bool isVector() const; /** @brief @@ -327,7 +347,7 @@ /** @brief * Prints the entire Matrix using standard PRINTF */ - virtual void print(); + virtual void print() const; /** @brief @@ -352,7 +372,7 @@ /** @brief * Returns the sum of every cell in the Matrix. */ - float sum(); + float sum() const; /** @brief @@ -361,19 +381,19 @@ * @param Col = number of Col in matrix * @return Num = float number in matrix */ - float getNumber( int Row, int Col ); + float getNumber( int Row, int Col ) const; /**@brief * Retuns the number of Columns in Matrix, index starts at 1. */ - int getCols(); + int getCols() const; /**@brief *Retruns the number of Rows in Matrix, index starts at 1. */ - int getRows(); + int getRows() const; private: @@ -399,12 +419,5 @@ }; -#endif /* MATRIX_H */ +#endif /* MATRIX_H */ -/* - * Things To Change -> Enhace -> Modify - * - * Submatrix - // .submat(first_row, first_column, last_row, last_column) - * - */