如何将以下代码重写为ceres-solver
?
我尝试遵循this tutorial,但看起来有些混乱。
from scipy.optimize import minimize
def target_func(point):
total_mse = 0
for equation in equations:
x, y, z = equation
denominator = linalg.norm(np.matmul(x, y))
numerator = linalg.norm(
np.cross(np.matmul(x, y),
point - z))
equation_error = numerator / denominator
total_mse += equation_error
return total_mse * total_mse
res = minimize(target_func, x0, method='nelder-mead',
options={'xtol': 1e-8})