narray 0.6.0.4 → 0.6.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,11 @@
1
+ 2013-01-30 Masahiro TANAKA <masa16.tanaka@gmail.com>
2
+
3
+ * narray.c (na_check_class_narray):
4
+ use Module#<= instead of rb_mod_ancestors
5
+ * na_random.c, na_linalg.c:
6
+ avoid warnings of signed <=> unsigned comparison
7
+ * ver 0.6.0.5
8
+
1
9
  2012-12-07 geoffyoungs
2
10
 
3
11
  * narray.c (na_check_class_narray):
@@ -575,7 +575,7 @@ void Init_na_linalg()
575
575
 
576
576
  for (i=1;i<NA_NTYPES;++i) {
577
577
  sz = na_funcset[i].elmsz = na_sizeof[i];
578
- sz = (sz>sizeof(int)) ? sz : sizeof(int);
578
+ sz = (sz>((int)sizeof(int))) ? sz : (int)sizeof(int);
579
579
  SetFuncs[i][NA_LINT](1, a,0, &one, 0);
580
580
  na_funcset[i].one = a;
581
581
  a += sz;
@@ -217,19 +217,22 @@ static int n_bits(int32_t a)
217
217
  return xl;
218
218
  }
219
219
 
220
- static int32_t size_check(double rmax, double limit)
220
+ // max&limit must be integer
221
+ static u_int32_t size_check(double rmax, double limit)
221
222
  {
223
+ u_int32_t max;
224
+
222
225
  if ( rmax == 0 ) {
223
- return (int32_t)(limit-1);
226
+ return (u_int32_t)(limit-1);
224
227
  }
225
228
  if ( rmax < 0 ) {
226
229
  rmax = -rmax;
227
230
  }
228
- rmax -= 1;
229
- if ( rmax >= limit ) {
230
- rb_raise(rb_eArgError, "rand-max(%.0f) must be <= %.0f", rmax+1, limit);
231
+ max = (u_int32_t)(rmax - 1);
232
+ if ( max >= limit ) {
233
+ rb_raise(rb_eArgError, "rand-max(%.0f) must be <= %.0f", rmax, limit);
231
234
  }
232
- return (int32_t)rmax;
235
+ return max;
233
236
  }
234
237
 
235
238
  static void TpErr(void) {
@@ -268,7 +271,7 @@ static void RndB(int n, char *p1, int i1, double rmax)
268
271
  static void RndI(int n, char *p1, int i1, double rmax)
269
272
  {
270
273
  u_int32_t y;
271
- int16_t max;
274
+ u_int16_t max;
272
275
  int shift, sign=1;
273
276
 
274
277
  if ( rmax < 0 ) { rmax = -rmax; sign = -1; }
@@ -295,7 +298,7 @@ static void RndI(int n, char *p1, int i1, double rmax)
295
298
  static void RndL(int n, char *p1, int i1, double rmax)
296
299
  {
297
300
  u_int32_t y;
298
- int32_t max;
301
+ u_int32_t max;
299
302
  int shift, sign=1;
300
303
 
301
304
  if ( rmax < 0 ) { rmax = -rmax; sign = -1; }
@@ -182,7 +182,9 @@ static void
182
182
  rb_raise(rb_eRuntimeError, "class required");
183
183
  }
184
184
 
185
- if(RTEST(rb_ary_includes(rb_mod_ancestors(v), cNArray)))
185
+ if (v == cNArray)
186
+ return;
187
+ if (RTEST(rb_funcall(v, rb_intern("<="), 1, cNArray)))
186
188
  return;
187
189
 
188
190
  rb_raise(rb_eRuntimeError, "need NArray or its subclass");
@@ -741,10 +743,6 @@ static VALUE
741
743
  static VALUE
742
744
  na_s_to_na(int argc, VALUE *argv, VALUE klass)
743
745
  {
744
- static int shape=1;
745
- VALUE v;
746
- struct NARRAY *ary;
747
-
748
746
  if (argc < 1) {
749
747
  rb_raise(rb_eArgError, "Argument is required");
750
748
  }
@@ -795,8 +793,8 @@ static VALUE
795
793
  int i;
796
794
  char buf[256];
797
795
  const char *classname;
798
- char *ref = "%s(ref).%s(%i";
799
- char *org = "%s.%s(%i";
796
+ const char *ref = "%s(ref).%s(%i";
797
+ const char *org = "%s.%s(%i";
800
798
 
801
799
  GetNArray(self,ary);
802
800
  classname = rb_class2name(CLASS_OF(self));
@@ -23,8 +23,8 @@
23
23
  # include <sys/types.h>
24
24
  #endif
25
25
 
26
- #define NARRAY_VERSION "0.6.0.4"
27
- #define NARRAY_VERSION_CODE 604
26
+ #define NARRAY_VERSION "0.6.0.5"
27
+ #define NARRAY_VERSION_CODE 605
28
28
 
29
29
  /*
30
30
  Data types used in NArray :
metadata CHANGED
@@ -1,27 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: narray
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0.5
4
5
  prerelease:
5
- version: 0.6.0.4
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Masahiro Tanaka
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-12-29 00:00:00 Z
12
+ date: 2013-01-30 00:00:00.000000000 Z
14
13
  dependencies: []
15
-
16
14
  description: Numerical N-dimensional Array class
17
15
  email: masa16.tanaka@gmail.com
18
16
  executables: []
19
-
20
- extensions:
17
+ extensions:
21
18
  - src/extconf.rb
22
19
  extra_rdoc_files: []
23
-
24
- files:
20
+ files:
25
21
  - src/ChangeLog
26
22
  - src/MANIFEST
27
23
  - src/README.en
@@ -45,31 +41,28 @@ files:
45
41
  - src/lib/narray_ext.rb
46
42
  - src/lib/nmatrix.rb
47
43
  homepage: http://narray.rubyforge.org/
48
- licenses:
44
+ licenses:
49
45
  - Ruby
50
46
  post_install_message:
51
47
  rdoc_options: []
52
-
53
- require_paths:
48
+ require_paths:
54
49
  - .
55
- required_ruby_version: !ruby/object:Gem::Requirement
50
+ required_ruby_version: !ruby/object:Gem::Requirement
56
51
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: "0"
61
- required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
57
  none: false
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: "0"
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
67
62
  requirements: []
68
-
69
63
  rubyforge_project: narray
70
64
  rubygems_version: 1.8.23
71
65
  signing_key:
72
66
  specification_version: 2
73
67
  summary: N-dimensional Numerical Array class for Ruby
74
68
  test_files: []
75
-