Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2DBAD11E62 for ; Mon, 4 Aug 2014 13:34:41 +0000 (UTC) Received: (qmail 3275 invoked by uid 500); 4 Aug 2014 13:34:40 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 3185 invoked by uid 500); 4 Aug 2014 13:34:40 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 3172 invoked by uid 99); 4 Aug 2014 13:34:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Aug 2014 13:34:39 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of schwarz.arne@gmail.com designates 209.85.220.43 as permitted sender) Received: from [209.85.220.43] (HELO mail-pa0-f43.google.com) (209.85.220.43) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Aug 2014 13:34:38 +0000 Received: by mail-pa0-f43.google.com with SMTP id lf10so10044066pab.2 for ; Mon, 04 Aug 2014 06:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=r0YKB8WguTPQl3lZ0IhjdL3/K2BEbqrMgaKMuhBylfM=; b=xECagcRda8IzJXJVlNo3vxmBOrW8r6vV17//F6UgN0B0Xz8H/jHBIWMlC5dncRM+X3 ri0/bk/JfkiFa4JBzAxfrE2uohvongJ88eXyK7qMtUchocwOwMuiwpMxGzHcaB8YME/U 73K8acp3TVb3tm8o3y0gmVNnGnLEgjNKUUNlYZcZfFr/vnAShBLYjxqiuSXbGogz91Ji 9ip32hHpEMyIZ8ikFGviJqdrSnGtxqaMxitCBcoBe2R/5sQD1p7g7PlbC3RJNhch2I3N GVIoop4wKyJ14QmIkp73sNzwKGlJWp/UH9ii7uRMYnWNqdpvlKmDavoaGxB9vozFvQgH k4tQ== MIME-Version: 1.0 X-Received: by 10.70.49.2 with SMTP id q2mr588452pdn.28.1407159252765; Mon, 04 Aug 2014 06:34:12 -0700 (PDT) Received: by 10.70.109.168 with HTTP; Mon, 4 Aug 2014 06:34:12 -0700 (PDT) In-Reply-To: <80d395d82c9b978fc53726e1ca87ce93@scarlet.be> References: <80d395d82c9b978fc53726e1ca87ce93@scarlet.be> Date: Mon, 4 Aug 2014 15:34:12 +0200 Message-ID: Subject: Re: [math] Calculating gain matrix in KalmanFilter From: Arne Schwarz To: Commons Users List Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org 2014-08-04 13:43 GMT+02:00 Gilles : > On Sun, 3 Aug 2014 18:18:24 +0200, Arne Schwarz wrote: >> >> Hi, >> >> I saw that to calculate the gain matrix the actual inverse of the >> residual covariance matrix is calculated. Wouldn't it be faster to use >> for example a Cholesky decomposition to solve the linear system? Since >> a covariance matrix is always symmetric and at least positive >> semi-definite. > > > Reading the code (in class "MatrixUtils"), it looks like QR decomposition > is used; any problem with that choice? > > Regards, > Gilles > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > What I meant was these lines in class "KalmanFilter": 363 // invert S 364 RealMatrix invertedS = MatrixUtils.inverse(s); 365 366 // Inn = z(k) - H * xHat(k)- 367 RealVector innovation = z.subtract(measurementMatrix.operate(stateEstimation)); 368 369 // calculate gain matrix 370 // K(k) = P(k)- * H' * (H * P(k)- * H' + R)^-1 371 // K(k) = P(k)- * H' * S^-1 372 RealMatrix kalmanGain = errorCovariance.multiply(measurementMatrixT).multiply(invertedS); I thought it would be better to directly solve the system an not calculate the inverse separately, but I may be wrong. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org