use from Ernesto Palacios
Dependents: RoboticArm DXL_SDK_Porting_Test
Fork of Matrix by
Diff: Operators.cpp
- Revision:
- 8:1774aa06ab99
- Parent:
- 7:7a564cf28ab6
diff -r 7a564cf28ab6 -r 1774aa06ab99 Operators.cpp --- a/Operators.cpp Thu Feb 02 04:29:41 2017 +0000 +++ b/Operators.cpp Sat Feb 11 13:07:13 2017 +0000 @@ -13,6 +13,17 @@ #include "Matrix.h" + + +extern Serial pc; + + +#if (DEBUG) + #define DBGMSG(x) pc.printf x; +#else + #define DBGMSG(x) +#endif + /// Subindex in Matrix left side float& Matrix::operator ()(int row, int col) { @@ -20,7 +31,7 @@ if( row >= _nRows || col >= _nCols) { - printf("\n\nError:\nOut of limits @ Matrix::operator()\n"); + DBGMSG(("\n\nError:\nOut of limits @ Matrix::operator()\n")) return _matrix[0][0];//暫時這樣stanley } @@ -37,7 +48,7 @@ if( row >= _nRows || col >= _nCols) { - printf("\n\nError:\nOut of limits @ Matrix::operator()\n"); + DBGMSG(("\n\nError:\nOut of limits @ Matrix::operator()\n")) return _matrix[0][0];//暫時這樣stanley }else{ return _matrix[row][col]; @@ -117,7 +128,7 @@ return leftM; }else{ - printf( "\n\nERROR:\nDiferent Dimensions @ += operator\n" ); + DBGMSG(( "\n\nERROR:\nDiferent Dimensions @ += operator\n" )) return leftM;//暫時這樣stanley @@ -138,7 +149,7 @@ return leftM; }else{ - printf( "\n\nERROR:\nDiferent Dimensions @ -= operator\n" ); + DBGMSG(( "\n\nERROR:\nDiferent Dimensions @ -= operator\n" )) return leftM;//暫時這樣stanley @@ -180,7 +191,7 @@ // return resultM;//org return leftM;//stanley }else{ - printf( "\n\nERROR:\nDiferent Dimensions @ *= operator\n" ); + DBGMSG(( "\n\nERROR:\nDiferent Dimensions @ *= operator\n" )) return leftM;//暫時這樣stanley @@ -233,7 +244,7 @@ return result; }else{ - printf( "\n\nERROR\nDiferent Dimensions @ + operator \n" ); + DBGMSG(( "\n\nERROR\nDiferent Dimensions @ + operator \n" )) Matrix NULL_M( 1, 1 );//暫時這樣stanley return NULL_M; @@ -275,7 +286,7 @@ return result; }else{ - printf( "\n\nERROR:\nDiferent Dimensions @ + operator \n" ); + DBGMSG(( "\n\nERROR:\nDiferent Dimensions @ + operator \n" )) Matrix NULL_M( 1, 1 );//暫時這樣stanley return NULL_M; @@ -317,7 +328,7 @@ } else { - printf("\n\nERROR:\nDiferent Dimension matrices @ * operator"); + DBGMSG(("\n\nERROR:\nDiferent Dimension matrices @ * operator")) Matrix NULL_M( 1, 1 );//暫時這樣stanley return NULL_M; @@ -352,7 +363,7 @@ } if( leftM._pRow > leftM._nRows ) { - printf( "\n\nERROR:\nAssignment out of limits @ << operator" ); + DBGMSG(("\n\nERROR:\nAssignment out of limits @ << operator")) return leftM; }else{