int main(int argc, char **argv) { int i,f,j,k; f=1; table[0][0]=1; table[1][0]=1; printf("1 \n"); printf("1 1 \n"); while(f) { for(i=2;f;i++) { set_a(); temp[0][0]=1; for(j=1;j<i;j++) { add(j); if(check(j)){ f=0;} } temp[i][0]=1; print(); for(j=0;j<400;j++) { for(k=0;k<100;k++) { table[j][k]=temp[j][k]; } } } } return 0; }
/* INCREASES IP FOR SCANNING. */ unsigned int dns_inc_ip(void){ if(((ip_i>>24)&0xff)>=254&&((ip_i>>16)&0xff)==255&&((ip_i>>8)&0xff)==255) ip_i=a_blocks[set_a(block_i)]; if(((ip_i>>24)&0xff)>=254&&((ip_i>>16)&0xff)==255) ip_i+=((1<<24)+(1<<16)+(1<<8)); if(((ip_i>>24)&0xff)>=254) ip_i+=((3<<24)+(1<<16)); else ip_i+=(1<<24);
OrbitProto *LineOrbit::serialize() { auto ret = new OrbitProto(); ret->set_max_value(max_value); auto lop = new LineOrbitProto(); lop->set_a(a); lop->set_b(b); lop->set_c(c); ret->set_allocated_lineorbit(lop); return ret; }
void SymbExpr::replace(SymbExpr *searched_se, SymbExpr *new_se){ if (_a != NULL && *_a == *searched_se){ set_a(new_se); } else if (_a != NULL /* && *_a != *searched_se */ ) _a->replace(searched_se, new_se); if (_b != NULL && *_b == *searched_se){ set_b(new_se); } else if (_b != NULL /* && *_b != *searched_se */ ) _b->replace(searched_se, new_se); }
void PCR::initialize_params(){ set_a(1.0); set_b(1.0); Vector h = response_histogram(); Vector b = beta(); b[0] = 0; b.back()=0.001; // a should not be zero for(uint i=1; i<h.size(); ++i) b[i] = log(h[i]/h[0]); set_beta(b); }
//Determine values for the orbital elements for the requested JD, then //call KSAsteroid::findGeocentricPosition() bool KSPluto::findGeocentricPosition( const KSNumbers *num, const KSPlanetBase *Earth ) { //First, set the orbital element values according to the current epoch double t = num->julianCenturies(); set_a( a0 + a1*t ); set_e( e0 + e1*t ); set_i( i0.Degrees() + i1*t ); set_N( N0.Degrees() + N1*t ); set_M( M0.Degrees() + M1*t ); set_P( 365.2568984 * pow((a0+a1*t), 1.5) ); //set period from Kepler's 3rd law setJD( num->julianDay() ); return KSAsteroid::findGeocentricPosition( num, Earth ); }
int main ( int argc, const char *argv[] ) { int n,m,*p,*q,result; printf ( "Informe o numero de elementos de A: \n" ); // le a quatidade que A tera de n elementos scanf ( "%d", &n ); printf ( "Informe os elementos de A: \n" ); // chama a funcao para preencher o vetor e p aponta p=set_a(n); printf ( "Informe o numero de elementos de B: \n" ); // le a quantidade que B tera de m elementos scanf ( "%d", &m ); printf ( "Informe os elementos de B: \n" ); // chama a funcao para preencher o vetor e q aponta q=set_b(m); // recebe o resultado 1 ou 0 result = a_contains_b(p,n,q,m); if (result==1) { printf ( "A esta contido em B\n" ); } else { printf ( "A nao esta contido em B\n" ); } // recebe o resultado 1 ou 0 result = ab_equals_ba(p,n,q,m); if (result==1) { printf ( "A=B\n" ); } else { printf ( "A!=B\n" ); } return 0; }
double rk_main(double alpha,double epsilon,double h_init){ double x=0,y=1,y4,y5,h=h_init; double a[6][6],b5[6],b4[6],c[6]; set_a(a); set_b4(b4); set_b5(b5); set_c(c); printf("#\t%s\t%s\t%s\t%s\n","x","y","h","dy/dx"); while(x<10.0){ rk_step(x,y,h,a,b4,c,&y4); rk_step(x,y,h,a,b5,c,&y5); if(y4-y5<epsilon){ printf("\t%f\t%f\t%e\t%f\n",x,y,h,f(x)); x+=h; y=y5; h=alpha*h*pow(epsilon/fabs(y4-y5),0.2); }else{ h=h/2; } } return y; }
void SEAdd::canonize(void){ // recursive call if (_a) _a->canonize(); if (_b) _b->canonize(); // [+, [K, <val1>], [K, <val2>]] -> [K, eval(<val1> + <val2>)] // This case will replace this in _parent ! if (_parent && _a && _a->op() == CONST && _b && _b->op() == CONST){ if (_parent->a() == this){ // WILL DELETE this ! _parent->set_a(new SEConst(_a->val() + _b->val())); return; } else if (_parent->b() == this){ // WILL DELETE this ! _parent->set_b(new SEConst(_a->val() + _b->val())); return; } } // [+, [K, <val1>], <expr1>] -> [+, <expr1>, [K, <val1>]] if (_a && _a->op() == CONST && _b){ SymbExpr *expr = _b; _b = _a; _a = expr; } // [+, [+, V, <expr1>], <expr2>] -> [+, V, canonize([+, <expr1>, <expr2>])] // with V either a SEReg or a SEAddr if (_a && _a->op() == ADD && _a->a() && (_a->a()->op() == REG || _a->a()->op() == ADDR)){ SEAdd *newb = new SEAdd(_a->b()->copy(), _b); newb->canonize(); _b = newb; set_a(_a->a()); } }
static void test_search() { printf ("Testing operation search (internal)\n"); KeySet *a = set_a(); Key *s = keyNew("user/a", KEY_END); ssize_t result; keySetName (s, "user/0"); result = ksSearchInternal (a, s); succeed_if (result == 0, "insertpos wrong"); keySetName (s, "user/a"); result = ksSearchInternal (a, s); succeed_if (result == 1, "insertpos wrong"); keySetName (s, "user/a/0"); result = ksSearchInternal (a, s); succeed_if (result == -3, "insertpos wrong"); keySetName (s, "user/a/a"); result = ksSearchInternal (a, s); succeed_if (result == 2, "insertpos wrong"); keySetName (s, "user/a/a/a"); result = ksSearchInternal (a, s); succeed_if (result == 3, "insertpos wrong"); keySetName (s, "user/a/a/b"); result = ksSearchInternal (a, s); succeed_if (result == 4, "insertpos wrong"); keySetName (s, "user/a/b"); result = ksSearchInternal (a, s); succeed_if (result == 5, "insertpos wrong"); keySetName (s, "user/a/b/a"); result = ksSearchInternal (a, s); succeed_if (result == 6, "insertpos wrong"); keySetName (s, "user/a/b/b"); result = ksSearchInternal (a, s); succeed_if (result == 7, "insertpos wrong"); keySetName (s, "user/a/c"); result = ksSearchInternal (a, s); succeed_if (result == 8, "insertpos wrong"); keySetName (s, "user/a/d"); result = ksSearchInternal (a, s); succeed_if (result == 9, "insertpos wrong"); keySetName (s, "user/a/x"); result = ksSearchInternal (a, s); succeed_if (result == -11, "insertpos wrong"); keySetName (s, "user/a/x/a"); result = ksSearchInternal (a, s); succeed_if (result == 10, "insertpos wrong"); keySetName (s, "user/a/x/b"); result = ksSearchInternal (a, s); succeed_if (result == 11, "insertpos wrong"); keySetName (s, "user/a/x/c"); result = ksSearchInternal (a, s); succeed_if (result == 12, "insertpos wrong"); keySetName (s, "user/a/x/c/a"); result = ksSearchInternal (a, s); succeed_if (result == 13, "insertpos wrong"); keySetName (s, "user/a/x/c/b"); result = ksSearchInternal (a, s); succeed_if (result == 14, "insertpos wrong"); keySetName (s, "user/x"); result = ksSearchInternal (a, s); succeed_if (result == 15, "insertpos wrong"); /* Generation of new Testcases: for (int i=0; i< 16; ++i) { s = a->array[i]; printf ("keySetName (s, \"%s\");\n", keyName(s)); printf ("result = ksSearchInternal (a, s);\n"); printf ("succeed_if (result == %zd, \"insertpos wrong\");\n\n", ksSearchInternal (a, s)); } */ keyDel (s); ksDel (a); }
int main() { set_a(12); set_a(3.14); set_a("feep"); }
Mod& Mod::operator++(){ set_a( get_a() + 1 ); return *this; }
Mod& Mod::operator=(const Mod& mod){ set_a(mod.get_a()); }
void SECmp::canonize(void){ // recursive call if (_a) _a->canonize(); if (_b) _b->canonize(); if (_op == CMP || _op == CMPU) return; // we need a determinated CMP for further canonization bool cancont; do{ cancont=false; // [<log_op>, [cmp, <expr1>, <expr2>]] -> [<log_op>, <expr1>, expr2>] if (_a && _a->op() == CMP && _b == NULL){ set_b(_a->b()); // we must set b first, because we'll erase _a set_a(_a->a()); cancont = true; } // The same for unsigned compare if (_a && _a->op() == CMPU && _b == NULL){ /* change the operator into unsigned form */ switch(_op){ case LE: _op = ULE; break; case LT: _op = ULT; break; case GE: _op = UGE; break; case GT: _op = UGT; break; default: break; } set_b(_a->b()); // we must set b first, because we'll erase _a set_a(_a->a()); cancont = true; } // [<log_op>, [K, <valeur>], <expr>] && <expr> != const // -> [reverse(<log_op>), <expr>, [K, <valeur>]] if (_a && _b && _a->op() == CONST && _b->op() != CONST){ _op = reverse(_op); SymbExpr *expr = _b; _b = _a; _a = expr; cancont = true; } // [<log_op>, [+, <expr0>, <expr1>], <expr2>] // -> [<log_op>, <expr0>, canonize([+, <expr2>, [-, <expr1>]])] if (_a && _b && _a->op() == ADD && _a->a() && _a->b()){ SEAdd newb = SEAdd(_b->copy(), new SENeg(_a->b()->copy())); set_b(&newb); set_a(_a->a()); _b->canonize(); cancont = true; } // [<log_op>, [-, <expr0>], expr1] // -> [reverse(<log_op>), <expr0>, canonize([-, <expr1>])] if (_a && _b && _a->op() == NEG && _a->a()){ _op = reverse(_op); set_a(_a->a()); SymbExpr *newb = new SENeg(_b->copy()); set_b(newb); delete newb; _b->canonize(); cancont = true; } }while(cancont); }
SymbExpr& SECmp::operator=(const SECmp& expr){ _op = expr._op; set_a(expr._a); set_b(expr._b); return *this; }
SymbExpr& SENeg::operator=(const SENeg& expr){ _op = expr._op; set_a(expr._a); return *this; }
void BM::set_params(double a, double b){set_a(a); set_b(b);}
Mod& Mod::operator--(){ set_a( get_a() - 1 ); return *this; }
int access_Bad() { set_a(10); return arr[idx]; }
void simulate_thread_main() { set_a(1); }