[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] docs updates
- From: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>
- Date: Sun, 12 Oct 2008 19:25:04 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=OzrTP2VrpRVqrTUBnoAv9VE1TozBCuLZKPQuZNPU66k=; b=Y6lkyx2tqc/e/qS0dUAQNdr3HWcWVIa2u2VovcTDmQaz60l3wXUf4hm/jafeFU0f5z wnoklAkezUKDX7KiytpoK3WGWVj2v8YAM6dHj/EK4vezdHfYmR2rPJiTpRgPd2Y39hbc LmhnpvtpJWXHIndJXjMOr6/tK1dS4fv7SV+Xg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=q+AdFHpHPNhjNjgoZ+wKk1dC3SMFkTd34tgtdBKcdBh5lXGl4HNl4ygb+nnYpKdaqG HdYOjXYU8x4itFhtZ2gQzkz8BxKZLbZlnXXhNI3d8Mwjna0MfvJNN01IHQMh0LnyiviD vYcNjx5lLbggj3etXd8t4yGbooPlhf2YHl4XM=
On Sun, Oct 12, 2008 at 5:37 PM, Benoît Jacob <jacob@xxxxxxxxxxxxxxx>
Indeed, a single template function lpNorm<p>() might be the way to go.
> I've seen it done as a template parameter in at least one other
> framework. Since they're templates, and hence being inlined, a compiler
> should optimize out the if block in the case of a constant being used.
> I feel like having them rolled into one function would make the API
> easier to work with (less functions to scan), but of course the final
> decision is with you guys.
Just FYI, yes the compiler will ultimately emit code for only one path, but it
will still go over all paths at least in the front-end, making compilation
longer. This can be avoided by "meta-selectors" i.e. using template
specialization instead of if().
ok, I agree with that proposal. and here we can directly use template specialization of lpNorm<>, no need to use a meta selector.