From 1d67844f1b1a1496c479dbcae4a6a868aca94050 Mon Sep 17 00:00:00 2001
From: Rahil Doshi <rahil.doshi@fau.de>
Date: Wed, 2 Apr 2025 17:17:06 +0200
Subject: [PATCH] Refactor interpolate_double_lookup_cpp.h

---
 .../interpolate_double_lookup_cpp.h                       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/pymatlib/core/cpp/include/pymatlib_interpolators/interpolate_double_lookup_cpp.h b/src/pymatlib/core/cpp/include/pymatlib_interpolators/interpolate_double_lookup_cpp.h
index a5770a1..4f73088 100644
--- a/src/pymatlib/core/cpp/include/pymatlib_interpolators/interpolate_double_lookup_cpp.h
+++ b/src/pymatlib/core/cpp/include/pymatlib_interpolators/interpolate_double_lookup_cpp.h
@@ -29,12 +29,12 @@ double interpolate_double_lookup_cpp(
     idx_y_neq += arrs.y_neq[idx_y_neq + 1] < y_target;
 
     // Get interpolation points
-    const double y1 = arrs.y_neq[idx_y_neq];
-    const double y2 = arrs.y_neq[idx_y_neq + 1];
     const double x1 = arrs.x_eq[idx_y_neq];
     const double x2 = arrs.x_eq[idx_y_neq + 1];
+    const double y1 = arrs.y_neq[idx_y_neq];
+    const double y2 = arrs.y_neq[idx_y_neq + 1];
 
     // Linear interpolation
-    const double slope = (x2 - x1) / (y2 - y1);
-    return x1 + slope * (y_target - y1);
+    const double inv_slope = (x2 - x1) / (y2 - y1);
+    return x1 + inv_slope * (y_target - y1);
 }
-- 
GitLab