my_parser.add_argument('-x0',action='store',type=float,nargs=2,help='The initial guess x0 in rowmajor format: two numbers separated by space',default=[3.0,2.0])
args=my_parser.parse_args()
# Objective function to be minimized
defobjective(X,*args):
A=args[0]
B=args[1].T
S=np.dot(X.T,np.dot(A,X))-np.dot(X.T,B)
returnS
# Stores intermediates minimization results in X_int
defreporter(X_r):
globalX_int
X_int=np.vstack([X_int,X_r])
return0
# Parameters of the function to minimize + initial guess (can be modified by user)