Return-Path: X-Original-To: apmail-mahout-user-archive@www.apache.org Delivered-To: apmail-mahout-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 634C598C3 for ; Wed, 25 Jan 2012 23:54:31 +0000 (UTC) Received: (qmail 26435 invoked by uid 500); 25 Jan 2012 23:45:51 -0000 Delivered-To: apmail-mahout-user-archive@mahout.apache.org Received: (qmail 26400 invoked by uid 500); 25 Jan 2012 23:45:50 -0000 Mailing-List: contact user-help@mahout.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@mahout.apache.org Delivered-To: mailing list user@mahout.apache.org Delivered-To: moderator for user@mahout.apache.org Received: (qmail 12306 invoked by uid 99); 25 Jan 2012 23:32:09 -0000 X-ASF-Spam-Status: No, hits=4.7 required=5.0 tests=FREEMAIL_FORGED_REPLYTO,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 580786.95624.bm@omp1043.mail.sp2.yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1327534288; bh=14kSVzSL6EuHlMWbvDxaRKukp4C/QtTovLEeCla/XCI=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=4vCl5ihNzxADlWxkZwoagWQV1D0LsaVJMbE8srz+Gqfng46EA22i5p6c3n6sNiXHEsATP2L1RIKalVvAv3troRyx3HB26V+xJ+GSqRIdmhtfsfBLR4TFkpRpvmakOPXV0PiaqdSuTP3ErY96dRR8OteQH0GPJtONn4K5QtXHpX8= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=0tvimsxkM9swZCL78EJwvYoS9aWDbF2vVbPoReHzZH+afj4ZRUJcL03qE3KKVxj4UYgyO69VbomxAt6qJnaE+lAh+kwHwzfA7N7TSpF3vZLIXk8IbS/OAf4Fe6SJEydU8z1RZApu/CRKzFuOpiJpeJFe4v9AWXULuJhQo+8WzZA=; X-YMail-OSG: B.hahFsVM1l6W70pwXSOq2SlXgmmmCmjloOdzU9B9J_jebS aQ7nsWW16z.zF_8Qi.ReZybfEEbyDHMCL9HdjJlnT97BnvrkQo8u37doootu P9aTCq7lYY3oJick7iohksdpKULATpqBrzL48esj3QWo3JDdSzb11kP8hyYe Lc6Qf5PiPzLtnPzRZXK0nCM0ghSi4k0tKF1CQs9ZmIV9Bmg_3R401XrEjqMl 5QSX4NgrG5AqHUsjGINDtJ_fZ97ejz78ReAcIwwJIxeLiCLm_op3eB52NgY3 Qi5RBpNQ0KSym4B8BcBNkhmEjC58zwu293F9HG4TdlXLK.hmpIrixHLtwUrQ sShrkrffBmISF7dFOUiNj2mWR6j5EIILYdhFw.dj88bAsPLaEhVoNP.gcU2t nsWY_q49U7DA- X-Mailer: YahooMailWebService/0.8.116.331537 References: <1327472120.72432.YahooMailNeo@web114201.mail.gq1.yahoo.com> <5A5FC957-863B-405C-9C33-CEFEC98585AE@gmail.com> <1327525851.98941.YahooMailNeo@web114217.mail.gq1.yahoo.com> Message-ID: <1327534288.16319.YahooMailNeo@web114215.mail.gq1.yahoo.com> Date: Wed, 25 Jan 2012 15:31:28 -0800 (PST) From: B & E Reply-To: B & E Subject: Re: mahout matrix package To: Ted Dunning Cc: "user@mahout.apache.org" In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="32398890-1719506081-1327534288=:16319" X-Virus-Checked: Checked by ClamAV on apache.org --32398890-1719506081-1327534288=:16319 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable thank you very much!=0A=0A=0A________________________________=0A From: Ted = Dunning =0ATo: B & E =0ACc: "user= @mahout.apache.org" =0ASent: Wednesday, January 25= , 2012 1:39 PM=0ASubject: Re: mahout matrix package=0A =0A=0A=0A=0A=0AOn We= d, Jan 25, 2012 at 1:10 PM, B & E wrote:=0A=0AIt's for p= art of a few straightforward matrix operations but over a very trivial size= of matrix (~ 10 x 5) within a mapper/reducer job.=A0=0A=0ASuppose you have= =A0=0A=0A=A0 =A0 =A0Matrix a;=0A=A0 =A0 =A0Vector b;=0A=0Aand you want to s= olve for x such that a.times(x) =3D b, then this should work:=0A=0A=A0 =A0 = =A0Matrix bMatrix =3D=A0new Matrix(b.size(), 1).assignColumn(0, b);=0A=A0 = =A0 =A0Vector x =3D new QRDecomposition(a).solve(bMatrix).viewColumn(0);=0A= =0A=0AThere is a bit of mess here because there isn't a solve(Vector) metho= d so we have to construct a matrix and then get the required vector back ou= t.=0A=0AIf you absolutely want the inverse over my suggestion that you don'= t want it, try this=0A=0A=A0 =A0 =A0Matrix inverse =3D new QRDecomposition(= a).solve(new DiagonalMatrix(n))=0A=0AYou will have to pick the right n.=0A= =0A=0A>=0A>For the inverse method, for now more like just looking for a han= dy brainless one liner (since the matrix operations is trivial now).=A0=0A= =0AThere you go.=0A=A0=0ABut do have a tradeoff concern in longer term when= the matrix calculations becomes more involved (in terms of complexity but = not so much of size), would we have better off by using another matrix pack= age in the first place VS the out-of-box convenience to get some quick proo= f-of-concepts now.=A0=0A=0AThat is up to you. =A0I still don't know what yo= u are doing and I don't know what your limits are. =A0Mahout's math package= is very good with sparse matrices and is moderate with dense matrices. =A0= It uses an API style that is really nice after you get to understand it, bu= t it has a learning curve.=0A=0A=A0=0A=0A>=0A>thanks.=0A>=0A>=0A>=0A>______= __________________________=0A> From: Ted Dunning =0A= >To: user@mahout.apache.org =0A>Cc: B & E =0A>Sent: Wedn= esday, January 25, 2012 3:18 AM=0A>Subject: Re: mahout matrix package=0A> = =0A>=0A>Matrix inverse is almost never a good idea. =A0The same effect can = usually be had using a decomposition at far less cost. =A0For instance, for= solving a linear system, QR decomposition provides two sub-matrices that c= an easily have an inverse multiply operation applied to them avoiding the n= eed for actually computing the inverse.=0A>=0A>=0A>Can you say more about w= hat you want to do?=0A>=0A>=0A>On Tue, Jan 24, 2012 at 11:47 PM, Raphael Ce= ndrillon wrote:=0A>=0A>I believe matrix inversio= n in general may not be so easy to distributed within a map reduce framewor= k, however you could consider using the SSVD job to calculate an approximat= e matrix inverse.=0A>>=0A>>=0A>>On 24 Jan, 2012, at 10:15 PM, B & E wrote:= =0A>>=0A>>> Hi,=0A>>>=0A>>> I have a mahout newbie question -- I wanted to = do some matrix operations in mahout and just realized Mahout's matrix packa= ge doesn't seem to have any API on providing an inverse of a matrix.=0A>>>= =0A>>> Just curious was there a particular reason for such, or just so happ= ens no code was contributed to add that method to the matrix classes?=0A>>>= =0A>>> thanks.=0A>>>=0A>>> Ejawce=0A>>=0A>>=0A>=0A>=0A> --32398890-1719506081-1327534288=:16319--