added a function to measure improvement

This commit is contained in:
Stephen McQuay 2011-03-28 22:11:38 -06:00
parent 487c132d12
commit 7685b130b7

View File

@ -49,7 +49,7 @@ def friendly_exact_3D(X):
x,y,z = X
return 1 + x*x + y*y + z*z
def improved_answer(answer, exact, verbose=False):
def improved_answer(answer, exact):
if not answer['error']:
return True
@ -64,3 +64,7 @@ def improved_answer(answer, exact, verbose=False):
else:
log.debug(":( damaged result")
return False
def percent_improvement(answer, exact):
return np.abs(answer['qlin'] - exact) / exact