narray 0.6.0.8 → 0.6.0.9

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
  SHA1:
3
- metadata.gz: 56a5e5c60ab2450492b8e19b78387d62e090fdbc
4
- data.tar.gz: ff0771dbbde2a98e9e92db8f0b821ffc25658e3c
3
+ metadata.gz: b502e43bb2703b09703eab484b27a2230c7f215f
4
+ data.tar.gz: b1bcbb6b5388d48fac66d206c42ddfb6cc533481
5
5
  SHA512:
6
- metadata.gz: 8993262cf562f08738f314e567f3d596c7661c64d4722260db5e0fb809f9fb4e5ce9f1b07ee16bc424d474f5e1b1abd8a51a22949f25b025c45b35998a417a38
7
- data.tar.gz: 30166a5c16acd63324282142da10fd6ed2dc8e182fad3fb280b731e0e234e0eb5a787df43b2d8b9d680a51281964747d5a8f4a1f0bba9b44deeca87c85f89eda
6
+ metadata.gz: 68631b41d59afb56f9cb006d8959b9c74f8f9e1f9ab9aa4fcf650ea08b639566c9e29ae74b191ee60feb24393c088d9ff5c687b4a9c8d6211a513aadd1566535
7
+ data.tar.gz: 3ebb0656301126842e704047c8c331d098f2497dae23b64620b10fc751f3f1548865c98e6b359d07d6e5eb7c912cd387bcd3dce84fdff5587aa17e4bc08f01fb
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 2013-03-16 Masahiro TANAKA <masa16.tanaka@gmail.com>
2
+
3
+ * narray.c (Init_narray): add map, map!
4
+ Thanks to Michael Macias.
5
+
1
6
  2013-02-27 Masahiro TANAKA <masa16.tanaka@gmail.com>
2
7
 
3
8
  * Rakefile: use rubygems/package_task.
data/MANIFEST CHANGED
@@ -1,9 +1,9 @@
1
1
  ChangeLog
2
2
  MANIFEST
3
- README.en
4
- README.ja
5
- SPEC.en
6
- SPEC.ja
3
+ README.md
4
+ README.ja.md
5
+ SPEC.en.txt
6
+ SPEC.ja.txt
7
7
  depend
8
8
  extconf.rb
9
9
  mkmath.rb
@@ -0,0 +1,54 @@
1
+ # Ruby/NArray
2
+
3
+ * ver 0.6.0.9 (2014-05-29)
4
+ * [Home page](http://masa16.github.io/narray/index.ja.html)
5
+ * [リポジトリ](https://github.com/masa16/narray)
6
+ * [NArrayメソッド一覧](https://github.com/masa16/narray/blob/master/SPEC.ja.txt)
7
+
8
+ ## Ruby/NArrayの特徴:
9
+
10
+ * Rubyで、高速な数値計算が可能。
11
+ * 要素には、8,16,32 bit 整数、単精度/倍精度の実数/複素数、
12
+ および Rubyオブジェクトをサポート。
13
+ * 部分配列の取出し、代入も容易。
14
+ 要素位置の指定には、数値、範囲、インデックスの配列が使用可能。
15
+ * +, -, *, /, %, ** や 算術関数の演算は、要素-対-要素でおこなう。
16
+ * NMath 算術関数モジュール
17
+ * 配列同士の演算・代入は、各次元のサイズが同じであることが必要。
18
+ ただし、サイズが1の次元は、他方の配列のサイズに合わせて
19
+ 「繰り返し」同じ要素が適用される。
20
+ * FFTW (高速フーリエ変換) version 3 は次のモジュールでサポート。
21
+ * Ruby/PGPLOT (グラフィックスライブラリ、別悃) にて
22
+ XYグラフ、ヒストグラム、等高線、イメージ表示可能。
23
+ * 数値計算・画像処理・データ解析など幅広い応用が可能(と思う)。
24
+
25
+ * 類似品
26
+ * Python/NumPy, Perl/PDL, Yorick, IDL
27
+
28
+ * 不十分な点
29
+ * メソッドが不足。
30
+ * バグ出しが不十分。
31
+ * ドキュメントがない。
32
+
33
+ ## インストール方法
34
+
35
+ Rubyの標準的な拡張ライブラリと同じです。ソースを展開したディレクトリで、
36
+
37
+ ruby extconf.rb
38
+ make
39
+ make install
40
+
41
+ と実行します。
42
+
43
+ ## 動作確認
44
+
45
+ * ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
46
+ * gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
47
+
48
+ ## 配布条件
49
+
50
+ Rubyのライセンスに準拠します。
51
+
52
+ ## 著者
53
+
54
+ 田中昌宏
@@ -0,0 +1,50 @@
1
+ # Ruby/NArray
2
+
3
+ * ver 0.6.0.9 (2014-05-29)
4
+ * [Home page](http://masa16.github.io/narray/)
5
+ * [Repository](https://github.com/masa16/narray)
6
+ * [NArray method list](https://github.com/masa16/narray/blob/master/SPEC.en.txt)
7
+
8
+ ## NArray Features:
9
+
10
+ * Fast and easy calculation for large numerical array.
11
+ * Accepting Elements:
12
+ 8,16,32 bit integer, single/double float/complex, Ruby Object.
13
+ * Easy extraction/substitution of array subset,
14
+ using assignment with number, range, array index.
15
+ * Operator: +, -, *, /, %, **, etc.
16
+ * NMath: Mathematics functions.
17
+ * FFTW version 2 or 3 is separately supported.
18
+ * Ruby/PGPLOT: Graphics library interface (separately distributed)
19
+ X-Y Graph, Histogram, Contour map, Image map, etc.
20
+
21
+ * NArray is similar to:
22
+ * Python/NumPy, Perl/PDL, Yorick, IDL
23
+
24
+ * NArray is far from completed!
25
+ * Experimental! Specification may be changed.
26
+ * Far from completed.
27
+ * Bugs may be included.
28
+ * No document.
29
+
30
+ ## Installation
31
+
32
+ ruby extconf.rb
33
+ make
34
+ make install
35
+
36
+ ## Tested Platform
37
+
38
+ * ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
39
+ * gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
40
+
41
+ ## License
42
+
43
+ This program is free software.
44
+ You can distribute/modify this program
45
+ under the same terms as Ruby itself.
46
+ NO WARRANTY.
47
+
48
+ ## Author
49
+
50
+ Masahiro TANAKA
File without changes
File without changes
@@ -1037,6 +1037,7 @@ static int
1037
1037
  int i, j, c=0;
1038
1038
  long r, n;
1039
1039
  VALUE v;
1040
+ volatile VALUE s;
1040
1041
 
1041
1042
  if (flag==0)
1042
1043
  MEMZERO(rankv,int,rankc);
@@ -1061,8 +1062,10 @@ static int
1061
1062
  else
1062
1063
  if (CLASS_OF(v)==rb_cRange) {
1063
1064
  rb_range_beg_len( v, &r, &n, rankc, 1 );
1064
- if ( c+n > rankc )
1065
- rb_raise(rb_eArgError, "too many ranks");
1065
+ if ( c+n > rankc ) {
1066
+ s = rb_inspect(v);
1067
+ rb_raise(rb_eArgError,"invalid dimension range: %s",StringValueCStr(s));
1068
+ }
1066
1069
  if (flag) {
1067
1070
  for(j=0; j<n; ++j)
1068
1071
  rankv[c++] = r++;
@@ -1123,11 +1126,9 @@ static VALUE
1123
1126
  GetNArray(self,a2);
1124
1127
 
1125
1128
  /* Parse Argument */
1126
- rankv = ALLOC_N( int, NA_MAX_RANK*2 );
1127
- shape = &rankv[NA_MAX_RANK];
1129
+ rankv = ALLOC_N( int, a2->rank*2 );
1130
+ shape = &rankv[a2->rank];
1128
1131
  rankc = na_arg_to_rank( argc, argv, a2->rank, rankv, 1 );
1129
- if (rankc > a2->rank)
1130
- rb_raise(rb_eArgError, "too many args");
1131
1132
  for ( ;rankc<a2->rank; ++rankc)
1132
1133
  rankv[rankc] = rankc;
1133
1134
 
@@ -9,7 +9,7 @@
9
9
  NO WARRANTY.
10
10
  */
11
11
 
12
- /*
12
+ /*
13
13
  This is based on trimmed version of MT19937. To get the original version,
14
14
  contact <http://www.math.keio.ac.jp/~matumoto/emt.html>.
15
15
 
@@ -20,11 +20,11 @@ The original copyright notice follows.
20
20
  This is a faster version by taking Shawn Cokus's optimization,
21
21
  Matthe Bellew's simplification, Isaku Wada's real version.
22
22
 
23
- Before using, initialize the state by using init_genrand(seed)
23
+ Before using, initialize the state by using init_genrand(seed)
24
24
  or init_by_array(init_key, key_length).
25
25
 
26
26
  Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
27
- All rights reserved.
27
+ All rights reserved.
28
28
 
29
29
  Redistribution and use in source and binary forms, with or without
30
30
  modification, are permitted provided that the following conditions
@@ -37,8 +37,8 @@ The original copyright notice follows.
37
37
  notice, this list of conditions and the following disclaimer in the
38
38
  documentation and/or other materials provided with the distribution.
39
39
 
40
- 3. The names of its contributors may not be used to endorse or promote
41
- products derived from this software without specific prior written
40
+ 3. The names of its contributors may not be used to endorse or promote
41
+ products derived from this software without specific prior written
42
42
  permission.
43
43
 
44
44
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -62,7 +62,7 @@ The original copyright notice follows.
62
62
  #include "narray.h"
63
63
  #include "narray_local.h"
64
64
 
65
- /* Period parameters */
65
+ /* Period parameters */
66
66
  #define N 624
67
67
  #define M 397
68
68
  #define MATRIX_A 0x9908b0dfUL /* constant vector a */
@@ -83,7 +83,7 @@ static void
83
83
  int j;
84
84
  state[0]= s & 0xffffffffUL;
85
85
  for (j=1; j<N; ++j) {
86
- state[j] = (1812433253UL * (state[j-1] ^ (state[j-1] >> 30)) + j);
86
+ state[j] = (1812433253UL * (state[j-1] ^ (state[j-1] >> 30)) + j);
87
87
  /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
88
88
  /* In the previous versions, MSBs of the seed affect */
89
89
  /* only MSBs of the array state[]. */
@@ -105,11 +105,11 @@ static void
105
105
 
106
106
  left = N;
107
107
  next = state;
108
-
109
- for (j=N-M+1; --j; ++p)
108
+
109
+ for (j=N-M+1; --j; ++p)
110
110
  *p = p[M] ^ TWIST(p[0], p[1]);
111
111
 
112
- for (j=M; --j; ++p)
112
+ for (j=M; --j; ++p)
113
113
  *p = p[M-N] ^ TWIST(p[0], p[1]);
114
114
 
115
115
  *p = p[M-N] ^ TWIST(p[0], state[0]);
@@ -161,7 +161,7 @@ static VALUE
161
161
  VALUE sd;
162
162
  u_int32_t seed, old;
163
163
 
164
- rb_secure(4);
164
+ //rb_secure(4);
165
165
  if (rb_scan_args(argc, argv, "01", &sd) == 0) {
166
166
  seed = random_seed();
167
167
  }
@@ -931,8 +931,6 @@ static void
931
931
 
932
932
  if (argc==0)
933
933
  rb_raise(rb_eArgError, "Argument required");
934
- if (ary->rank + argc > NA_MAX_RANK-1)
935
- rb_raise(rb_eArgError, "Exceed maximum ranks");
936
934
  if (ary->total==0)
937
935
  rb_raise(rb_eRuntimeError, "cannot extend empty array");
938
936
 
@@ -1240,6 +1238,8 @@ void
1240
1238
  rb_define_method(cNArray, "each", na_each,0);
1241
1239
  rb_define_method(cNArray, "collect", na_collect,0);
1242
1240
  rb_define_method(cNArray, "collect!", na_collect_bang,0);
1241
+ rb_define_alias(cNArray, "map", "collect");
1242
+ rb_define_alias(cNArray, "map!", "collect!");
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);
@@ -23,8 +23,8 @@
23
23
  # include <sys/types.h>
24
24
  #endif
25
25
 
26
- #define NARRAY_VERSION "0.6.0.8"
27
- #define NARRAY_VERSION_CODE 608
26
+ #define NARRAY_VERSION "0.6.0.9"
27
+ #define NARRAY_VERSION_CODE 609
28
28
 
29
29
  /*
30
30
  Data types used in NArray :
@@ -110,8 +110,6 @@ extern VALUE cNArray;
110
110
  extern const int na_sizeof[NA_NTYPES+1];
111
111
  #endif
112
112
 
113
- #define NA_MAX_RANK 15
114
-
115
113
  #define GetNArray(obj,var) Data_Get_Struct(obj, struct NARRAY, var)
116
114
  #define IsNArray(obj) (rb_obj_is_kind_of(obj,cNArray)==Qtrue)
117
115
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: narray
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.8
4
+ version: 0.6.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Tanaka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-02-27 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Numerical N-dimensional Array class
14
14
  email: masa16.tanaka@gmail.com
@@ -19,12 +19,14 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - ChangeLog
21
21
  - MANIFEST
22
- - README.en
23
- - README.ja
24
- - SPEC.en
25
- - SPEC.ja
22
+ - README.ja.md
23
+ - README.md
24
+ - SPEC.en.txt
25
+ - SPEC.ja.txt
26
26
  - src/depend
27
27
  - src/extconf.rb
28
+ - src/lib/narray_ext.rb
29
+ - src/lib/nmatrix.rb
28
30
  - src/mkmath.rb
29
31
  - src/mknafunc.rb
30
32
  - src/mkop.rb
@@ -37,47 +39,45 @@ files:
37
39
  - src/narray.def
38
40
  - src/narray.h
39
41
  - src/narray_local.h
40
- - src/lib/narray_ext.rb
41
- - src/lib/nmatrix.rb
42
- homepage: http://narray.rubyforge.org/
42
+ homepage: http://masa16.github.io/narray/
43
43
  licenses:
44
44
  - Ruby
45
45
  metadata: {}
46
46
  post_install_message:
47
47
  rdoc_options:
48
- - --title
48
+ - "--title"
49
49
  - NArray
50
- - --main
50
+ - "--main"
51
51
  - NArray
52
- - --exclude
52
+ - "--exclude"
53
53
  - mk.*
54
- - --exclude
54
+ - "--exclude"
55
55
  - extconf\.rb
56
- - --exclude
56
+ - "--exclude"
57
57
  - src/.*\.h
58
- - --exclude
58
+ - "--exclude"
59
59
  - src/lib/
60
- - --exclude
61
- - .*\.o
62
- - --exclude
60
+ - "--exclude"
61
+ - ".*\\.o"
62
+ - "--exclude"
63
63
  - narray\.so
64
- - --exclude
64
+ - "--exclude"
65
65
  - libnarray\.*
66
66
  require_paths:
67
- - .
67
+ - "."
68
68
  required_ruby_version: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - '>='
70
+ - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
- rubyforge_project: narray
80
- rubygems_version: 2.0.0
79
+ rubyforge_project:
80
+ rubygems_version: 2.2.2
81
81
  signing_key:
82
82
  specification_version: 2
83
83
  summary: N-dimensional Numerical Array class for Ruby
data/README.en DELETED
@@ -1,49 +0,0 @@
1
- Ruby/NArray ver 0.6.0.0 (2011-08-27) by Masahiro TANAKA
2
-
3
- * NArray properties:
4
-
5
- + Fast and easy calculation for large numerical array.
6
- + Accepting Elements:
7
- 8,16,32 bit integer, single/double float/complex, Ruby Object.
8
- + Easy extraction/substitution of array subset,
9
- using assignment with number, range, array index.
10
- + Operator: +,-,*,/,%,**, etc.
11
- + FFTW version 2 or 3 is separately supported.
12
- + NImage: Image viewer class.
13
- + Ruby/PGPLOT: Graphics library interface (separately distributed)
14
- X-Y Graph, Histogram, Contour map, Image map, etc.
15
-
16
- * NArray is similar to:
17
-
18
- + Python/NumPy, Perl/PDL, Yorick, IDL
19
-
20
- * NArray is far from completed!
21
-
22
- + Experimental! Specification may be changed.
23
- + Far from completed.
24
- + Bugs may be included.
25
- + No document.
26
-
27
- * Installation
28
-
29
- + Compile & Install NArray
30
-
31
- ruby extconf.rb
32
- make
33
- make install
34
-
35
- * Tested Platform
36
-
37
- ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
38
- gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC)
39
-
40
- * License
41
-
42
- This program is free software.
43
- You can distribute/modify this program
44
- under the same terms as Ruby itself.
45
- NO WARRANTY.
46
-
47
- * Author
48
-
49
- Masahiro TANAKA <masa16.tanaka@gmail.com>
data/README.ja DELETED
@@ -1,52 +0,0 @@
1
- Ruby/NArray ver 0.6.0.0 (2011-08-27) by Masahiro TANAKA
2
-
3
- * Ruby/NArrayの特徴。
4
-
5
- + Rubyで、高速な数値計算が可能。
6
- + 要素には、8,16,32 bit 整数、単精度/倍精度の実数/複素数、
7
- および Rubyオブジェクトをサポート。
8
- + 部分配列の取出し、代入も容易。
9
- 要素位置の指定には、数値、範囲、インデックスの配列が使用可能。
10
- + +,-,*,/,%,** や 算術関数の演算は、要素-対-要素でおこなう。
11
- + 配列同士の演算・代入は、各次元のサイズが同じであることが必要。
12
- ただし、サイズが1の次元は、他方の配列のサイズに合わせて
13
- 「繰り返し」同じ要素が適用される。
14
- + FFTW (高速フーリエ変換) version 3 は次のモジュールでサポート。
15
- + NImage (X11イメージ表示) クラス附属。(nimage/ ディレクトリ参照)
16
- + Ruby/PGPLOT (グラフィックスライブラリ、別悃) にて
17
- XYグラフ、ヒストグラム、等高線、イメージ表示可能。
18
- + 数値計算・画像処理・データ解析など幅広い応用が可能(と思う)。
19
-
20
- * 類似品
21
-
22
- + Python/NumPy, Perl/PDL, Yorick, IDL
23
-
24
- * 不十分な点
25
-
26
- + メソッドが不足。
27
- + バグ出しが不十分。
28
- + ドキュメントがない。
29
-
30
- * インストール方法
31
-
32
- Rubyの標準的な拡張ライブラリと同じです。ソースを展開したディレクトリで、
33
-
34
- ruby extconf.rb
35
- make
36
- make install
37
-
38
- と実行します。
39
-
40
- * 動作確認
41
-
42
- ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
43
- gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC)
44
-
45
- * 配布条件
46
-
47
- Rubyのライセンスに準拠します。
48
-
49
- * 著者
50
-
51
- 田中昌宏
52
- ご意見,バグレポートその他は masa16.tanaka@gmail.com までお願いします。