-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2918 from ChadFulton/ss-cykfs
ENH: Statespace: New / improved Kalman filter, smoother, simulation smoother (feature branch)
- Loading branch information
Showing
41 changed files
with
9,629 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# ## Math Functions | ||
# Real and complex log and abs functions | ||
from libc.math cimport log as dlog, abs as dabs | ||
cimport numpy as np | ||
|
||
cdef extern from "numpy/npy_math.h": | ||
np.float64_t NPY_PI | ||
np.float64_t npy_cabs(np.npy_cdouble z) | ||
np.npy_cdouble npy_clog(np.npy_cdouble z) | ||
|
||
cdef inline np.float64_t zabs(np.complex128_t z): | ||
return npy_cabs((<np.npy_cdouble *> &z)[0]) | ||
|
||
cdef inline np.complex128_t zlog(np.complex128_t z): | ||
cdef np.npy_cdouble x | ||
x = npy_clog((<np.npy_cdouble*> &z)[0]) | ||
return (<np.complex128_t *> &x)[0] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#cython: boundscheck=False | ||
#cython: wraparound=False | ||
#cython: cdivision=False | ||
""" | ||
State Space Models - Conventional Kalman Filter declarations | ||
Author: Chad Fulton | ||
License: Simplified-BSD | ||
""" | ||
|
||
cimport numpy as np | ||
from statsmodels.tsa.statespace._representation cimport ( | ||
sStatespace, dStatespace, cStatespace, zStatespace | ||
) | ||
from statsmodels.tsa.statespace._kalman_filter cimport ( | ||
sKalmanFilter, dKalmanFilter, cKalmanFilter, zKalmanFilter | ||
) | ||
|
||
# Single precision | ||
cdef int sforecast_missing_conventional(sKalmanFilter kfilter, sStatespace model) | ||
cdef int supdating_missing_conventional(sKalmanFilter kfilter, sStatespace model) | ||
cdef np.float32_t sinverse_missing_conventional(sKalmanFilter kfilter, sStatespace model, np.float32_t determinant) except * | ||
cdef np.float32_t sloglikelihood_missing_conventional(sKalmanFilter kfilter, sStatespace model, np.float32_t determinant) | ||
|
||
cdef int sforecast_conventional(sKalmanFilter kfilter, sStatespace model) | ||
cdef int supdating_conventional(sKalmanFilter kfilter, sStatespace model) | ||
cdef int sprediction_conventional(sKalmanFilter kfilter, sStatespace model) | ||
cdef np.float32_t sloglikelihood_conventional(sKalmanFilter kfilter, sStatespace model, np.float32_t determinant) | ||
|
||
# Double precision | ||
cdef int dforecast_missing_conventional(dKalmanFilter kfilter, dStatespace model) | ||
cdef int dupdating_missing_conventional(dKalmanFilter kfilter, dStatespace model) | ||
cdef np.float64_t dinverse_missing_conventional(dKalmanFilter kfilter, dStatespace model, np.float64_t determinant) except * | ||
cdef np.float64_t dloglikelihood_missing_conventional(dKalmanFilter kfilter, dStatespace model, np.float64_t determinant) | ||
|
||
cdef int dforecast_conventional(dKalmanFilter kfilter, dStatespace model) | ||
cdef int dupdating_conventional(dKalmanFilter kfilter, dStatespace model) | ||
cdef int dprediction_conventional(dKalmanFilter kfilter, dStatespace model) | ||
cdef np.float64_t dloglikelihood_conventional(dKalmanFilter kfilter, dStatespace model, np.float64_t determinant) | ||
|
||
# Single precision complex | ||
cdef int cforecast_missing_conventional(cKalmanFilter kfilter, cStatespace model) | ||
cdef int cupdating_missing_conventional(cKalmanFilter kfilter, cStatespace model) | ||
cdef np.complex64_t cinverse_missing_conventional(cKalmanFilter kfilter, cStatespace model, np.complex64_t determinant) except * | ||
cdef np.complex64_t cloglikelihood_missing_conventional(cKalmanFilter kfilter, cStatespace model, np.complex64_t determinant) | ||
|
||
cdef int cforecast_conventional(cKalmanFilter kfilter, cStatespace model) | ||
cdef int cupdating_conventional(cKalmanFilter kfilter, cStatespace model) | ||
cdef int cprediction_conventional(cKalmanFilter kfilter, cStatespace model) | ||
cdef np.complex64_t cloglikelihood_conventional(cKalmanFilter kfilter, cStatespace model, np.complex64_t determinant) | ||
|
||
# Double precision complex | ||
cdef int zforecast_missing_conventional(zKalmanFilter kfilter, zStatespace model) | ||
cdef int zupdating_missing_conventional(zKalmanFilter kfilter, zStatespace model) | ||
cdef np.complex128_t zinverse_missing_conventional(zKalmanFilter kfilter, zStatespace model, np.complex128_t determinant) except * | ||
cdef np.complex128_t zloglikelihood_missing_conventional(zKalmanFilter kfilter, zStatespace model, np.complex128_t determinant) | ||
|
||
cdef int zforecast_conventional(zKalmanFilter kfilter, zStatespace model) | ||
cdef int zupdating_conventional(zKalmanFilter kfilter, zStatespace model) | ||
cdef int zprediction_conventional(zKalmanFilter kfilter, zStatespace model) | ||
cdef np.complex128_t zloglikelihood_conventional(zKalmanFilter kfilter, zStatespace model, np.complex128_t determinant) |
Oops, something went wrong.