93#define EIGENTESTC_ENORM 0
94#define EIGENTESTC_ESUB 1
95#define EIGENTESTC_EARG 2
96#define EIGENTESTC_EMEM 3
97#define EIGENTESTC_EFILE 4
98#define EIGENTESTC_EFMT 5
103#define EIGENTESTC_MSGENORM "Normal exit"
104#define EIGENTESTC_MSGESUB "Subroutine failed"
105#define EIGENTESTC_MSGEARG "Error parsing arguments"
106#define EIGENTESTC_MSGEMEM "Out of memory"
107#define EIGENTESTC_MSGEFILE "Could not open file"
108#define EIGENTESTC_MSGEFMT "Bad input file format"
114#include <lal/LALStdio.h>
115#include <lal/LALStdlib.h>
116#include <lal/AVFactories.h>
117#include <lal/StreamInput.h>
118#include <lal/Random.h>
119#include <lal/MatrixUtils.h>
125#define USAGE "Usage: %s [-n size | -i infile] [-o outfile]\n" \
126"\t[-v] [-t] [-s] [-d debuglevel]\n"
129#define ERROR( code, msg, statement ) \
131if ( lalDebugLevel & LALERROR ) \
133 LALPrintError( "Error[0] %d: program %s, file %s, line %d, %s\n" \
134 " %s %s\n", (code), *argv, __FILE__, \
135 __LINE__, "$Id$", statement ? \
136 statement : "", (msg) ); \
140#define INFO( statement ) \
142if ( lalDebugLevel & LALINFO ) \
144 LALPrintError( "Info[0]: program %s, file %s, line %d, %s\n" \
145 " %s\n", *argv, __FILE__, __LINE__, \
146 "$Id$", (statement) ); \
150#define WARNING( statement ) \
152if ( lalDebugLevel & LALWARNING ) \
154 LALPrintError( "Warning[0]: program %s, file %s, line %d, %s\n" \
155 " %s\n", *argv, __FILE__, __LINE__, \
156 "$Id$", (statement) ); \
160#define SUB( func, statusptr ) \
162if ( (func), (statusptr)->statusCode ) \
164 ERROR( EIGENTESTC_ESUB, EIGENTESTC_MSGESUB, \
165 "Function call \"" #func "\" failed:" ); \
166 return EIGENTESTC_ESUB; \
171main(
int argc,
char **argv )
177 CHAR *outfile = NULL;
187 clock_t start = 0, stop = 0;
196 while ( arg < argc ) {
199 if ( !strcmp( argv[arg],
"-n" ) ) {
200 if ( argc > arg + 1 ) {
202 n = atoi( argv[arg++] );
211 else if ( !strcmp( argv[arg],
"-i" ) ) {
212 if ( argc > arg + 1 ) {
214 infile = argv[arg++];
223 else if ( !strcmp( argv[arg],
"-o" ) ) {
224 if ( argc > arg + 1 ) {
226 outfile = argv[arg++];
235 else if ( !strcmp( argv[arg],
"-v" ) ) {
239 else if ( !strcmp( argv[arg],
"-s" ) ) {
243 else if ( !strcmp( argv[arg],
"-t" ) ) {
249 else if ( !strcmp( argv[arg],
"-d" ) ) {
250 if ( argc > arg + 1 ) {
274 dimLength.
data = dims;
280 if ( !strcmp( infile,
"stdin" ) )
282 else if ( !(
fp = fopen( infile,
"r" ) ) ) {
294 }
while ( ( n = vec->
length ) == 0 );
295 dimLength.
data[0] = dimLength.
data[1] = n;
297 for ( j = 0; j < n; j++ )
302 for ( i = 1; i < n; i++ ) {
308 for ( j = 0; j < n; j++ )
309 sMatrix->
data[i*n+j] = vec->
data[j];
321 }
while ( ( n = vec->
length ) == 0 );
322 dimLength.
data[0] = dimLength.
data[1] = n;
324 for ( j = 0; j < n; j++ )
329 for ( i = 1; i < n; i++ ) {
335 for ( j = 0; j < n; j++ )
336 dMatrix->
data[i*n+j] = vec->
data[j];
346 dimLength.
data[0] = dimLength.
data[1] = n;
351 for ( i = 0; i < n; i++ ) {
352 for ( j = 0; j < i; j++ ) {
362 for ( i = 0; i < n; i++ ) {
363 for ( j = 0; j < i; j++ ) {
364 dMatrix->
data[i*n+j] = dMatrix->
data[j*n+i]
378 if ( !strcmp( outfile,
"stdout" ) )
380 else if ( !strcmp( outfile,
"stderr" ) )
382 else if ( !(
fp = fopen( outfile,
"r" ) ) ) {
389 for ( i = 0; i < n; i++ ) {
391 for ( j = 1; j < n; j++ )
399 for ( i = 0; i < n; i++ ) {
401 for ( j = 1; j < n; j++ )
436 fprintf( stderr,
"Elapsed time: %.2f s\n",
437 (
double)( stop - start )/CLOCKS_PER_SEC );
447 for ( j = 1; j < n; j++ )
452 for ( j = 1; j < n; j++ )
461 for ( i = 0; i < n; i++ ) {
463 for ( j = 1; j < n; j++ )
468 for ( i = 0; i < n; i++ ) {
470 for ( j = 1; j < n; j++ )
478 if (
fp != stdout &&
fp != stderr )
491 INFO( EIGENTESTC_MSGENORM );
#define EIGENTESTC_EFMT
Bad input file format.
#define EIGENTESTC_EARG
Error parsing arguments.
#define EIGENTESTC_ENORM
Normal exit.
#define EIGENTESTC_EFILE
Could not open file.
void LALCheckMemoryLeaks(void)
#define SUB(func, statusptr)
#define ERROR(code, msg, statement)
int main(int argc, char *argv[])
void LALSCreateArray(LALStatus *, REAL4Array **, UINT4Vector *)
void LALDCreateArray(LALStatus *, REAL8Array **, UINT4Vector *)
void LALSDestroyArray(LALStatus *, REAL4Array **)
void LALDDestroyArray(LALStatus *, REAL8Array **)
void LALDSymmetricEigenVectors(LALStatus *stat, REAL8Vector *values, REAL8Array *matrix)
void LALSSymmetricEigenVectors(LALStatus *stat, REAL4Vector *values, REAL4Array *matrix)
unsigned char BOOLEAN
Boolean logical type, see Headers LAL(Atomic)Datatypes.h for more details.
double REAL8
Double precision real floating-point number (8 bytes).
char CHAR
One-byte signed integer, see Headers LAL(Atomic)Datatypes.h for more details.
uint32_t UINT4
Four-byte unsigned integer.
int LALPrintError(const char *fmt,...)
RandomParams * XLALCreateRandomParams(INT4 seed)
REAL4 XLALUniformDeviate(RandomParams *params)
void XLALDestroyRandomParams(RandomParams *params)
void LALDCreateVector(LALStatus *, REAL8Vector **, UINT4)
void LALDDestroyVector(LALStatus *, REAL8Vector **)
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALSCreateVector(LALStatus *, REAL4Vector **, UINT4)
LAL status structure, see The LALStatus structure for more details.
Multidimentional array of REAL4, see DATATYPE-Array types for more details.
REAL4 * data
Pointer to the data array.
Vector of type REAL4, see DATATYPE-Vector types for more details.
REAL4 * data
Pointer to the data array.
UINT4 length
Number of elements in array.
Multidimentional array of REAL8, see DATATYPE-Array types for more details.
REAL8 * data
Pointer to the data array.
Vector of type REAL8, see DATATYPE-Vector types for more details.
REAL8 * data
Pointer to the data array.
UINT4 length
Number of elements in array.
This structure contains the parameters necessary for generating the current sequence of random number...
Vector of type UINT4, see DATATYPE-Vector types for more details.
UINT4 length
Number of elements in array.
UINT4 * data
Pointer to the data array.