SINFONI Pipeline Reference Manual  2.5.2
sinfo_solve_poly_root.h
1 #ifndef SINFO_SOLVE_POLY_ROOT_H
2 #define SINFO_SOLVE_POLY_ROOT_H
3 /*
4  * This file is part of the ESO SINFONI Pipeline
5  * Copyright (C) 2004,2005 European Southern Observatory
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
20  */
21 
22 /*
23 #include <stdio.h>
24 */
25 #include <stdlib.h>
26 #include <math.h>
27 #include <stdlib.h>
28 #include <cpl.h>
29 #include "sinfo_msg.h"
30 
31 /* C-style sinfo_matrix elements */
32 #define MAT(m,i,j,n) ((m)[(i)*(n) + (j)])
33 
34 /* Fortran-style sinfo_matrix elements */
35 #define FMAT(m,i,j,n) ((m)[((i)-1)*(n) + ((j)-1)])
36 
37 
38 #undef __BEGIN_DECLS
39 #undef __END_DECLS
40 #ifdef __cplusplus
41 # define __BEGIN_DECLS extern "C" {
42 # define __END_DECLS }
43 #else
44 # define __BEGIN_DECLS /* empty */
45 # define __END_DECLS /* empty */
46 #endif
47 
48 typedef double * gsl_complex_packed_ptr ;
49 
50 void sinfo_balance_companion_matrix (double *m, size_t nc);
51 int sinfo_qr_companion (double *h, size_t nc, gsl_complex_packed_ptr z);
52 void sinfo_set_companion_matrix (const double *a, size_t n, double *m);
53 
54 __BEGIN_DECLS
55 
56 /* Solve for the complex roots of a general real polynomial */
57 
58 typedef struct
59 {
60  size_t nc ;
61  double * sinfo_matrix ;
62 }
63 gsl_poly_complex_workspace ;
64 
65 gsl_poly_complex_workspace * sinfo_gsl_poly_complex_workspace_alloc (size_t n);
66 void sinfo_gsl_poly_complex_workspace_free (gsl_poly_complex_workspace * w);
67 
68 int
69 sinfo_gsl_poly_complex_solve (const double * a, size_t n,
70  gsl_poly_complex_workspace * w,
71  gsl_complex_packed_ptr z);
72 
73 
74 
75 __END_DECLS
76 
77 #endif /* SINFO_SOLVE_POLY_ROOT_H */