1 /*! ========================================================================
2 ** Extended Template and Library Test Suite
6 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
8 ** This package is free software; you can redistribute it and/or
9 ** modify it under the terms of the GNU General Public License as
10 ** published by the Free Software Foundation; either version 2 of
11 ** the License, or (at your option) any later version.
13 ** This package is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ** General Public License for more details.
18 ** === N O T E S ===========================================================
20 ** ========================================================================= */
22 /* === H E A D E R S ======================================================= */
27 #include <ETL/calculus>
30 /* === M A C R O S ========================================================= */
34 /* === C L A S S E S ======================================================= */
37 /* === P R O C E D U R E S ================================================= */
39 int bspline_basic_test(void)
44 bspline<float> BSpline;
48 *BSpline.cpoints().insert(BSpline.cpoints().end())=0;
49 *BSpline.cpoints().insert(BSpline.cpoints().end())=-1;
50 *BSpline.cpoints().insert(BSpline.cpoints().end())=0;
51 *BSpline.cpoints().insert(BSpline.cpoints().end())=1;
52 *BSpline.cpoints().insert(BSpline.cpoints().end())=0;
55 BSpline.reset_knots();
57 integral<bspline<float> > inte(BSpline);
61 for(f=0.0;f<1.001;f+=0.05)
62 fprintf(stderr,"BSpline(%f)= %f\n",f,BSpline(f));
65 fprintf(stderr,"integral of BSpline() on [0,1] = %f\n",inte(0,1.0));
68 for(f=0.0f,timer.reset();f<1.001f;f+=0.000005f)
70 t+=BSpline(f)+BSpline(f+0.1f);
71 t+=BSpline(f)+BSpline(f+0.1f);
72 t+=BSpline(f)+BSpline(f+0.1f);
73 t+=BSpline(f)+BSpline(f+0.1f);
74 t+=BSpline(f)+BSpline(f+0.1f);
75 t+=BSpline(f)+BSpline(f+0.1f);
76 t+=BSpline(f)+BSpline(f+0.1f);
77 t+=BSpline(f)+BSpline(f+0.1f);
78 t+=BSpline(f)+BSpline(f+0.1f);
79 t+=BSpline(f)+BSpline(f+0.1f);
80 t+=BSpline(f)+BSpline(f+0.1f);
81 t+=BSpline(f)+BSpline(f+0.1f);
85 fprintf(stderr,"BSpline time=%f milliseconds\n",t*1000);
89 /* === E N T R Y P O I N T ================================================= */
95 error+=bspline_basic_test();