本文整理汇总了C++中q2函数的典型用法代码示例。如果您正苦于以下问题:C++ q2函数的具体用法?C++ q2怎么用?C++ q2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了q2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Op_GE_001
void Op_GE_001( )
{
quaternion_type q1( 2, 3, 3, 4 );
quaternion_type q2( 1, 2, 3, 4 );
CPPUNIT_ASSERTION( q1 > q2 );
}
示例2: Op_LE_004
void Op_LE_004( )
{
quaternion_type q1( 1, 2, 3, 4 );
quaternion_type q2( 1, 2, 4, 4 );
CPPUNIT_ASSERTION( q1 <= q2 );
}
示例3: Op_GT_004
void Op_GT_004( )
{
quaternion_type q1( 1, 2, 3, 5 );
quaternion_type q2( 1, 2, 3, 4 );
CPPUNIT_ASSERTION( q1 > q2 );
}
示例4: Test
void Test() {
std::string str('x', 4);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: constructor parameters are probably swapped [misc-string-constructor]
std::wstring wstr(L'x', 4);
// CHECK-MESSAGES: [[@LINE-1]]:16: warning: constructor parameters are probably swapped
std::string s0(0, 'x');
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: constructor creating an empty string
std::string s1(-4, 'x');
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: negative value used as length parameter
std::string s2(0x1000000, 'x');
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: suspicious large length parameter
std::string q0("test", 0);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: constructor creating an empty string
std::string q1(kText, -4);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: negative value used as length parameter
std::string q2("test", 200);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: length is bigger then string literal size
std::string q3(kText, 200);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: length is bigger then string literal size
std::string q4(kText2, 200);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: length is bigger then string literal size
std::string q5(kText3, 0x1000000);
// CHECK-MESSAGES: [[@LINE-1]]:15: warning: suspicious large length parameter
}
示例5: Op_LT_003
void Op_LT_003( )
{
quaternion_type q1( 1, 2, 3, 4 );
quaternion_type q2( 1, 2, 4, 4 );
CPPUNIT_ASSERTION( q1 < q2 );
}
示例6: max_dig_pell
//only for x^2 - 2y^2= -1;
void max_dig_pell(int num, vector<int>& vroot, vector<I64Pair>& results)
{
results.clear();
i64 p0(vroot[0]);
i64 q0(1);
i64 p1(vroot[0]*vroot[1]+1);
i64 q1(vroot[1]);
i64 p2(1);
i64 q2(1);
results.push_back(I64Pair(p0,q0));
vroot.erase(vroot.begin());
int vsize = vroot.size();
//int r = vsize - 1;
int start = 2;
for(int s = start; true; ++s){
int idx = (s-1)%vsize;
int value = vroot[idx];
p2 = p1*(value) + p0;
q2 = q1*(value) + q0;
p0 = p1; q0 = q1;
p1 = p2; q1 = q2;
if(p2 > 1e18) break;
if((s)%(2) == 0) {
assert(p1*p1-5*q1*q1==-1);
results.push_back(I64Pair(p1, q1));
}
}
}
示例7: main
int main() {
queue<int> q;
q.push(10);
std::cout << q << std::endl;
std::vector<int> vec(5, 1);
queue<int> q3(vec.begin(), vec.end());
std::cout << q3 << std::endl;
int a[] = {1, 2, 3, 4, 5};
queue<int> q2(a, a+5);
std::cout << q2 << std::endl;
queue<int> q4;
q4 = q3;
std::cout << q4 << std::endl;
return 0;
}
示例8: p0
vector<double> CIEColor::SinglehueSequential(double t, double s, double b, double c, double h)
{
int N=10;
vector<double> Pseg;
vector<double> p0(3,0),p1(3,0), p2(3,0), q0(3,0), q1(3,0), q2(3,0);
p2[0]=100, p2[1]=0, p2[2]=h;
p1=dividingLCHuvforMSC_H(0,100,h);
p0[0]=0, p0[1]=0, p0[2]=h;
q0[0] = (1-s) * p0[0] + s *p1[0];
q0[1] = (1-s) * p0[1] + s *p1[1];
q0[2] = (1-s) * p0[2] + s *p1[2];
q2[0] = (1-s) * p2[0] + s *p1[0];
q2[1] = (1-s) * p2[1] + s *p1[1];
q2[2] = (1-s) * p2[2] + s *p1[2];
q1[0] = (q0[0] + q2[0])/2;
q1[1] = (q0[1] + q2[1])/2;
q1[2] = (q0[2] + q2[2])/2;
vector<double> T = getT(p0, p1, p2, q0, q1, q2, 125-125*pow(0.2,(1-c)*b+t*c));
Pseg = getCseg(p0, p1, p2, q0, q1, q2, T[0]);
Pseg[2]=h;
double r, g, k;
//LCHuvtoRGB(Pseg[0], Pseg[1], Pseg[2], r, g, k);
closestLCHuvtoRGB(Pseg[0], Pseg[1], Pseg[2], r, g, k);
Pseg[0]= r, Pseg[1]=g, Pseg[2]=k;
return Pseg;
}
示例9: Op_GE_005
void Op_GE_005( )
{
quaternion_type q1( 1, 2, 3, 5 );
quaternion_type q2( 1, 2, 3, 4 );
CPPUNIT_ASSERTION( q1 >= q2 );
}
示例10: q2
bool AlphaFinder::finalPart(Real alphaFound,
Integer stepindex,
const std::vector<Volatility>& ratetwohomogeneousvols,
Real quadraticPart,
Real linearPart,
Real constantPart,
Real& alpha,
Real& a,
Real& b,
std::vector<Volatility>& ratetwovols) {
alpha = alphaFound;
quadratic q2(quadraticPart, linearPart, constantPart-targetVariance_ );
parametricform_->setAlpha(alpha);
Real y; // dummy
q2.roots(a,y);
Real varSoFar=0.0;
for (Integer i =0; i < stepindex+1; ++i) {
ratetwovols[i] = ratetwohomogeneousvols[i] *
(*parametricform_)(i) * a;
varSoFar += ratetwovols[i]* ratetwovols[i];
}
Real VarToFind = totalVar_-varSoFar;
if (VarToFind < 0)
return false;
Real requiredSd = std::sqrt(VarToFind);
b = requiredSd / (ratetwohomogeneousvols[stepindex+1] *
(*parametricform_)(stepindex));
ratetwovols[stepindex+1] = requiredSd;
return true;
}
示例11: main
int main (int argc, char * const argv[]) {
Queue<int> q1;
q1.insere( 13 );
q1.insere( 15 );
q1.insere( 12 );
q1.insere( 38 );
q1.insere( 98 );
Queue<int> q2( q1 );
int x;
std::cout << q1
<< std::endl
<< q2
<< std::endl
<< "o primeiro elemento da fila 2 é: "
<< q2.frente()
<< std::endl
<< "o último elemento da fila 2 é: "
<< q2.ultimo()
<< std::endl
;
q2.retira( x );
std::cout << "Retirando o elemento "
<< x
<< " da fila. Esta fica com o elementos: "
<< std::endl
<< q2
;
return 0;
}
示例12: main
main(int argc, char *argv[]) {
node gnd;
node n1("n1");
node n2("n2");
node n3("n3");
node n4("n4");
node n5("n5");
node n6("n6");
vdc vcc("vcc", n6, gnd, 5.0);
vpulse vin("vin", n1, gnd, 0, 5, 2e-9, 2e-9, 2e-9, 10e-9);
r rb1("rb1", n1, n2, 10e3);
r rc1("rc1", n6, n3, 1e3);
qnd q1("q1", n3, n2, gnd);
r rb2("rb2", n3, n4, 10e3);
qnd q2("q2", n5, n4, gnd);
r rc2("rc2", n6, n5, 1e3);
op::monitor = 1;
op();
plot::output = *argv;
plot::add("n1", "n3", "n5");
tran::tsmin = 1.0e-30;
tran::monitor = 1;
tran(0.2e-9, 20.0e-9);
}
示例13: seed_Ss
Num seed_Ss(Num N, Num M, Num X, Num T, Num b, Num v)
{
Num q2u = q2(N, M, 1.0);
Num su = X / (1 - 1 / q2u);
Num h2 = -(b * T + 2 * v * sqrt(T)) * X / (su - X);
return X + (su - X) * (1 - exp(h2));
}
示例14: q2
float poseEstimation::orientationDistance(cluster & c1, const cluster & c2)
{
float _distance;
// Compute distance between rotations
_distance=(c1.meanPose.transform.rotation.w() * c2.meanPose.transform.rotation.w()) +
(c1.meanPose.transform.rotation.x() * c2.meanPose.transform.rotation.x()) +
(c1.meanPose.transform.rotation.y() * c2.meanPose.transform.rotation.y()) +
(c1.meanPose.transform.rotation.z() * c2.meanPose.transform.rotation.z());
if(_distance< (-pointPair::angleStepCos) )
{
//std::cout << "before change: " << 2*acos(_distance)*RAD_TO_DEG << std::endl;
// Compute distance between rotations
Eigen::Quaternion<float> q2(-c1.meanPose.transform.rotation.w(),-c1.meanPose.transform.rotation.x(),-c1.meanPose.transform.rotation.y(),-c2.meanPose.transform.rotation.z());
c1.meanPose.transform.rotation=q2;
_distance=(c1.meanPose.transform.rotation.w() * c2.meanPose.transform.rotation.w()) +
(c1.meanPose.transform.rotation.x() * c2.meanPose.transform.rotation.x()) +
(c1.meanPose.transform.rotation.y() * c2.meanPose.transform.rotation.y()) +
(c1.meanPose.transform.rotation.z() * c2.meanPose.transform.rotation.z());
//std::cout << "after change: " << 2*acos(_distance)*RAD_TO_DEG << std::endl;
}
if(_distance >= 1.0000000000)
{
_distance=1.00000000;
// std::cout << "UPS" << std::endl;
}
return _distance;
}
示例15: main
int main() {
//test ints
Deque<int> deq;
Queue<int> q(&deq);
q.add(1);
q.add(2);
//Swap implementation
List<int> lst;
lst.push_back(3);
q.changeImpl(&lst);
q.add(4);
q.add(5);
displayAndEmptyQueue(q);
//Test strings
Deque<string> deq2;
Queue<string> q2(&deq2);
q2.add("1");
q2.add("2");
//Swap Implementation
List<string> lst2;
lst2.push_back("3");
q2.changeImpl(&lst2);
q2.add("4");
q2.add("5");
displayAndEmptyQueue(q2);
}