Sha256: 61ec23ffb1087d417ceed718798a9a7bc3eaeefbfae6ea5d6847ad607d8d2590
Contents?: true
Size: 536 Bytes
Versions: 4
Compression:
Stored size: 536 Bytes
Contents
class Palette module Helper module Fallback module_function def linspace(x1, x2, n=100) d = x2 - x1 step = d / (n-1).to_f n.times.map {|i| x1 + i*step } end end begin require 'numo/narray' rescue LoadError end if defined?(Numo) module_function def linspace(x1, x2, *rest) Numo::DFloat.linspace(x1, x2, *rest).to_a end else module_function def linspace(x1, x2, *rest) Fallback.linspace(x1, x2, *rest) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
red-palette-0.5.0 | lib/palette/helper.rb |
red-palette-0.4.0 | lib/palette/helper.rb |
red-palette-0.3.0 | lib/palette/helper.rb |
red-palette-0.2.0 | lib/palette/helper.rb |