void testSimpleMatrixMultiplyInequalSize() { SimpleVector v = createSimpleVector(3); SimpleMatrix m = createSimpleMatrix(2, 2); try { m.multiplyLeft(v); BOOST_ERROR( "Exception should have been thrown!" ); } catch (const char* e) { } try { m.multiplyRight(v); BOOST_ERROR( "Exception should have been thrown!" ); } catch (const char* e) { } }
void testSimpleMatrixMultiplyRight() { SimpleVector v = SimpleVector(3); SimpleMatrix m = createSimpleMatrix(2, 3); v.setElement(0, 3); v.setElement(1, 2); v.setElement(2, 1); // [0,1,2] * [3] = [4] // [0,1,2] [2] [4] // [1] Vector* res = m.multiplyRight(v); BOOST_CHECK( res->size() == 2 ); BOOST_CHECK( res->getElement(0) == 4 ); BOOST_CHECK( res->getElement(1) == 4 ); delete res; }