New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parameter object and adaptation #19
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,26 +2,26 @@ | |
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 | ||
|
||
blockpfGaussianOpt_impl <- function(data, part, lag) { | ||
.Call(`_RcppSMC_blockpfGaussianOpt_impl`, data, part, lag) | ||
.Call('RcppSMC_blockpfGaussianOpt_impl', PACKAGE = 'RcppSMC', data, part, lag) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are using an Rcpp version older than 0.12.12. Please upgrade, and re-create the file, or explain why you must use on old version, possibly over at the Rcpp repo with an issue ticket there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for picking up on that. I've fixed it up now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. |
||
} | ||
|
||
LinRegLA_impl <- function(Data, intemps, lNumber) { | ||
.Call(`_RcppSMC_LinRegLA_impl`, Data, intemps, lNumber) | ||
LinReg_impl <- function(Data, lNumber) { | ||
.Call('RcppSMC_LinReg_impl', PACKAGE = 'RcppSMC', Data, lNumber) | ||
} | ||
|
||
LinReg_impl <- function(Data, lNumber) { | ||
.Call(`_RcppSMC_LinReg_impl`, Data, lNumber) | ||
LinRegLA_impl <- function(Data, intemps, lNumber) { | ||
.Call('RcppSMC_LinRegLA_impl', PACKAGE = 'RcppSMC', Data, intemps, lNumber) | ||
} | ||
|
||
nonLinPMMH_impl <- function(data, lNumber, lMCMCits) { | ||
.Call(`_RcppSMC_nonLinPMMH_impl`, data, lNumber, lMCMCits) | ||
.Call('RcppSMC_nonLinPMMH_impl', PACKAGE = 'RcppSMC', data, lNumber, lMCMCits) | ||
} | ||
|
||
pfLineartBS_impl <- function(data, part, usef, fun) { | ||
.Call(`_RcppSMC_pfLineartBS_impl`, data, part, usef, fun) | ||
.Call('RcppSMC_pfLineartBS_impl', PACKAGE = 'RcppSMC', data, part, usef, fun) | ||
} | ||
|
||
pfNonlinBS_impl <- function(data, part) { | ||
.Call(`_RcppSMC_pfNonlinBS_impl`, data, part) | ||
.Call('RcppSMC_pfNonlinBS_impl', PACKAGE = 'RcppSMC', data, part) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- | ||
// | ||
// algParam: A class that holds all of the algorithm parameters that can be adapted | ||
// | ||
// Copyright (C) 2017 Dirk Eddelbuettel, Adam Johansen and Leah South | ||
// | ||
// This file is part of RcppSMC. | ||
// | ||
// RcppSMC is free software: you can redistribute it and/or modify it | ||
// under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 2 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// RcppSMC is distributed in the hope that it will be useful, but | ||
// WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with RInside. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
|
||
//! \file | ||
//! \brief A base class containing algorithm parameters and virtual | ||
//! functions to adapt them. | ||
//! | ||
|
||
#ifndef __SMC_ALGPARAM_H | ||
#define __SMC_ALGPARAM_H 1.0 | ||
|
||
#include <population.h> | ||
|
||
|
||
namespace smc { | ||
|
||
/// A base class which contains the algorithm parameters and virtual functions to adapt them. | ||
template <class Space, class Params> class algParam { | ||
|
||
protected: | ||
Params param; | ||
|
||
public: | ||
|
||
/// Free the workspace allocated for the algorithm parameters. | ||
virtual ~algParam() { | ||
} | ||
|
||
/// Holder function for updates to be done before the move step. | ||
virtual void updateForMove(const population<Space> & pop) {} | ||
|
||
/// Holder function for updates to be done before the MCMC step. | ||
virtual void updateForMCMC(const population<Space> & pop, double acceptProb, int nResampled, int & nRepeats) {} | ||
|
||
/// Holder function for updates to be done at the end of each iteration. | ||
virtual void updateEnd(const population<Space> & pop) {} | ||
|
||
/// Returns the parameters. | ||
const Params & GetParams(void) const {return param;} | ||
}; | ||
} | ||
|
||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning that up.