LatticeCovering.c File Reference

Author:
Reinhard Prix Functions for covering metric parameter-spaces with a lattice.
More...

#include <math.h>
#include <gsl/gsl_block.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_blas.h>
#include "LatticeCovering.h"

Include dependency graph for LatticeCovering.c:

Go to the source code of this file.

Defines

#define MIN(x, y)   ((x) < (y) ? (x) : (y))
#define MAX(x, y)   ((x) > (y) ? (x) : (y))
#define TRUE   (1==1)
#define FALSE   (1==0)
#define HAVE_INLINE   1

Functions

 NRCSID (LATTICECOVERINGC,"$Id: LatticeCovering.c,v 1.4 2007/01/31 00:18:48 reinhard Exp $")
void LALLatticeCovering (LALStatus *status, REAL8VectorList **covering, REAL8 coveringRadius, const gsl_matrix *metric, const REAL8Vector *startPoint, BOOLEAN(*isInside)(const REAL8Vector *point), LatticeType latticeType)
 Central function of this module: produce a lattice-covering of given lattice-type for the given parameter-space with constant metric.
void LALLatticeFill (LALStatus *status, REAL8VectorList **fillGrid, const gsl_matrix *generator, const REAL8Vector *startPoint, BOOLEAN(*isInside)(const REAL8Vector *point))
 Fill the given parameter-space by a lattice defined by the specified generating matrix.
REAL8 XLALMetricScalarProduct (const gsl_vector *v1, const gsl_vector *v2, const gsl_matrix *gij)
 Scalar product of two vectors with respect to the given metric $\vec{v}_1 \cdot \vec{v}_2 = g_{i j}\, v_1^i \,v_2^j $.
int XLALFindCoveringGenerator (gsl_matrix **outmatrix, LatticeType type, REAL8 coveringRadius, const gsl_matrix *gij)
 Construct the full-rank generating matrix of given type, for covering a space of given (constant) metric and a given covering Radius.
int XLALReduceGenerator2FullRank (gsl_matrix **outmatrix, const gsl_matrix *inmatrix)
 "Reduce" a general (non-quadratic) generating matrix M with rank(M) <= cols(M) into a quadratic generator of full rank.
int XLALGetLatticeGenerator (gsl_matrix **outmatrix, UINT4 dimension, LatticeType type)
 Return a (not necessarily quadratic) n-dimensional generating matrix for one of several possible lattices (currently possible: cubic or $A_n^*$).
REAL8VectorListXLALREAL8VectorListAddEntry (REAL8VectorList *head, const REAL8Vector *entry)
 Add a new element at the end of the list 'head', _copy_ the given entry there, and return pointer to the new list-entry.
void XLALREAL8VectorListDestroy (REAL8VectorList *head)
 'List-destructor' for REAL8VectorList: free a complete list.
REAL8VectorXLALgsl2LALmetric (const gsl_matrix *gmetric)
 Translate a symmetric gsl_matrix into a 'LAL-encoded' REAL8Vector, using the index-convention l = a + b*(b+1) if a <= b, see PMETRIC_INDEX(a,b).
gsl_matrix * XLALmetric2gsl (const REAL8Vector *metric)
 Convert a LAL-encoded metric (REAL8Vector) into a symmetric gsl_matrix.

Variables

INT4VectorList empty_INT4VectorList
REAL8VectorList empty_REAL8VectorList


Detailed Description

Author:
Reinhard Prix Functions for covering metric parameter-spaces with a lattice.

Date:
2005
Id
LatticeCovering.c,v 1.4 2007/01/31 00:18:48 reinhard Exp

Todo:

Definition in file LatticeCovering.c.


Define Documentation

#define MIN ( x,
y   )     ((x) < (y) ? (x) : (y))

Definition at line 48 of file LatticeCovering.c.

#define MAX ( x,
y   )     ((x) > (y) ? (x) : (y))

Definition at line 49 of file LatticeCovering.c.

#define TRUE   (1==1)

Definition at line 51 of file LatticeCovering.c.

#define FALSE   (1==0)

Definition at line 52 of file LatticeCovering.c.

#define HAVE_INLINE   1

Definition at line 55 of file LatticeCovering.c.


Function Documentation

NRCSID ( LATTICECOVERINGC  ,
"$Id: LatticeCovering.  c,
v 1.4 2007/01/31 00:18:48 reinhard Exp $"   
)

void LALLatticeCovering ( LALStatus status,
REAL8VectorList **  covering,
REAL8  coveringRadius,
const gsl_matrix *  metric,
const REAL8Vector startPoint,
BOOLEAN(*)(const REAL8Vector *point)  isInside,
LatticeType  latticeType 
)

Central function of this module: produce a lattice-covering of given lattice-type for the given parameter-space with constant metric.

For optimal covering, use latticeType=0, namely the An* lattice, which is the best known covering-lattice up to dimension 23, see [CS99]

Algorithm:
Parameters:
covering  [out] final covering-grid
coveringRadius  [in] covering radius
metric  [in] constant metric
startPoint  [in] start-point in the covering-region
isInside  [in] boundary-condition

Definition at line 103 of file LatticeCovering.c.

void LALLatticeFill ( LALStatus status,
REAL8VectorList **  fillGrid,
const gsl_matrix *  generator,
const REAL8Vector startPoint,
BOOLEAN(*)(const REAL8Vector *point)  isInside 
)

Fill the given parameter-space by a lattice defined by the specified generating matrix.

Note1:
The input generating-matrix (generator) must already be scaled correctly to the required covering radius, also, it needs to be in canonical full-rank square matrix form.
Note2:
As always in this module, the generating matrix contains the lattice-vectors as rows
Parameters:
fillGrid  [out] fillGrid final fill-grid (physical points)
generator  [in] SQUARE generating matrix for lattice
startPoint  [in] physical startpoint for filling
isInside  [in] boundary-condition

Definition at line 167 of file LatticeCovering.c.

REAL8 XLALMetricScalarProduct ( const gsl_vector *  v1,
const gsl_vector *  v2,
const gsl_matrix *  gij 
)

Scalar product of two vectors with respect to the given metric $\vec{v}_1 \cdot \vec{v}_2 = g_{i j}\, v_1^i \,v_2^j $.

Definition at line 405 of file LatticeCovering.c.

int XLALFindCoveringGenerator ( gsl_matrix **  outmatrix,
LatticeType  type,
REAL8  coveringRadius,
const gsl_matrix *  gij 
)

Construct the full-rank generating matrix of given type, for covering a space of given (constant) metric and a given covering Radius.

Note1:
the returned generator is a square matrix, with lattice-vectors in the matrix-rows (as always in this module!)
Note2:
the memory for 'outmatrix' is allocated here with gsl_matrix_alloc() and needs to be free by the caller via gsl_matrix_free()
Algorithm:
  • 1) get the (generally non-square) generating matrix for the lattice
  • 2) reduce it to a full-rank square generating matrix by expressing the lattice vectors in the basis of their spanned space
  • 3) translate the basis-vectors to the coordinates cooresponding to the given metric
  • 4) scale the generating matrix to the given covering radius
Parameters:
outmatrix  [out] generating matrix for covering lattice
type  [in] type of lattice
coveringRadius  [in] desired covering radius
gij  [in] (constant) metric of covering space

Definition at line 591 of file LatticeCovering.c.

int XLALReduceGenerator2FullRank ( gsl_matrix **  outmatrix,
const gsl_matrix *  inmatrix 
)

"Reduce" a general (non-quadratic) generating matrix M with rank(M) <= cols(M) into a quadratic generator of full rank.

The input matrix can have columns >= rows, the rows reprenting the lattice vectors. This algorithm simply proceeds by constructing an (Euclidean!) orthonormal basis out of the lattice vectors (using GramSchmidt), and then expressing the lattice-vectors in this new basis.

Note:
the memory for 'outmatrix' is allocated in here via gsl_matrix_alloc() and has to be free'ed by the caller via gsl_matrix_free() !
Parameters:
outmatrix  [out] full-rank square generating matrix
inmatrix  [in] generating matrix (cols >= rows)

Definition at line 691 of file LatticeCovering.c.

int XLALGetLatticeGenerator ( gsl_matrix **  outmatrix,
UINT4  dimension,
LatticeType  type 
)

Return a (not necessarily quadratic) n-dimensional generating matrix for one of several possible lattices (currently possible: cubic or $A_n^*$).

See [CS99] for the definition and properties of these lattices.

Note1:
Because these lattices are intended for covering, we scale them so that their covering-radius is unity. This allows the user to later-on scale these easily to any desired covering-radius without having to know anything about the lattice... (Remembering that if you scale the generator $M$ of a lattice by $M' = c M$, then the covering radius R scales as $R' = c R$)
Note2:
The memory for 'outmatrix' is allocated in here via gsl_matrix_alloc() and has to be free'ed by the caller via gsl_matrix_free() !
Parameters:
outmatrix  [out] generating matrix
dimension  [in] number of dimensions
type  [in] type of lattice

Definition at line 795 of file LatticeCovering.c.

REAL8VectorList* XLALREAL8VectorListAddEntry ( REAL8VectorList head,
const REAL8Vector entry 
)

Add a new element at the end of the list 'head', _copy_ the given entry there, and return pointer to the new list-entry.

Note:
This function is rather permissive in that it takes the vector-dimension from the new entry 'el', without requiring this to be equal to the dimension of the other list-entries...

Definition at line 939 of file LatticeCovering.c.

void XLALREAL8VectorListDestroy ( REAL8VectorList head  ) 

'List-destructor' for REAL8VectorList: free a complete list.

Note:
'head' will be freed too, so make sure not to pass a non-freeable head (like an automatic variabe)

Definition at line 1063 of file LatticeCovering.c.

REAL8Vector* XLALgsl2LALmetric ( const gsl_matrix *  gmetric  ) 

Translate a symmetric gsl_matrix into a 'LAL-encoded' REAL8Vector, using the index-convention l = a + b*(b+1) if a <= b, see PMETRIC_INDEX(a,b).

Definition at line 1150 of file LatticeCovering.c.

gsl_matrix* XLALmetric2gsl ( const REAL8Vector metric  ) 

Convert a LAL-encoded metric (REAL8Vector) into a symmetric gsl_matrix.

Definition at line 1184 of file LatticeCovering.c.


Variable Documentation

INT4VectorList empty_INT4VectorList

Definition at line 62 of file LatticeCovering.c.

REAL8VectorList empty_REAL8VectorList

Definition at line 63 of file LatticeCovering.c.


Generated on Sat Aug 30 03:13:59 2008 for LAL by  doxygen 1.5.2