diff -r ee5959aa4410 -r c280de819a73 src/work/alpar/matrix.cc --- a/src/work/alpar/matrix.cc Sun Apr 17 18:57:22 2005 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -#include -#include - -template -class Matrix -{ -public: - int m,n; - std::vector values; - - Matrix(int _m, int _n) : m(_m), n(_n), values(n*m) {} - typename std::vector::reference operator()(int i, int j) - { return values[i*n+j];} - - class Row - { - public: - Matrix &mat; - int row; - - Row(Matrix &_mat,int _row) : mat(_mat), row(_row) {} - typename std::vector::reference operator()(int j) - { return mat.values[row*mat.n+j];} - }; - class Column - { - public: - Matrix &mat; - int col; - - Column(Matrix &_mat,int _col) : mat(_mat), col(_col) {} - typename std::vector::reference operator[](int i) - { return mat.values[i*mat.n+col];} - }; - - Row operator[](int i) { return Row(*this,i); } - Column operator()(int j) { return Column(*this,j); } -}; - -main() -{ - const int COUNT=1000000; - const int SIZE=100; - - Matrix A(SIZE,SIZE); - - for(int i=0;i