SINFONI Pipeline Reference Manual  2.5.2
sinfo_matrix.h
1 /*
2  * This file is part of the ESO SINFONI Pipeline
3  * Copyright (C) 2004,2005 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, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
18  */
19 /*----------------------------------------------------------------------------
20 
21  File name : sinfo_matrix.h
22  Author : Nicolas Devillard
23  Created on : 1994
24  Description : basic 2d sinfo_eclipse_matrix handling routines
25 
26  ---------------------------------------------------------------------------*/
27 /*
28  $Id: sinfo_matrix.h,v 1.3 2007-06-06 07:10:45 amodigli Exp $
29  $Author: amodigli $
30  $Date: 2007-06-06 07:10:45 $
31  $Revision: 1.3 $
32  */
33 
34 #ifndef SINFO_MATRIX_H
35 #define SINFO_MATRIX_H
36 
37 
38 /*---------------------------------------------------------------------------
39  Includes
40  ---------------------------------------------------------------------------*/
41 
42 #include <stdio.h>
43 #include <stdlib.h>
44 #include <math.h>
45 #include "sinfo_msg.h"
46 #include <cpl.h>
47 
48 /*---------------------------------------------------------------------------
49  Defines
50  ---------------------------------------------------------------------------*/
51 
52 #define _(b,i,j) (*((b)->m+(i)*(b)->nc+(j))) /* b(i,j)*/
53 
54 #define mx_get(M,i,j) ((M)->m[(i)+(j)*(M)->nc])
55 #define mx_set(M,i,j,v) (mx_get(M,i,j)=v)
56 
57 
58 /*---------------------------------------------------------------------------
59  New Types
60  ---------------------------------------------------------------------------*/
61 
62 
63 typedef struct _MATRIX_ {
64  double * m;
65  int nr;
66  int nc;
67 } sinfo_eclipse_matrix, *Matrix;
68 
69 
70 
71 /*---------------------------------------------------------------------------
72  Function ANSI C prototypes
73  ---------------------------------------------------------------------------*/
74 
86 Matrix
87 sinfo_create_mx(int nr, int nc) ;
88 
99 Matrix
100 sinfo_copy_mx(Matrix a) ;
101 
112 void
113 sinfo_close_mx(Matrix a) ;
114 
115 
127 Matrix
128 sinfo_mul_mx(Matrix a, Matrix b) ;
129 
143 Matrix
144 sinfo_invert_mx(Matrix aa) ;
145 
146 
157 Matrix
158 sinfo_transp_mx(Matrix a) ;
159 
179 Matrix sinfo_least_sq_mx(
180  Matrix A,
181  Matrix B
182 ) ;
183 
184 
197 void sinfo_print_mx(
198  Matrix M,
199  const char * name
200 ) ;
201 
202 
203 #endif