File kstars-eigen3.patch of Package kstars

From 0deb888186ad97f4801d5615a12a982baf18457e Mon Sep 17 00:00:00 2001
From: Paolo Stivanin <info@paolostivanin.com>
Date: Fri, 5 Dec 2025 08:31:43 +0100
Subject: [PATCH] Fix build with latest Eigen: use max(0.0) instead of max(0)

Eigen 3.4.x requires ArrayBase::max() to receive a value with a
matching scalar type. Calling .max(0) triggers ambiguous overload
errors when building against newer Eigen releases.

This patch updates both math_tools.cpp copies to use .max(0.0),
which is valid for all supported Eigen versions.

Build verified on:
- openSUSE Leap 15.6 (older Eigen)
- openSUSE Leap 16.0 (older Eigen)
- openSUSE Tumbleweed (Eigen 3.4.1)
---
 .../internalguide/MPI_IS_gaussian_process/src/math_tools.cpp    | 2 +-
 .../internalguide/MPI_IS_gaussian_process/tools/math_tools.cpp  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kstars/ekos/guide/internalguide/MPI_IS_gaussian_process/src/math_tools.cpp b/kstars/ekos/guide/internalguide/MPI_IS_gaussian_process/src/math_tools.cpp
index 9f8b2b7be2..82cfb327ba 100644
--- a/kstars/ekos/guide/internalguide/MPI_IS_gaussian_process/src/math_tools.cpp
+++ b/kstars/ekos/guide/internalguide/MPI_IS_gaussian_process/src/math_tools.cpp
@@ -72,7 +72,7 @@ Eigen::MatrixXd squareDistance(const Eigen::MatrixXd &a, const Eigen::MatrixXd &
     return
         ((am.array().square().colwise().sum().transpose().rowwise().replicate(bCols).matrix()
           + bm.array().square().colwise().sum().colwise().replicate(aCols).matrix())
-         - 2 * (am.transpose()) * bm).array().max(0);
+         - 2 * (am.transpose()) * bm).array().max(0.0);
 
     /* // verbose version
     Eigen::MatrixXd a_square =
diff --git a/kstars/ekos/guide/internalguide/MPI_IS_gaussian_process/tools/math_tools.cpp b/kstars/ekos/guide/internalguide/MPI_IS_gaussian_process/tools/math_tools.cpp
index 9f8b2b7be2..82cfb327ba 100644
--- a/kstars/ekos/guide/internalguide/MPI_IS_gaussian_process/tools/math_tools.cpp
+++ b/kstars/ekos/guide/internalguide/MPI_IS_gaussian_process/tools/math_tools.cpp
@@ -72,7 +72,7 @@ Eigen::MatrixXd squareDistance(const Eigen::MatrixXd &a, const Eigen::MatrixXd &
     return
         ((am.array().square().colwise().sum().transpose().rowwise().replicate(bCols).matrix()
           + bm.array().square().colwise().sum().colwise().replicate(aCols).matrix())
-         - 2 * (am.transpose()) * bm).array().max(0);
+         - 2 * (am.transpose()) * bm).array().max(0.0);
 
     /* // verbose version
     Eigen::MatrixXd a_square =
-- 
GitLab

openSUSE Build Service is sponsored by