numo-narray 0.9.0.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/README.md +47 -0
  4. data/Rakefile +41 -0
  5. data/ext/numo/narray/SFMT-params.h +97 -0
  6. data/ext/numo/narray/SFMT-params19937.h +46 -0
  7. data/ext/numo/narray/SFMT.c +620 -0
  8. data/ext/numo/narray/SFMT.h +157 -0
  9. data/ext/numo/narray/array.c +525 -0
  10. data/ext/numo/narray/data.c +901 -0
  11. data/ext/numo/narray/depend.erb +33 -0
  12. data/ext/numo/narray/extconf.rb +117 -0
  13. data/ext/numo/narray/gen/bit.erb.c +811 -0
  14. data/ext/numo/narray/gen/cogen.rb +18 -0
  15. data/ext/numo/narray/gen/def/dcomplex.rb +32 -0
  16. data/ext/numo/narray/gen/def/dfloat.rb +30 -0
  17. data/ext/numo/narray/gen/def/int16.rb +29 -0
  18. data/ext/numo/narray/gen/def/int32.rb +29 -0
  19. data/ext/numo/narray/gen/def/int64.rb +29 -0
  20. data/ext/numo/narray/gen/def/int8.rb +29 -0
  21. data/ext/numo/narray/gen/def/robject.rb +30 -0
  22. data/ext/numo/narray/gen/def/scomplex.rb +32 -0
  23. data/ext/numo/narray/gen/def/sfloat.rb +30 -0
  24. data/ext/numo/narray/gen/def/uint16.rb +29 -0
  25. data/ext/numo/narray/gen/def/uint32.rb +29 -0
  26. data/ext/numo/narray/gen/def/uint64.rb +29 -0
  27. data/ext/numo/narray/gen/def/uint8.rb +29 -0
  28. data/ext/numo/narray/gen/dtype.erb.c +328 -0
  29. data/ext/numo/narray/gen/tmpl/accum.c +36 -0
  30. data/ext/numo/narray/gen/tmpl/accum_binary.c +75 -0
  31. data/ext/numo/narray/gen/tmpl/accum_index.c +58 -0
  32. data/ext/numo/narray/gen/tmpl/allocate.c +35 -0
  33. data/ext/numo/narray/gen/tmpl/aref.c +51 -0
  34. data/ext/numo/narray/gen/tmpl/aset.c +61 -0
  35. data/ext/numo/narray/gen/tmpl/binary.c +53 -0
  36. data/ext/numo/narray/gen/tmpl/binary2.c +55 -0
  37. data/ext/numo/narray/gen/tmpl/binary_s.c +34 -0
  38. data/ext/numo/narray/gen/tmpl/bit_binary.c +94 -0
  39. data/ext/numo/narray/gen/tmpl/bit_count.c +82 -0
  40. data/ext/numo/narray/gen/tmpl/bit_unary.c +77 -0
  41. data/ext/numo/narray/gen/tmpl/cast.c +37 -0
  42. data/ext/numo/narray/gen/tmpl/cast_array.c +79 -0
  43. data/ext/numo/narray/gen/tmpl/cast_numeric.c +22 -0
  44. data/ext/numo/narray/gen/tmpl/coerce_cast.c +8 -0
  45. data/ext/numo/narray/gen/tmpl/cond_binary.c +51 -0
  46. data/ext/numo/narray/gen/tmpl/cond_unary.c +45 -0
  47. data/ext/numo/narray/gen/tmpl/cum.c +42 -0
  48. data/ext/numo/narray/gen/tmpl/each.c +43 -0
  49. data/ext/numo/narray/gen/tmpl/each_with_index.c +64 -0
  50. data/ext/numo/narray/gen/tmpl/extract.c +23 -0
  51. data/ext/numo/narray/gen/tmpl/eye.c +91 -0
  52. data/ext/numo/narray/gen/tmpl/fill.c +38 -0
  53. data/ext/numo/narray/gen/tmpl/format.c +60 -0
  54. data/ext/numo/narray/gen/tmpl/format_to_a.c +47 -0
  55. data/ext/numo/narray/gen/tmpl/head.c +25 -0
  56. data/ext/numo/narray/gen/tmpl/inspect.c +16 -0
  57. data/ext/numo/narray/gen/tmpl/map_with_index.c +94 -0
  58. data/ext/numo/narray/gen/tmpl/median.c +44 -0
  59. data/ext/numo/narray/gen/tmpl/minmax.c +47 -0
  60. data/ext/numo/narray/gen/tmpl/poly.c +49 -0
  61. data/ext/numo/narray/gen/tmpl/pow.c +74 -0
  62. data/ext/numo/narray/gen/tmpl/powint.c +17 -0
  63. data/ext/numo/narray/gen/tmpl/qsort.c +149 -0
  64. data/ext/numo/narray/gen/tmpl/rand.c +33 -0
  65. data/ext/numo/narray/gen/tmpl/rand_norm.c +46 -0
  66. data/ext/numo/narray/gen/tmpl/robj_allocate.c +32 -0
  67. data/ext/numo/narray/gen/tmpl/seq.c +61 -0
  68. data/ext/numo/narray/gen/tmpl/set2.c +56 -0
  69. data/ext/numo/narray/gen/tmpl/sort.c +36 -0
  70. data/ext/numo/narray/gen/tmpl/sort_index.c +86 -0
  71. data/ext/numo/narray/gen/tmpl/store.c +31 -0
  72. data/ext/numo/narray/gen/tmpl/store_array.c +5 -0
  73. data/ext/numo/narray/gen/tmpl/store_from.c +53 -0
  74. data/ext/numo/narray/gen/tmpl/store_numeric.c +22 -0
  75. data/ext/numo/narray/gen/tmpl/to_a.c +41 -0
  76. data/ext/numo/narray/gen/tmpl/unary.c +58 -0
  77. data/ext/numo/narray/gen/tmpl/unary2.c +58 -0
  78. data/ext/numo/narray/gen/tmpl/unary_s.c +57 -0
  79. data/ext/numo/narray/index.c +822 -0
  80. data/ext/numo/narray/kwarg.c +79 -0
  81. data/ext/numo/narray/math.c +140 -0
  82. data/ext/numo/narray/narray.c +1539 -0
  83. data/ext/numo/narray/ndloop.c +1928 -0
  84. data/ext/numo/narray/numo/compat.h +23 -0
  85. data/ext/numo/narray/numo/intern.h +112 -0
  86. data/ext/numo/narray/numo/narray.h +411 -0
  87. data/ext/numo/narray/numo/ndloop.h +99 -0
  88. data/ext/numo/narray/numo/template.h +140 -0
  89. data/ext/numo/narray/numo/types/bit.h +19 -0
  90. data/ext/numo/narray/numo/types/complex.h +410 -0
  91. data/ext/numo/narray/numo/types/complex_macro.h +205 -0
  92. data/ext/numo/narray/numo/types/dcomplex.h +11 -0
  93. data/ext/numo/narray/numo/types/dfloat.h +12 -0
  94. data/ext/numo/narray/numo/types/float_def.h +34 -0
  95. data/ext/numo/narray/numo/types/float_macro.h +277 -0
  96. data/ext/numo/narray/numo/types/int16.h +12 -0
  97. data/ext/numo/narray/numo/types/int32.h +12 -0
  98. data/ext/numo/narray/numo/types/int64.h +12 -0
  99. data/ext/numo/narray/numo/types/int8.h +12 -0
  100. data/ext/numo/narray/numo/types/int_macro.h +34 -0
  101. data/ext/numo/narray/numo/types/robj_macro.h +218 -0
  102. data/ext/numo/narray/numo/types/robject.h +21 -0
  103. data/ext/numo/narray/numo/types/scomplex.h +11 -0
  104. data/ext/numo/narray/numo/types/sfloat.h +13 -0
  105. data/ext/numo/narray/numo/types/uint16.h +12 -0
  106. data/ext/numo/narray/numo/types/uint32.h +12 -0
  107. data/ext/numo/narray/numo/types/uint64.h +12 -0
  108. data/ext/numo/narray/numo/types/uint8.h +12 -0
  109. data/ext/numo/narray/numo/types/uint_macro.h +31 -0
  110. data/ext/numo/narray/numo/types/xint_macro.h +133 -0
  111. data/ext/numo/narray/rand.c +87 -0
  112. data/ext/numo/narray/step.c +506 -0
  113. data/ext/numo/narray/struct.c +872 -0
  114. data/lib/2.1/numo/narray.so +0 -0
  115. data/lib/2.2/numo/narray.so +0 -0
  116. data/lib/2.3/numo/narray.so +0 -0
  117. data/lib/erbpp/line_number.rb +126 -0
  118. data/lib/erbpp/narray_def.rb +338 -0
  119. data/lib/erbpp.rb +286 -0
  120. data/lib/numo/narray.rb +6 -0
  121. data/numo-narray.gemspec +35 -0
  122. data/spec/bit_spec.rb +93 -0
  123. data/spec/narray_spec.rb +249 -0
  124. metadata +238 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: afa2563cf5a6d4f756025e0b51536bf83c2a3fd7
4
+ data.tar.gz: eab5d7f761a567782e29e97420aa56c3eb142bf4
5
+ SHA512:
6
+ metadata.gz: 080bb8d44b7e906dd17588a2e87f2f4935b43426bb87af47c721904ef8ee0f3177247bd175878d0db85c5cb99a579bbd6244a1de0aad9d5fa71c1a2e8d27701e
7
+ data.tar.gz: d9e84f080188fa0da98a38dd61fd5af4e184b7530d77a087ca66ff2a15c16e43b354de0f9c721321c6ea6ae75dec0e5c34dca190e8bcd9b09ab8ad3148577849
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in narray-devel.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Numo::NArray - New NArray class library for Ruby/Numo (NUmerical MOdule)
2
+
3
+ [![Build Status](https://travis-ci.org/ruby-numo/narray.svg?branch=master)](https://travis-ci.org/ruby-numo/narray)
4
+
5
+ under development
6
+
7
+ ## Related Projects
8
+ * [Numo::Linalg](https://github.com/ruby-numo/linalg): Linear Algebra library with [LAPACK](http://www.netlib.org/lapack/).
9
+ * [Numo::GSL](https://github.com/ruby-numo/gsl): Ruby interface for [GSL (GNU Scientific Library)](http://www.gnu.org/software/gsl/).
10
+ * [Numo::FFTE](https://github.com/ruby-numo/ffte): Ruby interface for [FFTE (A Fast Fourier Transform library with radix-2,3,5)](http://www.ffte.jp/).
11
+
12
+ ## Installation
13
+ ### Ubuntu, Debian
14
+ ```shell
15
+ apt install -y git ruby gcc ruby-dev rake make
16
+ git clone git://github.com/ruby-numo/narray
17
+ cd narray
18
+ gem build numo-narray.gemspec
19
+ gem install numo-narray-0.9.0.1.gem
20
+ ```
21
+
22
+ ## Quick start
23
+ An example
24
+ ```ruby
25
+ [1] pry(main)> require "numo/narray"
26
+ => true
27
+ [2] pry(main)> a = Numo::DFloat.new(3,5).seq
28
+ => Numo::DFloat#shape=[3,5]
29
+ [[0, 1, 2, 3, 4],
30
+ [5, 6, 7, 8, 9],
31
+ [10, 11, 12, 13, 14]]
32
+ [3] pry(main)> a.shape
33
+ => [3, 5]
34
+ [4] pry(main)> a.ndim
35
+ => 2
36
+ [5] pry(main)> a.class
37
+ => Numo::DFloat
38
+ [6] pry(main)> a.size
39
+ => 15
40
+ ```
41
+ For more examples, check out this [narray version of 100 numpy exercises](https://github.com/ruby-numo/narray/wiki/100-narray-exercises).
42
+
43
+ ## numo-array status compared to numpy
44
+
45
+ https://github.com/ruby-numo/narray/wiki/Numo-vs-numpy
46
+
47
+ ## [NArray Tentative API Document](http://ruby-numo.github.io/narray/narray/frames.html)
data/Rakefile ADDED
@@ -0,0 +1,41 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/extensiontask"
3
+ require "rake_compiler_dock"
4
+ require "shellwords"
5
+
6
+ spec = Bundler::GemHelper.gemspec
7
+
8
+ Rake::ExtensionTask.new("numo/narray", spec) do |ext|
9
+ ext.cross_compile = true
10
+ ext.cross_platform = ["x86-mingw32", "x64-mingw32"]
11
+ end
12
+
13
+ namespace :build do
14
+ pkg_dir = "pkg"
15
+ directory pkg_dir
16
+
17
+ desc "Build gems for Windows"
18
+ task :windows => pkg_dir do
19
+ ruby_versions = "2.1.6:2.2.2:2.3.0"
20
+
21
+ build_dir = "tmp/windows"
22
+ rm_rf build_dir
23
+ mkdir_p build_dir
24
+
25
+ commands = [
26
+ ["git", "clone", "file://#{Dir.pwd}/.git", build_dir],
27
+ ["cd", build_dir],
28
+ ["bundle"],
29
+ ["rake", "cross", "native", "gem", "RUBY_CC_VERSION=#{ruby_versions}"],
30
+ ]
31
+ raw_commands = commands.collect do |command|
32
+ Shellwords.join(command)
33
+ end
34
+ raw_command_line = raw_commands.join(" && ")
35
+
36
+ RakeCompilerDock.sh(raw_command_line)
37
+
38
+ cp(Dir.glob("#{build_dir}/#{pkg_dir}/*.gem"),
39
+ "#{pkg_dir}/")
40
+ end
41
+ end
@@ -0,0 +1,97 @@
1
+ #ifndef SFMT_PARAMS_H
2
+ #define SFMT_PARAMS_H
3
+
4
+ #if !defined(MEXP)
5
+ //#ifdef __GNUC__
6
+ // #warning "MEXP is not defined. I assume MEXP is 19937."
7
+ //#endif
8
+ #define MEXP 19937
9
+ #endif
10
+ /*-----------------
11
+ BASIC DEFINITIONS
12
+ -----------------*/
13
+ /** Mersenne Exponent. The period of the sequence
14
+ * is a multiple of 2^MEXP-1.
15
+ * #define MEXP 19937 */
16
+ /** SFMT generator has an internal state array of 128-bit integers,
17
+ * and N is its size. */
18
+ #define N (MEXP / 128 + 1)
19
+ /** N32 is the size of internal state array when regarded as an array
20
+ * of 32-bit integers.*/
21
+ #define N32 (N * 4)
22
+ /** N64 is the size of internal state array when regarded as an array
23
+ * of 64-bit integers.*/
24
+ #define N64 (N * 2)
25
+
26
+ /*----------------------
27
+ the parameters of SFMT
28
+ following definitions are in paramsXXXX.h file.
29
+ ----------------------*/
30
+ /** the pick up position of the array.
31
+ #define POS1 122
32
+ */
33
+
34
+ /** the parameter of shift left as four 32-bit registers.
35
+ #define SL1 18
36
+ */
37
+
38
+ /** the parameter of shift left as one 128-bit register.
39
+ * The 128-bit integer is shifted by (SL2 * 8) bits.
40
+ #define SL2 1
41
+ */
42
+
43
+ /** the parameter of shift right as four 32-bit registers.
44
+ #define SR1 11
45
+ */
46
+
47
+ /** the parameter of shift right as one 128-bit register.
48
+ * The 128-bit integer is shifted by (SL2 * 8) bits.
49
+ #define SR2 1
50
+ */
51
+
52
+ /** A bitmask, used in the recursion. These parameters are introduced
53
+ * to break symmetry of SIMD.
54
+ #define MSK1 0xdfffffefU
55
+ #define MSK2 0xddfecb7fU
56
+ #define MSK3 0xbffaffffU
57
+ #define MSK4 0xbffffff6U
58
+ */
59
+
60
+ /** These definitions are part of a 128-bit period certification vector.
61
+ #define PARITY1 0x00000001U
62
+ #define PARITY2 0x00000000U
63
+ #define PARITY3 0x00000000U
64
+ #define PARITY4 0xc98e126aU
65
+ */
66
+
67
+ #if MEXP == 607
68
+ #include "SFMT-params607.h"
69
+ #elif MEXP == 1279
70
+ #include "SFMT-params1279.h"
71
+ #elif MEXP == 2281
72
+ #include "SFMT-params2281.h"
73
+ #elif MEXP == 4253
74
+ #include "SFMT-params4253.h"
75
+ #elif MEXP == 11213
76
+ #include "SFMT-params11213.h"
77
+ #elif MEXP == 19937
78
+ #include "SFMT-params19937.h"
79
+ #elif MEXP == 44497
80
+ #include "SFMT-params44497.h"
81
+ #elif MEXP == 86243
82
+ #include "SFMT-params86243.h"
83
+ #elif MEXP == 132049
84
+ #include "SFMT-params132049.h"
85
+ #elif MEXP == 216091
86
+ #include "SFMT-params216091.h"
87
+ #else
88
+ #ifdef __GNUC__
89
+ #error "MEXP is not valid."
90
+ #undef MEXP
91
+ #else
92
+ #undef MEXP
93
+ #endif
94
+
95
+ #endif
96
+
97
+ #endif /* SFMT_PARAMS_H */
@@ -0,0 +1,46 @@
1
+ #ifndef SFMT_PARAMS19937_H
2
+ #define SFMT_PARAMS19937_H
3
+
4
+ #define POS1 122
5
+ #define SL1 18
6
+ #define SL2 1
7
+ #define SR1 11
8
+ #define SR2 1
9
+ #define MSK1 0xdfffffefU
10
+ #define MSK2 0xddfecb7fU
11
+ #define MSK3 0xbffaffffU
12
+ #define MSK4 0xbffffff6U
13
+ #define PARITY1 0x00000001U
14
+ #define PARITY2 0x00000000U
15
+ #define PARITY3 0x00000000U
16
+ #define PARITY4 0x13c9e684U
17
+
18
+
19
+ /* PARAMETERS FOR ALTIVEC */
20
+ #if defined(__APPLE__) /* For OSX */
21
+ #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1)
22
+ #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
23
+ #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
24
+ #define ALTI_MSK64 \
25
+ (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
26
+ #define ALTI_SL2_PERM \
27
+ (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8)
28
+ #define ALTI_SL2_PERM64 \
29
+ (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0)
30
+ #define ALTI_SR2_PERM \
31
+ (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
32
+ #define ALTI_SR2_PERM64 \
33
+ (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
34
+ #else /* For OTHER OSs(Linux?) */
35
+ #define ALTI_SL1 {SL1, SL1, SL1, SL1}
36
+ #define ALTI_SR1 {SR1, SR1, SR1, SR1}
37
+ #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4}
38
+ #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3}
39
+ #define ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
40
+ #define ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
41
+ #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
42
+ #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
43
+ #endif /* For OSX */
44
+ #define IDSTR "SFMT-19937:122-18-1-11-1:dfffffef-ddfecb7f-bffaffff-bffffff6"
45
+
46
+ #endif /* SFMT_PARAMS19937_H */