Loading [MathJax]/extensions/TeX/AMSsymbols.js
LALPulsar 7.1.1.1-b246709
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
bin/TwoSpect/Statistics.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2011, 2014, 2015 Evan Goetz
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with with program; see the file COPYING. If not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19
20//Some functions based from Matab 2012a functions, but optimized for TwoSpect analysis
21
22#include <math.h>
23
24#include <gsl/gsl_randist.h>
25#include <gsl/gsl_cdf.h>
26#include <gsl/gsl_statistics_double.h>
27
28#include <lal/LALStdlib.h>
29#include <lal/LALConstants.h>
30#include <lal/VectorOps.h>
31
32#include "statistics.h"
33
34/**
35 * Create a exponentially distributed noise value
36 * \param [in] mu Mean value of the distribution
37 * \param [in] ptrToGenerator Pointer to a gsl_rng generator
38 * \return A random value drawn from the exponential distribution
39 */
40REAL8 expRandNum( const REAL8 mu, const gsl_rng *ptrToGenerator )
41{
42 XLAL_CHECK_REAL8( mu > 0.0 && ptrToGenerator != NULL, XLAL_EINVAL );
43 return gsl_ran_exponential( ptrToGenerator, mu );
44} /* expRandNum() */
45
46REAL4VectorAligned *expRandNumVector( const UINT4 length, const REAL8 mu, const gsl_rng *ptrToGenerator )
47{
48 XLAL_CHECK_NULL( mu > 0.0 && ptrToGenerator != NULL, XLAL_EINVAL );
50 XLAL_CHECK_NULL( ( output = XLALCreateREAL4VectorAligned( length, 32 ) ) != NULL, XLAL_EFUNC );
51 for ( UINT4 ii = 0; ii < length; ii++ ) {
52 output->data[ii] = ( REAL4 )expRandNum( mu, ptrToGenerator );
53 }
54 return output;
55}
56
57/* Critical values of KS test (from Bickel and Doksum). Does not apply directly (mean determined from distribution)
58 alpha=0.01
59 n 10 20 30 40 50 60 80 n>80
60 .489 .352 .290 .252 .226 .207 .179 1.628/(sqrt(n)+0.12+0.11/sqrt(n))
61
62 alpha=0.05
63 n 10 20 30 40 50 60 80 n>80
64 .409 .294 .242 .210 .188 .172 .150 1.358/(sqrt(n)+0.12+0.11/sqrt(n))
65 */
66
67/**
68 * KS test of data against an expected exponential distribution
69 * \param [out] ksvalue Pointer to the KS value
70 * \param [in] vector Pointer to the REAL4VectorAligned to compare against an exponential distribution
71 * \return Status value
72 */
74{
75
76 INT4 ii;
77
78 //First the mean value needs to be calculated from the median value
79 REAL4VectorAligned *tempvect = NULL;
80 XLAL_CHECK( ( tempvect = XLALCreateREAL4VectorAligned( vector->length, 32 ) ) != NULL, XLAL_EFUNC );
81 memcpy( tempvect->data, vector->data, sizeof( REAL4 )*vector->length );
82 sort_float_ascend( tempvect ); //tempvect becomes sorted
83 REAL4 vector_median = 0.0;
84 if ( tempvect->length % 2 != 1 ) {
85 vector_median = 0.5 * ( tempvect->data[( INT4 )( 0.5 * tempvect->length ) - 1] + tempvect->data[( INT4 )( 0.5 * tempvect->length )] );
86 } else {
87 vector_median = tempvect->data[( INT4 )( 0.5 * tempvect->length )];
88 }
89 REAL4 vector_mean = ( REAL4 )( vector_median / LAL_LN2 );
90
91 //Now start doing the K-S testing
92 *ksvalue = 0.0;
93 REAL8 testval1, testval2, testval;
94 REAL8 oneoverlength = 1.0 / tempvect->length;
95 for ( ii = 0; ii < ( INT4 )tempvect->length; ii++ ) {
96 REAL8 pval = gsl_cdf_exponential_P( tempvect->data[ii], vector_mean );
97 testval1 = fabs( ( 1.0 + ii ) * oneoverlength - pval );
98 testval2 = fabs( ii * oneoverlength - pval );
99 testval = fmax( testval1, testval2 );
100 if ( testval > ( *ksvalue ) ) {
101 *ksvalue = testval;
102 }
103 }
104
105 //Destroy stuff
107
108 return XLAL_SUCCESS;
109
110} /* ks_test_exp() */
111
112
113/* Critical values of Kuiper's test using root finding by E.G.
114alpha=0.05
115n n>80
116 1.747/(sqrt(n)+0.155+0.24/sqrt(n))
117
118alpha=0.1
119n n>80
120 1.620/(sqrt(n)+0.155+0.24/sqrt(n)) */
121
122/**
123 * Kuiper's test of data against an expected exponential distribution
124 * \param [out] kuipervalue Pointer to the Kuiper's test value
125 * \param [in] vector Pointer to the REAL4VectorAligned to compare against an exponential distribution
126 * \return Status value
127 */
129{
130
131 INT4 ii;
132
133 REAL4VectorAligned *tempvect = NULL;
134 XLAL_CHECK( ( tempvect = XLALCreateREAL4VectorAligned( vector->length, 32 ) ) != NULL, XLAL_EFUNC );
135
136 memcpy( tempvect->data, vector->data, sizeof( REAL4 )*vector->length );
137
138 sort_float_ascend( tempvect );
139
140 REAL4 vector_median = 0.0;
141 if ( tempvect->length % 2 != 1 ) {
142 vector_median = 0.5 * ( tempvect->data[( INT4 )( 0.5 * tempvect->length ) - 1] + tempvect->data[( INT4 )( 0.5 * tempvect->length )] );
143 } else {
144 vector_median = tempvect->data[( INT4 )( 0.5 * tempvect->length )];
145 }
146
147 REAL4 vector_mean = ( REAL4 )( vector_median / LAL_LN2 );
148
149 //Now the Kuiper's test calculation is made
150 REAL8 loval = 0.0, hival = 0.0;
151 REAL8 oneoverlength = 1.0 / tempvect->length;
152 loval = -1.0, hival = -1.0;
153 for ( ii = 0; ii < ( INT4 )tempvect->length; ii++ ) {
154 REAL8 pval = gsl_cdf_exponential_P( tempvect->data[ii], vector_mean );
155 REAL8 testval1 = ( 1.0 + ii ) * oneoverlength - pval;
156 REAL8 testval2 = ii * oneoverlength - pval;
157 if ( hival < testval1 ) {
158 hival = testval1;
159 }
160 if ( hival < testval2 ) {
161 hival = testval2;
162 }
163 if ( loval < -testval1 ) {
164 loval = -testval1;
165 }
166 if ( loval < -testval2 ) {
167 loval = -testval2;
168 }
169 }
170 *kuipervalue = hival + loval;
171
173
174 return XLAL_SUCCESS;
175
176} /* kuipers_test_exp() */
177
178
179/**
180 * Sort a REAL4VectorAligned, keeping the smallest of the values in the output vector
181 * \param [out] output Pointer to a REAL4VectorAligned containing the output vector
182 * \param [in] input Pointer to the REAL4VectorAligned from which to find the smallest values
183 * \return Status value
184 */
186{
187 //Copy of the input vector
188 REAL4VectorAligned *tempvect = NULL;
189 XLAL_CHECK( ( tempvect = XLALCreateREAL4VectorAligned( input->length, 32 ) ) != NULL, XLAL_EFUNC );
190 memcpy( tempvect->data, input->data, sizeof( REAL4 )*input->length );
191
192 //qsort rearranges original vector, so sort the copy of the input vector
193 qsort( tempvect->data, tempvect->length, sizeof( REAL4 ), qsort_REAL4_compar );
194
195 memcpy( output->data, tempvect->data, sizeof( REAL4 )*output->length );
196
198
199 return XLAL_SUCCESS;
200
201} /* sort_float_smallest() */
202
203
204/**
205 * Sort a REAL8Vector in ascending order, modifying the input vector
206 * \param [in,out] vector Pointer to a REAL8Vector to be sorted
207 */
209{
210 qsort( vector->data, vector->length, sizeof( REAL8 ), qsort_REAL8_compar );
211} /* sort_double_ascend() */
212
213
214/**
215 * Sort a REAL4VectorAligned in ascending order, modifying the input vector
216 * \param [in,out] vector Pointer to a REAL4VectorAligned to be sorted
217 */
219{
220 qsort( vector->data, vector->length, sizeof( REAL4 ), qsort_REAL4_compar );
221} /* sort_float_ascend() */
222
223
224/**
225 * Sample a number (sampleSize) of values from a REAL4VectorAligned (input) randomly
226 * \param [out] output Pointer to output REAL4VectorAligned with length less than input
227 * \param [in] input Pointer to a REAL4VectorAligned to be sampled from
228 * \param [in] rng Pointer to a gsl_rng generator
229 * \return Newly allocated REAL4VectorAligned of sampled values from the input vector
230 */
232{
233 XLAL_CHECK( output != NULL && input != NULL && output->length < input->length, XLAL_EINVAL );
234 for ( UINT4 ii = 0; ii < output->length; ii++ ) {
235 output->data[ii] = input->data[gsl_rng_uniform_int( rng, input->length )];
236 }
237 return XLAL_SUCCESS;
238} /* sampleREAL4VectorAligned() */
239
240/**
241 * Sample a number (sampleSize) of values from an REAL4VectorAlignedArray (input) randomly from vector 0 up to numberofvectors without accepting any values of zero
242 * Needs this numberofvectors limit because of the IHS algorithm
243 * \param [in] input Pointer to a REAL4VectorAlignedArray to be sampled from
244 * \param [in] numberofvectors Number of vectors from the start from which to sample from
245 * \param [in] sampleSize Integer value for the length of the output vector
246 * \param [in] rng Pointer to a gsl_rng generator
247 * \return Newly allocated REAL4VectorAligned of sampled values from the input vector
248 */
249REAL4VectorAligned *sampleREAL4VectorAlignedArray_nozerosaccepted( const REAL4VectorAlignedArray *input, const UINT4 numberofvectors, const UINT4 sampleSize, const gsl_rng *rng )
250{
251 XLAL_CHECK_NULL( input != NULL, XLAL_EINVAL );
252
254 XLAL_CHECK_NULL( ( output = XLALCreateREAL4VectorAligned( sampleSize, 32 ) ) != NULL, XLAL_EFUNC );
255
256 for ( UINT4 ii = 0; ii < sampleSize; ii++ ) {
257 output->data[ii] = input->data[( UINT4 )floor( gsl_rng_uniform( rng ) * numberofvectors )]->data[( UINT4 )floor( gsl_rng_uniform( rng ) * input->data[0]->length )];
258 while ( output->data[ii] == 0.0 ) {
259 output->data[ii] = input->data[( UINT4 )floor( gsl_rng_uniform( rng ) * numberofvectors )]->data[( UINT4 )floor( gsl_rng_uniform( rng ) * input->data[0]->length )];
260 }
261 }
262
263 return output;
264
265} /* sampleREAL4VectorAlignedArray_nozerosaccepted() */
266
267/**
268 * Compute the mean value of a REAL4VectorAligned, computed via recursion like in GSL
269 * \param [in] vector Pointer to a REAL4VectorAligned of values
270 * \return The mean value
271 */
273{
274
275 //Calculate mean from recurrance relation. Same as GSL
276 REAL8 meanval = 0.0;
277 for ( INT4 ii = 0; ii < ( INT4 )vector->length; ii++ ) {
278 meanval += ( vector->data[ii] - meanval ) / ( ii + 1 );
279 }
280
281 return ( REAL4 )meanval;
282
283} /* calcMean() */
284
285
286/**
287 * Compute the mean value of a REAL4VectorAligned without accepting values of zero
288 * \param [in] vector Pointer to a REAL4VectorAligned of values
289 * \return The mean value
290 */
292{
293
294 INT4 values = 0;
295 REAL8 meanval = 0.0;
296 for ( INT4 ii = 0; ii < ( INT4 )vector->length; ii++ ) {
297 if ( vector->data[ii] != 0.0 ) {
298 meanval += vector->data[ii];
299 values++;
300 }
301 }
302
303 if ( values > 0 ) {
304 return ( REAL4 )( meanval / values );
305 } else {
306 return 0.0;
307 }
308
309} /* calcMean_ignoreZeros() */
310
311
312/**
313 * \brief Compute the harmonic mean value of a REAL4VectorAligned of SFT values
314 *
315 * The harmonic mean is computed from the mean values of the SFTs
316 * \param [out] harmonicMean Pointer to the output REAL4 harmonic mean value
317 * \param [in] vector Pointer to a REAL4Value from which to compute the harmonic mean
318 * \param [in] numfbins Number of frequency bins in the SFTs
319 * \param [in] numffts Number of SFTs during the observation time
320 * \return Status value
321 */
322INT4 calcHarmonicMean( REAL4 *harmonicMean, const REAL4VectorAligned *vector, const UINT4 numfbins, const UINT4 numffts )
323{
324
325 UINT4 values = 0;
326 REAL4VectorAligned *tempvect = NULL;
327 XLAL_CHECK( ( tempvect = XLALCreateREAL4VectorAligned( numfbins, 32 ) ) != NULL, XLAL_EFUNC );
328
329 for ( UINT4 ii = 0; ii < numffts; ii++ ) {
330 if ( vector->data[ii * numfbins] != 0.0 ) {
331 memcpy( tempvect->data, &( vector->data[ii * numfbins] ), sizeof( REAL4 )*numfbins );
332 *harmonicMean += 1.0 / calcMean( tempvect );
333 values++;
334 }
335 }
336 if ( values > 0 ) {
337 *harmonicMean = ( REAL4 )values / ( *harmonicMean );
338 } else {
339 *harmonicMean = 0.0;
340 }
341
343
344 return XLAL_SUCCESS;
345
346} /* calcHarmonicMean() */
347
348
349/**
350 * Compute the standard deviation of a REAL4VectorAligned
351 * \param [out] sigma Pointer to the output standard deviation value
352 * \param [in] vector Pointer to a REAL4VectorAligned of values
353 * \return Status value
354 */
356{
357
358 double *gslarray = NULL;
359 XLAL_CHECK( ( gslarray = XLALMalloc( sizeof( double ) * vector->length ) ) != NULL, XLAL_ENOMEM );
360 for ( INT4 ii = 0; ii < ( INT4 )vector->length; ii++ ) {
361 gslarray[ii] = ( double )vector->data[ii];
362 }
363 *sigma = ( REAL4 )gsl_stats_sd( gslarray, 1, vector->length );
364
365 XLALFree( ( double * )gslarray );
366
367 return XLAL_SUCCESS;
368
369} /* calcStddev() */
370
371
372/**
373 * Compute the standard deviation of a REAL4VectorAligned ignoring zero values
374 * \param [out] sigma Pointer to the output standard deviation value
375 * \param [in] vector Pointer to a REAL4VectorAligned of values
376 * \return Status value
377 */
379{
380
381 REAL4 meanval = calcMean_ignoreZeros( vector );
382 if ( meanval == 0.0 ) {
383 *sigma = 0.0;
384 return XLAL_SUCCESS;
385 }
386
387 INT4 values = 0;
388 REAL8 sumtotal = 0.0;
389 for ( INT4 ii = 0; ii < ( INT4 )vector->length; ii++ ) {
390 if ( vector->data[ii] != 0.0 ) {
391 sumtotal += ( vector->data[ii] - meanval ) * ( vector->data[ii] - meanval );
392 values++;
393 }
394 }
395
396 if ( values > 1 ) {
397 *sigma = sqrtf( ( REAL4 )( sumtotal / ( values - 1 ) ) );
398 return XLAL_SUCCESS;
399 } else if ( values == 1 ) {
401 } else {
403 }
404
405} /* calcStddev_ignoreZeros() */
406
407
408/**
409 * Compute the RMS value of a REAL4VectorAligned
410 * \param [out] rms Pointer to the output RMS value
411 * \param [in] vector Pointer to a REAL4VectorAligned of values
412 * \return Status value
413 */
415{
416
417 REAL4VectorAligned *sqvector = NULL;
418 XLAL_CHECK( ( sqvector = XLALCreateREAL4VectorAligned( vector->length, 32 ) ) != NULL, XLAL_EFUNC );
419 XLAL_CHECK( XLALVectorMultiplyREAL4( sqvector->data, vector->data, vector->data, vector->length ) == XLAL_SUCCESS, XLAL_EFUNC );
420 *rms = sqrtf( calcMean( sqvector ) );
421
423
424 return XLAL_SUCCESS;
425
426} /* calcRms() */
427
428
429/**
430 * Compute the mean value of a REAL8Vector
431 * \param [in] vector Pointer to a REAL8Vector of values
432 * \return Mean value
433 */
435{
436 REAL8 meanval = gsl_stats_mean( ( double * )vector->data, 1, vector->length );
437 return meanval;
438} /* calcMeanD() */
439
440
441/**
442 * Compute the standard deviation of a REAL8Vector
443 * \param [in] vector Pointer to a REAL8Vector of values
444 * \return Standard deviation value
445 */
447{
448 REAL8 stddev = gsl_stats_sd( ( double * )vector->data, 1, vector->length );
449 return stddev;
450} /* calcStddevD() */
451
452
453/**
454 * Determine the index value of the maximum value in a REAL4VectorAligned
455 * \param [in] vector Pointer to REAL4VectorAligned of values
456 * \return Index value of the largest element
457 */
459{
460
461 UINT4 indexval = 0;
462 REAL4 maxval = vector->data[0];
463
464 for ( INT4 ii = 1; ii < ( INT4 )vector->length; ii++ ) {
465 if ( vector->data[ii] > maxval ) {
466 maxval = vector->data[ii];
467 indexval = ii;
468 }
469 }
470
471 return indexval;
472
473} /* max_index() */
474
475/**
476 * Determine the index value of the maximum value in a REAL8Vector
477 * \param [in] vector Pointer to REAL8Vector of values
478 * \return Index value of the largest element
479 */
481{
482 UINT4 indexval = ( UINT4 )gsl_stats_max_index( vector->data, 1, vector->length );
483 return indexval;
484} /* max_index_double() */
485
486
487/**
488 * Determine the index value of the maximum value between elements of a REAL4VectorAligned (inclusive)
489 * \param [in] vector Pointer to REAL4VectorAligned of values
490 * \param [in] startlocation Index value to start from in the REAL4VectorAligned
491 * \param [in] lastlocation Index value to end at in the REAL4VectorAligned
492 * \return Index value of the largest element
493 */
494UINT4 max_index_in_range( const REAL4VectorAligned *vector, const UINT4 startlocation, const UINT4 lastlocation )
495{
496 UINT4 last = lastlocation;
497 if ( last >= vector->length ) {
498 last = vector->length - 1;
499 }
500
501 UINT4 indexval = startlocation;
502 REAL4 maxval = vector->data[startlocation];
503
504 for ( UINT4 ii = startlocation + 1; ii <= last; ii++ ) {
505 if ( vector->data[ii] > maxval ) {
506 maxval = vector->data[ii];
507 indexval = ii;
508 }
509 }
510
511 return indexval;
512
513} /* max_index_in_range() */
514
515/**
516 * Determine the index value of the maximum and minimum values in an INT4Vector
517 * \param [in] inputvector Pointer to INT4Vector
518 * \param [out] min_index_out Pointer to index value of smallest element
519 * \param [out] max_index_out Pointer to index value of largest element
520 * \return Status value
521 */
522INT4 min_max_index_INT4Vector( const INT4Vector *inputvector, UINT4 *min_index_out, UINT4 *max_index_out )
523{
524
525 *min_index_out = 0, *max_index_out = 0;
526 INT4 minval = inputvector->data[0];
527 INT4 maxval = inputvector->data[0];
528
529 for ( INT4 ii = 1; ii < ( INT4 )inputvector->length; ii++ ) {
530 if ( inputvector->data[ii] < minval ) {
531 minval = inputvector->data[ii];
532 *min_index_out = ii;
533 }
534 if ( inputvector->data[ii] > maxval ) {
535 maxval = inputvector->data[ii];
536 *max_index_out = ii;
537 }
538 }
539
540 return XLAL_SUCCESS;
541
542} /* min_max_index_INT4Vector() */
543
544
545/**
546 * Calculate the median value from a REAL4VectorAligned
547 * \param [out] median Pointer to the median value
548 * \param [in] vector Pointer to a REAL4VectorAligned
549 * \return Status value
550 */
552{
553 //Make a copy of the original vector
554 REAL4VectorAligned *tempvect = NULL;
555 XLAL_CHECK( ( tempvect = XLALCreateREAL4VectorAligned( vector->length, 32 ) ) != NULL, XLAL_EFUNC );
556 memcpy( tempvect->data, vector->data, sizeof( REAL4 )*vector->length );
557
558 //qsort() on the copied data
559 qsort( tempvect->data, tempvect->length, sizeof( REAL4 ), qsort_REAL4_compar );
560
561 if ( tempvect->length % 2 != 1 ) {
562 *median = 0.5 * ( tempvect->data[( INT4 )( 0.5 * tempvect->length ) - 1] + tempvect->data[( INT4 )( 0.5 * tempvect->length )] );
563 } else {
564 *median = tempvect->data[( INT4 )( 0.5 * tempvect->length )];
565 }
566
568
569 return XLAL_SUCCESS;
570
571} /* calcMedian() */
572
573
574//Comparison functions for qsort
575INT4 qsort_REAL4_compar( const void *a, const void *b )
576{
577 const REAL4 *y = a;
578 const REAL4 *z = b;
579
580 if ( *y < *z ) {
581 return -1;
582 }
583 if ( *y > *z ) {
584 return 1;
585 }
586 return 0;
587} /* qsort_REAL4_compar() */
588INT4 qsort_REAL8_compar( const void *a, const void *b )
589{
590 const REAL8 *y = a;
591 const REAL8 *z = b;
592
593 if ( *y < *z ) {
594 return -1;
595 }
596 if ( *y > *z ) {
597 return 1;
598 }
599 return 0;
600} /* qsort_REAL8_compar() */
INT4 calcHarmonicMean(REAL4 *harmonicMean, const REAL4VectorAligned *vector, const UINT4 numfbins, const UINT4 numffts)
Compute the harmonic mean value of a REAL4VectorAligned of SFT values.
void sort_float_ascend(REAL4VectorAligned *vector)
Sort a REAL4VectorAligned in ascending order, modifying the input vector.
INT4 calcMedian(REAL4 *median, const REAL4VectorAligned *vector)
Calculate the median value from a REAL4VectorAligned.
INT4 sort_float_smallest(REAL4VectorAligned *output, const REAL4VectorAligned *input)
Sort a REAL4VectorAligned, keeping the smallest of the values in the output vector.
REAL4 calcMean_ignoreZeros(const REAL4VectorAligned *vector)
Compute the mean value of a REAL4VectorAligned without accepting values of zero.
INT4 qsort_REAL4_compar(const void *a, const void *b)
INT4 qsort_REAL8_compar(const void *a, const void *b)
INT4 min_max_index_INT4Vector(const INT4Vector *inputvector, UINT4 *min_index_out, UINT4 *max_index_out)
Determine the index value of the maximum and minimum values in an INT4Vector.
INT4 sampleREAL4VectorAligned(REAL4VectorAligned *output, const REAL4VectorAligned *input, const gsl_rng *rng)
Sample a number (sampleSize) of values from a REAL4VectorAligned (input) randomly.
UINT4 max_index_double(const REAL8Vector *vector)
Determine the index value of the maximum value in a REAL8Vector.
INT4 kuipers_test_exp(REAL8 *kuipervalue, const REAL4VectorAligned *vector)
Kuiper's test of data against an expected exponential distribution.
INT4 calcRms(REAL4 *rms, const REAL4VectorAligned *vector)
Compute the RMS value of a REAL4VectorAligned.
INT4 calcStddev_ignoreZeros(REAL4 *sigma, const REAL4VectorAligned *vector)
Compute the standard deviation of a REAL4VectorAligned ignoring zero values.
INT4 ks_test_exp(REAL8 *ksvalue, const REAL4VectorAligned *vector)
KS test of data against an expected exponential distribution.
REAL8 calcStddevD(const REAL8Vector *vector)
Compute the standard deviation of a REAL8Vector.
REAL8 expRandNum(const REAL8 mu, const gsl_rng *ptrToGenerator)
Create a exponentially distributed noise value.
UINT4 max_index(const REAL4VectorAligned *vector)
Determine the index value of the maximum value in a REAL4VectorAligned.
void sort_double_ascend(REAL8Vector *vector)
Sort a REAL8Vector in ascending order, modifying the input vector.
INT4 calcStddev(REAL4 *sigma, const REAL4VectorAligned *vector)
Compute the standard deviation of a REAL4VectorAligned.
REAL4VectorAligned * expRandNumVector(const UINT4 length, const REAL8 mu, const gsl_rng *ptrToGenerator)
UINT4 max_index_in_range(const REAL4VectorAligned *vector, const UINT4 startlocation, const UINT4 lastlocation)
Determine the index value of the maximum value between elements of a REAL4VectorAligned (inclusive)
REAL4 calcMean(const REAL4VectorAligned *vector)
Compute the mean value of a REAL4VectorAligned, computed via recursion like in GSL.
REAL4VectorAligned * sampleREAL4VectorAlignedArray_nozerosaccepted(const REAL4VectorAlignedArray *input, const UINT4 numberofvectors, const UINT4 sampleSize, const gsl_rng *rng)
Sample a number (sampleSize) of values from an REAL4VectorAlignedArray (input) randomly from vector 0...
REAL8 calcMeanD(const REAL8Vector *vector)
Compute the mean value of a REAL8Vector.
#define LAL_LN2
double REAL8
uint32_t UINT4
int32_t INT4
float REAL4
void * XLALMalloc(size_t n)
void XLALFree(void *p)
static const INT4 a
void XLALDestroyREAL4VectorAligned(REAL4VectorAligned *in)
REAL4VectorAligned * XLALCreateREAL4VectorAligned(const UINT4 length, const UINT4 align)
int XLALVectorMultiplyREAL4(REAL4 *out, const REAL4 *in1, const REAL4 *in2, const UINT4 len)
#define XLAL_ERROR(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_CHECK_REAL8(assertion,...)
#define XLAL_CHECK_NULL(assertion,...)
XLAL_ENOMEM
XLAL_SUCCESS
XLAL_EFPINVAL
XLAL_EFUNC
XLAL_EINVAL
XLAL_EFPDIV0
float data[BLOCKSIZE]
Definition: hwinject.c:360
float testval
Definition: hwinject.c:362
list y
list mu
INT4 * data
UINT4 length
REAL4VectorAligned ** data