Bugzilla – Attachment 134 Details for
Bug 206
JacobiSVD problem size constructor does not preallocate all of its resources
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]
part 2: Non-allocating versions of HouseholderSequence::applyThisOnTheRight/Left
HouseholderSequence.patch (text/plain), 6.73 KB, created by
Adolfo Rodriguez Tsouroukdissian
on 2011-03-08 14:45:38 UTC
(
hide
)
Description:
part 2: Non-allocating versions of HouseholderSequence::applyThisOnTheRight/Left
Filename:
MIME Type:
Creator:
Adolfo Rodriguez Tsouroukdissian
Created:
2011-03-08 14:45:38 UTC
Size:
6.73 KB
patch
obsolete
># HG changeset patch ># User Adolfo Rodriguez Tsourouksdissian <adolfo.rodriguez@pal-robotics.com> ># Date 1299575509 -3600 ># Node ID f48d27c05af0f945eccb7f94c6be71bbead94cb4 ># Parent 7566ba0b38a170f503c69ffd2bd1156d3fe19a5c >For HouseholderSequence objects, added overloads to applyThisOnTheRight/Left that takes temporary as additional temporary. This allows users/decompositions to have finer control over memory allocations. > >diff --git a/Eigen/src/Householder/HouseholderSequence.h b/Eigen/src/Householder/HouseholderSequence.h >--- a/Eigen/src/Householder/HouseholderSequence.h >+++ b/Eigen/src/Householder/HouseholderSequence.h >@@ -280,34 +280,52 @@ template<typename VectorsType, typename > .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), &temp.coeffRef(0)); > } > } > } > > /** \internal */ > template<typename Dest> inline void applyThisOnTheRight(Dest& dst) const > { >- Matrix<Scalar,1,Dest::RowsAtCompileTime> temp(dst.rows()); >+ Matrix<Scalar,1,Dest::RowsAtCompileTime,RowMajor,1,Dest::MaxRowsAtCompileTime> temp(dst.rows()); >+ applyThisOnTheRight(dst, temp); >+ } >+ >+ /** \internal */ >+ template<typename Dest> inline void applyThisOnTheRight(Dest& dst, >+ Matrix<Scalar,1,Dest::RowsAtCompileTime,RowMajor, >+ 1,Dest::MaxRowsAtCompileTime>& temp) const >+ { >+ temp.resize(dst.rows()); > for(Index k = 0; k < m_length; ++k) > { > Index actual_k = m_trans ? m_length-k-1 : k; > dst.rightCols(rows()-m_shift-actual_k) >- .applyHouseholderOnTheRight(essentialVector(actual_k), m_coeffs.coeff(actual_k), &temp.coeffRef(0)); >+ .applyHouseholderOnTheRight(essentialVector(actual_k), m_coeffs.coeff(actual_k), &temp.coeffRef(0)); > } > } > > /** \internal */ > template<typename Dest> inline void applyThisOnTheLeft(Dest& dst) const > { >- Matrix<Scalar,1,Dest::ColsAtCompileTime> temp(dst.cols()); >+ Matrix<Scalar,1,Dest::ColsAtCompileTime,RowMajor,1,Dest::MaxColsAtCompileTime> temp(dst.cols()); >+ applyThisOnTheLeft(dst, temp); >+ } >+ >+ /** \internal */ >+ template<typename Dest> inline void applyThisOnTheLeft(Dest& dst, >+ Matrix<Scalar,1,Dest::ColsAtCompileTime,RowMajor, >+ 1,Dest::MaxColsAtCompileTime>& temp) const >+ { >+ temp.resize(dst.cols()); > for(Index k = 0; k < m_length; ++k) > { > Index actual_k = m_trans ? k : m_length-k-1; > dst.bottomRows(rows()-m_shift-actual_k) >- .applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), &temp.coeffRef(0)); >+ .applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), &temp.coeffRef(0)); > } > } > > /** \brief Computes the product of a Householder sequence with a matrix. > * \param[in] other %Matrix being multiplied. > * \returns Expression object representing the product. > * > * This function computes \f$ HM \f$ where \f$ H \f$ is the Householder sequence represented by \p *this ># HG changeset patch ># User Adolfo Rodriguez Tsourouksdissian <adolfo.rodriguez@pal-robotics.com> ># Date 1299590908 -3600 ># Node ID fb398de1531b184f64b291478a98ead2ff24516c ># Parent f48d27c05af0f945eccb7f94c6be71bbead94cb4 >Indentation and naming fixes for homogeneity with existing code. > >diff --git a/Eigen/src/Householder/HouseholderSequence.h b/Eigen/src/Householder/HouseholderSequence.h >--- a/Eigen/src/Householder/HouseholderSequence.h >+++ b/Eigen/src/Householder/HouseholderSequence.h >@@ -280,52 +280,52 @@ template<typename VectorsType, typename > .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), &temp.coeffRef(0)); > } > } > } > > /** \internal */ > template<typename Dest> inline void applyThisOnTheRight(Dest& dst) const > { >- Matrix<Scalar,1,Dest::RowsAtCompileTime,RowMajor,1,Dest::MaxRowsAtCompileTime> temp(dst.rows()); >- applyThisOnTheRight(dst, temp); >+ Matrix<Scalar,1,Dest::RowsAtCompileTime,RowMajor,1,Dest::MaxRowsAtCompileTime> workspace(dst.rows()); >+ applyThisOnTheRight(dst, workspace); > } > > /** \internal */ > template<typename Dest> inline void applyThisOnTheRight(Dest& dst, > Matrix<Scalar,1,Dest::RowsAtCompileTime,RowMajor, >- 1,Dest::MaxRowsAtCompileTime>& temp) const >+ 1,Dest::MaxRowsAtCompileTime>& workspace) const > { >- temp.resize(dst.rows()); >+ workspace.resize(dst.rows()); > for(Index k = 0; k < m_length; ++k) > { > Index actual_k = m_trans ? m_length-k-1 : k; > dst.rightCols(rows()-m_shift-actual_k) >- .applyHouseholderOnTheRight(essentialVector(actual_k), m_coeffs.coeff(actual_k), &temp.coeffRef(0)); >+ .applyHouseholderOnTheRight(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data()); > } > } > > /** \internal */ > template<typename Dest> inline void applyThisOnTheLeft(Dest& dst) const > { >- Matrix<Scalar,1,Dest::ColsAtCompileTime,RowMajor,1,Dest::MaxColsAtCompileTime> temp(dst.cols()); >- applyThisOnTheLeft(dst, temp); >+ Matrix<Scalar,1,Dest::ColsAtCompileTime,RowMajor,1,Dest::MaxColsAtCompileTime> workspace(dst.cols()); >+ applyThisOnTheLeft(dst, workspace); > } > > /** \internal */ > template<typename Dest> inline void applyThisOnTheLeft(Dest& dst, > Matrix<Scalar,1,Dest::ColsAtCompileTime,RowMajor, >- 1,Dest::MaxColsAtCompileTime>& temp) const >+ 1,Dest::MaxColsAtCompileTime>& workspace) const > { >- temp.resize(dst.cols()); >+ workspace.resize(dst.cols()); > for(Index k = 0; k < m_length; ++k) > { > Index actual_k = m_trans ? k : m_length-k-1; > dst.bottomRows(rows()-m_shift-actual_k) >- .applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), &temp.coeffRef(0)); >+ .applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data()); > } > } > > /** \brief Computes the product of a Householder sequence with a matrix. > * \param[in] other %Matrix being multiplied. > * \returns Expression object representing the product. > * > * This function computes \f$ HM \f$ where \f$ H \f$ is the Householder sequence represented by \p *this
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 206
:
110
|
115
|
119
|
125
|
126
|
128
|
132
|
134
|
135
|
136
|
137
|
138
|
152
|
153
|
154
|
158
|
159