Bugzilla – Attachment 316 Details for
Bug 505
Assert if temporary objects that are still referred to get destructed (was: Misbehaving Product on C++11)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
[patch]
Patch moving product temporaries into parent expression
Move_product_temp_to_parent.diff (text/plain), 4.39 KB, created by
Gael Guennebaud
on 2013-02-26 00:27:53 UTC
(
hide
)
Description:
Patch moving product temporaries into parent expression
Filename:
MIME Type:
Creator:
Gael Guennebaud
Created:
2013-02-26 00:27:53 UTC
Size:
4.39 KB
patch
obsolete
>diff --git a/Eigen/src/Core/ProductBase.h b/Eigen/src/Core/ProductBase.h >--- a/Eigen/src/Core/ProductBase.h >+++ b/Eigen/src/Core/ProductBase.h >@@ -108,24 +108,16 @@ class ProductBase : public MatrixBase<De > inline void subTo(Dest& dst) const { scaleAndAddTo(dst,Scalar(-1)); } > > template<typename Dest> > inline void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { derived().scaleAndAddTo(dst,alpha); } > > const _LhsNested& lhs() const { return m_lhs; } > const _RhsNested& rhs() const { return m_rhs; } > >- // Implicit conversion to the nested type (trigger the evaluation of the product) >- operator const PlainObject& () const >- { >- m_result.resize(m_lhs.rows(), m_rhs.cols()); >- derived().evalTo(m_result); >- return m_result; >- } >- > const Diagonal<const FullyLazyCoeffBaseProductType,0> diagonal() const > { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); } > > template<int Index> > const Diagonal<FullyLazyCoeffBaseProductType,Index> diagonal() const > { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); } > > const Diagonal<FullyLazyCoeffBaseProductType,Dynamic> diagonal(Index index) const >@@ -165,27 +157,25 @@ class ProductBase : public MatrixBase<De > eigen_assert(this->rows() == 1 && this->cols() == 1); > return derived().coeffRef(i); > } > > protected: > > LhsNested m_lhs; > RhsNested m_rhs; >- >- mutable PlainObject m_result; > }; > > // here we need to overload the nested rule for products >-// such that the nested type is a const reference to a plain matrix >+// such that the nested type is a plain matrix storing the result of the product > namespace internal { > template<typename Lhs, typename Rhs, int Mode, int N, typename PlainObject> > struct nested<GeneralProduct<Lhs,Rhs,Mode>, N, PlainObject> > { >- typedef PlainObject const& type; >+ typedef PlainObject type; > }; > } > > template<typename NestedProduct> > class ScaledProduct; > > // Note that these two operator* functions are not defined as member > // functions of ProductBase, because, otherwise we would have to >diff --git a/Eigen/src/Core/products/CoeffBasedProduct.h b/Eigen/src/Core/products/CoeffBasedProduct.h >--- a/Eigen/src/Core/products/CoeffBasedProduct.h >+++ b/Eigen/src/Core/products/CoeffBasedProduct.h >@@ -185,51 +185,42 @@ class CoeffBasedProduct > PacketScalar res; > internal::product_packet_impl<Flags&RowMajorBit ? RowMajor : ColMajor, > Unroll ? InnerSize-1 : Dynamic, > _LhsNested, _RhsNested, PacketScalar, LoadMode> > ::run(row, col, m_lhs, m_rhs, res); > return res; > } > >- // Implicit conversion to the nested type (trigger the evaluation of the product) >- EIGEN_STRONG_INLINE operator const PlainObject& () const >- { >- m_result.lazyAssign(*this); >- return m_result; >- } >- > const _LhsNested& lhs() const { return m_lhs; } > const _RhsNested& rhs() const { return m_rhs; } > > const Diagonal<const LazyCoeffBasedProductType,0> diagonal() const > { return reinterpret_cast<const LazyCoeffBasedProductType&>(*this); } > > template<int DiagonalIndex> > const Diagonal<const LazyCoeffBasedProductType,DiagonalIndex> diagonal() const > { return reinterpret_cast<const LazyCoeffBasedProductType&>(*this); } > > const Diagonal<const LazyCoeffBasedProductType,Dynamic> diagonal(Index index) const > { return reinterpret_cast<const LazyCoeffBasedProductType&>(*this).diagonal(index); } > > protected: > typename internal::add_const_on_value_type<LhsNested>::type m_lhs; > typename internal::add_const_on_value_type<RhsNested>::type m_rhs; >- >- mutable PlainObject m_result; > }; > > namespace internal { > > // here we need to overload the nested rule for products >-// such that the nested type is a const reference to a plain matrix >+// such that the nested type is a plain matrix storing the result of the product > template<typename Lhs, typename Rhs, int N, typename PlainObject> > struct nested<CoeffBasedProduct<Lhs,Rhs,EvalBeforeNestingBit|EvalBeforeAssigningBit>, N, PlainObject> > { >- typedef PlainObject const& type; >+ typedef PlainObject type; > }; > > /*************************************************************************** > * Normal product .coeff() implementation (with meta-unrolling) > ***************************************************************************/ > > /************************************** > *** Scalar path - no vectorization ***
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 505
: 316