Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 75589 invoked from network); 16 Oct 2010 19:00:21 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Oct 2010 19:00:21 -0000 Received: (qmail 68578 invoked by uid 500); 16 Oct 2010 19:00:19 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 68476 invoked by uid 500); 16 Oct 2010 19:00:19 -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 68468 invoked by uid 99); 16 Oct 2010 19:00:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Oct 2010 19:00:19 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [194.206.126.239] (HELO smtp.nordnet.fr) (194.206.126.239) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Oct 2010 19:00:10 +0000 Received: from lehrin (177.232.146.195.dynamic.adsl.abo.nordnet.fr [195.146.232.177]) by smtp.nordnet.fr (Postfix) with ESMTP id 48F7A345EE for ; Sat, 16 Oct 2010 20:59:48 +0200 (CEST) Received: by lehrin (Postfix, from userid 5001) id CACDC406D; Sat, 16 Oct 2010 20:59:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on lehrin.spaceroots.local X-Spam-Level: Received: from lehrin.spaceroots.local (lehrin.spaceroots.local [127.0.0.1]) by lehrin (Postfix) with ESMTP id 25BD4405E for ; Sat, 16 Oct 2010 20:59:48 +0200 (CEST) Message-ID: <4CB9F623.6050802@free.fr> Date: Sat, 16 Oct 2010 20:59:47 +0200 From: Luc Maisonobe User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100922 Thunderbird/3.1.4 MIME-Version: 1.0 To: Commons Users List Subject: Re: [math] Re: complex matrix operation References: <010401cb6d52$b75d1df0$261759d0$@edu> <4CB9EE01.70106@free.fr> <011301cb6d61$4937a570$dba6f050$@edu> In-Reply-To: <011301cb6d61$4937a570$dba6f050$@edu> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,FREEMAIL_FROM autolearn=unavailable version=3.3.1 Le 16/10/2010 20:38, Cuong P. Nguyen a �crit : > Hi Luc and friends, > > Thanks a lot for the quick response > > 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 = 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 = new Array2DRowFieldMatrix(matrixData); // create a vector Complex[] vectorData = new Complex[] { new Complex(1.0, 2.0), new Complex(3.0, 4.0), }; FieldVector u = new ArrayFieldVector(vectorData); // perform matrix-vector multiplication FieldVector v = m.operate(u); // print the initial vector for (int i = 0; i < u.getDimension(); ++i) { System.out.println(ComplexFormat.formatComplex(u.getEntry(i))); } System.out.println(); // print the result for (int i = 0; i < v.getDimension(); ++i) { System.out.println(ComplexFormat.formatComplex(v.getEntry(i))); } Luc > > I am a new java beginner as well as new to Commons Math community. > > Thanks, > > Cuong > > -----Original Message----- > From: Luc Maisonobe [mailto:Luc.Maisonobe@free.fr] > Sent: Saturday, October 16, 2010 1:25 PM > To: Commons Users List > Subject: [math] Re: complex matrix operation > > Le 16/10/2010 18:53, Cuong P. Nguyen a �crit : >> Hi, > > Hi Cuong, > > 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. > >> can I use the package for basic complex-number matrix operations >> (addition, subtraction, multiplication) ? > > 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. > > Luc > >> >> Thanks >> >> Cuong >> >> > > > --------------------------------------------------------------------- > 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