matrix.h

Go to the documentation of this file.
00001 // Copyright 2007, Massachusetts Institute of Technology.
00002 // The use of this code is permitted for research only. There is
00003 // absolutely no warranty for this software.
00004 //
00005 // Author: John Lee (jjl@mit.edu)
00006 //
00007 #ifndef KERNEL_MATRIX_H
00008 #define KERNEL_MATRIX_H
00009 
00010 #include <vector>
00011 #include <string>
00012 #include <iostream>
00013 
00014 using namespace std;
00015 
00016 namespace libpmk_util {
00018 class Matrix {
00019  public:
00021    Matrix() { }
00022 
00024    Matrix(int rows, int cols);
00025 
00027    int GetNumRows() const;
00028 
00030    int GetNumCols() const;
00031 
00033 
00037    void Resize(int new_rows, int new_cols);
00038    
00040    double& at(int row, int col);
00041 
00043    double at(int row, int col) const;
00044 
00046 
00056    void WriteToStream(ostream& output_stream) const;
00057 
00059 
00062    void WriteToFile(const char* filename) const;
00063 
00065 
00069    void ReadFromStream(istream& input_stream);
00070 
00072 
00075    void ReadFromFile(const char* filename);
00076 
00077  private:
00078    vector<vector<double> > matrix_;
00079    int num_rows_;
00080    int num_cols_;
00081    
00082 };
00083 }  // namespace libpmk_util
00084 
00085 #endif  // KERNEL_MATRIX_H

Generated on Wed May 2 11:17:12 2007 for libpmk by  doxygen 1.5.1