@@ -84,21 +84,21 @@ int main(int, char *[]) {
8484
8585// Print the stuff out
8686//
87- std::cout <<" Row matrix\n " ;
88- for (long r =0 ; r < row_mat.rows (); ++r) {
89- for (long c =0 ; c < row_mat.cols (); ++c) {
90- std::cout <<row_mat (r, c) <<" ," ;
91- }
92- std::cout <<' \n ' ;
93- }
94- std::cout <<" \n\n " ;
95- std::cout <<" Column matrix\n " ;
96- for (long r =0 ; r < col_mat.rows (); ++r) {
97- for (long c =0 ; c < col_mat.cols (); ++c) {
98- std::cout <<col_mat (r, c) <<" ," ;
99- }
100- std::cout <<' \n ' ;
101- }
87+ // std::cout << "Row matrix\n";
88+ // for (long r = 0; r < row_mat.rows(); ++r) {
89+ // for (long c = 0; c < row_mat.cols(); ++c) {
90+ // std::cout << row_mat(r, c) << ", ";
91+ // }
92+ // std::cout << '\n';
93+ // }
94+ // std::cout << "\n\n";
95+ // std::cout << "Column matrix\n";
96+ // for (long r = 0; r < col_mat.rows(); ++r) {
97+ // for (long c = 0; c < col_mat.cols(); ++c) {
98+ // std::cout << col_mat(r, c) << ", ";
99+ // }
100+ // std::cout << '\n';
101+ // }
102102
103103// Testing symmetrix matrices
104104//
@@ -270,7 +270,7 @@ int main(int, char *[]) {
270270assert (big_multi_mat (2 ,5 ) ==30300 );
271271 }
272272
273- // Testing vector matrixmultilications
273+ // Testing vector matrixmultiplication
274274//
275275 {
276276row_mat_t row_mat {5 ,6 };
@@ -290,9 +290,36 @@ int main(int, char *[]) {
290290 rhs[5 ] =10 ;
291291
292292const auto result1 = lhs * row_mat;
293+
294+ assert (result1.rows () ==1 );
295+ assert (result1.cols () ==6 );
296+ assert (result1 (0 ,0 ) ==1530 );
297+ assert (result1 (0 ,3 ) ==1800 );
298+ assert (result1 (0 ,5 ) ==1980 );
299+
293300const auto result2 = lhs * col_mat;
301+
302+ assert (result2.rows () ==1 );
303+ assert (result2.cols () ==6 );
304+ assert (result2 (0 ,0 ) ==1530 );
305+ assert (result2 (0 ,3 ) ==1800 );
306+ assert (result2 (0 ,5 ) ==1980 );
307+
294308const auto result3 = row_mat * rhs;
309+
310+ assert (result3.rows () ==5 );
311+ assert (result3.cols () ==1 );
312+ assert (result3 (0 ,0 ) ==390 );
313+ assert (result3 (2 ,0 ) ==1590 );
314+ assert (result3 (4 ,0 ) ==2790 );
315+
295316const auto result4 = col_mat * rhs;
317+
318+ assert (result4.rows () ==5 );
319+ assert (result4.cols () ==1 );
320+ assert (result4 (0 ,0 ) ==390 );
321+ assert (result4 (2 ,0 ) ==1590 );
322+ assert (result4 (4 ,0 ) ==2790 );
296323 }
297324
298325// Test Inverse