00001 /* 00002 * This file is part of the ESO SINFONI 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 File name : sinfo_matrix.h 00022 Author : Nicolas Devillard 00023 Created on : 1994 00024 Description : basic 2d sinfo_eclipse_matrix handling routines 00025 00026 ---------------------------------------------------------------------------*/ 00027 /* 00028 $Id: sinfo_matrix.h,v 1.3 2007/06/06 07:10:45 amodigli Exp $ 00029 $Author: amodigli $ 00030 $Date: 2007/06/06 07:10:45 $ 00031 $Revision: 1.3 $ 00032 */ 00033 00034 #ifndef SINFO_MATRIX_H 00035 #define SINFO_MATRIX_H 00036 00037 00038 /*--------------------------------------------------------------------------- 00039 Includes 00040 ---------------------------------------------------------------------------*/ 00041 00042 #include <stdio.h> 00043 #include <stdlib.h> 00044 #include <math.h> 00045 #include "sinfo_msg.h" 00046 #include <cpl.h> 00047 00048 /*--------------------------------------------------------------------------- 00049 Defines 00050 ---------------------------------------------------------------------------*/ 00051 00052 #define _(b,i,j) (*((b)->m+(i)*(b)->nc+(j))) /* b(i,j)*/ 00053 00054 #define mx_get(M,i,j) ((M)->m[(i)+(j)*(M)->nc]) 00055 #define mx_set(M,i,j,v) (mx_get(M,i,j)=v) 00056 00057 00058 /*--------------------------------------------------------------------------- 00059 New Types 00060 ---------------------------------------------------------------------------*/ 00061 00062 00063 typedef struct _MATRIX_ { 00064 double * m; 00065 int nr; 00066 int nc; 00067 } sinfo_eclipse_matrix, *Matrix; 00068 00069 00070 00071 /*--------------------------------------------------------------------------- 00072 Function ANSI C prototypes 00073 ---------------------------------------------------------------------------*/ 00074 00086 Matrix 00087 sinfo_create_mx(int nr, int nc) ; 00088 00099 Matrix 00100 sinfo_copy_mx(Matrix a) ; 00101 00112 void 00113 sinfo_close_mx(Matrix a) ; 00114 00115 00127 Matrix 00128 sinfo_mul_mx(Matrix a, Matrix b) ; 00129 00143 Matrix 00144 sinfo_invert_mx(Matrix aa) ; 00145 00146 00157 Matrix 00158 sinfo_transp_mx(Matrix a) ; 00159 00179 Matrix sinfo_least_sq_mx( 00180 Matrix A, 00181 Matrix B 00182 ) ; 00183 00184 00197 void sinfo_print_mx( 00198 Matrix M, 00199 const char * name 00200 ) ; 00201 00202 00203 #endif