Re: [eigen] still the solve() API debate

[ Thread Index | Date Index | More Archives ]

2009/9/11 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> On Fri, Sep 11, 2009 at 3:13 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>> Same thing when we do A.solveInPlace(b.start(n)), start() returns a
>> temporary, same problem, whence the idea of inplace() or whatever we
>> call it.
> Ok, I just caught up with re-reading... that's indeed ugly. But as you
> guys already observed, in new compiler versions we already have rvalue
> references. Benoit, what about your idea of passing Matrices by
> reference and MatrixBase by value? You suggested to do that in the
> "MatrixBase::swap - why const" thread? This approach would allow an
> easy transition towards rvalues references in the future.

That would be perfect, if you figure it out.

I tried to think how that could be done, some time ago, but didn't
succeed. Doesn't mean it can't be done, i'm just not very good. The
basic problem is that if you define two methods,
template<typename Derived> swap(MatrixBase<Derived>)
then when you call this on a matrix both variants are possible, and I
expect that the compiler will reject this as "ambiguous".

If that doesn't work, and if we want to keep swap in infix notation,
then I propose this:

matrix.row(i) = Eigen::swap(matrix.row(j));

or if we give up infix notation:

matrix.row(i) = matrix.row(j).swap();


Mail converted by MHonArc 2.6.19+