Z3_tactic Z3_API Z3_tactic_par_or(Z3_context c, unsigned num, Z3_tactic const ts[]) { Z3_TRY; LOG_Z3_tactic_par_or(c, num, ts); RESET_ERROR_CODE(); ptr_buffer<tactic> _ts; for (unsigned i = 0; i < num; i++) { _ts.push_back(to_tactic_ref(ts[i])); } tactic * new_t = par(num, _ts.c_ptr()); RETURN_TACTIC(new_t); Z3_CATCH_RETURN(0); }
void Compilador::InsertaConst(string constante, int tipo){ //Checa si existe unordered_map<string,Variable>::const_iterator it = tablaConsts.find(constante); if(it == tablaConsts.end()){ int dir = (rangoMemoria[0][2][tipo-10000]) + (ctes[tipo-10000]); Variable miConst(constante, tipo, dir); ctes[tipo-10000]++; std::pair<std::string,Variable> par (constante, miConst); tablaConsts.insert(par); } //Si ya existia no hace nada }
void Dropper::initialize() { faulty = par("faulty"); // Register Hook inet::IPv4* ipLayer = check_and_cast<inet::IPv4*>( getModuleByPath("^.networkLayer.ip")); // TODO check the priority that should have ipLayer->registerHook(1, this); inPackets = 0; outPackets = 0; droppedPackets = 0; dataOverhead.setName("DataOverhead"); }
void CLIPSInstructionBuilder::addFields(Instruction* instruction, KnowledgeConstruction *kc, char* parent, bool addDestinationRegisters) { User* tmp = (User*)instruction; CLIPSUserBuilder::addFields(tmp, kc, parent); FunctionNamer& namer = getNamer(); std::string par (parent); PointerAddress pa = namer.registerInstructionWithBasicBlock(par); addField("TimeIndex", pa); addField("Operation", (char*) instruction->getOpcodeName()); if(instruction->mayWriteToMemory()) addTrueField("MayWriteToMemory"); if(instruction->mayReadFromMemory()) addTrueField("MayReadFromMemory"); if(instruction->mayReadOrWriteMemory()) addTrueField("MayReadOrWriteMemory"); if(instruction->mayHaveSideEffects()) addTrueField("MayHaveSideEffects"); if(instruction->isBinaryOp()) addTrueField("IsBinaryOp"); if(instruction->isTerminator()) addTrueField("IsTerminator"); if(instruction->isShift()) addTrueField("IsShift"); if(instruction->isCast()) addTrueField("IsCast"); if(instruction->isArithmeticShift()) addTrueField("IsArithmeticShift"); if(instruction->isLogicalShift()) addTrueField("IsLogicalShift"); if(instruction->isAssociative()) addTrueField("IsAssociative"); if(instruction->isCommutative()) addTrueField("IsCommutative"); if(!instruction->getType()->isVoidTy() && instruction->hasName() && addDestinationRegisters) { addField("DestinationRegisters", instruction->getName()); } if(!instruction->use_empty()) { // DenseMap<BasicBlock*,unsigned> counterArgument; //BasicBlock* directParent = instruction->getParent(); //we could have an instruction not used in the block it's created :D openField("Consumers"); for(Value::use_iterator i = instruction->use_begin(), e = instruction->use_end(); i != e; ++i) { User* target = *i; PointerAddress ptr = (PointerAddress)target; if(namer.pointerRegistered(ptr)) { appendValue(namer.nameFromPointer(ptr)); } else if(isa<Function>(target) || isa<Instruction>(target)) { appendValue(target->getName()); } else { appendValue(kc->route(target, namer)); } } closeField(); /* openField("BlocksUsedIn"); for(DenseMap<BasicBlock*, unsigned>::iterator a = counterArgument.begin(), b = counterArgument.end(); a != b; ++a) { BasicBlock* bb = a->first; appendValue(bb->getName()); //the name of the basic block appendValue(a->second); //the number of iterations } closeField(); */ } }
void Detector::initialize(int stage) { if (stage == inet::INITSTAGE_LAST) { // Initialize local variables IP = inet::L3AddressResolver().addressOf( getParentModule()->getParentModule(), inet::L3AddressResolver::ADDR_IPv4).toIPv4(); faulty = par("faulty"); monitor = check_and_cast<TrafficMonitor*>( getParentModule()->getSubmodule("monitor")); WATCH_VECTOR(thresholds); WATCH_VECTOR(evaluateNextIter); } }
void CLinearMapping::writeParamsToStream(ostream& out) const { writeToStream(out, "baseType", getBaseType()); writeToStream(out, "type", getType()); writeToStream(out, "numData", getNumData()); writeToStream(out, "outputDim", getOutputDim()); writeToStream(out, "inputDim", getInputDim()); writeToStream(out, "numParams", getOptNumParams()); CMatrix par(1, getOptNumParams()); getOptParams(par); par.toStream(out); }
__host__ __device__ async_launch< parallel_group< concurrent_group< bulk::agent<grainsize>, groupsize > > > grid(size_t num_groups, size_t heap_size, cudaStream_t stream) { return par(stream, con<groupsize,grainsize>(heap_size), num_groups); }
void AssetTemplateItem::setup( const Record & rec, const QModelIndex & self ) { r = rec; Element e(r); _flags = Qt::ItemFlags(0); isRecurseTemplate = false; isGhostItem = false; QModelIndex parent = self.parent(); QModelIndex par(parent); while( par.isValid() ) { Element p(AssetTemplateTranslator::getRecordStatic(par)); if( p.assetTemplate().isRecord() ) { isGhostItem = true; break; } par = par.parent(); } // Set it if we are a recurse template ourselves isRecurseTemplate = e.assetTemplate().isRecord(); if( e.isRecord() ) { col1 = e.displayName(); icon = ElementUi(e).image(); // If we have an asset template, then overlay the icon if( isRecurseTemplate ) { QImage over( ":/images/plus_overlay.png" ); QPainter p( &icon ); p.drawImage( QPoint(6,6), over ); } if( isGhostItem ) { QPixmap cur(icon.size()); cur.fill( QColor( 180, 180, 180, 200 ) ); QPainter p( &icon ); p.setCompositionMode( QPainter::CompositionMode_SourceAtop ); p.drawPixmap(QPoint(),cur); } if( isRecurseTemplate ) _flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled; else if( isGhostItem ) _flags = 0; else _flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled; } FileTracker ft(r); if( ft.isRecord() ) { col1 = ft.name(); icon = QPixmap( ":/images/tracker.png" ); _flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled; } }
int main() { setlocale(LC_CTYPE,"Russian"); TransportnoeSredstvo t("a","b"), t1("1","2"), *tt; Parohod par(1234,"a","b",5,4,"a","a"); tt = ∥ t.add(); t1.add(); tt->add(); AAA::show(); return 0; }
MnUserParameterState MnHesse::operator()(const FCNBase& fcn, const MnUserParameterState& state, unsigned int maxcalls) const { unsigned int n = state.variableParameters(); MnUserFcn mfcn(fcn, state.trafo()); MnAlgebraicVector x(n); for(unsigned int i = 0; i < n; i++) x(i) = state.intParameters()[i]; double amin = mfcn(x); Numerical2PGradientCalculator gc(mfcn, state.trafo(), theStrategy); MinimumParameters par(x, amin); FunctionGradient gra = gc(par); MinimumState tmp = (*this)(mfcn, MinimumState(par, MinimumError(MnAlgebraicSymMatrix(n), 1.), gra, state.edm(), state.nfcn()), state.trafo(), maxcalls); return MnUserParameterState(tmp, fcn.up(), state.trafo()); }
int main(int argc, char **argv) { printf("yield: the yield function\n"); initialize(0x40000000, 8192); // 1 GB total allocatable memory code_p children[] = { child1, child2 }; void *args[] = { NULL, NULL }; uint stacksize[] = { 2000, 2000 }; par(children, args, stacksize, 2); printf("After par\n"); return 0; }
bool Compilador::InsertaFunc(string nomFunc, int tipo) { if(ExisteFunc(nomFunc)) return false; //Ya existia, por lo tanto no inserto //No existia la funcion, entonces la creo e inserto en la tabla int direccion = vectorCuadruplos.size(); Funcion func(contFunciones, nomFunc, tipo, direccion); contFunciones++; std::pair<std::string,Funcion> par (nomFunc, func); tablaFuncs.insert(par); funcionActual = nomFunc; return true; }
SEXP SP::func(SEXP biomass) { FLQuant bio(biomass); FLQuant rtn(1,1,par.minyr(),par.maxyr(),par.nareas(),par.nseasons(),par.nunits(),par.niters()); int i, j, k, l, m; int i, j, k, l, m; for(m=1; m <= bio.niters(); m++) { for (l = 1; l <= bio.nareas(); l++) { for (k = 1; k <= bio.nseasons(); k++) { for (j = 1; j <= bio.nunits(); j++) { for (i = bio.minyr(); i <= bio.maxyr(); i++) { switch(getSP(model)) { case FLRConst_fletcher: rtn(1,i,j,k,l,m) = spFletcher(bio(1,i,j,k,l,m),par(1,i,j,k,l,m),par(2,i,j,k,l,m),par(3,i,j,k,l,m)); break; case FLRConst_fox: rtn(1,i,j,k,l,m) = spFox( bio(1,i,j,k,l,m),par(1,i,j,k,l,m),par(2,i,j,k,l,m)); break; case FLRConst_genfit: rtn(1,i,j,k,l,m) = spGenfit( bio(1,i,j,k,l,m),par(1,i,j,k,l,m),par(2,i,j,k,l,m),par(3,i,j,k,l,m)); break; case FLRConst_gulland: rtn(1,i,j,k,l,m) = spGulland( bio(1,i,j,k,l,m),par(1,i,j,k,l,m),par(2,i,j,k,l,m)); break; case FLRConst_logistic: rtn(1,i,j,k,l,m) = spLogistic(bio(1,i,j,k,l,m),par(1,i,j,k,l,m),par(2,i,j,k,l,m)); break; case FLRConst_pellat: rtn(1,i,j,k,l,m) = spPellaT( bio(1,i,j,k,l,m),par(1,i,j,k,l,m),par(2,i,j,k,l,m),par(3,i,j,k,l,m)); break; case FLRConst_schaefer: rtn(1,i,j,k,l,m) = spSchaefer(bio(1,i,j,k,l,m),par(1,i,j,k,l,m),par(2,i,j,k,l,m)); break; case FLRConst_shepherd: rtn(1,i,j,k,l,m) = spShepherd(bio(1,i,j,k,l,m),par(1,i,j,k,l,m),par(2,i,j,k,l,m),par(3,i,j,k,l,m)); break; } } } } } } return rtn; }
void bridge_ornamented_rep::insert_ornament (box b) { /* ttt->insert_marker (st, ip); array<page_item> l2= array<page_item> (1); l2[0]= page_item (b); ttt->insert_stack (l2, stack_border ()); */ lazy_paragraph par (env, ip); par->a= copy (ttt->a); par->a << line_item (STD_ITEM, env->mode_op, b, HYPH_INVALID); par->a << ttt->b; par->format_paragraph (); ttt->insert_stack (par->sss->l, par->sss->sb); }
vec3<T>& vec3<T>::rotate(const vec3<T>& r) { T phi = norm(r); if (phi != 0) { // part of vector which is parallel to r vec3<T> par(r*(*this)/(r*r) * r); // part of vector which is perpendicular to r vec3<T> perp(*this - par); // rotation direction, size of perp vec3<T> rotdir(norm(perp) * normalized(crossprod(r,perp))); *this = par + cos(phi)*perp + sin(phi)*rotdir; } return *this; }
Parameters CalibratorKriging::train(const std::vector<ObsEns>& iData) const { double timeStart = Util::clock(); float totalObs = 0; float totalFcst = 0; int counter = 0; // Compute predictors in model for(int i = 0; i < iData.size(); i++) { float obs = iData[i].first; std::vector<float> ens = iData[i].second; float mean = Util::calculateStat(ens, Util::StatTypeMean); if(Util::isValid(obs) && Util::isValid(mean)) { totalObs += obs; totalFcst += mean; counter++; } } float bias = Util::MV; if(counter <= 0) { std::stringstream ss; ss << "CalibratorKriging: No valid data, no correction will be made."; Util::warning(ss.str()); bias = 0; } else { if(mOperator == Util::OperatorAdd) { bias = (totalObs - totalFcst)/counter; } else if(mOperator == Util::OperatorSubtract) { bias = (totalFcst - totalObs)/counter; } else if(mOperator == Util::OperatorMultiply) { bias = totalObs / totalFcst; } else if(mOperator == Util::OperatorDivide) { bias = totalFcst / totalObs; } else { Util::error("CalibratorKriging: 'operator' not recognized"); } } std::vector<float> values(1, bias); Parameters par(values); double timeEnd = Util::clock(); std::cout << "Time: " << timeEnd - timeStart << std::endl; return par; }
int main(int argc,char **argv) { if(argc < 2){ HypherParameters::Error("Not enough parameters for cmd."); } string conf(argv[1]); HypherParameters par(conf); srand(par.CONF_random_seed); Process *x; switch(par.CONF_method){ case 4: x = new M2_p2o1(conf); break; case 5: x = new M2_p2o2(conf); break; case 6: x = new M2_p2o3(conf); break; case 7: x = new M3_pro2(conf); break; case 8: x = new M3_pro3(conf); break; } if(argc == 2){ //training x->train(); if(par.CONF_test_file.length()>0 && par.CONF_gold_file.length()>0){ //test string mach_best_name = par.CONF_mach_name+par.CONF_mach_best_suffix; x->test(mach_best_name); } } else if(argc == 3){ //only testing x->test(string(argv[2])); } else if(argc == 5){ //check o1-filter x->check_o1_filter(string(argv[2]),string(argv[3]),string(argv[4])); } else{ HypherParameters::Error("Wrong parameters for cmd."); } return 0; }
void Detector::updateCores(CoresUpdate* update) { cores = update->getCores(); boundaries = update->getBoundaries(); evaluateNextIter = std::vector<bool>(cores.size(), true); double threshold = par("checkProbability").doubleValue() * double(UINT_MAX); min_threshold = unsigned(threshold); thresholds = std::vector<unsigned>(cores.size(), min_threshold); randGenerators.clear(); std::vector<unsigned> secrets = update->getSecrets(); for (auto it = secrets.begin(); it < secrets.end(); it++) { randGenerators.push_back(std::mt19937(*it)); } monitor->setCores(cores); monitor->setShareSummaries(evaluateNextIter); delete update; }
Parameters KalmanParameters::toParameters() const { std::vector<float> values; for(int i = 0; i < x.size(); i++) { values.push_back(x[i]); } for(int i = 0; i < k.size(); i++) { values.push_back(k[i]); } for(int i = 0; i < P.size(); i++) { for(int j = 0; j < P.size(); j++) { values.push_back(P[i][j]); } } Parameters par(values); return par; }
int main(int argc, char* argv[]) { std::signal(SIGINT, signal_handler); std::signal(SIGTERM, signal_handler); try { Parameters par(argc, argv); Application app(par, &signal_status); app.run(); } catch (std::exception const& e) { L_(fatal) << e.what(); return EXIT_FAILURE; } return EXIT_SUCCESS; }
inet::INetfilter::IHook::Result Dropper::datagramForwardHook( inet::INetworkDatagram* datagram, const inet::InterfaceEntry* inIE, const inet::InterfaceEntry*& outIE, inet::L3Address& nextHopAddr) { // Drop with some prob. if (datagram->getTransportProtocol() == DATA_PROTOCOL_NUMBER) { inPackets++; totalIn++; if (std::rand() < double(par("dropProbability")) * double(RAND_MAX)) { droppedPackets++; totalDropped++; return IHook::DROP; } outPackets++; totalOut++; } return IHook::ACCEPT; }
void EventSystem::handleOSCMessage(const char *path, const char *types, lo_arg **argv, int argc, void *data) { Event ev("osc_msg"); std::string par("\""); par += path; par += "\""; ev.add(par.c_str()); for (int i = 0; i < argc; i++) { par = oscTypePython(types[i]); par += "(\""; par += oscValueStr(types[i], argv[i]); par += "\")"; ev.add(par.c_str()); } events.push(ev); }
FX ParallelizerInternal::getDerivative(int nfwd, int nadj){ // Generate derivative expressions vector<FX> der_funcs(funcs_.size()); for(int i=0; i<funcs_.size(); ++i){ der_funcs[i] = funcs_[i].derivative(nfwd,nadj); } // Create a new parallelizer for the derivatives Parallelizer par(der_funcs); // Set options and initialize par.setOption(dictionary()); par.init(); // Create a function call to the parallelizer vector<MX> par_arg = par.symbolicInput(); vector<MX> par_res = par.call(par_arg); // Get the offsets: copy to allow being used as a counter std::vector<int> par_inind = par->inind_; std::vector<int> par_outind = par->outind_; // Arguments and results of the return function vector<MX> ret_arg, ret_res; ret_arg.reserve(par_arg.size()); ret_res.reserve(par_res.size()); // Loop over all nondifferentiated inputs/outputs and forward seeds/sensitivities for(int dir=-1; dir<nfwd; ++dir){ for(int i=0; i<funcs_.size(); ++i){ for(int j=inind_[i]; j<inind_[i+1]; ++j) ret_arg.push_back(par_arg[par_inind[i]++]); for(int j=outind_[i]; j<outind_[i+1]; ++j) ret_res.push_back(par_res[par_outind[i]++]); } } // Loop over adjoint seeds/sensitivities for(int dir=0; dir<nadj; ++dir){ for(int i=0; i<funcs_.size(); ++i){ for(int j=outind_[i]; j<outind_[i+1]; ++j) ret_arg.push_back(par_arg[par_inind[i]++]); for(int j=inind_[i]; j<inind_[i+1]; ++j) ret_res.push_back(par_res[par_outind[i]++]); } } // Assemble the return function return MXFunction(ret_arg,ret_res); }
struct in_out elaboratePrimaryExpressionRight(const Context &context, struct primary_expression &arg, bool ifContext) { struct in_out result; // must check for enum's id and pointer area overloading // insert id and type to set if (arg. _name_ != NULL) { string name(arg._name_); //cout<<"Getting name1 '"<<name<<"' :"<<arg<<endl; TParam par(name, context.getTypeInfo(name), ifContext); result.insertIn(par); return result; } if (arg._braces_ != NULL) return scanExpression(context, *arg._braces_, ifContext); return result; // no more ids }
int main(int argc, char **argv) { printf("ring0arg2: two process ping pong, no process args\n"); initialize(0x40000000, 8192); // 1 GB total allocatable memory init_channel(&chan1); init_channel(&chan2); code_p children[] = { child1, child2 }; void *args[] = { NULL, NULL }; uint stacksize[] = { 2000, 2000 }; par(children, args, stacksize, 2); printf("After par\n"); return 0; }
RcppExport double evaluate4(long *l_nfeval, double *param, int i_D, const Rcpp::Function & fun, const Rcpp::Environment & env) { (*l_nfeval)++; //increment function evaluation count Rcpp::NumericVector par(i_D); for (int i = 0; i < i_D; i++) par[i] = param[i]; Rcpp::Language funcall(fun, par); Rcpp::NumericVector v = funcall.eval(env); double f_result = v[0]; if (ISNAN(f_result)) ::Rf_error("NaN value of objective function! \nPerhaps adjust the bounds."); return(f_result); }
int triling(karta *p) { if (!par(p)) return 0; int brojac = 5; int ima = 0; while (brojac-- > 2) { if (p[brojac].broj == p[brojac-1].broj && p[brojac-1].broj == p[brojac-2].broj) { ima = 1; break; } } return ima; }
struct in_out elaboratePrimaryExpressionLeft(const Context &context, struct primary_expression &arg, int selfchange, bool ifContext) { struct in_out result; // must check for enum's id and pointer area overloading // insert id and type to set if (arg. _name_ != NULL) { string name(arg. _name_); //cout<<"Getting name4 '"<<name<<"'"<<endl; TParam par(name, context. getTypeInfo(name), ifContext); result.insertOut(par); if (selfchange) result.insertIn(par); return result; } if (arg._braces_ != NULL) sserror("Braces in left part unsupported yet", arg._braces_->lt); return result; }
RcppExport SEXP setContext(SEXP parSEXP) { try { Rcpp::List par(parSEXP); // set fixingDays and settleDate RQLContext::instance().fixingDays = Rcpp::as<int>(par["fixingDays"]); RQLContext::instance().settleDate = QuantLib::Date(dateFromR(Rcpp::as<Rcpp::Date>(par["settleDate"]))); boost::shared_ptr<QuantLib::Calendar> pcal( getCalendar(Rcpp::as<std::string>(par["calendar"])) ); RQLContext::instance().calendar = *pcal; // set calendar in global singleton } catch(std::exception &ex) { forward_exception_to_r(ex); } catch(...) { ::Rf_error("c++ exception (unknown reason)"); } return R_NilValue; }
PlanContext LogicalSort::GetPlanContext() { // Get the information from its child child_plan_context_ = child_->GetPlanContext(); PlanContext ret; ret.attribute_list_ = child_plan_context_.attribute_list_; ret.commu_cost_ = child_plan_context_.commu_cost_; ret.plan_partitioner_.set_partition_func( child_plan_context_.plan_partitioner_.get_partition_func()); ret.plan_partitioner_.set_partition_key(Attribute()); NodeID location = 0; unsigned long data_cardinality = 0; PartitionOffset offset = 0; PlanPartitionInfo par(offset, data_cardinality, location); vector<PlanPartitionInfo> partition_list; partition_list.push_back(par); ret.plan_partitioner_.set_partition_list(partition_list); return ret; }