Sha256: 7a91bb3369b0e850b63ca954aba3b5a72c256c76577344b4e7caa7ed494ee1e7
Contents?: true
Size: 887 Bytes
Versions: 35
Compression:
Stored size: 887 Bytes
Contents
#include <HPA.h> #include <rice/rice.hpp> #include "utils.h" void init_hpa(Rice::Module& m) { Rice::define_class_under<tomoto::IHPAModel, tomoto::IPAModel>(m, "HPA") .define_singleton_function( "_new", [](size_t tw, size_t k1, size_t k2, tomoto::Float alpha, tomoto::Float eta, size_t seed) { tomoto::HPAArgs args; args.k = k1; args.k2 = k2; args.alpha = {alpha}; args.eta = eta; if (seed >= 0) { args.seed = seed; } return tomoto::IHPAModel::create((tomoto::TermWeight)tw, false, args); }, Rice::Return().takeOwnership()) .define_method( "alpha", [](tomoto::IHPAModel& self) { Array res; // use <= to return k+1 elements for (size_t i = 0; i <= self.getK(); i++) { res.push(self.getAlpha(i)); } return res; }); }
Version data entries
35 entries across 35 versions & 1 rubygems