From 13b61529f459eb9cf2ceee23a51bcbd4b7c64e9a Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen <4643818-rmlarsen1@users.noreply.gitlab.com> Date: Thu, 26 Feb 2026 12:35:44 -0800 Subject: [PATCH] Add const to non-mutating member functions in products/ and Serializer libeigen/eigen!2221 Co-authored-by: Rasmus Munk Larsen --- Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h | 2 +- Eigen/src/Core/products/SelfadjointMatrixMatrix.h | 6 +++--- Eigen/src/Core/util/Serializer.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h b/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h index adae3dd6c..5a8599ab7 100644 --- a/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +++ b/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h @@ -154,7 +154,7 @@ struct tribb_kernel { enum { BlockSize = meta_least_common_multiple::ret }; void operator()(ResScalar* res_, Index resIncr, Index resStride, const LhsScalar* blockA, const RhsScalar* blockB, - Index size, Index depth, const ResScalar& alpha) { + Index size, Index depth, const ResScalar& alpha) const { typedef blas_data_mapper ResMapper; typedef blas_data_mapper BufferMapper; ResMapper res(res_, resStride, resIncr); diff --git a/Eigen/src/Core/products/SelfadjointMatrixMatrix.h b/Eigen/src/Core/products/SelfadjointMatrixMatrix.h index 899283dcc..fd66b6093 100644 --- a/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +++ b/Eigen/src/Core/products/SelfadjointMatrixMatrix.h @@ -22,7 +22,7 @@ template inline void pack(Scalar* blockA, const const_blas_data_mapper& lhs, Index cols, Index i, - Index& count) { + Index& count) const { // normal copy for (Index k = 0; k < i; k++) for (Index w = 0; w < BlockRows; w++) blockA[count++] = lhs(i + w, k); // normal @@ -40,7 +40,7 @@ struct symm_pack_lhs { for (Index k = i + BlockRows; k < cols; k++) for (Index w = 0; w < BlockRows; w++) blockA[count++] = numext::conj(lhs(k, i + w)); // transposed } - void operator()(Scalar* blockA, const Scalar* lhs_, Index lhsStride, Index cols, Index rows) { + void operator()(Scalar* blockA, const Scalar* lhs_, Index lhsStride, Index cols, Index rows) const { typedef typename unpacket_traits::type>::half HalfPacket; typedef typename unpacket_traits::type>::half>::half QuarterPacket; @@ -99,7 +99,7 @@ struct symm_pack_lhs { template struct symm_pack_rhs { enum { PacketSize = packet_traits::size }; - void operator()(Scalar* blockB, const Scalar* rhs_, Index rhsStride, Index rows, Index cols, Index k2) { + void operator()(Scalar* blockB, const Scalar* rhs_, Index rhsStride, Index rows, Index cols, Index k2) const { Index end_k = k2 + rows; Index count = 0; const_blas_data_mapper rhs(rhs_, rhsStride); diff --git a/Eigen/src/Core/util/Serializer.h b/Eigen/src/Core/util/Serializer.h index 72ce6cb59..6de7fe247 100644 --- a/Eigen/src/Core/util/Serializer.h +++ b/Eigen/src/Core/util/Serializer.h @@ -46,7 +46,7 @@ class Serializer end)) return nullptr; EIGEN_USING_STD(memcpy) @@ -84,7 +84,7 @@ class Serializer, void> { EIGEN_DEVICE_FUNC size_t size(const Derived& value) const { return sizeof(Header) + sizeof(Scalar) * value.size(); } - EIGEN_DEVICE_FUNC uint8_t* serialize(uint8_t* dest, uint8_t* end, const Derived& value) { + EIGEN_DEVICE_FUNC uint8_t* serialize(uint8_t* dest, uint8_t* end, const Derived& value) const { if (EIGEN_PREDICT_FALSE(dest == nullptr)) return nullptr; if (EIGEN_PREDICT_FALSE(dest + size(value) > end)) return nullptr; const size_t header_bytes = sizeof(Header);