Beispiel #1
0
int maindo1(){
	MTRand53 mt(1234);
	BiasingPotential Ut(-5,5,100,1000);
	unsigned long n=0;
	double x=0;
	double E=tempE(x)+ Ut.getBiasingE(x);
	for (n=0;n<1000000;n++){
		double dx=(mt()-.5)*2.*0.1;
		double newx=x+dx;
		double newE=tempE(newx)+ Ut.getBiasingE(newx);
		if (newE<E){
			x=newx;E=newE;
		}
		else{
			double temp=mt();
			if (temp<exp(-newE+E)){
				x=newx;
				E=newE;
			}
		}
		Ut.collect(x);
		if (n % 100000==0)
			Ut.pickle("testAF.txt");
	}
	return 0;
}
Beispiel #2
0
bool multiArrayMessageCopyToMatrixEigen(const MultiArrayMessageType_& m, EigenType_& e)
{
  if (e.IsRowMajor != isRowMajor(m)) {
    ROS_ERROR("multiArrayMessageToMatrixEigen() failed because the storage order is not compatible.");
    return false;
  }

  EigenType_ tempE(getRows(m), getCols(m));
  tempE = Eigen::Map<const EigenType_>(m.data.data(), getRows(m), getCols(m));
  e = tempE;
  return true;
}