Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/mext/array/fill.rb,
lib/mext/array/dotop.rb,
lib/mext/array/choose.rb,
lib/mext/array/scalarop.rb,
lib/mext/array/vectorize.rb
Direct Known Subclasses
Defined Under Namespace
Classes: SizeMismatch
Constant Summary collapse
- MINIMUM_STEP =
fill_float(end_value, start_value = 0.0, step = 1.0)
fill a blank newly created array with
Float
numbers which will range fromstart_value
toend_value
in steps ofstep
1e-32
- DOT_OPERATIONS =
{ :dotplus => :+, :dotminus => :-, :dotmul => :*, :dotdiv => :/, :dotmod => :%, :dotpow => :**, :dotaddsemi => :addsemi, }
- SCALAR_OPERATIONS =
modifying the behaviour of scalar multiplication for Arrays has the unintended side-effect of killing any File.join() path which contains a [‘..’] * n idiomatic figure.
Better not tamper with it and use another name
[ :+, :-, ]
- SCALAR_NEW_OPERATIONS =
[ :smul, :/, :%, :**, ]
Class Method Summary collapse
Instance Method Summary collapse
-
#choose ⇒ Object
choose
: choose a random element in the array.
Class Method Details
.fill_float(end_value, start_value = 0.0, step = 1.0) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/mext/array/fill.rb', line 13 def fill_float(end_value, start_value = 0.0, step = 1.0) raise ArgumentError.new("step too small") unless step.abs > MINIMUM_STEP res = new ev = end_value - step start_value.step(ev, step).each { |f| res << f } res end |