[Bf-blender-cvs] [924041c] soc-2016-cycles_denoising: Cycles: Fix 2-parameter least-squares helper function
Lukas Stockner
noreply at git.blender.org
Fri Jul 8 04:31:35 CEST 2016
Commit: 924041c49ff463d705867b45f8a7eb07c5d2611c
Author: Lukas Stockner
Date: Thu Jul 7 20:12:12 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB924041c49ff463d705867b45f8a7eb07c5d2611c
Cycles: Fix 2-parameter least-squares helper function
===================================================================
M intern/cycles/util/util_math_matrix.h
===================================================================
diff --git a/intern/cycles/util/util_math_matrix.h b/intern/cycles/util/util_math_matrix.h
index e187f56..cb426dc 100644
--- a/intern/cycles/util/util_math_matrix.h
+++ b/intern/cycles/util/util_math_matrix.h
@@ -254,7 +254,8 @@ ccl_device_inline void math_lsq_add(double *lsq, double x, double y)
/* Returns the first-order coefficient a of the fitted function. */
ccl_device_inline double math_lsq_solve(double *lsq)
{
- return (lsq[2]*lsq[3] - lsq[1]*lsq[4]) / (lsq[0]*lsq[2] - lsq[1]*lsq[1] + 1e-4);
+ double inv_det = 1.0 / (lsq[0]*lsq[2] - lsq[1]*lsq[1] + 1e-4);
+ return (lsq[0]*lsq[4] - lsq[1]*lsq[3]) * inv_det;
}
ccl_device float math_largest_eigenvalue(float *A, int n, float *vec, float *tmp)
More information about the Bf-blender-cvs
mailing list