Open source Very Long Baseline Interferometry
OpenVLBI
Macros | Functions

Macros

#define dsp_stats_min(buf, len)
 Gets the minimum value of the input stream. More...
 
#define dsp_stats_max(buf, len)
 Gets the maximum value of the input stream. More...
 
#define dsp_stats_mid(buf, len)
 Gets the middle value of the input stream. More...
 
#define dsp_stats_minimum_index(buf, len)
 Gets minimum value's position into the buffer. More...
 
#define dsp_stats_maximum_index(buf, len)
 Gets maximum value's position into the buffer. More...
 
#define dsp_stats_mean(buf, len)
 A mean calculator. More...
 
#define dsp_stats_stddev(buf, len)
 Standard deviation of the inut stream. More...
 
#define dsp_stats_val_count(buf, len, val)
 Counts value occurrences into stream. More...
 
#define dsp_stats_val_sum(buf, len)
 Cumulative sum of all the values on the stream. More...
 
#define dsp_stats_range_count(buf, len, lo, hi)
 Counts value ranging occurrences into stream. More...
 
#define dsp_stats_compare(in1, in2, len)
 Compare two buffers. More...
 

Functions

DLL_EXPORT double * dsp_stats_histogram (dsp_stream_p stream, int size)
 Histogram of the inut stream. More...
 

Detailed Description

Macro Definition Documentation

◆ dsp_stats_compare

#define dsp_stats_compare (   in1,
  in2,
  len 
)
Value:
({\
__typeof(in1[0]) out = 0;\
for(int i = 0; i < len; i++) {\
out += in1[i] - (__typeof(in1[0]))in2[i];\
}\
out;\
})
Parameters
in1the first input buffer
in2the second input buffer
lenthe length in elements of the buffer.
Returns
the sum of the subtraction of each element of both streams

◆ dsp_stats_max

#define dsp_stats_max (   buf,
  len 
)
Value:
({\
int i;\
__typeof(buf[0]) max = (__typeof(buf[0]))buf[0];\
for(i = 0; i < len; i++) {\
max = Max(buf[i], max);\
}\
max;\
})
Parameters
bufthe input buffer
lenthe length in elements of the buffer.
Returns
the maximum value.

◆ dsp_stats_maximum_index

#define dsp_stats_maximum_index (   buf,
  len 
)
Value:
({\
int i;\
__typeof(buf[0]) max = dsp_stats_max(buf, len);\
for(i = 0; i < len; i++) {\
if(buf[i] == max) break;\
}\
i;\
})
Parameters
bufthe input buffer
lenthe length in elements of the buffer.
Returns
the position index of the maximum value.

◆ dsp_stats_mean

#define dsp_stats_mean (   buf,
  len 
)
Value:
({\
int __dsp__i;\
double __dsp__mean = 0;\
for(__dsp__i = 0; __dsp__i < len; __dsp__i++) {\
__dsp__mean += buf[__dsp__i];\
}\
__dsp__mean /= len;\
__dsp__mean;\
})
Parameters
bufthe input buffer
lenthe length in elements of the buffer.
Returns
the mean value of the stream.

◆ dsp_stats_mid

#define dsp_stats_mid (   buf,
  len 
)
Value:
({\
int i;\
__typeof(buf[0]) min = dsp_stats_min(buf, len);\
(__typeof(buf[0]))(min - dsp_stats_max(buf, len)) / 2.0 + min;\
})
Parameters
bufthe input buffer
lenthe length in elements of the buffer.
Returns
the middle value.

◆ dsp_stats_min

#define dsp_stats_min (   buf,
  len 
)
Value:
({\
int i;\
__typeof(buf[0]) min = (__typeof(buf[0]))buf[0];\
for(i = 0; i < len; i++) {\
min = Min(buf[i], min);\
}\
min;\
})
Parameters
bufthe input buffer
lenthe length in elements of the buffer.
Returns
the minimum value.

◆ dsp_stats_minimum_index

#define dsp_stats_minimum_index (   buf,
  len 
)
Value:
({\
int i;\
__typeof(buf[0]) min = dsp_stats_min(buf, len);\
for(i = 0; i < len; i++) {\
if(buf[i] == min) break;\
}\
i;\
})
Parameters
bufthe input buffer
lenthe length in elements of the buffer.
Returns
the position index of the minimum value.

◆ dsp_stats_range_count

#define dsp_stats_range_count (   buf,
  len,
  lo,
  hi 
)
Value:
({\
int x;\
int count = 0;\
for(x = 0; x < len; x++) {\
if(buf[x] < hi && buf[x] >= lo)\
count ++;\
}\
count;\
})
Parameters
bufthe input buffer
lenthe length in elements of the buffer.
lothe bottom margin value.
hithe upper margin value.
Returns
the count of the values ranging between the margins of the stream.

◆ dsp_stats_stddev

#define dsp_stats_stddev (   buf,
  len 
)
Value:
({\
double __dsp__mean = dsp_stats_mean(buf, len);\
int __dsp__x;\
double __dsp__stddev = 0;\
for(__dsp__x = 0; __dsp__x < len; __dsp__x++) {\
__dsp__stddev += fabs(buf[__dsp__x] - __dsp__mean);\
}\
__dsp__stddev /= len;\
__dsp__stddev;\
})
Parameters
bufthe inout buffer
lenthe length of the buffer

◆ dsp_stats_val_count

#define dsp_stats_val_count (   buf,
  len,
  val 
)
Value:
({\
int x;\
int count = 0;\
for(x = 0; x < len; x++) {\
if(buf[x] == val)\
count ++;\
}\
count;\
})
Parameters
bufthe input buffer
lenthe length in elements of the buffer.
valthe value to count.
Returns
the count of the value of the stream.

◆ dsp_stats_val_sum

#define dsp_stats_val_sum (   buf,
  len 
)
Value:
({\
int x;\
double sum = 0;\
for(x = 0; x < len; x++) {\
sum += buf[x];\
}\
sum;\
})
Parameters
bufthe input buffer
lenthe length in elements of the buffer.
Returns
the count of the value of the stream.

Function Documentation

◆ dsp_stats_histogram()

DLL_EXPORT double* dsp_stats_histogram ( dsp_stream_p  stream,
int  size 
)
Parameters
streamthe stream on which execute
sizethe length of the median.
Returns
the output stream if successfull elaboration. NULL if an error is encountered.
Max
#define Max(a, b)
if max() is not present you can use this one
Definition: dsp.h:184
dsp_stats_min
#define dsp_stats_min(buf, len)
Gets the minimum value of the input stream.
Definition: dsp.h:575
dsp_stats_mean
#define dsp_stats_mean(buf, len)
A mean calculator.
Definition: dsp.h:662
Min
#define Min(a, b)
if min() is not present you can use this one
Definition: dsp.h:177
dsp_stats_max
#define dsp_stats_max(buf, len)
Gets the maximum value of the input stream.
Definition: dsp.h:593