Sha256: 52f969dc86c8b16dc26286c3cba9f6ff585e58808e6fe4be88ed8123068c88d7
Contents?: true
Size: 857 Bytes
Versions: 3
Compression:
Stored size: 857 Bytes
Contents
#include <HPA.h> #include <rice/Module.hpp> #include "utils.h" void init_hpa(Rice::Module& m) { Rice::define_class_under<tomoto::IHPAModel, tomoto::IPAModel>(m, "HPA") .define_singleton_method( "_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); }) .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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tomoto-0.2.2 | ext/tomoto/hpa.cpp |
tomoto-0.2.1 | ext/tomoto/hpa.cpp |
tomoto-0.2.0 | ext/tomoto/hpa.cpp |