use from Ernesto Palacios
Dependents: RoboticArm DXL_SDK_Porting_Test
Fork of Matrix by
Operators.cpp@3:589fb80932b5, 2011-10-21 (annotated)
- Committer:
- Yo_Robot
- Date:
- Fri Oct 21 03:33:53 2011 +0000
- Revision:
- 3:589fb80932b5
- Parent:
- 2:493402568a5e
- Child:
- 5:a4014ab0a8cf
version 1.6.0.1 just fixed some typos in comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Yo_Robot | 3:589fb80932b5 | 1 | /** |
Yo_Robot | 3:589fb80932b5 | 2 | * @file Matrix.cpp |
Yo_Robot | 3:589fb80932b5 | 3 | * @author Ernesto Palacios |
Yo_Robot | 3:589fb80932b5 | 4 | * @brief Source Code for the Operator of Matrix Class. |
Yo_Robot | 3:589fb80932b5 | 5 | * |
Yo_Robot | 3:589fb80932b5 | 6 | * Created on September 2011. |
Yo_Robot | 3:589fb80932b5 | 7 | * |
Yo_Robot | 3:589fb80932b5 | 8 | */ |
Yo_Robot | 3:589fb80932b5 | 9 | #include "mbed.h" |
Yo_Robot | 3:589fb80932b5 | 10 | #include "Matrix.h" |
Yo_Robot | 3:589fb80932b5 | 11 | |
Yo_Robot | 3:589fb80932b5 | 12 | /// Overloaded Asign Operator. Resizes Matrix |
Yo_Robot | 3:589fb80932b5 | 13 | Matrix& Matrix::operator = ( const Matrix& rightM ) |
Yo_Robot | 3:589fb80932b5 | 14 | { |
Yo_Robot | 3:589fb80932b5 | 15 | if (this != &rightM ) |
Yo_Robot | 3:589fb80932b5 | 16 | { |
Yo_Robot | 3:589fb80932b5 | 17 | |
Yo_Robot | 3:589fb80932b5 | 18 | _nRows = rightM._nRows; |
Yo_Robot | 3:589fb80932b5 | 19 | _nCols = rightM._nCols; |
Yo_Robot | 3:589fb80932b5 | 20 | |
Yo_Robot | 3:589fb80932b5 | 21 | _matrix.resize( rightM._nRows ); |
Yo_Robot | 3:589fb80932b5 | 22 | for( int i = 0; i < rightM._nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 23 | _matrix [i].resize(rightM._nCols); |
Yo_Robot | 3:589fb80932b5 | 24 | |
Yo_Robot | 3:589fb80932b5 | 25 | for( int i = 0; i < _nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 26 | for( int j = 0; j < _nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 27 | _matrix[i][j] = rightM._matrix[i][j]; |
Yo_Robot | 3:589fb80932b5 | 28 | } |
Yo_Robot | 3:589fb80932b5 | 29 | return *this; |
Yo_Robot | 3:589fb80932b5 | 30 | |
Yo_Robot | 3:589fb80932b5 | 31 | } |
Yo_Robot | 3:589fb80932b5 | 32 | |
Yo_Robot | 3:589fb80932b5 | 33 | /// Comapre element by element |
Yo_Robot | 3:589fb80932b5 | 34 | bool Matrix::operator == ( const Matrix& rightM ) |
Yo_Robot | 3:589fb80932b5 | 35 | { |
Yo_Robot | 3:589fb80932b5 | 36 | if( _nRows == rightM._nRows && _nCols == rightM._nCols ) |
Yo_Robot | 3:589fb80932b5 | 37 | { |
Yo_Robot | 3:589fb80932b5 | 38 | bool equal = false; |
Yo_Robot | 3:589fb80932b5 | 39 | |
Yo_Robot | 3:589fb80932b5 | 40 | for( int i = 0; i < _nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 41 | for( int j = 0; j < _nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 42 | if( _matrix[i][j] != rightM._matrix[i][j] ) |
Yo_Robot | 3:589fb80932b5 | 43 | equal = equal || true; |
Yo_Robot | 3:589fb80932b5 | 44 | |
Yo_Robot | 3:589fb80932b5 | 45 | return !equal; |
Yo_Robot | 3:589fb80932b5 | 46 | |
Yo_Robot | 3:589fb80932b5 | 47 | }else{ return false; } |
Yo_Robot | 3:589fb80932b5 | 48 | } |
Yo_Robot | 3:589fb80932b5 | 49 | |
Yo_Robot | 3:589fb80932b5 | 50 | |
Yo_Robot | 3:589fb80932b5 | 51 | /// Calls for '==' operator |
Yo_Robot | 3:589fb80932b5 | 52 | bool Matrix::operator != ( const Matrix& rightM ) |
Yo_Robot | 3:589fb80932b5 | 53 | { |
Yo_Robot | 3:589fb80932b5 | 54 | return !( *this == rightM ); |
Yo_Robot | 3:589fb80932b5 | 55 | } |
Yo_Robot | 3:589fb80932b5 | 56 | |
Yo_Robot | 3:589fb80932b5 | 57 | |
Yo_Robot | 3:589fb80932b5 | 58 | /// Matrices must be same size. |
Yo_Robot | 3:589fb80932b5 | 59 | /// Element by element adition. |
Yo_Robot | 3:589fb80932b5 | 60 | Matrix& Matrix::operator +=(const Matrix& rightM) |
Yo_Robot | 3:589fb80932b5 | 61 | { |
Yo_Robot | 3:589fb80932b5 | 62 | if( _nRows == rightM._nRows && _nCols == rightM._nCols ) |
Yo_Robot | 3:589fb80932b5 | 63 | { |
Yo_Robot | 3:589fb80932b5 | 64 | for( int i = 0; i < _nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 65 | for( int j = 0; j < _nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 66 | _matrix[i][j] += rightM._matrix[i][j]; |
Yo_Robot | 3:589fb80932b5 | 67 | |
Yo_Robot | 3:589fb80932b5 | 68 | return *this; |
Yo_Robot | 3:589fb80932b5 | 69 | |
Yo_Robot | 3:589fb80932b5 | 70 | }else{ |
Yo_Robot | 3:589fb80932b5 | 71 | printf( "\n\nERROR\nDiferent Dimensions @ += operator\n" ); |
Yo_Robot | 3:589fb80932b5 | 72 | //Matrix error(4); |
Yo_Robot | 3:589fb80932b5 | 73 | //error.Clear(); |
Yo_Robot | 3:589fb80932b5 | 74 | //return error; |
Yo_Robot | 3:589fb80932b5 | 75 | } |
Yo_Robot | 3:589fb80932b5 | 76 | } |
Yo_Robot | 3:589fb80932b5 | 77 | |
Yo_Robot | 3:589fb80932b5 | 78 | |
Yo_Robot | 3:589fb80932b5 | 79 | /// Matrices must be same size. |
Yo_Robot | 3:589fb80932b5 | 80 | /// Element by element Substraction |
Yo_Robot | 3:589fb80932b5 | 81 | Matrix& Matrix::operator -=(const Matrix& rightM) |
Yo_Robot | 3:589fb80932b5 | 82 | { |
Yo_Robot | 3:589fb80932b5 | 83 | if( _nRows == rightM._nRows && _nCols == rightM._nCols ) |
Yo_Robot | 3:589fb80932b5 | 84 | { |
Yo_Robot | 3:589fb80932b5 | 85 | for( int i = 0; i < _nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 86 | for( int j = 0; j < _nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 87 | _matrix[i][j] -= rightM._matrix[i][j]; |
Yo_Robot | 3:589fb80932b5 | 88 | |
Yo_Robot | 3:589fb80932b5 | 89 | return *this; |
Yo_Robot | 3:589fb80932b5 | 90 | |
Yo_Robot | 3:589fb80932b5 | 91 | }else{ |
Yo_Robot | 3:589fb80932b5 | 92 | printf( "\n\nERROR\nDiferent Dimensions @ -= operator \n" ); |
Yo_Robot | 3:589fb80932b5 | 93 | } |
Yo_Robot | 3:589fb80932b5 | 94 | } |
Yo_Robot | 3:589fb80932b5 | 95 | |
Yo_Robot | 3:589fb80932b5 | 96 | |
Yo_Robot | 3:589fb80932b5 | 97 | Matrix& Matrix::operator *=( const Matrix& rightM ) |
Yo_Robot | 3:589fb80932b5 | 98 | { |
Yo_Robot | 3:589fb80932b5 | 99 | if( this->_nCols == rightM._nRows ) |
Yo_Robot | 3:589fb80932b5 | 100 | { |
Yo_Robot | 3:589fb80932b5 | 101 | Matrix resultM ( this->_nRows, rightM._nCols ); |
Yo_Robot | 3:589fb80932b5 | 102 | |
Yo_Robot | 3:589fb80932b5 | 103 | for( int i = 0; i < resultM._nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 104 | for( int j = 0; j < resultM._nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 105 | for( int m = 0; m < rightM._nRows; m++ ) |
Yo_Robot | 3:589fb80932b5 | 106 | resultM._matrix[i][j] += this->_matrix[i][m] * rightM._matrix[m][j]; |
Yo_Robot | 3:589fb80932b5 | 107 | |
Yo_Robot | 3:589fb80932b5 | 108 | *this = resultM; |
Yo_Robot | 3:589fb80932b5 | 109 | } |
Yo_Robot | 3:589fb80932b5 | 110 | |
Yo_Robot | 3:589fb80932b5 | 111 | return *this; |
Yo_Robot | 3:589fb80932b5 | 112 | } |
Yo_Robot | 3:589fb80932b5 | 113 | |
Yo_Robot | 3:589fb80932b5 | 114 | |
Yo_Robot | 3:589fb80932b5 | 115 | Matrix& Matrix::operator *=(float number) |
Yo_Robot | 3:589fb80932b5 | 116 | { |
Yo_Robot | 3:589fb80932b5 | 117 | for( int i = 0; i < _nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 118 | for( int j = 0; j < _nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 119 | _matrix[i][j] *= number; |
Yo_Robot | 3:589fb80932b5 | 120 | |
Yo_Robot | 3:589fb80932b5 | 121 | return *this; |
Yo_Robot | 3:589fb80932b5 | 122 | } |
Yo_Robot | 3:589fb80932b5 | 123 | |
Yo_Robot | 3:589fb80932b5 | 124 | |
Yo_Robot | 3:589fb80932b5 | 125 | const Matrix Matrix::operator -() |
Yo_Robot | 3:589fb80932b5 | 126 | { |
Yo_Robot | 3:589fb80932b5 | 127 | Matrix result( _nRows, _nCols ); |
Yo_Robot | 3:589fb80932b5 | 128 | |
Yo_Robot | 3:589fb80932b5 | 129 | for( int i = 0; i < _nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 130 | for( int j = 0; j < _nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 131 | result._matrix[i][j] = _matrix[i][j] * -1; |
Yo_Robot | 3:589fb80932b5 | 132 | |
Yo_Robot | 3:589fb80932b5 | 133 | return result; |
Yo_Robot | 3:589fb80932b5 | 134 | } |
Yo_Robot | 3:589fb80932b5 | 135 | |
Yo_Robot | 3:589fb80932b5 | 136 | /*****************************************************************************/ |
Yo_Robot | 3:589fb80932b5 | 137 | |
Yo_Robot | 3:589fb80932b5 | 138 | // Overload operators |
Yo_Robot | 3:589fb80932b5 | 139 | |
Yo_Robot | 3:589fb80932b5 | 140 | |
Yo_Robot | 3:589fb80932b5 | 141 | const Matrix operator +=( Matrix& leftM, float number ) |
Yo_Robot | 3:589fb80932b5 | 142 | { |
Yo_Robot | 3:589fb80932b5 | 143 | for( int i = 0; i < leftM._nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 144 | for( int j = 0; j < leftM._nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 145 | leftM._matrix[i][j] += number; |
Yo_Robot | 3:589fb80932b5 | 146 | return leftM; |
Yo_Robot | 3:589fb80932b5 | 147 | } |
Yo_Robot | 3:589fb80932b5 | 148 | |
Yo_Robot | 3:589fb80932b5 | 149 | |
Yo_Robot | 3:589fb80932b5 | 150 | const Matrix operator -=( Matrix& leftM, float number ) |
Yo_Robot | 3:589fb80932b5 | 151 | { |
Yo_Robot | 3:589fb80932b5 | 152 | for( int i = 0; i < leftM._nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 153 | for( int j = 0; j < leftM._nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 154 | leftM._matrix[i][j] -= number; |
Yo_Robot | 3:589fb80932b5 | 155 | return leftM; |
Yo_Robot | 3:589fb80932b5 | 156 | } |
Yo_Robot | 3:589fb80932b5 | 157 | |
Yo_Robot | 3:589fb80932b5 | 158 | |
Yo_Robot | 3:589fb80932b5 | 159 | const Matrix operator +( const Matrix& leftM, const Matrix& rightM) |
Yo_Robot | 3:589fb80932b5 | 160 | { |
Yo_Robot | 3:589fb80932b5 | 161 | if( leftM._nRows == rightM._nRows && leftM._nCols == rightM._nCols ) |
Yo_Robot | 3:589fb80932b5 | 162 | { |
Yo_Robot | 3:589fb80932b5 | 163 | Matrix result( leftM._nRows, leftM._nCols ); |
Yo_Robot | 3:589fb80932b5 | 164 | |
Yo_Robot | 3:589fb80932b5 | 165 | for( int i = 0; i < leftM._nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 166 | for( int j = 0; j < leftM._nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 167 | result._matrix[i][j] = leftM._matrix[i][j] + rightM._matrix[i][j]; |
Yo_Robot | 3:589fb80932b5 | 168 | |
Yo_Robot | 3:589fb80932b5 | 169 | return result; |
Yo_Robot | 3:589fb80932b5 | 170 | |
Yo_Robot | 3:589fb80932b5 | 171 | }else{ |
Yo_Robot | 3:589fb80932b5 | 172 | printf( "\n\nERROR\nDiferent Dimensions @ + operator \n" ); |
Yo_Robot | 3:589fb80932b5 | 173 | //Matrix error(4); |
Yo_Robot | 3:589fb80932b5 | 174 | //error.Clear(); |
Yo_Robot | 3:589fb80932b5 | 175 | //return error; |
Yo_Robot | 3:589fb80932b5 | 176 | } |
Yo_Robot | 3:589fb80932b5 | 177 | } |
Yo_Robot | 3:589fb80932b5 | 178 | |
Yo_Robot | 3:589fb80932b5 | 179 | |
Yo_Robot | 3:589fb80932b5 | 180 | const Matrix operator +( const Matrix& leftM, float number ) |
Yo_Robot | 3:589fb80932b5 | 181 | { |
Yo_Robot | 3:589fb80932b5 | 182 | Matrix result( leftM._nRows, leftM._nCols ); |
Yo_Robot | 3:589fb80932b5 | 183 | |
Yo_Robot | 3:589fb80932b5 | 184 | for( int i = 0; i < leftM._nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 185 | for( int j = 0; j < leftM._nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 186 | result._matrix[i][j] = leftM._matrix[i][j] + number; |
Yo_Robot | 3:589fb80932b5 | 187 | |
Yo_Robot | 3:589fb80932b5 | 188 | return result; |
Yo_Robot | 3:589fb80932b5 | 189 | } |
Yo_Robot | 3:589fb80932b5 | 190 | |
Yo_Robot | 3:589fb80932b5 | 191 | |
Yo_Robot | 3:589fb80932b5 | 192 | const Matrix operator +( float number, const Matrix& leftM ) |
Yo_Robot | 3:589fb80932b5 | 193 | { |
Yo_Robot | 3:589fb80932b5 | 194 | return ( leftM + number ); |
Yo_Robot | 3:589fb80932b5 | 195 | } |
Yo_Robot | 3:589fb80932b5 | 196 | |
Yo_Robot | 3:589fb80932b5 | 197 | |
Yo_Robot | 3:589fb80932b5 | 198 | const Matrix operator -( const Matrix& leftM, const Matrix& rightM ) |
Yo_Robot | 3:589fb80932b5 | 199 | { |
Yo_Robot | 3:589fb80932b5 | 200 | if( leftM._nRows == rightM._nRows && leftM._nCols == rightM._nCols ) |
Yo_Robot | 3:589fb80932b5 | 201 | { |
Yo_Robot | 3:589fb80932b5 | 202 | Matrix result( leftM._nRows, leftM._nCols ); |
Yo_Robot | 3:589fb80932b5 | 203 | |
Yo_Robot | 3:589fb80932b5 | 204 | for( int i = 0; i < leftM._nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 205 | for( int j = 0; j < leftM._nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 206 | result._matrix[i][j] = leftM._matrix[i][j] - rightM._matrix[i][j]; |
Yo_Robot | 3:589fb80932b5 | 207 | |
Yo_Robot | 3:589fb80932b5 | 208 | return result; |
Yo_Robot | 3:589fb80932b5 | 209 | |
Yo_Robot | 3:589fb80932b5 | 210 | }else{ |
Yo_Robot | 3:589fb80932b5 | 211 | printf( "\n\nERROR:\nDiferent Dimensions @ + operator \n" ); |
Yo_Robot | 3:589fb80932b5 | 212 | |
Yo_Robot | 3:589fb80932b5 | 213 | } |
Yo_Robot | 3:589fb80932b5 | 214 | } |
Yo_Robot | 3:589fb80932b5 | 215 | |
Yo_Robot | 3:589fb80932b5 | 216 | |
Yo_Robot | 3:589fb80932b5 | 217 | const Matrix operator -( const Matrix& leftM, float number ) |
Yo_Robot | 3:589fb80932b5 | 218 | { |
Yo_Robot | 3:589fb80932b5 | 219 | Matrix result( leftM._nRows, leftM._nCols ); |
Yo_Robot | 3:589fb80932b5 | 220 | |
Yo_Robot | 3:589fb80932b5 | 221 | for( int i = 0; i < leftM._nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 222 | for( int j = 0; j < leftM._nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 223 | result._matrix[i][j] = leftM._matrix[i][j] - number; |
Yo_Robot | 3:589fb80932b5 | 224 | |
Yo_Robot | 3:589fb80932b5 | 225 | return result; |
Yo_Robot | 3:589fb80932b5 | 226 | } |
Yo_Robot | 3:589fb80932b5 | 227 | |
Yo_Robot | 3:589fb80932b5 | 228 | |
Yo_Robot | 3:589fb80932b5 | 229 | const Matrix operator -( float number, const Matrix& leftM ) |
Yo_Robot | 3:589fb80932b5 | 230 | { |
Yo_Robot | 3:589fb80932b5 | 231 | return ( leftM - number ); |
Yo_Robot | 3:589fb80932b5 | 232 | } |
Yo_Robot | 3:589fb80932b5 | 233 | |
Yo_Robot | 3:589fb80932b5 | 234 | |
Yo_Robot | 3:589fb80932b5 | 235 | const Matrix operator *( const Matrix& leftM, const Matrix& rightM ) |
Yo_Robot | 3:589fb80932b5 | 236 | { |
Yo_Robot | 3:589fb80932b5 | 237 | if( leftM._nCols == rightM._nRows ) |
Yo_Robot | 3:589fb80932b5 | 238 | { |
Yo_Robot | 3:589fb80932b5 | 239 | Matrix resultM ( leftM._nRows, rightM._nCols ); |
Yo_Robot | 3:589fb80932b5 | 240 | resultM.Clear(); |
Yo_Robot | 3:589fb80932b5 | 241 | |
Yo_Robot | 3:589fb80932b5 | 242 | for( int i = 0; i < resultM._nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 243 | for( int j = 0; j < resultM._nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 244 | for( int m = 0; m < rightM._nRows; m++ ) |
Yo_Robot | 3:589fb80932b5 | 245 | resultM._matrix[i][j] += leftM._matrix[i][m] * rightM._matrix[m][j]; |
Yo_Robot | 3:589fb80932b5 | 246 | |
Yo_Robot | 3:589fb80932b5 | 247 | return resultM; |
Yo_Robot | 3:589fb80932b5 | 248 | |
Yo_Robot | 3:589fb80932b5 | 249 | } else { |
Yo_Robot | 3:589fb80932b5 | 250 | |
Yo_Robot | 3:589fb80932b5 | 251 | printf("\n\nERROR:\nDiferent Dimension matrices @ * operator"); |
Yo_Robot | 3:589fb80932b5 | 252 | } |
Yo_Robot | 3:589fb80932b5 | 253 | |
Yo_Robot | 3:589fb80932b5 | 254 | } |
Yo_Robot | 3:589fb80932b5 | 255 | |
Yo_Robot | 3:589fb80932b5 | 256 | |
Yo_Robot | 3:589fb80932b5 | 257 | const Matrix operator *( const Matrix& leftM, float number ) |
Yo_Robot | 3:589fb80932b5 | 258 | { |
Yo_Robot | 3:589fb80932b5 | 259 | Matrix result( leftM._nRows, leftM._nCols ); |
Yo_Robot | 3:589fb80932b5 | 260 | |
Yo_Robot | 3:589fb80932b5 | 261 | for( int i = 0; i < leftM._nRows; i++ ) |
Yo_Robot | 3:589fb80932b5 | 262 | for( int j = 0; j < leftM._nCols; j++ ) |
Yo_Robot | 3:589fb80932b5 | 263 | result._matrix[i][j] = leftM._matrix[i][j] * number; |
Yo_Robot | 3:589fb80932b5 | 264 | |
Yo_Robot | 3:589fb80932b5 | 265 | return result; |
Yo_Robot | 3:589fb80932b5 | 266 | } |
Yo_Robot | 3:589fb80932b5 | 267 | |
Yo_Robot | 3:589fb80932b5 | 268 | const Matrix operator *( float number, const Matrix& leftM ) |
Yo_Robot | 3:589fb80932b5 | 269 | { |
Yo_Robot | 3:589fb80932b5 | 270 | return ( leftM * number ); |
Yo_Robot | 3:589fb80932b5 | 271 | } |
Yo_Robot | 3:589fb80932b5 | 272 | |
Yo_Robot | 3:589fb80932b5 | 273 | |
Yo_Robot | 3:589fb80932b5 | 274 | Matrix& operator <<( Matrix& leftM, float number ) |
Yo_Robot | 3:589fb80932b5 | 275 | { |
Yo_Robot | 3:589fb80932b5 | 276 | if( leftM._pCol == leftM._nCols ) //end of Row |
Yo_Robot | 3:589fb80932b5 | 277 | { |
Yo_Robot | 3:589fb80932b5 | 278 | leftM._pCol = 0; |
Yo_Robot | 3:589fb80932b5 | 279 | leftM._pRow++; |
Yo_Robot | 3:589fb80932b5 | 280 | } |
Yo_Robot | 3:589fb80932b5 | 281 | if( leftM._pRow > leftM._nRows ) |
Yo_Robot | 3:589fb80932b5 | 282 | { |
Yo_Robot | 3:589fb80932b5 | 283 | printf( "\n\nERROR:\nAssignment out of limits @ << operator" ); |
Yo_Robot | 3:589fb80932b5 | 284 | return leftM; |
Yo_Robot | 3:589fb80932b5 | 285 | |
Yo_Robot | 3:589fb80932b5 | 286 | }else{ |
Yo_Robot | 3:589fb80932b5 | 287 | |
Yo_Robot | 3:589fb80932b5 | 288 | leftM._matrix[ leftM._pRow ][ leftM._pCol ] = number; |
Yo_Robot | 3:589fb80932b5 | 289 | leftM._pCol++; |
Yo_Robot | 3:589fb80932b5 | 290 | |
Yo_Robot | 3:589fb80932b5 | 291 | return leftM; |
Yo_Robot | 3:589fb80932b5 | 292 | } |
Yo_Robot | 3:589fb80932b5 | 293 | } |
Yo_Robot | 3:589fb80932b5 | 294 |