本文整理汇总了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);
}
示例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();
}
示例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");
}
}
示例4: updateParameters
//==============================================================================
void DrumSynthEnvelope::resized ()
{
xDelta = (getWidth ()) / MAX_ENVELOPE_LENGTH;
yDelta = (getHeight ()) / MAX_ENVELOPE_GAIN;
updateParameters (false);
示例5: updateParameters
void UserSpecificQueryWrapperObject::setUserId(const QString &userId)
{
if (m_userId != userId) {
m_userId = userId;
updateParameters();
emit userIdChanged();
}
}
示例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();
}
示例7: updateVelocity
// ------------- update
void EyeLinker::update(){
updateVelocity();
updateParameters();
updatePhysics();
updateEye();
updateFading();
updateFireworks();
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例12: updateParameters
bool functor::useParameters(functor::parameters& theParams) {
if (ownParams) {
delete params;
params = 0;
}
params = &theParams;
ownParams = false;
return updateParameters();
}
示例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();
}
示例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);
}
示例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();
}