<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>So it seems like we already have an implementation of Horner and
Clenshaw in:</p>
<p> <a class="moz-txt-link-freetext" href="https://github.com/OSGeo/PROJ/blob/master/src/mlfn.cpp">https://github.com/OSGeo/PROJ/blob/master/src/mlfn.cpp</a><br>
</p>
<div class="moz-signature">called <i>polyval()</i> and <i>clenshaw()</i>
just like in GeographicLib ( <a
href="https://github.com/geographiclib/geographiclib/blob/main/include/GeographicLib/Math.hpp#L280">polyval()</a>
, <a
href="https://github.com/geographiclib/geographiclib/blob/main/src/AuxLatitude.cpp#L1319">Clenshaw()</a>).<br>
</div>
<div class="moz-signature"><br>
</div>
<div class="moz-signature">It seems like Charles wrote or at least
updated that :)</div>
<div class="moz-signature"><br>
</div>
<div class="moz-signature">That is using the Cµφ (C[mu phi]) (A5)
and Cφµ (C[phi mu]) (A6) from page 12 of the paper, where µ is
called the "rectifying latitude".<br>
I imagine that this is directly related to the "meridional
distance" ?</div>
<div class="moz-signature"><br>
</div>
<div class="moz-signature">Perhaps we could re-organize this a bit
to share this <i>polyval()</i> and <i>clenshaw()</i> (they are
currently static functions local to this <i>mlfn.cpp</i>) for use
in <i>auth.cpp</i> ?</div>
<div class="moz-signature"><br>
</div>
<div class="moz-signature">Thanks!</div>
<div class="moz-signature"><br>
</div>
<div class="moz-signature">Kind regards,</div>
<div class="moz-signature"><br>
</div>
<div class="moz-signature">-Jerome<br>
</div>
<div class="moz-signature"><br>
</div>
<div class="moz-cite-prefix">On 9/11/24 3:33 PM, Jérôme St-Louis
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:9ab1b1a7-caae-43cc-97a5-ab5ddade3f26@ecere.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p>Thanks a lot for the input Charles and Thomas,</p>
<p>I am not familiar with either <a
href="https://en.wikipedia.org/wiki/Horner%27s_method"
moz-do-not-send="true">Horner</a> or <a
href="https://en.wikipedia.org/wiki/Clenshaw_algorithm"
moz-do-not-send="true">Clenshaw</a>, but I do see the mentions
now on <i>Section 6 - Evaluating the series</i> pages 6 and 7
of the papers.<br>
I implemented the simpler basic approach from section 3 / page
3, which also happened to more easily correspond to the existing
PROJ implementation.</p>
<p>I can definitely try to understand all this, with the help of
this Rust Geodesy code and the GeographicLib code, and have a go
at updating my proposed implementation for improved accuracy and
performance.</p>
<p>Kind regards,</p>
<p>-Jerome</p>
<div class="moz-cite-prefix">On 9/11/24 12:18 PM, Thomas Knudsen
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAH0YoEMiYpNxR1LNYFxh9BqjM=NWWaiJKFZV_2yoe+kb__uy2g@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">I totally agree with Charles regarding using Horner for polynomial
evaluation and Clenshaw for the trig series - for accuracy and speed.
I implemented all the material from Charles' preprint
<a class="moz-txt-link-freetext" href="https://arxiv.org/pdf/2212.05818"
moz-do-not-send="true">https://arxiv.org/pdf/2212.05818</a> for Rust Geodesy, when the preprint
appeared about 1½ years ago.
And although (being an experiment) my handling of the raw coefficients
is rather clumsy, at least it gave me a reason to revise my PROJ horner
and clenshaw implementations (which in turn were based on material from
Poder & Engsager: "Some Conformal Mappings...").
So Jérôme, perhaps take a look at the functions "taylor" and "fourier"
over at <a class="moz-txt-link-freetext"
href="https://github.com/busstoptaktik/geodesy/blob/main/src/math/series.rs"
moz-do-not-send="true">https://github.com/busstoptaktik/geodesy/blob/main/src/math/series.rs</a>
While written in Rust, translating to C++ should be rather trivial,
and they may be easier to follow than my decade-old versions already
in the PROJ code base.
</pre>
</blockquote>
</blockquote>
</body>
</html>