<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Cubic Hermite interpolation</title> <link rel="stylesheet" href="../math.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="../index.html" title="Math Toolkit 3.0.0"> <link rel="up" href="../interpolation.html" title="Chapter 12. Interpolation"> <link rel="prev" href="cardinal_trigonometric.html" title="Cardinal Trigonometric interpolation"> <link rel="next" href="makima.html" title="Modified Akima interpolation"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> <td align="center"><a href="../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="cardinal_trigonometric.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../interpolation.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="makima.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="math_toolkit.cubic_hermite"></a><a class="link" href="cubic_hermite.html" title="Cubic Hermite interpolation">Cubic Hermite interpolation</a> </h2></div></div></div> <h4> <a name="math_toolkit.cubic_hermite.h0"></a> <span class="phrase"><a name="math_toolkit.cubic_hermite.synopsis"></a></span><a class="link" href="cubic_hermite.html#math_toolkit.cubic_hermite.synopsis">Synopsis</a> </h4> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">interpolators</span><span class="special">/</span><span class="identifier">cubic_hermite</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> </pre> <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">interpolators</span> <span class="special">{</span> <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">RandomAccessContainer</span><span class="special">></span> <span class="keyword">class</span> <span class="identifier">cubic_hermite</span> <span class="special">{</span> <span class="keyword">public</span><span class="special">:</span> <span class="keyword">using</span> <span class="identifier">Real</span> <span class="special">=</span> <span class="identifier">RandomAccessContainer</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">;</span> <span class="identifier">cubic_hermite</span><span class="special">(</span><span class="identifier">RandomAccessContainer</span><span class="special">&&</span> <span class="identifier">abscissas</span><span class="special">,</span> <span class="identifier">RandomAccessContainer</span><span class="special">&&</span> <span class="identifier">ordinates</span><span class="special">,</span> <span class="identifier">RandomAccessContainer</span><span class="special">&&</span> <span class="identifier">derivatives</span><span class="special">);</span> <span class="identifier">Real</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Real</span> <span class="identifier">x</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">Real</span> <span class="identifier">prime</span><span class="special">(</span><span class="identifier">Real</span> <span class="identifier">x</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">void</span> <span class="identifier">push_back</span><span class="special">(</span><span class="identifier">Real</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">y</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">dydx</span><span class="special">);</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">Real</span><span class="special">,</span> <span class="identifier">Real</span><span class="special">></span> <span class="identifier">domain</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">friend</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="keyword">operator</span><span class="special"><<(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span> <span class="special">&</span> <span class="identifier">os</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">cubic_hermite</span> <span class="special">&</span> <span class="identifier">m</span><span class="special">);</span> <span class="special">};</span> <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">RandomAccessContainer</span><span class="special">></span> <span class="keyword">class</span> <span class="identifier">cardinal_cubic_hermite</span> <span class="special">{</span> <span class="keyword">public</span><span class="special">:</span> <span class="keyword">using</span> <span class="identifier">Real</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">RandomAccessContainer</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">;</span> <span class="identifier">cardinal_cubic_hermite</span><span class="special">(</span><span class="identifier">RandomAccessContainer</span> <span class="special">&&</span> <span class="identifier">y</span><span class="special">,</span> <span class="identifier">RandomAccessContainer</span> <span class="special">&&</span> <span class="identifier">dydx</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">x0</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">dx</span><span class="special">)</span> <span class="keyword">inline</span> <span class="identifier">Real</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Real</span> <span class="identifier">x</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">inline</span> <span class="identifier">Real</span> <span class="identifier">prime</span><span class="special">(</span><span class="identifier">Real</span> <span class="identifier">x</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">Real</span><span class="special">,</span> <span class="identifier">Real</span><span class="special">></span> <span class="identifier">domain</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> <span class="special">};</span> <span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">RandomAccessContainer</span><span class="special">></span> <span class="keyword">class</span> <span class="identifier">cardinal_cubic_hermite_aos</span> <span class="special">{</span> <span class="keyword">public</span><span class="special">:</span> <span class="keyword">using</span> <span class="identifier">Point</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">RandomAccessContainer</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">;</span> <span class="keyword">using</span> <span class="identifier">Real</span> <span class="special">=</span> <span class="keyword">typename</span> <span class="identifier">Point</span><span class="special">::</span><span class="identifier">value_type</span><span class="special">;</span> <span class="identifier">cardinal_cubic_hermite_aos</span><span class="special">(</span><span class="identifier">RandomAccessContainer</span> <span class="special">&&</span> <span class="identifier">data</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">x0</span><span class="special">,</span> <span class="identifier">Real</span> <span class="identifier">dx</span><span class="special">);</span> <span class="keyword">inline</span> <span class="identifier">Real</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Real</span> <span class="identifier">x</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">inline</span> <span class="identifier">Real</span> <span class="identifier">prime</span><span class="special">(</span><span class="identifier">Real</span> <span class="identifier">x</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special"><</span><span class="identifier">Real</span><span class="special">,</span> <span class="identifier">Real</span><span class="special">></span> <span class="identifier">domain</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span> <span class="special">};</span> <span class="special">}</span> <span class="comment">// namespaces</span> </pre> <h4> <a name="math_toolkit.cubic_hermite.h1"></a> <span class="phrase"><a name="math_toolkit.cubic_hermite.cubic_hermite_interpolation"></a></span><a class="link" href="cubic_hermite.html#math_toolkit.cubic_hermite.cubic_hermite_interpolation">Cubic Hermite Interpolation</a> </h4> <p> The cubic Hermite interpolant takes non-equispaced data and interpolates between them via cubic Hermite polynomials whose slopes must be provided. This is a very nice interpolant for solution skeletons of ODEs steppers, since numerically solving <span class="emphasis"><em>y</em></span>' = <span class="emphasis"><em>f</em></span>(<span class="emphasis"><em>x</em></span>, <span class="emphasis"><em>y</em></span>) produces a list of positions, values, and their derivatives, i.e. (<span class="emphasis"><em>x</em></span>,<span class="emphasis"><em>y</em></span>,<span class="emphasis"><em>y</em></span>')=(<span class="emphasis"><em>x</em></span>,<span class="emphasis"><em>y</em></span>,<span class="emphasis"><em>f</em></span>(<span class="emphasis"><em>x</em></span>,<span class="emphasis"><em>y</em></span>))-which is exactly what is required for the cubic Hermite interpolator. The interpolant is <span class="emphasis"><em>C</em></span><sup>1</sup> and evaluation has 𝑶(log(<span class="emphasis"><em>N</em></span>)) complexity. An example usage is as follows: </p> <pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">x</span><span class="special">{</span><span class="number">1</span><span class="special">,</span> <span class="number">5</span><span class="special">,</span> <span class="number">9</span> <span class="special">,</span> <span class="number">12</span><span class="special">};</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">y</span><span class="special">{</span><span class="number">8</span><span class="special">,</span><span class="number">17</span><span class="special">,</span> <span class="number">4</span><span class="special">,</span> <span class="special">-</span><span class="number">3</span><span class="special">};</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">double</span> <span class="identifier">dydx</span><span class="special">{</span><span class="number">5</span><span class="special">,</span> <span class="special">-</span><span class="number">2</span><span class="special">,</span> <span class="special">-</span><span class="number">1</span><span class="special">};</span> <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">interpolators</span><span class="special">::</span><span class="identifier">cubic_hermite</span><span class="special">;</span> <span class="keyword">auto</span> <span class="identifier">spline</span> <span class="special">=</span> <span class="identifier">cubic_hermite</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">x</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">y</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">dydx</span><span class="special">));</span> <span class="comment">// evaluate at a point:</span> <span class="keyword">double</span> <span class="identifier">z</span> <span class="special">=</span> <span class="identifier">spline</span><span class="special">(</span><span class="number">3.4</span><span class="special">);</span> <span class="comment">// evaluate derivative at a point:</span> <span class="keyword">double</span> <span class="identifier">zprime</span> <span class="special">=</span> <span class="identifier">spline</span><span class="special">.</span><span class="identifier">prime</span><span class="special">(</span><span class="number">3.4</span><span class="special">);</span> </pre> <p> Sanity checking of the interpolator can be achieved via: </p> <pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">spline</span> <span class="special"><<</span> <span class="string">"\n"</span><span class="special">;</span> </pre> <p> Note that the interpolator is pimpl'd, so that copying the class is cheap, and hence it can be shared between threads. (The call operator and <code class="computeroutput"><span class="special">.</span><span class="identifier">prime</span><span class="special">()</span></code> are threadsafe; <code class="computeroutput"><span class="identifier">push_back</span></code> is not.) </p> <p> This interpolant can be updated in constant time. Hence we can use <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">circular_buffer</span></code> to do real-time interpolation: </p> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">circular_buffer</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> <span class="special">...</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">circular_buffer</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">initial_x</span><span class="special">{</span><span class="number">1</span><span class="special">,</span><span class="number">2</span><span class="special">,</span><span class="number">3</span><span class="special">,</span><span class="number">4</span><span class="special">};</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">circular_buffer</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">initial_y</span><span class="special">{</span><span class="number">4</span><span class="special">,</span><span class="number">5</span><span class="special">,</span><span class="number">6</span><span class="special">,</span><span class="number">7</span><span class="special">};</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">circular_buffer</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">initial_dydx</span><span class="special">{</span><span class="number">1</span><span class="special">,</span><span class="number">1</span><span class="special">,</span><span class="number">1</span><span class="special">,</span><span class="number">1</span><span class="special">};</span> <span class="keyword">auto</span> <span class="identifier">circular_hermite</span> <span class="special">=</span> <span class="identifier">cubic_hermite</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">initial_x</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">initial_y</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">initial_dydx</span><span class="special">));</span> <span class="comment">// interpolate via call operation:</span> <span class="keyword">double</span> <span class="identifier">y</span> <span class="special">=</span> <span class="identifier">circular_hermite</span><span class="special">(</span><span class="number">3.5</span><span class="special">);</span> <span class="comment">// add new data:</span> <span class="identifier">circular_hermite</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="number">5</span><span class="special">,</span> <span class="number">8</span><span class="special">);</span> <span class="comment">// interpolate at 4.5:</span> <span class="identifier">y</span> <span class="special">=</span> <span class="identifier">circular_hermite</span><span class="special">(</span><span class="number">4.5</span><span class="special">);</span> </pre> <p> For the equispaced case, we can either use <code class="computeroutput"><span class="identifier">cardinal_cubic_hermite</span></code>, which accepts two separate arrays of <code class="computeroutput"><span class="identifier">y</span></code> and <code class="computeroutput"><span class="identifier">dydx</span></code>, or we can use <code class="computeroutput"><span class="identifier">cardinal_cubic_hermite_aos</span></code>, which takes a vector of <code class="computeroutput"><span class="special">(</span><span class="identifier">y</span><span class="special">,</span> <span class="identifier">dydx</span><span class="special">)</span></code>, i.e., and array of structs (<code class="computeroutput"><span class="identifier">aos</span></code>). The array of structs should be preferred as it uses cache more effectively. </p> <p> Usage is as follows: </p> <pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">interpolators</span><span class="special">::</span><span class="identifier">cardinal_cubic_hermite</span><span class="special">;</span> <span class="keyword">double</span> <span class="identifier">x0</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="keyword">double</span> <span class="identifier">dx</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">y</span><span class="special">(</span><span class="number">128</span><span class="special">,</span> <span class="number">1</span><span class="special">);</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">dydx</span><span class="special">(</span><span class="number">128</span><span class="special">,</span> <span class="number">0</span><span class="special">);</span> <span class="keyword">auto</span> <span class="identifier">ch</span> <span class="special">=</span> <span class="identifier">cardinal_cubic_hermite</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">y</span><span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">dydx</span><span class="special">),</span> <span class="identifier">x0</span><span class="special">,</span> <span class="identifier">dx</span><span class="special">);</span> </pre> <p> For the "array of structs" version: </p> <pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">interpolators</span><span class="special">::</span><span class="identifier">cardinal_cubic_hermite_aos</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">array</span><span class="special"><</span><span class="keyword">double</span><span class="special">,</span> <span class="number">2</span><span class="special">>></span> <span class="identifier">data</span><span class="special">(</span><span class="number">128</span><span class="special">);</span> <span class="keyword">for</span> <span class="special">(</span><span class="keyword">auto</span> <span class="special">&</span> <span class="identifier">datum</span> <span class="special">:</span> <span class="identifier">data</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">datum</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="comment">// y</span> <span class="identifier">datum</span><span class="special">[</span><span class="number">1</span><span class="special">]</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="comment">// y'</span> <span class="special">}</span> <span class="keyword">auto</span> <span class="identifier">ch</span> <span class="special">=</span> <span class="identifier">cardinal_cubic_hermite_aos</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">move</span><span class="special">(</span><span class="identifier">data</span><span class="special">),</span> <span class="identifier">x0</span><span class="special">,</span> <span class="identifier">dx</span><span class="special">);</span> </pre> <p> For a quick sanity check, we can call <code class="computeroutput"><span class="identifier">ch</span><span class="special">.</span><span class="identifier">domain</span><span class="special">()</span></code>: </p> <pre class="programlisting"><span class="keyword">auto</span> <span class="special">[</span><span class="identifier">x_min</span><span class="special">,</span> <span class="identifier">x_max</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">ch</span><span class="special">.</span><span class="identifier">domain</span><span class="special">();</span> </pre> <h4> <a name="math_toolkit.cubic_hermite.h2"></a> <span class="phrase"><a name="math_toolkit.cubic_hermite.performance"></a></span><a class="link" href="cubic_hermite.html#math_toolkit.cubic_hermite.performance">Performance</a> </h4> <p> Google benchmark was used to evaluate the performance. </p> <pre class="programlisting"><span class="identifier">Run</span> <span class="identifier">on</span> <span class="special">(</span><span class="number">16</span> <span class="identifier">X</span> <span class="number">4300</span> <span class="identifier">MHz</span> <span class="identifier">CPU</span> <span class="identifier">s</span><span class="special">)</span> <span class="identifier">CPU</span> <span class="identifier">Caches</span><span class="special">:</span> <span class="identifier">L1</span> <span class="identifier">Data</span> <span class="number">32</span> <span class="identifier">KiB</span> <span class="special">(</span><span class="identifier">x8</span><span class="special">)</span> <span class="identifier">L1</span> <span class="identifier">Instruction</span> <span class="number">32</span> <span class="identifier">KiB</span> <span class="special">(</span><span class="identifier">x8</span><span class="special">)</span> <span class="identifier">L2</span> <span class="identifier">Unified</span> <span class="number">1024</span> <span class="identifier">KiB</span> <span class="special">(</span><span class="identifier">x8</span><span class="special">)</span> <span class="identifier">L3</span> <span class="identifier">Unified</span> <span class="number">11264</span> <span class="identifier">KiB</span> <span class="special">(</span><span class="identifier">x1</span><span class="special">)</span> <span class="identifier">Load</span> <span class="identifier">Average</span><span class="special">:</span> <span class="number">1.16</span><span class="special">,</span> <span class="number">1.11</span><span class="special">,</span> <span class="number">0.99</span> <span class="special">-----------------------------------------------------</span> <span class="identifier">Benchmark</span> <span class="identifier">Time</span> <span class="special">-----------------------------------------------------</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">256</span> <span class="number">9.67</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">512</span> <span class="number">10.4</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">1024</span> <span class="number">10.9</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">2048</span> <span class="number">12.3</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">4096</span> <span class="number">13.4</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">8192</span> <span class="number">14.9</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">16384</span> <span class="number">15.5</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">32768</span> <span class="number">18.0</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">65536</span> <span class="number">19.9</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">131072</span> <span class="number">23.0</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">262144</span> <span class="number">25.3</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">524288</span> <span class="number">28.9</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">1048576</span> <span class="number">31.0</span> <span class="identifier">ns</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span><span class="identifier">_BigO</span> <span class="number">1.32</span> <span class="identifier">lgN</span> <span class="identifier">CubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span><span class="identifier">_RMS</span> <span class="number">13</span> <span class="special">%</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">256</span> <span class="number">3.14</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">512</span> <span class="number">3.13</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">1024</span> <span class="number">3.19</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">2048</span> <span class="number">3.14</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">4096</span> <span class="number">3.38</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">8192</span> <span class="number">3.54</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">16384</span> <span class="number">3.51</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">32768</span> <span class="number">3.76</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">65536</span> <span class="number">5.82</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">131072</span> <span class="number">5.76</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">262144</span> <span class="number">5.85</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">524288</span> <span class="number">5.69</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">1048576</span> <span class="number">5.77</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span><span class="identifier">_BigO</span> <span class="number">4.28</span> <span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="identifier">CardinalCubicHermite</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span><span class="identifier">_RMS</span> <span class="number">28</span> <span class="special">%</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">256</span> <span class="number">3.22</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">512</span> <span class="number">3.22</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">1024</span> <span class="number">3.26</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">2048</span> <span class="number">3.23</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">4096</span> <span class="number">3.49</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">8192</span> <span class="number">3.57</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">16384</span> <span class="number">3.73</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">32768</span> <span class="number">4.12</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">65536</span> <span class="number">4.13</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">131072</span> <span class="number">4.12</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">262144</span> <span class="number">4.12</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">524288</span> <span class="number">4.12</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">>/</span><span class="number">1048576</span> <span class="number">4.19</span> <span class="identifier">ns</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span><span class="identifier">_BigO</span> <span class="number">3.73</span> <span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="identifier">CardinalCubicHermiteAOS</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span><span class="identifier">_RMS</span> <span class="number">11</span> <span class="special">%</span> </pre> <p> The logarithmic complexity of the non-equispaced version is evident, as is the better cache utilization of the "array of structs" version as the problem size gets larger. </p> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright © 2006-2021 Nikhar Agrawal, Anton Bikineev, Matthew Borland, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert Holin, Bruno Lalande, John Maddock, Evan Miller, Jeremy Murphy, Matthew Pulver, Johan Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="cardinal_trigonometric.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../interpolation.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="makima.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>