From 9efbf1b1945de9ff20f389dda1a0a88923733285 Mon Sep 17 00:00:00 2001 From: Marco Meyer-Conde Date: Wed, 26 Nov 2025 15:34:42 +0900 Subject: [PATCH] added mutable keywords to polynomial root property. --- math/mathmore/inc/Math/Polynomial.h | 9 ++++----- math/mathmore/src/Polynomial.cxx | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/math/mathmore/inc/Math/Polynomial.h b/math/mathmore/inc/Math/Polynomial.h index 238214eb91acd..abe145b14b0c8 100644 --- a/math/mathmore/inc/Math/Polynomial.h +++ b/math/mathmore/inc/Math/Polynomial.h @@ -116,20 +116,20 @@ class Polynomial : public ParamFunction, equation is very small. In that case it might be more robust to use the numerical method, by calling directly FindNumRoots() */ - const std::vector > & FindRoots(); + const std::vector > & FindRoots() const; /** Find the only the real polynomial roots. For n <= 4, the roots are found analytically while for larger order an iterative numerical method is used The numerical method used is from GSL (see documentation ) */ - std::vector FindRealRoots(); + std::vector FindRealRoots() const; /** Find the polynomial roots using always an iterative numerical methods The numerical method used is from GSL (see documentation ) */ - const std::vector > & FindNumRoots(); + const std::vector > & FindNumRoots() const; /** Order of Polynomial @@ -166,8 +166,7 @@ class Polynomial : public ParamFunction, mutable std::vector fDerived_params; // roots - - std::vector< std::complex < double > > fRoots; + mutable std::vector< std::complex < double > > fRoots; }; diff --git a/math/mathmore/src/Polynomial.cxx b/math/mathmore/src/Polynomial.cxx index 7797f7c2a2dc2..7f0e43fe4ee41 100644 --- a/math/mathmore/src/Polynomial.cxx +++ b/math/mathmore/src/Polynomial.cxx @@ -148,7 +148,7 @@ IGenFunction * Polynomial::Clone() const { } -const std::vector< std::complex > & Polynomial::FindRoots(){ +const std::vector< std::complex > & Polynomial::FindRoots() const { // check if order is correct @@ -234,7 +234,7 @@ const std::vector< std::complex > & Polynomial::FindRoots(){ } -std::vector< double > Polynomial::FindRealRoots(){ +std::vector< double > Polynomial::FindRealRoots() const { FindRoots(); std::vector roots; roots.reserve(fOrder); @@ -244,7 +244,7 @@ std::vector< double > Polynomial::FindRealRoots(){ } return roots; } -const std::vector< std::complex > & Polynomial::FindNumRoots(){ +const std::vector< std::complex > & Polynomial::FindNumRoots() const { // check if order is correct