本文整理汇总了C++中T2函数的典型用法代码示例。如果您正苦于以下问题:C++ T2函数的具体用法?C++ T2怎么用?C++ T2使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了T2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: productionRules
QList<char> productionRules(QVector<double> params)
{
switch((int)params[0])
{
case 0:
return T1().symbol({0,0});
break;
case -1:
return T2().symbol({0,0});
break;
default:
return r3.productionRules({params[0] - 1, 0}) + productionRules({params[0]-2,0});
}
}
示例2: T1
geometry_msgs::Pose Sensors::robot2sensorTransformation(geometry_msgs::Pose pose)
{
Eigen::Matrix4d robotPoseMat, robot2sensorMat, sensorPoseMat;
//Robot matrix pose
Eigen::Matrix3d R; Eigen::Vector3d T1(pose.position.x,pose.position.y,pose.position.z);
tf::Quaternion qt(pose.orientation.x,pose.orientation.y,pose.orientation.z,pose.orientation.w);
tf::Matrix3x3 R1(qt);
tf::matrixTFToEigen(R1,R);
robotPoseMat.setZero ();
robotPoseMat.block (0, 0, 3, 3) = R;
robotPoseMat.block (0, 3, 3, 1) = T1;
robotPoseMat (3, 3) = 1;
//transformation matrix
qt = tf::createQuaternionFromRPY(sensorRPY[0],sensorRPY[1],sensorRPY[2]);
tf::Matrix3x3 R2(qt);Eigen::Vector3d T2(sensorPose[0], sensorPose[1], sensorPose[2]);
tf::matrixTFToEigen(R2,R);
robot2sensorMat.setZero ();
robot2sensorMat.block (0, 0, 3, 3) = R;
robot2sensorMat.block (0, 3, 3, 1) = T2;
robot2sensorMat (3, 3) = 1;
//preform the transformation
sensorPoseMat = robotPoseMat * robot2sensorMat;
Eigen::Matrix4d sensor2sensorMat; //the frustum culling sensor needs this
//the transofrmation is rotation by +90 around x axis of the sensor
sensor2sensorMat << 1, 0, 0, 0,
0, 0,-1, 0,
0, 1, 0, 0,
0, 0, 0, 1;
Eigen::Matrix4d newSensorPoseMat = sensorPoseMat * sensor2sensorMat;
geometry_msgs::Pose p;
Eigen::Vector3d T3;Eigen::Matrix3d Rd; tf::Matrix3x3 R3;
Rd = newSensorPoseMat.block (0, 0, 3, 3);
tf::matrixEigenToTF(Rd,R3);
T3 = newSensorPoseMat.block (0, 3, 3, 1);
p.position.x=T3[0];p.position.y=T3[1];p.position.z=T3[2];
R3.getRotation(qt);
p.orientation.x = qt.getX(); p.orientation.y = qt.getY();p.orientation.z = qt.getZ();p.orientation.w = qt.getW();
return p;
}
示例3: sc_main
int sc_main(int ac, char *av[])
{
// Signal Instantiation
signal_bool_vector prime ("prime");
// Clock Instantiation
sc_clock clk ("CLK", 6, SC_NS, 0.5, 0, SC_NS); // 167 Mhz
// Process Instantiation
displayp T2 ("T2", clk, prime);
// Simulation Run Control
sc_start( 30, SC_NS, SC_EXIT_ON_STARVATION );
cout << sc_time_stamp() << " : STOPPING SIM - start button" << endl;
return 0;
}
示例4: rgp_base
rgpprob1::rgpprob1() : rgp_base(NUM_VARS)
{
// Objective function: h^-1 w^-1 d^-1 (inverse of volume)
{ monomial<aaf> obj(NUM_VARS);
obj._a[h] = aaf(-1.0); obj._a[w] = aaf(-1.0); obj._a[d] = aaf(-1.0);
obj.set_coeff(aaf(1.0));
rgp_base::_M.push_back( posynomial<aaf>(obj) ); }
// (2/Awall)hw + (2/Awall)hd <= 1
{ monomial<aaf> T11(NUM_VARS);
T11._a[h] = aaf(1.0); T11._a[w] = aaf(1.0);
T11.set_coeff(2./Awall);
monomial<aaf> T12(NUM_VARS);
T12._a[h] = aaf(1.0); T12._a[d] = aaf(1.0);
T12.set_coeff(2./Awall);
posynomial<aaf> P1(T11);
P1 += T12;
rgp_base::_M.push_back(P1); }
{ monomial<aaf> T2(NUM_VARS);
T2._a[w] = aaf(1.0); T2._a[d] = aaf(1.0);
T2.set_coeff(1./Aflr);
rgp_base::_M.push_back( posynomial<aaf>(T2) ); }
{ monomial<aaf> T3(NUM_VARS);
T3._a[h] = aaf(-1.0); T3._a[w] = aaf(1.0);
T3.set_coeff(alpha);
rgp_base::_M.push_back( posynomial<aaf>(T3) ); }
{ monomial<aaf> T4(NUM_VARS);
T4._a[h] = aaf(1.0); T4._a[w] = aaf(-1.0);
T4.set_coeff(1./beta);
rgp_base::_M.push_back( posynomial<aaf>(T4) ); }
{ monomial<aaf> T5(NUM_VARS);
T5._a[w] = aaf(1.0); T5._a[d] = aaf(-1.0);
T5.set_coeff(gamma2);
rgp_base::_M.push_back( posynomial<aaf>(T5) ); }
{ monomial<aaf> T6(NUM_VARS);
T6._a[w] = aaf(-1.0); T6._a[d] = aaf(1.0);
T6.set_coeff(1./delta);
rgp_base::_M.push_back( posynomial<aaf>(T6) ); }
}
示例5: generateRandomTransform_ccd
void generateRandomTransform_ccd(FCL_REAL extents[6], std::vector<Transform3f>& transforms, std::vector<Transform3f>& transforms2, FCL_REAL delta_trans[3], FCL_REAL delta_rot, std::size_t n,
const std::vector<Vec3f>& vertices1, const std::vector<Triangle>& triangles1,
const std::vector<Vec3f>& vertices2, const std::vector<Triangle>& triangles2)
{
transforms.resize(n);
transforms2.resize(n);
for(std::size_t i = 0; i < n;)
{
FCL_REAL x = rand_interval(extents[0], extents[3]);
FCL_REAL y = rand_interval(extents[1], extents[4]);
FCL_REAL z = rand_interval(extents[2], extents[5]);
const FCL_REAL pi = 3.1415926;
FCL_REAL a = rand_interval(0, 2 * pi);
FCL_REAL b = rand_interval(0, 2 * pi);
FCL_REAL c = rand_interval(0, 2 * pi);
Matrix3f R;
eulerToMatrix(a, b, c, R);
Vec3f T(x, y, z);
Transform3f tf(R, T);
std::vector<std::pair<int, int> > results;
{
transforms[i] = tf;
FCL_REAL deltax = rand_interval(-delta_trans[0], delta_trans[0]);
FCL_REAL deltay = rand_interval(-delta_trans[1], delta_trans[1]);
FCL_REAL deltaz = rand_interval(-delta_trans[2], delta_trans[2]);
FCL_REAL deltaa = rand_interval(-delta_rot, delta_rot);
FCL_REAL deltab = rand_interval(-delta_rot, delta_rot);
FCL_REAL deltac = rand_interval(-delta_rot, delta_rot);
Matrix3f R2;
eulerToMatrix(a + deltaa, b + deltab, c + deltac, R2);
Vec3f T2(x + deltax, y + deltay, z + deltaz);
transforms2[i].setTransform(R2, T2);
++i;
}
}
}
示例6: start
void start ( void)
{ //---------------------- begin ---------------------
assert ( N ==0 );
//std::cout<<"1.-Begin main function \n";
N++ ;
s.try_lock() ;
N++ ;
std::thread T1 ( function1);
std::thread T2 ( function2);
//std::cout<<"2.-Inside main function \n";
std::this_thread::sleep_for( std::chrono::seconds(3) ) ;
assert ( N == 4 );
N++ ;
s.unlock() ;
T1.join() ;
T2.join() ;
assert ( N == 9);
//std::cout<<"7.-End of main function \n";
}
示例7: main
int main()
{
std::mutex MX;
std::condition_variable CV;
auto F1 = [&] {
std::cout << "Start F1" << std::endl;
try
{
std::unique_lock<std::mutex> UL(MX);
while (true)
{
interruptible_wait(CV, UL);
}
}
catch (thread_interrupted& e)
{
std::cout << e.what() << std::endl;
}
std::cout << "Endof F1" << std::endl;
};
interruptible_thread T1(F1);
std::thread T2([&] {
std::cout << "Start F2" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
T1.interrupt();
//std::this_thread::sleep_for(std::chrono::milliseconds(10000));
//T1.interrupt();
std::cout << "Endof F2" << std::endl;
});
T1.join();
T2.join();
return 0;
}
示例8: get
template<class T2> void LinearTermBase<T2>::get(MElement *ele, int npts, IntPt *GP, fullVector<T2> &vec) const
{
std::vector<fullVector<T2> > vv;
vv.resize(npts);
get(ele,npts,GP,vv);
int nbFF=vv[0].size();
vec.resize(nbFF);
vec.setAll(T2());
double jac[3][3];
for(int i = 0; i < npts; i++)
{
const double u = GP[i].pt[0]; const double v = GP[i].pt[1]; const double w = GP[i].pt[2];
const double weight = GP[i].weight; const double detJ = ele->getJacobian(u, v, w, jac);
for(int j = 0; j < nbFF; j++)
{
double contrib = weight * detJ;
vec(j) += contrib*vv[i](j);
}
}
}
示例9: main
void main(){
cout << "201211305 이현규" << endl;
time T1;
T1.reset(4, 50);
T1.show();
T1.addMin(100);
T1.show();
time T2(1, 30);
time T3 = T1.operator+(T2);
T3.show();
time T4 = 2.5 * T2;
T4.show();
//T1 = T2.operator*(T1);
T4 << cout;
cout << T4; // 연산자가 뒤에온다 해결방법은 friend 함수
}
示例10: T
Sphere::Sphere(const Point & pa,
const Point & pb,
const Point & pc,
const Point & pd)
{
Point pad = pa - pd;
Point pbd = pb - pd;
Point pcd = pc - pd;
TensorValue<Real> T(pad,pbd,pcd);
Real D = T.det();
// The points had better not be coplanar
libmesh_assert_greater (std::abs(D), 1e-12);
Real e = 0.5*(pa.norm_sq() - pd.norm_sq());
Real f = 0.5*(pb.norm_sq() - pd.norm_sq());
Real g = 0.5*(pc.norm_sq() - pd.norm_sq());
TensorValue<Real> T1(e,pad(1),pad(2),
f,pbd(1),pbd(2),
g,pcd(1),pcd(2));
Real sx = T1.det()/D;
TensorValue<Real> T2(pad(0),e,pad(2),
pbd(0),f,pbd(2),
pcd(0),g,pcd(2));
Real sy = T2.det()/D;
TensorValue<Real> T3(pad(0),pad(1),e,
pbd(0),pbd(1),f,
pcd(0),pcd(1),g);
Real sz = T3.det()/D;
Point c(sx,sy,sz);
Real r = (c-pa).norm();
this->create_from_center_radius(c,r);
}
示例11: sc_main
int sc_main(int ac, char *av[])
{
// Signal Instantiation
sc_signal<bool> reset ("reset");
sc_signal<bool> prime_ready ("prime_ready");
signal_bool_vector prime ("prime");
// Clock Instantiation
sc_clock clk ("CLK", 6, SC_NS, 0.5, 10, SC_NS, false); // 167 Mhz
// Process Instantiation
prime_numgen D1 ("D1", clk, reset, prime_ready, prime);
resetp T1 ("T1", clk, reset);
displayp T2 ("T2", clk, prime_ready, prime);
// Simulation Run Control
sc_start();
return 0;
}
示例12: SM4_key_expansion
int SM4_key_expansion(unsigned char* subkey, unsigned char* key) {
unsigned CK[] = { 0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269,
0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
0x50575e65, 0x6c737a81, 0x888f969d, 0xa4abb2b9,
0xc0c7ced5, 0xdce3eaf1, 0xf8ff060d, 0x141b2229,
0x30373e45, 0x4c535a61, 0x686f767d, 0x848b9299,
0xa0a7aeb5, 0xbcc3cad1, 0xd8dfe6ed, 0xf4fb0209,
0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279};
unsigned FK[] = { 0xa3b1bac6, 0x56aa3350, 0x677d9197, 0xb27022dc};
unsigned K[36];
int i;
for(i = 0; i < 4; i ++) {
K[i] = char_to_unsigned(key + i * 4);
K[i] = key[i] ^ FK[i];
}
for(i = 0; i < 32; i ++) {
K[i + 4] = K[i] ^ T2(K[i + 1] ^ K[i + 2] ^ K[i + 3] ^ K[i]);
unsigned_to_char(subkey + i * 4, K[i + 4]);
}
return 1;
}
示例13: switch
int VSSubphantom::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
#ifndef QT_NO_PROPERTIES
if (_c == QMetaObject::ReadProperty) {
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< double*>(_v) = T1(); break;
case 1: *reinterpret_cast< double*>(_v) = T2(); break;
case 2: *reinterpret_cast< double*>(_v) = chemicalShift(); break;
}
_id -= 3;
} else if (_c == QMetaObject::WriteProperty) {
void *_v = _a[0];
switch (_id) {
case 0: setT1(*reinterpret_cast< double*>(_v)); break;
case 1: setT2(*reinterpret_cast< double*>(_v)); break;
case 2: setChemicalShift(*reinterpret_cast< double*>(_v)); break;
}
_id -= 3;
} else if (_c == QMetaObject::ResetProperty) {
_id -= 3;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 3;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 3;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 3;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 3;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 3;
}
#endif // QT_NO_PROPERTIES
return _id;
}
示例14: dotytab
//.........这里部分代码省略.........
"ident", TYident, TYident, TYident, -1, 0, 0,
"template", TYtemplate, TYtemplate, TYtemplate, -1, 0, 0,
"vtshape", TYvtshape, TYvtshape, TYvtshape, -1, 0, 0,
};
FILE *f;
static unsigned tytab[64 * 4];
static tym_t tytouns[64 * 4];
static tym_t _tyrelax[TYMAX];
static tym_t _tyequiv[TYMAX];
static signed char _tysize[64 * 4];
static const char *tystring[TYMAX];
static unsigned char dttab[TYMAX];
static unsigned short dttab4[TYMAX];
int i;
#define T1(arr,mask) for (i=0; i<arraysize(arr); i++) \
{ tytab[arr[i]] |= mask; \
};
#define T2(arr,mask) for (i=0; i<arraysize(arr); i++) \
{ tytab[arr[i]] |= mask; \
};
T1(_ptr, TYFLptr);
T1(_ptr_nflat,TYFLptr);
T1(_real, TYFLreal);
T1(_integral, TYFLintegral);
T1(_imaginary,TYFLimaginary);
T1(_complex, TYFLcomplex);
T1(_uns, TYFLuns);
T1(_mptr, TYFLmptr);
T1(_fv, TYFLfv);
T2(_farfunc, TYFLfarfunc);
T2(_pasfunc, TYFLpascal);
T2(_revfunc, TYFLrevparam);
T2(_short, TYFLshort);
T2(_aggregate,TYFLaggregate);
T2(_ref, TYFLref);
T2(_func, TYFLfunc);
T2(_nullptr, TYFLnullptr);
T2(_pasfunc_nf, TYFLpascal);
T2(_revfunc_nf, TYFLrevparam);
T2(_ref_nflat, TYFLref);
T2(_func_nflat, TYFLfunc);
T1(_xmmreg, TYFLxmmreg);
T1(_simd, TYFLsimd);
#undef T1
#undef T2
f = fopen("tytab.c","w");
fprintf(f,"unsigned tytab[] =\n{ ");
for (i = 0; i < arraysize(tytab); i++)
{ fprintf(f,"0x%02x,",tytab[i]);
if ((i & 7) == 7 && i < arraysize(tytab) - 1)
fprintf(f,"\n ");
}
fprintf(f,"\n};\n");
#if 0
fprintf(f,"unsigned char tytab2[] =\n{ ");
for (i = 0; i < arraysize(tytab2); i++)
{ fprintf(f,"0x%02x,",tytab2[i]);
if ((i & 7) == 7 && i < arraysize(tytab2) - 1)
fprintf(f,"\n ");
示例15: check_result
inline void check_result(T2)
{
T1 a = T1();
T2 b = T2();
return check_result_imp(a, b);
}