示例#1
0
int
operator_a(void)
{
    struct QX(HalfFermion) *f_a;
    struct QX(HalfFermion) *f_b;
    struct QX(HalfFermion) *f_x;
    struct QX(Fermion) *t;
    long long flops = 0;
    long long sent = 0;
    long long received = 0;
    double x, y, norm;

    if (q(setup_comm)(state, sizeof (REAL))) {
	zprint("opetator_a(): setup_comm failed");
	return 1;
    }

    if (QX(import_half_fermion)(&f_a, state, read_fermion_x, &seed_a)) {
	zprint("operator_a(): alloc failed on x");
	return 1;
    }

    if (QX(import_half_fermion)(&f_b, state, read_fermion_x, &seed_b)) {
	zprint("operator_a(): alloc failed on b");
	return 1;
    }

    if (QX(import_half_fermion)(&f_x, state, read_fermion_x, &seed_a)) {
	zprint("operator_a(): alloc failed on x");
	return 1;
    }
    
    if (QX(allocate_fermion)(&t, state)) {
	zprint("operator_a(): alloc failed on t");
	return 1;
    }

    qx(op_even_Mxn)(f_x->even, &norm, state, params, gauge->data,
		    f_a->even, &flops, &sent, &received, t->even, t->odd);

    QX(dot_half_fermion)(&x, &y, f_b, f_x);

    QOP_MDWF_free_fermion(&t);
    QOP_MDWF_free_half_fermion(&f_x);
    QOP_MDWF_free_half_fermion(&f_a);
    QOP_MDWF_free_half_fermion(&f_b);
    show("native", x, y, norm);
    return 0;
}
示例#2
0
文件: f.c 项目: PlanetAPL/a-plus
Z H1(ts){A z;Z C *t[]={"int","float","char","null","box","sym","func",
 "unknown"};
 W(gs(Et))*z->p=MS(si(t[QA(a)?(Et<a->t?6:Et>a->t?a->t:!a->n?3:
 Et==a->t?(QA(a=(A)*a->p)&&a->t<Xt?4:QS(a)?5:6):6):
 QP(a)?6:QX(a)?6:7]));R(I)z;}
示例#3
0
int main(int argc, char** argv)
{

  char port[] = "27015";
  char ip[] = "10.0.0.67";

  int numbytes;
  char buf[MAXDATASIZE];

  // Get input parameters
  for(int a=0; a < argc; a++)
    {
      if( strcmp( argv[a], "--ip" ) == 0 )
	{
	  strcpy(ip, argv[a+1]);
	}

      if( strcmp( argv[a], "--port" ) == 0 )
	{
	  strcpy(port, argv[a+1]);
	}
    }

  TCP myClient = TCP(port, ip);

  ros::init(argc, argv, "joints");
  ros::NodeHandle n;

  std::string receivedString;
  std::string attribute;
  std::stringstream ss;
  std::istringstream iss;

  tf::TransformBroadcaster br;
  tf::Transform transform;

  ros::Rate loop_rate(30);


  if( myClient.Connect() == 0 )
    {
      // Receive data
      numbytes = recv(myClient.s,buf,MAXDATASIZE-1,0);

      while (numbytes != 0 && ros::ok())
	{
	  numbytes = recv(myClient.s,buf,MAXDATASIZE-1,0);

	  buf[numbytes]='\0';

	  receivedString.assign(buf);

	  // debug
	  // std::cout << "Ahoy! Received " << numbytes << " bytes. " << receivedString << std::endl;

	  std::istringstream iss(receivedString);


	  std::vector<double> x (25, 0.0);
	  std::vector<double> y (25, 0.0);
	  std::vector<double> z (25, 0.0);

    std::vector<std::vector<double> > X (6, x);
    std::vector<std::vector<double> > Y (6, y);
    std::vector<std::vector<double> > Z (6, z);

    std::vector<double> qx (25, 0.0);
	  std::vector<double> qy (25, 0.0);
	  std::vector<double> qz (25, 0.0);
	  std::vector<double> qw (25, 1.0);

    std::vector<std::vector<double> > QX (6, qx);
    std::vector<std::vector<double> > QY (6, qy);
    std::vector<std::vector<double> > QZ (6, qz);
    std::vector<std::vector<double> > QW (6, qw);

	  int j;
	  int count = 6;
	  int id;

	  std::vector<int> foundIdx;
    std::string frame;
    std::string joint;

      /* code */

	  while(!iss.eof())
	    {
      // joint = "joint_";
      iss >> attribute;
      frame = "person_";

	      if( strcmp(attribute.c_str(), "count:") == 0 )
		{
		  iss >> count;
		  // ROS_INFO("count %d",count);
		}
	      else if( strcmp(attribute.c_str(), "id:") == 0 )
		{
		  iss >> id;
		  foundIdx.push_back(id);
      frame.append(boost::lexical_cast<std::string>(id));
		  // ROS_INFO("id %s",frame);
      // std::cout << id << " " << frame << " ";
		}