Skip to content

Commit

Permalink
Remove comments in tests since they are not really informative and ma…
Browse files Browse the repository at this point in the history
…sk some info
  • Loading branch information
pfernique committed Apr 13, 2019
1 parent 123bb37 commit 600fb00
Show file tree
Hide file tree
Showing 239 changed files with 1,499 additions and 1,778 deletions.
13 changes: 5 additions & 8 deletions src/cpp/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace statiskit

boost::mt19937 _random_generator = boost::mt19937(0);

boost::mt19937& get_random_generator()
boost::mt19937& get_random_generator(void)
{ return _random_generator; }

std::unordered_map< uintptr_t, unsigned int > iterations = std::unordered_map< uintptr_t, unsigned int >();
Expand Down Expand Up @@ -76,7 +76,7 @@ namespace statiskit
}
}

void set_seed()
void set_seed(void)
{ __impl::_random_generator.seed(); }

void set_seed(const Index& seed)
Expand All @@ -85,9 +85,6 @@ namespace statiskit
not_implemented_error::not_implemented_error(const std::string& function, const std::string& file, const unsigned int& line) : std::runtime_error("'" + function + "' in file '" + file + "' at line " + __impl::to_string(line) + " is not implemented")
{}

proxy_connection_error::proxy_connection_error() : std::exception()
{}

parameter_error::parameter_error(const std::string& parameter, const std::string& error) : std::runtime_error("'" + parameter + "' parameter: " + error)
{}

Expand All @@ -100,7 +97,7 @@ namespace statiskit
nullptr_error::nullptr_error(const std::string& parameter) : parameter_error(parameter, "cannot be set to nullptr")
{}

Schedule::~Schedule()
Schedule::~Schedule(void)
{}

ExponentialSchedule::ExponentialSchedule(const double& theta)
Expand All @@ -109,13 +106,13 @@ namespace statiskit
ExponentialSchedule::ExponentialSchedule(const ExponentialSchedule& schedule)
{ _theta = schedule._theta; }

ExponentialSchedule::~ExponentialSchedule()
ExponentialSchedule::~ExponentialSchedule(void)
{}

double ExponentialSchedule::operator() (const double& stage) const
{ return exp(- stage / _theta); }

const double& ExponentialSchedule::get_theta() const
const double& ExponentialSchedule::get_theta(void) const
{ return _theta; }

void ExponentialSchedule::set_theta(const double& theta)
Expand Down
41 changes: 19 additions & 22 deletions src/cpp/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ namespace statiskit

template<class T, class D, class B=T> struct PolymorphicCopy : public B
{
PolymorphicCopy();
PolymorphicCopy(void);
PolymorphicCopy(const PolymorphicCopy<T, D, B>& other);
virtual ~PolymorphicCopy() = default;
virtual ~PolymorphicCopy(void) = default;

virtual std::unique_ptr< T > copy() const;
virtual std::unique_ptr< T > copy(void) const;
};

namespace __impl
Expand All @@ -76,7 +76,7 @@ namespace statiskit
*
* The random generator used is the <a href="http://www.boost.org/doc/libs/1_60_0/doc/html/boost/random/mt19937.html">Mersenne Twister</a> random generator of the Boost.Random library
*/
STATISKIT_CORE_API boost::mt19937& get_random_generator();
STATISKIT_CORE_API boost::mt19937& get_random_generator(void);

STATISKIT_CORE_API unsigned int get_maxits(const uintptr_t& ptr, const unsigned int& maxits);
STATISKIT_CORE_API void set_maxits(const uintptr_t& ptr, const unsigned int& maxits);
Expand All @@ -87,15 +87,12 @@ namespace statiskit
template<class U, class V> std::set< U > keys(const std::map< U, V >& map);
}

STATISKIT_CORE_API void set_seed();
STATISKIT_CORE_API void set_seed(void);
STATISKIT_CORE_API void set_seed(const Index& seed);

struct STATISKIT_CORE_API not_implemented_error : std::runtime_error
{ not_implemented_error(const std::string& function, const std::string& file, const unsigned int& line); };

struct STATISKIT_CORE_API proxy_connection_error : std::exception
{ proxy_connection_error(); };

struct STATISKIT_CORE_API parameter_error : std::runtime_error
{ parameter_error(const std::string& parameter, const std::string& error); };

Expand Down Expand Up @@ -135,17 +132,17 @@ namespace statiskit
class Optimization : public T
{
public:
Optimization();
Optimization(void);
Optimization(const Optimization< T >& optimization);
virtual ~Optimization();
virtual ~Optimization(void);

const double& get_mindiff() const;
const double& get_mindiff(void) const;
void set_mindiff(const double& mindiff);

unsigned int get_minits() const;
unsigned int get_minits(void) const;
void set_minits(const unsigned int& maxits);

unsigned int get_maxits() const;
unsigned int get_maxits(void) const;
void set_maxits(const unsigned int& maxits);

protected:
Expand All @@ -158,23 +155,23 @@ namespace statiskit

struct STATISKIT_CORE_API Schedule
{
virtual ~Schedule() = 0;
virtual ~Schedule(void) = 0;

virtual double operator() (const double& stage) const = 0;

virtual std::unique_ptr< Schedule > copy() const = 0;
virtual std::unique_ptr< Schedule > copy(void) const = 0;
};

class STATISKIT_CORE_API ExponentialSchedule : public PolymorphicCopy< Schedule, ExponentialSchedule >
{
public:
ExponentialSchedule(const double& theta);
ExponentialSchedule(const ExponentialSchedule& schedule);
virtual ~ExponentialSchedule();
virtual ~ExponentialSchedule(void);

virtual double operator() (const double& stage) const;

const double& get_theta() const;
const double& get_theta(void) const;
void set_theta(const double& theta);

protected:
Expand All @@ -185,17 +182,17 @@ namespace statiskit
class SimulatedAnnealing : public T
{
public:
SimulatedAnnealing();
SimulatedAnnealing(void);
SimulatedAnnealing(const SimulatedAnnealing< T >& simulated_annealing);
virtual ~SimulatedAnnealing();
virtual ~SimulatedAnnealing(void);

const Schedule* get_schedule() const;
const Schedule* get_schedule(void) const;
void set_schedule(const Schedule& schedule);

unsigned int get_minits() const;
unsigned int get_minits(void) const;
void set_minits(const unsigned int& maxits);

unsigned int get_maxits() const;
unsigned int get_maxits(void) const;
void set_maxits(const unsigned int& maxits);

protected:
Expand Down
24 changes: 12 additions & 12 deletions src/cpp/base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
namespace statiskit
{
template<class T, class D, class B>
PolymorphicCopy< T, D, B >::PolymorphicCopy() : B()
PolymorphicCopy< T, D, B >::PolymorphicCopy(void) : B()
{}

template<class T, class D, class B>
PolymorphicCopy< T, D, B >::PolymorphicCopy(const PolymorphicCopy< T, D, B>& other) : B(other)
{}

template<class T, class D, class B>
std::unique_ptr< T > PolymorphicCopy< T, D, B >::copy() const
std::unique_ptr< T > PolymorphicCopy< T, D, B >::copy(void) const
{ return std::make_unique< D >(static_cast< const D& >(*this)); }

namespace __impl
Expand Down Expand Up @@ -124,7 +124,7 @@ namespace statiskit
{}

template<typename T>
Optimization< T >::Optimization()
Optimization< T >::Optimization(void)
{
_mindiff = 1e-5;
_minits = 1;
Expand All @@ -140,27 +140,27 @@ namespace statiskit
}

template<typename T>
Optimization< T >::~Optimization()
Optimization< T >::~Optimization(void)
{}

template<typename T>
const double& Optimization< T >::get_mindiff() const
const double& Optimization< T >::get_mindiff(void) const
{ return _mindiff; }

template<typename T>
void Optimization< T >::set_mindiff(const double& mindiff)
{ _mindiff = mindiff; }

template<typename T>
unsigned int Optimization< T >::get_minits() const
unsigned int Optimization< T >::get_minits(void) const
{ return _minits; }

template<typename T>
void Optimization< T >::set_minits(const unsigned int& minits)
{ _minits = minits; }

template<typename T>
unsigned int Optimization< T >::get_maxits() const
unsigned int Optimization< T >::get_maxits(void) const
{ return _maxits; }

template<typename T>
Expand All @@ -182,7 +182,7 @@ namespace statiskit
}

template<typename T>
SimulatedAnnealing< T >::SimulatedAnnealing()
SimulatedAnnealing< T >::SimulatedAnnealing(void)
{
_schedule = new ExponentialSchedule(1.);
_minits = 1;
Expand All @@ -201,7 +201,7 @@ namespace statiskit
}

template<typename T>
SimulatedAnnealing< T >::~SimulatedAnnealing()
SimulatedAnnealing< T >::~SimulatedAnnealing(void)
{
if(_schedule)
{
Expand All @@ -211,23 +211,23 @@ namespace statiskit
}

template<typename T>
const Schedule* SimulatedAnnealing< T >::get_schedule() const
const Schedule* SimulatedAnnealing< T >::get_schedule(void) const
{ return _schedule; }

template<typename T>
void SimulatedAnnealing< T >::set_schedule(const Schedule& schedule)
{ _schedule = schedule.copy().release(); }

template<typename T>
unsigned int SimulatedAnnealing< T >::get_minits() const
unsigned int SimulatedAnnealing< T >::get_minits(void) const
{ return _minits; }

template<typename T>
void SimulatedAnnealing< T >::set_minits(const unsigned int& minits)
{ _minits = minits; }

template<typename T>
unsigned int SimulatedAnnealing< T >::get_maxits() const
unsigned int SimulatedAnnealing< T >::get_maxits(void) const
{ return _maxits; }

template<typename T>
Expand Down
4 changes: 0 additions & 4 deletions src/cpp/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,11 @@ namespace statiskit

const UnivariateEvent* UnivariateDataFrame::Generator::event() const
{
if(!_data)
{ throw proxy_connection_error(); }
return _data->get_event(_index);
}

double UnivariateDataFrame::Generator::weight() const
{
if(!_data)
{ throw proxy_connection_error(); }
return 1;
}

Expand Down
Loading

0 comments on commit 600fb00

Please sign in to comment.