ruby-numo / numo-narray

Ruby/Numo::NArray - New NArray class library
http://ruby-numo.github.io/narray/
BSD 3-Clause "New" or "Revised" License
415 stars 41 forks source link

mean method for int types #79

Open kojix2 opened 6 years ago

kojix2 commented 6 years ago

Hello. I realize that the mean method can not be used in int types.

require 'numo/narray'
a = Numo::Int32.new(10).seq
puts a.mean
# undefined method `mean' for "Numo::Int32

Although it may be trivial, I feel this is a little inconvenient. I would be happy if I could use mean method with int types. As in the numpy example below.

import numpy as np

a = np.arange(10, dtype=np.int32)
print(a.mean())
# 4.5