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

The name of a method corresponding to numpy.maximum

Open masa16 opened this issue 8 years ago • 6 comments

Numpy has confusing two functions: numpy.max and numpy.maximum. Numo::NArray#max() method is same as numpy.max. Now I need to define the specification of a method corresponding to numpy.maximum. Current ideas:

Numo::NArray.max(a,b,...)
Numo::Nanika.max(a,b,...) # Nanika is a module with an appropriate name.
Numo.max(a,b,...)
a.max(b)

masa16 avatar Jun 08 '17 10:06 masa16

Hi! IMO pointwise max/min operations should be public class methods of the corresponding class (NArray,NMatrix,...).

Numo.max would suggests an operation on objetcs of different Numo-classes

hth

Try2Code avatar Jun 08 '17 11:06 Try2Code

I consider Numo module is dedicated to Numo::NArray class objects. This is similar to Math module that calculates with Float objects.

masa16 avatar Jun 08 '17 11:06 masa16

Ah, I see - I thought Numo would be a module for NArray and NMatrix. Will there be no Numo::NMatrix in the future?

Try2Code avatar Jun 08 '17 11:06 Try2Code

I cannot afford to maintain so many classes, so do not consider something like Numo::NMatrix.

masa16 avatar Jun 08 '17 12:06 masa16

No Problem - NArray is multidimensional out of the box. I was just asking, because some time ago I ran into problems with building gsl-bindings. The gem I used supported NArray or NMatrix based builds, but using NMatrix from sciruby. This clashed (at least IMO) with the NMatrix class from "the old" narray implementation. anyhow ... since you created Numo::GSL, this issue is solved ;-)

Try2Code avatar Jun 08 '17 13:06 Try2Code

back to the topic - My favourites are both

Numo.max(a,b,...)
a.max(b)

I guess it's rather easy to let a.max(b) make use of Numo.max(a,b) in order to stay with a single implementation.

Try2Code avatar Jun 08 '17 13:06 Try2Code