parallel_programming Lab 1-Matrix Solved

30.00 $

Description

5/5 - (1 vote)

Part I : Matrix

  1. Write a class Column_Major_Matrix that has a member all_column which is

    of type vector<vector<T>>

  2. Write a class Row_Major_Matrix that has a member all_row which is of type

    vector<vector<T>>

  3. Provide a constructor for each class that takes arguments to specify the

    dimensions (e.g., Column_Major_Matrix<int> cc1 (1000, 1000); ), and fills up all

    elements by randomly generated values of type T.

  4. Provide getter/setter function to access each column and row by an index.
  5. Overload copy/assignment and move copy/assignment operator to allow the

    following in the main function:

    Column_Major_Matrix<int> cc1 (1000, 1000); Row_Major_Matrix<int> rr1( 1000, 1000); Column_Major_Matrix<int> cc2 (cc1); Row_Major_Matrix<int> rr2 = (rr1); Column_Major_Matrix<int> cc3 = std::move( cc2 ); Row_Major_Matrix<int> rr3 = std::move( rr2 );

  6. Overload operator* in Row_Major_Matrix to allow calculation of the product of a Row_Major_Matrix instance to a Column_Major_Matrix instance, and return the resultant product as a Row_Major_Matrix.
  7. Overload operator* in Column_Major_Matrix to allow calculation of the product of a Column_Major_Matrix instance to a Row_Major_Matrix instance, and return the resultant product as a Column_Major_Matrix.
  8. Write type conversion operators (i.e., operator Row_Major_Matrix() and operator Column_Major_Matrix() ) to allow implicit type conversion between Row_Major_Matrix and Column_Major_Matrix. Show it works by:

    Column_Major_Matrix<int> cc (55, 1000); Row_Major_Matrix<int> rr (1000, 66); Row_Major_Matrix<int> rr = cc*rr;

  9. Overload operator% to use exactly 10 threads to multiplex the multiplication, and use std::chrono to show the speedup w/ and w/o multithreading.
  • Lab1_matrix-lefxsm.zip