numo-libsvm 2.2.0 → 2.3.0

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: 1e4eb5d7c2a7e1bde6c1987e2f235d66954715d13c894b732f45686c944f632b
4
- data.tar.gz: 1a2839e141f0160328aaae9cbd7e2b85f4bf500f880dbbc94599c2568fb04e27
3
+ metadata.gz: b29c8702582263f5465fc49e1d3ba7b7efedaa895d3eb988a7167393b64d98e0
4
+ data.tar.gz: 90906818ef9c3b8120a98961da0a845acdfd4c079d5ed5266c1df7706fa39db1
5
5
  SHA512:
6
- metadata.gz: 7f115624dc61595a4bc6298c055e4a0a3bbecd12aad2645b8c2869fd62d036f0d874a6884ec351b589f4acb315ff09d58dc6e4a0df71cd992bc9cf8d96e07ab8
7
- data.tar.gz: cd04639c40579d3f1aa2ba88ddf62e1510cd7d1b7f224acd04866eaf075bede38063ecb84b018cc3f0bcd7831f6a5c26149f8221abbe31b6d50d4e06a24268ef
6
+ metadata.gz: e50f643d7b4b4ff55a61abeb2c297a8caebe60adb214f172da17bd569705edc71883aae780ecb5dbca3999571fffcd9cffb1057efcf23c697cb531c1cad17609
7
+ data.tar.gz: b1e45d76573c025deb93c7a29360320a1fe89172a79738a76f6f7561bd91e4443a49f4a108ab5e2cc99048b6e9132756c592915b92257ac6d7abff6f936ddb35
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 2.3.0
2
+ - Update bundled LIBSVM to 3.35.
3
+
1
4
  # 2.2.0
2
5
  - Update bundled LIBSVM to 3.31.
3
6
 
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019-2023 Atsushi Tatsuma
1
+ Copyright (c) 2019-2024 Atsushi Tatsuma
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2019-2023 Atsushi Tatsuma
2
+ * Copyright (c) 2019-2024 Atsushi Tatsuma
3
3
  * All rights reserved.
4
4
  *
5
5
  * Redistribution and use in source and binary forms, with or without
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2019-2023 Atsushi Tatsuma
2
+ * Copyright (c) 2019-2024 Atsushi Tatsuma
3
3
  * All rights reserved.
4
4
  *
5
5
  * Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,7 @@ static void info(const char *fmt,...)
54
54
  char buf[BUFSIZ];
55
55
  va_list ap;
56
56
  va_start(ap,fmt);
57
- vsprintf(buf,fmt,ap);
57
+ vsnprintf(buf,BUFSIZ,fmt,ap);
58
58
  va_end(ap);
59
59
  (*svm_print_string)(buf);
60
60
  }
@@ -71,7 +71,7 @@ static void info(const char *fmt,...) {}
71
71
  class Cache
72
72
  {
73
73
  public:
74
- Cache(int l,long int size);
74
+ Cache(int l,size_t size);
75
75
  ~Cache();
76
76
 
77
77
  // request data [0,len)
@@ -81,7 +81,7 @@ public:
81
81
  void swap_index(int i, int j);
82
82
  private:
83
83
  int l;
84
- long int size;
84
+ size_t size;
85
85
  struct head_t
86
86
  {
87
87
  head_t *prev, *next; // a circular list
@@ -95,12 +95,12 @@ private:
95
95
  void lru_insert(head_t *h);
96
96
  };
97
97
 
98
- Cache::Cache(int l_,long int size_):l(l_),size(size_)
98
+ Cache::Cache(int l_,size_t size_):l(l_),size(size_)
99
99
  {
100
100
  head = (head_t *)calloc(l,sizeof(head_t)); // initialized to 0
101
101
  size /= sizeof(Qfloat);
102
- size -= l * sizeof(head_t) / sizeof(Qfloat);
103
- size = max(size, 2 * (long int) l); // cache must be large enough for two columns
102
+ size_t header_size = l * sizeof(head_t) / sizeof(Qfloat);
103
+ size = max(size, 2 * (size_t) l + header_size) - header_size; // cache must be large enough for two columns
104
104
  lru_head.next = lru_head.prev = &lru_head;
105
105
  }
106
106
 
@@ -136,7 +136,7 @@ int Cache::get_data(const int index, Qfloat **data, int len)
136
136
  if(more > 0)
137
137
  {
138
138
  // free old space
139
- while(size < more)
139
+ while(size < (size_t)more)
140
140
  {
141
141
  head_t *old = lru_head.next;
142
142
  lru_delete(old);
@@ -148,7 +148,7 @@ int Cache::get_data(const int index, Qfloat **data, int len)
148
148
 
149
149
  // allocate new space
150
150
  h->data = (Qfloat *)realloc(h->data,sizeof(Qfloat)*len);
151
- size -= more;
151
+ size -= more; // previous while loop guarantees size >= more and subtraction of size_t variable will not underflow
152
152
  swap(h->len,len);
153
153
  }
154
154
 
@@ -1274,7 +1274,7 @@ public:
1274
1274
  :Kernel(prob.l, prob.x, param)
1275
1275
  {
1276
1276
  clone(y,y_,prob.l);
1277
- cache = new Cache(prob.l,(long int)(param.cache_size*(1<<20)));
1277
+ cache = new Cache(prob.l,(size_t)(param.cache_size*(1<<20)));
1278
1278
  QD = new double[prob.l];
1279
1279
  for(int i=0;i<prob.l;i++)
1280
1280
  QD[i] = (this->*kernel_function)(i,i);
@@ -1326,7 +1326,7 @@ public:
1326
1326
  ONE_CLASS_Q(const svm_problem& prob, const svm_parameter& param)
1327
1327
  :Kernel(prob.l, prob.x, param)
1328
1328
  {
1329
- cache = new Cache(prob.l,(long int)(param.cache_size*(1<<20)));
1329
+ cache = new Cache(prob.l,(size_t)(param.cache_size*(1<<20)));
1330
1330
  QD = new double[prob.l];
1331
1331
  for(int i=0;i<prob.l;i++)
1332
1332
  QD[i] = (this->*kernel_function)(i,i);
@@ -1373,7 +1373,7 @@ public:
1373
1373
  :Kernel(prob.l, prob.x, param)
1374
1374
  {
1375
1375
  l = prob.l;
1376
- cache = new Cache(l,(long int)(param.cache_size*(1<<20)));
1376
+ cache = new Cache(l,(size_t)(param.cache_size*(1<<20)));
1377
1377
  QD = new double[2*l];
1378
1378
  sign = new schar[2*l];
1379
1379
  index = new int[2*l];
@@ -1,7 +1,7 @@
1
1
  #ifndef _LIBSVM_H
2
2
  #define _LIBSVM_H
3
3
 
4
- #define LIBSVM_VERSION 331
4
+ #define LIBSVM_VERSION 335
5
5
 
6
6
  #ifdef __cplusplus
7
7
  extern "C" {
@@ -3,6 +3,6 @@
3
3
  module Numo
4
4
  module Libsvm
5
5
  # The version of Numo::Libsvm you are using.
6
- VERSION = '2.2.0'
6
+ VERSION = '2.3.0'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numo-libsvm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-03-05 00:00:00.000000000 Z
10
+ date: 2024-12-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: numo-narray
@@ -56,7 +55,6 @@ metadata:
56
55
  source_code_uri: https://github.com/yoshoku/numo-libsvm
57
56
  documentation_uri: https://yoshoku.github.io/numo-libsvm/doc/
58
57
  rubygems_mfa_required: 'true'
59
- post_install_message:
60
58
  rdoc_options: []
61
59
  require_paths:
62
60
  - lib
@@ -71,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
69
  - !ruby/object:Gem::Version
72
70
  version: '0'
73
71
  requirements: []
74
- rubygems_version: 3.3.26
75
- signing_key:
72
+ rubygems_version: 3.6.2
76
73
  specification_version: 4
77
74
  summary: Numo::Libsvm is a Ruby gem binding to the LIBSVM library. Numo::Libsvm makes
78
75
  to use the LIBSVM functions with dataset represented by Numo::NArray.