Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 1802 invoked from network); 16 Oct 2010 20:47:33 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Oct 2010 20:47:33 -0000 Received: (qmail 35687 invoked by uid 500); 16 Oct 2010 20:47:32 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 35583 invoked by uid 500); 16 Oct 2010 20:47:32 -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 35575 invoked by uid 99); 16 Oct 2010 20:47:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Oct 2010 20:47:32 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of cnguyen7@iit.edu designates 216.47.143.127 as permitted sender) Received: from [216.47.143.127] (HELO spamblock-1.iit.edu) (216.47.143.127) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Oct 2010 20:47:22 +0000 X-ASG-Debug-ID: 1287262020-0c789b980001-yrcYzN Received: from atlas-v-iv.iit.edu (atlas-p.iit.edu [216.47.143.155]) by spamblock-1.iit.edu with ESMTP id VBToM6JHCNYL5F9V for ; Sat, 16 Oct 2010 15:47:00 -0500 (CDT) X-Barracuda-Envelope-From: cnguyen7@iit.edu X-Barracuda-Apparent-Source-IP: 216.47.143.155 MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Received: from CUONGNGUYEN (dhcp169.hum.iit.edu [216.47.158.169]) by atlas-v.iit.edu (Sun Java(tm) System Messaging Server 6.3-4.01 (built Aug 3 2007; 32bit)) with ESMTPSA id <0LAE00B3UHW50J30@atlas-v.iit.edu> for user@commons.apache.org; Sat, 16 Oct 2010 15:50:29 -0500 (CDT) From: "Cuong P. Nguyen" To: 'Commons Users List' References: <010401cb6d52$b75d1df0$261759d0$@edu> <4CB9EE01.70106@free.fr> <011301cb6d61$4937a570$dba6f050$@edu> <4CB9F623.6050802@free.fr> In-reply-to: <4CB9F623.6050802@free.fr> Subject: [math] Re: complex matrix operation Date: Sat, 16 Oct 2010 15:47:01 -0500 X-ASG-Orig-Subj: [math] Re: complex matrix operation Message-id: <011401cb6d73$485e0920$d91a1b60$@edu> Content-transfer-encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-index: ActtZN148D9ye+c3TwavcWGQeXipnAADUQKQ Content-language: en-us X-Barracuda-Connect: atlas-p.iit.edu[216.47.143.155] X-Barracuda-Start-Time: 1287262020 X-Barracuda-URL: http://spamblock-1.iit.edu:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at iit.edu X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.43878 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Hi Luc and friends,=20 I have a question more related to java matrix storage. If I have a 3-dimentional m matrix say 2 by 2 by 2, I want to access the matrix efficiently so I would like to know the order in which the data is = stored in the memory. I am not sure if it is stored consecutively this way in the memory register: m(1,1,1), m(1,1,2), m(1,2,1), m(1,2,2), m(2,1,1), m(2,1,2), m(2,2,1), m(2,2,2) I also wonder if the package could store sparse vectors, matrices and perform basic operations on them? Thanks, Cuong -----Original Message----- From: Luc Maisonobe [mailto:Luc.Maisonobe@free.fr]=20 Sent: Saturday, October 16, 2010 2:00 PM To: Commons Users List Subject: Re: [math] Re: complex matrix operation Le 16/10/2010 20:38, Cuong P. Nguyen a =E9crit : > Hi Luc and friends,=20 >=20 > Thanks a lot for the quick response >=20 > Could you give me any simple code example of Complex-type = vector-matrix > multiplication or matrix-matrix multiplication ? Here is a matrix vector multiplication: // create a 2x2 complex matrix Complex[][] matrixData =3D new Complex[][] { { new Complex(1.0, 0.0), new Complex( 0.0, 1.0) }, { new Complex(0.0, -1.0), new Complex(-1.0, 0.0) } }; FieldMatrix m =3D new = Array2DRowFieldMatrix(matrixData); // create a vector Complex[] vectorData =3D new Complex[] { new Complex(1.0, 2.0), new Complex(3.0, 4.0), }; FieldVector u =3D new ArrayFieldVector(vectorData); // perform matrix-vector multiplication FieldVector v =3D m.operate(u); // print the initial vector for (int i =3D 0; i < u.getDimension(); ++i) { System.out.println(ComplexFormat.formatComplex(u.getEntry(i))); } System.out.println(); // print the result for (int i =3D 0; i < v.getDimension(); ++i) { System.out.println(ComplexFormat.formatComplex(v.getEntry(i))); } Luc >=20 > I am a new java beginner as well as new to Commons Math community. >=20 > Thanks, >=20 > Cuong >=20 > -----Original Message----- > From: Luc Maisonobe [mailto:Luc.Maisonobe@free.fr]=20 > Sent: Saturday, October 16, 2010 1:25 PM > To: Commons Users List > Subject: [math] Re: complex matrix operation >=20 > Le 16/10/2010 18:53, Cuong P. Nguyen a =E9crit : >> Hi, >=20 > Hi Cuong, >=20 > First, please use a [math] marker on the subject line when posting to > this list for the commons-math component. The list is shared among > several commons components and these markers help filtering. >=20 >> can I use the package for basic complex-number matrix operations >> (addition, subtraction, multiplication) ? >=20 > You can use the linear algebra packe from commons-math with complex > matrices. The appropriate interface is FieldMatrix which has > two implementations: Array2DRowFieldMatrix and > BlockFieldMatrix. The former should be preferred for small > sizes and the later for large sizes. You can also use complex vectors > and LU decomposition with these matrices. >=20 > Luc >=20 >> >> Thanks >> >> Cuong >> >> >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > For additional commands, e-mail: user-help@commons.apache.org >=20 --------------------------------------------------------------------- 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