当前位置: 首页>>代码示例>>C++>>正文


C++ q2函数代码示例

本文整理汇总了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 );
	}
开发者ID:ChenglongWang,项目名称:MIST,代码行数:7,代码来源:quaternion.cpp

示例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 );
	}
开发者ID:ChenglongWang,项目名称:MIST,代码行数:7,代码来源:quaternion.cpp

示例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 );
	}
开发者ID:ChenglongWang,项目名称:MIST,代码行数:7,代码来源:quaternion.cpp

示例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
}
开发者ID:falho,项目名称:clang-tools-extra,代码行数:25,代码来源:misc-string-constructor.cpp

示例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 );
	}
开发者ID:ChenglongWang,项目名称:MIST,代码行数:7,代码来源:quaternion.cpp

示例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));
        }
    }
}
开发者ID:lld2006,项目名称:my-c---practice-project,代码行数:30,代码来源:138.cpp

示例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;
}
开发者ID:cheerayhuang,项目名称:Garner,代码行数:26,代码来源:main.cpp

示例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;
}
开发者ID:ivcl,项目名称:SplitVectors,代码行数:31,代码来源:CIEColor_copy.cpp

示例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 );
	}
开发者ID:ChenglongWang,项目名称:MIST,代码行数:7,代码来源:quaternion.cpp

示例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;
    }
开发者ID:SePTimO7,项目名称:QuantLib,代码行数:32,代码来源:alphafinder.cpp

示例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;
}
开发者ID:netp,项目名称:Queue,代码行数:34,代码来源:main.cpp

示例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);
}
开发者ID:hb4837,项目名称:cpphdl,代码行数:28,代码来源:rtlinv.cpp

示例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));
}
开发者ID:qliang27,项目名称:Sfinx,代码行数:7,代码来源:barone_adesi_whaley.hpp

示例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; 
}
开发者ID:kuri-kustar,项目名称:object_recognition,代码行数:35,代码来源:pose_estimation.cpp

示例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);
}
开发者ID:apamburn,项目名称:3450,代码行数:29,代码来源:queue.cpp


注:本文中的q2函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。