about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPjotr Prins2018-08-26 09:24:26 +0000
committerPjotr Prins2018-08-26 09:24:26 +0000
commite760e53fac224f252db47dfe7c37f76d6bebb4dc (patch)
treee765c8874a12cfd1f5fd9837a6e360f82a7d5e83 /src
parentde52274064b78c5020f7e1edf4b023fa986b68e0 (diff)
downloadpangemma-e760e53fac224f252db47dfe7c37f76d6bebb4dc.tar.gz
Make sure tau_inv is initialized outside loop - gets rid of compiler warning
Diffstat (limited to 'src')
-rw-r--r--src/vc.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vc.cpp b/src/vc.cpp
index 416a3e4..19590f7 100644
--- a/src/vc.cpp
+++ b/src/vc.cpp
@@ -1935,7 +1935,7 @@ void VC::CalcVCacl(const gsl_matrix *K, const gsl_matrix *W,
   size_t n1 = K->size1, n2 = K->size2;
   size_t n_vc = n2 / n1;
 
-  double d, y2_sum, tau_inv;
+  double d, y2_sum;
 
   // New matrices/vectors.
   gsl_matrix *K_scale = gsl_matrix_alloc(n1, n2);
@@ -2049,6 +2049,7 @@ void VC::CalcVCacl(const gsl_matrix *K, const gsl_matrix *W,
   // Iterate to solve tau and h's.
   size_t it = 0;
   double s = 1;
+  double tau_inv = y2_sum / (double)n1 - d / ((double)n1 * ((double)n1 - 1));
   while (abs(s) > 1e-3 && it < 100) {
 
     // Update tau_inv.