Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 7900acf5 authored by hhakim's avatar hhakim
Browse files

Update MHTPParams: refactoring the ctor in .hpp (initializing all the...

Update MHTPParams: refactoring the ctor in .hpp (initializing all the attributes), adding a to_string member function.
parent 85c899cf
No related branches found
No related tags found
No related merge requests found
#ifndef __MHTP__
#define __MHTP__
#include <string>
namespace Faust
{
/**
* \brief This class represents the set of parameters used for the MHTP (Multilinear Hard Thresholding Pursuit) algorithm used optionally in PALM4MSA (2020 implementation only).
*
*/
template<typename FPP>
struct MHTPParams
{
......@@ -11,8 +16,9 @@ namespace Faust
FPP step_size;
int palm4msa_period;
bool updating_lambda;
MHTPParams() : used(false) {}; //TODO: move in faust_MHTP.hpp
MHTPParams();
std::string to_string() const;
};
};
#include "faust_MHTP.hpp"
#endif
namespace Faust
{
template<typename FPP>
MHTPParams<FPP>::MHTPParams() : used(false),
constant_step_size(false),
step_size(1e-3),
palm4msa_period(1000),
updating_lambda(true),
sc(StoppingCriterion<FPP>(50)){};
template<typename FPP>
std::string MHTPParams<FPP>::to_string() const
{
auto sc_str = sc.to_string();
std::string str = "MHTPParams (START):";
str += "\r\n";
str += "StoppingCriterion:";
str += "\r\n ===";
str += sc_str;
str += " === \r\n";
str += "constant_step_size: ";
str += std::to_string(constant_step_size);
str += "\r\n";
str += "step_size: ";
str += std::to_string(step_size);
str += "\r\n";
str += "palm4msa_period: ";
str += std::to_string(palm4msa_period);
str += "\r\n";
str += "updating_lambda: ";
str += std::to_string(updating_lambda);
str += "\r\n";
str += "MHTPParams END.";
return str;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment