Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

neuralregion.h

Go to the documentation of this file.
00001 
00008 #ifndef __NEURALREGION_H__
00009 #define __NEURALREGION_H__
00010 
00011 #include <utility>
00012 #include <string>
00013 
00014 #include "matrix.h"
00015 #include "generic_stdlib.h"
00016 
00020 class NeuralRegion {
00021 public:
00023   typedef double Activity;
00025   typedef double Length;
00026 
00033   typedef MatrixType<Activity>::rectangular ActivityMatrix;
00034 
00036   typedef ActivityMatrix::size_type Subscript;
00037 
00039   typedef pair<Subscript,Subscript> SubscriptPair;
00040 
00042   struct Dimensions {
00043     Dimensions(Subscript h, Subscript w, Length xo=0.5, Length yo=0.5)
00044       : height(h), width(w), xoffset(xo), yoffset(yo) {  }
00045     Subscript height;   
00046     Subscript width;    
00047     Length    xoffset;  
00048     Length    yoffset;  
00049   };
00050   
00051   NeuralRegion(string name_i, Subscript height, Subscript width)
00052     : name_str(name_i), output(height,width) { }
00053   
00054   NeuralRegion(const NeuralRegion& other) 
00055     : name_str(other.name_str), output(other.output) { }
00056   
00057   virtual ~NeuralRegion() { }
00058 
00060   virtual void activate(bool learn=false, bool settle=true) =0; 
00061   
00064   
00065   /*   activity(Subscript i, Subscript j) may need to be made non-virtual for speed.  */
00067   virtual Activity activity(Subscript i, Subscript j) const {  return output[i][j];  }
00069   virtual const ActivityMatrix& const_activity() const      {  return output;        }
00070   //  virtual ActivityMatrix& activity()                        {  return output;        }
00071 
00073 
00075   const string& name() const {  return name_str;  }
00076   
00077 private:
00078   const string name_str;
00079 
00080 protected:
00082   ActivityMatrix output;
00083 };
00084 
00085 
00086 
00087 
00092 class InternalNeuralRegion : public NeuralRegion {
00093 public:
00094   InternalNeuralRegion(string name_i, Subscript height, Subscript width)
00095     : NeuralRegion(name_i,height,width) { }
00096   
00097   virtual ~InternalNeuralRegion() { }
00098 
00105   typedef ActivityMatrix WeightMatrix;
00106 
00108   typedef Generic::unary_virtual_function<double,WeightMatrix> WeightFunction;
00109 
00111   virtual Dimensions input_dimensions(WeightFunction& fn, Length size_scale=1.0) =0;
00112 
00114   virtual void add_input(const string& name, const ActivityMatrix& input_region,
00115                          WeightFunction& fn, Length size_scale) =0;
00116 
00125   virtual const WeightMatrix get_weights(const string& name="", int i=0, int j=0) const =0;
00126 };
00127 
00128 
00129 #endif

Generated at Mon Aug 21 00:30:54 2000 for RF-LISSOM by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000