numo-narray icon indicating copy to clipboard operation
numo-narray copied to clipboard

Method name corresponding to numpy.zeros_like

Open masa16 opened this issue 7 years ago • 4 comments

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?

masa16 avatar Jun 10 '17 08:06 masa16

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

Try2Code avatar Jun 12 '17 05:06 Try2Code

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.

Try2Code avatar Jun 12 '17 10:06 Try2Code

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.

masa16 avatar Jun 12 '17 11:06 masa16

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

mrkn avatar Sep 15 '20 06:09 mrkn