当前位置: 首页>>代码示例>>C++>>正文


C++ updateParameters函数代码示例

本文整理汇总了C++中updateParameters函数的典型用法代码示例。如果您正苦于以下问题:C++ updateParameters函数的具体用法?C++ updateParameters怎么用?C++ updateParameters使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了updateParameters函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateParameters

/// Slot called on completion of the Fit algorithm.
/// @param error :: Set to true if Fit finishes with an error.
void MultiDatasetFit::finishFit(bool error) {
  if (!error) {
    m_plotController->clear();
    m_plotController->update();
    Mantid::API::IFunction_sptr fun;
    auto algorithm = m_fitRunner->getAlgorithm();
    if (m_fitOptionsBrowser->getCurrentFittingType() ==
        MantidWidgets::FitOptionsBrowser::Simultaneous) {
      // After a simultaneous fit
      fun = algorithm->getProperty("Function");
      updateParameters(*fun);
      auto status =
          QString::fromStdString(algorithm->getPropertyValue("OutputStatus"));
      auto chiSquared = QString::fromStdString(
          algorithm->getPropertyValue("OutputChi2overDoF"));
      setFitStatusInfo(status, chiSquared);
      formatParametersForPlotting(
          *fun, algorithm->getPropertyValue("OutputParameters"));
    } else {
      // After a sequential fit
      auto paramsWSName =
          m_fitOptionsBrowser->getProperty("OutputWorkspace").toStdString();
      if (!Mantid::API::AnalysisDataService::Instance().doesExist(paramsWSName))
        return;
      size_t nSpectra = getNumberOfSpectra();
      if (nSpectra == 0)
        return;
      fun = m_functionBrowser->getGlobalFunction();
      auto nParams = fun->nParams() / nSpectra;
      auto params = Mantid::API::AnalysisDataService::Instance()
                        .retrieveWS<Mantid::API::ITableWorkspace>(paramsWSName);
      if (nParams * 2 + 2 != params->columnCount()) {
        throw std::logic_error(
            "Output table workspace has unexpected number of columns.");
      }
      for (size_t index = 0; index < nSpectra; ++index) {
        std::string prefix =
            "f" + boost::lexical_cast<std::string>(index) + ".";
        for (size_t ip = 0; ip < nParams; ++ip) {
          auto colIndex = ip * 2 + 1;
          auto column = params->getColumn(colIndex);
          fun->setParameter(prefix + column->name(), column->toDouble(index));
        }
      }
      updateParameters(*fun);
      showParameterPlot();
      clearFitStatusInfo();
    }
  }
  m_uiForm.btnFit->setEnabled(true);
}
开发者ID:samueljackson92,项目名称:mantid,代码行数:53,代码来源:MultiDatasetFit.cpp

示例2: updateParameters

void GaussianBlurFilter::onKeyPressed(int key) {
//    if (key==OF_KEY_LEFT) _blurSize--;
//    else if (key==OF_KEY_RIGHT) _blurSize++;
//    else if (key==OF_KEY_UP) _bloom += 0.1;
//    else if (key==OF_KEY_DOWN) _bloom -= 0.1;
   updateParameters();
}
开发者ID:chemabc,项目名称:ofxFilterLibrary,代码行数:7,代码来源:GaussianBlurFilter.cpp

示例3: parameterData

KBootParms::KBootParms(const void *bootData, uval32 partRef)
    : parameterData(NULL), parameterDataLength(0), dataRef(partRef)
{
    if (!updateParameters(bootData, false)) {
	passertMsg(false, "Passed invalid data\n");
    }
}
开发者ID:BillTheBest,项目名称:k42,代码行数:7,代码来源:KBootParms.C

示例4: updateParameters

//==============================================================================
void DrumSynthEnvelope::resized ()
{
    xDelta = (getWidth ()) / MAX_ENVELOPE_LENGTH;
    yDelta = (getHeight ()) / MAX_ENVELOPE_GAIN;
    
    updateParameters (false);
开发者ID:alessandropetrolati,项目名称:juced,代码行数:7,代码来源:DrumSynthEnvelope.cpp

示例5: updateParameters

void UserSpecificQueryWrapperObject::setUserId(const QString &userId)
{
    if (m_userId != userId) {
        m_userId = userId;
        updateParameters();
        emit userIdChanged();
    }
}
开发者ID:froksen,项目名称:harbour-twablet,代码行数:8,代码来源:userspecificquerywrapperobject.cpp

示例6: updateParameters

void BilateralFilter::onKeyPressed(int key) {
//    float blurOffset = _texelSpacing.x;
//    if (key==OF_KEY_DOWN) blurOffset -= 0.5f;
//    else if (key==OF_KEY_UP) blurOffset += 0.5f;
//    else if (key==OF_KEY_LEFT) _normalization -=0.5;
//    else if (key==OF_KEY_RIGHT) _normalization += 0.5;
    updateParameters();
}
开发者ID:chemabc,项目名称:ofxFilterLibrary,代码行数:8,代码来源:BilateralFilter.cpp

示例7: updateVelocity

// ------------- update
void EyeLinker::update(){
    updateVelocity();
    updateParameters();
    updatePhysics();
    updateEye();
    updateFading();
    updateFireworks();
}
开发者ID:ofZach,项目名称:funkyForms,代码行数:9,代码来源:EyeLinker.cpp

示例8: updateParameters

ptRecorder::ptRecorder() { // constructor for class JoyTeleop
  joySub = nh.subscribe("/joy", 10, &ptRecorder::joyCallback, this);
  poseSub = nh.subscribe("/robot_pose", 10, &ptRecorder::poseCallback, this);

  pointPub= nh.advertise<geometry_msgs::PoseStamped>("/pt", 10);

  updateParameters();
}
开发者ID:1487quantum,项目名称:fyp-autonomous-bot,代码行数:8,代码来源:pointrecorder.cpp

示例9: mb_estimator_update

/***************** ENTRY-POINT FUNCTION CALL  *****************************
 *                                                                        *
 **************************************************************************/
void mb_estimator_update(void) {
	clear_UI_LED();  // Clears all LEDs that had been active on the previous cycle

	if (INITIALIZE_ESTIMATOR) {
		// Initialize the filter coefficients:
		setFilterCoeff(&FC_FAST, FILTER_CUTOFF_FAST);
		setFilterCoeff(&FC_SLOW, FILTER_CUTOFF_SLOW);
		setFilterCoeff(&FC_VERY_SLOW, FILTER_CUTOFF_VERY_SLOW);

		// Reset the joint angle rate filters
		setFilterData(&FD_OUTER_LEG_ANGLE, ID_UI_ROLL);
		setFilterData(&FD_UI_ANG_RATE_X, ID_UI_ANG_RATE_X);
		setFilterData(&FD_MCH_ANG_RATE, ID_MCH_ANG_RATE);
		setFilterData(&FD_MCFO_RIGHT_ANKLE_RATE, ID_MCFO_RIGHT_ANKLE_RATE);
		setFilterData(&FD_MCFI_ANKLE_RATE, ID_MCFI_ANKLE_RATE);

		// Reset the contact sensor filters
		setFilterData(&FD_MCFO_LEFT_HEEL_SENSE, ID_MCFO_LEFT_HEEL_SENSE);
		setFilterData(&FD_MCFO_RIGHT_HEEL_SENSE, ID_MCFO_RIGHT_HEEL_SENSE);
		setFilterData(&FD_MCFI_LEFT_HEEL_SENSE, ID_MCFI_LEFT_HEEL_SENSE);
		setFilterData(&FD_MCFI_RIGHT_HEEL_SENSE, ID_MCFI_RIGHT_HEEL_SENSE);

		// Steering motor stuff:
		setFilterData(&FD_MCSI_STEER_ANGLE, ID_MCSI_STEER_ANGLE);

		// Robot orientation estimation
		resetRobotOrientation();
		getIntegralRateGyro();   // Run integral to log the current state of the rate gyro

		// Set "once per step" variables:
		STATE_lastStepLength = 0.0;    // Initialize to zero, for lack of a better plan
		STATE_lastStepTimeSec = STATE_t;  //  cpu clock time at last heel strike.
		STATE_lastStepDuration = 0.0;  // Duration of the last step (seconds)


		STATE_lastEstTime = 0.001 * mb_io_get_float(ID_TIMESTAMP);
		// Remember that we've initialized everything properly
		INITIALIZE_ESTIMATOR = false;
	}

	STATE_t = 0.001 * mb_io_get_float(ID_TIMESTAMP); // Robot Time (converted to seconds)
	runAllFilters();// Run the butterworth filters:
	updateRobotOrientation();
	sendTotalPower();
	updateEnergyUsage(); // Must come after sendTotalPower()

	// Update the state variables:  (absolute orientation and rate)
	updateRobotState();

	// Update controller parameters from LabVIEW
	updateParameters();

	// Check if the robot fell down
	checkIfRobotFellDown();

	STATE_lastEstTime = STATE_t; // Update previous estimation time.
	return;
}
开发者ID:RuinaLab,项目名称:Ranger,代码行数:61,代码来源:mb_estimator.c

示例10: trainStochasticGradientDescent

// executes serial implementation of stochastic gradient descent for
// logistic regression with a fixed number of iterations
// config_params: {step_size, characteristic_time}
void trainStochasticGradientDescent(
    DataSet training_set,
    TrainingOptions training_options) {

    // shuffle datapoints in order to add more stochasticity
    // shuffleKeyValue(training_set.data_points, training_set.labels,
    //                 training_set.num_data_points, training_set.num_features);

    FeatureType* gradient = new FeatureType[training_set.num_features];

    // read configuration parameters
    double step_size = *training_options.step_size;

    const double characteristic_time =
        (fieldExists(training_options.config_params, "characteristic_time"))
        ? training_options.config_params["characteristic_time"]
        : CHARACTERISTIC_TIME;

    size_t curr_num_epochs =
        (fieldExists(training_options.config_params, "curr_num_epochs"))
        ? training_options.config_params["curr_num_epochs"]
        : 0;

    double annealed_step_size = step_size;

    for (size_t k = 0; k < training_options.num_epochs; k++) {

        // simulated annealing (reduces step size as it converges)
        annealed_step_size = training_options.config_params["initial_step_size"]
                             / (1.0
                                + (curr_num_epochs
                                   * training_set.num_data_points
                                   / characteristic_time));
        curr_num_epochs++;

        for (size_t i = 0; i < training_set.num_data_points; i++) {
            // computes gradient
            gradientForSinglePoint(
                training_set.parameter_vector,
                &training_set.data_points[i * training_set.num_features],
                training_set.labels[i],
                training_set.num_features,
                gradient);

            // updates parameter vector
            updateParameters(
                training_set.parameter_vector,
                gradient,
                training_set.num_features,
                annealed_step_size);
        }
    }

    *training_options.step_size = annealed_step_size;

    delete[] gradient;
}
开发者ID:yw778,项目名称:testApplication,代码行数:60,代码来源:sgd_baseline.cpp

示例11: boldDriver

// Bold Driver: adjusting the step size according to the result of the
// last step and reverting the step if results are worse than they were before.
static void boldDriver(
    DataSet training_set,
    FeatureType* gradient,
    double* step_size) {

    double previous_loss = lossFunction(training_set);

    updateParameters(training_set.parameter_vector,
                     gradient,
                     training_set.num_features,
                     *step_size);

    double current_loss = lossFunction(training_set);

    // if it's going in the right direction, increase step size
    if (current_loss < previous_loss) {
        *step_size *= 1.045;
    }
    // if the previous step was too big and the loss increased,
    // revert step and reduce step size
    else {
        bool revert = true;
        int num_reverts = 0, max_reverts = 10;
        while (revert && (num_reverts < max_reverts)) {
            updateParameters(training_set.parameter_vector,
                             gradient,
                             training_set.num_features,
                             *step_size,
                             revert);

            *step_size *= 0.5;

            updateParameters(training_set.parameter_vector,
                             gradient,
                             training_set.num_features,
                             *step_size);

             current_loss = lossFunction(training_set);

             revert = (current_loss > previous_loss);
        }

    }
}
开发者ID:yw778,项目名称:testApplication,代码行数:46,代码来源:batch_baseline.cpp

示例12: updateParameters

  bool functor::useParameters(functor::parameters& theParams) {
    if (ownParams) {
      delete params;
      params = 0;
    }
    params = &theParams;
    ownParams = false;

    return updateParameters();
  }
开发者ID:chenbk85,项目名称:alcordev,代码行数:10,代码来源:ltiFunctor.cpp

示例13: updateParameters

void Unison::setSize(int new_size)
{
    if(new_size < 1)
        new_size = 1;
    unison_size = new_size;
    alloc.devalloc(uv);
    uv = alloc.valloc<UnisonVoice>(unison_size);
    first_time = true;
    updateParameters();
}
开发者ID:xsgoodbox,项目名称:zynaddsubfx,代码行数:10,代码来源:Unison.cpp

示例14: updateEvent

void PanelObjectEvent::on_radioButtonEventUser_toggled(bool checked) {
    ui->comboBoxEventsUser->setEnabled(checked);
    m_event->setIsSystem(false);
    QStandardItemModel *model = RPM::get()->project()->gameDatas()
        ->commonEventsDatas()->modelEventsUser();
    SystemEvent *super = reinterpret_cast<SystemEvent *>(model->item(ui
        ->comboBoxEventsUser->currentIndex())->data().value<quintptr>());
    updateEvent(super);
    updateParameters(super);
}
开发者ID:Wano-k,项目名称:RPG-Paper-Maker,代码行数:10,代码来源:panelobjectevent.cpp

示例15: updateParameters

void ColorGradationPlugin::changedParam( const OFX::InstanceChangedArgs& args, const std::string& paramName )
{
	if( paramName == kParamInvert )
	{
		int in = _paramIn->getValue();
		_paramIn->setValue ( _paramOut->getValue() );
		_paramOut->setValue( in );
	}
	updateParameters();
}
开发者ID:Finaler,项目名称:TuttleOFX,代码行数:10,代码来源:ColorGradationPlugin.cpp


注:本文中的updateParameters函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。