Re: [eigen] port of (c)minpack to eigen : status |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] port of (c)minpack to eigen : status
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 24 Sep 2009 15:52:02 -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=u0SMkoptEr4zmCSAVvZE+vPSXqfvCEKrM77+dLj7WuI=; b=IjcW0Fl2n6Y62ezfEGcqUEbNBAFscH6U5Ypy5mZdJfKeVY8PsSVmVK8fLf3As1eBmd t2uz8ai3JckNuDznVSYOPDe1PhNs6smymXZ+kubo4RuCgpXM+QmqJGsq5mxz1L0ncLsf 6ydduksFKU4dcLc4HT9su4vAAvggW/VWXaR68=
- 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=sd9jnTwvtaEZAnPLJ7mholtvLYu0Ua4c2CAlisJME16HifYM/V+2XgIKyk12O2zGcH QXPOJhF9JCYsTih8dYA6Z4F4kZ/AdWYV5/MkkBsQ4xxDVWi9a1OIeml16Cx5Wmd2iRQq m/13VWeXQTTBvbiG6Md6j40ul5couyBH3Ksdo=
Ok, me too, a few remarks...
First of all, as Hauke noted, there are public data members, I don't
think that's a good idea. It's true that, being a pure headers
library, we can't magically solve ABI compatibility problems by
protecting data members. But still, there are other advantages in
protecting them rather than having the user directly access them.
Also, we had a convention of prefixing all data members with m_. Once
you do that, it's cumbersome enough that you prefer to use accessor
methods ;)
Speaking of coding style, the indentation rules vary from place to
place, sometimes it's Eigen-ish, sometimes not at all. Obviously I'd
ask, please to what you can to Eigen-ify that, but again I don't want
to put a big burden on you as part of that code comes from a third
party.
The code seems to be only for double, right? Is there a good reason to
forbid float and other types?
It's hard to make more comments, as I don't know this stuff and there
are very few comments in the code. For example, you mentioned that
it's hard to reuse the ColPivotingHouseholderQR here, i would like to
hear about the specifics so I can try to adapt it. Is it in ei_r1updt?
It's hard to understand what this function does exactly.
The functors idea seems to have been implemented right. Then again,
not knowing about this stuff, I can't know if in this situation it's
better to use functors (so static polymorphism, resolved at compile
time) or virtual functions (so dynamic , runtime polymorphism). The
functors approach allows to have more things known at compile-time and
to make direct function calls.
At some places there is question of "superdiagonals" and
"subdiagonals". I don't understand this code, but if this has to do
with a band matrix, have you investigated the new BandMatrix class?
There are tons of 'for' loops that can and should be replaced by Eigen
expressions, but that's not a blocker, can be finished later.
The prerequisite for this is to make very extensive unit tests, so one
is sure not to introduce regressions.
By the way, your unit test looks rather good. I just don't know how
extensive it is (but at least it's big!). It's also funny that it
works on prescribed instead of random matrices, i guess that comes
from minpack..?
Benoit
2009/9/24 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> Ok, finally a few remarks...
>
> 1) I think it might be of interest for users to change the cost function at
> run-time. With the current design this is hardly possible since it requires
> to instantiate a new LevenbergMarquardt class for each cost-function.
> Pre-Instantiation of all possible optimizers is here a bit cumbersome. An
> alternative would be to define a pure virtual cost function base class.
> Actually, in our framework we have that even for optimizers since we also
> like to switch between let's say Downhill Simplex (or Nelder Mead) and
> LevenbergMarquardt. But that is really optional - though in our group we
> utilize it a lot.
>
> 2) void abort() would be nice in the optimizer's interface. There exist
> optimization procedures that take for longer than 5 minutes and here it
> makes a lot of sense to be able to terminate early. How this might be done
> a) Introduce a member: Status m_status;
> b) Replace each 'return Running;' by 'return m_status;'
> c) Replace each remaining 'return <status_type>' by 'm_status =
> <status_type>; return m_status;'
> d) Add 'void abort() { m_status = UserAsked; }
>
> 3) It seems, as if currently different functions are called for numerical
> differentiation vs. optimal storage vs. analytical differentiation. I am
> just wondering whether these special cases are not candidates for
> templating. These are basically policies, right? Like 'use as much mem as
> you want' vs. 'use minimal memory' and 'differentiate analytically' vs.
> 'differentiate by forword diffs'.
>
> 4) Optional: A callback function would be cool. Basically, some way of
> getting updates of intermediate optimization results. It oftentimes helps a
> lot in the course of debugging/tuning specific optimization problems because
> you can visualize the intermediate results.
>
> 5) Finally, I would not expose member variables directly and I am wondering
> whether all of those functions are required in the public interface.
>
> In general I like the work - it's cool to have a non-linear optimization
> based on Eigen. :) Thanks for your all the effort.
>
> Hauke
>