• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ q2函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中q2函数的典型用法代码示例。如果您正苦于以下问题:C++ q2函数的具体用法?C++ q2怎么用?C++ q2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了q2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: TEST

TEST(Bullet, QuaternionTimesEqual)
{
  btQuaternion q1 (btVector3(1,0,0), M_PI/2.0);
  btQuaternion q2 (btVector3(0,0,1), M_PI/2.0);

  btQuaternion q3 (q1);
  q3*=q2;
  printf("(%f,%f,%f,%f)*(%f,%f,%f,%f)=(%f,%f,%f,%f)\n",q1.x(), q1.y(), q1.z(), q1.getAngle(), q2.x(), q2.y(), q2.z(), q2.getAngle(), q3.x(), q3.y(), q3.z(), q3.getAngle());

  btMatrix3x3 m3(q3);

  btVector3 xout = m3*btVector3(1,0,0);
  btVector3 yout = m3*btVector3(0,1,0);
  btVector3 zout = m3*btVector3(0,0,1);
  printf("(%f, %f, %f), (%f, %f, %f), (%f, %f, %f)\n", 
         xout.x(), xout.y(), xout.z() ,
         yout.x(), yout.y(), yout.z() ,
         zout.x(), zout.y(), zout.z());
  q3 = q1;
  q3*=q1;
  printf("(%f,%f,%f,%f)*(%f,%f,%f,%f)=(%f,%f,%f,%f)\n",q2.x(), q2.y(), q2.z(), q2.getAngle(), q1.x(), q1.y(), q1.z(), q1.getAngle(), q3.x(), q3.y(), q3.z(), q3.getAngle());

  m3.setRotation(q3);

  xout = m3*btVector3(1,0,0);
  yout = m3*btVector3(0,1,0);
  zout = m3*btVector3(0,0,1);
  printf("(%f, %f, %f), (%f, %f, %f), (%f, %f, %f)\n", 
         xout.x(), xout.y(), xout.z() ,
         yout.x(), yout.y(), yout.z() ,
         zout.x(), zout.y(), zout.z());
}
开发者ID:janfrs,项目名称:kwc-ros-pkg,代码行数:32,代码来源:bullet_unittest.cpp


示例17: main

void main() {
  QuickFind q1(10);
  q1.Connect(3, 7);
  q1.Connect(6, 7);
  q1.Connect(0, 9);
  q1.Connect(2, 4);
  q1.Connect(8, 7);
  q1.Connect(6, 5);
  q1.PrintArray();

  QuickUnion q2(10);
  q2.Connect(1, 7);
  q2.Connect(6, 0);
  q2.Connect(2, 8);
  q2.Connect(2, 3);
  q2.Connect(7, 6);
  q2.Connect(3, 5);
  q2.Connect(9, 4);
  q2.Connect(9, 8);
  q2.Connect(8, 6);
  q2.PrintArray();

  QuickUnion q3(10);
  q3.Connect(9, 8);
  q3.Connect(9, 7);
  q3.Connect(9, 2);
  q3.Connect(4, 0);
  q3.Connect(4, 9);
  q3.Connect(1, 5);
  q3.Connect(3, 6);
  q3.Connect(3, 1);
  q3.Connect(9, 3);
  q3.PrintArray();
}
开发者ID:yuwilbur,项目名称:Coursera-PrincetonAlgorithms,代码行数:34,代码来源:main.cpp


示例18: main

int main()
{
    test<int> q(make<C>(5), test_allocator<int>(4));
    test<int> q2(q, test_allocator<int>(5));
    assert(q2.get_allocator() == test_allocator<int>(5));
    assert(q2.size() == 5);
}
开发者ID:themiwi,项目名称:libcxx,代码行数:7,代码来源:ctor_copy_alloc.pass.cpp


示例19: findMinHeightTrees

 vector<int> findMinHeightTrees(int n, vector<pair<int, int>>& edges) {
     vector<int> ans;
     if(!n)
         return ans;
     if(n == 1){
         ans.push_back(0);
         return ans;
     }
     vector<int> deg(n);
     for(int i = 0; i < edges.size(); ++ i){
         ++ deg[edges[i].first];
         ++ deg[edges[i].second];
     }
     vector<unordered_set<int>> mp(n);
     for(int i = 0; i < edges.size(); ++ i){
         mp[edges[i].first].insert(edges[i].second);
         mp[edges[i].second].insert(edges[i].first);
     }
     vector<int> q1(n), q2(n);
     int front1 = 0, rear1 = 0, rear2 = 0, num = n;
     for(int i = 0; i < n; ++ i){
         if(deg[i] == 1){
             q1[rear1 ++] = i;
             -- deg[i];
         }
     }
     
     if(n == 2){
         for(int i = 0; i < n; ++ i)
             ans.push_back(i);
     }else{
         while(front1 < rear1){
             rear2 = 0;
             while(front1 < rear1){
                 int cur = q1[front1 ++];
                 unordered_set<int>::iterator it = mp[cur].begin();
                 -- num;
                 for(; it != mp[cur].end(); ++ it){
                     -- deg[*it];
                     if(deg[*it] == 1){
                         q2[rear2 ++] = *it;
                     }
                 }
             }
             
             for(int i = 0; i < rear2; ++ i)
                 q1[rear1 ++] = q2[i];
                 
             if(num <= 2)
                 break;
         }
         
         ans.resize(rear1 - front1);
         ans[0] = q1[front1];
         if(rear1 - front1 == 2)
             ans[1] = q1[front1 + 1];
     }
     
     return ans;
 }
开发者ID:yular,项目名称:CC--InterviewProblem,代码行数:60,代码来源:leetcode_minimum-height-trees.cpp


示例20: main

int main(void)
{
	static const struct st3 a = {1, 2, 3, 4, 5, 6};

	l1(100);
	l2(100, 200);
	l3(100, 200, 300);
	l4(100, 200, 300, 400);
	l5(100, 200, 300, 400, 500);
	l6(100, 200, 300, 400, 500, 600);
	l7(100, 200, 300, 400, 500, 600, 700);
	l8(100, 200, 300, 400, 500, 600, 700, 800);

	d1();
	d2(43);
	d3(100, 200);
	d4(a);
	d5('a', 43, a);
	d6('a', 1);

	c1(44);
	c2(100, 'a', 3.4);
	c3(200, 2.777, 'q');
	c4(200, 1);
	c5(1.1, 2.2);
	c6(1.23, 45.6);
	c7('z', 0x200);

	a1('a');
	a2(10);
	a3(20);
	a4(102030405060LL);

	b1('a', 20);
	b2(30, 'b');
	b3(10, 20, 30, 40, 50, 60);

	s1(sx);
	s1p(&sx);
	s2(sy);
	s3(sz);
	s4(sq);
	s5(sa);
	s6(sb);

	r1();
	r3();
	r4();

	q1(200, sx);
	q2(300, 't', sx);
	q3(400, 410, sy);
	q4(500, 510, sq);
	q5(600, 610, 'z', 'q', sq);

	real1("fresh air");
	real2();

	return 0;
}
开发者ID:jkkm,项目名称:latrace,代码行数:60,代码来源:test1.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ qA函数代码示例发布时间:2022-05-30
下一篇:
C++ q1函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap