tomoto 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/ext/tomoto/extconf.rb +4 -2
- data/lib/tomoto/version.rb +1 -1
- data/vendor/tomotopy/README.kr.rst +10 -1
- data/vendor/tomotopy/README.rst +10 -1
- data/vendor/tomotopy/src/TopicModel/CT.h +2 -2
- data/vendor/tomotopy/src/TopicModel/CTModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/CTModel.hpp +1 -0
- data/vendor/tomotopy/src/TopicModel/DMR.h +2 -2
- data/vendor/tomotopy/src/TopicModel/DMRModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/DMRModel.hpp +1 -0
- data/vendor/tomotopy/src/TopicModel/DT.h +2 -2
- data/vendor/tomotopy/src/TopicModel/DTModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/DTModel.hpp +3 -0
- data/vendor/tomotopy/src/TopicModel/GDMR.h +2 -2
- data/vendor/tomotopy/src/TopicModel/GDMRModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/GDMRModel.hpp +1 -0
- data/vendor/tomotopy/src/TopicModel/HDP.h +2 -2
- data/vendor/tomotopy/src/TopicModel/HDPModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/HDPModel.hpp +2 -0
- data/vendor/tomotopy/src/TopicModel/HLDA.h +2 -2
- data/vendor/tomotopy/src/TopicModel/HLDAModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/HLDAModel.hpp +9 -0
- data/vendor/tomotopy/src/TopicModel/HPA.h +2 -2
- data/vendor/tomotopy/src/TopicModel/HPAModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/HPAModel.hpp +2 -0
- data/vendor/tomotopy/src/TopicModel/LDA.h +8 -2
- data/vendor/tomotopy/src/TopicModel/LDAModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/LDAModel.hpp +8 -0
- data/vendor/tomotopy/src/TopicModel/LLDA.h +2 -2
- data/vendor/tomotopy/src/TopicModel/LLDAModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/LLDAModel.hpp +1 -0
- data/vendor/tomotopy/src/TopicModel/MGLDA.h +2 -2
- data/vendor/tomotopy/src/TopicModel/MGLDAModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/MGLDAModel.hpp +1 -0
- data/vendor/tomotopy/src/TopicModel/PA.h +2 -2
- data/vendor/tomotopy/src/TopicModel/PAModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/PAModel.hpp +2 -0
- data/vendor/tomotopy/src/TopicModel/PLDAModel.hpp +1 -0
- data/vendor/tomotopy/src/TopicModel/PT.h +3 -3
- data/vendor/tomotopy/src/TopicModel/PTModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/PTModel.hpp +1 -0
- data/vendor/tomotopy/src/TopicModel/SLDA.h +3 -2
- data/vendor/tomotopy/src/TopicModel/SLDAModel.cpp +5 -0
- data/vendor/tomotopy/src/TopicModel/SLDAModel.hpp +1 -0
- data/vendor/tomotopy/src/TopicModel/TopicModel.hpp +77 -3
- data/vendor/tomotopy/src/Utils/Dictionary.cpp +102 -0
- data/vendor/tomotopy/src/Utils/Dictionary.h +26 -75
- data/vendor/tomotopy/src/Utils/Mmap.cpp +146 -0
- data/vendor/tomotopy/src/Utils/Mmap.h +139 -0
- data/vendor/tomotopy/src/Utils/MultiNormalDistribution.hpp +1 -0
- data/vendor/tomotopy/src/Utils/SharedString.cpp +134 -0
- data/vendor/tomotopy/src/Utils/SharedString.h +104 -0
- data/vendor/tomotopy/src/Utils/serializer.cpp +166 -0
- data/vendor/tomotopy/src/Utils/serializer.hpp +261 -85
- metadata +9 -4
- data/vendor/tomotopy/src/Utils/SharedString.hpp +0 -206
@@ -9,6 +9,7 @@
|
|
9
9
|
#include <unordered_map>
|
10
10
|
#include <Eigen/Dense>
|
11
11
|
#include "text.hpp"
|
12
|
+
#include "Utils.hpp"
|
12
13
|
|
13
14
|
/*
|
14
15
|
|
@@ -30,36 +31,51 @@ namespace tomoto
|
|
30
31
|
{
|
31
32
|
namespace serializer
|
32
33
|
{
|
33
|
-
struct membuf : std::streambuf
|
34
|
+
struct membuf : public std::streambuf
|
34
35
|
{
|
35
|
-
membuf(char* base, std::ptrdiff_t n)
|
36
|
+
membuf(bool read, bool write, char* base, std::ptrdiff_t n);
|
37
|
+
~membuf();
|
38
|
+
|
39
|
+
std::streampos seekpos(pos_type sp, std::ios_base::openmode which) override;
|
40
|
+
|
41
|
+
std::streampos seekoff(off_type off,
|
42
|
+
std::ios_base::seekdir dir,
|
43
|
+
std::ios_base::openmode which = std::ios_base::in
|
44
|
+
) override;
|
45
|
+
|
46
|
+
const char* curptr() const
|
36
47
|
{
|
37
|
-
this->
|
48
|
+
return this->gptr();
|
38
49
|
}
|
50
|
+
};
|
51
|
+
|
52
|
+
class imstream : public std::istream
|
53
|
+
{
|
54
|
+
membuf buf;
|
55
|
+
public:
|
56
|
+
imstream(const char* base, std::ptrdiff_t n);
|
57
|
+
~imstream();
|
39
58
|
|
40
|
-
|
41
|
-
|
59
|
+
template<class Ty>
|
60
|
+
imstream(const Ty& m) : imstream(m.get(), m.size())
|
61
|
+
{
|
42
62
|
}
|
43
63
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
if (dir == std::ios_base::cur)
|
48
|
-
gbump(off);
|
49
|
-
else if (dir == std::ios_base::end)
|
50
|
-
setg(eback(), egptr() + off, egptr());
|
51
|
-
else if (dir == std::ios_base::beg)
|
52
|
-
setg(eback(), eback() + off, egptr());
|
53
|
-
return gptr() - eback();
|
64
|
+
const char* curptr() const
|
65
|
+
{
|
66
|
+
return buf.curptr();
|
54
67
|
}
|
55
68
|
};
|
56
69
|
|
57
|
-
class
|
70
|
+
class omstream : public std::ostream
|
58
71
|
{
|
59
72
|
membuf buf;
|
60
73
|
public:
|
61
|
-
|
62
|
-
|
74
|
+
omstream(char* base, std::ptrdiff_t n);
|
75
|
+
~omstream();
|
76
|
+
|
77
|
+
template<class Ty>
|
78
|
+
omstream(const Ty& m) : omstream(m.get(), m.size())
|
63
79
|
{
|
64
80
|
}
|
65
81
|
};
|
@@ -224,6 +240,16 @@ namespace tomoto
|
|
224
240
|
return v;
|
225
241
|
}
|
226
242
|
|
243
|
+
template<typename _Ty>
|
244
|
+
inline uint64_t computeHash(uint64_t seed, const _Ty& v)
|
245
|
+
{
|
246
|
+
return Serializer<
|
247
|
+
typename std::remove_const<typename std::remove_reference<_Ty>::type>::type
|
248
|
+
>{}.hash(seed, v);
|
249
|
+
}
|
250
|
+
|
251
|
+
uint64_t computeFastHash(const void* data, size_t size, uint64_t seed = 0);
|
252
|
+
|
227
253
|
inline void writeMany(std::ostream& ostr)
|
228
254
|
{
|
229
255
|
// do nothing
|
@@ -279,6 +305,22 @@ namespace tomoto
|
|
279
305
|
return m == first.m;
|
280
306
|
}
|
281
307
|
|
308
|
+
inline uint64_t computeHashMany(uint64_t seed)
|
309
|
+
{
|
310
|
+
return seed;
|
311
|
+
}
|
312
|
+
|
313
|
+
template<typename _FirstTy, typename ... _RestTy>
|
314
|
+
inline typename std::enable_if<
|
315
|
+
!is_key<typename std::remove_reference<_FirstTy>::type>::value,
|
316
|
+
uint64_t
|
317
|
+
>::type computeHashMany(uint64_t seed, _FirstTy&& first, _RestTy&&... rest)
|
318
|
+
{
|
319
|
+
seed = computeHash(seed, std::forward<_FirstTy>(first));
|
320
|
+
seed = computeHashMany(seed, std::forward<_RestTy>(rest)...);
|
321
|
+
return seed;
|
322
|
+
}
|
323
|
+
|
282
324
|
template<size_t>
|
283
325
|
struct version_holder {};
|
284
326
|
|
@@ -343,6 +385,11 @@ namespace tomoto
|
|
343
385
|
if (!istr.read((char*)&v, sizeof(_Ty)))
|
344
386
|
throw std::ios_base::failure(std::string("reading type '") + typeid(_Ty).name() + std::string("' is failed"));
|
345
387
|
}
|
388
|
+
|
389
|
+
uint64_t hash(uint64_t seed, const _Ty& v)
|
390
|
+
{
|
391
|
+
return computeFastHash(&v, sizeof(_Ty), seed);
|
392
|
+
}
|
346
393
|
};
|
347
394
|
|
348
395
|
template<typename _Ty>
|
@@ -357,6 +404,11 @@ namespace tomoto
|
|
357
404
|
{
|
358
405
|
v.serializerRead(istr);
|
359
406
|
}
|
407
|
+
|
408
|
+
uint64_t hash(uint64_t seed, const _Ty& v)
|
409
|
+
{
|
410
|
+
return v.computeHash(seed);
|
411
|
+
}
|
360
412
|
};
|
361
413
|
|
362
414
|
template<typename _Ty>
|
@@ -435,6 +487,13 @@ namespace tomoto
|
|
435
487
|
if (!istr.read((char*)v.data(), sizeof(_Ty) * rows * cols))
|
436
488
|
throw std::ios_base::failure(std::string("reading type '") + typeid(_Ty).name() + std::string("' is failed"));
|
437
489
|
}
|
490
|
+
|
491
|
+
uint64_t hash(uint64_t seed, const VTy& v)
|
492
|
+
{
|
493
|
+
seed = computeHash(seed, (uint32_t)v.rows());
|
494
|
+
seed = computeHash(seed, (uint32_t)v.cols());
|
495
|
+
return computeFastHash(v.data(), sizeof(_Ty) * v.size(), seed);
|
496
|
+
}
|
438
497
|
};
|
439
498
|
|
440
499
|
template<typename _Ty>
|
@@ -457,6 +516,13 @@ namespace tomoto
|
|
457
516
|
if (!istr.read((char*)v.data(), sizeof(_Ty) * rows * cols))
|
458
517
|
throw std::ios_base::failure(std::string("reading type '") + typeid(_Ty).name() + std::string("' is failed"));
|
459
518
|
}
|
519
|
+
|
520
|
+
uint64_t hash(uint64_t seed, const VTy& v)
|
521
|
+
{
|
522
|
+
seed = computeHash(seed, (uint32_t)v.rows());
|
523
|
+
seed = computeHash(seed, (uint32_t)v.cols());
|
524
|
+
return computeFastHash(v.data(), sizeof(_Ty) * v.size(), seed);
|
525
|
+
}
|
460
526
|
};
|
461
527
|
|
462
528
|
template<typename _Ty>
|
@@ -487,6 +553,12 @@ namespace tomoto
|
|
487
553
|
if (!istr.read((char*)v.data(), sizeof(_Ty) * size))
|
488
554
|
throw std::ios_base::failure(std::string("reading type '") + typeid(_Ty).name() + std::string("' is failed"));
|
489
555
|
}
|
556
|
+
|
557
|
+
uint64_t hash(uint64_t seed, const VTy& v)
|
558
|
+
{
|
559
|
+
seed = computeHash(seed, (uint32_t)v.size());
|
560
|
+
return computeFastHash(v.data(), sizeof(_Ty) * v.size(), seed);
|
561
|
+
}
|
490
562
|
};
|
491
563
|
|
492
564
|
template<typename _Ty>
|
@@ -505,6 +577,16 @@ namespace tomoto
|
|
505
577
|
v.resize(size);
|
506
578
|
for (auto& e : v) Serializer<_Ty>{}.read(istr, e);
|
507
579
|
}
|
580
|
+
|
581
|
+
uint64_t hash(uint64_t seed, const VTy& v)
|
582
|
+
{
|
583
|
+
seed = computeHash(seed, (uint32_t)v.size());
|
584
|
+
for (auto& e : v)
|
585
|
+
{
|
586
|
+
seed = computeHash(seed, e);
|
587
|
+
}
|
588
|
+
return seed;
|
589
|
+
}
|
508
590
|
};
|
509
591
|
|
510
592
|
template<typename _Ty, size_t n>
|
@@ -525,6 +607,12 @@ namespace tomoto
|
|
525
607
|
if (!istr.read((char*)v.data(), sizeof(_Ty) * size))
|
526
608
|
throw std::ios_base::failure(std::string("reading type '") + typeid(_Ty).name() + std::string("' is failed"));
|
527
609
|
}
|
610
|
+
|
611
|
+
uint64_t hash(uint64_t seed, const VTy& v)
|
612
|
+
{
|
613
|
+
seed = computeHash(seed, (uint32_t)v.size());
|
614
|
+
return computeFastHash(v.data(), sizeof(_Ty) * v.size(), seed);
|
615
|
+
}
|
528
616
|
};
|
529
617
|
|
530
618
|
template<typename _Ty, size_t n>
|
@@ -543,6 +631,16 @@ namespace tomoto
|
|
543
631
|
if (n != size) throw std::ios_base::failure(text::format("the size of array must be %zd, not %zd", n, size));
|
544
632
|
for (auto& e : v) Serializer<_Ty>{}.read(istr, e);
|
545
633
|
}
|
634
|
+
|
635
|
+
uint64_t hash(uint64_t seed, const VTy& v)
|
636
|
+
{
|
637
|
+
seed = computeHash(seed, (uint32_t)v.size());
|
638
|
+
for (auto& e : v)
|
639
|
+
{
|
640
|
+
seed = computeHash(seed, e);
|
641
|
+
}
|
642
|
+
return seed;
|
643
|
+
}
|
546
644
|
};
|
547
645
|
|
548
646
|
template<typename _Ty>
|
@@ -563,6 +661,12 @@ namespace tomoto
|
|
563
661
|
if (!istr.read((char*)v.data(), sizeof(_Ty) * size))
|
564
662
|
throw std::ios_base::failure(std::string("reading type '") + typeid(_Ty).name() + std::string("' is failed"));
|
565
663
|
}
|
664
|
+
|
665
|
+
uint64_t hash(uint64_t seed, const VTy& v)
|
666
|
+
{
|
667
|
+
seed = computeHash(seed, (uint32_t)v.size());
|
668
|
+
return computeFastHash(v.data(), sizeof(_Ty) * v.size(), seed);
|
669
|
+
}
|
566
670
|
};
|
567
671
|
|
568
672
|
template<typename _Ty1, typename _Ty2>
|
@@ -578,6 +682,13 @@ namespace tomoto
|
|
578
682
|
{
|
579
683
|
readMany(istr, v.first, v.second);
|
580
684
|
}
|
685
|
+
|
686
|
+
uint64_t hash(uint64_t seed, const VTy& v)
|
687
|
+
{
|
688
|
+
seed = computeHash(seed, v.first);
|
689
|
+
seed = computeHash(seed, v.second);
|
690
|
+
return seed;
|
691
|
+
}
|
581
692
|
};
|
582
693
|
|
583
694
|
template<typename _Ty1, typename _Ty2>
|
@@ -599,6 +710,8 @@ namespace tomoto
|
|
599
710
|
v.emplace(readFromStream<std::pair<_Ty1, _Ty2>>(istr));
|
600
711
|
}
|
601
712
|
}
|
713
|
+
|
714
|
+
// not support hash
|
602
715
|
};
|
603
716
|
|
604
717
|
template<typename _Ty1, typename _Ty2>
|
@@ -620,6 +733,16 @@ namespace tomoto
|
|
620
733
|
v.emplace(readFromStream<std::pair<_Ty1, _Ty2>>(istr));
|
621
734
|
}
|
622
735
|
}
|
736
|
+
|
737
|
+
uint64_t hash(uint64_t seed, const VTy& v)
|
738
|
+
{
|
739
|
+
seed = computeHash(seed, (uint32_t)v.size());
|
740
|
+
for (auto& e : v)
|
741
|
+
{
|
742
|
+
seed = computeHash(seed, e);
|
743
|
+
}
|
744
|
+
return seed;
|
745
|
+
}
|
623
746
|
};
|
624
747
|
|
625
748
|
template<typename _Ty>
|
@@ -635,91 +758,98 @@ namespace tomoto
|
|
635
758
|
{
|
636
759
|
_Ty::serializerRead(v, istr);
|
637
760
|
}
|
638
|
-
};
|
639
761
|
|
640
|
-
|
762
|
+
uint64_t hash(uint64_t seed, const VTy& v)
|
763
|
+
{
|
764
|
+
return _Ty::serializerHash(v, seed);
|
765
|
+
}
|
766
|
+
};
|
641
767
|
|
642
|
-
|
643
|
-
inline void writeTaggedData(std::ostream& ostr, uint32_t version, uint32_t trailing_cnt, const Key<_len>& key, const _Ty& data)
|
768
|
+
class BlockStreamBuffer : public std::basic_streambuf<char>
|
644
769
|
{
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
ostr.seekp(totsize_pos);
|
651
|
-
writeMany(ostr, (uint64_t)(end_pos - totsize_pos));
|
652
|
-
ostr.seekp(end_pos);
|
653
|
-
}
|
770
|
+
std::vector<std::unique_ptr<uint8_t[]>> buffers;
|
771
|
+
size_t block_size = 0;
|
772
|
+
public:
|
773
|
+
BlockStreamBuffer(size_t _block_size = 4096);
|
774
|
+
~BlockStreamBuffer();
|
654
775
|
|
655
|
-
|
656
|
-
|
776
|
+
int overflow(int c) override;
|
777
|
+
|
778
|
+
std::streamsize xsputn(const char* s, std::streamsize n) override;
|
779
|
+
|
780
|
+
size_t totalSize() const;
|
781
|
+
|
782
|
+
template<class Fn>
|
783
|
+
void iterateBuffers(Fn fn) const
|
784
|
+
{
|
785
|
+
for (size_t i = 0; i < buffers.size() - 1; ++i)
|
786
|
+
{
|
787
|
+
fn(buffers[i].get(), block_size);
|
788
|
+
}
|
789
|
+
fn(buffers.back().get(), this->pptr() - this->pbase());
|
790
|
+
}
|
791
|
+
};
|
792
|
+
|
793
|
+
static constexpr uint32_t taggedDataKeyUint = 0x4b545054; // "TPTK"
|
794
|
+
|
795
|
+
struct TaggedDataHeader
|
657
796
|
{
|
658
|
-
|
797
|
+
uint32_t key;
|
798
|
+
uint32_t version;
|
659
799
|
uint64_t totsize;
|
660
800
|
uint32_t keysize;
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
801
|
+
uint32_t trailing_cnt;
|
802
|
+
};
|
803
|
+
|
804
|
+
template<size_t _len, typename _Ty>
|
805
|
+
inline void writeTaggedData(std::ostream& ostr, uint32_t version, uint32_t trailing_cnt, const Key<_len>& key, const _Ty& data)
|
806
|
+
{
|
807
|
+
BlockStreamBuffer buf;
|
808
|
+
std::ostream serialized_data(&buf);
|
809
|
+
writeMany(serialized_data, key, data);
|
810
|
+
const auto key_data_size = buf.totalSize();
|
811
|
+
|
812
|
+
TaggedDataHeader h;
|
813
|
+
h.key = taggedDataKeyUint;
|
814
|
+
h.version = version;
|
815
|
+
h.totsize = key_data_size + 16;
|
816
|
+
h.keysize = key.size();
|
817
|
+
h.trailing_cnt = trailing_cnt;
|
818
|
+
|
819
|
+
ostr.write((const char*)&h, sizeof(h));
|
820
|
+
buf.iterateBuffers([&](const void* data, size_t size)
|
680
821
|
{
|
681
|
-
|
682
|
-
|
683
|
-
}
|
684
|
-
return std::make_pair(true, end_pos);
|
822
|
+
ostr.write((const char*)data, size);
|
823
|
+
});
|
685
824
|
}
|
686
825
|
|
687
|
-
|
826
|
+
using TaggedDataMap = std::unordered_map<std::string, std::pair<std::streampos, std::streampos>>;
|
827
|
+
|
828
|
+
TaggedDataMap readTaggedDataMap(std::istream& istr, uint32_t version);
|
829
|
+
|
830
|
+
inline void readTaggedMany(std::istream& istr, const TaggedDataMap& data_map, uint32_t version)
|
688
831
|
{
|
689
832
|
// seek to the end of tagged data list
|
690
|
-
|
691
|
-
do
|
692
|
-
{
|
693
|
-
uint64_t totsize;
|
694
|
-
uint32_t keysize;
|
695
|
-
readMany(istr, taggedDataKey, version);
|
696
|
-
std::streampos totsize_pos = istr.tellg();
|
697
|
-
readMany(istr, totsize, keysize, trailing_cnt);
|
698
|
-
istr.seekg(totsize_pos + (std::streamoff)totsize);
|
699
|
-
|
700
|
-
} while (trailing_cnt);
|
833
|
+
istr.seekg(data_map.find("")->second.second);
|
701
834
|
}
|
702
835
|
|
703
836
|
template<size_t _len, typename _Ty, typename ... _Rest>
|
704
|
-
inline void readTaggedMany(std::istream& istr, uint32_t version, const Key<_len>& key, _Ty& data, _Rest&&... rest)
|
837
|
+
inline void readTaggedMany(std::istream& istr, const TaggedDataMap& data_map, uint32_t version, const Key<_len>& key, _Ty& data, _Rest&&... rest)
|
705
838
|
{
|
706
|
-
auto
|
707
|
-
|
708
|
-
do
|
839
|
+
auto it = data_map.find(key.str());
|
840
|
+
if (it != data_map.end())
|
709
841
|
{
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
else
|
716
|
-
{
|
717
|
-
istr.seekg(p.second);
|
718
|
-
}
|
719
|
-
} while (trailing_cnt);
|
842
|
+
istr.seekg(it->second.first);
|
843
|
+
readMany(istr, data);
|
844
|
+
}
|
845
|
+
readTaggedMany(istr, data_map, version, std::forward<_Rest>(rest)...);
|
846
|
+
}
|
720
847
|
|
721
|
-
|
722
|
-
|
848
|
+
template<typename ... _Rest>
|
849
|
+
inline void readTaggedMany(std::istream& istr, uint32_t version, _Rest&&... rest)
|
850
|
+
{
|
851
|
+
const auto data_map = readTaggedDataMap(istr, version);
|
852
|
+
readTaggedMany(istr, data_map, version, std::forward<_Rest>(rest)...);
|
723
853
|
}
|
724
854
|
|
725
855
|
inline void writeTaggedMany(std::ostream& ostr, uint32_t version)
|
@@ -745,6 +875,11 @@ void serializerWrite(std::ostream& ostr) const\
|
|
745
875
|
tomoto::serializer::writeMany(ostr, __VA_ARGS__);\
|
746
876
|
}
|
747
877
|
|
878
|
+
#define DEFINE_HASHER(...) uint64_t computeHash(uint64_t seed) const\
|
879
|
+
{\
|
880
|
+
return tomoto::serializer::computeHashMany(seed, __VA_ARGS__);\
|
881
|
+
}
|
882
|
+
|
748
883
|
#define DEFINE_SERIALIZER_WITH_VERSION(v,...) void serializerRead(tomoto::serializer::version_holder<v>, std::istream& istr)\
|
749
884
|
{\
|
750
885
|
tomoto::serializer::readMany(istr, __VA_ARGS__);\
|
@@ -775,6 +910,12 @@ void serializerWrite(std::ostream& ostr) const\
|
|
775
910
|
tomoto::serializer::writeMany(ostr, __VA_ARGS__);\
|
776
911
|
}
|
777
912
|
|
913
|
+
#define DEFINE_HASHER_AFTER_BASE(base, ...) uint64_t computeHash(uint64_t seed) const\
|
914
|
+
{\
|
915
|
+
seed = base::computeHash(seed);\
|
916
|
+
return tomoto::serializer::computeHashMany(seed, __VA_ARGS__);\
|
917
|
+
}\
|
918
|
+
|
778
919
|
#define DEFINE_SERIALIZER_AFTER_BASE_WITH_VERSION(base, v, ...) void serializerRead(tomoto::serializer::version_holder<v> _v, std::istream& istr)\
|
779
920
|
{\
|
780
921
|
base::serializerRead(_v, istr);\
|
@@ -786,6 +927,17 @@ void serializerWrite(tomoto::serializer::version_holder<v> _v, std::ostream& ost
|
|
786
927
|
tomoto::serializer::writeMany(ostr, __VA_ARGS__);\
|
787
928
|
}
|
788
929
|
|
930
|
+
#define DEFINE_OUT_SERIALIZER_AFTER_BASE_WITH_VERSION(cls, base, v, ...) template<TermWeight _tw> void cls<_tw>::serializerRead(tomoto::serializer::version_holder<v> _v, std::istream& istr)\
|
931
|
+
{\
|
932
|
+
base::serializerRead(_v, istr);\
|
933
|
+
tomoto::serializer::readMany(istr, __VA_ARGS__);\
|
934
|
+
}\
|
935
|
+
template<TermWeight _tw> void cls<_tw>::serializerWrite(tomoto::serializer::version_holder<v> _v, std::ostream& ostr) const\
|
936
|
+
{\
|
937
|
+
base::serializerWrite(_v, ostr);\
|
938
|
+
tomoto::serializer::writeMany(ostr, __VA_ARGS__);\
|
939
|
+
}
|
940
|
+
|
789
941
|
#define DEFINE_SERIALIZER_BASE_WITH_VERSION(base, v) void serializerRead(tomoto::serializer::version_holder<v> _v, std::istream& istr)\
|
790
942
|
{\
|
791
943
|
base::serializerRead(_v, istr);\
|
@@ -795,6 +947,19 @@ void serializerWrite(tomoto::serializer::version_holder<v> _v, std::ostream& ost
|
|
795
947
|
base::serializerWrite(_v, ostr);\
|
796
948
|
}
|
797
949
|
|
950
|
+
#define DEFINE_OUT_SERIALIZER_BASE_WITH_VERSION(cls, base, v) template<TermWeight _tw> void cls<_tw>::serializerRead(tomoto::serializer::version_holder<v> _v, std::istream& istr)\
|
951
|
+
{\
|
952
|
+
base::serializerRead(_v, istr);\
|
953
|
+
}\
|
954
|
+
template<TermWeight _tw> void cls<_tw>::serializerWrite(tomoto::serializer::version_holder<v> _v, std::ostream& ostr) const\
|
955
|
+
{\
|
956
|
+
base::serializerWrite(_v, ostr);\
|
957
|
+
}
|
958
|
+
|
959
|
+
|
960
|
+
#define DECLARE_SERIALIZER_WITH_VERSION(v) void serializerRead(tomoto::serializer::version_holder<v> _v, std::istream& istr);\
|
961
|
+
void serializerWrite(tomoto::serializer::version_holder<v> _v, std::ostream& ostr) const;
|
962
|
+
|
798
963
|
#define DEFINE_SERIALIZER_AFTER_BASE_CALLBACK(base, onRead, ...) void serializerRead(std::istream& istr)\
|
799
964
|
{\
|
800
965
|
base::serializerRead(istr);\
|
@@ -863,3 +1028,14 @@ void serializerWrite(tomoto::serializer::version_holder<v> _v, std::ostream& ost
|
|
863
1028
|
base::serializerWrite(_v, ostr);\
|
864
1029
|
tomoto::serializer::writeTaggedMany(ostr, t, _TO_KEY_VALUE(__VA_ARGS__));\
|
865
1030
|
}
|
1031
|
+
|
1032
|
+
#define DEFINE_OUT_TAGGED_SERIALIZER_AFTER_BASE_WITH_VERSION(cls, base, v, t,...) template<TermWeight _tw> void cls<_tw>::serializerRead(tomoto::serializer::version_holder<v> _v, std::istream& istr)\
|
1033
|
+
{\
|
1034
|
+
base::serializerRead(_v, istr);\
|
1035
|
+
tomoto::serializer::readTaggedMany(istr, t, _TO_KEY_VALUE(__VA_ARGS__));\
|
1036
|
+
}\
|
1037
|
+
template<TermWeight _tw> void cls<_tw>::serializerWrite(tomoto::serializer::version_holder<v> _v, std::ostream& ostr) const\
|
1038
|
+
{\
|
1039
|
+
base::serializerWrite(_v, ostr);\
|
1040
|
+
tomoto::serializer::writeTaggedMany(ostr, t, _TO_KEY_VALUE(__VA_ARGS__));\
|
1041
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomoto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rice
|
@@ -499,6 +499,7 @@ files:
|
|
499
499
|
- vendor/tomotopy/src/TopicModel/SLDAModel.hpp
|
500
500
|
- vendor/tomotopy/src/TopicModel/TopicModel.hpp
|
501
501
|
- vendor/tomotopy/src/Utils/AliasMethod.hpp
|
502
|
+
- vendor/tomotopy/src/Utils/Dictionary.cpp
|
502
503
|
- vendor/tomotopy/src/Utils/Dictionary.h
|
503
504
|
- vendor/tomotopy/src/Utils/EigenAddonOps.hpp
|
504
505
|
- vendor/tomotopy/src/Utils/LBFGS.h
|
@@ -506,10 +507,13 @@ files:
|
|
506
507
|
- vendor/tomotopy/src/Utils/LBFGS/LineSearchBracketing.h
|
507
508
|
- vendor/tomotopy/src/Utils/LBFGS/Param.h
|
508
509
|
- vendor/tomotopy/src/Utils/LUT.hpp
|
510
|
+
- vendor/tomotopy/src/Utils/Mmap.cpp
|
511
|
+
- vendor/tomotopy/src/Utils/Mmap.h
|
509
512
|
- vendor/tomotopy/src/Utils/MultiNormalDistribution.hpp
|
510
513
|
- vendor/tomotopy/src/Utils/PolyaGamma.hpp
|
511
514
|
- vendor/tomotopy/src/Utils/PolyaGammaHybrid.hpp
|
512
|
-
- vendor/tomotopy/src/Utils/SharedString.
|
515
|
+
- vendor/tomotopy/src/Utils/SharedString.cpp
|
516
|
+
- vendor/tomotopy/src/Utils/SharedString.h
|
513
517
|
- vendor/tomotopy/src/Utils/ThreadPool.hpp
|
514
518
|
- vendor/tomotopy/src/Utils/Trie.hpp
|
515
519
|
- vendor/tomotopy/src/Utils/TruncMultiNormal.hpp
|
@@ -521,6 +525,7 @@ files:
|
|
521
525
|
- vendor/tomotopy/src/Utils/neon_gamma.h
|
522
526
|
- vendor/tomotopy/src/Utils/rtnorm.hpp
|
523
527
|
- vendor/tomotopy/src/Utils/sample.hpp
|
528
|
+
- vendor/tomotopy/src/Utils/serializer.cpp
|
524
529
|
- vendor/tomotopy/src/Utils/serializer.hpp
|
525
530
|
- vendor/tomotopy/src/Utils/slp.hpp
|
526
531
|
- vendor/tomotopy/src/Utils/sse_gamma.h
|
@@ -553,7 +558,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
553
558
|
- !ruby/object:Gem::Version
|
554
559
|
version: '0'
|
555
560
|
requirements: []
|
556
|
-
rubygems_version: 3.5.
|
561
|
+
rubygems_version: 3.5.11
|
557
562
|
signing_key:
|
558
563
|
specification_version: 4
|
559
564
|
summary: High performance topic modeling for Ruby
|