spatial_stats 1.0.4 → 2.0.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d7d2e6e57d8059f55f1bb9128f670ae02da382005a80111410a4c72c69ce04b
|
4
|
+
data.tar.gz: df3018cdf87fd2d5d19cb788855252497466bfd383cb13a078c8f91693a4b2c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e95cf8d912d4f6a606871f8f78484157f2aa234ce500f343ec0a7a722b6b470c6e89f733d6e103d27f2d9bd133882aa22af88a0ff67fc62b1358c6df38b7dab5
|
7
|
+
data.tar.gz: 53738b1d1cdc77a840eea583baaa26a77f3b50ab8b540822f3da20b8c88801de2666a22944d244b2bd896b3edae0b2d49ea068c1f6507ba38c4170cefa2a42cb
|
@@ -22,9 +22,17 @@ size_t csr_matrix_memsize(const void *ptr)
|
|
22
22
|
return sizeof(*csr);
|
23
23
|
}
|
24
24
|
|
25
|
+
const rb_data_type_t csr_matrix_type = {
|
26
|
+
"SpatialStats::Weights::CSRMatrix",
|
27
|
+
{NULL, csr_matrix_free, csr_matrix_memsize},
|
28
|
+
0,
|
29
|
+
0,
|
30
|
+
RUBY_TYPED_FREE_IMMEDIATELY
|
31
|
+
};
|
32
|
+
|
25
33
|
VALUE csr_matrix_alloc(VALUE self)
|
26
34
|
{
|
27
|
-
csr_matrix *csr =
|
35
|
+
csr_matrix *csr = ALLOC(csr_matrix);
|
28
36
|
return TypedData_Wrap_Struct(self, &csr_matrix_type, csr);
|
29
37
|
}
|
30
38
|
|
@@ -64,7 +72,7 @@ void mat_to_sparse(csr_matrix *csr, VALUE data, VALUE keys, VALUE num_rows)
|
|
64
72
|
// if it is, add array len to nnz
|
65
73
|
row = rb_hash_aref(data, key);
|
66
74
|
Check_Type(row, T_ARRAY);
|
67
|
-
nnz +=
|
75
|
+
nnz += (int)RARRAY_LEN(row); // Explicit cast to int
|
68
76
|
}
|
69
77
|
|
70
78
|
values = malloc(sizeof(double) * nnz);
|
@@ -82,7 +90,7 @@ void mat_to_sparse(csr_matrix *csr, VALUE data, VALUE keys, VALUE num_rows)
|
|
82
90
|
|
83
91
|
key = rb_ary_entry(keys, i);
|
84
92
|
row = rb_hash_aref(data, key);
|
85
|
-
m =
|
93
|
+
m = (int)RARRAY_LEN(row); // Explicit cast to int
|
86
94
|
|
87
95
|
for (j = 0; j < m; j++)
|
88
96
|
{
|
@@ -140,7 +148,7 @@ VALUE csr_matrix_initialize(VALUE self, VALUE data, VALUE num_rows)
|
|
140
148
|
keys = rb_funcall(data, rb_intern("keys"), 0);
|
141
149
|
|
142
150
|
// check dimensions are correct
|
143
|
-
if (NUM2INT(num_rows) !=
|
151
|
+
if (NUM2INT(num_rows) != (int)RARRAY_LEN(keys)) // Explicit cast to int
|
144
152
|
{
|
145
153
|
rb_raise(rb_eArgError, "n_rows != keys.size, check your dimensions");
|
146
154
|
}
|
@@ -249,7 +257,7 @@ VALUE csr_matrix_mulvec(VALUE self, VALUE vec)
|
|
249
257
|
|
250
258
|
TypedData_Get_Struct(self, csr_matrix, &csr_matrix_type, csr);
|
251
259
|
|
252
|
-
if (
|
260
|
+
if (RARRAY_LEN(vec) != csr->n)
|
253
261
|
{
|
254
262
|
rb_raise(rb_eArgError, "Dimension Mismatch CSRMatrix.n != vec.size");
|
255
263
|
}
|
@@ -294,7 +302,7 @@ VALUE csr_matrix_dot_row(VALUE self, VALUE vec, VALUE row)
|
|
294
302
|
|
295
303
|
TypedData_Get_Struct(self, csr_matrix, &csr_matrix_type, csr);
|
296
304
|
|
297
|
-
if (
|
305
|
+
if (RARRAY_LEN(vec) != csr->n)
|
298
306
|
{
|
299
307
|
rb_raise(rb_eArgError, "Dimension Mismatch CSRMatrix.n != vec.size");
|
300
308
|
}
|
@@ -14,13 +14,7 @@ typedef struct csr_matrix
|
|
14
14
|
void csr_matrix_free(void *mat);
|
15
15
|
size_t csr_matrix_memsize(const void *ptr);
|
16
16
|
|
17
|
-
|
18
|
-
static const rb_data_type_t csr_matrix_type = {
|
19
|
-
"SpatialStats::Weights::CSRMatrix",
|
20
|
-
{NULL, csr_matrix_free, csr_matrix_memsize},
|
21
|
-
0,
|
22
|
-
0,
|
23
|
-
RUBY_TYPED_FREE_IMMEDIATELY};
|
17
|
+
extern const rb_data_type_t csr_matrix_type;
|
24
18
|
|
25
19
|
void mat_to_sparse(csr_matrix *csr, VALUE data, VALUE keys, VALUE num_rows);
|
26
20
|
VALUE csr_matrix_alloc(VALUE self);
|
@@ -15,7 +15,7 @@ void Init_spatial_stats()
|
|
15
15
|
{
|
16
16
|
VALUE spatial_stats_mod = rb_define_module("SpatialStats");
|
17
17
|
VALUE weights_mod = rb_define_module_under(spatial_stats_mod, "Weights");
|
18
|
-
VALUE csr_matrix_class = rb_define_class_under(weights_mod, "CSRMatrix",
|
18
|
+
VALUE csr_matrix_class = rb_define_class_under(weights_mod, "CSRMatrix", rb_cObject);
|
19
19
|
|
20
20
|
rb_define_alloc_func(csr_matrix_class, csr_matrix_alloc);
|
21
21
|
rb_define_method(csr_matrix_class, "initialize", csr_matrix_initialize, 2);
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spatial_stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Doggett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-narray
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
name: activerecord-postgis-adapter
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 6.0.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 6.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.0.2
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.0.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pg
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,14 +182,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
182
182
|
requirements:
|
183
183
|
- - ">="
|
184
184
|
- !ruby/object:Gem::Version
|
185
|
-
version:
|
185
|
+
version: 3.1.0
|
186
186
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
187
|
requirements:
|
188
188
|
- - ">="
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
|
-
rubygems_version: 3.
|
192
|
+
rubygems_version: 3.5.3
|
193
193
|
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: An ActiveRecord/PostGIS extension that provides statistical methods to spatial
|