numo-narray 0.9.0.3 → 0.9.0.4

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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -6
  3. data/Rakefile +2 -10
  4. data/ext/numo/narray/array.c +1 -6
  5. data/ext/numo/narray/data.c +3 -9
  6. data/ext/numo/narray/depend.erb +1 -1
  7. data/ext/numo/narray/extconf.rb +0 -1
  8. data/ext/numo/narray/gen/def/bit.rb +2 -0
  9. data/ext/numo/narray/gen/def/dcomplex.rb +2 -0
  10. data/ext/numo/narray/gen/def/dfloat.rb +2 -0
  11. data/ext/numo/narray/gen/def/int16.rb +2 -0
  12. data/ext/numo/narray/gen/def/int32.rb +2 -0
  13. data/ext/numo/narray/gen/def/int64.rb +2 -0
  14. data/ext/numo/narray/gen/def/int8.rb +2 -0
  15. data/ext/numo/narray/gen/def/robject.rb +2 -0
  16. data/ext/numo/narray/gen/def/scomplex.rb +2 -0
  17. data/ext/numo/narray/gen/def/sfloat.rb +2 -0
  18. data/ext/numo/narray/gen/def/uint16.rb +2 -0
  19. data/ext/numo/narray/gen/def/uint32.rb +2 -0
  20. data/ext/numo/narray/gen/def/uint64.rb +2 -0
  21. data/ext/numo/narray/gen/def/uint8.rb +2 -0
  22. data/ext/numo/narray/gen/dtype.erb.c +7 -7
  23. data/ext/numo/narray/gen/spec.rb +24 -2
  24. data/ext/numo/narray/gen/tmpl/accum_binary.c +6 -0
  25. data/ext/numo/narray/gen/tmpl/aref.c +6 -4
  26. data/ext/numo/narray/gen/tmpl/aset.c +6 -4
  27. data/ext/numo/narray/gen/tmpl/binary.c +4 -0
  28. data/ext/numo/narray/gen/tmpl/binary2.c +4 -0
  29. data/ext/numo/narray/gen/tmpl/bincount.c +180 -0
  30. data/ext/numo/narray/gen/tmpl/cast.c +4 -0
  31. data/ext/numo/narray/gen/tmpl/cast_array.c +3 -64
  32. data/ext/numo/narray/gen/tmpl/cond_binary.c +4 -0
  33. data/ext/numo/narray/gen/tmpl/inspect.c +4 -0
  34. data/ext/numo/narray/gen/tmpl/pow.c +4 -0
  35. data/ext/numo/narray/gen/tmpl/qsort.c +1 -7
  36. data/ext/numo/narray/gen/tmpl/rand.c +13 -2
  37. data/ext/numo/narray/gen/tmpl/rand_norm.c +89 -16
  38. data/ext/numo/narray/gen/tmpl/store.c +4 -0
  39. data/ext/numo/narray/gen/tmpl/store_array.c +99 -2
  40. data/ext/numo/narray/gen/tmpl_bit/allocate.c +1 -1
  41. data/ext/numo/narray/gen/tmpl_bit/aref.c +6 -4
  42. data/ext/numo/narray/gen/tmpl_bit/aset.c +6 -4
  43. data/ext/numo/narray/gen/tmpl_bit/cast_array.c +3 -65
  44. data/ext/numo/narray/gen/tmpl_bit/mask.c +16 -1
  45. data/ext/numo/narray/gen/tmpl_bit/store_array.c +101 -2
  46. data/ext/numo/narray/gen/tmpl_bit/where.c +7 -23
  47. data/ext/numo/narray/gen/tmpl_bit/where2.c +58 -4
  48. data/ext/numo/narray/index.c +168 -166
  49. data/ext/numo/narray/kwarg.c +1 -6
  50. data/ext/numo/narray/math.c +8 -12
  51. data/ext/numo/narray/narray.c +231 -71
  52. data/ext/numo/narray/ndloop.c +86 -26
  53. data/ext/numo/narray/numo/intern.h +6 -10
  54. data/ext/numo/narray/numo/narray.h +83 -54
  55. data/ext/numo/narray/numo/ndloop.h +0 -5
  56. data/ext/numo/narray/numo/template.h +0 -5
  57. data/ext/numo/narray/numo/types/complex.h +1 -6
  58. data/ext/numo/narray/numo/types/complex_macro.h +30 -3
  59. data/ext/numo/narray/numo/types/dcomplex.h +18 -0
  60. data/ext/numo/narray/numo/types/dfloat.h +18 -0
  61. data/ext/numo/narray/numo/types/float_macro.h +25 -2
  62. data/ext/numo/narray/numo/types/robj_macro.h +2 -4
  63. data/ext/numo/narray/numo/types/scomplex.h +18 -0
  64. data/ext/numo/narray/numo/types/sfloat.h +18 -0
  65. data/ext/numo/narray/rand.c +0 -15
  66. data/ext/numo/narray/step.c +0 -5
  67. data/ext/numo/narray/struct.c +7 -12
  68. data/lib/erbpp/line_number.rb +4 -4
  69. data/lib/erbpp/narray_def.rb +16 -7
  70. data/lib/numo/narray.rb +2 -0
  71. data/lib/numo/narray/extra.rb +465 -0
  72. data/numo-narray.gemspec +2 -2
  73. data/spec/narray_spec.rb +4 -3
  74. metadata +13 -7
  75. data/ext/numo/narray/gen/tmpl/head.c +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74f41e5ff035eb49ec0110722546783161a6fe34
4
- data.tar.gz: 33bbc3eb268834b15aaa646ca2973efe7061da14
3
+ metadata.gz: 344742df38a815d85e70962da4cdb85969d816a2
4
+ data.tar.gz: 6da0a54faee1813628901213587213618ce696bc
5
5
  SHA512:
6
- metadata.gz: 360c0c2e95a630ff7fd73adc08df094fe4d3d19072a98fc42cc1e781a1453eaf1c6d5c405db283d0dc744904407fe1e34e3fe97cf133468f751797c69f512133
7
- data.tar.gz: 9025c1c48a50ddde9fd7bd8d86491165c9cf7cb373efeedf000799a2cf56e24ab21dfe6e4fa0d649fdd35c677c0de725fcf9b4588d8db6dac6a535c0b699e9c7
6
+ metadata.gz: 908a26721c4d03e7af632747cce53ba41465d6e2917dbb97505a04ab9d8008c6764889bc669d79d83952b36a21467f7d8c8913046cc46ebf8cda23e792d62f9f
7
+ data.tar.gz: caa3d25b088c2ab5376ee64daf88581e9eeb64a9febd6456a3780ce05b0535c065867a6f9a64913db96cf422a38843c1d1800f3d53bcb5417f773af42ca123fe
data/README.md CHANGED
@@ -3,6 +3,14 @@
3
3
  [![Binder](http://mybinder.org/badge.svg)](http://mybinder.org/repo/ruby-numo/narray)
4
4
  [![Build Status](https://travis-ci.org/ruby-numo/narray.svg?branch=master)](https://travis-ci.org/ruby-numo/narray)
5
5
 
6
+ [GitHub](https://github.com/ruby-numo/narray)
7
+ | [RubyGems](https://rubygems.org/gems/numo-narray)
8
+
9
+ Numo::NArray is an Numerical N-dimensional Array class
10
+ for fast processing and easy manipulation of multi-dimensional numerical data,
11
+ similar to numpy.ndaray.
12
+ This project is the successor to [Ruby/NArray](http://masa16.github.io/narray/).
13
+
6
14
  under development
7
15
 
8
16
  ## Related Projects
@@ -12,13 +20,11 @@ under development
12
20
  * [Numo::Gnuplot](https://github.com/ruby-numo/gnuplot) - Simple and easy-to-use Gnuplot interface.
13
21
 
14
22
  ## Installation
15
- ### Ubuntu, Debian
23
+ ### Ubuntu, Debian, Bash on Windows
16
24
  ```shell
17
25
  apt install -y git ruby gcc ruby-dev rake make
18
- git clone git://github.com/ruby-numo/narray
19
- cd narray
20
- gem build numo-narray.gemspec
21
- gem install numo-narray-0.9.0.2.gem
26
+ gem install specific_install
27
+ gem specific_install https://github.com/ruby-numo/narray.git
22
28
  ```
23
29
 
24
30
  ## Quick start
@@ -40,7 +46,7 @@ An example
40
46
  [6] pry(main)> a.size
41
47
  => 15
42
48
  ```
43
- For more examples, check out this [narray version of 100 numpy exercises](https://github.com/ruby-numo/narray/wiki/100-narray-exercises).
49
+ For more examples, check out this [narray version of 100 numpy exercises](https://github.com/ruby-numo/narray/wiki/100-narray-exercises) (and the [IRuby Notebook](https://github.com/ruby-numo/narray/blob/master/100-narray-exercises.ipynb)).
44
50
 
45
51
  ## Documentation
46
52
 
data/Rakefile CHANGED
@@ -22,8 +22,6 @@ namespace :build do
22
22
 
23
23
  desc "Build gems for Windows into the pkg directory"
24
24
  task :windows => pkg_dir do
25
- ruby_versions = "2.1.6:2.2.2:2.3.0"
26
-
27
25
  build_dir = "tmp/windows"
28
26
  rm_rf build_dir
29
27
  mkdir_p build_dir
@@ -32,7 +30,7 @@ namespace :build do
32
30
  ["git", "clone", "file://#{Dir.pwd}/.git", build_dir],
33
31
  ["cd", build_dir],
34
32
  ["bundle"],
35
- ["rake", "cross", "native", "gem", "RUBY_CC_VERSION=#{ruby_versions}"],
33
+ ["rake", "cross", "native", "gem"],
36
34
  ]
37
35
  raw_commands = commands.collect do |command|
38
36
  Shellwords.join(command)
@@ -44,16 +42,10 @@ namespace :build do
44
42
  cp(Dir.glob("#{build_dir}/#{pkg_dir}/*.gem"),
45
43
  "#{pkg_dir}/")
46
44
  end
47
-
48
- windows_gem_paths.each do |path|
49
- file path do
50
- Rake::Task["build:windows"].invoke
51
- end
52
- end
53
45
  end
54
46
 
55
47
  namespace :release do
56
- task :windows => windows_gem_paths do
48
+ task :windows => "build:windows" do
57
49
  windows_gem_paths.each do |path|
58
50
  ruby("-S", "gem", "push", path)
59
51
  end
@@ -2,11 +2,6 @@
2
2
  array.c
3
3
  Numerical Array Extension for Ruby
4
4
  (C) Copyright 1999-2016 by Masahiro TANAKA
5
-
6
- This program is free software.
7
- You can distribute/modify this program
8
- under the same terms as Ruby itself.
9
- NO WARRANTY.
10
5
  */
11
6
  #include <ruby.h>
12
7
  #include "numo/narray.h"
@@ -120,7 +115,7 @@ void na_mdai_object_type(na_mdai_t *mdai, VALUE v)
120
115
  if (NIL_P(mdai->na_type)) {
121
116
  mdai->na_type = CLASS_OF(v);
122
117
  } else {
123
- mdai->na_type = na_upcast(CLASS_OF(v), CLASS_OF(mdai->na_type));
118
+ mdai->na_type = na_upcast(CLASS_OF(v), mdai->na_type);
124
119
  }
125
120
  } else if (rb_obj_is_kind_of(v, rb_cRange)) {
126
121
  MDAI_ATTR_TYPE(mdai->type,v,"begin");
@@ -2,11 +2,6 @@
2
2
  data.c
3
3
  Numerical Array Extension for Ruby
4
4
  (C) Copyright 1999-2016 by Masahiro TANAKA
5
-
6
- This program is free software.
7
- You can distribute/modify this program
8
- under the same terms as Ruby itself.
9
- NO WARRANTY.
10
5
  */
11
6
 
12
7
  #include <ruby.h>
@@ -119,7 +114,7 @@ nary_swap_byte(VALUE self)
119
114
  if (self!=v) {
120
115
  na_copy_flags(self, v);
121
116
  }
122
- REVERSE_BYTE_SWAPPED(v);
117
+ REVERSE_ENDIAN(v);
123
118
  return v;
124
119
  }
125
120
 
@@ -127,7 +122,7 @@ nary_swap_byte(VALUE self)
127
122
  static VALUE
128
123
  nary_to_network(VALUE self)
129
124
  {
130
- if (TEST_NETWORK_ORDER(self)) {
125
+ if (TEST_BIG_ENDIAN(self)) {
131
126
  return self;
132
127
  }
133
128
  return rb_funcall(self, rb_intern("swap_byte"), 0);
@@ -136,7 +131,7 @@ nary_to_network(VALUE self)
136
131
  static VALUE
137
132
  nary_to_vacs(VALUE self)
138
133
  {
139
- if (TEST_VACS_ORDER(self)) {
134
+ if (TEST_LITTLE_ENDIAN(self)) {
140
135
  return self;
141
136
  }
142
137
  return rb_funcall(self, rb_intern("swap_byte"), 0);
@@ -906,7 +901,6 @@ Init_nary_data()
906
901
  #else
907
902
  #ifdef WORDS_BIGENDIAN
908
903
  #else // LITTLE_ENDIAN
909
- rb_define_alias(cNArray, "hton", "swap_byte");
910
904
  rb_define_alias(cNArray, "hton", "swap_byte");
911
905
  rb_define_alias(cNArray, "network_order?", "byte_swapped?");
912
906
  rb_define_alias(cNArray, "little_endian?", "host_order?");
@@ -13,7 +13,7 @@ TAGS : $(TAGSRC)
13
13
  doc :
14
14
  yard doc *.c types/*.c
15
15
 
16
- C_TMPL = <%=Dir.glob("#{__dir__}/gen/tmpl/*.c").join(" ")%>
16
+ C_TMPL = <%=Dir.glob("#{__dir__}/gen/tmpl*/*.c").join(" ")%>
17
17
 
18
18
  COGEN = <%= __dir__ %>/gen/cogen.rb
19
19
  DTYPE = <%= __dir__ %>/gen/dtype.erb.c
@@ -79,7 +79,6 @@ end
79
79
  have_func("exp10")
80
80
 
81
81
  have_var("rb_cComplex")
82
- have_var("rb_cFixnum")
83
82
 
84
83
  $objs = srcs.collect{|i| i+".o"}
85
84
 
@@ -6,11 +6,13 @@ template_dir "tmpl_bit"
6
6
  has_math false
7
7
  is_bit true
8
8
  is_int false
9
+ is_unsigned true
9
10
  is_float false
10
11
  is_complex false
11
12
  is_object false
12
13
  is_real false
13
14
  is_comparable false
15
+ is_double_precision false
14
16
 
15
17
  upcast_rb "Integer"
16
18
  upcast_rb "Float", "DFloat"
@@ -7,11 +7,13 @@ real_ctype "double"
7
7
  has_math true
8
8
  is_bit false
9
9
  is_int false
10
+ is_unsigned false
10
11
  is_float true
11
12
  is_real false
12
13
  is_complex true
13
14
  is_object false
14
15
  is_comparable false
16
+ is_double_precision true
15
17
 
16
18
  upcast_rb "Integer"
17
19
  upcast_rb "Float"
@@ -5,11 +5,13 @@ ctype "double"
5
5
  has_math true
6
6
  is_bit false
7
7
  is_int false
8
+ is_unsigned false
8
9
  is_float true
9
10
  is_complex false
10
11
  is_object false
11
12
  is_real true
12
13
  is_comparable true
14
+ is_double_precision true
13
15
 
14
16
  upcast_rb "Integer"
15
17
  upcast_rb "Float"
@@ -4,11 +4,13 @@ ctype "int16_t"
4
4
  has_math false
5
5
  is_bit false
6
6
  is_int true
7
+ is_unsigned false
7
8
  is_float false
8
9
  is_complex false
9
10
  is_object false
10
11
  is_real true
11
12
  is_comparable true
13
+ is_double_precision false
12
14
 
13
15
  upcast_rb "Integer"
14
16
  upcast_rb "Float", "DFloat"
@@ -4,11 +4,13 @@ ctype "int32_t"
4
4
  has_math false
5
5
  is_bit false
6
6
  is_int true
7
+ is_unsigned false
7
8
  is_float false
8
9
  is_complex false
9
10
  is_object false
10
11
  is_real true
11
12
  is_comparable true
13
+ is_double_precision false
12
14
 
13
15
  upcast_rb "Integer"
14
16
  upcast_rb "Float", "DFloat"
@@ -4,11 +4,13 @@ ctype "int64_t"
4
4
  has_math false
5
5
  is_bit false
6
6
  is_int true
7
+ is_unsigned false
7
8
  is_float false
8
9
  is_complex false
9
10
  is_object false
10
11
  is_real true
11
12
  is_comparable true
13
+ is_double_precision false
12
14
 
13
15
  upcast_rb "Integer"
14
16
  upcast_rb "Float", "DFloat"
@@ -4,11 +4,13 @@ ctype "int8_t"
4
4
  has_math false
5
5
  is_bit false
6
6
  is_int true
7
+ is_unsigned false
7
8
  is_float false
8
9
  is_complex false
9
10
  is_object false
10
11
  is_real true
11
12
  is_comparable true
13
+ is_double_precision false
12
14
 
13
15
  upcast_rb "Integer"
14
16
  upcast_rb "Float", "DFloat"
@@ -6,11 +6,13 @@ real_ctype "VALUE"
6
6
  has_math false
7
7
  is_bit false
8
8
  is_int true
9
+ is_unsigned false
9
10
  is_float true
10
11
  is_real true
11
12
  is_complex false
12
13
  is_object true
13
14
  is_comparable true
15
+ is_double_precision false
14
16
 
15
17
  upcast_rb "Integer"
16
18
  upcast_rb "Float"
@@ -7,11 +7,13 @@ real_ctype "float"
7
7
  has_math true
8
8
  is_bit false
9
9
  is_int false
10
+ is_unsigned false
10
11
  is_float true
11
12
  is_real false
12
13
  is_complex true
13
14
  is_object false
14
15
  is_comparable false
16
+ is_double_precision false
15
17
 
16
18
  upcast_rb "Integer"
17
19
  upcast_rb "Float"
@@ -5,11 +5,13 @@ ctype "float"
5
5
  has_math true
6
6
  is_bit false
7
7
  is_int false
8
+ is_unsigned false
8
9
  is_float true
9
10
  is_complex false
10
11
  is_object false
11
12
  is_real true
12
13
  is_comparable true
14
+ is_double_precision false
13
15
 
14
16
  upcast_rb "Integer"
15
17
  upcast_rb "Float"
@@ -4,11 +4,13 @@ ctype "u_int16_t"
4
4
  has_math false
5
5
  is_bit false
6
6
  is_int true
7
+ is_unsigned true
7
8
  is_float false
8
9
  is_complex false
9
10
  is_object false
10
11
  is_real true
11
12
  is_comparable true
13
+ is_double_precision false
12
14
 
13
15
  upcast_rb "Integer"
14
16
  upcast_rb "Float", "DFloat"
@@ -4,11 +4,13 @@ ctype "u_int32_t"
4
4
  has_math false
5
5
  is_bit false
6
6
  is_int true
7
+ is_unsigned true
7
8
  is_float false
8
9
  is_complex false
9
10
  is_object false
10
11
  is_real true
11
12
  is_comparable true
13
+ is_double_precision false
12
14
 
13
15
  upcast_rb "Integer"
14
16
  upcast_rb "Float", "DFloat"
@@ -4,11 +4,13 @@ ctype "u_int64_t"
4
4
  has_math false
5
5
  is_bit false
6
6
  is_int true
7
+ is_unsigned true
7
8
  is_float false
8
9
  is_complex false
9
10
  is_object false
10
11
  is_real true
11
12
  is_comparable true
13
+ is_double_precision false
12
14
 
13
15
  upcast_rb "Integer"
14
16
  upcast_rb "Float", "DFloat"
@@ -4,11 +4,13 @@ ctype "u_int8_t"
4
4
  has_math false
5
5
  is_bit false
6
6
  is_int true
7
+ is_unsigned true
7
8
  is_float false
8
9
  is_complex false
9
10
  is_object false
10
11
  is_real true
11
12
  is_comparable true
13
+ is_double_precision false
12
14
 
13
15
  upcast_rb "Integer"
14
16
  upcast_rb "Float", "DFloat"
@@ -2,11 +2,6 @@
2
2
  <%=type_name%>.c
3
3
  Numerical Array Extension for Ruby
4
4
  (C) Copyright 1999-2011,2013-2016 by Masahiro TANAKA
5
-
6
- This program is free software.
7
- You can distribute/modify this program
8
- under the same terms as Ruby itself.
9
- NO WARRANTY.
10
5
  */
11
6
 
12
7
  #include <ruby.h>
@@ -65,8 +60,13 @@ Init_nary_<%=tp%>()
65
60
  rb_define_singleton_method(cT, "[]", <%=cast_func%>, -2);
66
61
 
67
62
  <% if is_object %>
68
- rb_undef_method(rb_singleton_class(cT),"from_string");
69
- rb_undef_method(cT,"to_string");
63
+ rb_undef_method(rb_singleton_class(cT),"from_binary");
64
+ rb_undef_method(cT,"to_binary");
65
+ rb_undef_method(cT,"swap_byte");
66
+ rb_undef_method(cT,"to_network");
67
+ rb_undef_method(cT,"to_vacs");
68
+ rb_undef_method(cT,"to_host");
69
+ rb_undef_method(cT,"to_swapped");
70
70
  <% end %>
71
71
 
72
72
  <% Function.definitions.each do |x| %>
@@ -13,6 +13,7 @@ else
13
13
  end
14
14
  if is_float
15
15
  def_id "nearly_eq"
16
+ def_id "copysign"
16
17
  end
17
18
  if is_comparable
18
19
  def_id "gt"
@@ -36,6 +37,8 @@ if is_object
36
37
  def_id "nan?"
37
38
  def_id "infinite?"
38
39
  def_id "finite?"
40
+ def_id "==","op_eq"
41
+ def_id "!=","op_ne"
39
42
  def_id ">" ,"op_gt"
40
43
  def_id ">=","op_ge"
41
44
  def_id "<" ,"op_lt"
@@ -43,6 +46,10 @@ if is_object
43
46
  def_id "<=>","op_ufo"
44
47
  end
45
48
 
49
+ if is_int && !is_object
50
+ def_id "minlength" # for bincount
51
+ end
52
+
46
53
  # Allocation
47
54
 
48
55
  if is_object
@@ -54,8 +61,6 @@ def_method "allocate", 0
54
61
 
55
62
  def_method "extract", 0
56
63
  store_numeric
57
- cast_array
58
- store_array
59
64
  store_bit "Bit"
60
65
  if is_complex
61
66
  store_from "DComplex","dcomplex","m_from_dcomplex"
@@ -72,6 +77,11 @@ store_from "UInt32","u_int32_t","m_from_real"
72
77
  store_from "UInt16","u_int16_t","m_from_real"
73
78
  store_from "UInt8", "u_int8_t", "m_from_real"
74
79
 
80
+ store_from "RObject", "VALUE", "m_num_to_data"
81
+
82
+ store_array
83
+ cast_array
84
+
75
85
  def_method "store", 1
76
86
  def_singleton "cast", 1
77
87
 
@@ -101,6 +111,7 @@ if is_bit
101
111
  binary "eq"
102
112
  bit_count "count_true"
103
113
  def_alias "count_1","count_true"
114
+ def_alias "count","count_true"
104
115
  bit_count "count_false"
105
116
  def_alias "count_0","count_false"
106
117
  bit_reduce "all?", 1
@@ -187,6 +198,7 @@ if is_float
187
198
  unary "trunc"
188
199
  if !is_object
189
200
  unary "rint"
201
+ binary "copysign"
190
202
  end
191
203
  end
192
204
 
@@ -211,6 +223,9 @@ end
211
223
 
212
224
  accum "sum","dtype","cT"
213
225
  accum "prod","dtype","cT"
226
+ if is_double_precision
227
+ accum "kahan_sum","dtype","cT"
228
+ end
214
229
 
215
230
  if is_float
216
231
  accum "mean","dtype","cT"
@@ -227,6 +242,10 @@ if is_comparable
227
242
  def_method "minmax",-1
228
243
  end
229
244
 
245
+ if is_int && !is_object
246
+ def_method "bincount",-1
247
+ end
248
+
230
249
  cum "cumsum","add"
231
250
  cum "cumprod","mul"
232
251
 
@@ -247,6 +266,9 @@ def_method "eye",-1
247
266
  def_alias "indgen", "seq"
248
267
 
249
268
  def_method "rand", -1
269
+ if is_float && !is_object
270
+ def_method "rand_norm", -1
271
+ end
250
272
 
251
273
  # y = a[0] + a[1]*x + a[2]*x^2 + a[3]*x^3 + ... + a[n]*x^n
252
274
  def_method "poly",-2