• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
yahastu

Kalman filter without using matrix inverse

5 posts in this topic

Kalman filter predict/update equations are here:

https://en.wikipedia.org/wiki/Kalman_filter

 

I have implemented the Kalman filter and it works nicely.  However,  the standard Kalman equations are written naively in terms of the matrix inverse.  In particular, the S matrix (innovation covariance) is inverted in order to compute K (the gain matrix):

S = H P H^t + R
K = P H^t S^{-1}

The gain matrix (K) is finally used to update the state estimate (x) and estimated covariance of the state (P) as follows:

x += K y
P -= K H P

I would like to update 'x' and 'P' without computing the matrix inverse S^{-1}.

In the following reference, a method is given "for calculating (H P H^t + R)^{-1} H in the conventional Kalman filter without explicitly computing an inverse." (using U D U^T, or LDL^t)  Of course, (H P H^t + R)^{-1} is equal to S^{-1}, but this confuses me because "S^{-1} H" does not appear in the computation of K....and so, it is not clear to me, how the value of S^{-1}H can be used to compute K.

Reference:
'Kalman Filtering; Theory and Practice Using MATLAB', second edition, by Grewal and Andrews
http://books.google.com/books?id=sZbxLK-NKb0C&q=+without+explicitly+inverting#v=snippet&q=without%20explicitly%20inverting&f=false
(click the second link)

Edited by yahastu
1

Share this post


Link to post
Share on other sites

In these types of recursive algorithms involving updates and matrix inverse you can often eliminate the inverse with the Matrix Inversion Lemma, also known as the Woodbury identity or variations thereof. It basically gives you a formula for recursively updating the inverse of a matrix directly instead of updating the matrix and then inverting it every iteration.

 

That information may help you on the way, although I am not even sure if it is possible to use the MIL in this case.

1

Share this post


Link to post
Share on other sites

Of course, (H P H^t + R)^{-1} is equal to S^{-1}, but this confuses me because "S^{-1} H" does not appear in the computation of K....and so, it is not clear to me, how the value of S^{-1}H can be used to compute K.


I haven't read the formulas for the Kalman filter in a while, so I might be missing something, but if S is symmetric (which it should be, since it's a covariance matrix of some sort), the transpose of (S^{-1} H) is (H^t S^{-1}), which you can use to compute K.
0

Share this post


Link to post
Share on other sites

Kalman filter predict/update equations are here:

https://en.wikipedia.org/wiki/Kalman_filter

 

I have implemented the Kalman filter and it works nicely.  However,  the standard Kalman equations are written naively in terms of the matrix inverse.  In particular, the S matrix (innovation covariance) is inverted in order to compute K (the gain matrix):

S = H P H^t + R
K = P H^t S^{-1}

The gain matrix (K) is finally used to update the state estimate (x) and estimated covariance of the state (P) as follows:

x += K y
P -= K H P

I would like to update 'x' and 'P' without computing the matrix inverse S^{-1}.

In the following reference, a method is given "for calculating (H P H^t + R)^{-1} H in the conventional Kalman filter without explicitly computing an inverse." (using U D U^T, or LDL^t)  Of course, (H P H^t + R)^{-1} is equal to S^{-1}, but this confuses me because "S^{-1} H" does not appear in the computation of K....and so, it is not clear to me, how the value of S^{-1}H can be used to compute K.

Reference:
'Kalman Filtering; Theory and Practice Using MATLAB', second edition, by Grewal and Andrews
http://books.google.com/books?id=sZbxLK-NKb0C&q=+without+explicitly+inverting#v=snippet&q=without%20explicitly%20inverting&f=false
(click the second link)

 

You have K = P H^t S^{-1} = P X^t, where X is the solution to the linear system of equations

S X = H

now this could be solved by calculating X = S^-1 H which is, however, not the most efficient solution.

Since in your case S is positive definite, you can use the Cholesky decomposition to solve it.

More information on wikipedia.

0

Share this post


Link to post
Share on other sites

I you are using lapack to do the linear algebra stuff, the functions dpotrf and dpotrs will do what you need here.

0

Share this post


Link to post
Share on other sites

There are three forms of the Kalman filter.  You might consider using another form,

 

There's the covariance form, which you are using.  This requires a matrix inversion at each step, but gives you the state estimate directly.  This is the form most people know.

 

There's also an information form, which works with the inverse of the covariance matrix (called the (Fisher) information matrix).  This does not require a matrix inversion at each step -- but the state estimate is not directly accessible. Instead of a state estimate, you have an information vector.  You can reconstruct the state estimate from the information vector, but this requires a matrix inverse.  One nice thing about this form is that you can specify a totally noninformative prior for the state by setting the initial information matrix to zero.  Also, there are reasonable assumptions under which information matrices are sparse (but covariance matrices are not), so this form can sometimes be efficient for really large problems with sparsity.

 

Finally, there's the square root form.  Here, instead of working with either the covariance or its inverse, you work with a matrix square root of the covariance matrix (e.g., its Cholesky decomposition), and actually never construct the covariance matrix directly.  This is usually the most computationally efficient filter. [EDIT: Actually, it's the most expensive; what it is is numerically stable.]  It also avoid the problems of ensuring that your covariance or information matrix remain positive definite in the face of roundoff errors, since it's impossible to represent anything but positive definite matrices this way [EDIT: this is largely the point of this form].

Edited by Emergent
2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0