|Re: [eigen] still the solve() API debate|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] still the solve() API debate
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Fri, 11 Sep 2009 09:36:43 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=UaYs6iibse4izDt+eHKtmDAB9EULdDgL7OnBEUv59UI=; b=F/UDrOdTE4yo2VMN2H701c/bUwVWtDOjAJTkRF+nJJRBmqn0J0HUoxcnCmURA7N9JA NMzZkhMjRvm39oZ0rw214IHefl02NmU18b1ip4pIvffjN8KnLWMmBnUvRR4gORk1nJpo vpUcrbzML4iJT3TqyfbTU9bEj7IkN/63NmaEM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=xPHDD7r/Tg8ixUQUlEkDhcaui/3hYQSRLua883g0I7EzaZxRRqddsM4qDQJrRQrsqf WB+rXgV+h7R8sgmW3ILbRbBfLAEngaacHdruhHBDDfohIOXKh5AxZlFXNrNHjhZEoYmc 04ub9XNcHYDlzX6Pd9XU6WcchL7Mnt1aYq/5E=
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();