This bugzilla service is closed. All entries have been migrated to
Bug 1658 - Add DenseBase::conjugateIf<bool>()
Summary: Add DenseBase::conjugateIf<bool>()
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: unspecified
Hardware: All All
: Normal Feature Request
Assignee: Nobody
Depends on:
Reported: 2019-01-13 20:59 UTC by Gael Guennebaud
Modified: 2019-12-04 18:21 UTC (History)
3 users (show)

Add conjugateIf<cond>() members (10.82 KB, patch)
2019-01-15 09:58 UTC, Gael Guennebaud
no flags Details | Diff

Description Gael Guennebaud 2019-01-13 20:59:16 UTC
Adding a conditional conjugateIf<bool>() method would allow to simplify the implementation of some of our solver code. For instance, in PartialPivLU, we have code like:

  if (Conjugate) {
    dst = m_lu.template triangularView<Upper>().adjoint().solve(rhs);
    m_lu.template triangularView<UnitLower>().adjoint().solveInPlace(dst);
  } else {
    dst = m_lu.template triangularView<Upper>().transpose().solve(rhs);
    m_lu.template triangularView<UnitLower>().transpose().solveInPlace(dst);

that could be factorized as:

  dst = m_lu.template triangularView<Upper>().transpose()
            .template conjugateIf<Conjugate>().solve(rhs);
  m_lu.template triangularView<UnitLower>().transpose()
      .template conjugateIf<Conjugate>().solveInPlace(dst);

More complicated exemples include FullPivLU::_solve_impl_transposed, and some code in PR567:

We could keep it internal:

  dst = internal::conj_if<bool>(m_lu.template triangularView<Upper>().transpose()).solve(rhs);

but (1) it's less readable than as a free function, and (2) if it's good for us, it's probably good for our users too.
Comment 1 Gael Guennebaud 2019-01-15 09:58:26 UTC
Created attachment 916 [details]
Add conjugateIf<cond>()  members

Patch ready. I also added it to triangularView and selfadjointView, and updated PartialPivLU to make use of it.
Comment 2 Nobody 2019-12-04 18:21:52 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance:

Note You need to log in before you can comment on or make changes to this bug.