model.h

Go to the documentation of this file.
00001 #ifndef _model_h
00002 #define _model_h
00003 #include <sstream>
00004 #include <cstdlib>
00005 #include <iostream>
00006 
00007 #include "vectors.h"
00008 #include "globals.h"
00009 
00013 struct model {
00014   FVector w;
00015   double wscale, bias;
00016   int dim;
00017   double t;
00018   
00023 model(int dim) : w(dim) { wscale = 1; bias = 0; this->dim = dim;}
00027 model() : w(0) {wscale = 1; bias = 0; this->dim = dim;} 
00033 model(int dim, bool random_noise) : w(dim) {
00034   wscale = 1;
00035   bias = drand48();
00036   if(random_noise) {
00037     srand(10);
00038     for(int i = 0; i < dim; i++) {
00039       double v = drand48() - 0.5;
00040       w.set(i, v);
00041     }
00042   }
00043   this->dim = dim;
00044 }
00045 
00046   void resetModel() {
00047     wscale = 1;
00048     bias = 0;
00049     w.clear();
00050     w.resize(dim);
00051   }
00052 };
00056 std::istream& operator>>(std::istream &f, model &m);
00060 std::ostream& operator<<(std::ostream &f, const model &m);
00061 #endif

Generated on Wed Dec 15 10:46:15 2010 for Hazy_System by  doxygen 1.4.7