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

C++ r3函数代码示例

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

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



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

示例1: imp3

void Constraint::ApplyImpulse()
{
    if (bodyA != NULL && bodyA->mass < w_vars->UNMOVABLE_MASS)
    {
        bodyA->velocity = bodyA->velocity + Impulse * bodyA->iMass;
        double iinrt1 = bodyA->iInert;
        Vector3 imp3(Impulse.v1, Impulse.v2, 0);
        Vector3 r3(rA.v1, rA.v2, 0);
        r3 = r3.cross(imp3);
        double ro1 = r3.v3;

        bodyA->angle_vel += iinrt1 * ro1;
        bodyA->angle_vel += iinrt1 * Torque;
    }
    if (bodyB != NULL && bodyB->mass < w_vars->UNMOVABLE_MASS)
    {
        bodyB->velocity = bodyB->velocity - Impulse * bodyB->iMass;
        double iinrt2 = bodyB->iInert;
        Vector3 imp3(Impulse.v1, Impulse.v2, 0);
        Vector3 r3(rB.v1, rB.v2, 0);
        r3 = r3.cross(imp3);
        double ro2 = r3.v3;
        bodyB->angle_vel -= iinrt2 * ro2;
        bodyB->angle_vel -= iinrt2 * Torque;
    }
}
开发者ID:happanda,项目名称:Engine,代码行数:26,代码来源:Constraint.cpp


示例2: TEST

TEST(SegmentTest, swaps)
{
  {
    RAJA::RangeSegment r1(0, 5);
    RAJA::RangeSegment r2(1, 6);
    RAJA::RangeSegment r3(r1);
    RAJA::RangeSegment r4(r2);
    std::swap(r1, r2);
    ASSERT_EQ(r1, r4);
    ASSERT_EQ(r2, r3);
  }
  {
    RAJA::RangeStrideSegment r1(0, 5, 2);
    RAJA::RangeStrideSegment r2(1, 6, 1);
    RAJA::RangeStrideSegment r3(r1);
    RAJA::RangeStrideSegment r4(r2);
    std::swap(r1, r2);
    ASSERT_EQ(r1, r4);
    ASSERT_EQ(r2, r3);
  }
  {
    RAJA::Index_type vals[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    RAJA::ListSegment r1(vals, 5, RAJA::Unowned);
    RAJA::ListSegment r2(vals + 5, 5, RAJA::Unowned);
    ASSERT_NE(r1, r2);
    RAJA::ListSegment r3(r1);
    RAJA::ListSegment r4(r2);
    std::swap(r1, r2);
    ASSERT_EQ(r1, r4);
    ASSERT_EQ(r2, r3);
  }
}
开发者ID:LLNL,项目名称:RAJA,代码行数:32,代码来源:test-segments.cpp


示例3: BprojCore_dag

void Dirac_DomainWall_4D::
BprojCore_dag(double* f1,double* fN,const double* f) const{

  // f1 = f5(0), fN = f5(N5_-1)
  for(int c=0; c<NC_; ++c){
    double fup_r = 0.5*(f[r0(c)] +f[r2(c)]);
    double fup_i = 0.5*(f[i0(c)] +f[i2(c)]);
    double fdn_r = 0.5*(f[r1(c)] +f[r3(c)]);
    double fdn_i = 0.5*(f[i1(c)] +f[i3(c)]);

    fN[r0(c)] = fup_r;   fN[i0(c)] = fup_i;
    fN[r1(c)] = fdn_r;   fN[i1(c)] = fdn_i;
    fN[r2(c)] = fup_r;   fN[i2(c)] = fup_i;
    fN[r3(c)] = fdn_r;   fN[i3(c)] = fdn_i;

    fup_r -= f[r2(c)]; //0.5*(f[r0(c)] -f[r2(c)])
    fup_i -= f[i2(c)]; //0.5*(f[i0(c)] -f[i2(c)])
    fdn_r -= f[r3(c)]; //0.5*(f[r1(c)] -f[r3(c)])
    fdn_i -= f[i3(c)]; //0.5*(f[i1(c)] -f[i3(c)])

    f1[r0(c)] = fup_r;   f1[i0(c)] = fup_i;
    f1[r1(c)] = fdn_r;   f1[i1(c)] = fdn_i;
    f1[r2(c)] =-fup_r;   f1[i2(c)] =-fup_i;
    f1[r3(c)] =-fdn_r;   f1[i3(c)] =-fdn_i;
  }
}
开发者ID:coppolachan,项目名称:IroIro,代码行数:26,代码来源:dirac_WilsonLike.cpp


示例4:

void GammaMatrix::isigma24core(double* w,const double* f)const{
  for(int c=0; c<Ncol_; ++c){
    w[r0(c)] = f[r3(c)];  w[i0(c)] = f[i3(c)];
    w[r1(c)] =-f[r2(c)];  w[i1(c)] =-f[i2(c)];
    w[r2(c)] = f[r1(c)];  w[i2(c)] = f[i1(c)];
    w[r3(c)] =-f[r0(c)];  w[i3(c)] =-f[i0(c)];
  }
}
开发者ID:coppolachan,项目名称:IroIro,代码行数:8,代码来源:wilsonLikeUtils.cpp


示例5:

void DiracWilsonLike::gamma5core(double* w,const double* f)const{
  for(int c=0; c<N; ++c){
    w[r0(c)] = f[r2(c)];  w[i0(c)] = f[i2(c)];
    w[r1(c)] = f[r3(c)];  w[i1(c)] = f[i3(c)];
    w[r2(c)] = f[r0(c)];  w[i2(c)] = f[i0(c)];
    w[r3(c)] = f[r1(c)];  w[i3(c)] = f[i1(c)];
  }
}
开发者ID:coppolachan,项目名称:IroIro,代码行数:8,代码来源:dirac_WilsonLike.cpp


示例6: projMcore

void GammaMatrix::projMcore(double* w,const double* f)const{
  for(int c=0; c<Ncol_; ++c){
    double fup_r = 0.5*(f[r0(c)] -f[r2(c)]);
    double fup_i = 0.5*(f[i0(c)] -f[i2(c)]);
    double fdn_r = 0.5*(f[r1(c)] -f[r3(c)]);
    double fdn_i = 0.5*(f[i1(c)] -f[i3(c)]);
    w[r0(c)] = fup_r;   w[i0(c)] = fup_i;
    w[r1(c)] = fdn_r;   w[i1(c)] = fdn_i;
    w[r2(c)] =-fup_r;   w[i2(c)] =-fup_i;
    w[r3(c)] =-fdn_r;   w[i3(c)] =-fdn_i;
  }
}
开发者ID:coppolachan,项目名称:IroIro,代码行数:12,代码来源:wilsonLikeUtils.cpp


示例7: projMcore

void DiracWilsonLike::projMcore(double* w,const double* f)const{
  for(int c=0; c<N; ++c){
    double fup_r = 0.5*(f[r0(c)] -f[r2(c)]);
    double fup_i = 0.5*(f[i0(c)] -f[i2(c)]);
    double fdn_r = 0.5*(f[r1(c)] -f[r3(c)]);
    double fdn_i = 0.5*(f[i1(c)] -f[i3(c)]);
    w[r0(c)] = fup_r;   w[i0(c)] = fup_i;
    w[r1(c)] = fdn_r;   w[i1(c)] = fdn_i;
    w[r2(c)] =-fup_r;   w[i2(c)] =-fup_i;
    w[r3(c)] =-fdn_r;   w[i3(c)] =-fdn_i;
  }
}
开发者ID:coppolachan,项目名称:IroIro,代码行数:12,代码来源:dirac_WilsonLike.cpp


示例8: testClassBasics

bool testClassBasics() {
   bool passedTests=true;

   RealNumber a=1,b=-22,c=5+5,d(1),e(2,1),f(-3),g(2,3);

   if(passedTests)
      passedTests = (a == 1);
   if(passedTests)
      passedTests = (b == -22);
   if(passedTests)
      passedTests = (c == 10);
   if(passedTests)
      passedTests = (d == 1);
   if(passedTests)
      passedTests = (e == 2);
   if(passedTests)
      passedTests = (f == -3);
   if(passedTests)
      passedTests = (g != 2 && g != 3);

   RealNumber r1(20,30), r2(30,30), r3(30,20), r4(2,3), r5(3,2);
   RealNumber r6 = r4;
   if(passedTests)
      passedTests = (r1 == r4);
   if(passedTests)
      passedTests = (r5 == r3);
   if(passedTests)
      passedTests = (r2 != r3);
   if(passedTests)
      passedTests = (r1 != r3);
   if(passedTests)
      passedTests = (r6 == r4);

   return passedTests;
}
开发者ID:mikedll,项目名称:linalg,代码行数:35,代码来源:TestRealNumber.cpp


示例9: 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


示例10: rotateAround

TVector3<float> rotateAround( const TVector3<float>& v,
                              const TVector3<float>& axis,
                              float angle )
{
	float one = 1.0f;

    if ( Math::notZero( angle ) )
    {
        float sangle = sin( Math::Pi * angle / 180.0f );
        float cangle = cos( Math::Pi * angle / 180.0f );
        float xangle = one - cangle;    // "1 minus cos angle"

        TVector3<float> u  = normalized( axis );
        TVector3<float> r1( u.mX * u.mX + cangle * ( one - u.mX * u.mX ),
                               u.mX * u.mY * xangle - sangle * u.mZ,
                               u.mY * u.mZ * xangle + sangle * u.mY );
        TVector3<float> r2( u.mX * u.mY * xangle + sangle * u.mZ,
                               u.mY * u.mY + cangle * ( one - u.mY * u.mY ),
                               u.mY * u.mZ * xangle - sangle * u.mX );
        TVector3<float> r3( u.mX * u.mZ * xangle - sangle * u.mY,
                               u.mY * u.mZ * xangle + sangle * u.mX,
                               u.mZ * u.mZ + cangle * ( one - u.mZ * u.mZ ) );

        return TVector3<float>( dot( v, r1 ),
                                   dot( v, r2 ),
                                   dot( v, r3 ) );
    }
    else
    {
        return v;
    }
}
开发者ID:smacdo,项目名称:smath,代码行数:32,代码来源:vector.cpp


示例11: main

int main()
{
  // initialize grid. params are read from input file
  GRID grid;

  // initialize a result object on grid
  Result result(&grid);

  // fill in Delta by initializing it to semi-circle
  InitDelta(DOStypes::SemiCircle, grid.get_N(), 0.2, 0.0, 0.01, 0.5, result.omega, result.Delta);

  result.mu = 0.1;
  result.n = 0.5;
  result.mu0 = 0.3; 
 
  //make a copy
  Result r2(result);
  //r2.CopyFrom(&result);
  r2.mu = 0.2;  
  r2.Delta[1000] = 7;

  result.PrintResult("Result.dat");
  r2.PrintResult("Result.dat.c");  

  Result r3(&grid);
  // this way mu, n and mu0 are not read
  r3.ReadFromFile("Result.dat.c");
  r3.n = 0.3;  
  r3.PrintResult("Result.dat.cc");  
  
  return 0;
}
开发者ID:MilosRadonjic,项目名称:DMFT,代码行数:32,代码来源:main_result.cpp


示例12: taylorSample

/** An sample for taylor expansion of logdet(X). */
void taylorSample() {

  std::string ans;
  char rowChar[5];
  int rowTmp = ROW;
  sprintf(rowChar, "%d", rowTmp);
  std::string row = rowChar;
  // Initialize the matrices.
  symbolic_matrix_type X("X", ROW, COL);
  symbolic_matrix_type X0("X0", ROW, COL);
  symbolic_matrix_type Delta("(X-X0)", ROW, COL);
    
  AMD::SymbolicScalarMatlab a2("1/2!");
  AMD::SymbolicScalarMatlab a3("1/3!"); 
  SymbolicSMFunc r2(a2,ROW,COL);
  SymbolicSMFunc r3(a3,ROW, COL);

  // Initialize MatrixMatrixFunction. 
  SymbolicMMFunc fX(X, false);
  SymbolicMMFunc fX0(X0, false);
  SymbolicMMFunc fDelta(Delta, true);

  // Compute Taylor series iteratively. 
  SymbolicSMFunc f0 =  logdet(fX0);
  SymbolicSMFunc f1 = trace(fDelta * transpose(*f0.derivativeFuncVal));
  SymbolicSMFunc f2 = trace(fDelta * transpose(*f1.derivativeFuncVal));
  SymbolicSMFunc f3 = trace(fDelta * transpose(*f2.derivativeFuncVal));
  // Taylor Expansion. 
  SymbolicSMFunc func = f0 + f1 + r2*f2 + r3*f3;

  std::cout<<"The first 4 terms of Taylor Expansion for logdet(X) around X0 is:";
  std::cout << std::endl;
  std::cout << func.functionVal.getString() << std::endl;

}
开发者ID:yyzreal,项目名称:AMD,代码行数:36,代码来源:TaylorSample.cpp


示例13: rMax

void CDrawArea::SelfTest()
{
#ifdef _DEBUG
    CDrawArea a,b,c;
    CRect<int> rMax(0,0,640,400);
    CRect<int> r1(0,0,100,100);
    CRect<int> r2(0,0,500,300);
    CRect<int> r3(200,200,300,300);
    CRect<int> rTooBig(0,0,1000,1000);

    ASSERT(a.Size()==0);

    a.Combine(r1);
    ASSERT(a.Size()==1);
    ASSERT(a.Rect(0,rMax).Equals(r1));
    a.Combine(r3);
    ASSERT(a.Size()==2);
    ASSERT(a.Rect(0,rMax).Equals(r1));
    ASSERT(a.Rect(1,rMax).Equals(r3));
    a.Combine(r2);
    ASSERT(a.Size()==1);
    ASSERT(a.Rect(0,rMax).Equals(r2));
    a.Combine(rTooBig);
    ASSERT(a.Size()==1);
#endif
}
开发者ID:emlai,项目名称:tapankaikki,代码行数:26,代码来源:CDrawArea.cpp


示例14: QVERIFY

void tst_QPicture::boundingRect()
{
    QPicture p1;
    // default value
    QVERIFY( !p1.boundingRect().isValid() );

    QRect r1( 20, 30, 5, 15 );
    p1.setBoundingRect( r1 );
    QCOMPARE( p1.boundingRect(), r1 );
    p1.setBoundingRect(QRect());

    QPainter pt( &p1 );
    pt.drawLine( 10, 20, 110, 80 );
    pt.end();

    // assignment and copy constructor
    QRect r2( 10, 20, 100, 60 );
    QCOMPARE( p1.boundingRect(), r2 );
    QPicture p2( p1 );
    QCOMPARE( p1.boundingRect(), r2 );
    QPicture p3;
    p3 = p1;
    QCOMPARE( p1.boundingRect(), r2 );

    {
        QPicture p4;
        QPainter p(&p4);
        p.drawLine(0, 0, 5, 0);
        p.drawLine(0, 0, 0, 5);
        p.end();

        QRect r3(0, 0, 5, 5);
        QCOMPARE(p4.boundingRect(), r3);
    }
}
开发者ID:mpvader,项目名称:qt,代码行数:35,代码来源:tst_qpicture.cpp


示例15: test_reference

template<typename MatrixType> void test_reference(const MatrixType& m) {
  typedef typename MatrixType::Scalar Scalar;
  enum { Flag          =  MatrixType::IsRowMajor ? Eigen::RowMajor : Eigen::ColMajor};
  enum { TransposeFlag = !MatrixType::IsRowMajor ? Eigen::RowMajor : Eigen::ColMajor};
  typename MatrixType::Index rows = m.rows(), cols=m.cols();
  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Flag         > MatrixX;
  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, TransposeFlag> MatrixXT;
  // Dynamic reference:
  typedef Eigen::Ref<const MatrixX  > Ref;
  typedef Eigen::Ref<const MatrixXT > RefT;

  Ref r1(m);
  Ref r2(m.block(rows/3, cols/4, rows/2, cols/2));
  RefT r3(m.transpose());
  RefT r4(m.topLeftCorner(rows/2, cols/2).transpose());

  VERIFY_RAISES_ASSERT(RefT r5(m));
  VERIFY_RAISES_ASSERT(Ref r6(m.transpose()));
  VERIFY_RAISES_ASSERT(Ref r7(Scalar(2) * m));

  // Copy constructors shall also never malloc
  Ref r8 = r1;
  RefT r9 = r3;

  // Initializing from a compatible Ref shall also never malloc
  Eigen::Ref<const MatrixX, Unaligned, Stride<Dynamic, Dynamic> > r10=r8, r11=m;

  // Initializing from an incompatible Ref will malloc:
  typedef Eigen::Ref<const MatrixX, Aligned> RefAligned;
  VERIFY_RAISES_ASSERT(RefAligned r12=r10);
  VERIFY_RAISES_ASSERT(Ref r13=r10); // r10 has more dynamic strides

}
开发者ID:Aerobota,项目名称:eigen,代码行数:33,代码来源:nomalloc.cpp


示例16: test

int test()
{
	//Test it correctly or not
	MyRectangle enclosingRect(40, 40);
	MyRectangle r1(15, 30);
	MyRectangle r2(20, 25);
	MyRectangle r5(10, 10);
	MyRectangle r4(20, 8);
	MyRectangle r3(9, 7);

	std::vector<MyRectangle> listRect;
	listRect.push_back(r1);
	listRect.push_back(r2);
	listRect.push_back(r3);
	listRect.push_back(r4);
	listRect.push_back(r5);

	Node node(0, 0, 40, 40);

	node.packWithNoPreSort(listRect, node);
	for (auto rect : listRect)
	{
		rect.print();
	}


std:cout << "here is packing alogorthim in codeproject\n";
	PackingAlogorithm pa;
	pa.pack(listRect, enclosingRect);
	for (auto rect : listRect)
	{
		rect.print();
	}
}
开发者ID:ducthangho,项目名称:3D,代码行数:34,代码来源:main.cpp


示例17: abort

Foam::cylindricalCS Foam::arcEdge::calcAngle()
{
    vector a = p2_ - p1_;
    vector b = p3_ - p1_;

    // find centre of arcEdge
    scalar asqr = a & a;
    scalar bsqr = b & b;
    scalar adotb = a & b;

    scalar denom = asqr*bsqr - adotb*adotb;

    if (mag(denom) < VSMALL)
    {
        FatalErrorInFunction
            << denom
            << abort(FatalError);
    }

    scalar fact = 0.5*(bsqr - adotb)/denom;

    point centre = 0.5*a + fact*((a ^ b) ^ a);

    centre += p1_;

    // find position vectors w.r.t. the arcEdge centre
    vector r1(p1_ - centre);
    vector r2(p2_ - centre);
    vector r3(p3_ - centre);

    // find angles
    angle_ = radToDeg(acos((r3 & r1)/(mag(r3) * mag(r1))));

    // check if the vectors define an exterior or an interior arcEdge
    if (((r1 ^ r2) & (r1 ^ r3)) < 0.0)
    {
        angle_ = 360.0 - angle_;
    }

    vector tempAxis;

    if (angle_ <= 180.0)
    {
        tempAxis = r1 ^ r3;

        if (mag(tempAxis)/(mag(r1)*mag(r3)) < 0.001)
        {
            tempAxis = r1 ^ r2;
        }
    }
    else
    {
        tempAxis = r3 ^ r1;
    }

    radius_ = mag(r3);

    // set up and return the local coordinate system
    return cylindricalCS("arcEdgeCS", centre, tempAxis, r1);
}
开发者ID:BarisCumhur,项目名称:OpenFOAM-dev,代码行数:60,代码来源:arcEdge.C


示例18: DEF_TEST

DEF_TEST(Data, reporter) {
    const char* str = "We the people, in order to form a more perfect union.";
    const int N = 10;

    SkAutoTUnref<SkData> r0(SkData::NewEmpty());
    SkAutoTUnref<SkData> r1(SkData::NewWithCopy(str, strlen(str)));
    SkAutoTUnref<SkData> r2(SkData::NewWithProc(new int[N], N*sizeof(int),
                                           delete_int_proc, gGlobal));
    SkAutoTUnref<SkData> r3(SkData::NewSubset(r1, 7, 6));

    assert_len(reporter, r0, 0);
    assert_len(reporter, r1, strlen(str));
    assert_len(reporter, r2, N * sizeof(int));
    assert_len(reporter, r3, 6);

    assert_data(reporter, r1, str, strlen(str));
    assert_data(reporter, r3, "people", 6);

    SkData* tmp = SkData::NewSubset(r1, strlen(str), 10);
    assert_len(reporter, tmp, 0);
    tmp->unref();
    tmp = SkData::NewSubset(r1, 0, 0);
    assert_len(reporter, tmp, 0);
    tmp->unref();

    test_cstring(reporter);
    test_files(reporter);
}
开发者ID:trevorlinton,项目名称:skia,代码行数:28,代码来源:DataRefTest.cpp


示例19: main

int main()
try {
    // constructors
    Rational r1;
    Rational r2(5);
    Rational r3(7,3);
    cout << "r1: " << r1 << endl
        << "r2: " << r2 << endl
        << "r3: " << r3 << endl;

    // operators
    cout << "5/3 + 7/2 = " << Rational(5,3) + Rational(7/2) <<
        " = " << (Rational(5,3) + Rational(7/2)).conv_double() << endl;
    cout << "8/5 - 40/7 = " << Rational(8,5) - Rational(40,7) <<
        " = " << (Rational(8,5) - Rational(40,7)).conv_double() << endl;
    cout << "10/11 * 17/18 = " << Rational(10,11) * Rational(17,18) <<
        " = " << (Rational(10,11) * Rational(17,18)).conv_double() << endl;
    //cout << "5 / (0/3) = " << Rational(5) / Rational(0,3) << endl;
    cout << "(5/7) / (1/3) = " << Rational(5,7) / Rational(1,3) <<
        " = " << (Rational(5,7) / Rational(1,3)).conv_double() << endl;

    if (r1 == Rational(0,1)) cout << "r1 == 0/1" << endl;
    if (Rational(1,2) == Rational(2,4)) cout << "1/2 == 2/4" << endl;
    if (r2 != r2) cout << "r2 != r2" << endl;

    cout << r3 << " = " << r3.conv_double() << endl;
}
catch (exception& e) {
    cerr << "exception: " << e.what() << endl;
}
catch (...) {
    cerr << "exception" << endl;
}
开发者ID:AndrewFrauens,项目名称:stroustrup_ppp,代码行数:33,代码来源:chapter09_ex13.cpp


示例20: test_loadstore_fp16

    TheTest & test_loadstore_fp16()
    {
#if CV_FP16 && CV_SIMD128
        AlignedData<R> data;
        AlignedData<R> out;

        if(1 /* checkHardwareSupport(CV_CPU_FP16) */ )
        {
            // check if addresses are aligned and unaligned respectively
            EXPECT_EQ((size_t)0, (size_t)&data.a.d % 16);
            EXPECT_NE((size_t)0, (size_t)&data.u.d % 16);
            EXPECT_EQ((size_t)0, (size_t)&out.a.d % 16);
            EXPECT_NE((size_t)0, (size_t)&out.u.d % 16);

            // check some initialization methods
            R r1 = data.u;
            R r2 = v_load_f16(data.a.d);
            R r3(r2);
            EXPECT_EQ(data.u[0], r1.get0());
            EXPECT_EQ(data.a[0], r2.get0());
            EXPECT_EQ(data.a[0], r3.get0());

            // check some store methods
            out.a.clear();
            v_store_f16(out.a.d, r1);
            EXPECT_EQ(data.a, out.a);
        }

        return *this;
#endif
    }
开发者ID:gini,项目名称:opencv,代码行数:31,代码来源:test_intrin_utils.hpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ r300_context函数代码示例发布时间:2022-05-30
下一篇:
C++ r2函数代码示例发布时间: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