mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add const to non-mutating member functions in products/ and Serializer
libeigen/eigen!2221 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
@@ -154,7 +154,7 @@ struct tribb_kernel {
|
|||||||
|
|
||||||
enum { BlockSize = meta_least_common_multiple<plain_enum_max(mr, nr), plain_enum_min(mr, nr)>::ret };
|
enum { BlockSize = meta_least_common_multiple<plain_enum_max(mr, nr), plain_enum_min(mr, nr)>::ret };
|
||||||
void operator()(ResScalar* res_, Index resIncr, Index resStride, const LhsScalar* blockA, const RhsScalar* blockB,
|
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<ResScalar, Index, ColMajor, Unaligned, ResInnerStride> ResMapper;
|
typedef blas_data_mapper<ResScalar, Index, ColMajor, Unaligned, ResInnerStride> ResMapper;
|
||||||
typedef blas_data_mapper<ResScalar, Index, ColMajor, Unaligned> BufferMapper;
|
typedef blas_data_mapper<ResScalar, Index, ColMajor, Unaligned> BufferMapper;
|
||||||
ResMapper res(res_, resStride, resIncr);
|
ResMapper res(res_, resStride, resIncr);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ template <typename Scalar, typename Index, int Pack1, int Pack2_dummy, int Stora
|
|||||||
struct symm_pack_lhs {
|
struct symm_pack_lhs {
|
||||||
template <int BlockRows>
|
template <int BlockRows>
|
||||||
inline void pack(Scalar* blockA, const const_blas_data_mapper<Scalar, Index, StorageOrder>& lhs, Index cols, Index i,
|
inline void pack(Scalar* blockA, const const_blas_data_mapper<Scalar, Index, StorageOrder>& lhs, Index cols, Index i,
|
||||||
Index& count) {
|
Index& count) const {
|
||||||
// normal copy
|
// normal copy
|
||||||
for (Index k = 0; k < i; k++)
|
for (Index k = 0; k < i; k++)
|
||||||
for (Index w = 0; w < BlockRows; w++) blockA[count++] = lhs(i + w, k); // normal
|
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 k = i + BlockRows; k < cols; k++)
|
||||||
for (Index w = 0; w < BlockRows; w++) blockA[count++] = numext::conj(lhs(k, i + w)); // transposed
|
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<typename packet_traits<Scalar>::type>::half HalfPacket;
|
typedef typename unpacket_traits<typename packet_traits<Scalar>::type>::half HalfPacket;
|
||||||
typedef typename unpacket_traits<typename unpacket_traits<typename packet_traits<Scalar>::type>::half>::half
|
typedef typename unpacket_traits<typename unpacket_traits<typename packet_traits<Scalar>::type>::half>::half
|
||||||
QuarterPacket;
|
QuarterPacket;
|
||||||
@@ -99,7 +99,7 @@ struct symm_pack_lhs {
|
|||||||
template <typename Scalar, typename Index, int nr, int StorageOrder>
|
template <typename Scalar, typename Index, int nr, int StorageOrder>
|
||||||
struct symm_pack_rhs {
|
struct symm_pack_rhs {
|
||||||
enum { PacketSize = packet_traits<Scalar>::size };
|
enum { PacketSize = packet_traits<Scalar>::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 end_k = k2 + rows;
|
||||||
Index count = 0;
|
Index count = 0;
|
||||||
const_blas_data_mapper<Scalar, Index, StorageOrder> rhs(rhs_, rhsStride);
|
const_blas_data_mapper<Scalar, Index, StorageOrder> rhs(rhs_, rhsStride);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class Serializer<T,
|
|||||||
* \param value the value to serialize.
|
* \param value the value to serialize.
|
||||||
* \return the next memory address past the end of the serialized data.
|
* \return the next memory address past the end of the serialized data.
|
||||||
*/
|
*/
|
||||||
EIGEN_DEVICE_FUNC uint8_t* serialize(uint8_t* dest, uint8_t* end, const T& value) {
|
EIGEN_DEVICE_FUNC uint8_t* serialize(uint8_t* dest, uint8_t* end, const T& value) const {
|
||||||
if (EIGEN_PREDICT_FALSE(dest == nullptr)) return nullptr;
|
if (EIGEN_PREDICT_FALSE(dest == nullptr)) return nullptr;
|
||||||
if (EIGEN_PREDICT_FALSE(dest + sizeof(value) > end)) return nullptr;
|
if (EIGEN_PREDICT_FALSE(dest + sizeof(value) > end)) return nullptr;
|
||||||
EIGEN_USING_STD(memcpy)
|
EIGEN_USING_STD(memcpy)
|
||||||
@@ -84,7 +84,7 @@ class Serializer<DenseBase<Derived>, void> {
|
|||||||
|
|
||||||
EIGEN_DEVICE_FUNC size_t size(const Derived& value) const { return sizeof(Header) + sizeof(Scalar) * value.size(); }
|
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 == nullptr)) return nullptr;
|
||||||
if (EIGEN_PREDICT_FALSE(dest + size(value) > end)) return nullptr;
|
if (EIGEN_PREDICT_FALSE(dest + size(value) > end)) return nullptr;
|
||||||
const size_t header_bytes = sizeof(Header);
|
const size_t header_bytes = sizeof(Header);
|
||||||
|
|||||||
Reference in New Issue
Block a user