Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

FeatureMap.h

00001 #ifndef _FEATURE_MAP_H_
00002 #define _FEATURE_MAP_H_
00003 
00004 // Copyright (C) 2001 Jean-Marc Valin
00005 
00006 #include <math.h>
00007 #include <vector>
00008 #include <iostream>
00009 #include "Object.h"
00010 
00011 namespace FD {
00012 
00013 class FeatureMap;
00014 
00015 std::ostream &operator << (std::ostream &out, const FeatureMap &cell);
00016 
00017 
00018 class FeatureMap : public Object {
00019 protected:
00020    int inDimension;
00021    int outDimension;
00022    bool terminal;
00023    FeatureMap *first;
00024    FeatureMap *second;
00025    float threshold;
00026    int splitDimension;
00027    int cellID;
00028    std::vector<float> mapData;
00029 public:
00030    FeatureMap(int _inDimension, int _outDimension) 
00031       : inDimension(_inDimension)
00032       , outDimension(_outDimension)
00033       , terminal(true)
00034       , first(NULL)
00035       , second(NULL)
00036       , cellID (-1)
00037       , mapData(_outDimension)
00038    {}
00039 
00040    FeatureMap(){}
00041    
00042    FeatureMap (const FeatureMap &) {std::cerr << "don't call the FeatureMap copy constructor\n"; exit(1);}
00043 
00044    ~FeatureMap() 
00045    {
00046       if (!terminal) 
00047       {
00048          delete first; 
00049          delete second;
00050       }
00051    }
00052 
00053    void recursiveSplit (const std::vector<float *> &inData, const std::vector<float *> &outData, int level = 2);
00054 
00055    void split(const std::vector<float *> &inData, const std::vector<float *> &outData, int &bestDim, float &bestThreshold);
00056 
00057    void findThreshold(const std::vector<float *> &inData, const std::vector<float *> &outData, int dim, float &thresh, float &score);
00058    
00059    int setNumbering(int start=0);
00060    
00061    void calc(const float *in, float *out);
00062 
00063    //int belongs(float *vect) const;
00064 
00065    //void calcTemplate (const std::vector<float *> &features, std::vector<int> &templ) const;
00066 
00067    void printOn(std::ostream &out) const;
00068 
00069    void readFrom (std::istream &in);
00070    
00071    int getOutDimension() {return outDimension;}
00072 
00073    friend std::istream &operator >> (std::istream &in, FeatureMap &cell);
00074 };
00075 
00076 }//namespace FD
00077 
00078 #endif

Generated on Wed Oct 5 14:28:55 2005 for FlowDesigner by  doxygen 1.4.4