[Numpy-discussion] MemoryError with dot(A, A.T) where A is 800MB on 32-bit Vista

Alan G Isaac aisaac at american.edu
Wed Jun 9 13:16:20 EDT 2010


On 6/9/2010 12:49 PM, greg whittier wrote:
> Is there a way to do A*A.T without two
> copies of A?

Does this do what you want?
Alan Isaac

>>> a
array([[0, 1],
        [2, 3],
        [4, 5],
        [6, 7],
        [8, 9]])
>>> np.tensordot(a,a,axes=(-1,-1))
array([[  1,   3,   5,   7,   9],
        [  3,  13,  23,  33,  43],
        [  5,  23,  41,  59,  77],
        [  7,  33,  59,  85, 111],
        [  9,  43,  77, 111, 145]])





More information about the NumPy-Discussion mailing list