On Thu, Dec 5, 2013 at 11:00 PM, Alexander Belopolsky <ndar...@mac.com> wrote: > > On Thu, Dec 5, 2013 at 10:35 PM, <josef.p...@gmail.com> wrote: >> >> what about np.dot, np.dot(mask, x) which is the same as (mask * >> x).sum(0) ? > > > I am not sure which way your argument goes, but I don't think you would find > the following natural: > >>>> x = array([True, True]) >>>> dot(x,x) > True
this is weird but I would never do that. maybe I would, but then i would add 1 non boolean >>>> (x*x).sum() > 2 >>>> (x*x).sum(0) > 2 That sounds right to me >>> (mask**2 == mask).all() True >>>> (x*x).sum(False) > 2 What is axis=False? The way my argument goes: I'm a heavy user of using * pretending the bool behaves like an int, and of sum and accumulate. It would be a pain to loose them. >From where I come from (*) a bool is not a boolean it's just 0, 1, given that numpy casting rules apply and it's sometimes cast back to (0, 1) Does this work as explanation for the pattern of + and - also. (*) places where the type system is more restricted. What about max? >>> np.maximum(mask, mask) array([False, False, False, True, True], dtype=bool) >>> np.maximum(mask, ~mask) array([ True, True, True, True, True], dtype=bool) >>> mask + mask array([False, False, False, True, True], dtype=bool) >>> mask + ~mask array([ True, True, True, True, True], dtype=bool) first mask is if the wife has a car, second mask is if the husband has a car. The max is if there is a car in the family. What's this as logical? Josef > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion