numo-libsvm 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/LICENSE.txt +1 -1
- data/ext/numo/libsvm/libsvmext.cpp +1 -1
- data/ext/numo/libsvm/libsvmext.hpp +1 -1
- data/ext/numo/libsvm/src/svm.cpp +11 -11
- data/ext/numo/libsvm/src/svm.h +1 -1
- data/lib/numo/libsvm/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b29c8702582263f5465fc49e1d3ba7b7efedaa895d3eb988a7167393b64d98e0
|
4
|
+
data.tar.gz: 90906818ef9c3b8120a98961da0a845acdfd4c079d5ed5266c1df7706fa39db1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e50f643d7b4b4ff55a61abeb2c297a8caebe60adb214f172da17bd569705edc71883aae780ecb5dbca3999571fffcd9cffb1057efcf23c697cb531c1cad17609
|
7
|
+
data.tar.gz: b1e45d76573c025deb93c7a29360320a1fe89172a79738a76f6f7561bd91e4443a49f4a108ab5e2cc99048b6e9132756c592915b92257ac6d7abff6f936ddb35
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/ext/numo/libsvm/src/svm.cpp
CHANGED
@@ -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
|
-
|
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,
|
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
|
-
|
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_,
|
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
|
-
|
103
|
-
size = max(size, 2 * (
|
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,(
|
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,(
|
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,(
|
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];
|
data/ext/numo/libsvm/src/svm.h
CHANGED
data/lib/numo/libsvm/version.rb
CHANGED
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.
|
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:
|
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.
|
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.
|