uves_utils_polynomial.h

00001 /*
00002  * This file is part of the ESO UVES Pipeline
00003  * Copyright (C) 2004,2005 European Southern Observatory
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA
00018  */
00019 
00020 /*
00021  * $Author: amodigli $
00022  * $Date: 2011/12/08 13:54:13 $
00023  * $Revision: 1.25 $
00024  * $Name: uves-5_0_0 $
00025  * $Log: uves_utils_polynomial.h,v $
00026  * Revision 1.25  2011/12/08 13:54:13  amodigli
00027  * include uves_cpl_size.h for CPL6
00028  *
00029  * Revision 1.24  2010/09/24 09:32:09  amodigli
00030  * put back QFITS dependency to fix problem spot by NRI on FIBER mode (with MIDAS calibs) data
00031  *
00032  * Revision 1.22  2007/09/11 17:08:49  amodigli
00033  * mooved uves_polynomial_convert_from_plist_midas to uves_dfs
00034  *
00035  * Revision 1.21  2007/06/20 08:30:03  amodigli
00036  * added index parameter to support FIBER mode lintab in uves_polynomial_convert_from_plist_midas
00037  *
00038  * Revision 1.20  2007/06/06 08:17:33  amodigli
00039  * replace tab with 4 spaces
00040  *
00041  * Revision 1.19  2007/05/03 15:18:31  jmlarsen
00042  * Added function to add polynomials
00043  *
00044  * Revision 1.18  2007/04/24 12:50:29  jmlarsen
00045  * Replaced cpl_propertylist -> uves_propertylist which is much faster
00046  *
00047  * Revision 1.17  2007/03/19 15:04:57  jmlarsen
00048  * Added get_degree function
00049  *
00050  * Revision 1.16  2007/03/05 10:20:51  jmlarsen
00051  * Added uves_polynomial_delete_const()
00052  *
00053  * Revision 1.15  2006/08/17 13:56:53  jmlarsen
00054  * Reduced max line length
00055  *
00056  * Revision 1.14  2006/04/24 09:28:29  jmlarsen
00057  * Added function to create zero-polynomial
00058  *
00059  * Revision 1.13  2005/12/19 16:17:56  jmlarsen
00060  * Replaced bool -> int
00061  *
00062  */
00063 #ifndef UVES_UTILS_POLYNOMIAL_H
00064 #define UVES_UTILS_POLYNOMIAL_H
00065 
00066 /*-----------------------------------------------------------------------------
00067                                    Includes
00068  -----------------------------------------------------------------------------*/
00069 
00070 #include <uves_propertylist.h>
00071 #include <cpl.h>
00072 #include <uves_cpl_size.h>
00073 /*-----------------------------------------------------------------------------
00074                                    Typedefs
00075  -----------------------------------------------------------------------------*/
00076 
00077 typedef struct _polynomial polynomial ;
00078 
00079 /*-----------------------------------------------------------------------------
00080                                    Prototypes
00081  -----------------------------------------------------------------------------*/
00082 
00083 
00084 polynomial *uves_polynomial_new(const cpl_polynomial *pol);
00085 polynomial *uves_polynomial_new_zero(int dim);
00086 polynomial *uves_polynomial_duplicate(const polynomial *p);
00087 
00088 
00089 polynomial *uves_polynomial_convert_from_table(cpl_table *t);
00090 polynomial *uves_polynomial_collapse(const polynomial *p, int varno, double value);
00091 polynomial * uves_polynomial_fit_1d(const cpl_vector    *   x_pos,
00092                     const cpl_vector    *   values,
00093                     const cpl_vector    *   sigmas,
00094                     int                     poly_deg,
00095                     double              *   mse);
00096 polynomial *uves_polynomial_fit_2d(const cpl_bivector     *  xy_pos,
00097                    const cpl_vector       *  values,
00098                    const cpl_vector       *  sigmas,
00099                    int                       poly_deg1,
00100                    int                       poly_deg2,
00101                    double                 *  mse,
00102                    double                 *  red_chisq,
00103                    polynomial             ** variance);
00104 
00105 polynomial *uves_polynomial_add_2d(const polynomial *p1, const polynomial *p2);
00106 
00107 int uves_polynomial_get_degree(const polynomial *p);
00108 
00109 void uves_polynomial_delete(polynomial **p);
00110 void uves_polynomial_delete_const(const polynomial **p);
00111 
00112 cpl_table     *uves_polynomial_convert_to_table(const polynomial *p);
00113 int            uves_polynomial_get_dimension(const polynomial *p);
00114 void           uves_polynomial_dump(const polynomial *p, FILE *stream);
00115 cpl_error_code uves_polynomial_shift(polynomial *p, int varno, double shift);
00116 cpl_error_code uves_polynomial_rescale(polynomial *p, int varno, double scale);
00117 double         uves_polynomial_get_coeff_1d(const polynomial *p, int degree);
00118 double         uves_polynomial_get_coeff_2d(const polynomial *p,
00119                         int degree1, int degree2);
00120 double         uves_polynomial_evaluate_1d(const polynomial *p, double x);
00121 double         uves_polynomial_evaluate_2d(const polynomial *p, double x1, double x2);
00122 double         uves_polynomial_solve_1d(const polynomial *p, double value, 
00123                     double guess, int multiplicity);
00124 double         uves_polynomial_solve_2d(const polynomial *p, double value, 
00125                     double guess, int multiplicity, 
00126                     int varno, double x_value);
00127 double         uves_polynomial_derivative_1d(const polynomial *p, double x);
00128 double         uves_polynomial_derivative_2d(const polynomial *p, double x1,
00129                          double x2, int varno);
00130 cpl_error_code uves_polynomial_derivative(polynomial *p, int varno);
00131 
00132 #endif

Generated on 9 Mar 2012 for UVES Pipeline Reference Manual by  doxygen 1.6.1