ruby-numo / numo-narray

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

Method name corresponding to numpy.zeros_like #63

Open masa16 opened 7 years ago

masa16 commented 7 years ago

Numo::NArray needs to have a method corresponding to:

numpy.zeros_like(a)

In Ruby, the standard way is

a.zeros_like

This is wrong order if we regard this as an English phrase. Currently the name of this method is new_zeros but it seems not good name. Any idea?

Try2Code commented 7 years ago

IMO it works like a constructor. So I would look for something like Numo.zeros_like(a) Or simply Numo.zeros(a).

Try2Code commented 7 years ago

Is this realy needed? you already have something very close to it

Numo::DFloat.zeros(b.shape)

I personally to not need all numpy methods - esp. one-liners like this. I do not see an benefit in replacing a one-liner with another one.

masa16 commented 7 years ago

This methos is just same as

b.class.zeros(b.shape)

numpy.zeros_like frequently appears in numpy codes and I think situation is the same with NArray. So I think it has a benefit to write a code shortly.

mrkn commented 4 years ago

@masa How about Numo::NArray.zeros_like(b)?