On Fri, Mar 12, 2010 at 12:52, gerardo.berbeglia <gberbeg...@gmail.com> wrote: > > Hello, > > I want to "divide" an n x n (2-dimension) numpy array matrix A by a n > (1-dimension) array d as follows: > > Take n = 2. > Let A= 2 3 > 1 10 > and let d = [ 3 2 ] > Then i would like to have "A/d" = 2/3 3/3 > 1/2 10/2
In [2]: import numpy In [3]: a = numpy.array([[2.0, 3.0], [1.0, 10.0]]) In [4]: a Out[4]: array([[ 2., 3.], [ 1., 10.]]) In [5]: d = numpy.array([[3.0], [2.0]]) In [6]: d Out[6]: array([[ 3.], [ 2.]]) In [7]: a / d Out[7]: array([[ 0.66666667, 1. ], [ 0.5 , 5. ]]) -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion