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


C++ S2函数代码示例

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


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

示例1: intersection_conserve_mostaniso_2d

// preserve orientation of the most anisotropic metric in 2D!!!
SMetric3 intersection_conserve_mostaniso_2d (const SMetric3 &m1, const SMetric3 &m2)
{

  fullMatrix<double> V1(3,3);
  fullVector<double> S1(3);
  m1.eig(V1,S1,false);
  double ratio1 = anisoRatio2D(V1(0,0),V1(1,0),V1(2,0),
                               V1(0,1),V1(1,1),V1(2,1),
                               V1(0,2),V1(1,2),V1(2,2),
                               S1(0),S1(1),S1(2));

  fullMatrix<double> V2(3,3);
  fullVector<double> S2(3);
  m2.eig(V2,S2,false);
  double ratio2 = anisoRatio2D(V2(0,0),V2(1,0),V2(2,0),
                               V2(0,1),V2(1,1),V2(2,1),
                               V2(0,2),V2(1,2),V2(2,2),
                               S2(0),S2(1),S2(2));

  if (ratio1 < ratio2)
    return intersection_conserveM1(m1, m2);
  else
    return intersection_conserveM1(m2, m1);

}
开发者ID:fmach,项目名称:agros2d,代码行数:26,代码来源:STensor3.cpp

示例2: test

void test(int M)
{
  /* Original iterators. */
  int i, j;
  S3(2,1) ;
  S1(3,1) ;
  S1(4,1) ;
  S4(4,2) ;
  for (i=5;i<=M+1;i++) {
    S1(i,1) ;
    for (j=2;j<=floord(i-1,2);j++) {
      S2(i,j) ;
    }
    if (i%2 == 0) {
      S4(i,i/2) ;
    }
  }
  for (i=M+2;i<=2*M-1;i++) {
    for (j=i-M;j<=floord(i-1,2);j++) {
      S2(i,j) ;
    }
    if (i%2 == 0) {
      S4(i,i/2) ;
    }
  }
  i = 2*M ;
  S4(2*M,M) ;
}
开发者ID:Ced,项目名称:cloog,代码行数:28,代码来源:forwardsub-3-1-2.good.c

示例3: ROS_ERROR

/* This solves the equation A qdot = ydot for qdot using the weighted
 * pseudoinverse A_inv_weighted, where Wq denotes the weights of the joints and
 * Wy denotes the weights of the constraints.
 *
 * Note: Wq is a num_joints x num_joints matrix.
 * 	 Wy is a num_constraints x num_constraints matrix.
 */
bool SolverWeighted::solve(const Eigen::MatrixXd &A,
		const Eigen::VectorXd &ydot, const Eigen::MatrixXd &Wq,
		const Eigen::MatrixXd &Wy, Eigen::VectorXd &qdot, Eigen::MatrixXd &A_inv_weighted)
{
	// Create the Weighted Jacobian
	A_Wq = (A * Wq);
	Wy_A_Wq = (Wy * A_Wq);
	// Compute the SVD of the weighted jacobian
	int ret = KDL::svd_eigen_HH(Wy_A_Wq, U2, S2, V, tmp);
	if (ret < 0) {
        ROS_ERROR("SVD decomposition failed");
		return false;
	}

/* NOTE: ORIGINAL 'OPTIMIZED' CODE FROM LEUVEN HAD PROBLEMS WITH OVERSPECIFIED CASES
	// put U2 and S2 into U and S
	int block_size = std::min(num_constraints, num_joints);
	U.block(0, 0, block_size, block_size) = U2.block(0, 0, block_size, block_size);
	S.segment(0, block_size) = S2.segment(0, block_size);

	for (int j = 0; j < U.rows(); j++) {
		if (fabs(U2(j, num_joints - 1)) > EPSILON) {
            ROS_WARN("Element %d of the last column of U2 is not equal to zero, but = %f", j, U2(j, num_joints - 1));
		}
	}
	// FIXME: this check should be done for all entries of S2 from 7 to end.
	if (fabs(S2(num_joints - 1)) > EPSILON) {
        ROS_WARN("Last value of S2 is not equal to zero, but = %f", S2(num_joints - 1));
	}

	// Pre-multiply U and V by the task space and joint space weighting matrix respectively
	Wy_U = (Wy * U);
	Wq_V = (Wq * V);

	for (int i = 0; i < S.rows(); i++)
		Sinv(i, i) = (S(i) / (S(i) * S(i) + lambda * lambda));

	// qdot = Wq*V * S^-1 * U'*Wy' * ydot
	qdot = (Wq_V * Sinv * Wy_U.transpose() * ydot);

*/

       // BEGINNING RE-IMPLEMENTATION WITHOUT OPTIMIZATION

       // Pre-multiply U and V by the task space and joint space weighting matrix respectively
       Wy_U = (Wy * U2);
       Wq_V = (Wq * V);
 
       // invert S2 and also be aware of very small diagonale values
       for (unsigned int i = 0; i < S2.rows(); i++)
         Sinv2(i, i) = (S2(i) / (S2(i) * S2(i) + lambda * lambda));

       // finally calculate the results...
       // Ainv = Wq*V * S^-1 * U'*Wy'
       A_inv_weighted = Wq_V * Sinv2 * Wy_U.transpose();
       qdot = A_inv_weighted * ydot;

       return true;
}
开发者ID:airballking,项目名称:feature_constraints_controller,代码行数:66,代码来源:SolverWeighted.cpp

示例4: serpent_encrypt

static void serpent_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
{
	struct serpent_ctx *ctx = crypto_tfm_ctx(tfm);
	const u32
		*k = ctx->expkey;
	const __le32 *s = (const __le32 *)src;
	__le32	*d = (__le32 *)dst;
	u32	r0, r1, r2, r3, r4;

/*
 * Note: The conversions between u8* and u32* might cause trouble
 * on architectures with stricter alignment rules than x86
 */

	r0 = le32_to_cpu(s[0]);
	r1 = le32_to_cpu(s[1]);
	r2 = le32_to_cpu(s[2]);
	r3 = le32_to_cpu(s[3]);

				 K(r0,r1,r2,r3,0);
	S0(r0,r1,r2,r3,r4);	LK(r2,r1,r3,r0,r4,1);
	S1(r2,r1,r3,r0,r4);	LK(r4,r3,r0,r2,r1,2);
	S2(r4,r3,r0,r2,r1);	LK(r1,r3,r4,r2,r0,3);
	S3(r1,r3,r4,r2,r0);	LK(r2,r0,r3,r1,r4,4);
	S4(r2,r0,r3,r1,r4);	LK(r0,r3,r1,r4,r2,5);
	S5(r0,r3,r1,r4,r2);	LK(r2,r0,r3,r4,r1,6);
	S6(r2,r0,r3,r4,r1);	LK(r3,r1,r0,r4,r2,7);
	S7(r3,r1,r0,r4,r2);	LK(r2,r0,r4,r3,r1,8);
	S0(r2,r0,r4,r3,r1);	LK(r4,r0,r3,r2,r1,9);
	S1(r4,r0,r3,r2,r1);	LK(r1,r3,r2,r4,r0,10);
	S2(r1,r3,r2,r4,r0);	LK(r0,r3,r1,r4,r2,11);
	S3(r0,r3,r1,r4,r2);	LK(r4,r2,r3,r0,r1,12);
	S4(r4,r2,r3,r0,r1);	LK(r2,r3,r0,r1,r4,13);
	S5(r2,r3,r0,r1,r4);	LK(r4,r2,r3,r1,r0,14);
	S6(r4,r2,r3,r1,r0);	LK(r3,r0,r2,r1,r4,15);
	S7(r3,r0,r2,r1,r4);	LK(r4,r2,r1,r3,r0,16);
	S0(r4,r2,r1,r3,r0);	LK(r1,r2,r3,r4,r0,17);
	S1(r1,r2,r3,r4,r0);	LK(r0,r3,r4,r1,r2,18);
	S2(r0,r3,r4,r1,r2);	LK(r2,r3,r0,r1,r4,19);
	S3(r2,r3,r0,r1,r4);	LK(r1,r4,r3,r2,r0,20);
	S4(r1,r4,r3,r2,r0);	LK(r4,r3,r2,r0,r1,21);
	S5(r4,r3,r2,r0,r1);	LK(r1,r4,r3,r0,r2,22);
	S6(r1,r4,r3,r0,r2);	LK(r3,r2,r4,r0,r1,23);
	S7(r3,r2,r4,r0,r1);	LK(r1,r4,r0,r3,r2,24);
	S0(r1,r4,r0,r3,r2);	LK(r0,r4,r3,r1,r2,25);
	S1(r0,r4,r3,r1,r2);	LK(r2,r3,r1,r0,r4,26);
	S2(r2,r3,r1,r0,r4);	LK(r4,r3,r2,r0,r1,27);
	S3(r4,r3,r2,r0,r1);	LK(r0,r1,r3,r4,r2,28);
	S4(r0,r1,r3,r4,r2);	LK(r1,r3,r4,r2,r0,29);
	S5(r1,r3,r4,r2,r0);	LK(r0,r1,r3,r2,r4,30);
	S6(r0,r1,r3,r2,r4);	LK(r3,r4,r1,r2,r0,31);
	S7(r3,r4,r1,r2,r0);	 K(r0,r1,r2,r3,32);

	d[0] = cpu_to_le32(r0);
	d[1] = cpu_to_le32(r1);
	d[2] = cpu_to_le32(r2);
	d[3] = cpu_to_le32(r3);
}
开发者ID:08opt,项目名称:linux,代码行数:58,代码来源:serpent.c

示例5: S1

  namespace PR11851_Comment9 {
    struct S1 {
      constexpr S1() {}
      constexpr operator int() const { return 0; }
    };
    int k1 = sizeof(short{S1(S1())});

    struct S2 {
      constexpr S2() {}
      constexpr operator int() const { return 123456; }
    };
    int k2 = sizeof(short{S2(S2())}); // expected-error {{cannot be narrowed}} expected-note {{override}}
  }
开发者ID:Chxnew,项目名称:minix,代码行数:13,代码来源:constexpr-instantiate.cpp

示例6: pi_deleglise_rivat_parallel2

/// Calculate the number of primes below x using the
/// Deleglise-Rivat algorithm.
/// Run time: O(x^(2/3) / (log x)^2) operations, O(x^(1/3) * (log x)^3) space.
///
int64_t pi_deleglise_rivat_parallel2(int64_t x, int threads)
{
  if (x < 2)
    return 0;

  double alpha = get_alpha(x, 0.0017154, -0.0508992, 0.483613, 0.0672202);
  int64_t x13 = iroot<3>(x);
  int64_t y = (int64_t) (x13 * alpha);
  int64_t z = x / y;
  int64_t pi_y = pi_legendre(y, 1);
  int64_t c = PhiTiny::get_c(y);

  print("");
  print("=== pi_deleglise_rivat_parallel2(x) ===");
  print("pi(x) = S1 + S2 + pi(y) - 1 - P2");
  print(x, y, z, c, alpha, threads);

  int64_t p2 = P2(x, y, threads);
  int64_t s1 = S1(x, y, c, threads);
  int64_t s2_approx = S2_approx(x, pi_y, p2, s1);
  int64_t s2 = S2(x, y, z, c, s2_approx, threads);
  int64_t phi = s1 + s2;
  int64_t sum = phi + pi_y - 1 - p2;

  return sum;
}
开发者ID:WilliamAufort,项目名称:primecount,代码行数:30,代码来源:pi_deleglise_rivat_parallel2.cpp

示例7: intersection_conserve_mostaniso

// preserve orientation of the most anisotropic metric !!!
SMetric3 intersection_conserve_mostaniso (const SMetric3 &m1, const SMetric3 &m2)
{
  fullMatrix<double> V1(3,3);
  fullVector<double> S1(3);
  m1.eig(V1,S1,true);
  double ratio1 = fabs(S1(0)/S1(2));  // Minimum ratio because we take sorted eigenvalues
  fullMatrix<double> V2(3,3);
  fullVector<double> S2(3);
  m2.eig(V2,S2,true);
  double ratio2 = fabs(S2(0)/S2(2));  // Minimum ratio because we take sorted eigenvalues

  if (ratio1 < ratio2)
    return intersection_conserveM1(m1, m2);
  else
    return intersection_conserveM1(m2, m1);
}
开发者ID:fmach,项目名称:agros2d,代码行数:17,代码来源:STensor3.cpp

示例8: pi_deleglise_rivat2

/// Calculate the number of primes below x using the
/// Deleglise-Rivat algorithm.
/// Run time: O(x^(2/3) / (log x)^2) operations, O(x^(1/3) * (log x)^3) space.
///
int64_t pi_deleglise_rivat2(int64_t x)
{
  if (x < 2)
    return 0;

  double alpha = get_alpha_deleglise_rivat(x);
  int64_t x13 = iroot<3>(x);
  int64_t y = (int64_t) (x13 * alpha);
  int64_t c = PhiTiny::get_c(y);
  int64_t z = x / y;

  print("");
  print("=== pi_deleglise_rivat2(x) ===");
  print("pi(x) = S1 + S2 + pi(y) - 1 - P2");
  print(x, y, z, c, alpha, 1);

  int64_t p2 = P2(x, y, 1);
  int64_t pi_y = pi_legendre(y, 1);
  int64_t s1 = S1(x, y, c, 1);
  int64_t s2 = S2(x, y, z, c);
  int64_t phi = s1 + s2;
  int64_t sum = phi + pi_y - 1 - p2;

  return sum;
}
开发者ID:uxn,项目名称:primecount,代码行数:29,代码来源:pi_deleglise_rivat2.cpp

示例9: f

static inline void
f (S3 < int > s3)
{
  extern bool m;
  if (m)
    S2 (0).s (s3);
}
开发者ID:0day-ci,项目名称:gcc,代码行数:7,代码来源:pr44372.C

示例10: S2

 inline void SpawnTask::OnCancel() {
   m_syncTrigger.Do(
     [=] {
       if(m_state == 1) {
         return S2(StateEntry(State::CANCELED));
       }
     });
 }
开发者ID:eidolonsystems,项目名称:beam,代码行数:8,代码来源:SpawnTask.hpp

示例11: serpent256_encrypt

void _stdcall serpent256_encrypt(const unsigned char *in, unsigned char *out, serpent256_key *key)
{
	u32 *k = key->expkey;
	u32  r0, r1, r2, r3, r4;

	r0 = p32(in)[0]; r1 = p32(in)[1];
	r2 = p32(in)[2];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,r0,r3,r2);	LK(r0,r4,r3,r1,r2,25);
	S1(r0,r4,r3,r1,r2);	LK(r2,r3,r1,r0,r4,26);
	S2(r2,r3,r1,r0,r4);	LK(r4,r3,r2,r0,r1,27);
	S3(r4,r3,r2,r0,r1);	LK(r0,r1,r3,r4,r2,28);
	S4(r0,r1,r3,r4,r2);	LK(r1,r3,r4,r2,r0,29);
	S5(r1,r3,r4,r2,r0);	LK(r0,r1,r3,r2,r4,30);
	S6(r0,r1,r3,r2,r4);	LK(r3,r4,r1,r2,r0,31);
	S7(r3,r4,r1,r2,r0);	 K(r0,r1,r2,r3,32);

	p32(out)[0] = r0; p32(out)[1] = r1;
	p32(out)[2] = r2; p32(out)[3] = r3;
}
开发者ID:capturePointer,项目名称:DiskCryptor-1,代码行数:45,代码来源:serpent.c

示例12: sc_main

int sc_main(int ac, char *av[])
{
    //Signals
    sc_signal<double> in1;
    sc_signal<double> in2;
    sc_signal<double> sum;
    sc_signal<double> diff;
    sc_signal<double> prod;
    sc_signal<double> quot;
    sc_signal<double> powr;
    //Clock
    sc_signal<bool>   clk;

    numgen N("numgen");               //instance of `numgen' module
    N(in1, in2, clk );                //Positional port binding

    stage1 S1("stage1");              //instance of `stage1' module
    //Named port binding
    S1.in1(in1);
    S1.in2(in2);
    S1.sum(sum);
    S1.diff(diff);
    S1.clk(clk);

    stage2 S2("stage2");              //instance of `stage2' module
    S2(sum, diff, prod, quot, clk );  //Positional port binding

    stage3 S3("stage3");              //instance of `stage3' module
    S3( prod, quot, powr, clk);       //Positional port binding

    display D("display");             //instance of `display' module
    D(powr, clk);                     //Positional port binding

    sc_start(0, SC_NS);               //Initialize simulation
    for (int i = 0; i < 50; i++)
    {
        clk.write(1);
        sc_start( 10, SC_NS );
        clk.write(0);
        sc_start( 10, SC_NS );
    }

    return 0;
}
开发者ID:joelbarca,项目名称:nirgam,代码行数:44,代码来源:main.cpp

示例13: main

// Main routine for array-based queue driver class
int main(int argc, char** argv) {
  // Declare some sample lists
  AQueue<Int> S1;
  AQueue<Int*> S2(15);
  AQueue<int> S3;

  QueueTest<Int>(S1);
  QueueTest<int>(S3);
  return 0;
}
开发者ID:LeqiaoP1,项目名称:DSAA_Cpp,代码行数:11,代码来源:Aqueuemain.cpp

示例14: ut_typename

char *
ut_typename(int t) {
    switch (t) {
#define S(N) case N : return #N
#define S2(N,N2) case N : return #N2
        S(EMPTY);
        S(RUN_LVL);
        S(BOOT_TIME);
        S(OLD_TIME);
        S(NEW_TIME);
        S2(INIT_PROCESS,INIT);
        S2(LOGIN_PROCESS,LOGIN);
        S2(USER_PROCESS,USER);
        S2(DEAD_PROCESS,DEAD);
        S(ACCOUNTING);
    default:
        return "??";
    }
}
开发者ID:FarazShaikh,项目名称:likewise-open,代码行数:19,代码来源:dump-utmp.c

示例15: test

void test(int M)
{
  /* Scattering iterators. */
  int c1, c2;
  /* Original iterators. */
  int i, j;
  for (c1=1;c1<=4;c1++) {
    for (c2=5;c2<=M-10;c2++) {
      S1(c1,c2) ;
    }
  }
  for (c1=5;c1<=min(M-10,9);c1++) {
    for (c2=-c1+1;c2<=4;c2++) {
      i = c1+c2 ;
      S2(c1+c2,c1) ;
    }
    for (c2=5;c2<=M-10;c2++) {
      S1(c1,c2) ;
      i = c1+c2 ;
      S2(c1+c2,c1) ;
    }
    for (c2=M-9;c2<=-c1+M;c2++) {
      i = c1+c2 ;
      S2(c1+c2,c1) ;
    }
  }
  if (M >= 20) {
    for (c2=-9;c2<=4;c2++) {
      i = c2+10 ;
      S2(c2+10,10) ;
    }
    for (c2=5;c2<=M-10;c2++) {
      S1(10,c2) ;
      i = c2+10 ;
      S2(c2+10,10) ;
    }
  }
  for (c1=11;c1<=M-10;c1++) {
    for (c2=-c1+1;c2<=4;c2++) {
      i = c1+c2 ;
      S2(c1+c2,c1) ;
    }
    for (c2=5;c2<=-c1+M;c2++) {
      S1(c1,c2) ;
      i = c1+c2 ;
      S2(c1+c2,c1) ;
    }
    for (c2=-c1+M+1;c2<=M-10;c2++) {
      S1(c1,c2) ;
    }
  }
  for (c1=M-9;c1<=M;c1++) {
    for (c2=5;c2<=M-10;c2++) {
      S1(c1,c2) ;
    }
  }
}
开发者ID:Ced,项目名称:cloog,代码行数:57,代码来源:gesced2.good.c


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