[Numpy-discussion] matrix operation
Eric Firing
efiring@hawaii....
Wed Mar 17 13:53:42 CDT 2010
gerardob wrote:
> Let A and B be two n x n matrices.
>
> I would like to have another n x n matrix C such that
> C_ij = min {A_ij, B_ij}
>
> Example:
> A = numpy.array([[2,3],[10,12]])
> B = numpy.array([[1,4],[9,13]])
>
> Output
>
> C = [[1,3],[9,12]]
>
> The function min(axis) of numpy seems to be only unary.
>
> Thanks.
>
In [4]:C = numpy.minimum(A,B)
In [5]:C
Out[5]:
array([[ 1, 3],
[ 9, 12]])
More information about the NumPy-Discussion
mailing list