narray 0.5.9.6 → 0.5.9.7
Sign up to get free protection for your applications and to get access to all the features.
- data/src/ChangeLog +13 -0
- data/src/lib/narray_ext.rb +6 -6
- data/src/na_index.c +2 -0
- metadata +2 -2
data/src/ChangeLog
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
2009-05-20 Masahiro TANAKA <masa16.tanaka at gmail.com>
|
2
|
+
|
3
|
+
* lib/narray_ext.rb (mean, stddev,rms,rsmdev,covariance):
|
4
|
+
- swith to DFLOAT type if integer array.
|
5
|
+
- thanks to Philip Silva for report.
|
6
|
+
* ver 0.5.9p7
|
7
|
+
|
8
|
+
2009-03-11 Masahiro TANAKA <masa16.tanaka at gmail.com>
|
9
|
+
|
10
|
+
* na_index.c (na_aset_single_dim):
|
11
|
+
- add check of storing empty array.
|
12
|
+
- thanks to NISHI Takao for report.
|
13
|
+
|
1
14
|
2008-11-05 Masahiro TANAKA <masa16.tanaka at gmail.com>
|
2
15
|
|
3
16
|
* work with ruby 1.9.1 preview1
|
data/src/lib/narray_ext.rb
CHANGED
@@ -55,7 +55,7 @@ class NArray
|
|
55
55
|
# Statistics
|
56
56
|
def mean(*ranks)
|
57
57
|
if integer?
|
58
|
-
a = self.
|
58
|
+
a = self.to_type(NArray::DFLOAT)
|
59
59
|
else
|
60
60
|
a = self
|
61
61
|
end
|
@@ -65,7 +65,7 @@ class NArray
|
|
65
65
|
|
66
66
|
def stddev(*ranks)
|
67
67
|
if integer?
|
68
|
-
a = self.
|
68
|
+
a = self.to_type(NArray::DFLOAT)
|
69
69
|
else
|
70
70
|
a = self
|
71
71
|
end
|
@@ -80,7 +80,7 @@ class NArray
|
|
80
80
|
|
81
81
|
def rms(*ranks)
|
82
82
|
if integer?
|
83
|
-
a = self.
|
83
|
+
a = self.to_type(NArray::DFLOAT)
|
84
84
|
else
|
85
85
|
a = self
|
86
86
|
end
|
@@ -95,7 +95,7 @@ class NArray
|
|
95
95
|
|
96
96
|
def rmsdev(*ranks)
|
97
97
|
if integer?
|
98
|
-
a = self.
|
98
|
+
a = self.to_type(NArray::DFLOAT)
|
99
99
|
else
|
100
100
|
a = self
|
101
101
|
end
|
@@ -217,9 +217,9 @@ module NMath
|
|
217
217
|
# Statistics
|
218
218
|
def covariance(x,y,*ranks)
|
219
219
|
x = NArray.to_na(x) unless x.kind_of?(NArray)
|
220
|
-
x = x.
|
220
|
+
x = x.to_type(NArray::DFLOAT) if x.integer?
|
221
221
|
y = NArray.to_na(y) unless y.kind_of?(NArray)
|
222
|
-
y = y.
|
222
|
+
y = y.to_type(NArray::DFLOAT) if y.integer?
|
223
223
|
n = x.rank_total(*ranks)
|
224
224
|
xm = x.accum(*ranks).div!(n)
|
225
225
|
ym = y.accum(*ranks).div!(n)
|
data/src/na_index.c
CHANGED
@@ -720,6 +720,8 @@ void
|
|
720
720
|
/* rank check */
|
721
721
|
if (rank < src->rank)
|
722
722
|
rb_raise(rb_eIndexError, "%i dst.ranks < %i src.ranks", rank, src->rank);
|
723
|
+
if (src->rank == 0)
|
724
|
+
rb_raise(rb_eIndexError, "cannot store empty array");
|
723
725
|
|
724
726
|
/* extend rank */
|
725
727
|
src_shape = ALLOCA_N(int, rank);
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: narray
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.5.9.
|
7
|
-
date:
|
6
|
+
version: 0.5.9.7
|
7
|
+
date: 2009-06-14 00:00:00 +09:00
|
8
8
|
summary: N-dimensional Numerical Array class for Ruby
|
9
9
|
require_paths:
|
10
10
|
- .
|