kernel-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_KERNEL_MATRIX_H
00008 #define KERNEL_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 KernelMatrix {
00019  public:
00021    KernelMatrix() { }
00022 
00024    KernelMatrix(int size);
00025 
00027    int GetSize() const;
00028 
00030    void Normalize();
00031 
00033 
00039    void NormalizeByMinCardinality(const vector<int>& cards);
00040 
00042 
00047    void Resize(int new_size);
00048    
00050 
00055    double& at(int row, int col);
00056 
00058    double at(int row, int col) const;
00059 
00061 
00071    void WriteToStream(ostream& output_stream) const;
00072 
00074 
00077    void WriteToFile(const char* filename) const;
00078 
00080 
00084    void ReadFromStream(istream& input_stream);
00085 
00087 
00090    void ReadFromFile(const char* filename);
00091 
00092  private:
00093    // Internally, we represent a kernel matrix as a triangle. Row 0
00094    // has 1 entry, row 1 has 2 entries, etc.
00095    vector<vector<double> > matrix_;
00096    
00097 };
00098 }  // namespace libpmk_util
00099 
00100 #endif  // KERNEL_KERNEL_MATRIX_H

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