qub_kalman.h.html mathcode2html   
 Source file:   qub_kalman.h
 Converted:   Thu Feb 26 2015 at 13:39:00
 This documentation file will not reflect any later changes in the source file.

$$\phantom{******** If you see this on the webpage then the browser could not locate *********}$$
$$\phantom{******** jsMath/easy/load.js or the variable root is set wrong in this file *********}$$
$$\newcommand{\vector}[1]{\left[\begin{array}{c} #1 \end{array}\right]}$$ $$\newenvironment{matrix}{\left[\begin{array}{cccccccccc}} {\end{array}\right]}$$ $$\newcommand{\A}{{\cal A}}$$ $$\newcommand{\W}{{\cal W}}$$

/* Copyright 2008-2011 Research Foundation State University of New York   */

/* This file is part of QUB Express.                                      */

/* QUB Express is free software; you can redistribute it and/or modify    */
/* it under the terms of the GNU General Public License as published by   */
/* the Free Software Foundation, either version 3 of the License, or      */
/* (at your option) any later version.                                    */

/* QUB Express is distributed in the hope that it will be useful,         */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of         */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
/* GNU General Public License for more details.                           */

/* You should have received a copy of the GNU General Public License,     */
/* named LICENSE.txt, in the QUB Express program directory.  If not, see  */
/* <http://www.gnu.org/licenses/>.                                        */

#ifndef QUB_KALMAN_H
#define QUB_KALMAN_H

#include "ublas_plus.h"
#include "qubfast.h"

#ifdef __cplusplus
extern "C" {
#endif


typedef struct {
  void *storage;
  int Nprocess, Nmeasure;
  double **A;    // process matrix
  double **Q;    // process covariance
  double **H;    // process->measurement matrix
  double **R;    // measurement covariance
} qub_kalman_const;

QUBFAST_API qub_kalman_const * qub_kalman_create(int Nprocess, int Nmeasure);
QUBFAST_API void qub_kalman_free(qub_kalman_const *filter);

typedef struct {
  void *storage;
  qub_kalman_const *kalman;
  double *X;     // posterior process vector
  double *Z;     // posterior measurement vector (filter output for last sample)
  double **P;    // posterior process covariance
} qub_kalman_state;

QUBFAST_API qub_kalman_state * qub_kalman_state_create(qub_kalman_const *kalman);
QUBFAST_API void qub_kalman_state_free(qub_kalman_state *state);
QUBFAST_API void qub_kalman_state_copy(qub_kalman_state *into, qub_kalman_state *from);
QUBFAST_API void qub_kalman_state_reset(qub_kalman_state *state);
QUBFAST_API void qub_kalman_state_next(qub_kalman_state *state, double *z);
QUBFAST_API void qub_kalman_state_next_into(qub_kalman_state *into, qub_kalman_state *from, double *z);
QUBFAST_API void qub_kalman_filter(qub_kalman_state *state, int N, double *z, double *p); // for Nmeasure == 1
  // p: output variance (of X[0]) unless p==NULL
#ifdef __cplusplus
}
#endif

#endif