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: 2010/09/24 09:32:09 $
00023  * $Revision: 1.24 $
00024  * $Name: uves-4_9_1 $
00025  * $Log: uves_utils_polynomial.h,v $
00026  * Revision 1.24  2010/09/24 09:32:09  amodigli
00027  * put back QFITS dependency to fix problem spot by NRI on FIBER mode (with MIDAS calibs) data
00028  *
00029  * Revision 1.22  2007/09/11 17:08:49  amodigli
00030  * mooved uves_polynomial_convert_from_plist_midas to uves_dfs
00031  *
00032  * Revision 1.21  2007/06/20 08:30:03  amodigli
00033  * added index parameter to support FIBER mode lintab in uves_polynomial_convert_from_plist_midas
00034  *
00035  * Revision 1.20  2007/06/06 08:17:33  amodigli
00036  * replace tab with 4 spaces
00037  *
00038  * Revision 1.19  2007/05/03 15:18:31  jmlarsen
00039  * Added function to add polynomials
00040  *
00041  * Revision 1.18  2007/04/24 12:50:29  jmlarsen
00042  * Replaced cpl_propertylist -> uves_propertylist which is much faster
00043  *
00044  * Revision 1.17  2007/03/19 15:04:57  jmlarsen
00045  * Added get_degree function
00046  *
00047  * Revision 1.16  2007/03/05 10:20:51  jmlarsen
00048  * Added uves_polynomial_delete_const()
00049  *
00050  * Revision 1.15  2006/08/17 13:56:53  jmlarsen
00051  * Reduced max line length
00052  *
00053  * Revision 1.14  2006/04/24 09:28:29  jmlarsen
00054  * Added function to create zero-polynomial
00055  *
00056  * Revision 1.13  2005/12/19 16:17:56  jmlarsen
00057  * Replaced bool -> int
00058  *
00059  */
00060 #ifndef UVES_UTILS_POLYNOMIAL_H
00061 #define UVES_UTILS_POLYNOMIAL_H
00062 
00063 /*-----------------------------------------------------------------------------
00064                                    Includes
00065  -----------------------------------------------------------------------------*/
00066 
00067 #include <uves_propertylist.h>
00068 #include <cpl.h>
00069 
00070 /*-----------------------------------------------------------------------------
00071                                    Typedefs
00072  -----------------------------------------------------------------------------*/
00073 
00074 typedef struct _polynomial polynomial ;
00075 
00076 /*-----------------------------------------------------------------------------
00077                                    Prototypes
00078  -----------------------------------------------------------------------------*/
00079 
00080 
00081 polynomial *uves_polynomial_new(const cpl_polynomial *pol);
00082 polynomial *uves_polynomial_new_zero(int dim);
00083 polynomial *uves_polynomial_duplicate(const polynomial *p);
00084 
00085 
00086 polynomial *uves_polynomial_convert_from_table(cpl_table *t);
00087 polynomial *uves_polynomial_collapse(const polynomial *p, int varno, double value);
00088 polynomial * uves_polynomial_fit_1d(const cpl_vector    *   x_pos,
00089                     const cpl_vector    *   values,
00090                     const cpl_vector    *   sigmas,
00091                     int                     poly_deg,
00092                     double              *   mse);
00093 polynomial *uves_polynomial_fit_2d(const cpl_bivector     *  xy_pos,
00094                    const cpl_vector       *  values,
00095                    const cpl_vector       *  sigmas,
00096                    int                       poly_deg1,
00097                    int                       poly_deg2,
00098                    double                 *  mse,
00099                    double                 *  red_chisq,
00100                    polynomial             ** variance);
00101 
00102 polynomial *uves_polynomial_add_2d(const polynomial *p1, const polynomial *p2);
00103 
00104 int uves_polynomial_get_degree(const polynomial *p);
00105 
00106 void uves_polynomial_delete(polynomial **p);
00107 void uves_polynomial_delete_const(const polynomial **p);
00108 
00109 cpl_table     *uves_polynomial_convert_to_table(const polynomial *p);
00110 int            uves_polynomial_get_dimension(const polynomial *p);
00111 void           uves_polynomial_dump(const polynomial *p, FILE *stream);
00112 cpl_error_code uves_polynomial_shift(polynomial *p, int varno, double shift);
00113 cpl_error_code uves_polynomial_rescale(polynomial *p, int varno, double scale);
00114 double         uves_polynomial_get_coeff_1d(const polynomial *p, int degree);
00115 double         uves_polynomial_get_coeff_2d(const polynomial *p,
00116                         int degree1, int degree2);
00117 double         uves_polynomial_evaluate_1d(const polynomial *p, double x);
00118 double         uves_polynomial_evaluate_2d(const polynomial *p, double x1, double x2);
00119 double         uves_polynomial_solve_1d(const polynomial *p, double value, 
00120                     double guess, int multiplicity);
00121 double         uves_polynomial_solve_2d(const polynomial *p, double value, 
00122                     double guess, int multiplicity, 
00123                     int varno, double x_value);
00124 double         uves_polynomial_derivative_1d(const polynomial *p, double x);
00125 double         uves_polynomial_derivative_2d(const polynomial *p, double x1,
00126                          double x2, int varno);
00127 cpl_error_code uves_polynomial_derivative(polynomial *p, int varno);
00128 
00129 #endif

Generated on 8 Mar 2011 for UVES Pipeline Reference Manual by  doxygen 1.6.1