double nie_alphas(double x1,double x2,double re0,double rcore,double qe) { double res0; res0 = re0/sqrt(1-qe*qe); double al1,al2; al1 = atan(x1*sqrt(1-qe*qe)/(hfunc(x1,x2,rcore,qe)+rcore)); al2 = atanh(x2*sqrt(1-qe*qe)/(hfunc(x1,x2,rcore,qe)+rcore*qe*qe)); return res0*al1*res0*al2; }
// method to remove data TEMPLATE_HEADER void STORAGE::remove( const Key & key ){ size_t hash = hfunc(key) % table_size; if ( table[hash] != 0 ) { table[hash]->erase(key); } }
T get_server(const P & skey) { //std::hash<P> hfunc; paracel::hash_type<P> hfunc; auto key = hfunc(skey); auto server = srv_hashring[paracel::ring_bsearch(srv_hashring, key)]; return srv_hashring_dct[server]; }
double nie_phi(double x1,double x2,double re0,double rcore,double qe) { double res0; res0 = re0/sqrt(1-qe*qe); double al1,al2; al1 = res0*atan(x1*sqrt(1-qe*qe)/(hfunc(x1,x2,rcore,qe)+rcore)); al2 = res0*atanh(x2*sqrt(1-qe*qe)/(hfunc(x1,x2,rcore,qe)+rcore*qe*qe)); double res1; res1 = x1*al1+x2*al2; double res2; res2 = re0*rcore*log(sqrt(pow((hfunc(x1,x2,rcore,qe)+rcore),2.0)+(1-qe*qe)*x1*x1)); double res; res = res1-res2; return res; }
// see if desired key has been used in this table TEMPLATE_HEADER bool STORAGE::exist( const Key & key ) const{ size_t hash = hfunc(key) % table_size; if ( table[hash] == 0 ){ return false; }else{ return (table[hash]->find(key) != table[hash]->end() ); } }
// gets(key) → value, unique boost::optional<std::pair<V, paracel::hash_return_type> > gets(const K & k) { if(auto v = get(k)) { std::pair<V, paracel::hash_return_type> ret(*v, hfunc(*v)); return boost::optional< std::pair<V, paracel::hash_return_type> >(ret); } else { return boost::none; } }
void ida(){ //起始状态就是目标状态 DEPTH = (hfunc()+2)/3; while(DEPTH < 5 && dfsSearch(1))DEPTH++; if(DEPTH == 5){ printf("5 or more\n"); } else{ printf("%d\n",DEPTH); } }
// method to push new data TEMPLATE_HEADER void STORAGE::push( const Key & key, const Data & data, DataStorer** table_, size_t tsize ){ if (table_ == 0 ) { table_ = table; tsize = table_size; } size_t hash = hfunc(key) % tsize; if ( table_[hash] == 0 ){ table_[hash] = new DataStorer(); num_elements++; }else{ if( !table_[hash]->count(key) ){ num_elements++; } } table_[hash][key] = Node(key,data); }
void AttribBrush::mkGaussianBrush (Brush *b, float sigmaxsq, float sigmaysq, float angle, int cval, float hardness) { int hw = b->Width()/2; int hh = b->Height()/2; float rangle = -angle/180*M_PI; for (float x = -hw; x <= hw; x++) { for (float y = -hh; y <= hh; y++) { register float rx = (x*cos (rangle) + y*sin (rangle))/sigmaxsq*2; register float ry = (x*sin (rangle) - y*cos (rangle))/sigmaysq*2; register float r = rx*rx + ry*ry; b->Set (hw + x, hh + y, cval*exp (-(hfunc (r, hardness)))); } } }
// retrieve data associated with key TEMPLATE_HEADER Data & STORAGE::operator[]( const Key & key ){ size_t hash = hfunc(key) % table_size; Data d; if ( table[hash] == 0 ){ table[hash] = new DataStorer(); num_elements++; (*table[hash])[key] = Node(key,d); }else{ if( !table[hash]->count(key) ){ num_elements++; (*table[hash])[key] = Node(key,d); } } return (*table[hash])[key].v; }
/* * initialize video output plugin. */ int videoout_initialize(const string fname) { t_sys_library_handle fhandle; fennec_videoout_initialize hfunc; letter plgname[v_sys_maxpath]; letter plgtitle[v_sys_maxpath]; if(videoout_initialized) { if(current_videoout_data.initialize) current_videoout_data.initialize(); return 0;// videoout_uninitialize(); } fennec_get_plugings_path(plgname); str_cat(plgname, fname); fhandle = sys_library_load(plgname); if(fhandle == v_error_sys_library_load)return -1; /* error: invalid skin file "[fname]" */ hfunc = (fennec_videoout_initialize) sys_library_getaddress(fhandle, videoout_function_initialize); if(hfunc == v_error_sys_library_getaddress) { sys_library_free(fhandle); return -2; /* error: cannot load skin file "[fname]" */ } current_videoout_data.fiversion = plugin_version; plugin_settings_fillstruct(¤t_videoout_data.fsettings); current_videoout_data.getdata = videoout_getdata; current_videoout_data.shared = &fennec; current_videoout_data.refresh = 0; current_videoout_data.uninitialize = 0; current_videoout_data.settings = 0; current_videoout_data.about = 0; hfunc(¤t_videoout_data, plgtitle); current_videoout_handle = fhandle; videoout_initialized = 1; return 0; }
void add_server(const T & name) { //std::hash<paracel::str_type> hfunc; paracel::hash_type<paracel::str_type> hfunc; std::ostringstream tmp; tmp << name; auto name_str = tmp.str(); for(int i = 0; i < replicas; ++i) { std::ostringstream cvt; cvt << i; auto n = name_str + ":" + cvt.str(); auto key = hfunc(n); srv_hashring_dct[key] = name; srv_hashring.push_back(key); } // sort srv_hashring std::sort(srv_hashring.begin(), srv_hashring.end()); }
// find iterator associated with key TEMPLATE_HEADER typename STORAGE::iterator STORAGE::find( const Key & key ) { size_t hash = hfunc(key) % table_size; STORAGE::iterator out(this); out.index = hash; if ( table[hash] == 0 ){ return end(); } out.iter = table[hash]->find(key); if( out.iter != table[hash]->end() ){ return out; }else{ return end(); } }
void remove_server(const T & name) { //std::hash<paracel::str_type> hfunc; paracel::hash_type<paracel::str_type> hfunc; std::ostringstream tmp; tmp << name; auto name_str = tmp.str(); for(int i = 0; i < replicas; ++i) { std::ostringstream cvt; cvt << i; auto n = name_str + ":" + cvt.str(); auto key = hfunc(n); srv_hashring_dct.erase(key); auto iter = std::find(srv_hashring.begin(), srv_hashring.end(), key); if(iter != srv_hashring.end()) { srv_hashring.erase(iter); } } }
bool dfsSearch( int currDepth) { int x1,x2,x3,h; for(x1=0;x1<n-1;x1++){ for(x2=x1;x2<n-1;x2++){ for(x3=x2+1;x3<n;x3++){ changeState(x1,x2,x3); h=hfunc(); if(h==0)return false; else if(3*currDepth + h <= 3*DEPTH){ if(!dfsSearch(currDepth+1))return false; } changeState(x1,x1-x2+x3-1,x3); } } } return true ; }
int main(void){ int a; int* b; void* v; int c; int d; int e; int h; int i; int j; float f; float z; float x; float y; float* g; int zzz[20]; a=a/c*d/e*h/i/j; f=z*x**&y/f*f; a=*(b+a); a=zzz[23]; a=*(zzz+23); a=!a; if (!(a+b)) a=a; a=ffunc(a,b,f,g,v); a=gfunc(a,b,f,g); a=hfunc(a,b,f); a=ifunc(a,b); b=intstarfunc(a); g=floatstarfunc(f); v=voidstarfunc(v); return 1; /* g=g/g/g/g/g;*/ /* a=a+c; f=f+f; b=b+a; b=a+b; g=g+a; g=a+g; a=a-c; f=f-f; b=b-a; g=g-a; a=g-g; a=b-b;*/ }
double nie_mu(double x1,double x2,double re0,double rcore,double qe) { double res; res = 1.0/(1.0-re0/hfunc(x1,x2,rcore,qe)-re0*re0*rcore/(hfunc(x1,x2,rcore,qe)*(pow(hfunc(x1,x2,rcore,qe)+rcore,2)+(1-qe*qe)*x1*x1))); return res; }
auto mark_h_values_with(Cell terminal) { auto mark_h = [=](Cell c) { at(c).h = hfunc(c, terminal); }; matrix.each_cell(mark_h); }