ckmeans 1.0.3 → 1.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ad7e8c24dd367d5e6a6dd66abc529ae92079cf99d1c781a7646c929547b0e62
4
- data.tar.gz: 2e338ca878eba2d250ca61fff2ea8bee44ec8387b37e12b31600edf9da2b7130
3
+ metadata.gz: 17dd59ae47e814d5cf0b45665856a52e33e1af22c90722955750004405633a4e
4
+ data.tar.gz: 4278bb18d8a987ac71fd7ea179055ab6d2c15292d772b7d9df1dd8c4adde011b
5
5
  SHA512:
6
- metadata.gz: 8c59e1e159cc9cada8afed9e016a5d8956cfe909bb7b7d82c8d155f388fdf1924a49072d37e52065fa643a539da3a192767eddb38da95b2c2524bcc7d0a39ebd
7
- data.tar.gz: f2b535377d441bc1f2ee309a5466c8231b425aa0dd9b0512aa36257defa12b3b645694ae953b2b5e3b6997c50bde796e8fa1c2f8f10d4055b1cc9cb6abcf1353
6
+ metadata.gz: 7e3d19cfbfbebb0b26bf1ffdd7c99998a898ccf123359994e339147735b819f3f16fc73c2ac202a3fbe3c4f1c13c747e7181d01d56770be5404ca6354533b23d
7
+ data.tar.gz: 2be82db12f8d9da2cafb03713440f3083d2ffd7fd7f6917ad8e98d1c864b1d97f99e9a0771afe6aaaff502fee86d81e9221b8d689a388817b060fc7ce1917a87
data/CHANGELOG.md CHANGED
@@ -1,9 +1,22 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [1.0.1] - 2025-04-24
3
+ ## [1.0.4] - 2025-05-01
4
4
 
5
- - https://github.com/vlebedeff/rb-ckmeans/pull/9
6
- - https://github.com/vlebedeff/rb-ckmeans/pull/8
5
+ - Simpler capacity size expression ([#14](https://github.com/vlebedeff/rb-ckmeans/pull/14))
6
+
7
+ ## [1.0.3] - 2025-05-01
8
+
9
+ - More frugal memory allocation ([#11](https://github.com/vlebedeff/rb-ckmeans/pull/11))
10
+ - Use `rb_iv_get` for brevity
11
+ - Various optimizations ([#10](https://github.com/vlebedeff/rb-ckmeans/pull/10))
12
+ - Extract `LDouble` type definition
13
+ - Remove `ruby-prof` gem
14
+ - Rename `nvalues` to `size`
15
+
16
+ ## [1.0.2] - 2025-04-24
17
+
18
+ - Polish & Housekeeping ([#9](https://github.com/vlebedeff/rb-ckmeans/pull/9))
19
+ - Fix int variable sign ([#8](https://github.com/vlebedeff/rb-ckmeans/pull/8))
7
20
 
8
21
  ## [1.0.0] - 2025-04-22
9
22
 
@@ -103,6 +103,7 @@ void Init_extensions(void) {
103
103
  }
104
104
 
105
105
  # define ARENA_MIN_CAPACITY 100
106
+ # define ALLOCATION_FACTOR 3
106
107
  # define PIx2 (M_PI * 2.0)
107
108
 
108
109
  VALUE rb_ckmeans_sorted_group_sizes(VALUE self)
@@ -112,13 +113,8 @@ VALUE rb_ckmeans_sorted_group_sizes(VALUE self)
112
113
  uint32_t kmax = NUM2UINT(rb_iv_get(self, "@kmax"));
113
114
  bool apply_deviation = RTEST(rb_iv_get(self, "@apply_bic_deviation"));
114
115
  VALUE rb_xsorted = rb_iv_get(self, "@xsorted");
115
-
116
- Arena *arena =
117
- arena_create(
118
- sizeof(LDouble) * xcount * (kmax + 4) +
119
- sizeof(uint32_t) * xcount * kmax * 5 +
120
- ARENA_MIN_CAPACITY
121
- );
116
+ size_t capacity = sizeof(LDouble) * (xcount + 1) * (kmax + 1) * ALLOCATION_FACTOR + ARENA_MIN_CAPACITY;
117
+ Arena *arena = arena_create(capacity);
122
118
 
123
119
  if (arena == NULL) rb_raise(rb_eNoMemError, "Arena Memory Allocation Failed");
124
120
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ckmeans
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ckmeans
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Lebedev