removed the old baker error routines

This commit is contained in:
Stephen Mardson McQuay 2010-10-29 21:05:21 -06:00
parent bcf1622f35
commit 22a8855a99
1 changed files with 0 additions and 81 deletions

View File

@ -103,87 +103,6 @@ def qlinear_3D(X, R):
qlin = sum([q_i * phi_i for q_i, phi_i in zip(R.q, phis)])
return phis, qlin
def get_error_quadratic(phi, R, S):
B = [] # baker eq 9
w = [] # baker eq 11
for (s, q) in zip(S.verts, S.q):
cur_phi, cur_qlin = qlinear(s, R)
(phi1, phi2, phi3) = cur_phi
B.append(
[
phi1 * phi2,
phi2 * phi3,
phi3 * phi1,
]
)
w.append(q - cur_qlin)
B = np.array(B)
w = np.array(w)
A = np.dot(B.T, B)
b = np.dot(B.T, w)
# baker solve eq 10
try:
(a, b, c) = np.linalg.solve(A,b)
except np.linalg.LinAlgError as e:
log.error("linear calculation went bad, resorting to np.linalg.pinv: %s" % e)
(a, b, c) = np.dot(np.linalg.pinv(A), b)
error_term = a * phi[0] * phi[1]\
+ b * phi[1] * phi[2]\
+ c * phi[2] * phi[0]
return error_term
def get_error_cubic(phi, R, S):
B = [] # baker eq 9
w = [] # baker eq 11
for (s, q) in zip(S.verts, S.q):
cur_phi, cur_qlin = qlinear(s, R)
(phi1, phi2, phi3) = cur_phi
# basing this on eq 17
B.append(
[
phi1 * phi2 * phi2, # a
phi1 * phi3 * phi3, # b
phi2 * phi1 * phi1, # c
phi2 * phi3 * phi3, # d
phi3 * phi1 * phi1, # e
phi3 * phi2 * phi2, # f
phi1 * phi2 * phi3, # g
]
)
w.append(q - cur_qlin)
B = np.array(B)
w = np.array(w)
A = np.dot(B.T, B)
b = np.dot(B.T, w)
# baker solve eq 10
try:
(a, b, c, d, e, f, g) = np.linalg.solve(A,b)
except np.linalg.LinAlgError as e:
log.error("linear calculation went bad, resorting to np.linalg.pinv: %s" % e)
(a, b, c, d, e, f, g) = np.dot(np.linalg.pinv(A), b)
error_term = a * phi[0] * phi[1] * phi[1]\
+ b * phi[0] * phi[2] * phi[2]\
+ c * phi[1] * phi[0] * phi[0]\
+ d * phi[1] * phi[2] * phi[2]\
+ e * phi[2] * phi[0] * phi[0]\
+ f * phi[2] * phi[1] * phi[1]\
+ g * phi[0] * phi[1] * phi[2]\
return error_term
def get_error_sauron(phi, R, S, order = 2):
log.debug("len(phi): %d"% len(phi))
B = [] # baker eq 9