narray 0.6.0.7 → 0.6.0.8

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 56a5e5c60ab2450492b8e19b78387d62e090fdbc
4
+ data.tar.gz: ff0771dbbde2a98e9e92db8f0b821ffc25658e3c
5
+ SHA512:
6
+ metadata.gz: 8993262cf562f08738f314e567f3d596c7661c64d4722260db5e0fb809f9fb4e5ce9f1b07ee16bc424d474f5e1b1abd8a51a22949f25b025c45b35998a417a38
7
+ data.tar.gz: 30166a5c16acd63324282142da10fd6ed2dc8e182fad3fb280b731e0e234e0eb5a787df43b2d8b9d680a51281964747d5a8f4a1f0bba9b44deeca87c85f89eda
@@ -1,3 +1,19 @@
1
+ 2013-02-27 Masahiro TANAKA <masa16.tanaka@gmail.com>
2
+
3
+ * Rakefile: use rubygems/package_task.
4
+ * narray.gemspec: add --exclude in rdoc_options.
5
+ * ver 0.6.0.8
6
+
7
+ 2013-02-26 Masahiro TANAKA <masa16.tanaka@gmail.com>
8
+
9
+ * test/ld.rb: add require "rubygems".
10
+ * narray.gemspec: change gem directory from src to ext.
11
+ * narray.c: avoid warnings in require "complex" and rdoc parsing.
12
+
13
+ 2013-02-13 Masahiro TANAKA <masa16.tanaka@gmail.com>
14
+
15
+ * lib/narray_ext.rb: new method: NArray.cast
16
+
1
17
  2013-02-01 Masahiro TANAKA <masa16.tanaka@gmail.com>
2
18
 
3
19
  * lib/narray_ext.rb: eql? hash methods implemented.
File without changes
File without changes
File without changes
File without changes
File without changes
data/src/depend CHANGED
@@ -11,4 +11,4 @@ na_math.o: na_math.c narray.h $(hdrdir)/ruby.h
11
11
 
12
12
 
13
13
  cleanall: clean
14
- @$(RM) -r na_op.c na_math.c src pkg
14
+ @$(RM) -r Makefile narray_config.h na_op.c na_math.c src pkg
@@ -8,6 +8,21 @@
8
8
  #
9
9
  class NArray
10
10
 
11
+ def self.cast(array,type=nil)
12
+ case array
13
+ when NArray
14
+ when Array
15
+ array = NArray.to_na(array)
16
+ else
17
+ raise ArgumentError, "1st argument must be NArray or Array"
18
+ end
19
+ type = array.typecode if type.nil?
20
+ shape = array.shape
21
+ na = self.new(type,*shape)
22
+ na[] = array
23
+ na
24
+ end
25
+
11
26
  def integer?
12
27
  self.typecode==NArray::BYTE ||
13
28
  self.typecode==NArray::SINT ||
@@ -751,6 +751,10 @@ for i in data
751
751
  name=bsname
752
752
  print <<EOM
753
753
 
754
+ /*
755
+ * call-seq:
756
+ * NMath.#{name}(arg) -> narray
757
+ */
754
758
  static VALUE na_math_#{bsname}(VALUE obj, VALUE x)
755
759
  { return na_math_func(x,#{name}Funcs); }
756
760
  EOM
@@ -493,6 +493,7 @@ VALUE
493
493
  }
494
494
 
495
495
 
496
+ /* :nodoc: */
496
497
  VALUE
497
498
  na_to_narray(VALUE obj)
498
499
  {
@@ -642,3 +643,8 @@ VALUE
642
643
  rb_str_cat(val, " ", 2);
643
644
  }
644
645
  }
646
+
647
+
648
+ void Init_na_array() {
649
+ rb_define_method(cNArray, "to_a", na_to_array,0); //
650
+ }
@@ -523,6 +523,12 @@ static int
523
523
  return count;
524
524
  }
525
525
 
526
+ /*
527
+ * call-seq:
528
+ * narray.count_true -> int
529
+ *
530
+ * Returns the number of true (non-zero) in narray
531
+ */
526
532
  VALUE
527
533
  na_count_true(VALUE self)
528
534
  {
@@ -549,12 +555,19 @@ static int
549
555
  return count;
550
556
  }
551
557
 
558
+ /*
559
+ * call-seq:
560
+ * narray.count_false -> int
561
+ *
562
+ * Returns the number of false (zero-value) in narray
563
+ */
552
564
  VALUE
553
565
  na_count_false(VALUE self)
554
566
  {
555
567
  return( INT2NUM(na_count_false_body(self)) );
556
568
  }
557
569
 
570
+ /* :nodoc: */
558
571
  VALUE
559
572
  na_aref_mask(VALUE self, VALUE mask)
560
573
  {
@@ -984,3 +997,15 @@ VALUE
984
997
 
985
998
  return idx[nidx];
986
999
  }
1000
+
1001
+
1002
+ void Init_na_index() {
1003
+ /* slice */
1004
+ rb_define_method(cNArray, "[]", na_aref,-1);
1005
+ rb_define_method(cNArray, "[]=", na_aset,-1);
1006
+ rb_define_method(cNArray, "slice", na_slice,-1);
1007
+ /* mask */
1008
+ rb_define_method(cNArray, "count_false", na_count_false, 0);
1009
+ rb_define_method(cNArray, "count_true", na_count_true, 0);
1010
+ rb_define_method(cNArray, "mask", na_aref_mask, 1);
1011
+ }
@@ -286,6 +286,7 @@ static int
286
286
  }
287
287
 
288
288
 
289
+ /* :nodoc: */
289
290
  static VALUE
290
291
  na_lu_fact_bang(VALUE self)
291
292
  {
@@ -329,6 +330,7 @@ static VALUE
329
330
  }
330
331
 
331
332
 
333
+ /* :nodoc: */
332
334
  static VALUE
333
335
  na_lu_fact(VALUE self)
334
336
  {
@@ -471,6 +473,15 @@ na_shape_max2(int ndim, int *shape, int n1, int *shape1, int n2, int *shape2)
471
473
  }
472
474
 
473
475
 
476
+
477
+ /*
478
+ * call-seq:
479
+ * lu.solve(arg) -> result
480
+ *
481
+ * Solve with the result of LU factorization.
482
+ * arg should be NMatrix or NVector instance.
483
+ * Returns an instance of same class with arg.
484
+ */
474
485
  static VALUE
475
486
  na_lu_solve(VALUE self, volatile VALUE other)
476
487
  {
@@ -526,6 +537,7 @@ na_lu_solve(VALUE self, volatile VALUE other)
526
537
  }
527
538
 
528
539
 
540
+ /* :nodoc: */
529
541
  static VALUE
530
542
  na_lu_init(VALUE self, VALUE lu, VALUE piv)
531
543
  {
@@ -58,6 +58,8 @@ static int mem_count = 0;
58
58
  static int na_gc_freq = 2500000; /* Frequency of Garbage Collection */
59
59
  #endif
60
60
 
61
+ void Init_na_array(void);
62
+ void Init_na_index(void);
61
63
  void Init_nmath(void);
62
64
  void Init_na_funcs(void);
63
65
  void Init_na_linalg(void);
@@ -1173,15 +1175,18 @@ static VALUE
1173
1175
  void
1174
1176
  Init_narray()
1175
1177
  {
1176
- /* require Complex class */
1177
- rb_require("complex");
1178
+ ID id_Complex = rb_intern("Complex");
1179
+
1180
+ if (!rb_const_defined( rb_cObject, id_Complex)) {
1181
+ /* require Complex class */
1182
+ rb_require("complex");
1183
+ }
1178
1184
  cComplex = rb_const_get( rb_cObject, rb_intern("Complex") );
1179
1185
 
1180
1186
  /* define NArray class */
1181
1187
  cNArray = rb_define_class("NArray",rb_cObject);
1182
1188
 
1183
1189
  /* class methods */
1184
- /* rb_define_global_function("NArray",na_to_narray,-1); */
1185
1190
  rb_define_singleton_method(cNArray,"new",na_s_new,-1);
1186
1191
  rb_define_singleton_method(cNArray,"byte",na_s_new_byte,-1);
1187
1192
  rb_define_singleton_method(cNArray,"sint",na_s_new_sint,-1);
@@ -1200,9 +1205,6 @@ void
1200
1205
  rb_define_singleton_method(cNArray,"[]",na_s_bracket,-1);
1201
1206
 
1202
1207
  /* methods */
1203
- rb_define_method(cNArray, "[]", na_aref,-1);
1204
- rb_define_method(cNArray, "[]=", na_aset,-1);
1205
- rb_define_method(cNArray, "slice", na_slice,-1);
1206
1208
  rb_define_method(cNArray, "shape", na_shape,0);
1207
1209
  rb_define_alias(cNArray, "sizes","shape");
1208
1210
  rb_define_method(cNArray, "size", na_size,0);
@@ -1238,8 +1240,6 @@ void
1238
1240
  rb_define_method(cNArray, "each", na_each,0);
1239
1241
  rb_define_method(cNArray, "collect", na_collect,0);
1240
1242
  rb_define_method(cNArray, "collect!", na_collect_bang,0);
1241
- /* rb_define_method(cNArray, "each_index", na_each_index,0); */
1242
- rb_define_method(cNArray, "to_a", na_to_array,0);
1243
1243
  rb_define_method(cNArray, "to_s", na_to_s, 0);
1244
1244
  rb_define_method(cNArray, "to_f", na_to_float, 0);
1245
1245
  rb_define_method(cNArray, "to_i", na_to_integer, 0);
@@ -1247,10 +1247,6 @@ void
1247
1247
  rb_define_method(cNArray, "to_binary", na_to_binary, 0);
1248
1248
  rb_define_method(cNArray, "to_type_as_binary", na_to_type_as_binary, 1);
1249
1249
  rb_define_method(cNArray, "to_string", na_to_string, 0);
1250
- /*mask*/
1251
- rb_define_method(cNArray, "count_false", na_count_false, 0);
1252
- rb_define_method(cNArray, "count_true", na_count_true, 0);
1253
- rb_define_method(cNArray, "mask", na_aref_mask, 1);
1254
1250
 
1255
1251
  rb_define_const(cNArray, "NARRAY_VERSION", rb_str_new2(NARRAY_VERSION));
1256
1252
  rb_define_const(cNArray, "BYTE", INT2FIX(NA_BYTE));
@@ -1282,6 +1278,8 @@ void
1282
1278
  rb_define_method(cNArray, "refer", na_refer,0);
1283
1279
  rb_define_method(cNArray, "original", na_original,0);
1284
1280
 
1281
+ Init_na_array();
1282
+ Init_na_index();
1285
1283
  Init_nmath();
1286
1284
  Init_na_funcs();
1287
1285
  Init_na_random();
@@ -23,8 +23,8 @@
23
23
  # include <sys/types.h>
24
24
  #endif
25
25
 
26
- #define NARRAY_VERSION "0.6.0.7"
27
- #define NARRAY_VERSION_CODE 607
26
+ #define NARRAY_VERSION "0.6.0.8"
27
+ #define NARRAY_VERSION_CODE 608
28
28
 
29
29
  /*
30
30
  Data types used in NArray :
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: narray
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.7
5
- prerelease:
4
+ version: 0.6.0.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Masahiro Tanaka
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-02 00:00:00.000000000 Z
11
+ date: 2013-02-27 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Numerical N-dimensional Array class
15
14
  email: masa16.tanaka@gmail.com
@@ -18,12 +17,12 @@ extensions:
18
17
  - src/extconf.rb
19
18
  extra_rdoc_files: []
20
19
  files:
21
- - src/ChangeLog
22
- - src/MANIFEST
23
- - src/README.en
24
- - src/README.ja
25
- - src/SPEC.en
26
- - src/SPEC.ja
20
+ - ChangeLog
21
+ - MANIFEST
22
+ - README.en
23
+ - README.ja
24
+ - SPEC.en
25
+ - SPEC.ja
27
26
  - src/depend
28
27
  - src/extconf.rb
29
28
  - src/mkmath.rb
@@ -43,25 +42,42 @@ files:
43
42
  homepage: http://narray.rubyforge.org/
44
43
  licenses:
45
44
  - Ruby
45
+ metadata: {}
46
46
  post_install_message:
47
- rdoc_options: []
47
+ rdoc_options:
48
+ - --title
49
+ - NArray
50
+ - --main
51
+ - NArray
52
+ - --exclude
53
+ - mk.*
54
+ - --exclude
55
+ - extconf\.rb
56
+ - --exclude
57
+ - src/.*\.h
58
+ - --exclude
59
+ - src/lib/
60
+ - --exclude
61
+ - .*\.o
62
+ - --exclude
63
+ - narray\.so
64
+ - --exclude
65
+ - libnarray\.*
48
66
  require_paths:
49
67
  - .
50
68
  required_ruby_version: !ruby/object:Gem::Requirement
51
- none: false
52
69
  requirements:
53
- - - ! '>='
70
+ - - '>='
54
71
  - !ruby/object:Gem::Version
55
72
  version: '0'
56
73
  required_rubygems_version: !ruby/object:Gem::Requirement
57
- none: false
58
74
  requirements:
59
- - - ! '>='
75
+ - - '>='
60
76
  - !ruby/object:Gem::Version
61
77
  version: '0'
62
78
  requirements: []
63
79
  rubyforge_project: narray
64
- rubygems_version: 1.8.23
80
+ rubygems_version: 2.0.0
65
81
  signing_key:
66
82
  specification_version: 2
67
83
  summary: N-dimensional Numerical Array class for Ruby