numo-libsvm 1.0.1 → 1.0.2

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: '049939ac19f6b660182096f07e08e5191e76f09a91ea639e9d04b79fa85f2f2f'
4
- data.tar.gz: ee2e9ceaff7c17604505590df3266817a4df7ba0e334e99ce04b909abaf379c3
3
+ metadata.gz: d72a8a48f52a71000c0ff4b1202684a8929a8e34b3004f5f142cccbd9af1e034
4
+ data.tar.gz: 7c8f38da980376b9ca84191235e10cf98bd9ff44ab546ee3b52d105b57cb4ec7
5
5
  SHA512:
6
- metadata.gz: 7fca5bc012281d8350260e01037001741dfd23439560a53765c1594f1202edac47e5b3eefa9c0e50659e96d83d1959473f6cd4892c36ac218d96ed69ec8833e3
7
- data.tar.gz: 4d4681a436044f0cf011a55c051081a45a8789a6b188be359f1569f0a846344dfbd4a24f164282a87172d119185b1d3b878d1274c494265e79220215ffb0399c
6
+ metadata.gz: 795830bf885ba8164bb95619eb713cd3b893c61c0c3b1f43de66afb7d3632383054e1ca6870d48ca8a69f0b1fc2007e42b5e37ab67ef14848dd7a471c4d195d2
7
+ data.tar.gz: 41388d1b428d3e4e7a181149cc53a7b1654af3b61961dce67948b86ef54fb96eb24e626d1ffe2645fc59886e37d44ec3ba20333c2e17cab5446513d65f205e8c
@@ -1,3 +1,7 @@
1
+ # 1.0.2
2
+ - Add GC guard to model saving and loading methods.
3
+ - Fix size specification to memcpy function.
4
+
1
5
  # 1.0.1
2
6
  - Add GC guard codes.
3
7
  - Fix some configuration files.
@@ -505,6 +505,8 @@ VALUE load_svm_model(VALUE self, VALUE filename)
505
505
  rb_ary_store(res, 0, param_hash);
506
506
  rb_ary_store(res, 1, model_hash);
507
507
 
508
+ RB_GC_GUARD(filename);
509
+
508
510
  return res;
509
511
  }
510
512
 
@@ -539,6 +541,8 @@ VALUE save_svm_model(VALUE self, VALUE filename, VALUE param_hash, VALUE model_h
539
541
  return Qfalse;
540
542
  }
541
543
 
544
+ RB_GC_GUARD(filename);
545
+
542
546
  return Qtrue;
543
547
  }
544
548
 
@@ -35,13 +35,13 @@ struct svm_parameter* rb_hash_to_svm_parameter(VALUE param_hash)
35
35
  param->weight_label = NULL;
36
36
  if (!NIL_P(el)) {
37
37
  param->weight_label = ALLOC_N(int, param->nr_weight);
38
- memcpy(param->weight_label, (int32_t*)na_get_pointer_for_read(el), param->nr_weight);
38
+ memcpy(param->weight_label, (int32_t*)na_get_pointer_for_read(el), param->nr_weight * sizeof(int32_t));
39
39
  }
40
40
  el = rb_hash_aref(param_hash, ID2SYM(rb_intern("weight")));
41
41
  param->weight = NULL;
42
42
  if (!NIL_P(el)) {
43
43
  param->weight = ALLOC_N(double, param->nr_weight);
44
- memcpy(param->weight, (double*)na_get_pointer_for_read(el), param->nr_weight);
44
+ memcpy(param->weight, (double*)na_get_pointer_for_read(el), param->nr_weight * sizeof(double));
45
45
  }
46
46
  return param;
47
47
  }
@@ -3,6 +3,6 @@
3
3
  module Numo
4
4
  module Libsvm
5
5
  # The version of Numo::Libsvm you are using.
6
- VERSION = '1.0.1'
6
+ VERSION = '1.0.2'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numo-libsvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-16 00:00:00.000000000 Z
11
+ date: 2021-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: numo-narray
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
- rubygems_version: 3.1.4
147
+ rubygems_version: 3.2.3
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Numo::Libsvm is a Ruby gem binding to the LIBSVM library. Numo::Libsvm makes