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

Saint Louis University

Computer Science 146
Object-Oriented Practicum

Michael Goldwasser

Spring 2011

Dept. of Math & Computer Science

Assignment 07

Matrix proxy class (first draft)

Overview

Topic: Matrix proxy class (first draft)
Due: 11:59pm Wednesday, 6 April 2011

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(1,3,1) << endl;      // add a submatrix to some other matrix
  matrix B(A(range(0,2), range(0,4)));                     // create a new (independent) matrix based on a submatrix
Your task is to modify the code base so that 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 any files that you modify, together with a readme.txt file that gives an overview of your changes.
Michael Goldwasser
CSCI 146, Spring 2011
Last modified: Thursday, 24 March 2011
Course Home | Assignments | Computing Resources | Lab Hours/Tutoring | Schedule