testsoinput.cpp 1.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#include <iostream>
#include <fcntl.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_vector.h>
#include "secorder_input.hpp"

using namespace std;

int main(int argc, char *argv[]) {
  
  gsl_rng *rng = gsl_rng_alloc(gsl_rng_mt19937);
  gsl_rng_set(rng, 47);

  int N_nodes0=2000, N_nodes1=500;
  double mean_rate0=10.0;
  double mean_rate1=5.0;
  double input_corr0=0.02;
  double input_corr1=0.02;
  double input_cc_01=-1.0;

  double dt = 2.0;
  //double tmax=2.0;
  
  
  secorder_input cinput;

  cinput.setup_trains(mean_rate0,mean_rate1,
		      input_corr0,input_corr1,input_cc_01,
		      dt, N_nodes0, N_nodes1);
  
  
  //gsl_vector *the_inputs =gsl_vector_alloc(N_nodes);

  FILE *fhnd;
  fhnd = fopen("testinput", "w");
  if(fhnd==NULL) {
    cerr << "Couldn't open testinput\n";
    exit(-1);
  }
  
  gsl_matrix *the_inputs;
  the_inputs = cinput.sample_trains(100, rng);
  // gsl_matrix_fprintf (fhnd, the_inputs, "%e");

  for(size_t j=0; j< the_inputs->size2; j++) {
    for(int i=0; i<N_nodes0+N_nodes1;i++) {
      fprintf(fhnd, "%f ", gsl_matrix_get(the_inputs,i,j));
    }
    fprintf(fhnd,"\n");
  }

  fclose(fhnd);
  

  
  return 0;
}