Sha256: 390df96c2748434d9bdea2d105dd37505dbb4fa2c3b189ecad7e2bdf02ed8c27

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

class Array
  def daru_lite_vector(name = nil, index = nil, dtype = :array)
    DaruLite::Vector.new self, name: name, index: index, dtype: dtype
  end

  alias dv daru_lite_vector

  def to_index
    DaruLite::Index.new self
  end
end

class Range
  def daru_lite_vector(name = nil, index = nil, dtype = :array)
    DaruLite::Vector.new self, name: name, index: index, dtype: dtype
  end

  alias dv daru_lite_vector

  def to_index
    DaruLite::Index.new to_a
  end
end

class Hash
  def daru_lite_vector(index = nil, dtype = :array)
    DaruLite::Vector.new values[0], name: keys[0], index: index, dtype: dtype
  end

  alias dv daru_lite_vector
end

class MDArray
  def daru_lite_vector(name = nil, index = nil, *)
    DaruLite::Vector.new self, name: name, index: index, dtype: :mdarray
  end

  alias dv daru_lite_vector
end

class Matrix
  def elementwise_division(other)
    map.with_index do |e, index|
      e / other.to_a.flatten[index]
    end
  end
end

class Object
  if RUBY_VERSION < '2.2'
    def itself
      self
    end
  end
end
# :nocov:

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
daru_lite-0.1.3 lib/daru_lite/monkeys.rb
daru_lite-0.1.2 lib/daru_lite/monkeys.rb
daru_lite-0.1.1 lib/daru_lite/monkeys.rb
daru_lite-0.1 lib/daru_lite/monkeys.rb