Re: [eigen] Re: [Bitbucket] Pull request #80: Allow LevenbergMarquardt to work with non-standard types. (eigen/eigen) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: Eigen mailinglist <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [eigen] Re: [Bitbucket] Pull request #80: Allow LevenbergMarquardt to work with non-standard types. (eigen/eigen)
- From: Jitse Niesen <jitseniesen@xxxxxxxxx>
- Date: Sun, 31 Aug 2014 00:06:12 +0100 (BST)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1409439970; bh=YEKQwp2BuvWx0HwURR9M5EA2iaQSkEBPWHa8KxNCJJs=; h=Received:Received:Received:DKIM-Signature:X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Date:From:X-X-Sender:To:Subject:In-Reply-To:Message-ID:References:User-Agent:MIME-Version:Content-Type:From:Subject; b=THKPO6UBBfCVd5I+u529fi13QtJoGuIA4UX+RJn/ahCTRwCd5j69Rps9ASSIqm0HR34rd7GoRG8TzFqnbb1bbgMS+a1B7PVB4+8IKe27kmLxt0Q7qIqDwy57g8wn20kl9LxtSwMskHMfxuvTEwu/ZpUw1udD5X2IpXuSDbadIkzeiPErNdsjIbYYwobVfFPNUnCSgYDBZe4uHvfWuGclnZh3YI5dtUEaHckBd3C7yXdt/suunuB0fe/Ibn6QqdVYgLnnPHxzNpnD8fTieL8F56nOkHcqQjRDg2ChUpFTQNpo3PmGDhNHpIqQMHhxhqGidi7L3NPMz+FO3JLZCL/lkw==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1409439970; bh=YEKQwp2BuvWx0HwURR9M5EA2iaQSkEBPWHa8KxNCJJs=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Date:From:X-X-Sender:To:Subject:In-Reply-To:Message-ID:References:User-Agent:MIME-Version:Content-Type; b=OaRIf44JhUAFhc0RMXKpVHQwExHNkJU3SyPKiUxua6caI5/J6jOyL/2uXiZ9O/IwmHCT5ofEv4LJMcJaOad24j8N+bV1pS0uFYpgmdiwKb0Z1W+tc0ByT71zQU7+I7m8hjm1qBqVHB2gdr78SywFXraOurwmx27NpOGxX8uMQCI=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.com; b=iM0GZq55O40svCfOq2iFZuIqqnL9Komqm/hJSkhkLEKnr8I7wpjZYSF8X8y2OlzHRsKJxex4399dfQA8QMjDeAPcmj4UILb7Wo5+wfsEcA8ZZbr4AYgP2fAea9uNwsKYtmam3xYGkqmxyH256zKYGCj/KwvK9y2vDFDfP/+UupkEh3kmpWAA7+8cHSgnWorOndhzghUb3kvv+ja59v+tHyYCLv78mKz1wH89ltGqMnNen6N89Lv4sT63cJWAL0fHsVIxY4Sw4fRR7NryQSpAweKwz5DPDlozaGiFTsIhuFvro99iCq8HM/v0RLpdsyM1WgL307vygmN1HEcmBMCvcQ==;
On Fri, 29 Aug 2014, Christoph Hertzberg wrote:
Regarding the pull-request: Wouldn't it be better to define sqrt once in the
Eigen::numext namespace, and always use that? I don't think we should define
a sqrt_ function in every module that needs it.
I like the idea, though the discussion we had two years ago (starting with
http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2012/09/msg00026.html )
makes me rather nervous.
I am also not sure how to implement this. The straightforward attempt
would be:
namespace numext {
template <typename Scalar> Scalar sqrt(Scalar x) {
using std::sqrt; return sqrt(x);
}
}
However, I think the sqrt inside the function body is ambiguous because of
the presence of Eigen::numext::sqrt. Should we rename Eigen::numext::sqrt
to e.g. sqrt_ (this is what the patch which I merged did)? Alternatively,
perhaps we can exploit the overload rules to resolve this ambiguity but
that seems rather fragile.
Jitse