This class provides with operations for Matrix Objects
Dependents: Matrix_class Wizardsneverdie mbed_multiplex_matrix Kinematics_Project_G5 ... more
MatrixMath.cpp@0:eb69bbfb6486, 2011-10-21 (annotated)
- Committer:
- Yo_Robot
- Date:
- Fri Oct 21 03:28:28 2011 +0000
- Revision:
- 0:eb69bbfb6486
- Child:
- 1:c74cdf14aea2
version 0.1 still under development, only published to accompany Matrix Class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Yo_Robot | 0:eb69bbfb6486 | 1 | /** |
Yo_Robot | 0:eb69bbfb6486 | 2 | * @brief Still under work version 0.1 |
Yo_Robot | 0:eb69bbfb6486 | 3 | * @file MatrixMath.cpp |
Yo_Robot | 0:eb69bbfb6486 | 4 | * @author Erneseto Palacios |
Yo_Robot | 0:eb69bbfb6486 | 5 | * |
Yo_Robot | 0:eb69bbfb6486 | 6 | * Develop Under GPL v3.0 License |
Yo_Robot | 0:eb69bbfb6486 | 7 | * http://www.gnu.org/licenses/gpl-3.0.html |
Yo_Robot | 0:eb69bbfb6486 | 8 | */ |
Yo_Robot | 0:eb69bbfb6486 | 9 | |
Yo_Robot | 0:eb69bbfb6486 | 10 | #include "mbed.h" |
Yo_Robot | 0:eb69bbfb6486 | 11 | #include "MatrixMath.h" |
Yo_Robot | 0:eb69bbfb6486 | 12 | |
Yo_Robot | 0:eb69bbfb6486 | 13 | ///Transpose matrix |
Yo_Robot | 0:eb69bbfb6486 | 14 | Matrix MatrixMath::Transpose(const Matrix& matrix) |
Yo_Robot | 0:eb69bbfb6486 | 15 | { |
Yo_Robot | 0:eb69bbfb6486 | 16 | Matrix result( matrix._nCols, matrix._nRows ); //Transpose Matrix |
Yo_Robot | 0:eb69bbfb6486 | 17 | |
Yo_Robot | 0:eb69bbfb6486 | 18 | for( int i = 0; i < result._nRows; i++ ) |
Yo_Robot | 0:eb69bbfb6486 | 19 | for( int j = 0; j < result._nCols; j++ ) |
Yo_Robot | 0:eb69bbfb6486 | 20 | result._matrix[i][j] = matrix._matrix[j][i]; |
Yo_Robot | 0:eb69bbfb6486 | 21 | |
Yo_Robot | 0:eb69bbfb6486 | 22 | return result; |
Yo_Robot | 0:eb69bbfb6486 | 23 | } |
Yo_Robot | 0:eb69bbfb6486 | 24 |