CR2RE Pipeline Reference Manual 1.6.7
hdrl_cat_polynm-test.c
1/*
2 * This file is part of the HDRL
3 * Copyright (C) 2017 European Southern Observatory
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <cpl_test.h>
21
22#include "../hdrl_cat_polynm.h"
23
24
25int main(void)
26{
27 cpl_test_init(PACKAGE_BUGREPORT,CPL_MSG_WARNING);
28
29
30 /* Initialize */
31 double x[] = { 1. , 3. , 5. , -10.};
32 double y[] = {-0.5, -27.5, -86.5, -424.};
33
34 double coefs[3] = {1., 2.5, -4.};
35 double poly[3];
36
37 /* Do the test */
38 hdrl_polynm(y, x, 4, poly, 3, 0);
39
40 /* Check the results */
41 cpl_test_rel(poly[0], coefs[0], 0.01);
42 cpl_test_rel(poly[1], coefs[1], 0.01);
43 cpl_test_rel(poly[2], coefs[2], 0.01);
44
45
46 return cpl_test_end(0);
47}
cpl_error_code hdrl_polynm(double xdat[], double xcor[], cpl_size n, double polycf[], cpl_size m, cpl_size ilim)
Work out the median seeing.