Skip to content

Commit

Permalink
add checkpointing to dnest4adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
qacwnfq committed Aug 19, 2024
1 parent 5cc06aa commit d420802
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/hops/NestedSampling/DNest4Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,19 @@ double hops::DNest4Adapter::proposal_log_likelihood() const {
}

void hops::DNest4Adapter::print(std::ostream &out) const {
for (long i = 0; i < proposal->getState().rows(); i++)
for (long i = 0; i < this->proposal->getState().rows(); i++)
out << this->proposal->getState()(i) << " ";
}

void hops::DNest4Adapter::read(std::istream &in) {
hops::VectorType readState = this->proposal->getState();
for (long i = 0; i < readState.rows(); i++) {
in >> readState(i);
}
this->proposal->setState(readState);

}

std::string hops::DNest4Adapter::description() const {
std::string description;
auto parameterNames = proposal->getDimensionNames();
Expand Down
6 changes: 6 additions & 0 deletions src/hops/NestedSampling/DNest4Adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ namespace hops {
*/
void print(std::ostream &out) const;

/**
* @Brief reads current state to stream
* @param in
*/
void read(std::istream &in);

/**
* @Brief returns string with column names in csv format
* @return
Expand Down
2 changes: 1 addition & 1 deletion src/hops/extern/DNest4
Submodule DNest4 updated 103 files

0 comments on commit d420802

Please sign in to comment.