// 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); }
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) ; }
/* 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; }
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); }
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}} }
/// 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; }
/// Calculate the number of primes below x using the /// Lagarias-Miller-Odlyzko algorithm. /// Run time: O(x^(2/3) / log x) operations, O(x^(1/3) * (log x)^2) space. /// int64_t pi_lmo_parallel3(int64_t x, int threads) { if (x < 2) return 0; double alpha = get_alpha_lmo(x); int64_t x13 = iroot<3>(x); int64_t y = (int64_t) (x13 * alpha); int64_t z = x / y; int64_t c = PhiTiny::get_c(y); print(""); print("=== pi_lmo_parallel3(x) ==="); print("pi(x) = S1 + S2 + pi(y) - 1 - P2"); print(x, y, z, c, alpha, threads); int64_t p2 = P2(x, y, threads); vector<int32_t> mu = generate_moebius(y); vector<int32_t> lpf = generate_least_prime_factors(y); vector<int32_t> primes = generate_primes(y); int64_t pi_y = primes.size() - 1; 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, c, s2_approx, primes, lpf, mu, threads); int64_t phi = s1 + s2; int64_t sum = phi + pi_y - 1 - p2; return sum; }
// 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); }
/// 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; }
static inline void f (S3 < int > s3) { extern bool m; if (m) S2 (0).s (s3); }
inline void SpawnTask::OnCancel() { m_syncTrigger.Do( [=] { if(m_state == 1) { return S2(StateEntry(State::CANCELED)); } }); }
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]; r3 = p32(in)[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); p32(out)[0] = r0; p32(out)[1] = r1; p32(out)[2] = r2; p32(out)[3] = r3; }
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; }
// 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; }
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 "??"; } }
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) ; } } }
void test() { /* Scattering iterators. */ int c1; /* Original iterators. */ int i; S1(); S3(0); S2(); S3(1); }
void test(int M, int N) { /* Original iterators. */ int i, j; for (i=0;i<=N;i++) { for (j=0;j<=i;j++) { S1(i,j) ; S2(i,j) ; } } for (i=N+1;i<=M;i++) { for (j=0;j<=N;j++) { S1(i,j) ; S2(i,j) ; } for (j=N+1;j<=i;j++) { S1(i,j) ; } } }
void test(int m, int n, int p, int q) { /* Original iterators. */ int i; for (i=m;i<=min(min(n,p-1),q);i++) { S1(i) ; } for (i=p;i<=min(min(q,m-1),n);i++) { S2(i) ; } for (i=max(m,p);i<=min(n,q);i++) { S1(i) ; S2(i) ; } for (i=max(m,q+1);i<=n;i++) { S1(i) ; } for (i=max(p,n+1);i<=q;i++) { S2(i) ; } }
inline void SpawnTask::S5() { m_state = 5; if(m_taskCount == 0 && m_triggerIsComplete) { // C0 return S2(StateEntry(State::COMPLETE)); } else { //! ~C0 return S1(); } }
void main(void){ // Животные - непарнокопытные: лошади,зебры,ослы { clrscr(); Animal A("неизвестное"); Solipeds S("Чудо"), S2("Мистер_Х"); Horse H("Пегас"), H2("Мустанг"); Zebra K("Хабл"), K1("Форидка"); Donkey D("Гавр"), D2("МегаМозг"); cout<<"\nD ты кто? ";S.WhoAreYou(); cout<<"\nT ты кто? ";H.WhoAreYou(); cout<<endl; } getchar(); }//======================================================================
void test(int n) { /* Scattering iterators. */ int p3; /* Original iterators. */ int j, l, m; for (p3=0;p3<=n;p3++) { S1(p3,0,0) ; } for (p3=0;p3<=n;p3++) { S2(0,p3,0) ; } }
static void __serpent_setkey_sbox(u32 r0, u32 r1, u32 r2, u32 r3, u32 r4, u32 *k) { k += 100; S3(r3, r4, r0, r1, r2); store_and_load_keys(r1, r2, r4, r3, 28, 24); S4(r1, r2, r4, r3, r0); store_and_load_keys(r2, r4, r3, r0, 24, 20); S5(r2, r4, r3, r0, r1); store_and_load_keys(r1, r2, r4, r0, 20, 16); S6(r1, r2, r4, r0, r3); store_and_load_keys(r4, r3, r2, r0, 16, 12); S7(r4, r3, r2, r0, r1); store_and_load_keys(r1, r2, r0, r4, 12, 8); S0(r1, r2, r0, r4, r3); store_and_load_keys(r0, r2, r4, r1, 8, 4); S1(r0, r2, r4, r1, r3); store_and_load_keys(r3, r4, r1, r0, 4, 0); S2(r3, r4, r1, r0, r2); store_and_load_keys(r2, r4, r3, r0, 0, -4); S3(r2, r4, r3, r0, r1); store_and_load_keys(r0, r1, r4, r2, -4, -8); S4(r0, r1, r4, r2, r3); store_and_load_keys(r1, r4, r2, r3, -8, -12); S5(r1, r4, r2, r3, r0); store_and_load_keys(r0, r1, r4, r3, -12, -16); S6(r0, r1, r4, r3, r2); store_and_load_keys(r4, r2, r1, r3, -16, -20); S7(r4, r2, r1, r3, r0); store_and_load_keys(r0, r1, r3, r4, -20, -24); S0(r0, r1, r3, r4, r2); store_and_load_keys(r3, r1, r4, r0, -24, -28); k -= 50; S1(r3, r1, r4, r0, r2); store_and_load_keys(r2, r4, r0, r3, 22, 18); S2(r2, r4, r0, r3, r1); store_and_load_keys(r1, r4, r2, r3, 18, 14); S3(r1, r4, r2, r3, r0); store_and_load_keys(r3, r0, r4, r1, 14, 10); S4(r3, r0, r4, r1, r2); store_and_load_keys(r0, r4, r1, r2, 10, 6); S5(r0, r4, r1, r2, r3); store_and_load_keys(r3, r0, r4, r2, 6, 2); S6(r3, r0, r4, r2, r1); store_and_load_keys(r4, r1, r0, r2, 2, -2); S7(r4, r1, r0, r2, r3); store_and_load_keys(r3, r0, r2, r4, -2, -6); S0(r3, r0, r2, r4, r1); store_and_load_keys(r2, r0, r4, r3, -6, -10); S1(r2, r0, r4, r3, r1); store_and_load_keys(r1, r4, r3, r2, -10, -14); S2(r1, r4, r3, r2, r0); store_and_load_keys(r0, r4, r1, r2, -14, -18); S3(r0, r4, r1, r2, r3); store_and_load_keys(r2, r3, r4, r0, -18, -22); k -= 50; S4(r2, r3, r4, r0, r1); store_and_load_keys(r3, r4, r0, r1, 28, 24); S5(r3, r4, r0, r1, r2); store_and_load_keys(r2, r3, r4, r1, 24, 20); S6(r2, r3, r4, r1, r0); store_and_load_keys(r4, r0, r3, r1, 20, 16); S7(r4, r0, r3, r1, r2); store_and_load_keys(r2, r3, r1, r4, 16, 12); S0(r2, r3, r1, r4, r0); store_and_load_keys(r1, r3, r4, r2, 12, 8); S1(r1, r3, r4, r2, r0); store_and_load_keys(r0, r4, r2, r1, 8, 4); S2(r0, r4, r2, r1, r3); store_and_load_keys(r3, r4, r0, r1, 4, 0); S3(r3, r4, r0, r1, r2); storekeys(r1, r2, r4, r3, 0); }
int main() { SONE S(1.2, 0), S1(0, 1), S2(1,-0.7); try { S2.SolveNewton(); } catch (std::exception &e) { std::cout << e.what() << std::endl; } std::cin.get(); }
//---- Run function void runAction() { switch(*pstate) { case 0://---- S0 initialisation if( S0S1() ) { S1(); *pstate = 1; } else if( S0S2() ) { S2(); *pstate = 2; } else { //-- Give error alert message; } break; case 1: //---- S1 move robots in position if( S1S2() ) { S2(); *pstate = 2; } else S1(); break; case 2: //---- S2 robots in position if( S2S1() ) { S1(); *pstate = 1; } else S2(); break; default: //---- Give error alert message break; } return; }
void test(int M) { /* Scattering iterators. */ int c1, c2; /* Original iterators. */ int i, j, k; if (M >= 2) { for (c2=2;c2<=M;c2++) { for (j=2;j<=M;j++) { S2(1,j,c2) ; } } } for (c1=2;c1<=M-1;c1++) { for (c2=c1+1;c2<=M;c2++) { for (j=1;j<=c1-1;j++) { S1(c1,j,c2) ; } for (j=c1+1;j<=M;j++) { S2(c1,j,c2) ; } } } }
AbstractModel::SufficientStatisticsVector MultivariateModel ::GetSufficientStatistics(const Realizations &R, const Observations& Obs) { /// Computation of the suffisient statistics of the model /// Basically, it is a vector (named S1 to S9) of vectors /// S1 <- y_ij * eta_ij & S2 <- eta_ij * eta_ij VectorType S1(m_NbTotalOfObservations), S2(m_NbTotalOfObservations); auto itS1 = S1.begin(), itS2 = S2.begin(); for(size_t i = 0; i < m_NumberOfSubjects; ++i) { for(size_t j = 0; j < Obs.GetNumberOfTimePoints(i); ++j) { VectorType PC = ComputeParallelCurve(i, j); *itS1 = dot_product(PC, Obs.GetSubjectCognitiveScore(i, j)); *itS2 = PC.squared_magnitude(); ++itS1, ++itS2; } } /// S3 <- Ksi_i & S4 <- Ksi_i * Ksi_i VectorType S3 = R.at("Ksi"); VectorType S4 = R.at("Ksi") % R.at("Ksi"); /// S5 <- Tau_i & S6 <- Tau_i * Tau_i VectorType S5 = R.at("Tau"); VectorType S6 = R.at("Tau") % R.at("Tau"); /// S7 <- G VectorType S7(1, R.at("G", 0)); /// S8 <- beta_k VectorType S8((m_ManifoldDimension-1) * m_NbIndependentSources); ScalarType * itS8 = S8.memptr(); for(size_t i = 0; i < S8.size(); ++i) itS8[i] = R.at("Beta#" + std::to_string(i), 0); /// S8 <- delta_k VectorType S9(m_ManifoldDimension - 1); ScalarType * itS9 = S9.memptr(); for(size_t i = 1; i < S9.size(); ++i) itS9[i] = R.at("Delta#" + std::to_string(i), 0); return {S1, S2, S3, S4, S5, S6, S7, S8, S9}; }
void vpTemplateTrackerWarp::warpTriangle(const vpTemplateTrackerTriangle &in,const vpColVector &p, vpTemplateTrackerTriangle &out) { if (p.size() < 2) { vpCTRACE << "Bad template tracker warp parameters dimension. Should never occur. " << std::endl; throw(vpException(vpException::dimensionError, "Bad template tracker warp parameters dimension")); } vpColVector S1(2),S2(2),S3(2); vpColVector rS1(2),rS2(2),rS3(2); in.getCorners(S1,S2,S3); computeDenom(S1,p); warpX(S1,rS1,p); computeDenom(S2,p); warpX(S2,rS2,p); computeDenom(S3,p); warpX(S3,rS3,p); out.init(rS1,rS2,rS3); }
inline bool compare_and_assign_( S1 const& input , V const& v , S2& output ) { if(compare_(c_str_data(input), c_str_len(input), c_str_data(v.first), c_str_len(v.first))) { S2(c_str_data(v.second), c_str_len(v.second)).swap(output); return true; } return false; }
void test(int M) { /* Scattering iterators. */ int c2, c4; /* Original iterators. */ int i, j; for (c2=1;c2<=M;c2++) { for (c4=1;c4<=M;c4++) { S1(c2,c4) ; } } for (c2=1;c2<=M;c2++) { for (c4=1;c4<=M;c4++) { S2(c2,c4) ; } } }