/* [web:reg] Hodrick Prescott Filter - DLL © 2006, Kurt Annen email: annen@web-reg.de web: www.web-reg.de 'Cardware' This DLL was written by Kurt Annen (www.web-reg.de/contact.html) If you like the program, please send me a postcard. data - Array/Pointer (double) of raw data nobs - Number of observations (data legth / Unsigned int) lambda - the smoothing parameter (double) output - Array/Pointer (double) where the filtered data will be stored Must be the same length as data. ret - Boolean parameter. if ret is true, then the trend will be calculated otherwise the cyclical component will be calculated Error codes ------- Errorcode ---------- Description -------------- 0 | EXIT_SUCCESS ------------------------------------------------------- 1 | nobs < 5 ------------------------------------------------------- 2 | memory problem ------------------------------------------------------- 3 | singular Matrix ------------------------------------------------------- Using this DLL in VB 1. Declare the function Public Declare Function hp_filter Lib "HP_Filter.dll" _ (ByRef Data As Double, ByVal nobs As Long, ByVal lambda As Double, _ ByRef out As Double, ByVal ret As Boolean) As Long 2. Now you can use the filter i.e. Dim X(10) As Double, Y(10) As Double, error as long error = hp_filter(X(0), 10, 1600, Y(0), False) */ #include #ifndef _HP_FILTER_H_ #define _HP_FILTER_H_ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if BUILDING_DLL # define DLLEXPORT __declspec (dllexport) #endif /* Not BUILDING_DLL */ DLLEXPORT int hp_filter(double *data, UINT nobs, double lambda, double *output, BOOL ret); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _HP_FILTER_H_ */