1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Cubic Hermite interpolation</title> 5<link rel="stylesheet" href="../math.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../index.html" title="Math Toolkit 2.12.0"> 8<link rel="up" href="../interpolation.html" title="Chapter 12. Interpolation"> 9<link rel="prev" href="cardinal_trigonometric.html" title="Cardinal Trigonometric interpolation"> 10<link rel="next" href="makima.html" title="Modified Akima interpolation"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<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> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 27<a name="math_toolkit.cubic_hermite"></a><a class="link" href="cubic_hermite.html" title="Cubic Hermite interpolation">Cubic Hermite interpolation</a> 28</h2></div></div></div> 29<h4> 30<a name="math_toolkit.cubic_hermite.h0"></a> 31 <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> 32 </h4> 33<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> 34</pre> 35<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> 36 37<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">RandomAccessContainer</span><span class="special">></span> 38<span class="keyword">class</span> <span class="identifier">cubic_hermite</span> 39<span class="special">{</span> 40<span class="keyword">public</span><span class="special">:</span> 41 42 <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> 43 44 <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> 45 46 <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> 47 48 <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> 49 50 <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> 51 52 <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> 53 54 <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> 55<span class="special">};</span> 56 57<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">RandomAccessContainer</span><span class="special">></span> 58<span class="keyword">class</span> <span class="identifier">cardinal_cubic_hermite</span> <span class="special">{</span> 59<span class="keyword">public</span><span class="special">:</span> 60 <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> 61 62 <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> 63 64 <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> 65 66 <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> 67 68 <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> 69<span class="special">};</span> 70 71 72<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">RandomAccessContainer</span><span class="special">></span> 73<span class="keyword">class</span> <span class="identifier">cardinal_cubic_hermite_aos</span> <span class="special">{</span> 74<span class="keyword">public</span><span class="special">:</span> 75 <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> 76 <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> 77 78 <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> 79 80 <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> 81 82 <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> 83 84 <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> 85<span class="special">};</span> 86 87<span class="special">}</span> <span class="comment">// namespaces</span> 88</pre> 89<h4> 90<a name="math_toolkit.cubic_hermite.h1"></a> 91 <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 92 Interpolation</a> 93 </h4> 94<p> 95 The cubic Hermite interpolant takes non-equispaced data and interpolates between 96 them via cubic Hermite polynomials whose slopes must be provided. This is a 97 very nice interpolant for solution skeletons of ODEs steppers, since numerically 98 solving <span class="emphasis"><em>y</em></span>' = <span class="emphasis"><em>f</em></span>(<span class="emphasis"><em>x</em></span>, 99 <span class="emphasis"><em>y</em></span>) produces a list of positions, values, and their derivatives, 100 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 101 is exactly what is required for the cubic Hermite interpolator. The interpolant 102 is <span class="emphasis"><em>C</em></span><sup>1</sup> and evaluation has (log(<span class="emphasis"><em>N</em></span>)) 103 complexity. An example usage is as follows: 104 </p> 105<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> 106<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> 107<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> 108<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> 109<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> 110<span class="comment">// evaluate at a point:</span> 111<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> 112<span class="comment">// evaluate derivative at a point:</span> 113<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> 114</pre> 115<p> 116 Sanity checking of the interpolator can be achieved via: 117 </p> 118<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> 119</pre> 120<p> 121 Note that the interpolator is pimpl'd, so that copying the class is cheap, 122 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> 123 are threadsafe; <code class="computeroutput"><span class="identifier">push_back</span></code> is 124 not.) 125 </p> 126<p> 127 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> 128 to do real-time interpolation: 129 </p> 130<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> 131<span class="special">...</span> 132<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> 133<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> 134<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> 135<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> 136<span class="comment">// interpolate via call operation:</span> 137<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> 138<span class="comment">// add new data:</span> 139<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> 140<span class="comment">// interpolate at 4.5:</span> 141<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> 142</pre> 143<p> 144 For the equispaced case, we can either use <code class="computeroutput"><span class="identifier">cardinal_cubic_hermite</span></code>, 145 which accepts two separate arrays of <code class="computeroutput"><span class="identifier">y</span></code> 146 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 147 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>, 148 i.e., and array of structs (<code class="computeroutput"><span class="identifier">aos</span></code>). 149 The array of structs should be preferred as it uses cache more effectively. 150 </p> 151<p> 152 Usage is as follows: 153 </p> 154<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> 155<span class="keyword">double</span> <span class="identifier">x0</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> 156<span class="keyword">double</span> <span class="identifier">dx</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> 157<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> 158<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> 159<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> 160</pre> 161<p> 162 For the "array of structs" version: 163 </p> 164<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> 165<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> 166<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> 167 <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> 168 <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> 169<span class="special">}</span> 170 171<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> 172</pre> 173<p> 174 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>: 175 </p> 176<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> 177</pre> 178<h4> 179<a name="math_toolkit.cubic_hermite.h2"></a> 180 <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> 181 </h4> 182<p> 183 Google benchmark was used to evaluate the performance. 184 </p> 185<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> 186<span class="identifier">CPU</span> <span class="identifier">Caches</span><span class="special">:</span> 187 <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> 188 <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> 189 <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> 190 <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> 191<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> 192<span class="special">-----------------------------------------------------</span> 193<span class="identifier">Benchmark</span> <span class="identifier">Time</span> 194<span class="special">-----------------------------------------------------</span> 195<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> 196<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> 197<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> 198<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> 199<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> 200<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> 201<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> 202<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> 203<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> 204<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> 205<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> 206<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> 207<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> 208<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> 209<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> 210<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> 211<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> 212<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> 213<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> 214<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> 215<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> 216<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> 217<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> 218<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> 219<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> 220<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> 221<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> 222<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> 223<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> 224<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> 225<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> 226<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> 227<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> 228<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> 229<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> 230<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> 231<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> 232<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> 233<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> 234<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> 235<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> 236<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> 237<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> 238<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> 239<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> 240</pre> 241<p> 242 The logarithmic complexity of the non-equispaced version is evident, as is 243 the better cache utilization of the "array of structs" version as 244 the problem size gets larger. 245 </p> 246</div> 247<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 248<td align="left"></td> 249<td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar 250 Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, 251 Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan 252 Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, 253 Daryle Walker and Xiaogang Zhang<p> 254 Distributed under the Boost Software License, Version 1.0. (See accompanying 255 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>) 256 </p> 257</div></td> 258</tr></table> 259<hr> 260<div class="spirit-nav"> 261<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> 262</div> 263</body> 264</html> 265