/*#F:Opens the primary file for parsing.#R:True if successfully opened.*/ BOOL CTokenFileInfo::Open() { ASSERT(File[0]==NULL); //file is allready open SetParameters(); CString &Fn = FileNames[iFileIndex]; CString FnO = Fn; /*if (FnO.GetLength()>3 && FnO[0]=='.' && FnO[1]=='.' && FnO[2]=='\\') { FnO = PrjPrevDirectory(); FnO += Fn.Right(Fn.GetLength()-3); }*/ AllFileNames[iIncFileCnt] = FnO; Strng FnFull = FnO; bool result = OpenFile(FnFull); //File[iFileIndex] = fopen((const char*)FnO, "rt"); FnModifyTime((char*)(const char*)FnO, FileTimes[iFileIndex]); AllFileTimes[iIncFileCnt]=FileTimes[iFileIndex]; iIncFileCnt++; return result; //if (File[iFileIndex] == NULL) // return FALSE; //return TRUE; }
// // OnApplyChanges // // Changes made should be kept. Change the variable // HRESULT CCalibFilterProperties::OnApplyChanges() { GetControls(m_hwnd); SetParameters(); m_bDirty = FALSE; return NOERROR; } // OnApplyChanges
void CAI_AccelDecay::SetMaxVelocity( float maxVelocity ) { if (maxVelocity != m_maxVelocity) { SetParameters( m_minVelocity, maxVelocity, m_accel, 1.0 - m_invDecay ); } }
/* Computes the log of the integral of the tempered posterior. Integrate( (p(Y|Theta)*p(Theta))^(1/K) dTheta ) */ double SBVAR_symmetric_linear::LogPosteriorIntegral(TDenseVector p, int ndraws, int thin, int burn_in) { if (ndraws <= 0) throw dw_exception("PosteriorIntegral(): number of draws must be postive"); if (thin <= 0) throw dw_exception("PosteriorIntegral(): thinning factor must be positive"); if (p.dim != NumberParameters()) throw dw_exception("PosteriorIntegral(): Incorrect number of parameters"); if (!simulation_info_set) SetSimulationInfo(); SetParameters(p.vector); double integral=log_likelihood_constant + log_prior_constant; for (int i=0; i < n_vars; i++) integral+=0.5*dim_g[i]*1.837877066409345 + LogAbsDeterminant(Simulate_SqrtH[i]); // 1.837877066409345 = log(2*pi) integral+=lambda_T*LogAbsDeterminant(A0); for (int i=0; i < n_vars; i++) { TDenseVector x=InverseMultiply(Simulate_SqrtS[i],p.SubVector(begin_b[i],begin_b[i]+dim_b[i]-1)); integral+=-0.5*lambda_T*InnerProduct(x,x); } for (int i=0; i < n_vars; i++) integral-=LogConditionalA0_gibbs(p,i,ndraws,thin,burn_in); return integral; }
void FDecalRendering::SetShader(FRHICommandList& RHICmdList, const FViewInfo& View, bool bShaderComplexity, const FTransientDecalRenderData& DecalData, const FMatrix& FrustumComponentToClip) { const FMaterialShaderMap* MaterialShaderMap = DecalData.MaterialResource->GetRenderingThreadShaderMap(); auto PixelShader = MaterialShaderMap->GetShader<FDeferredDecalPS>(); TShaderMapRef<FDeferredDecalVS> VertexShader(View.ShaderMap); if(bShaderComplexity) { TShaderMapRef<FShaderComplexityAccumulatePS> VisualizePixelShader(View.ShaderMap); const uint32 NumPixelShaderInstructions = PixelShader->GetNumInstructions(); const uint32 NumVertexShaderInstructions = VertexShader->GetNumInstructions(); static FGlobalBoundShaderState BoundShaderState; SetGlobalBoundShaderState(RHICmdList, View.GetFeatureLevel(), BoundShaderState, GetVertexDeclarationFVector4(), *VertexShader, *VisualizePixelShader); VisualizePixelShader->SetParameters(RHICmdList, NumVertexShaderInstructions, NumPixelShaderInstructions, View.GetFeatureLevel()); } else { // first Bind, then SetParameters() RHICmdList.SetLocalBoundShaderState(RHICmdList.BuildLocalBoundShaderState(GetVertexDeclarationFVector4(), VertexShader->GetVertexShader(), FHullShaderRHIRef(), FDomainShaderRHIRef(), PixelShader->GetPixelShader(), FGeometryShaderRHIRef())); PixelShader->SetParameters(RHICmdList, View, DecalData.MaterialProxy, *DecalData.DecalProxy, DecalData.FadeAlpha); } VertexShader->SetParameters(RHICmdList, View, FrustumComponentToClip); }
void Camera::Transform(const Matrix4x4& trans, bool maintainDistance) { Matrix4x4 frame = InitWithBasis(); Matrix4x4 frame_inv = inverse(frame); Matrix4x4 final_trans = frame * trans * frame_inv; ElVisFloat4 up4 = MakeFloat4(m_v); ElVisFloat4 eye4 = MakeFloat4(m_eye); eye4.w = 1.0f; ElVisFloat4 lookat4 = MakeFloat4(m_lookAt); lookat4.w = 1.0f; // Floating point errors tend to cause the camera to move away or towards // the // look at point. Store the distance so we can restore it after the // transform. ElVisFloat distance = distanceBetween(m_lookAt, m_eye); WorldVector temp_up = WorldVector(final_trans * up4); WorldPoint temp_eye = WorldPoint(final_trans * eye4); WorldPoint temp_lookAt = WorldPoint(final_trans * lookat4); if (maintainDistance) { WorldVector restoreVector = createVectorFromPoints(temp_lookAt, temp_eye); restoreVector.Normalize(); temp_eye = findPointAlongVector(restoreVector, distance) + temp_lookAt; } WorldVector reducedUp(temp_up.x(), temp_up.y(), temp_up.z()); SetParameters(temp_eye, temp_lookAt, reducedUp); }
void ay::ayReset() { //init regs with defaults int_limit = 0; int_counter = 0; z80_per_sample_counter = 0; int_per_z80_counter = 0; memset(regs, 0, sizeof(regs)); regs[AY_GPIO_A] = regs[AY_GPIO_B] = 0xff; chnl_period0 = chnl_period1 = chnl_period2 = 0; tone_period_init0 = tone_period_init1 = tone_period_init2 = 0; chnl_mute0 = chnl_mute1 = chnl_mute1 = false; env_type = 0; env_vol = 0; chnl_trigger0 = chnl_trigger1 = chnl_trigger2 = 0; noise_reg = 0x1; noise_trigger = 1; noise_period = 0; env_type_old = -1; env_step = 0; ay_tacts_counter = 0; beeper_volume = 0; beeper_oldval = false; SetParameters(0); setEnvelope(); }
bool ScriptFile::Execute(asIScriptObject* object, asIScriptFunction* method, const VariantVector& parameters, bool unprepare) { PROFILE(ExecuteMethod); if (!compiled_ || !object || !method) return false; // It is possible that executing the method causes us to unload. Therefore do not rely on member variables // However, we are not prepared for the whole script system getting destroyed during execution (should never happen) Script* scriptSystem = script_; asIScriptContext* context = scriptSystem->GetScriptFileContext(); if (context->Prepare(method) < 0) return false; context->SetObject(object); SetParameters(context, method, parameters); scriptSystem->IncScriptNestingLevel(); bool success = context->Execute() >= 0; if (unprepare) context->Unprepare(); scriptSystem->DecScriptNestingLevel(); return success; }
//==========================================================================* // Schismatic entry point for simplix_ref //--------------------------------------------------------------------------* void SetUpSimplix_ref() { cRobotType = RTYPE_SIMPLIX_REF; SetParameters(NBBOTS, "ref.sector-p4"); TDriver::UseRacinglineParameters = true; TDriver::UseWingControl = true; };
static int dvbfe_set_parameters(struct dvb_frontend *fe, struct dvb_frontend_parameters *param) { DECLARE_DEV; DBG_fCDVB("calling SetParameters()\n"); return SetParameters(p->context, param); }
void SetShader(const FRenderingCompositePassContext& Context, bool bShaderComplexity, const FTransientDecalRenderData& DecalData, FShader* VertexShader) { const FSceneView& View = Context.View; const FMaterialShaderMap* MaterialShaderMap = DecalData.MaterialResource->GetRenderingThreadShaderMap(); auto PixelShader = MaterialShaderMap->GetShader<FDeferredDecalPS>(); if(bShaderComplexity) { const FViewInfo &ViewInfo = (const FViewInfo &)View; TShaderMapRef<FShaderComplexityAccumulatePS> VisualizePixelShader(ViewInfo.ShaderMap); const uint32 NumPixelShaderInstructions = PixelShader->GetNumInstructions(); const uint32 NumVertexShaderInstructions = VertexShader->GetNumInstructions(); static FGlobalBoundShaderState BoundShaderState; SetGlobalBoundShaderState(Context.RHICmdList, Context.GetFeatureLevel(), BoundShaderState, GetVertexDeclarationFVector3(), VertexShader, *VisualizePixelShader); VisualizePixelShader->SetParameters(Context.RHICmdList, NumVertexShaderInstructions, NumPixelShaderInstructions, View.GetFeatureLevel()); } else { // first Bind, then SetParameters() Context.RHICmdList.SetLocalBoundShaderState(Context.RHICmdList.BuildLocalBoundShaderState(GetVertexDeclarationFVector3(), VertexShader->GetVertexShader(), FHullShaderRHIRef(), FDomainShaderRHIRef(), PixelShader->GetPixelShader(), FGeometryShaderRHIRef())); PixelShader->SetParameters(Context.RHICmdList, View, DecalData.MaterialProxy, *DecalData.DecalProxy); } }
TEST_F(ParticleTest, UpdateStageThree) { // Create GPU GPU *gpu = ParticleRead("../test/data/UpdateStageThreeInput.dat"); SetParameters(gpu, ¶ms); // Update Particle ParticleUpload(gpu); ParticleStep(gpu, 1, 3, 4.134832649154196e-4); ParticleDownload(gpu); // Compare Results GPU *expected = ParticleRead("../test/data/UpdateStageThreeExpected.dat"); ASSERT_EQ(gpu->pCount, expected->pCount); for(int i = 0; i < gpu->pCount; i++) { for(int j = 0; j < gpu->pCount; j++) { if(gpu->hParticles[i].pidx == expected->hParticles[j].pidx) { CompareParticle(&gpu->hParticles[i], &expected->hParticles[j]); } } } // Free Data free(gpu); free(expected); }
//==========================================================================* // Schismatic entry point for simplix //--------------------------------------------------------------------------* void SetUpSimplix() { cRobotType = RTYPE_SIMPLIX; SetParameters(NBBOTS, "car1-trb1"); TDriver::AdvancedParameters = true; TDriver::SkillingFactor = 0.1f; // Skilling factor for career-mode };
//============================================================================= Amesos_Umfpack::Amesos_Umfpack(const Epetra_LinearProblem &prob ) : Symbolic(0), Numeric(0), SerialMatrix_(0), UseTranspose_(false), Problem_(&prob), Rcond_(0.0), RcondValidOnAllProcs_(true), MtxConvTime_(-1), MtxRedistTime_(-1), VecRedistTime_(-1), SymFactTime_(-1), NumFactTime_(-1), SolveTime_(-1), OverheadTime_(-1) { // MS // move declaration of Problem_ above because I need it // MS // set up before calling Comm() Teuchos::ParameterList ParamList ; SetParameters( ParamList ) ; // // Hack to deal with Bug #1418 - circular dependencies in amesos, umfpack and amd libraries // This causes the amd files to be pulled in from libamesos.a // if ( UseTranspose_ ) { double control[3]; // This should never be called Amesos_Klu Nothing(*Problem_); amd_defaults(control); } }
//==========================================================================* // Schismatic entry point for simplix_trb1 //--------------------------------------------------------------------------* void SetUpSimplix_trb1() { cRobotType = RTYPE_SIMPLIX_TRB1; SetParameters(NBBOTS, "car1-trb1"); TDriver::SkillingFactor = 0.1f; // Skilling factor for career-mode TDriver::UseRacinglineParameters = true; };
//============================================================================== Ifpack_SPARSKIT::Ifpack_SPARSKIT(Epetra_RowMatrix* A) : A_(*A), Comm_(A->Comm()), UseTranspose_(false), lfil_(0), droptol_(0.0), tol_(0.0), permtol_(0.1), alph_(0.0), mbloc_(-1), Type_("ILUT"), Condest_(-1.0), IsInitialized_(false), IsComputed_(false), NumInitialize_(0), NumCompute_(0), NumApplyInverse_(0), InitializeTime_(0.0), ComputeTime_(0), ApplyInverseTime_(0), ComputeFlops_(0.0), ApplyInverseFlops_(0.0) { Teuchos::ParameterList List; SetParameters(List); }
void NegativeBinomialRand<double>::Fit(const std::vector<int> &sample) { /// Check positivity of sample if (!allElementsAreNonNegative(sample)) throw std::invalid_argument(fitErrorDescription(WRONG_SAMPLE, NON_NEGATIVITY_VIOLATION)); /// Initial guess by method of moments DoublePair stats = GetSampleMeanAndVariance(sample); double mean = stats.first, variance = stats.second; /// Method can't be applied in the case of too small variance if (variance <= mean) throw std::invalid_argument(fitErrorDescription(NOT_APPLICABLE, TOO_SMALL_VARIANCE)); double guess = mean * mean / (variance - mean); size_t n = sample.size(); if (!RandMath::findRoot([sample, mean, n] (double x) { double first = 0.0, second = 0.0; for (const double & var : sample) { first += RandMath::digamma(var + x); second += RandMath::trigamma(var + x); } first -= n * (RandMath::digammamLog(x) + std::log(x + mean)); second -= n * (RandMath::trigamma(x) - mean / (x * (mean + x))); return DoublePair(first, second); }, guess)) throw std::runtime_error(fitErrorDescription(UNDEFINED_ERROR, "Error in root-finding algorithm")); if (guess <= 0.0) throw std::runtime_error(fitErrorDescription(WRONG_RETURN, "Number should be positive, but returned value is " + toStringWithPrecision(guess))); SetParameters(guess, guess / (guess + mean)); }
/*#F:Opens the primary file for parsing.#R:True if successfully opened.*/ BOOL CTokenBufferInfo::Open() { SetParameters(); if (pBigBuff) return TRUE; return FALSE; }
//==========================================================================* // Schismatic entry point for simplix_sc //--------------------------------------------------------------------------* void SetUpSimplix_sc() { cRobotType = RTYPE_SIMPLIX_SC; SetParameters(NBBOTS, "sc996"); TDriver::UseSCSkilling = true; // Use supercar skilling TDriver::SkillingFactor = 0.1f; // Skilling factor for career-mode TDriver::UseRacinglineParameters = true; };
Command::Command(unsigned char componentId, unsigned char commandId, std::vector<float> commandParameters) : mCommandId(commandId), mComponentId(componentId), mIsConnectPacket(false) { SetParameters(commandParameters); }
CTokenBufferInfo::CTokenBufferInfo(CTokenParser* Parser) { bUseLineEnd = 0; pParser = Parser; pBigBuff = NULL; bMyBigBuff = 0; SetParameters(); }
wxGridCellEnumEditor::wxGridCellEnumEditor(const wxString& choices) :wxGridCellChoiceEditor() { m_index = -1; if (!choices.empty()) SetParameters(choices); }
void Texture::SetParameters(XMLFile* file) { if (!file) return; XMLElement rootElem = file->GetRoot(); SetParameters(rootElem); }
bool avsfilter::configure(void) { DEBUG_PRINTF("avsfilter : before dialog init\n"); print_objects(); #define PX(x) &(param.x) diaElemFile wine_app(0,(char**)PX(wine_app), QT_TR_NOOP("_wine app file:"), NULL, QT_TR_NOOP("Select wine filename[wine/cedega/etc.]")); diaElemFile loaderfile(0,(char**)PX(avs_loader), QT_TR_NOOP("_loader file:"), NULL, QT_TR_NOOP("Select loader filename[avsload.exe]")); diaElemFile avsfile(0,(char**)PX(avs_script), QT_TR_NOOP("_avs file:"), NULL, QT_TR_NOOP("Select avs filename[*.avs]")); diaElemUInteger pipe_timeout(PX(pipe_timeout),QT_TR_NOOP("_pipe timeout:"),1,30); diaElem *elems[4]={&wine_app, &loaderfile, &avsfile, &pipe_timeout}; if( diaFactoryRun(QT_TR_NOOP("AvsFilter config"), 4, elems)) { bool res = false; DEBUG_PRINTF("avsfilter : configure before SetParameters\n"); // if script/loader names are exist, then taste config if (param.avs_loader && strlen((const char*)param.avs_loader) && param.avs_script && strlen((const char*)param.avs_script) && param.wine_app && strlen((const char*)param.wine_app)) { struct stat st; if (stat((char*)param.avs_script, &st) != 0) { DEBUG_PRINTF_RED("avsfilter : cannot stat script file\n"); return 0; } param.script_mtime = st.st_mtime; // store timestamp param.script_ctime = st.st_ctime; print_objects(); res = SetParameters(¶m); if (res) avsfilter_config_jserialize(prefs_name, ¶m); DEBUG_PRINTF("avsfilter : configure before save prefs [%s][%s]\n", param.avs_script, param.avs_loader); // if setparameters are ok and (therefore) avs_script and avs_loader exist // we store this parameters in filter preferences DEBUG_PRINTF("avsfilter : after save prefs info : frameIncrement %lu totalDuration %llu\n", info.frameIncrement, info.totalDuration); DEBUG_PRINTF("avsfilter : configure exit ok\n"); return res; } } return 0; }
//==========================================================================* // Schismatic entry point for simplix_ls2 //--------------------------------------------------------------------------* void SetUpSimplix_ls2() { cRobotType = RTYPE_SIMPLIX_LS2; SetParameters(NBBOTS, "ls2-bavaria-g3gtr"); TDriver::AdvancedParameters = true; TDriver::UseBrakeLimit = true; TDriver::UseRacinglineParameters = true; TDriver::SkillingFactor = 0.1f; // Skilling factor for career-mode };
CTokenFileInfo::CTokenFileInfo(CTokenParser* Parser, byte Places, char* FileName, BOOL UseIncludes) { bFnPlaces=Places; pParser = Parser; bUseIncludes = UseIncludes; SetParameters(); FileNames[iFileIndex] = FileName; sIncludeChars = ">>"; }
TreeList::TreeList(string filename) { mParam = 0; mSize = 0; mTreeArray = 0; ifstream is(filename.c_str()); ReadFromStream(is); SetParameters(); }
//==========================================================================* // Module entry point (Torcs backward compatibility scheme). //--------------------------------------------------------------------------* extern "C" int simplix(tModInfo *ModInfo) { void *RobotSettings = GetFileHandle("simplix"); if (!RobotSettings) return -1; SetParameters(1, "car1-trb1"); return simplixEntryPoint(ModInfo,RobotSettings); }
//==========================================================================* // Schismatic entry point for simplix_36GP //--------------------------------------------------------------------------* void SetUpSimplix_36GP() { cRobotType = RTYPE_SIMPLIX_36GP; SetParameters(NBBOTS, "36GP-alfa12c"); TDriver::AdvancedParameters = true; TDriver::UseBrakeLimit = true; TDriver::UseGPBrakeLimit = true; TDriver::SkillingFactor = 0.1f; // Skilling factor for career-mode };
//==========================================================================* // Schismatic entry point for simplix_MP5 //--------------------------------------------------------------------------* void SetUpSimplix_mp5() { cRobotType = RTYPE_SIMPLIX_MP5; SetParameters(NBBOTS, "mp5"); TDriver::AdvancedParameters = true; TDriver::UseBrakeLimit = true; //TDriver::UseSCSkilling = true; TDriver::SkillingFactor = 0.1f; // Skilling factor for career-mode };