TEST_F(PriorityQueueTest, large_scale_speed) {
  PriorityQueueType2 lq(gt_int);

  std::vector<int> values;
  for (int i=0; i<speed_size; ++i)
    values.push_back(i);
  std::random_shuffle(values.begin(),values.end());

  for (int test=1; test<=5; ++test) {
    int enqueued = 0;
    int dequeued = 0;
    while (dequeued != speed_size) {
      int to_enqueue = ics::rand_range(0,speed_size-enqueued);
      for (int i=0; i <to_enqueue; ++i)
        lq.enqueue(values[enqueued++]);
      for (int v : lq)
        ;
      int to_dequeue = ics::rand_range(0,enqueued-dequeued);
      for (int i=0; i <to_dequeue; ++i) {
        lq.dequeue();
        ++dequeued;
      }
      for (int v : lq)
        ;
    }
  }
}
/**
 * wxThreadのテスト
 */
void HelloWorld::OnTestLockedQueue(wxCommandEvent& event) {

     // キューを作成 サイズは2
     wxMutex mutex;
     wxCondition enq(mutex), deq(mutex);
     wxLockedQueue<int> lq(2, &mutex, &enq, &deq);
     //WorkerThread<int>* thread = new WorkerThread<int>(lq);
}
Example #3
0
void ff_mmi_idct(int16_t * block)
{
        /* $4 = block */
        asm volatile("la $24, %0"::"m"(consttable[0]));
        lq($24, ROUNDER_0, $8);
        lq($24, ROUNDER_1, $7);
        DCT_8_INV_ROW1($4, 0, TAB_i_04, $8, $8);
        DCT_8_INV_ROW1($4, 16, TAB_i_17, $7, $9);
        DCT_8_INV_ROW1($4, 32, TAB_i_26, $7, $10);
        DCT_8_INV_ROW1($4, 48, TAB_i_35, $7, $11);
        DCT_8_INV_ROW1($4, 64, TAB_i_04, $7, $12);
        DCT_8_INV_ROW1($4, 80, TAB_i_35, $7, $13);
        DCT_8_INV_ROW1($4, 96, TAB_i_26, $7, $14);
        DCT_8_INV_ROW1($4, 112, TAB_i_17, $7, $15);
        DCT_8_INV_COL8();
        DCT_8_INV_COL8_STORE($4);

        //let savedtemp regs be saved
        asm volatile(" ":::"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23");
}
Example #4
0
int main() 
{
	Quote q("text", 10.60);
	Bulk_quote bq("text", 10.60, 10, 0.3);
	Limit_quote lq("text", 10.60, 20, 0.3);

	print_total(std::cout, q, 12);
	print_total(std::cout, bq, 12);
	print_total(std::cout, lq, 21);

	return 0;
}
Example #5
0
void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
{
        /* $4 = dest, $5 = line_size, $6 = block */
        asm volatile("la $24, %0"::"m"(consttable[0]));
        lq($24, ROUNDER_0, $8);
        lq($24, ROUNDER_1, $7);
        DCT_8_INV_ROW1($6, 0, TAB_i_04, $8, $8);
        DCT_8_INV_ROW1($6, 16, TAB_i_17, $7, $9);
        DCT_8_INV_ROW1($6, 32, TAB_i_26, $7, $10);
        DCT_8_INV_ROW1($6, 48, TAB_i_35, $7, $11);
        DCT_8_INV_ROW1($6, 64, TAB_i_04, $7, $12);
        DCT_8_INV_ROW1($6, 80, TAB_i_35, $7, $13);
        DCT_8_INV_ROW1($6, 96, TAB_i_26, $7, $14);
        DCT_8_INV_ROW1($6, 112, TAB_i_17, $7, $15);
        DCT_8_INV_COL8();
        lq($24, CLIPMAX, $11);
        DCT_8_INV_COL8_PMS();
        DCT_8_INV_COL8_ADD();

        //let savedtemp regs be saved
        asm volatile(" ":::"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23");
}
TEST_F(PriorityQueueTest, large_scale) {
  PriorityQueueType2 lq(gt_int);
  ics::ArrayPriorityQueue<int> lq_ref(gt_int);


  std::vector<int> values;
  for (int i=0; i<test_size; ++i)
    values.push_back(i);
   std::random_shuffle(values.begin(),values.end());


   for (int test=1; test<=5; ++test) {
    int enqueued = 0;
    int dequeued = 0;
    while (dequeued != test_size) {
      int to_enqueue = ics::rand_range(0,test_size-enqueued);
      if (trace)
        std::cout << "Enqueue " << to_enqueue << std::endl;
      for (int i=0; i <to_enqueue; ++i) {
        lq_ref.enqueue(values[enqueued]);
        ASSERT_EQ(1,lq.enqueue(values[enqueued++]));
      }
      ics::Iterator<int>& i = lq_ref.abegin();
      for (int v : lq) {
        ASSERT_EQ(*i,v);
        ++i;
      }

      int to_dequeue = ics::rand_range(0,enqueued-dequeued);
      if (trace)
        std::cout << "Dequeue " << to_dequeue << std::endl;
      for (int i=0; i <to_dequeue; ++i) {
        ASSERT_EQ(lq_ref.peek(),lq.peek());
        ASSERT_EQ(lq_ref.dequeue(),lq.dequeue());
        ++dequeued;
      }
      ics::Iterator<int>& j = lq_ref.abegin();
      for (int v : lq) {
        ASSERT_EQ(*j,v);
        ++j;
      }
    }
  }
  ASSERT_TRUE(lq.empty());
  ASSERT_EQ(0,lq.size());

}
Example #7
0
int main() 
{
	Quote q("text", 10.60);
	Bulk_quote bq("text", 10.60, 10, 0.3);
	Limit_quote lq("text", 10.60, 20, 0.3);

	print_total(std::cout, q, 12);
	print_total(std::cout, bq, 12);
	print_total(std::cout, lq, 21);

	std::cout << "*******************************" << std::endl;

	print_debug(q);
	print_debug(bq);
	print_debug(lq);

	return 0;
}
Example #8
0
 forceinline ModEvent
 IntView::le(Space& home, double n) {
   return lq(home,n-1.0);
 }
Example #9
0
int main(int argc, char **argv) {
   OptionParser opts;

   string mapFile,trainFile,testFile;

   int factor = 1;
   double step;

   opts.addOption(new StringOption("map", 
            "--map <filename>                 : map file",
            "../input/grid.bmp", mapFile, false));
   opts.addOption(new StringOption("evidence", 
            "--test evidence <filename>            : evidence file",
            "", testFile, true));

   opts.addOption(new DoubleOption("step",
            "--step <double>                   : inference interval",
            1.0, step, true));

   opts.parse(argc,argv);

   JetColorMap jet;
   RGBTRIPLE black = {0,0,0};
   RGBTRIPLE white = {255,255,255};
   RGBTRIPLE red;
   red.R = 255;
   red.G = 0;
   red.B = 0;
   RGBTRIPLE blue;
   blue.R = 0;
   blue.G = 0;
   blue.B = 255;
   RGBTRIPLE green;
   green.R = 0;
   green.G = 255;
   green.B = 0; 
   RGBTRIPLE initialColor;
   initialColor.R = 111; 
   initialColor.G = 49;
   initialColor.B = 152;
   RGBTRIPLE currentColor;
   currentColor.R = 181;
   currentColor.G = 165;
   currentColor.B = 213;
   RGBTRIPLE magenta;
   magenta.R = 255;
   magenta.G = 0;
   magenta.B = 255;
   RGBTRIPLE cyan;
   cyan.R = 0;
   cyan.G = 255;
   cyan.B = 255;
   RGBTRIPLE yellow;
   yellow.R = 255;
   yellow.G = 255;
   yellow.B = 0;

   BMPFile bmpFile(mapFile);
   Grid grid(bmpFile, black);

   
   Evidence testSet(testFile, grid, factor);
 //  Evidence trainSet(trainFile, grid, factor);

   pair<int, int> dims = grid.dims();
   
   cout << " Speed Feature"<<endl;
   vector<double> speedTable(VEL_DIM,0.0);
   speedTable.at(1) = 0.75;
   DisVecSeqFeature speedfeat(speedTable);

   vector<int> dimensions;
   dimensions.push_back(dims.first);
   dimensions.push_back(dims.second);
   dimensions.push_back(VEL_DIM);
   
   /* ****************************************
	*      INITIALIZE MARKOV DECESION PROCESS 
	*      BASED MODEL PARAMETERS
	* ****************************************/
   vector<double> p_weights(NUMPOSFEAT,-0.0);
   p_weights.at(0) = -2.23; //-2.23 for PPP forecast
   p_weights.at(1) = -6.2;
   p_weights.at(2) = -0.35;
   p_weights.at(3) = -2.73;
   p_weights.at(4) = -0.92;
   p_weights.at(5) = -0.26;
   vector<double> r_PosWeights(NUMPOSFEAT+NUMROBFEAT, -0.0);
   r_PosWeights.at(0) = -3.83;
   r_PosWeights.at(1) = -8.36;
   r_PosWeights.at(2) = -2.65;
   r_PosWeights.at(3) = -5.43;
   r_PosWeights.at(4) = -3.15;
   r_PosWeights.at(5) = -3.30;
   //r_PosWeights.at(6) =  0.60;
   //r_PosWeights.at(7) =  0.45;
   vector<double> nr_PosWeights(NUMPOSFEAT+NUMROBFEAT, -0.0);
   nr_PosWeights.at(0) = -4.51;
   nr_PosWeights.at(1) = -6.2;
   nr_PosWeights.at(2) = -0.35;
   nr_PosWeights.at(3) = -2.73;
   nr_PosWeights.at(4) = -0.93;
   nr_PosWeights.at(5) = -0.28;
   //nr_PosWeights.at(6) = -0.50;
   //nr_PosWeights.at(7) = -0.286;
   vector<double> r_SeqWeights(VEL_DIM, -0.0);
   r_SeqWeights.at(0) = 0.59;
   r_SeqWeights.at(1) = -0.83;
   vector<double> nr_SeqWeights(VEL_DIM, -0.0);
   nr_SeqWeights.at(0) = -1.21;
   nr_SeqWeights.at(1) = 0.49;

   Parameters p(p_weights);
   Parameters r_Pos(r_PosWeights);
   Parameters nr_Pos(nr_PosWeights);
   Parameters r_Seq(r_SeqWeights);
   Parameters nr_Seq(nr_SeqWeights);

   /* ****************************************
	*      INITIALIZE LINEAR QUADRATIC CONTROL 
	*      BASED MODEL PARAMETERS
	* ****************************************/
   M_6 A;
   A.setZero();
   A(0,0) = 1;
   A(1,1) = 1;
   A(4,2) = -1;
   A(5,3) = -1;
   M_6_2 B;
   B<<1,0,
	  0,1,
	  1,0,
	  0,1,
	  1,0,
	  0,1;
   M_6 costM;
   ifstream infile("../params/nonrob2000.dat");
   for(int row=0;row<costM.rows();row++){
	   for(int col=0;col<costM.cols();col++){
		   double temp;
		   infile>>temp;
		   costM(row,col) = temp;
	   }
   }
   infile.close();
   M_6 sigma;
   sigma<<0.001,0,0,0,0,0,
	      0,0.001,0,0,0,0,
		  0,0,0.005,0,0,0,
		  0,0,0,0.005,0,0,
		  0,0,0,0,0.005,0,
		  0,0,0,0,0,0.005;


   /* ****************************************
	*      DECLARATION OF INFERENCE ENGINES    
	* ****************************************/
   OrderedWaveInferenceEngine pp(InferenceEngine::GRID8);
   DisSeqOrderInferEngine mdpr(InferenceEngine::GRID8);
   DisSeqOrderInferEngine mdpnr(InferenceEngine::GRID8);
   ContinuousState cState;
   LQControlInference lq(A,B,sigma,costM,cState);
   lq.valueInference();


   IntentRecognizer IR(grid,p,r_Pos,r_Seq,nr_Pos,nr_Seq,
			   speedfeat,pp,mdpr,mdpnr,lq);

   cout << testSet.size() <<" Examples"<<endl;

   for (int i=0; i < testSet.size(); i++) {

      vector<pair<int, int> > & traj = testSet.at(i);
	  vector<double> & vels = testSet.at_v(i);
      vector<double> times = testSet.getTimes(i); 
	  pair<int,int> & botinGrid = testSet.at_bot(i);
	  vector<pair<double,double> > & obs = 
		  testSet.at_raw(i);
      vector<double> & rawTimes = testSet.at_rawTime(i);

      IR.combineForecast(traj,vels,obs,times,rawTimes,
				  botinGrid,i,step);
      
   }
}
void
TimeWheel::DumpEventQueue(void)
{
    if (_verbosity > 3) {
        std::priority_queue<std::shared_ptr<Event>, std::vector<std::shared_ptr<Event>>, EventComp> lq(_eventQueue);

        std::cout << "EventQueue : " << std::endl;
        std::shared_ptr<Event> ev;
        while (!lq.empty()) {
            ev = lq.top();
            ev->Dump();
            lq.pop();
        }
    }
}