|
SDDS ToolKit Programs and Libraries for C and Python
|
Computes statistical moments and related measures.
This file contains functions to compute various statistical measures such as standard deviation, moments, weighted moments, correlations, averages, RMS values, and more. It also includes threaded versions of these functions for parallel computation using OpenMP.
Definition in file moments.c.
#include "mdb.h"Go to the source code of this file.
Functions | |
| void | omp_set_num_threads (int a) |
| double | standardDeviation (double *x, long n) |
| Calculates the standard deviation of an array of doubles. | |
| double | standardDeviationThreaded (double *x, long n, long numThreads) |
| Calculates the standard deviation of an array of doubles using multiple threads. | |
| long | computeMoments (double *mean, double *rms, double *standDev, double *meanAbsoluteDev, double *x, long n) |
| Computes the mean, RMS, standard deviation, and mean absolute deviation of an array. | |
| long | computeMomentsThreaded (double *mean, double *rms, double *standDev, double *meanAbsoluteDev, double *x, long n, long numThreads) |
| Computes the mean, RMS, standard deviation, and mean absolute deviation of an array using multiple threads. | |
| long | computeWeightedMoments (double *mean, double *rms, double *standDev, double *meanAbsoluteDev, double *x, double *w, long n) |
| Computes weighted statistical moments of an array. | |
| long | computeWeightedMomentsThreaded (double *mean, double *rms, double *standDev, double *meanAbsoluteDev, double *x, double *w, long n, long numThreads) |
| Computes weighted statistical moments of an array using multiple threads. | |
| long | accumulateMoments (double *mean, double *rms, double *standDev, double *x, long n, long reset) |
| long | accumulateMomentsThreaded (double *mean, double *rms, double *standDev, double *x, long n, long reset, long numThreads) |
| long | accumulateWeightedMoments (double *mean, double *rms, double *standDev, double *x, double *w, long n, long reset) |
| long | accumulateWeightedMomentsThreaded (double *mean, double *rms, double *standDev, double *x, double *w, long n, long reset, long numThreads) |
| long | computeCorrelations (double *C11, double *C12, double *C22, double *x, double *y, long n) |
| Computes the correlations between two datasets. | |
| long | computeCorrelationsThreaded (double *C11, double *C12, double *C22, double *x, double *y, long n, long numThreads) |
| Computes the correlations between two datasets using multiple threads. | |
| double | arithmeticAverage (double *y, long n) |
| Calculates the arithmetic average of an array of doubles. | |
| double | arithmeticAverageThreaded (double *y, long n, long numThreads) |
| Calculates the arithmetic average of an array of doubles using multiple threads. | |
| double | rmsValue (double *y, long n) |
| Calculates the RMS (Root Mean Square) value of an array of doubles. | |
| double | rmsValueThreaded (double *y, long n, long numThreads) |
| Calculates the RMS (Root Mean Square) value of an array of doubles using multiple threads. | |
| double | meanAbsoluteDeviation (double *y, long n) |
| Calculates the mean absolute deviation of an array of doubles. | |
| double | meanAbsoluteDeviationThreaded (double *y, long n, long numThreads) |
| Calculates the mean absolute deviation of an array of doubles using multiple threads. | |
| double | weightedAverage (double *y, double *w, long n) |
| Calculates the weighted average of an array of doubles. | |
| double | weightedAverageThreaded (double *y, double *w, long n, long numThreads) |
| Calculates the weighted average of an array of doubles using multiple threads. | |
| double | weightedRMS (double *y, double *w, long n) |
| Calculates the weighted RMS (Root Mean Square) value of an array of doubles. | |
| double | weightedRMSThreaded (double *y, double *w, long n, long numThreads) |
| Calculates the weighted RMS (Root Mean Square) value of an array of doubles using multiple threads. | |
| double | weightedMAD (double *y, double *w, long n) |
| Calculates the weighted mean absolute deviation of an array of doubles. | |
| double | weightedMADThreaded (double *y, double *w, long n, long numThreads) |
| Calculates the weighted mean absolute deviation of an array of doubles using multiple threads. | |
| double | weightedStDev (double *y, double *w, long n) |
| Calculates the weighted standard deviation of an array of doubles. | |
| double | weightedStDevThreaded (double *y, double *w, long n, long numThreads) |
| Calculates the weighted standard deviation of an array of doubles using multiple threads. | |
| long accumulateMoments | ( | double * | mean, |
| double * | rms, | ||
| double * | standDev, | ||
| double * | x, | ||
| long | n, | ||
| long | reset ) |
| long accumulateMomentsThreaded | ( | double * | mean, |
| double * | rms, | ||
| double * | standDev, | ||
| double * | x, | ||
| long | n, | ||
| long | reset, | ||
| long | numThreads ) |
Definition at line 329 of file moments.c.
| long accumulateWeightedMoments | ( | double * | mean, |
| double * | rms, | ||
| double * | standDev, | ||
| double * | x, | ||
| double * | w, | ||
| long | n, | ||
| long | reset ) |
| long accumulateWeightedMomentsThreaded | ( | double * | mean, |
| double * | rms, | ||
| double * | standDev, | ||
| double * | x, | ||
| double * | w, | ||
| long | n, | ||
| long | reset, | ||
| long | numThreads ) |
Definition at line 387 of file moments.c.
| double arithmeticAverage | ( | double * | y, |
| long | n ) |
Calculates the arithmetic average of an array of doubles.
This function computes the arithmetic average of the given array by invoking the threaded version with a single thread.
| y | Pointer to the array of doubles. |
| n | Number of elements in the array. |
Definition at line 560 of file moments.c.
| double arithmeticAverageThreaded | ( | double * | y, |
| long | n, | ||
| long | numThreads ) |
Calculates the arithmetic average of an array of doubles using multiple threads.
This function computes the arithmetic average of the given array using the specified number of threads.
| y | Pointer to the array of doubles. |
| n | Number of elements in the array. |
| numThreads | Number of threads to use for computation. |
Definition at line 574 of file moments.c.
| long computeCorrelations | ( | double * | C11, |
| double * | C12, | ||
| double * | C22, | ||
| double * | x, | ||
| double * | y, | ||
| long | n ) |
Computes the correlations between two datasets.
This function calculates the correlation coefficients C11, C12, and C22 between two arrays of doubles by invoking the threaded version with a single thread.
| C11 | Pointer to store the computed C11 correlation coefficient. |
| C12 | Pointer to store the computed C12 correlation coefficient. |
| C22 | Pointer to store the computed C22 correlation coefficient. |
| x | Pointer to the first array of doubles. |
| y | Pointer to the second array of doubles. |
| n | Number of elements in each array. |
Definition at line 464 of file moments.c.
| long computeCorrelationsThreaded | ( | double * | C11, |
| double * | C12, | ||
| double * | C22, | ||
| double * | x, | ||
| double * | y, | ||
| long | n, | ||
| long | numThreads ) |
Computes the correlations between two datasets using multiple threads.
This function calculates the correlation coefficients C11, C12, and C22 between two arrays of doubles using the specified number of threads.
| C11 | Pointer to store the computed C11 correlation coefficient. |
| C12 | Pointer to store the computed C12 correlation coefficient. |
| C22 | Pointer to store the computed C22 correlation coefficient. |
| x | Pointer to the first array of doubles. |
| y | Pointer to the second array of doubles. |
| n | Number of elements in each array. |
| numThreads | Number of threads to use for computation. |
Definition at line 483 of file moments.c.
| long computeMoments | ( | double * | mean, |
| double * | rms, | ||
| double * | standDev, | ||
| double * | meanAbsoluteDev, | ||
| double * | x, | ||
| long | n ) |
Computes the mean, RMS, standard deviation, and mean absolute deviation of an array.
This function calculates multiple statistical moments of the provided data array by invoking the threaded version with a single thread.
| mean | Pointer to store the computed mean value. |
| rms | Pointer to store the computed RMS value. |
| standDev | Pointer to store the computed standard deviation. |
| meanAbsoluteDev | Pointer to store the computed mean absolute deviation. |
| x | Pointer to the array of doubles. |
| n | Number of elements in the array. |
Definition at line 108 of file moments.c.
| long computeMomentsThreaded | ( | double * | mean, |
| double * | rms, | ||
| double * | standDev, | ||
| double * | meanAbsoluteDev, | ||
| double * | x, | ||
| long | n, | ||
| long | numThreads ) |
Computes the mean, RMS, standard deviation, and mean absolute deviation of an array using multiple threads.
This function calculates multiple statistical moments of the provided data array using the specified number of threads.
| mean | Pointer to store the computed mean value. |
| rms | Pointer to store the computed RMS value. |
| standDev | Pointer to store the computed standard deviation. |
| meanAbsoluteDev | Pointer to store the computed mean absolute deviation. |
| x | Pointer to the array of doubles. |
| n | Number of elements in the array. |
| numThreads | Number of threads to use for computation. |
Definition at line 127 of file moments.c.
| long computeWeightedMoments | ( | double * | mean, |
| double * | rms, | ||
| double * | standDev, | ||
| double * | meanAbsoluteDev, | ||
| double * | x, | ||
| double * | w, | ||
| long | n ) |
Computes weighted statistical moments of an array.
This function calculates the weighted mean, RMS, standard deviation, and mean absolute deviation of the provided data array by invoking the threaded version with a single thread.
| mean | Pointer to store the computed weighted mean value. |
| rms | Pointer to store the computed weighted RMS value. |
| standDev | Pointer to store the computed weighted standard deviation. |
| meanAbsoluteDev | Pointer to store the computed weighted mean absolute deviation. |
| x | Pointer to the array of doubles. |
| w | Pointer to the array of weights corresponding to each data point. |
| n | Number of elements in the array. |
Definition at line 219 of file moments.c.
| long computeWeightedMomentsThreaded | ( | double * | mean, |
| double * | rms, | ||
| double * | standDev, | ||
| double * | meanAbsoluteDev, | ||
| double * | x, | ||
| double * | w, | ||
| long | n, | ||
| long | numThreads ) |
Computes weighted statistical moments of an array using multiple threads.
This function calculates the weighted mean, RMS, standard deviation, and mean absolute deviation of the provided data array using the specified number of threads.
| mean | Pointer to store the computed weighted mean value. |
| rms | Pointer to store the computed weighted RMS value. |
| standDev | Pointer to store the computed weighted standard deviation. |
| meanAbsoluteDev | Pointer to store the computed weighted mean absolute deviation. |
| x | Pointer to the array of doubles. |
| w | Pointer to the array of weights corresponding to each data point. |
| n | Number of elements in the array. |
| numThreads | Number of threads to use for computation. |
Definition at line 240 of file moments.c.
| double meanAbsoluteDeviation | ( | double * | y, |
| long | n ) |
Calculates the mean absolute deviation of an array of doubles.
This function computes the mean absolute deviation of the given array by invoking the threaded version with a single thread.
| y | Pointer to the array of doubles. |
| n | Number of elements in the array. |
Definition at line 660 of file moments.c.
| double meanAbsoluteDeviationThreaded | ( | double * | y, |
| long | n, | ||
| long | numThreads ) |
Calculates the mean absolute deviation of an array of doubles using multiple threads.
This function computes the mean absolute deviation of the given array using the specified number of threads.
| y | Pointer to the array of doubles. |
| n | Number of elements in the array. |
| numThreads | Number of threads to use for computation. |
Definition at line 674 of file moments.c.
| double rmsValue | ( | double * | y, |
| long | n ) |
Calculates the RMS (Root Mean Square) value of an array of doubles.
This function computes the RMS value of the given array by invoking the threaded version with a single thread.
| y | Pointer to the array of doubles. |
| n | Number of elements in the array. |
Definition at line 610 of file moments.c.
| double rmsValueThreaded | ( | double * | y, |
| long | n, | ||
| long | numThreads ) |
Calculates the RMS (Root Mean Square) value of an array of doubles using multiple threads.
This function computes the RMS value of the given array using the specified number of threads.
| y | Pointer to the array of doubles. |
| n | Number of elements in the array. |
| numThreads | Number of threads to use for computation. |
Definition at line 624 of file moments.c.
| double standardDeviation | ( | double * | x, |
| long | n ) |
Calculates the standard deviation of an array of doubles.
This function computes the standard deviation of the given array by invoking the threaded version with a single thread.
| x | Pointer to the array of doubles. |
| n | Number of elements in the array. |
Definition at line 37 of file moments.c.
| double standardDeviationThreaded | ( | double * | x, |
| long | n, | ||
| long | numThreads ) |
Calculates the standard deviation of an array of doubles using multiple threads.
This function computes the standard deviation of the given array using the specified number of threads.
| x | Pointer to the array of doubles. |
| n | Number of elements in the array. |
| numThreads | Number of threads to use for computation. |
Definition at line 51 of file moments.c.
| double weightedAverage | ( | double * | y, |
| double * | w, | ||
| long | n ) |
Calculates the weighted average of an array of doubles.
This function computes the weighted average of the given array by invoking the threaded version with a single thread.
| y | Pointer to the array of doubles. |
| w | Pointer to the array of weights corresponding to each data point. |
| n | Number of elements in the array. |
Definition at line 727 of file moments.c.
| double weightedAverageThreaded | ( | double * | y, |
| double * | w, | ||
| long | n, | ||
| long | numThreads ) |
Calculates the weighted average of an array of doubles using multiple threads.
This function computes the weighted average of the given array using the specified number of threads.
| y | Pointer to the array of doubles. |
| w | Pointer to the array of weights corresponding to each data point. |
| n | Number of elements in the array. |
| numThreads | Number of threads to use for computation. |
Definition at line 742 of file moments.c.
| double weightedMAD | ( | double * | y, |
| double * | w, | ||
| long | n ) |
Calculates the weighted mean absolute deviation of an array of doubles.
This function computes the weighted mean absolute deviation of the given array by invoking the threaded version with a single thread.
| y | Pointer to the array of doubles. |
| w | Pointer to the array of weights corresponding to each data point. |
| n | Number of elements in the array. |
Definition at line 845 of file moments.c.
| double weightedMADThreaded | ( | double * | y, |
| double * | w, | ||
| long | n, | ||
| long | numThreads ) |
Calculates the weighted mean absolute deviation of an array of doubles using multiple threads.
This function computes the weighted mean absolute deviation of the given array using the specified number of threads.
| y | Pointer to the array of doubles. |
| w | Pointer to the array of weights corresponding to each data point. |
| n | Number of elements in the array. |
| numThreads | Number of threads to use for computation. |
Definition at line 860 of file moments.c.
| double weightedRMS | ( | double * | y, |
| double * | w, | ||
| long | n ) |
Calculates the weighted RMS (Root Mean Square) value of an array of doubles.
This function computes the weighted RMS value of the given array by invoking the threaded version with a single thread.
| y | Pointer to the array of doubles. |
| w | Pointer to the array of weights corresponding to each data point. |
| n | Number of elements in the array. |
Definition at line 786 of file moments.c.
| double weightedRMSThreaded | ( | double * | y, |
| double * | w, | ||
| long | n, | ||
| long | numThreads ) |
Calculates the weighted RMS (Root Mean Square) value of an array of doubles using multiple threads.
This function computes the weighted RMS value of the given array using the specified number of threads.
| y | Pointer to the array of doubles. |
| w | Pointer to the array of weights corresponding to each data point. |
| n | Number of elements in the array. |
| numThreads | Number of threads to use for computation. |
Definition at line 801 of file moments.c.
| double weightedStDev | ( | double * | y, |
| double * | w, | ||
| long | n ) |
Calculates the weighted standard deviation of an array of doubles.
This function computes the weighted standard deviation of the given array by invoking the threaded version with a single thread.
| y | Pointer to the array of doubles. |
| w | Pointer to the array of weights corresponding to each data point. |
| n | Number of elements in the array. |
Definition at line 922 of file moments.c.
| double weightedStDevThreaded | ( | double * | y, |
| double * | w, | ||
| long | n, | ||
| long | numThreads ) |
Calculates the weighted standard deviation of an array of doubles using multiple threads.
This function computes the weighted standard deviation of the given array using the specified number of threads.
| y | Pointer to the array of doubles. |
| w | Pointer to the array of weights corresponding to each data point. |
| n | Number of elements in the array. |
| numThreads | Number of threads to use for computation. |
Definition at line 937 of file moments.c.