I have to do some math operations (e.g., add, multiply) on a large array.
To prevent any 'MemoryError' , I am doing my computations as suggested on the answer from this thread.
However, I am running into some trouble while applying the assignment operations as per suggested in the thread. I will demonstrate my problem using a small 3x3 array.
I have the following input array K:
array([[ 0.        ,  0.51290339,  0.24675368],
       [ 0.51290339,  0.        ,  0.29440921],
       [ 0.24675368,  0.29440921,  0.        ]])
I want to apply the following computation to the input array K:
output = K* (1.5 - 0.5 * K* K)
I apply the above equation to compute the desired output as follows in Python:
K*= (1.5+np.dot(np.dot(-0.5,K),K))
However, the output answer is not correct.
My desired answer should be:
0.0000000 0.7018904 0.3626184
0.7018904 0.0000000 0.4288546
0.3626184 0.4288546 0.0000000
Any help is welcome.
 
     
     
    