/usr/include/pspline.h is in libalglib-dev 2.6.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | /*************************************************************************
Copyright (c) 2006-2010, Sergey Bochkanov (ALGLIB project).
>>> SOURCE LICENSE >>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation (www.fsf.org); either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
A copy of the GNU General Public License is available at
http://www.fsf.org/licensing/licenses
>>> END OF LICENSE >>>
*************************************************************************/
#ifndef _pspline_h
#define _pspline_h
#include "ap.h"
#include "ialglib.h"
#include "spline3.h"
#include "blas.h"
#include "reflections.h"
#include "creflections.h"
#include "hqrnd.h"
#include "matgen.h"
#include "ablasf.h"
#include "ablas.h"
#include "trfac.h"
#include "trlinsolve.h"
#include "safesolve.h"
#include "rcond.h"
#include "matinv.h"
#include "hblas.h"
#include "sblas.h"
#include "ortfac.h"
#include "rotations.h"
#include "bdsvd.h"
#include "svd.h"
#include "xblas.h"
#include "densesolver.h"
#include "linmin.h"
#include "minlbfgs.h"
#include "minlm.h"
#include "lsfit.h"
#include "apserv.h"
#include "spline1d.h"
#include "tsort.h"
#include "hsschur.h"
#include "evd.h"
#include "gammafunc.h"
#include "gq.h"
#include "gkq.h"
#include "autogk.h"
/*************************************************************************
Parametric spline inteprolant: 2-dimensional curve.
You should not try to access its members directly - use PSpline2XXXXXXXX()
functions instead.
*************************************************************************/
struct pspline2interpolant
{
int n;
bool periodic;
ap::real_1d_array p;
spline1dinterpolant x;
spline1dinterpolant y;
};
/*************************************************************************
Parametric spline inteprolant: 3-dimensional curve.
You should not try to access its members directly - use PSpline3XXXXXXXX()
functions instead.
*************************************************************************/
struct pspline3interpolant
{
int n;
bool periodic;
ap::real_1d_array p;
spline1dinterpolant x;
spline1dinterpolant y;
spline1dinterpolant z;
};
/*************************************************************************
This function builds non-periodic 2-dimensional parametric spline which
starts at (X[0],Y[0]) and ends at (X[N-1],Y[N-1]).
INPUT PARAMETERS:
XY - points, array[0..N-1,0..1].
XY[I,0:1] corresponds to the Ith point.
Order of points is important!
N - points count, N>=5 for Akima splines, N>=2 for other types of
splines.
ST - spline type:
* 0 Akima spline
* 1 parabolically terminated Catmull-Rom spline (Tension=0)
* 2 parabolically terminated cubic spline
PT - parameterization type:
* 0 uniform
* 1 chord length
* 2 centripetal
OUTPUT PARAMETERS:
P - parametric spline interpolant
NOTES:
* this function assumes that there all consequent points are distinct.
I.e. (x0,y0)<>(x1,y1), (x1,y1)<>(x2,y2), (x2,y2)<>(x3,y3) and so on.
However, non-consequent points may coincide, i.e. we can have (x0,y0)=
=(x2,y2).
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline2build(ap::real_2d_array xy,
int n,
int st,
int pt,
pspline2interpolant& p);
/*************************************************************************
This function builds non-periodic 3-dimensional parametric spline which
starts at (X[0],Y[0],Z[0]) and ends at (X[N-1],Y[N-1],Z[N-1]).
Same as PSpline2Build() function, but for 3D, so we won't duplicate its
description here.
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline3build(ap::real_2d_array xy,
int n,
int st,
int pt,
pspline3interpolant& p);
/*************************************************************************
This function builds periodic 2-dimensional parametric spline which
starts at (X[0],Y[0]), goes through all points to (X[N-1],Y[N-1]) and then
back to (X[0],Y[0]).
INPUT PARAMETERS:
XY - points, array[0..N-1,0..1].
XY[I,0:1] corresponds to the Ith point.
XY[N-1,0:1] must be different from XY[0,0:1].
Order of points is important!
N - points count, N>=3 for other types of splines.
ST - spline type:
* 1 Catmull-Rom spline (Tension=0) with cyclic boundary conditions
* 2 cubic spline with cyclic boundary conditions
PT - parameterization type:
* 0 uniform
* 1 chord length
* 2 centripetal
OUTPUT PARAMETERS:
P - parametric spline interpolant
NOTES:
* this function assumes that there all consequent points are distinct.
I.e. (x0,y0)<>(x1,y1), (x1,y1)<>(x2,y2), (x2,y2)<>(x3,y3) and so on.
However, non-consequent points may coincide, i.e. we can have (x0,y0)=
=(x2,y2).
* last point of sequence is NOT equal to the first point. You shouldn't
make curve "explicitly periodic" by making them equal.
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline2buildperiodic(ap::real_2d_array xy,
int n,
int st,
int pt,
pspline2interpolant& p);
/*************************************************************************
This function builds periodic 3-dimensional parametric spline which
starts at (X[0],Y[0],Z[0]), goes through all points to (X[N-1],Y[N-1],Z[N-1])
and then back to (X[0],Y[0],Z[0]).
Same as PSpline2Build() function, but for 3D, so we won't duplicate its
description here.
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline3buildperiodic(ap::real_2d_array xy,
int n,
int st,
int pt,
pspline3interpolant& p);
/*************************************************************************
This function returns vector of parameter values correspoding to points.
I.e. for P created from (X[0],Y[0])...(X[N-1],Y[N-1]) and U=TValues(P) we
have
(X[0],Y[0]) = PSpline2Calc(P,U[0]),
(X[1],Y[1]) = PSpline2Calc(P,U[1]),
(X[2],Y[2]) = PSpline2Calc(P,U[2]),
...
INPUT PARAMETERS:
P - parametric spline interpolant
OUTPUT PARAMETERS:
N - array size
T - array[0..N-1]
NOTES:
* for non-periodic splines U[0]=0, U[0]<U[1]<...<U[N-1], U[N-1]=1
* for periodic splines U[0]=0, U[0]<U[1]<...<U[N-1], U[N-1]<1
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline2parametervalues(const pspline2interpolant& p,
int& n,
ap::real_1d_array& t);
/*************************************************************************
This function returns vector of parameter values correspoding to points.
Same as PSpline2ParameterValues(), but for 3D.
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline3parametervalues(const pspline3interpolant& p,
int& n,
ap::real_1d_array& t);
/*************************************************************************
This function calculates the value of the parametric spline for a given
value of parameter T
INPUT PARAMETERS:
P - parametric spline interpolant
T - point:
* T in [0,1] corresponds to interval spanned by points
* for non-periodic splines T<0 (or T>1) correspond to parts of
the curve before the first (after the last) point
* for periodic splines T<0 (or T>1) are projected into [0,1]
by making T=T-floor(T).
OUTPUT PARAMETERS:
X - X-position
Y - Y-position
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline2calc(const pspline2interpolant& p,
double t,
double& x,
double& y);
/*************************************************************************
This function calculates the value of the parametric spline for a given
value of parameter T.
INPUT PARAMETERS:
P - parametric spline interpolant
T - point:
* T in [0,1] corresponds to interval spanned by points
* for non-periodic splines T<0 (or T>1) correspond to parts of
the curve before the first (after the last) point
* for periodic splines T<0 (or T>1) are projected into [0,1]
by making T=T-floor(T).
OUTPUT PARAMETERS:
X - X-position
Y - Y-position
Z - Z-position
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline3calc(const pspline3interpolant& p,
double t,
double& x,
double& y,
double& z);
/*************************************************************************
This function calculates tangent vector for a given value of parameter T
INPUT PARAMETERS:
P - parametric spline interpolant
T - point:
* T in [0,1] corresponds to interval spanned by points
* for non-periodic splines T<0 (or T>1) correspond to parts of
the curve before the first (after the last) point
* for periodic splines T<0 (or T>1) are projected into [0,1]
by making T=T-floor(T).
OUTPUT PARAMETERS:
X - X-component of tangent vector (normalized)
Y - Y-component of tangent vector (normalized)
NOTE:
X^2+Y^2 is either 1 (for non-zero tangent vector) or 0.
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline2tangent(const pspline2interpolant& p,
double t,
double& x,
double& y);
/*************************************************************************
This function calculates tangent vector for a given value of parameter T
INPUT PARAMETERS:
P - parametric spline interpolant
T - point:
* T in [0,1] corresponds to interval spanned by points
* for non-periodic splines T<0 (or T>1) correspond to parts of
the curve before the first (after the last) point
* for periodic splines T<0 (or T>1) are projected into [0,1]
by making T=T-floor(T).
OUTPUT PARAMETERS:
X - X-component of tangent vector (normalized)
Y - Y-component of tangent vector (normalized)
Z - Z-component of tangent vector (normalized)
NOTE:
X^2+Y^2+Z^2 is either 1 (for non-zero tangent vector) or 0.
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline3tangent(const pspline3interpolant& p,
double t,
double& x,
double& y,
double& z);
/*************************************************************************
This function calculates derivative, i.e. it returns (dX/dT,dY/dT).
INPUT PARAMETERS:
P - parametric spline interpolant
T - point:
* T in [0,1] corresponds to interval spanned by points
* for non-periodic splines T<0 (or T>1) correspond to parts of
the curve before the first (after the last) point
* for periodic splines T<0 (or T>1) are projected into [0,1]
by making T=T-floor(T).
OUTPUT PARAMETERS:
X - X-value
DX - X-derivative
Y - Y-value
DY - Y-derivative
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline2diff(const pspline2interpolant& p,
double t,
double& x,
double& dx,
double& y,
double& dy);
/*************************************************************************
This function calculates derivative, i.e. it returns (dX/dT,dY/dT,dZ/dT).
INPUT PARAMETERS:
P - parametric spline interpolant
T - point:
* T in [0,1] corresponds to interval spanned by points
* for non-periodic splines T<0 (or T>1) correspond to parts of
the curve before the first (after the last) point
* for periodic splines T<0 (or T>1) are projected into [0,1]
by making T=T-floor(T).
OUTPUT PARAMETERS:
X - X-value
DX - X-derivative
Y - Y-value
DY - Y-derivative
Z - Z-value
DZ - Z-derivative
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline3diff(const pspline3interpolant& p,
double t,
double& x,
double& dx,
double& y,
double& dy,
double& z,
double& dz);
/*************************************************************************
This function calculates first and second derivative with respect to T.
INPUT PARAMETERS:
P - parametric spline interpolant
T - point:
* T in [0,1] corresponds to interval spanned by points
* for non-periodic splines T<0 (or T>1) correspond to parts of
the curve before the first (after the last) point
* for periodic splines T<0 (or T>1) are projected into [0,1]
by making T=T-floor(T).
OUTPUT PARAMETERS:
X - X-value
DX - derivative
D2X - second derivative
Y - Y-value
DY - derivative
D2Y - second derivative
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline2diff2(const pspline2interpolant& p,
double t,
double& x,
double& dx,
double& d2x,
double& y,
double& dy,
double& d2y);
/*************************************************************************
This function calculates first and second derivative with respect to T.
INPUT PARAMETERS:
P - parametric spline interpolant
T - point:
* T in [0,1] corresponds to interval spanned by points
* for non-periodic splines T<0 (or T>1) correspond to parts of
the curve before the first (after the last) point
* for periodic splines T<0 (or T>1) are projected into [0,1]
by making T=T-floor(T).
OUTPUT PARAMETERS:
X - X-value
DX - derivative
D2X - second derivative
Y - Y-value
DY - derivative
D2Y - second derivative
Z - Z-value
DZ - derivative
D2Z - second derivative
-- ALGLIB PROJECT --
Copyright 28.05.2010 by Bochkanov Sergey
*************************************************************************/
void pspline3diff2(const pspline3interpolant& p,
double t,
double& x,
double& dx,
double& d2x,
double& y,
double& dy,
double& d2y,
double& z,
double& dz,
double& d2z);
/*************************************************************************
This function calculates arc length, i.e. length of curve between t=a
and t=b.
INPUT PARAMETERS:
P - parametric spline interpolant
A,B - parameter values corresponding to arc ends:
* B>A will result in positive length returned
* B<A will result in negative length returned
RESULT:
length of arc starting at T=A and ending at T=B.
-- ALGLIB PROJECT --
Copyright 30.05.2010 by Bochkanov Sergey
*************************************************************************/
double pspline2arclength(const pspline2interpolant& p, double a, double b);
/*************************************************************************
This function calculates arc length, i.e. length of curve between t=a
and t=b.
INPUT PARAMETERS:
P - parametric spline interpolant
A,B - parameter values corresponding to arc ends:
* B>A will result in positive length returned
* B<A will result in negative length returned
RESULT:
length of arc starting at T=A and ending at T=B.
-- ALGLIB PROJECT --
Copyright 30.05.2010 by Bochkanov Sergey
*************************************************************************/
double pspline3arclength(const pspline3interpolant& p, double a, double b);
#endif
|