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 2C825101D0 for ; Tue, 12 Nov 2013 11:50:06 +0000 (UTC) Received: (qmail 68194 invoked by uid 500); 12 Nov 2013 11:47:46 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 67770 invoked by uid 500); 12 Nov 2013 11:47:39 -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 67480 invoked by uid 99); 12 Nov 2013 11:47:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Nov 2013 11:47:38 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of thomas.neidhart@gmail.com designates 209.85.128.53 as permitted sender) Received: from [209.85.128.53] (HELO mail-qe0-f53.google.com) (209.85.128.53) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Nov 2013 11:47:32 +0000 Received: by mail-qe0-f53.google.com with SMTP id cy11so5509492qeb.12 for ; Tue, 12 Nov 2013 03:47:12 -0800 (PST) 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=Kwm18Y9NFo4iTZ+CNoDl/MvxcXndGiXeM8LN7/BWxu4=; b=syCrjrPRnr20xVSZWyzIlZNcTjrkIA9e2ZV8LSle28OPt1fs87iASnVstYEVV1z7iA H7tleZ2yukFa6YbewZTiZ0iR5QhOap6FDx/oVY12x+z7BSF8SjLCbWgxcZG19JYnmn9l VtGmhSgoK22PYelxQTuS4xZ9zL8qf8VzIZLmRhwc/G2GnRxxx5b5HPaIKPRBUCjR7834 p43S+y/dPSvvwjtkmp5lYCSC9onpna6m9KT9Jzc6pf2nb5lJfa7f+MO+lkF9XWKBCkos URim6c4i9Vg6Jk8vScam6u3lLFBvc9J4wArNtomtrzizIYX6ri38yqzJcmNiy4IArQFX Kqbw== MIME-Version: 1.0 X-Received: by 10.224.160.134 with SMTP id n6mr25974471qax.4.1384256832156; Tue, 12 Nov 2013 03:47:12 -0800 (PST) Received: by 10.140.85.149 with HTTP; Tue, 12 Nov 2013 03:47:12 -0800 (PST) In-Reply-To: References: <527E2EDC.70608@gmail.com> <5280CBCE.9020905@gmail.com> Date: Tue, 12 Nov 2013 12:47:12 +0100 Message-ID: Subject: Re: [math] eigenvector doubts and issues From: Thomas Neidhart To: Commons Users List Content-Type: multipart/alternative; boundary=047d7bacb410c23ab604eaf96824 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bacb410c23ab604eaf96824 Content-Type: text/plain; charset=ISO-8859-1 Hi Andrea, that's exactly what we are looking for, so do not hesitate to ask questions. Thomas On Tue, Nov 12, 2013 at 11:54 AM, andrea antonello < andrea.antonello@gmail.com> wrote: > Hi Thomas, > > > good to hear. > > Sounds like an interesting problem you are working on. > > If you have found a good solution feel free to come back to use, we might > > want to include it in our user guide how an EigenDecomposition could be > > used. > > thanks for pointing this out, I was a bit afraid to go offtopic. > But I would be happy to share a small eigenvector real world example > if there is interest. I will try to put together something on an > accessible wiki page, but I might need some help to finish it for > proper use in documentation :) > > I'll keep you posted. > Thanks, > Andrea > > > > > Thanks, > > > > Thomas > > > > > > > > On Tue, Nov 12, 2013 at 11:31 AM, andrea antonello < > > andrea.antonello@gmail.com> wrote: > > > >> Hi Thomas, > >> you are definitely right. I was fooled by the "nice" result of the > >> JAMA calculation, not noticing that it is there that I was extracting > >> values in a strange order. > >> > >> I now made some 3x3 tests on known results and also with the A * v = > >> lambda * v constraint and everything is alright. > >> > >> I still have to figure out how to properly use the results to split > >> higher elevation parts from lower z parts in a x,y,z dataset, but the > >> eigenvectors and values are in the right place now. > >> > >> Thanks, > >> Andrea > >> > >> > >> > >> > >> On Mon, Nov 11, 2013 at 1:21 PM, Thomas Neidhart > >> wrote: > >> > On 11/11/2013 11:40 AM, andrea antonello wrote: > >> >> Hi Thomas, > >> >> thanks for your reply. > >> >> > >> >>> the result of CM and jama are identical, the difference is just in > the > >> >>> way how the data is stored. > >> >>> > >> >>> Afaik in jama calling getV() returns a vector in row format whereas > in > >> >>> CM the are stored in column format. > >> >>> > >> >>> If you transpose the matrix (or call getVT()) you will see that the > >> >>> vectors are identical, except for the signs and order. The reason > for > >> >>> this is that for CM the eigenvalues/eigenvectors are sorted in > >> >>> descending order in case of a symmetric matrix, which is the case > for > >> >>> your matrix. > >> >> > >> >> the problems is that the result is not just different in the > >> >> transposed way. And in fact if I pick the getVT,results are still not > >> >> the same. > >> >> The result seems to be reflected on the secondary diagonal, not the > >> >> primary diagonal. > >> >> > >> >> Furthermore, if I use the API, I do not expect to be problems of rows > >> >> and columns, so if I use: > >> >> > >> >> double eigenValue = eigenDecomposition.getRealEigenvalue(i); > >> >> RealVector eigenVector = eigenDecomposition.getEigenvector(i); > >> >> > >> >> I expect the eigenvector and eigenvalue to be the right ones for the > >> >> given index, no matter how the results are given in the matrixes. > >> >> > >> >> But the results I get are, for the same eigenvalue: > >> >> CM: eigenVal: 0.8056498828134406, eigenVect: [0.9015723557614027, > >> >> 0.19005937823202243, 0.38864472217295326 > >> >> JAMA: eigenVal: 0.8056498828134406, eigenVect: [-0.7731388420716028, > >> >> 0.5012101463530931, -0.38864472217295326] > >> >> > >> >> I am still quite puzzled about what I am missing. > >> > > >> > I do not know how you get the eigenvector from jama, as there is no > >> > getEigenVector method. > >> > > >> > The class javadoc of their EigenvalueDecomposition states: > >> > > >> > columns of V represent the eigenvectors in the sense that A*V = > V*D, > >> > i.e. A.times(V) equals V.times(D). The matrix V may be badly > >> > conditioned, or even singular, so the validity of the equation > >> > A = V*D*inverse(V) depends upon V.cond(). > >> > > >> > Looking at your example it looks like you took the rows of V to > extract > >> > your eigenvector. > >> > > >> > You can also easily verify if your eigenvector is correct: > >> > > >> > A * v = lambda * v > >> > > >> > Thomas > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > >> > For additional commands, e-mail: user-help@commons.apache.org > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > >> For additional commands, e-mail: user-help@commons.apache.org > >> > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org > > --047d7bacb410c23ab604eaf96824--