LatticeCovering.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2005 Reinhard Prix
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with with program; see the file COPYING. If not, write to the 
00016  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
00017  *  MA  02111-1307  USA
00018  */
00019 
00020 /**
00021  * \defgroup moduleLatticeCovering Lattice Covering
00022  * \ingroup coreDA
00023  *
00024  * \brief Module implementing a practical (approximate) solution to the "covering problem". 
00025  *  This is achieved by producing a lattice-covering with the \f$A_n^*\f$ lattice, 
00026  *  which is the best known covering up to dimension \f$n\le 23\f$ 
00027  *  (see \ref CS99 for details).
00028  */
00029 
00030 /**
00031  * \author Reinhard Prix
00032  * \date 2005
00033  * \file 
00034  * \ingroup moduleLatticeCovering
00035  * \brief Header-file defining the API for the lattice-covering functions.
00036  *
00037  * $Id: LatticeCovering.h,v 1.5 2007/01/31 00:18:41 reinhard Exp $
00038  *
00039  */
00040 
00041 #ifndef _LATTICECOVERING_H  /* Double-include protection. */
00042 #define _LATTICECOVERING_H
00043 
00044 /* C++ protection. */
00045 #ifdef  __cplusplus
00046 extern "C" {
00047 #endif
00048 
00049 /*---------- INCLUDES ----------*/
00050 #include <gsl/gsl_matrix.h>
00051 
00052 #include <lal/LALStdlib.h>
00053 #include <lal/LALDatatypes.h>
00054 #include <lal/AVFactories.h>
00055 
00056 /* we need these until we put them in some better LAL-place (FIXME) */
00057 #include <lal/PtoleMetric.h>
00058 
00059 
00060 
00061 NRCSID( LATTICECOVERINGH, "$Id: LatticeCovering.h,v 1.5 2007/01/31 00:18:41 reinhard Exp $" );
00062 
00063 
00064 /*---------- DEFINES ----------*/
00065 
00066 /*----- Error-codes -----*/
00067 
00068 #define LATTICECOVERING_ENULL           1
00069 #define LATTICECOVERING_ENONULL         2
00070 #define LATTICECOVERING_EMEM            3
00071 #define LATTICECOVERING_EINPUT          4
00072 #define LATTICECOVERING_ELIST           5
00073 #define LATTICECOVERING_EFUNC           6
00074 
00075 #define LATTICECOVERING_MSGENULL        "Arguments contained an unexpected null pointer"
00076 #define LATTICECOVERING_MSGENONULL      "Output pointer is not NULL"
00077 #define LATTICECOVERING_MSGEMEM         "Out of memory"
00078 #define LATTICECOVERING_MSGEINPUT       "Invald input parameter"
00079 #define LATTICECOVERING_MSGELIST        "Error occurred in list-handling ..."
00080 #define LATTICECOVERING_MSGEFUNC        "Sub-routine failed"
00081 
00082 /*---------- exported types ----------*/
00083 
00084 /** enum-type for denoting several types of lattice */
00085 typedef enum
00086 {
00087   LATTICE_TYPE_ANSTAR = 0,      /**< An*: optimal covering grid */
00088   LATTICE_TYPE_CUBIC,           /**< standard cubic grid: Zn */
00089   LATTICE_TYPE_LAST
00090 } LatticeType;
00091 
00092 /** doubly linked list of INT4-vectors (lattice-vectors) */
00093 typedef struct tagINT4VectorList
00094 {
00095   INT4Vector entry;
00096   struct tagINT4VectorList *next;
00097   struct tagINT4VectorList *prev;
00098 } INT4VectorList;
00099 
00100 /** doubly linked list of REAL8-vectors (physical vectors) */
00101 typedef struct tagREAL8VectorList
00102 {
00103   REAL8Vector entry;
00104   struct tagREAL8VectorList *next;
00105   struct tagREAL8VectorList *prev;
00106 } REAL8VectorList;
00107 
00108 /*---------- Global variables ----------*/
00109 /*---------- empty initializers ---------- */
00110 extern INT4VectorList empty_INT4VectorList;
00111 extern REAL8VectorList empty_REAL8VectorList;
00112 
00113 /*---------- exported prototypes [API] ----------*/
00114 void LALLatticeCovering (LALStatus *, REAL8VectorList **covering, REAL8 coveringRadius, 
00115                          const gsl_matrix *metric, const REAL8Vector *startPoint,
00116                          BOOLEAN (*isInside)(const REAL8Vector *point),
00117                          LatticeType latticeType);
00118 
00119 void LALLatticeFill (LALStatus *, REAL8VectorList **fillGrid, const gsl_matrix  *generator,
00120                      const REAL8Vector *startPoint, BOOLEAN (*isInside)(const REAL8Vector *point) );
00121 
00122 /* functions for handling lattice's generating matrix */
00123 int XLALFindCoveringGenerator (gsl_matrix **outmatrix, LatticeType type, REAL8 coveringRadius, const gsl_matrix *gij);
00124 int XLALReduceGenerator2FullRank(gsl_matrix **outmatrix, const gsl_matrix *inmatrix);
00125 int XLALGetLatticeGenerator (gsl_matrix **outmatrix, UINT4 dimension, LatticeType type);
00126 
00127 REAL8 XLALMetricScalarProduct (const gsl_vector *vector1, const gsl_vector *vector2,    
00128                                const gsl_matrix *metric);
00129 
00130 
00131 /* some REAL8 list-handling functions that might be useful to users of the above functions */
00132 REAL8VectorList* XLALREAL8VectorListAddEntry (REAL8VectorList *head, const REAL8Vector *entry);
00133 void XLALREAL8VectorListDestroy (REAL8VectorList *head);
00134 
00135 /* convert a symmetric gsl_matrix into a 'LAL-encoded' vector containing only 
00136  * the independent symmetric-matrix elements (see PMETRIC_INDEX) */
00137 REAL8Vector *XLALgsl2LALmetric (const gsl_matrix *gmetric);
00138 
00139 /* convert LAL-encoded metric into a symmetric gsl-matrix */
00140 gsl_matrix *XLALmetric2gsl (const REAL8Vector *metric);
00141 
00142 #ifdef  __cplusplus
00143 }
00144 #endif  
00145 /* C++ protection. */
00146 
00147 #endif  /* Double-include protection. */

Generated on Sat Sep 6 03:07:14 2008 for LAL by  doxygen 1.5.2