nmatrix 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/History.txt +102 -10
  3. data/README.rdoc +24 -32
  4. data/Rakefile +1 -1
  5. data/ext/nmatrix/data/complex.h +9 -0
  6. data/ext/nmatrix/data/data.cpp +78 -4
  7. data/ext/nmatrix/data/data.h +86 -54
  8. data/ext/nmatrix/data/rational.h +2 -0
  9. data/ext/nmatrix/data/ruby_object.h +38 -8
  10. data/ext/nmatrix/extconf.rb +13 -7
  11. data/ext/nmatrix/nmatrix.cpp +262 -139
  12. data/ext/nmatrix/nmatrix.h +11 -4
  13. data/ext/nmatrix/storage/common.cpp +20 -13
  14. data/ext/nmatrix/storage/common.h +18 -12
  15. data/ext/nmatrix/storage/dense.cpp +122 -192
  16. data/ext/nmatrix/storage/dense.h +4 -2
  17. data/ext/nmatrix/storage/list.cpp +467 -636
  18. data/ext/nmatrix/storage/list.h +6 -3
  19. data/ext/nmatrix/storage/storage.cpp +83 -46
  20. data/ext/nmatrix/storage/storage.h +7 -7
  21. data/ext/nmatrix/storage/yale.cpp +621 -361
  22. data/ext/nmatrix/storage/yale.h +21 -9
  23. data/ext/nmatrix/ttable_helper.rb +27 -31
  24. data/ext/nmatrix/types.h +1 -1
  25. data/ext/nmatrix/util/math.cpp +9 -10
  26. data/ext/nmatrix/util/sl_list.cpp +1 -7
  27. data/ext/nmatrix/util/sl_list.h +0 -118
  28. data/lib/nmatrix/blas.rb +59 -18
  29. data/lib/nmatrix/monkeys.rb +0 -52
  30. data/lib/nmatrix/nmatrix.rb +136 -9
  31. data/lib/nmatrix/nvector.rb +33 -0
  32. data/lib/nmatrix/shortcuts.rb +95 -16
  33. data/lib/nmatrix/version.rb +1 -1
  34. data/lib/nmatrix/yale_functions.rb +25 -19
  35. data/spec/blas_spec.rb +1 -19
  36. data/spec/elementwise_spec.rb +132 -17
  37. data/spec/lapack_spec.rb +0 -3
  38. data/spec/nmatrix_list_spec.rb +18 -0
  39. data/spec/nmatrix_spec.rb +44 -18
  40. data/spec/nmatrix_yale_spec.rb +1 -3
  41. data/spec/shortcuts_spec.rb +26 -36
  42. data/spec/slice_spec.rb +2 -4
  43. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80c122ef6be8531eccdf14ff07426f8302660a14
4
- data.tar.gz: 74335afd35279bcb817691e94c3017883ae3fed5
3
+ metadata.gz: 884e6aa70e17f383f0b979f94a911ad68960b48d
4
+ data.tar.gz: 4f1194649cfc46eb2af3fb94808c09b05837fcc4
5
5
  SHA512:
6
- metadata.gz: 2d1573ca2c204fb33897870fc350779db8800c0ce41b263c3ae0628647ebd85e31ff5080e7a02bdf76f043a184274c5d197384d6322827250583d68c743d0ca6
7
- data.tar.gz: 07446f0f43a91fed625330975a6f9d443b9b497ddc694bd6d7b54cb5e54da191a98444fb8d4c6097d594862e57e76c24d84133daac84eda68688699428920c7d
6
+ metadata.gz: aa28bc42bbfd037d04e18797076547860cf15d4f4c48203a60ac410d4c9102652d12ed22f980d7edaf854ed876d517a72311a924c7c16ecb3796aec118726ea4
7
+ data.tar.gz: 9d7132d3582dda04ea68afc8a93a3d2362f10d23519e00d65fe0af4a9b199ea74f990b43c2f5593131c02ed448534d86039cbc1da0c43d1cb1828dd0aa05181f
data/History.txt CHANGED
@@ -75,8 +75,8 @@
75
75
 
76
76
  * Yale-to-list casting
77
77
 
78
- * Now requires packable-1.3.5 or higher, fixing a problem with MATLAB
79
- .mat v5 file I/O (specific to doubles)
78
+ * Now requires packable-1.3.5 or higher, fixing a problem with
79
+ MATLAB .mat v5 file I/O (specific to doubles)
80
80
 
81
81
  === 0.0.4 / 2013-05-17
82
82
 
@@ -96,8 +96,8 @@
96
96
  * Made it possible to request a different itype internally for Yale
97
97
  matrices
98
98
 
99
- * Improved space usage of Yale slice-by-copying, which was requesting
100
- more space than needed
99
+ * Improved space usage of Yale slice-by-copying, which was
100
+ requesting more space than needed
101
101
 
102
102
  * Improved compile-time Mac OS X and Ubuntu library searching
103
103
 
@@ -109,22 +109,23 @@
109
109
  (which are based on shape) differ, and a separate problem where
110
110
  incorrect IJA and A entries were written.
111
111
 
112
- * NVector-scalar operations and NVector-NVector element-wise options
113
- now return an NVector instead of an NMatrix
112
+ * NVector-scalar operations and NVector-NVector element-wise
113
+ options now return an NVector instead of an NMatrix
114
114
 
115
115
  * Addressed problems with segmentation faults during iteration (by
116
116
  @cjfuller)
117
117
 
118
- * Addressed Ubuntu/Debian installation problems (incompatibility with
119
- apt-supplied atlas)
118
+ * Addressed Ubuntu/Debian installation problems (incompatibility
119
+ with apt-supplied atlas)
120
120
 
121
- * Fixed transpose behavior following slice-by-reference (by @cjfuller)
121
+ * Fixed transpose behavior following slice-by-reference (by
122
+ @cjfuller)
122
123
 
123
124
  * Fixed gem install command in Rakefile (by @jpmckinney)
124
125
 
125
126
  * Fixed Spanish language compile issue (by @imcsk8 and @agarie)
126
127
 
127
- === 0.0.5 / 2013-??-??
128
+ === 0.0.5 / 2013-07-09
128
129
 
129
130
  * 4 major enhancements
130
131
 
@@ -189,3 +190,94 @@
189
190
 
190
191
  * NMatrix::read() now raises an exception when asked to read a file
191
192
  that does not exist
193
+
194
+ === 0.0.6 / 2013-08-09
195
+
196
+ * 8 major enhancements:
197
+
198
+ * Refactored iteration, so that each storage type now has each of:
199
+ #each, #each_with_indices, #each_stored_with_indices
200
+
201
+ * Added element-wise power function (**) for dense matrices (by
202
+ @agarie)
203
+
204
+ * Dramatically improved matrix element-wise and scalar functions so
205
+ C++ templates are no longer necessary; element-wise operations
206
+ may now be written in protected Ruby methods that look like
207
+ NMatrix#__list_elementwise_op__ and NMatrix#__list_scalar_op__
208
+
209
+ * Element-wise and scalar operations that might return a true or
210
+ false now return Ruby matrices
211
+
212
+ * Yale element-wise and scalar operations have been added
213
+
214
+ * Yale is now allowed to have a non-zero default (specifically to
215
+ permit true-false matrices and nil sparse bases)
216
+
217
+ * Dramatically improved NMatrix#cast to allow for hashed options
218
+ including a :default for list and yale casts
219
+
220
+ * Dramatically improved speed of compilation
221
+
222
+ * 14 minor enhancements:
223
+
224
+ * Improved documentation for exposed BLAS and LAPACK functions
225
+
226
+ * Allowed for use of BLAS::rot without cloning x and y (in-place
227
+ plane rotation); removed unnecessary test of unfriendly version
228
+
229
+ * Added more user-friendly cblas_xrotg implementation: BLAS::rotg
230
+
231
+ * Moved NMatrix::YaleFunctions::yale_vector_insert to
232
+ NMatrix#__yale_vector_set__, which is more consistent with
233
+ behavior
234
+
235
+ * Changed notations for protected stype-specific functions, which
236
+ now look like __stype_method_name__, e.g., __yale_vector_set__
237
+
238
+ * Added NMatrix#__list_default_value__ protected function to get
239
+ the initial (sparse) value for list matrices
240
+
241
+ * Changed behavior and names of NMatrix::YaleFunctions methods
242
+ which get column indices and cell contents by row, so that they
243
+ now expect the :keys option (like Hash#keys) instead of :array,
244
+ which doesn't make sense; name changes are as follows:
245
+ yale_row_as_sorted_set -> yale_ja_d_keys_sorted_set_at
246
+ yale_row_as_set -> yale_ja_d_keys_set_at
247
+ yale_row_as_array -> yale_ja_d_keys_at
248
+ yale_nd_row_as_sorted_set -> yale_ja_sorted_set_at
249
+ yale_nd_row_as_set -> yale_ja_set_at
250
+ yale_nd_row_as_array -> yale_ja_at
251
+ Aliases are included but will be removed without notice.
252
+
253
+ * Added NVector#sorted_indices and #binned_sorted_indices for use
254
+ when running k-nearest neighbor searches on a distance matrix
255
+
256
+ * Added NVector::logspace shortcut function (analogous to
257
+ NVector::linspace)
258
+
259
+ * Cleaned up code by removing monkey patches that we stopped using
260
+ circa v0.0.2 (Array#min, Array#max, String#constantize,
261
+ String#camelize, String#underscore)
262
+
263
+ * Re-enabled element-wise mod (%) method
264
+
265
+ * Added NMatrix::guess_dtype class method, which allows you to
266
+ figure out what dtype (roughly) should be used for any given
267
+ Ruby value (e.g., 3)
268
+
269
+ * String and nil objects in NMatrix cells are no longer outlawed
270
+ (but are not supported), provided they are of the :object dtype
271
+
272
+ * NMatrix#diag shortcut for specifying sparse matrix with a user-
273
+ specified diagonal array (by @ryanmt)
274
+
275
+ * 3 bug fixes:
276
+
277
+ * Corrected BLAS::rot bounds checking on optional n argument
278
+
279
+ * Removed BLAS::rotg and BLAS::nrm2 code for rational numbers, as
280
+ both involve a square root
281
+
282
+ * Repaired list matrix element-wise functions
283
+
data/README.rdoc CHANGED
@@ -4,7 +4,8 @@ Fast Numerical Linear Algebra Library for Ruby
4
4
 
5
5
  * {sciruby.com}[http://sciruby.com]
6
6
  * {Google+}[https://plus.google.com/109304769076178160953/posts]
7
- * {Installation guide}[http://sciruby.com/docs#installation]
7
+ * {NMatrix Installation wiki}[https://github.com/SciRuby/nmatrix/wiki/Installation]
8
+ * {SciRuby Installation guide}[http://sciruby.com/docs#installation]
8
9
 
9
10
  == Description
10
11
 
@@ -19,36 +20,26 @@ To install the latest stable version:
19
20
 
20
21
  gem install nmatrix
21
22
 
22
- However, you will need to install {ATLAS}[http://math-atlas.sourceforge.net/] with CBLAS (C interface
23
- to {BLAS}[http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms]) first. Those directions can be
24
- found {here}[https://github.com/SciRuby/nmatrix/wiki/Installation]. The requirements for NMatrix are:
23
+ However, you will need to install {ATLAS}[http://math-atlas.sourceforge.net/] with CBLAS (C interface to
24
+ {BLAS}[http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms]) first. Detailed directions can be found
25
+ {here}[https://github.com/SciRuby/nmatrix/wiki/Installation]. The requirements for NMatrix are:
25
26
 
26
27
  * ATLAS
27
- * LAPACK, probably
28
+ * LAPACK, probably ({see here for details}[https://github.com/SciRuby/nmatrix/wiki/Installation])
28
29
  * a version of GCC or clang which supports C++0x or C++11
29
30
  * Ruby 1.9+
30
31
  * {packable}[http://github.com/marcandre/packable] 1.3.5 (used for I/O)
31
32
 
32
- If you want to obtain the latest (development)code, you should do:
33
+ If you want to obtain the latest (development) code, you should generally do:
33
34
 
34
35
  git clone https://github.com/SciRuby/nmatrix.git
35
36
  cd nmatrix/
36
- rake compile
37
- rake repackage
38
- gem install pkg/nmatrix-0.0.5.gem
37
+ bundle install
38
+ bundle exec rake compile
39
+ bundle exec rake repackage
40
+ gem install pkg/nmatrix-0.0.7.gem
39
41
 
40
- If you get errors about clapack.h or cblas.h, determine where your ATLAS headers are using:
41
-
42
- locate clapack.h
43
-
44
- If you're a Mac user, we recommend you search for cblas.h instead.
45
-
46
- Then, tell your system:
47
-
48
- export C_INCLUDE_PATH=/usr/local/atlas/include
49
- export CPLUS_INCLUDE_PATH=/usr/local/atlas/include
50
-
51
- Finally, try compiling again.
42
+ Detailed instructions are available for {Mac}[https://github.com/SciRuby/nmatrix/wiki/Installation#mac-os-x] and {Linux}[https://github.com/SciRuby/nmatrix/wiki/Installation#linux].
52
43
 
53
44
  == Documentation
54
45
 
@@ -63,6 +54,7 @@ You can find the complete API documentation {on our website}[http://sciruby.com/
63
54
 
64
55
  Create a new NMatrix from a ruby array:
65
56
 
57
+ >> require 'nmatrix'
66
58
  >> NMatrix.new([2, 3], [0, 1, 2, 3, 4, 5], :int64).pp
67
59
  [0, 1, 2]
68
60
  [3, 4, 5]
@@ -87,16 +79,17 @@ Read the instructions in +CONTRIBUTING.md+ if you want to help NMatrix.
87
79
 
88
80
  == Features
89
81
 
90
- The following features exist in the current version of NMatrix (0.0.4):
82
+ The following features exist in the current version of NMatrix (0.0.6):
91
83
 
92
84
  * Matrix and vector storage containers: dense, yale, list (more to come)
93
- * Data types: uint8, int8, int16, int32, int64, float32, float64, complex64, complex128, rational64, rational128
94
- (incomplete)
85
+ * Data types: byte (uint8), int8, int16, int32, int64, float32, float64, complex64, complex128, rational64, rational128,
86
+ Ruby object
95
87
  * Conversion between storage and data types (except from-complex, and from-float-to-rational)
96
- * Element-wise operations and comparisons for dense and yale
97
- * Matrix-matrix multiplication for dense (using ATLAS) and yale
98
- * Matrix-vector multiplication for dense (using ATLAS)
99
- * Dense and list matrix slicing and referencing
88
+ * Element-wise and right-hand-scalar operations and comparisons for all matrix types
89
+ * Matrix-matrix multiplication for dense (with and without ATLAS) and yale
90
+ * Matrix-vector multiplication for dense (with and without ATLAS)
91
+ * Dense and list matrix slicing by copy and reference
92
+ * Yale matrix slicing by copy
100
93
  * Native reading and writing of dense and yale matrices
101
94
  * Optional compression for dense matrices with symmetry or triangularity: symmetric, skew, hermitian, upper, lower
102
95
  * Matlab .MAT v5 file input
@@ -121,8 +114,9 @@ The following features exist in the current version of NMatrix (0.0.4):
121
114
 
122
115
  === Planned Features (Short-to-Medium Term)
123
116
 
124
- These are features planned for NMatrix 0.1.0, our first beta.
117
+ These are features planned for NMatrix 0.1.0, our first beta:
125
118
 
119
+ * Yale matrix slicing
126
120
  * calculation of determinant (LAPACK-free), trace, and eigenvalues (characteristic polynomial)
127
121
  * exponentials and square roots
128
122
  * matrix inversions (LAPACK-free)
@@ -144,9 +138,7 @@ now.
144
138
 
145
139
  You should also be aware that NMatrix and NArray are incompatible with one another; you should not try to require both
146
140
  at the same time. Unfortunately, that causes problems with Ruby/GSL, which currently depends upon NArray. As such, we
147
- are working on a {patch for Ruby/GSL}[https://github.com/SciRuby/rb-gsl]. You can find the most recent version in
148
- {the work branch of Masaomi's fork}[https://github.com/masaomi/rb-gsl/tree/work] (not currently compiling as of this
149
- writing).
141
+ have a {fork of Ruby/GSL}[https://github.com/SciRuby/rb-gsl].
150
142
 
151
143
  == License
152
144
 
data/Rakefile CHANGED
@@ -41,7 +41,7 @@ SPECDIR = BASEDIR + 'spec'
41
41
 
42
42
  VALGRIND_OPTIONS = [
43
43
  "--tool=memcheck",
44
- "--leak-check=yes",
44
+ #"--leak-check=yes",
45
45
  "--num-callers=15",
46
46
  #"--error-limit=no",
47
47
  "--partial-loads-ok=yes",
@@ -51,6 +51,7 @@
51
51
  */
52
52
  namespace nm {
53
53
 
54
+ class RubyObject;
54
55
  template <typename IntType> class Rational;
55
56
  template <typename Type> class Complex;
56
57
 
@@ -86,6 +87,8 @@ class Complex {
86
87
  template <typename IntType, typename = typename std::enable_if<std::is_integral<IntType>::value>::type>
87
88
  inline Complex(const Rational<IntType>& other) : r(Type(other.n) / Type(other.d)), i(0) {}
88
89
 
90
+ Complex(const RubyObject& other);
91
+
89
92
  /*
90
93
  * Complex conjugate function -- creates a copy, but inverted.
91
94
  */
@@ -360,6 +363,12 @@ inline std::ostream& operator<<(std::ostream& out, const Complex<Type>& rhs) {
360
363
  return out;
361
364
  }
362
365
 
366
+ // Negative operator
367
+ template <typename IntType, typename = typename std::enable_if<std::is_integral<IntType>::value>::type>
368
+ inline Complex<IntType> operator-(const Complex<IntType>& rhs) {
369
+ return Complex<IntType>(-rhs.r, -rhs.i);
370
+ }
371
+
363
372
  } // end of namespace nm
364
373
 
365
374
  namespace std {
@@ -42,6 +42,76 @@
42
42
  * Global Variables
43
43
  */
44
44
 
45
+ namespace nm {
46
+ const char* const EWOP_OPS[nm::NUM_EWOPS] = {
47
+ "+",
48
+ "-",
49
+ "*",
50
+ "/",
51
+ "**",
52
+ "%",
53
+ "==",
54
+ "!=",
55
+ "<",
56
+ ">",
57
+ "<=",
58
+ ">="
59
+ };
60
+
61
+ const std::string EWOP_NAMES[nm::NUM_EWOPS] = {
62
+ "add",
63
+ "sub",
64
+ "mul",
65
+ "div",
66
+ "pow",
67
+ "mod",
68
+ "eqeq",
69
+ "neq",
70
+ "lt",
71
+ "gt",
72
+ "leq",
73
+ "geq"
74
+ };
75
+
76
+
77
+ template <typename Type>
78
+ Complex<Type>::Complex(const RubyObject& other) {
79
+ switch(TYPE(other.rval)) {
80
+ case T_COMPLEX:
81
+ r = NUM2DBL(rb_funcall(other.rval, rb_intern("real"), 0));
82
+ i = NUM2DBL(rb_funcall(other.rval, rb_intern("imag"), 0));
83
+ break;
84
+ case T_FLOAT:
85
+ case T_RATIONAL:
86
+ r = NUM2DBL(other.rval);
87
+ i = 0.0;
88
+ break;
89
+ default:
90
+ rb_raise(rb_eTypeError, "not sure how to convert this type of VALUE to a complex");
91
+ }
92
+ }
93
+
94
+ template <typename Type>
95
+ Rational<Type>::Rational(const RubyObject& other) {
96
+ switch (TYPE(other.rval)) {
97
+ case T_RATIONAL:
98
+ n = NUM2LONG(rb_funcall(this->rval, rb_intern("numerator"), 0));
99
+ d = NUM2LONG(rb_funcall(this->rval, rb_intern("denominator"), 0));
100
+ break;
101
+ case T_FIXNUM:
102
+ n = NUM2LONG(other.rval);
103
+ d = 1;
104
+ break;
105
+ case T_COMPLEX:
106
+ case T_FLOAT:
107
+ rb_raise(rb_eTypeError, "cannot convert float to a rational");
108
+ break;
109
+ default:
110
+ rb_raise(rb_eTypeError, "not sure how to convert this type of VALUE to a rational");
111
+ }
112
+ }
113
+
114
+ } // end of namespace nm
45
115
  extern "C" {
46
116
 
47
117
  const char* const DTYPE_NAMES[nm::NUM_DTYPES] = {
@@ -67,6 +137,7 @@ const char* const ITYPE_NAMES[nm::NUM_ITYPES] = {
67
137
  "uint64"
68
138
  };
69
139
 
140
+
70
141
  const size_t DTYPE_SIZES[nm::NUM_DTYPES] = {
71
142
  sizeof(uint8_t),
72
143
  sizeof(int8_t),
@@ -91,8 +162,8 @@ const size_t ITYPE_SIZES[nm::NUM_ITYPES] = {
91
162
  };
92
163
 
93
164
  const nm::dtype_t Upcast[nm::NUM_DTYPES][nm::NUM_DTYPES] = {
94
- { nm::BYTE, nm::INT8, nm::INT16, nm::INT32, nm::INT64, nm::FLOAT32, nm::FLOAT64, nm::COMPLEX64, nm::COMPLEX128, nm::RATIONAL32, nm::RATIONAL64, nm::RATIONAL128, nm::RUBYOBJ},
95
- { nm::INT8, nm::INT8, nm::INT16, nm::INT32, nm::INT64, nm::FLOAT32, nm::FLOAT64, nm::COMPLEX64, nm::COMPLEX128, nm::RATIONAL32, nm::RATIONAL64, nm::RATIONAL128, nm::RUBYOBJ},
165
+ { nm::BYTE, nm::INT16, nm::INT16, nm::INT32, nm::INT64, nm::FLOAT32, nm::FLOAT64, nm::COMPLEX64, nm::COMPLEX128, nm::RATIONAL32, nm::RATIONAL64, nm::RATIONAL128, nm::RUBYOBJ},
166
+ { nm::INT16, nm::INT8, nm::INT16, nm::INT32, nm::INT64, nm::FLOAT32, nm::FLOAT64, nm::COMPLEX64, nm::COMPLEX128, nm::RATIONAL32, nm::RATIONAL64, nm::RATIONAL128, nm::RUBYOBJ},
96
167
  { nm::INT16, nm::INT16, nm::INT16, nm::INT32, nm::INT64, nm::FLOAT32, nm::FLOAT64, nm::COMPLEX64, nm::COMPLEX128, nm::RATIONAL32, nm::RATIONAL64, nm::RATIONAL128, nm::RUBYOBJ},
97
168
  { nm::INT32, nm::INT32, nm::INT32, nm::INT32, nm::INT64, nm::FLOAT32, nm::FLOAT64, nm::COMPLEX64, nm::COMPLEX128, nm::RATIONAL32, nm::RATIONAL64, nm::RATIONAL128, nm::RUBYOBJ},
98
169
  { nm::INT64, nm::INT64, nm::INT64, nm::INT64, nm::INT64, nm::FLOAT32, nm::FLOAT64, nm::COMPLEX64, nm::COMPLEX128, nm::RATIONAL32, nm::RATIONAL64, nm::RATIONAL128, nm::RUBYOBJ},
@@ -170,12 +241,12 @@ void rubyval_to_cval(VALUE val, nm::dtype_t dtype, void* loc) {
170
241
  break;
171
242
 
172
243
  case RUBYOBJ:
173
- *reinterpret_cast<VALUE*>(loc) = RubyObject(val).rval;
244
+ *reinterpret_cast<VALUE*>(loc) = val;
174
245
  //rb_raise(rb_eTypeError, "Attempting a bad conversion from a Ruby value.");
175
246
  break;
176
247
 
177
248
  default:
178
- rb_raise(rb_eTypeError, "Attempting a bad conversion from a Ruby value.");
249
+ rb_raise(rb_eTypeError, "Attempting a bad conversion.");
179
250
  break;
180
251
  }
181
252
  }
@@ -224,6 +295,7 @@ nm::RubyObject rubyobj_from_cval(void* val, nm::dtype_t dtype) {
224
295
  return RubyObject(*reinterpret_cast<Rational128*>(val));
225
296
 
226
297
  default:
298
+ throw;
227
299
  rb_raise(nm_eDataTypeError, "Conversion to RubyObject requested from unknown/invalid data type (did you try to convert from a VALUE?)");
228
300
  }
229
301
  return Qnil;
@@ -254,6 +326,7 @@ nm::RubyObject rubyobj_from_cval_by_itype(void* val, nm::itype_t itype) {
254
326
  return Qnil;
255
327
  }
256
328
 
329
+
257
330
  /*
258
331
  * Allocate and return a piece of data of the correct dtype, converted from a
259
332
  * given RubyObject.
@@ -267,4 +340,5 @@ void* rubyobj_to_cval(VALUE val, nm::dtype_t dtype) {
267
340
  return ret_val;
268
341
  }
269
342
 
343
+
270
344
  } // end of extern "C" block
@@ -31,6 +31,7 @@
31
31
  /*
32
32
  * Standard Includes
33
33
  */
34
+ #include <string>
34
35
 
35
36
  /*
36
37
  * Project Includes
@@ -48,17 +49,18 @@ namespace nm {
48
49
  /*
49
50
  * Constants
50
51
  */
51
-
52
+
52
53
  const int NUM_DTYPES = 13;
53
54
  const int NUM_ITYPES = 4;
54
- const int NUM_EWOPS = 11;
55
- const int NUM_NONCOMP_EWOPS = 5;
56
-
55
+ const int NUM_EWOPS = 12;
56
+ const int NUM_NONCOMP_EWOPS = 6;
57
+
57
58
  enum ewop_t {
58
59
  EW_ADD,
59
60
  EW_SUB,
60
61
  EW_MUL,
61
62
  EW_DIV,
63
+ EW_POW,
62
64
  EW_MOD,
63
65
  EW_EQEQ,
64
66
  EW_NEQ,
@@ -67,7 +69,11 @@ namespace nm {
67
69
  EW_LEQ,
68
70
  EW_GEQ
69
71
  };
70
-
72
+
73
+ // element-wise and scalar operators
74
+ extern const char* const EWOP_OPS[nm::NUM_EWOPS];
75
+ extern const std::string EWOP_NAMES[nm::NUM_EWOPS];
76
+
71
77
  } // end of namespace nm
72
78
 
73
79
  /*
@@ -81,8 +87,8 @@ namespace nm {
81
87
  nm_yale_storage_mark \
82
88
  };
83
89
 
84
- #define STYPE_CAST_COPY_TABLE(name) \
85
- static STORAGE* (*(name)[nm::NUM_STYPES][nm::NUM_STYPES])(const STORAGE*, nm::dtype_t) = { \
90
+ #define CAST_TABLE(name) \
91
+ static STORAGE* (*(name)[nm::NUM_STYPES][nm::NUM_STYPES])(const STORAGE*, nm::dtype_t, void*) = { \
86
92
  { nm_dense_storage_cast_copy, nm_dense_storage_from_list, nm_dense_storage_from_yale }, \
87
93
  { nm_list_storage_from_dense, nm_list_storage_cast_copy, nm_list_storage_from_yale }, \
88
94
  { nm_yale_storage_from_dense, nm_yale_storage_from_list, nm_yale_storage_cast_copy } \
@@ -162,50 +168,21 @@ namespace nm {
162
168
  #define LR_DTYPE_TEMPLATE_TABLE(fun, ret, ...) NAMED_LR_DTYPE_TEMPLATE_TABLE(ttable, fun, ret, __VA_ARGS__)
163
169
 
164
170
  #define NAMED_LR_DTYPE_TEMPLATE_TABLE(name, fun, ret, ...) \
165
- static ret (*(name)[nm::NUM_DTYPES][nm::NUM_DTYPES])(__VA_ARGS__) = { \
166
- {fun<uint8_t, uint8_t>, fun<uint8_t, int8_t>, fun<uint8_t, int16_t>, fun<uint8_t, int32_t>, fun<uint8_t, int64_t>, fun<uint8_t, float32_t>, fun<uint8_t, float64_t>, \
167
- fun<uint8_t, nm::Complex64>, fun<uint8_t, nm::Complex128>, fun<uint8_t, nm::Rational32>, fun<uint8_t, nm::Rational64>, \
168
- fun<uint8_t, nm::Rational128>, NULL}, \
169
- \
170
- {fun<int8_t, uint8_t>, fun<int8_t, int8_t>, fun<int8_t, int16_t>, fun<int8_t, int32_t>, fun<int8_t, int64_t>, fun<int8_t, float32_t>, fun<int8_t, float64_t>, \
171
- fun<int8_t, nm::Complex64>, fun<int8_t, nm::Complex128>, fun<int8_t, nm::Rational32>, fun<int8_t, nm::Rational64>, fun<int8_t, nm::Rational128>, NULL}, \
172
- \
173
- {fun<int16_t, uint8_t>, fun<int16_t, int8_t>, fun<int16_t, int16_t>, fun<int16_t, int32_t>, fun<int16_t, int64_t>, fun<int16_t, float32_t>, fun<int16_t, float64_t>, \
174
- fun<int16_t, nm::Complex64>, fun<int16_t, nm::Complex128>, fun<int16_t, nm::Rational32>, fun<int16_t, nm::Rational64>, fun<int16_t, nm::Rational128>, NULL}, \
175
- \
176
- {fun<int32_t, uint8_t>, fun<int32_t, int8_t>, fun<int32_t, int16_t>, fun<int32_t, int32_t>, fun<int32_t, int64_t>, fun<int32_t, float32_t>, fun<int32_t, float64_t>, \
177
- fun<int32_t, nm::Complex64>, fun<int32_t, nm::Complex128>, fun<int32_t, nm::Rational32>, fun<int32_t, nm::Rational64>, fun<int32_t, nm::Rational128>, NULL}, \
178
- \
179
- {fun<int64_t, uint8_t>, fun<int64_t, int8_t>, fun<int64_t, int16_t>, fun<int64_t, int32_t>, fun<int64_t, int64_t>, fun<int64_t, float32_t>, fun<int64_t, float64_t>, \
180
- fun<int64_t, nm::Complex64>, fun<int64_t, nm::Complex128>, fun<int64_t, nm::Rational32>, fun<int64_t, nm::Rational64>, fun<int64_t, nm::Rational128>, NULL}, \
181
- \
182
- {fun<float32_t, uint8_t>, fun<float32_t, int8_t>, fun<float32_t, int16_t>, fun<float32_t, int32_t>, fun<float32_t, int64_t>, \
183
- fun<float32_t, float32_t>, fun<float32_t, float64_t>, fun<float32_t, nm::Complex64>, fun<float32_t, nm::Complex128>, fun<float32_t, nm::Rational32>, \
184
- fun<float32_t, nm::Rational64>, fun<float32_t, nm::Rational128>, NULL}, \
185
- \
186
- {fun<float64_t, uint8_t>, fun<float64_t, int8_t>, fun<float64_t, int16_t>, fun<float64_t, int32_t>, fun<float64_t, int64_t>, \
187
- fun<float64_t, float32_t>, fun<float64_t, float64_t>, fun<float64_t, nm::Complex64>, fun<float64_t, nm::Complex128>, fun<float64_t, nm::Rational32>, \
188
- fun<float64_t, nm::Rational64>, fun<float64_t, nm::Rational128>, NULL}, \
189
- \
190
- {fun<nm::Complex64, uint8_t>, fun<nm::Complex64, int8_t>, fun<nm::Complex64, int16_t>, fun<nm::Complex64, int32_t>, fun<nm::Complex64, int64_t>, \
191
- fun<nm::Complex64, float32_t>, fun<nm::Complex64, float64_t>, fun<nm::Complex64, nm::Complex64>, fun<nm::Complex64, nm::Complex128>, \
192
- fun<nm::Complex64, nm::Rational32>, fun<nm::Complex64, nm::Rational64>, fun<nm::Complex64, nm::Rational128>, NULL}, \
193
- \
194
- {fun<nm::Complex128, uint8_t>, fun<nm::Complex128, int8_t>, fun<nm::Complex128, int16_t>, fun<nm::Complex128, int32_t>, fun<nm::Complex128, int64_t>, \
195
- fun<nm::Complex128, float32_t>, fun<nm::Complex128, float64_t>, fun<nm::Complex128, nm::Complex64>, fun<nm::Complex128, nm::Complex128>, \
196
- fun<nm::Complex128, nm::Rational32>, fun<nm::Complex128, nm::Rational64>, fun<nm::Complex128, nm::Rational128>, NULL}, \
197
- \
198
- {fun<nm::Rational32, uint8_t>, fun<nm::Rational32, int8_t>, fun<nm::Rational32, int16_t>, fun<nm::Rational32, int32_t>, fun<nm::Rational32, int64_t>, NULL, NULL, \
199
- NULL, NULL, fun<nm::Rational32, nm::Rational32>, fun<nm::Rational32, nm::Rational64>, fun<nm::Rational32, nm::Rational128>, NULL}, \
200
- \
201
- {fun<nm::Rational64, uint8_t>, fun<nm::Rational64, int8_t>, fun<nm::Rational64, int16_t>, fun<nm::Rational64, int32_t>, fun<nm::Rational64, int64_t>, NULL, NULL, \
202
- NULL, NULL, fun<nm::Rational64, nm::Rational32>, fun<nm::Rational64, nm::Rational64>, fun<nm::Rational64, nm::Rational128>, NULL}, \
203
- \
204
- {fun<nm::Rational128, uint8_t>, fun<nm::Rational128, int8_t>, fun<nm::Rational128, int16_t>, fun<nm::Rational128, int32_t>, fun<nm::Rational128, int64_t>, NULL, \
205
- NULL, NULL, NULL, fun<nm::Rational128, nm::Rational32>, fun<nm::Rational128, nm::Rational64>, fun<nm::Rational128, nm::Rational128>, NULL}, \
206
- \
207
- {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, fun<nm::RubyObject, nm::RubyObject>} \
208
- };
171
+ static ret (*(name)[nm::NUM_DTYPES][nm::NUM_DTYPES])(__VA_ARGS__) = { \
172
+ {fun<uint8_t, uint8_t>, fun<uint8_t, int8_t>, fun<uint8_t, int16_t>, fun<uint8_t, int32_t>, fun<uint8_t, int64_t>, fun<uint8_t, float32_t>, fun<uint8_t, float64_t>, fun<uint8_t, nm::Complex64>, fun<uint8_t, nm::Complex128>, fun<uint8_t, nm::Rational32>, fun<uint8_t, nm::Rational64>, fun<uint8_t, nm::Rational128>, fun<uint8_t, nm::RubyObject>}, \
173
+ {fun<int8_t, uint8_t>, fun<int8_t, int8_t>, fun<int8_t, int16_t>, fun<int8_t, int32_t>, fun<int8_t, int64_t>, fun<int8_t, float32_t>, fun<int8_t, float64_t>, fun<int8_t, nm::Complex64>, fun<int8_t, nm::Complex128>, fun<int8_t, nm::Rational32>, fun<int8_t, nm::Rational64>, fun<int8_t, nm::Rational128>, fun<int8_t, nm::RubyObject>}, \
174
+ {fun<int16_t, uint8_t>, fun<int16_t, int8_t>, fun<int16_t, int16_t>, fun<int16_t, int32_t>, fun<int16_t, int64_t>, fun<int16_t, float32_t>, fun<int16_t, float64_t>, fun<int16_t, nm::Complex64>, fun<int16_t, nm::Complex128>, fun<int16_t, nm::Rational32>, fun<int16_t, nm::Rational64>, fun<int16_t, nm::Rational128>, fun<int16_t, nm::RubyObject>}, \
175
+ {fun<int32_t, uint8_t>, fun<int32_t, int8_t>, fun<int32_t, int16_t>, fun<int32_t, int32_t>, fun<int32_t, int64_t>, fun<int32_t, float32_t>, fun<int32_t, float64_t>, fun<int32_t, nm::Complex64>, fun<int32_t, nm::Complex128>, fun<int32_t, nm::Rational32>, fun<int32_t, nm::Rational64>, fun<int32_t, nm::Rational128>, fun<int32_t, nm::RubyObject>}, \
176
+ {fun<int64_t, uint8_t>, fun<int64_t, int8_t>, fun<int64_t, int16_t>, fun<int64_t, int32_t>, fun<int64_t, int64_t>, fun<int64_t, float32_t>, fun<int64_t, float64_t>, fun<int64_t, nm::Complex64>, fun<int64_t, nm::Complex128>, fun<int64_t, nm::Rational32>, fun<int64_t, nm::Rational64>, fun<int64_t, nm::Rational128>, fun<int64_t, nm::RubyObject>}, \
177
+ {fun<float32_t, uint8_t>, fun<float32_t, int8_t>, fun<float32_t, int16_t>, fun<float32_t, int32_t>, fun<float32_t, int64_t>, fun<float32_t, float32_t>, fun<float32_t, float64_t>, fun<float32_t, nm::Complex64>, fun<float32_t, nm::Complex128>, fun<float32_t, nm::Rational32>, fun<float32_t, nm::Rational64>, fun<float32_t, nm::Rational128>, fun<float32_t, nm::RubyObject>}, \
178
+ {fun<float64_t, uint8_t>, fun<float64_t, int8_t>, fun<float64_t, int16_t>, fun<float64_t, int32_t>, fun<float64_t, int64_t>, fun<float64_t, float32_t>, fun<float64_t, float64_t>, fun<float64_t, nm::Complex64>, fun<float64_t, nm::Complex128>, fun<float64_t, nm::Rational32>, fun<float64_t, nm::Rational64>, fun<float64_t, nm::Rational128>, fun<float64_t, nm::RubyObject>}, \
179
+ {fun<nm::Complex64, uint8_t>, fun<nm::Complex64, int8_t>, fun<nm::Complex64, int16_t>, fun<nm::Complex64, int32_t>, fun<nm::Complex64, int64_t>, fun<nm::Complex64, float32_t>, fun<nm::Complex64, float64_t>, fun<nm::Complex64, nm::Complex64>, fun<nm::Complex64, nm::Complex128>, fun<nm::Complex64, nm::Rational32>, fun<nm::Complex64, nm::Rational64>, fun<nm::Complex64, nm::Rational128>, fun<nm::Complex64, nm::RubyObject>}, \
180
+ {fun<nm::Complex128, uint8_t>, fun<nm::Complex128, int8_t>, fun<nm::Complex128, int16_t>, fun<nm::Complex128, int32_t>, fun<nm::Complex128, int64_t>, fun<nm::Complex128, float32_t>, fun<nm::Complex128, float64_t>, fun<nm::Complex128, nm::Complex64>, fun<nm::Complex128, nm::Complex128>, fun<nm::Complex128, nm::Rational32>, fun<nm::Complex128, nm::Rational64>, fun<nm::Complex128, nm::Rational128>, fun<nm::Complex128, nm::RubyObject>}, \
181
+ {fun<nm::Rational32, uint8_t>, fun<nm::Rational32, int8_t>, fun<nm::Rational32, int16_t>, fun<nm::Rational32, int32_t>, fun<nm::Rational32, int64_t>, NULL, NULL, NULL, NULL, fun<nm::Rational32, nm::Rational32>, fun<nm::Rational32, nm::Rational64>, fun<nm::Rational32, nm::Rational128>, fun<nm::Rational32, nm::RubyObject>}, \
182
+ {fun<nm::Rational64, uint8_t>, fun<nm::Rational64, int8_t>, fun<nm::Rational64, int16_t>, fun<nm::Rational64, int32_t>, fun<nm::Rational64, int64_t>, NULL, NULL, NULL, NULL, fun<nm::Rational64, nm::Rational32>, fun<nm::Rational64, nm::Rational64>, fun<nm::Rational64, nm::Rational128>, fun<nm::Rational64, nm::RubyObject>}, \
183
+ {fun<nm::Rational128, uint8_t>, fun<nm::Rational128, int8_t>, fun<nm::Rational128, int16_t>, fun<nm::Rational128, int32_t>, fun<nm::Rational128, int64_t>, NULL, NULL, NULL, NULL, fun<nm::Rational128, nm::Rational32>, fun<nm::Rational128, nm::Rational64>, fun<nm::Rational128, nm::Rational128>, fun<nm::Rational128, nm::RubyObject>}, \
184
+ {fun<nm::RubyObject, uint8_t>, fun<nm::RubyObject, int8_t>, fun<nm::RubyObject, int16_t>, fun<nm::RubyObject, int32_t>, fun<nm::RubyObject, int64_t>, fun<nm::RubyObject, float32_t>, fun<nm::RubyObject, float64_t>, fun<nm::RubyObject, nm::Complex64>, fun<nm::RubyObject, nm::Complex128>, fun<nm::RubyObject, nm::Rational32>, fun<nm::RubyObject, nm::Rational64>, fun<nm::RubyObject, nm::Rational128>, fun<nm::RubyObject, nm::RubyObject>} \
185
+ };
209
186
 
210
187
  /*
211
188
  * Defines a static array that holds function pointers to operation, and left-
@@ -427,10 +404,64 @@ namespace nm {
427
404
  {fun<nm::EW_DIV, nm::Rational128, uint8_t>, fun<nm::EW_DIV, nm::Rational128, int8_t>, fun<nm::EW_DIV, nm::Rational128, int16_t>, fun<nm::EW_DIV, nm::Rational128, int32_t>, \
428
405
  fun<nm::EW_DIV, nm::Rational128, int64_t>, NULL, NULL, NULL, NULL, fun<nm::EW_DIV, nm::Rational128, nm::Rational32>, fun<nm::EW_DIV, nm::Rational128, nm::Rational64>, \
429
406
  fun<nm::EW_DIV, nm::Rational128, nm::Rational128>, NULL}, \
430
- \
407
+ \
431
408
  {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, fun<nm::EW_DIV, nm::RubyObject, nm::RubyObject>} \
432
409
  }, \
433
- \
410
+ \
411
+ { \
412
+ {fun<nm::EW_POW, uint8_t, uint8_t>, fun<nm::EW_POW, uint8_t, int8_t>, fun<nm::EW_POW, uint8_t, int16_t>, fun<nm::EW_POW, uint8_t, int32_t>, fun<nm::EW_POW, uint8_t, int64_t>, \
413
+ fun<nm::EW_POW, uint8_t, float32_t>, fun<nm::EW_POW, uint8_t, float64_t>, fun<nm::EW_POW, uint8_t, nm::Complex64>, fun<nm::EW_POW, uint8_t, nm::Complex128>, \
414
+ fun<nm::EW_POW, uint8_t, nm::Rational32>, fun<nm::EW_POW, uint8_t, nm::Rational64>, fun<nm::EW_POW, uint8_t, nm::Rational128>, NULL}, \
415
+ \
416
+ {fun<nm::EW_POW, int8_t, uint8_t>, fun<nm::EW_POW, int8_t, int8_t>, fun<nm::EW_POW, int8_t, int16_t>, fun<nm::EW_POW, int8_t, int32_t>, fun<nm::EW_POW, int8_t, int64_t>, \
417
+ fun<nm::EW_POW, int8_t, float32_t>, fun<nm::EW_POW, int8_t, float64_t>, fun<nm::EW_POW, int8_t, nm::Complex64>, fun<nm::EW_POW, int8_t, nm::Complex128>, \
418
+ fun<nm::EW_POW, int8_t, nm::Rational32>, fun<nm::EW_POW, int8_t, nm::Rational64>, fun<nm::EW_POW, int8_t, nm::Rational128>, NULL}, \
419
+ \
420
+ {fun<nm::EW_POW, int16_t, uint8_t>, fun<nm::EW_POW, int16_t, int8_t>, fun<nm::EW_POW, int16_t, int16_t>, fun<nm::EW_POW, int16_t, int32_t>, fun<nm::EW_POW, int16_t, int64_t>, \
421
+ fun<nm::EW_POW, int16_t, float32_t>, fun<nm::EW_POW, int16_t, float64_t>, fun<nm::EW_POW, int16_t, nm::Complex64>, fun<nm::EW_POW, int16_t, nm::Complex128>, \
422
+ fun<nm::EW_POW, int16_t, nm::Rational32>, fun<nm::EW_POW, int16_t, nm::Rational64>, fun<nm::EW_POW, int16_t, nm::Rational128>, NULL}, \
423
+ \
424
+ {fun<nm::EW_POW, int32_t, uint8_t>, fun<nm::EW_POW, int32_t, int8_t>, fun<nm::EW_POW, int32_t, int16_t>, fun<nm::EW_POW, int32_t, int32_t>, fun<nm::EW_POW, int32_t, int64_t>, \
425
+ fun<nm::EW_POW, int32_t, float32_t>, fun<nm::EW_POW, int32_t, float64_t>, fun<nm::EW_POW, int32_t, nm::Complex64>, fun<nm::EW_POW, int32_t, nm::Complex128>, \
426
+ fun<nm::EW_POW, int32_t, nm::Rational32>, fun<nm::EW_POW, int32_t, nm::Rational64>, fun<nm::EW_POW, int32_t, nm::Rational128>, NULL}, \
427
+ \
428
+ {fun<nm::EW_POW, int64_t, uint8_t>, fun<nm::EW_POW, int64_t, int8_t>, fun<nm::EW_POW, int64_t, int16_t>, fun<nm::EW_POW, int64_t, int32_t>, fun<nm::EW_POW, int64_t, int64_t>, \
429
+ fun<nm::EW_POW, int64_t, float32_t>, fun<nm::EW_POW, int64_t, float64_t>, fun<nm::EW_POW, int64_t, nm::Complex64>, fun<nm::EW_POW, int64_t, nm::Complex128>, \
430
+ fun<nm::EW_POW, int64_t, nm::Rational32>, fun<nm::EW_POW, int64_t, nm::Rational64>, fun<nm::EW_POW, int64_t, nm::Rational128>, NULL}, \
431
+ \
432
+ {fun<nm::EW_POW, float32_t, uint8_t>, fun<nm::EW_POW, float32_t, int8_t>, fun<nm::EW_POW, float32_t, int16_t>, fun<nm::EW_POW, float32_t, int32_t>, fun<nm::EW_POW, float32_t, int64_t>, \
433
+ fun<nm::EW_POW, float32_t, float32_t>, fun<nm::EW_POW, float32_t, float64_t>, fun<nm::EW_POW, float32_t, nm::Complex64>, fun<nm::EW_POW, float32_t, nm::Complex128>, \
434
+ fun<nm::EW_POW, float32_t, nm::Rational32>, fun<nm::EW_POW, float32_t, nm::Rational64>, fun<nm::EW_POW, float32_t, nm::Rational128>, NULL}, \
435
+ \
436
+ {fun<nm::EW_POW, float64_t, uint8_t>, fun<nm::EW_POW, float64_t, int8_t>, fun<nm::EW_POW, float64_t, int16_t>, fun<nm::EW_POW, float64_t, int32_t>, fun<nm::EW_POW, float64_t, int64_t>, \
437
+ fun<nm::EW_POW, float64_t, float32_t>, fun<nm::EW_POW, float64_t, float64_t>, fun<nm::EW_POW, float64_t, nm::Complex64>, fun<nm::EW_POW, float64_t, nm::Complex128>, \
438
+ fun<nm::EW_POW, float64_t, nm::Rational32>, fun<nm::EW_POW, float64_t, nm::Rational64>, fun<nm::EW_POW, float64_t, nm::Rational128>, NULL}, \
439
+ \
440
+ {fun<nm::EW_POW, nm::Complex64, uint8_t>, fun<nm::EW_POW, nm::Complex64, int8_t>, fun<nm::EW_POW, nm::Complex64, int16_t>, fun<nm::EW_POW, nm::Complex64, int32_t>, \
441
+ fun<nm::EW_POW, nm::Complex64, int64_t>, fun<nm::EW_POW, nm::Complex64, float32_t>, fun<nm::EW_POW, nm::Complex64, float64_t>, fun<nm::EW_POW, nm::Complex64, nm::Complex64>, \
442
+ fun<nm::EW_POW, nm::Complex64, nm::Complex128>, fun<nm::EW_POW, nm::Complex64, nm::Rational32>, fun<nm::EW_POW, nm::Complex64, nm::Rational64>, \
443
+ fun<nm::EW_POW, nm::Complex64, nm::Rational128>, NULL}, \
444
+ \
445
+ {fun<nm::EW_POW, nm::Complex128, uint8_t>, fun<nm::EW_POW, nm::Complex128, int8_t>, fun<nm::EW_POW, nm::Complex128, int16_t>, fun<nm::EW_POW, nm::Complex128, int32_t>, \
446
+ fun<nm::EW_POW, nm::Complex128, int64_t>, fun<nm::EW_POW, nm::Complex128, float32_t>, fun<nm::EW_POW, nm::Complex128, float64_t>, fun<nm::EW_POW, nm::Complex128, nm::Complex64>, \
447
+ fun<nm::EW_POW, nm::Complex128, nm::Complex128>, fun<nm::EW_POW, nm::Complex128, nm::Rational32>, fun<nm::EW_POW, nm::Complex128, nm::Rational64>, \
448
+ fun<nm::EW_POW, nm::Complex128, nm::Rational128>, NULL}, \
449
+ \
450
+ {fun<nm::EW_POW, nm::Rational32, uint8_t>, fun<nm::EW_POW, nm::Rational32, int8_t>, fun<nm::EW_POW, nm::Rational32, int16_t>, fun<nm::EW_POW, nm::Rational32, int32_t>, \
451
+ fun<nm::EW_POW, nm::Rational32, int64_t>, NULL, NULL, NULL, NULL, fun<nm::EW_POW, nm::Rational32, nm::Rational32>, fun<nm::EW_POW, nm::Rational32, nm::Rational64>, \
452
+ fun<nm::EW_POW, nm::Rational32, nm::Rational128>, NULL}, \
453
+ \
454
+ {fun<nm::EW_POW, nm::Rational64, uint8_t>, fun<nm::EW_POW, nm::Rational64, int8_t>, fun<nm::EW_POW, nm::Rational64, int16_t>, fun<nm::EW_POW, nm::Rational64, int32_t>, \
455
+ fun<nm::EW_POW, nm::Rational64, int64_t>, NULL, NULL, NULL, NULL, fun<nm::EW_POW, nm::Rational64, nm::Rational32>, fun<nm::EW_POW, nm::Rational64, nm::Rational64>, \
456
+ fun<nm::EW_POW, nm::Rational64, nm::Rational128>, NULL}, \
457
+ \
458
+ {fun<nm::EW_POW, nm::Rational128, uint8_t>, fun<nm::EW_POW, nm::Rational128, int8_t>, fun<nm::EW_POW, nm::Rational128, int16_t>, fun<nm::EW_POW, nm::Rational128, int32_t>, \
459
+ fun<nm::EW_POW, nm::Rational128, int64_t>, NULL, NULL, NULL, NULL, fun<nm::EW_POW, nm::Rational128, nm::Rational32>, fun<nm::EW_POW, nm::Rational128, nm::Rational64>, \
460
+ fun<nm::EW_POW, nm::Rational128, nm::Rational128>, NULL}, \
461
+ \
462
+ {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, fun<nm::EW_POW, nm::RubyObject, nm::RubyObject>} \
463
+ }, \
464
+ \
434
465
  { \
435
466
  {fun<nm::EW_MOD, uint8_t, uint8_t>, fun<nm::EW_MOD, uint8_t, int8_t>, fun<nm::EW_MOD, uint8_t, int16_t>, fun<nm::EW_MOD, uint8_t, int32_t>, fun<nm::EW_MOD, uint8_t, int64_t>, \
436
467
  fun<nm::EW_MOD, uint8_t, float32_t>, fun<nm::EW_MOD, uint8_t, float64_t>, fun<nm::EW_MOD, uint8_t, nm::Complex64>, fun<nm::EW_MOD, uint8_t, nm::Complex128>, \
@@ -481,7 +512,7 @@ namespace nm {
481
512
  {fun<nm::EW_MOD, nm::Rational128, uint8_t>, fun<nm::EW_MOD, nm::Rational128, int8_t>, fun<nm::EW_MOD, nm::Rational128, int16_t>, fun<nm::EW_MOD, nm::Rational128, int32_t>, \
482
513
  fun<nm::EW_MOD, nm::Rational128, int64_t>, NULL, NULL, NULL, NULL, fun<nm::EW_MOD, nm::Rational128, nm::Rational32>, fun<nm::EW_MOD, nm::Rational128, nm::Rational64>, \
483
514
  fun<nm::EW_MOD, nm::Rational128, nm::Rational128>, NULL}, \
484
- \
515
+ \
485
516
  {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, fun<nm::EW_MOD, nm::RubyObject, nm::RubyObject>} \
486
517
  }, \
487
518
  \
@@ -734,6 +765,7 @@ extern const size_t ITYPE_SIZES[nm::NUM_ITYPES];
734
765
 
735
766
  extern const nm::dtype_t Upcast[nm::NUM_DTYPES][nm::NUM_DTYPES];
736
767
 
768
+
737
769
  /*
738
770
  * Functions
739
771
  */