/*
 * main.cpp
 *
 *  Created on: 26-dic-2009
 *      Author: rafa
 */

#include "matrix.h"
#include <iostream>

using namespace std;
using namespace storage;

//Template function that prints a matrix

template<class Type>
void print(Matrix<Type> &M){

	for(unsigned int i=0; i<M.getNRows(); i++){
		for(unsigned int j=0; j<M.getNCols(); j++)
			cout << M.get(i, j) << " ";
		cout << endl;
	}
}

int main(int argc, char **argv){

	Matrix<float> M;

	M.resize(10, 10);
	M.setIdentity();
	print(M);

	Matrix<float> M2(M);

	print(M2);

	Matrix<float> M3(10, 10);

	M3 = M+M2;
	print(M3);

	//check the result
	for(unsigned int i=0; i<M3.getNRows(); i++){
		for(unsigned int j=0; j<M3.getNCols(); j++){
			if(i!=j)
				assert(M3.get(i, j) == 0);
			else
				assert(M3.get(i, j) == 2);
		}
	}

	cout << "Perfect" << endl;
}
