I have tried those two alternatives
objective = lambda A, x : (np.dot(x.T ,np.dot(A, x)))[0,0]
objective = lambda A, x : (np.matrix(x).T * np.matrix(A) * np.matrix(x))[0,0]
With primary one I got 5 sec of running time with my algorithm With secondary I got 14 sec
With MATLAB I got 2 sec
I want to go with the Numpy but obviously I need a way to ameliorate this crummy results. How can I get faster quadratic form matrix, vector product?
Note: I profiled the code and this lambda function drinks the juice of all. Improvemnt: I merely remove the native Ubuntu package of scipy and numpy then installed with followings
sudo pip install numpy
sudo apt-get install libatlas-base-dev gfortran
sudo pip install scipy
sudo apt-get install libpng-dev libfreetype6-dev
sudo pip install matplotlib
I improves the performance a bit, however still lower than Matlab