math/doc/html/math_toolkit/cardinal_quadratic_b.html
2019-10-31 17:55:35 +00:00

104 lines
10 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Cardinal Quadratic B-spline 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 2.11.0">
<link rel="up" href="../interpolation.html" title="Chapter&#160;12.&#160;Interpolation">
<link rel="prev" href="cardinal_cubic_b.html" title="Cardinal Cubic B-spline interpolation">
<link rel="next" href="cardinal_quintic_b.html" title="Cardinal Quintic B-spline 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_cubic_b.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="cardinal_quintic_b.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.cardinal_quadratic_b"></a><a class="link" href="cardinal_quadratic_b.html" title="Cardinal Quadratic B-spline interpolation">Cardinal Quadratic B-spline
interpolation</a>
</h2></div></div></div>
<h4>
<a name="math_toolkit.cardinal_quadratic_b.h0"></a>
<span class="phrase"><a name="math_toolkit.cardinal_quadratic_b.synopsis"></a></span><a class="link" href="cardinal_quadratic_b.html#math_toolkit.cardinal_quadratic_b.synopsis">Synopsis</a>
</h4>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</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_quadratic_b_spline</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">interpolators</span> <span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Real</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">cardinal_quadratic_b_spline</span>
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="comment">// If you don't know the value of the derivative at the endpoints, leave them as NaNs and the routine will estimate them.</span>
<span class="comment">// y[0] = y(a), y[n - 1] = y(b), step_size = (b - a)/(n -1).</span>
<span class="identifier">cardinal_quadratic_b_spline</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Real</span><span class="special">*</span> <span class="keyword">const</span> <span class="identifier">y</span><span class="special">,</span>
<span class="identifier">size_t</span> <span class="identifier">n</span><span class="special">,</span>
<span class="identifier">Real</span> <span class="identifier">t0</span> <span class="comment">/* initial time, left endpoint */</span><span class="special">,</span>
<span class="identifier">Real</span> <span class="identifier">h</span> <span class="comment">/*spacing, stepsize*/</span><span class="special">,</span>
<span class="identifier">Real</span> <span class="identifier">left_endpoint_derivative</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">Real</span><span class="special">&gt;::</span><span class="identifier">quiet_NaN</span><span class="special">(),</span>
<span class="identifier">Real</span> <span class="identifier">right_endpoint_derivative</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">Real</span><span class="special">&gt;::</span><span class="identifier">quiet_NaN</span><span class="special">())</span>
<span class="identifier">cardinal_quadratic_b_spline</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special">&lt;</span><span class="identifier">Real</span><span class="special">&gt;</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">y</span><span class="special">,</span>
<span class="identifier">Real</span> <span class="identifier">t0</span> <span class="comment">/* initial time, left endpoint */</span><span class="special">,</span>
<span class="identifier">Real</span> <span class="identifier">h</span> <span class="comment">/*spacing, stepsize*/</span><span class="special">,</span>
<span class="identifier">Real</span> <span class="identifier">left_endpoint_derivative</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">Real</span><span class="special">&gt;::</span><span class="identifier">quiet_NaN</span><span class="special">(),</span>
<span class="identifier">Real</span> <span class="identifier">right_endpoint_derivative</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">Real</span><span class="special">&gt;::</span><span class="identifier">quiet_NaN</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">t</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">t</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">};</span>
<span class="special">}}}</span>
</pre>
<h4>
<a name="math_toolkit.cardinal_quadratic_b.h1"></a>
<span class="phrase"><a name="math_toolkit.cardinal_quadratic_b.cardinal_quadratic_b_spline_inte"></a></span><a class="link" href="cardinal_quadratic_b.html#math_toolkit.cardinal_quadratic_b.cardinal_quadratic_b_spline_inte">Cardinal
Quadratic B-Spline Interpolation</a>
</h4>
<p>
The cardinal quadratic B-spline interpolator is very nearly the same as the
cubic B-spline interpolator, with the modification that the basis functions
are constructed by convolving a box function with itself twice, rather than
three times as is done with the cubic B-spline.
</p>
<p>
Since the basis functions are less smooth than the cubic B-spline, you will
nearly always wish to use the cubic B-spline interpolator rather than this.
However, this interpolator is occasionally useful for approximating functions
of reduced smoothness, as hence finds use internally in the Boost.Math library.
</p>
<p>
It is reasonable to test this interpolator against the cubic b-spline interpolator
when you are approximating functions which are two or three times continuously
differentiable, but not three or four times differentiable.
</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 &#169; 2006-2019 Nikhar
Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
R&#229;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_cubic_b.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="cardinal_quintic_b.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>