Re: specializing void MatrixBase<Derived>::makeHouseholder (Re: [eigen] Householder.h: ::min() and operator<== |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
Dear Christoph,
Am 12.09.2016 um 11:06 schrieb Christoph Hertzberg:
On 2016-09-11 15:41, Peter wrote:
[...]
Is there a simple way to specialize
template<typename Derived>
template<typename EssentialPart>
void MatrixBase<Derived>::makeHouseholder
for my own type, without interfering with the Eigen files, i.e. without
inserting enable_if statements in the Eigen code
I don't think there is an easy way.
You could specialize this method for certain types of Derived, but you can't partially specialize methods.
I.e., this could be possible (I did not actually try):
template<>
template<typename EssentialPart>
void MatrixBase<Matrix<MyType, Dynamic, Dynamic>::makeHouseholder(...)
I tried specializations like
template<>
void MatrixBase< TpFloat >::makeHouseholder(
VectorBlock<TpFloat, Dynamic>& essential,
Scalar& tau,
RealScalar& beta) const
or
template<>
template<typename EssentialPart>
void MatrixBase< TpFloat >::makeHouseholder(
EssentialPart& essential,
Scalar& tau,
RealScalar& beta) const
But I get >1000 lines of error messages.
But you can't specialize like:
template<int rows, int cols>
template<typename EssentialPart>
void MatrixBase<Matrix<MyType, rows, cols>::makeHouseholder(...)
How would you like to modify makeHouseholder?
I want to extend the handling of near-zeroes:
if(tailSqNorm <= tol && numext::abs2(numext::imag(c0))<=tol)
{
tau = RealScalar(0);
beta = numext::real(c0);
essential.setZero();
}
Ideally, we should only specialize a sub-part of the function for different types (which we can do by delegating the function to a helper-struct).
I agree, I just wanted to avoid changing the Eigen-Code for simplified updating.
I try to implement a helper class here.
Best regards,
Peter