Question: There is lab07_functions.h Using C++,thanks. #ifndef MATRIX_TYPE #define MATRIX_TYPE #include using std::string; #include using std::vector; /* very convenient. If you want to change the type

 There is lab07_functions.h Using C++,thanks. #ifndef MATRIX_TYPE #define MATRIX_TYPE #include usingstd::string; #include using std::vector; /* very convenient. If you want to changethe type stored in the matrix, you only have to change thesingle template type in matrix_row */ using matrix_row = vector; using matrix

There is lab07_functions.h Using C++,thanks.
#ifndef MATRIX_TYPE #define MATRIX_TYPE #include using std::string; #include using std::vector; /* very convenient. If you want to change the type stored in the matrix, you only have to change the single template type in matrix_row */ using matrix_row = vector; using matrix = vector; /* nicely print a matrix. Should have row/column alignment converts it to a string (doesn't print to cout!!!) uses width to space elements (setw). Default is 3 */ string matrix_to_str(const matrix &m1, size_t width=3); /* true if the two matrices have the same shape false otherwise */ bool same_size(matrix &m1, matrix &m2); /* matrices must not be empty and must be the same shape: - if true, return a new matrix that adds m1+m2 - if false, return an empty matrix (no elements) */ matrix add(matrix &m1, matrix &m2); /* matrix must not be empty: - if true, multiply T scalar value by m - if false, return empty matrix (no elements) */ matrix scalar_multiply(matrix &m, long val); #endif

The Problem We are going to work on 2D vectors 2D vector as a matrix You remember matrices, don't you? We are going to do some simple manipulation ofa matrix, namely: adding two matrices and multiplying a matrix by a scalar. You watched the 2D vector video, right? RIGHT??? Matrix A matrix is a 2-dimensional (rows and columns) data structure. It has a shape indicated by the number of rows and the number of columns. Though I suppose a matrix could have uneven sized rows, this doesn't usually happen in practice so a matrix is always rectangular, potentially square (based on its shape)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!