File indexing completed on 2025-02-21 10:03:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef __GSL_FILTER_H__
0021 #define __GSL_FILTER_H__
0022
0023 #include <gsl/gsl_math.h>
0024 #include <gsl/gsl_vector.h>
0025 #include <gsl/gsl_movstat.h>
0026
0027 #undef __BEGIN_DECLS
0028 #undef __END_DECLS
0029 #ifdef __cplusplus
0030 # define __BEGIN_DECLS extern "C" {
0031 # define __END_DECLS }
0032 #else
0033 # define __BEGIN_DECLS
0034 # define __END_DECLS
0035 #endif
0036
0037 __BEGIN_DECLS
0038
0039
0040 typedef enum
0041 {
0042 GSL_FILTER_END_PADZERO = GSL_MOVSTAT_END_PADZERO,
0043 GSL_FILTER_END_PADVALUE = GSL_MOVSTAT_END_PADVALUE,
0044 GSL_FILTER_END_TRUNCATE = GSL_MOVSTAT_END_TRUNCATE
0045 } gsl_filter_end_t;
0046
0047
0048 typedef enum
0049 {
0050 GSL_FILTER_SCALE_MAD,
0051 GSL_FILTER_SCALE_IQR,
0052 GSL_FILTER_SCALE_SN,
0053 GSL_FILTER_SCALE_QN
0054 } gsl_filter_scale_t;
0055
0056
0057 typedef struct
0058 {
0059 size_t K;
0060 double *kernel;
0061 gsl_movstat_workspace *movstat_workspace_p;
0062 } gsl_filter_gaussian_workspace;
0063
0064 gsl_filter_gaussian_workspace *gsl_filter_gaussian_alloc(const size_t K);
0065 void gsl_filter_gaussian_free(gsl_filter_gaussian_workspace * w);
0066 int gsl_filter_gaussian(const gsl_filter_end_t endtype, const double alpha, const size_t order, const gsl_vector * x,
0067 gsl_vector * y, gsl_filter_gaussian_workspace * w);
0068 int gsl_filter_gaussian_kernel(const double alpha, const size_t order, const int normalize, gsl_vector * kernel);
0069
0070
0071 typedef struct
0072 {
0073 gsl_movstat_workspace *movstat_workspace_p;
0074 } gsl_filter_median_workspace;
0075
0076 gsl_filter_median_workspace *gsl_filter_median_alloc(const size_t K);
0077 void gsl_filter_median_free(gsl_filter_median_workspace * w);
0078 int gsl_filter_median(const gsl_filter_end_t endtype, const gsl_vector * x, gsl_vector * y, gsl_filter_median_workspace * w);
0079
0080
0081 typedef struct
0082 {
0083 size_t H;
0084 size_t K;
0085 void *state;
0086 double *window;
0087 const gsl_movstat_accum * minmaxacc;
0088 gsl_movstat_workspace *movstat_workspace_p;
0089 } gsl_filter_rmedian_workspace;
0090
0091 gsl_filter_rmedian_workspace *gsl_filter_rmedian_alloc(const size_t K);
0092 void gsl_filter_rmedian_free(gsl_filter_rmedian_workspace * w);
0093 int gsl_filter_rmedian(const gsl_filter_end_t, const gsl_vector * x, gsl_vector * y, gsl_filter_rmedian_workspace * w);
0094
0095 typedef struct
0096 {
0097 gsl_movstat_workspace *movstat_workspace_p;
0098 } gsl_filter_impulse_workspace;
0099
0100 gsl_filter_impulse_workspace *gsl_filter_impulse_alloc(const size_t K);
0101 void gsl_filter_impulse_free(gsl_filter_impulse_workspace * w);
0102 int gsl_filter_impulse(const gsl_filter_end_t endtype, const gsl_filter_scale_t scale_type, const double t,
0103 const gsl_vector * x, gsl_vector * y, gsl_vector * xmedian, gsl_vector * xsigma, size_t * noutlier,
0104 gsl_vector_int * ioutlier, gsl_filter_impulse_workspace * w);
0105
0106 __END_DECLS
0107
0108 #endif