Course Home | Assignments | Computing Resources | Lab Hours/Tutoring | Schedule

Saint Louis University

Computer Science 146
Object-Oriented Practicum

Michael Goldwasser

Fall 2010

Dept. of Math & Computer Science

Assignment 07

Matrix proxy class (first draft)

Overview

Topic: Matrix proxy class (first draft)
Due: 11:59pm Tuesday, 26 October 2010

Please make sure you adhere to the policies on academic integrity.


Introduction

In class, we have begun discussions of what it might take to provide support for using ranges to describe submatrices in expressions that mutate the original matrix. For example, we would like support for behaviors such as

A(range(3,5), range(4,8)) = B;     // assuming B is matrix with proper size
The solution that we have described is to use what is known as a Proxy design pattern, in which we make a second class that serves as an intermediary for providing a public view of a submatrix while internally refering to the original values of the matrix.

Unfortunately, our initial solution is incomplete. Here are some examples of syntaxes that are still illegal with our current codebase:

  cout << A(2, range(3,2,9)) + A(4, range(0,3)) << endl;   // add two submatrices with equal size
  cout << A(2, range(3,2,9)) + matrix(3,3,1) << endl;      // add a submatrix to some other matrix
Your task is to modify the code for our proxy class so that both of the above syntaxes are supported with natural semantics.


Files we are providing

If working on turing, change directories into a desired subdirectory of your home folder if desired, and to execute the following command verbatim

  cp -R /Public/goldwasser/146/asgn07 .
This will cause a new folder named asgn07 to appear in your working directory including all files that you need for this assignment. Alternatively, these files can be downloaded individual from this website. The matrix definition is essentially the same one we have been using for past assignments. However, we have written a new driver for this assignment to make it easier for you to test your code. That driver is named test and can be built with the make command.

We have changed our codebase a bit from past assignments. In particular, we have divide the code across several additional files.


Submitting your project

Attach an updated version of matrix_proxy.h to an email.


Michael Goldwasser
CSCI 146, Fall 2010
Last modified: Tuesday, 19 October 2010
Course Home | Assignments | Computing Resources | Lab Hours/Tutoring | Schedule