tomoto 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/README.md +2 -0
  4. data/ext/tomoto/extconf.rb +11 -3
  5. data/ext/tomoto/lda.cpp +2 -2
  6. data/lib/tomoto/version.rb +1 -1
  7. data/vendor/EigenRand/EigenRand/Core.h +2 -2
  8. data/vendor/EigenRand/EigenRand/Dists/Basic.h +66 -4
  9. data/vendor/EigenRand/EigenRand/Dists/Discrete.h +3 -3
  10. data/vendor/EigenRand/EigenRand/Dists/GammaPoisson.h +2 -2
  11. data/vendor/EigenRand/EigenRand/Dists/NormalExp.h +2 -2
  12. data/vendor/EigenRand/EigenRand/EigenRand +2 -2
  13. data/vendor/EigenRand/EigenRand/Macro.h +3 -3
  14. data/vendor/EigenRand/EigenRand/MorePacketMath.h +2 -2
  15. data/vendor/EigenRand/EigenRand/MvDists/Multinomial.h +2 -2
  16. data/vendor/EigenRand/EigenRand/MvDists/MvNormal.h +2 -2
  17. data/vendor/EigenRand/EigenRand/PacketFilter.h +2 -2
  18. data/vendor/EigenRand/EigenRand/PacketRandomEngine.h +23 -8
  19. data/vendor/EigenRand/EigenRand/RandUtils.h +4 -4
  20. data/vendor/EigenRand/EigenRand/arch/AVX/MorePacketMath.h +2 -2
  21. data/vendor/EigenRand/EigenRand/arch/AVX/PacketFilter.h +2 -2
  22. data/vendor/EigenRand/EigenRand/arch/AVX/RandUtils.h +3 -3
  23. data/vendor/EigenRand/EigenRand/arch/NEON/MorePacketMath.h +2 -2
  24. data/vendor/EigenRand/EigenRand/arch/NEON/PacketFilter.h +2 -2
  25. data/vendor/EigenRand/EigenRand/arch/NEON/RandUtils.h +3 -3
  26. data/vendor/EigenRand/EigenRand/arch/SSE/MorePacketMath.h +2 -2
  27. data/vendor/EigenRand/EigenRand/arch/SSE/PacketFilter.h +2 -2
  28. data/vendor/EigenRand/EigenRand/arch/SSE/RandUtils.h +3 -3
  29. data/vendor/EigenRand/README.md +4 -0
  30. data/vendor/tomotopy/README.kr.rst +7 -0
  31. data/vendor/tomotopy/README.rst +22 -0
  32. data/vendor/tomotopy/src/Utils/EigenAddonOps.hpp +1 -1
  33. data/vendor/tomotopy/src/Utils/neon_gamma.h +51 -0
  34. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3e3aa3215e693030f3069cab0fd62686e9d28ad4df6e93ee2e9c7ba9e29286f
4
- data.tar.gz: 98e4f18488132f6130bd9523d8540dd73626e8b3e5a58a1656ce3aa1ddf8234b
3
+ metadata.gz: cbe3d5af04af38307a6bb5cf2db40fbc6df243bfaa34a3e53cd3360a2eed809d
4
+ data.tar.gz: 88cab90fd0a3ab1e1554ee9561eda4a23761703171b3262e36f564b6ebec5d8e
5
5
  SHA512:
6
- metadata.gz: 95b9d0697f58a9149c18cbbdcc7b93aa19dc7f335f12033fc80386a2ca6628bfc3c2a7a9c7299cd192459132f8d467663562de3da733cca00041da24361a6d9f
7
- data.tar.gz: 9c0e12d32aedb8cb0689032f9b0fe54387b9b452a1e26b747137c4115e9813ea491fa09b6851b9e69ca6a3a86df159409d57322c3862b670ae3b3d4f8711469d
6
+ metadata.gz: 9dc6d9734f06988259b1c2c45e63549713f4d8071c1b81ffda4a43573b908a0e601b79f5cf23e1ecd94c880dbde16d50a297c6d109a878e2c45c5a3b0edf2158
7
+ data.tar.gz: 47a95868b9d750de9aba52ccc11849ee50968c4dc988d670df0d13d62ec14f0dcd49c5709b0b54f8bd66972cd9d2243eedf73632fe61221bfea23b60dfa4e573
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.3.2 (2023-01-22)
2
+
3
+ - Added precompiled gem for Mac ARM
4
+ - Updated tomoto to 0.12.4
5
+
6
+ ## 0.3.1 (2023-01-12)
7
+
8
+ - Added support for Ruby 3.2
9
+
1
10
  ## 0.3.0 (2022-10-03)
2
11
 
3
12
  - Added precompiled gems for Linux and Mac
data/README.md CHANGED
@@ -12,6 +12,8 @@ Add this line to your application’s Gemfile:
12
12
  gem "tomoto"
13
13
  ```
14
14
 
15
+ ARM is not currently supported
16
+
15
17
  ## Getting Started
16
18
 
17
19
  Train a model
@@ -3,9 +3,17 @@ require "mkmf-rice"
3
3
  $CXXFLAGS += " -std=c++17 $(optflags) -DEIGEN_MPL2_ONLY"
4
4
 
5
5
  unless ENV["RUBY_CC_VERSION"]
6
- # AVX-512F not support yet
7
- # https://github.com/bab2min/tomotopy/issues/188
8
- $CXXFLAGS << " " << with_config("optflags", "-march=native -mno-avx512f")
6
+ default_optflags =
7
+ if RbConfig::CONFIG["host_os"] =~ /darwin/i && RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i
8
+ # -march=native not supported with Mac ARM
9
+ ""
10
+ else
11
+ # AVX-512F not supported yet
12
+ # https://github.com/bab2min/tomotopy/issues/188
13
+ "-march=native -mno-avx512f"
14
+ end
15
+
16
+ $CXXFLAGS << " " << with_config("optflags", default_optflags)
9
17
  end
10
18
 
11
19
  apple_clang = RbConfig::CONFIG["CC_VERSION_MESSAGE"] =~ /apple clang/i
data/ext/tomoto/lda.cpp CHANGED
@@ -49,12 +49,12 @@ void init_lda(Rice::Module& m) {
49
49
  })
50
50
  .define_method(
51
51
  "_make_doc",
52
- *[](tomoto::ILDAModel& self, std::vector<std::string> words) {
52
+ [](tomoto::ILDAModel& self, std::vector<std::string> words) {
53
53
  return DocumentObject(self.makeDoc(buildDoc(words)).release(), &self);
54
54
  })
55
55
  .define_method(
56
56
  "_infer",
57
- *[](tomoto::ILDAModel& self, DocumentObject& doc_object, size_t iteration, float tolerance, size_t workers, size_t ps, size_t together) {
57
+ [](tomoto::ILDAModel& self, DocumentObject& doc_object, size_t iteration, float tolerance, size_t workers, size_t ps, size_t together) {
58
58
  std::vector<tomoto::DocumentBase*> docs;
59
59
  auto doc = doc_object.doc;
60
60
  docs.emplace_back(const_cast<tomoto::DocumentBase*>(doc));
@@ -1,3 +1,3 @@
1
1
  module Tomoto
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -2,8 +2,8 @@
2
2
  * @file Core.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.3
6
- * @date 2021-03-31
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file Basic.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.3
6
- * @date 2021-03-31
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -360,6 +360,31 @@ namespace Eigen
360
360
  }
361
361
  };
362
362
 
363
+ namespace detail
364
+ {
365
+ template<size_t v>
366
+ struct BitWidth
367
+ {
368
+ static constexpr size_t value = BitWidth<v / 2>::value + 1;
369
+ };
370
+
371
+ template<>
372
+ struct BitWidth<0>
373
+ {
374
+ static constexpr size_t value = 0;
375
+ };
376
+
377
+ template<class Rng>
378
+ struct RngBitSize
379
+ {
380
+ static constexpr size_t _min = Rng::min();
381
+ static constexpr size_t _max = Rng::max();
382
+
383
+ static constexpr bool _fullbit_rng = _min == 0 && (_max & (_max + 1)) == 0;
384
+ static constexpr size_t value = IsPacketRandomEngine<Rng>::value ? sizeof(typename Rng::result_type) * 8 : (_fullbit_rng ? BitWidth<_max>::value : 0);
385
+ };
386
+ }
387
+
363
388
  /**
364
389
  * @brief Generator of reals in a range `[0, 1)`
365
390
  *
@@ -373,20 +398,57 @@ namespace Eigen
373
398
  public:
374
399
  using Scalar = _Scalar;
375
400
 
376
- template<typename Rng>
401
+ template<typename Rng,
402
+ typename std::enable_if<sizeof(Scalar) * 8 <= detail::RngBitSize<typename std::remove_const<typename std::remove_reference<Rng>::type>::type>::value, int>::type = 0
403
+ >
377
404
  EIGEN_STRONG_INLINE const _Scalar operator() (Rng&& rng)
378
405
  {
379
406
  using namespace Eigen::internal;
380
407
  return BitScalar<_Scalar>{}.to_ur(ExtractFirstUint<_Scalar>{}(std::forward<Rng>(rng)()));
381
408
  }
382
409
 
383
- template<typename Rng>
410
+ template<typename Rng,
411
+ typename std::enable_if<detail::RngBitSize<typename std::remove_const<typename std::remove_reference<Rng>::type>::type>::value < sizeof(Scalar) * 8, int>::type = 0
412
+ >
413
+ EIGEN_STRONG_INLINE const _Scalar operator() (Rng&& rng)
414
+ {
415
+ using RRng = typename std::remove_const<typename std::remove_reference<Rng>::type>::type;
416
+ static_assert(detail::RngBitSize<RRng>::value > 0,
417
+ "BaseRng must be a kind of mersenne_twister_engine.");
418
+ using ResultType = typename std::conditional<detail::RngBitSize<RRng>::value == 32, uint32_t, uint64_t>::type;
419
+ using namespace Eigen::internal;
420
+ ResultType arr[sizeof(Scalar) / sizeof(ResultType)];
421
+ for (size_t i = 0; i < sizeof(Scalar) / sizeof(ResultType); ++i)
422
+ {
423
+ arr[i] = rng();
424
+ }
425
+ return BitScalar<_Scalar>{}.to_ur(*(uint64_t*)arr);
426
+ }
427
+
428
+ template<typename Rng,
429
+ typename std::enable_if<sizeof(Scalar) <= sizeof(typename std::remove_const<typename std::remove_reference<Rng>::type>::type::result_type), int>::type = 0
430
+ >
384
431
  EIGEN_STRONG_INLINE const _Scalar nzur_scalar(Rng&& rng)
385
432
  {
386
433
  using namespace Eigen::internal;
387
434
  return BitScalar<_Scalar>{}.to_nzur(ExtractFirstUint<_Scalar>{}(std::forward<Rng>(rng)()));
388
435
  }
389
436
 
437
+ template<typename Rng,
438
+ typename std::enable_if<sizeof(typename std::remove_const<typename std::remove_reference<Rng>::type>::type::result_type) < sizeof(Scalar), int > ::type = 0
439
+ >
440
+ EIGEN_STRONG_INLINE const _Scalar nzur_scalar(Rng&& rng)
441
+ {
442
+ using namespace Eigen::internal;
443
+ using RngResult = typename std::remove_const<typename std::remove_reference<Rng>::type>::type::result_type;
444
+ RngResult arr[sizeof(Scalar) / sizeof(RngResult)];
445
+ for (size_t i = 0; i < sizeof(Scalar) / sizeof(RngResult); ++i)
446
+ {
447
+ arr[i] = rng();
448
+ }
449
+ return BitScalar<_Scalar>{}.to_nzur(*(Scalar*)arr);
450
+ }
451
+
390
452
  template<typename Packet, typename Rng>
391
453
  EIGEN_STRONG_INLINE const Packet packetOp(Rng&& rng)
392
454
  {
@@ -2,8 +2,8 @@
2
2
  * @file Discrete.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.3
6
- * @date 2021-03-31
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -264,7 +264,7 @@ namespace Eigen
264
264
  {
265
265
  EIGENRAND_CHECK_INFINITY_LOOP();
266
266
  _Scalar cands = (_Scalar)(rx & bitmask);
267
- if (cands <= pdiff) return cands;
267
+ if (cands <= pdiff) return cands + pmin;
268
268
  if (bitcnt + bitsize < 32)
269
269
  {
270
270
  rx >>= bitsize;
@@ -2,8 +2,8 @@
2
2
  * @file GammaPoisson.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.3
6
- * @date 2021-03-31
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file NormalExp.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.3
6
- * @date 2021-03-31
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file EigenRand
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.4.0
6
- * @date 2021-09-17
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file Macro.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.4.0
6
- * @date 2021-09-28
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -14,7 +14,7 @@
14
14
 
15
15
  #define EIGENRAND_WORLD_VERSION 0
16
16
  #define EIGENRAND_MAJOR_VERSION 4
17
- #define EIGENRAND_MINOR_VERSION 0
17
+ #define EIGENRAND_MINOR_VERSION 1
18
18
 
19
19
  #if EIGEN_VERSION_AT_LEAST(3,3,10)
20
20
  #define EIGENRAND_EIGEN_34_MODE
@@ -2,8 +2,8 @@
2
2
  * @file MorePacketMath.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.3
6
- * @date 2021-03-31
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file Multinomial.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.3
6
- * @date 2021-03-31
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file MvNormal.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.3
6
- * @date 2021-03-31
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file PacketFilter.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.3
6
- * @date 2021-03-31
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file PacketRandomEngine.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.3
6
- * @date 2021-03-31
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -25,11 +25,17 @@ namespace Eigen
25
25
  namespace detail
26
26
  {
27
27
  template<typename T>
28
- auto test_integral_result_type(int)->std::integral_constant<bool, std::is_integral<typename T::result_type>::value>;
28
+ auto test_integral_result_type(int)->std::integral_constant<bool, std::is_integral<typename T::result_type>::value && !(T::min() == 0 && (T::max() & T::max() + 1) == 0)>;
29
29
 
30
30
  template<typename T>
31
31
  auto test_integral_result_type(...)->std::false_type;
32
32
 
33
+ template<typename T>
34
+ auto test_integral_fullbit_result_type(int)->std::integral_constant<bool, std::is_integral<typename T::result_type>::value&& T::min() == 0 && (T::max() & T::max() + 1) == 0>;
35
+
36
+ template<typename T>
37
+ auto test_integral_fullbit_result_type(...)->std::false_type;
38
+
33
39
  template<typename T>
34
40
  auto test_intpacket_result_type(int)->std::integral_constant<bool, internal::IsIntPacket<typename T::result_type>::value>;
35
41
 
@@ -42,6 +48,11 @@ namespace Eigen
42
48
  {
43
49
  };
44
50
 
51
+ template<typename Ty>
52
+ struct IsScalarFullBitRandomEngine : decltype(detail::test_integral_fullbit_result_type<Ty>(0))
53
+ {
54
+ };
55
+
45
56
  template<typename Ty>
46
57
  struct IsPacketRandomEngine : decltype(detail::test_intpacket_result_type<Ty>(0))
47
58
  {
@@ -49,14 +60,15 @@ namespace Eigen
49
60
 
50
61
  enum class RandomEngineType
51
62
  {
52
- none, scalar, packet
63
+ none, scalar, scalar_fullbit, packet
53
64
  };
54
65
 
55
66
  template<typename Ty>
56
67
  struct GetRandomEngineType : std::integral_constant <
57
68
  RandomEngineType,
58
69
  IsPacketRandomEngine<Ty>::value ? RandomEngineType::packet :
59
- (IsScalarRandomEngine<Ty>::value ? RandomEngineType::scalar : RandomEngineType::none)
70
+ IsScalarFullBitRandomEngine<Ty>::value ? RandomEngineType::scalar_fullbit :
71
+ IsScalarRandomEngine<Ty>::value ? RandomEngineType::scalar : RandomEngineType::none
60
72
  >
61
73
  {
62
74
  };
@@ -257,7 +269,7 @@ namespace Eigen
257
269
  *
258
270
  * @return uint64_t
259
271
  */
260
- uint64_t min() const
272
+ static constexpr uint64_t min()
261
273
  {
262
274
  return 0;
263
275
  }
@@ -267,7 +279,7 @@ namespace Eigen
267
279
  *
268
280
  * @return uint64_t
269
281
  */
270
- uint64_t max() const
282
+ static constexpr uint64_t max()
271
283
  {
272
284
  return _wMask;
273
285
  }
@@ -418,6 +430,7 @@ namespace Eigen
418
430
  class ParallelRandomEngineAdaptor
419
431
  {
420
432
  static_assert(GetRandomEngineType<BaseRng>::value != RandomEngineType::none, "BaseRng must be a kind of Random Engine.");
433
+ static_assert(GetRandomEngineType<BaseRng>::value != RandomEngineType::scalar, "BaseRng must be a kind of mersenne_twister_engine.");
421
434
  public:
422
435
  using result_type = UIntType;
423
436
 
@@ -547,7 +560,7 @@ namespace Eigen
547
560
  IsPacketRandomEngine<typename std::remove_reference<Rng>::type>::value,
548
561
  PacketRandomEngineAdaptor<UIntType, typename std::remove_reference<Rng>::type>,
549
562
  typename std::conditional<
550
- IsScalarRandomEngine<typename std::remove_reference<Rng>::type>::value,
563
+ IsScalarFullBitRandomEngine<typename std::remove_reference<Rng>::type>::value,
551
564
  RandomEngineWrapper<typename std::remove_reference<Rng>::type>,
552
565
  void
553
566
  >::type
@@ -564,6 +577,8 @@ namespace Eigen
564
577
  template<typename UIntType, typename Rng>
565
578
  UniversalRandomEngine<UIntType, Rng> makeUniversalRng(Rng&& rng)
566
579
  {
580
+ static_assert(IsPacketRandomEngine<typename std::remove_reference<Rng>::type>::value || IsScalarFullBitRandomEngine<typename std::remove_reference<Rng>::type>::value,
581
+ "`Rng` must be a kind of RandomPacketEngine like std::mersenne_twister_engine");
567
582
  return { std::forward<Rng>(rng) };
568
583
  }
569
584
 
@@ -2,8 +2,8 @@
2
2
  * @file RandUtils.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.3
6
- * @date 2021-03-31
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -55,7 +55,7 @@ namespace Eigen
55
55
  struct scalar_rng_adaptor
56
56
  {
57
57
  static_assert(
58
- Rand::IsScalarRandomEngine<
58
+ Rand::IsScalarFullBitRandomEngine<
59
59
  typename std::remove_reference<Rng>::type
60
60
  >::value ||
61
61
  Rand::IsPacketRandomEngine<
@@ -95,7 +95,7 @@ namespace Eigen
95
95
  struct scalar_rng_adaptor<Gen, _Scalar, Rng, true>
96
96
  {
97
97
  static_assert(
98
- Rand::IsScalarRandomEngine<
98
+ Rand::IsScalarFullBitRandomEngine<
99
99
  typename std::remove_reference<Rng>::type
100
100
  >::value ||
101
101
  Rand::IsPacketRandomEngine<
@@ -2,8 +2,8 @@
2
2
  * @file MorePacketMath.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.5
6
- * @date 2021-07-16
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file PacketFilter.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.4.0
6
- * @date 2021-09-17
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file RandUtils.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.4.0
6
- * @date 2021-09-17
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -57,7 +57,7 @@ namespace Eigen
57
57
  };
58
58
 
59
59
  template<typename Rng, typename RngResult>
60
- struct RawbitsMaker<Packet8i, Rng, RngResult, Rand::RandomEngineType::scalar>
60
+ struct RawbitsMaker<Packet8i, Rng, RngResult, Rand::RandomEngineType::scalar_fullbit>
61
61
  {
62
62
  EIGEN_STRONG_INLINE Packet8i rawbits(Rng& rng)
63
63
  {
@@ -2,8 +2,8 @@
2
2
  * @file MorePacketMath.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.4.0
6
- * @date 2021-04-26
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file PacketFilter.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.4.0
6
- * @date 2021-09-17
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file RandUtils.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.4.0
6
- * @date 2021-09-17
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -19,7 +19,7 @@ namespace Eigen
19
19
  namespace internal
20
20
  {
21
21
  template<typename Rng, typename RngResult>
22
- struct RawbitsMaker<Packet4i, Rng, RngResult, Rand::RandomEngineType::scalar>
22
+ struct RawbitsMaker<Packet4i, Rng, RngResult, Rand::RandomEngineType::scalar_fullbit>
23
23
  {
24
24
  EIGEN_STRONG_INLINE Packet4i rawbits(Rng& rng)
25
25
  {
@@ -2,8 +2,8 @@
2
2
  * @file MorePacketMath.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.3.5
6
- * @date 2021-07-16
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file PacketFilter.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.4.0
6
- * @date 2021-09-17
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -2,8 +2,8 @@
2
2
  * @file RandUtils.h
3
3
  * @author bab2min (bab2min@gmail.com)
4
4
  * @brief
5
- * @version 0.4.0
6
- * @date 2021-09-17
5
+ * @version 0.4.1
6
+ * @date 2022-08-13
7
7
  *
8
8
  * @copyright Copyright (c) 2020-2021
9
9
  *
@@ -19,7 +19,7 @@ namespace Eigen
19
19
  namespace internal
20
20
  {
21
21
  template<typename Rng, typename RngResult>
22
- struct RawbitsMaker<Packet4i, Rng, RngResult, Rand::RandomEngineType::scalar>
22
+ struct RawbitsMaker<Packet4i, Rng, RngResult, Rand::RandomEngineType::scalar_fullbit>
23
23
  {
24
24
  EIGEN_STRONG_INLINE Packet4i rawbits(Rng& rng)
25
25
  {
@@ -385,6 +385,10 @@ MIT License
385
385
 
386
386
  ## History
387
387
 
388
+ ### 0.4.1 (2022-08-13)
389
+ * Fixed a bug where double-type generation with std::mt19937 fails compilation.
390
+ * Fixed a bug where `UniformIntGen` in scalar mode generates numbers in the wrong range.
391
+
388
392
  ### 0.4.0 alpha (2021-09-28)
389
393
  * Now EigenRand supports ARM & ARM64 NEON architecture experimentally. Please report issues about ARM & ARM64 NEON.
390
394
  * Now EigenRand has compatibility to `Eigen 3.4.0`.
@@ -305,6 +305,13 @@ tomotopy의 Python3 예제 코드는 https://github.com/bab2min/tomotopy/blob/ma
305
305
 
306
306
  역사
307
307
  -------
308
+ * 0.12.4 (2023-01-22)
309
+ * New features
310
+ * macOS ARM64 아키텍처에 대한 지원을 추가했습니다.
311
+ * Bug fixes
312
+ * `tomotopy.Document.get_sub_topic_dist()`가 bad argument 예외를 발생시키는 문제를 해결했습니다.
313
+ * 예외 발생이 종종 크래시를 발생시키는 문제를 해결했습니다.
314
+
308
315
  * 0.12.3 (2022-07-19)
309
316
  * 기능 개선
310
317
  * 이제 `tomotopy.LDAModel.add_doc()`로 빈 문서를 삽입할 경우 예외를 발생시키는 대신 그냥 무시합니다. 새로 추가된 인자인 `ignore_empty_words`를 False로 설정할 경우 이전처럼 예외를 발생시킵니다.
@@ -309,6 +309,13 @@ meaning you can use it for any reasonable purpose and remain in complete ownersh
309
309
 
310
310
  History
311
311
  -------
312
+ * 0.12.4 (2023-01-22)
313
+ * New features
314
+ * Added support for macOS ARM64 architecture.
315
+ * Bug fixes
316
+ * Fixed an issue where `tomotopy.Document.get_sub_topic_dist()` raises a bad argument exception.
317
+ * Fixed an issue where exception raising sometimes causes crashes.
318
+
312
319
  * 0.12.3 (2022-07-19)
313
320
  * New features
314
321
  * Now, inserting an empty document using `tomotopy.LDAModel.add_doc()` just ignores it instead of raising an exception. If the newly added argument `ignore_empty_words` is set to False, an exception is raised as before.
@@ -514,3 +521,18 @@ Bundled Libraries and Their License
514
521
 
515
522
  * Mapbox Variant: `BSD License
516
523
  <licenses_bundled/MapboxVariant>`_
524
+
525
+ Citation
526
+ ---------
527
+ ::
528
+
529
+ @software{minchul_lee_2022_6868418,
530
+ author = {Minchul Lee},
531
+ title = {bab2min/tomotopy: 0.12.3},
532
+ month = jul,
533
+ year = 2022,
534
+ publisher = {Zenodo},
535
+ version = {v0.12.3},
536
+ doi = {10.5281/zenodo.6868418},
537
+ url = {https://doi.org/10.5281/zenodo.6868418}
538
+ }
@@ -93,7 +93,7 @@ namespace Eigen
93
93
  #endif
94
94
  #ifdef EIGEN_VECTORIZE_NEON
95
95
  #include <arm_neon.h>
96
-
96
+ #include "neon_gamma.h"
97
97
 
98
98
  namespace Eigen
99
99
  {
@@ -0,0 +1,51 @@
1
+ #pragma once
2
+
3
+ inline float32x4_t accurate_rcp(float32x4_t x)
4
+ {
5
+ float32x4_t r = vrecpeq_f32(x);
6
+ return vmulq_f32(vrecpsq_f32(x, r), r);
7
+ }
8
+
9
+ // approximation : lgamma(z) ~= (z+2.5)ln(z+3) - z - 3 + 0.5 ln (2pi) + 1/12/(z + 3) - ln (z(z+1)(z+2))
10
+ inline float32x4_t lgamma_ps(float32x4_t x)
11
+ {
12
+ float32x4_t x_3 = vaddq_f32(x, vmovq_n_f32(3));
13
+ float32x4_t ret = vmulq_f32(vaddq_f32(x_3, vmovq_n_f32(-0.5f)), Eigen::internal::plog(x_3));
14
+ ret = vsubq_f32(ret, x_3);
15
+ ret = vaddq_f32(ret, vmovq_n_f32(0.91893853f));
16
+ ret = vaddq_f32(ret, vdivq_f32(vmovq_n_f32(1 / 12.f), x_3));
17
+ ret = vsubq_f32(ret, Eigen::internal::plog(vmulq_f32(
18
+ vmulq_f32(vsubq_f32(x_3, vmovq_n_f32(1)), vsubq_f32(x_3, vmovq_n_f32(2))), x)));
19
+ return ret;
20
+ }
21
+
22
+ // approximation : lgamma(z + a) - lgamma(z) = (z + a + 1.5) * log(z + a + 2) - (z + 1.5) * log(z + 2) - a + (1. / (z + a + 2) - 1. / (z + 2)) / 12. - log(((z + a) * (z + a + 1)) / (z * (z + 1)))
23
+ inline float32x4_t lgamma_subt(float32x4_t z, float32x4_t a)
24
+ {
25
+ float32x4_t _1p5 = vmovq_n_f32(1.5);
26
+ float32x4_t _2 = vmovq_n_f32(2);
27
+ float32x4_t za = vaddq_f32(z, a);
28
+ float32x4_t ret = vmulq_f32(vaddq_f32(za, _1p5), Eigen::internal::plog(vaddq_f32(za, _2)));
29
+ ret = vsubq_f32(ret, vmulq_f32(vaddq_f32(z, _1p5), Eigen::internal::plog(vaddq_f32(z, _2))));
30
+ ret = vsubq_f32(ret, a);
31
+ float32x4_t _1 = vmovq_n_f32(1);
32
+ float32x4_t _1_12 = vmovq_n_f32(1 / 12.f);
33
+ ret = vaddq_f32(ret, vsubq_f32(vdivq_f32(_1_12, vaddq_f32(za, _2)), vdivq_f32(_1_12, vaddq_f32(z, _2))));
34
+ ret = vsubq_f32(ret, Eigen::internal::plog(vdivq_f32(vdivq_f32(vmulq_f32(za, vaddq_f32(za, _1)), z), vaddq_f32(z, _1))));
35
+ return ret;
36
+ }
37
+
38
+
39
+ // approximation : digamma(z) ~= ln(z+4) - 1/2/(z+4) - 1/12/(z+4)^2 - 1/z - 1/(z+1) - 1/(z+2) - 1/(z+3)
40
+ inline float32x4_t digamma_ps(float32x4_t x)
41
+ {
42
+ float32x4_t x_4 = vaddq_f32(x, vmovq_n_f32(4));
43
+ float32x4_t ret = Eigen::internal::plog(x_4);
44
+ ret = vsubq_f32(ret, vdivq_f32(vmovq_n_f32(1 / 2.f), x_4));
45
+ ret = vsubq_f32(ret, vdivq_f32(vdivq_f32(vmovq_n_f32(1 / 12.f), x_4), x_4));
46
+ ret = vsubq_f32(ret, accurate_rcp(vsubq_f32(x_4, vmovq_n_f32(1))));
47
+ ret = vsubq_f32(ret, accurate_rcp(vsubq_f32(x_4, vmovq_n_f32(2))));
48
+ ret = vsubq_f32(ret, accurate_rcp(vsubq_f32(x_4, vmovq_n_f32(3))));
49
+ ret = vsubq_f32(ret, accurate_rcp(vsubq_f32(x_4, vmovq_n_f32(4))));
50
+ return ret;
51
+ }
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.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-04 00:00:00.000000000 Z
11
+ date: 2023-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rice
@@ -518,6 +518,7 @@ files:
518
518
  - vendor/tomotopy/src/Utils/avx_mathfun.h
519
519
  - vendor/tomotopy/src/Utils/exception.h
520
520
  - vendor/tomotopy/src/Utils/math.h
521
+ - vendor/tomotopy/src/Utils/neon_gamma.h
521
522
  - vendor/tomotopy/src/Utils/rtnorm.hpp
522
523
  - vendor/tomotopy/src/Utils/sample.hpp
523
524
  - vendor/tomotopy/src/Utils/serializer.hpp
@@ -552,7 +553,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
552
553
  - !ruby/object:Gem::Version
553
554
  version: '0'
554
555
  requirements: []
555
- rubygems_version: 3.3.7
556
+ rubygems_version: 3.4.1
556
557
  signing_key:
557
558
  specification_version: 4
558
559
  summary: High performance topic modeling for Ruby