Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 16729 invoked from network); 4 Jan 2009 12:10:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jan 2009 12:10:18 -0000 Received: (qmail 76449 invoked by uid 500); 4 Jan 2009 12:10:16 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 76406 invoked by uid 500); 4 Jan 2009 12:10:16 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 76397 invoked by uid 99); 4 Jan 2009 12:10:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Jan 2009 04:10:16 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Jan 2009 12:10:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EC34B23888E7; Sun, 4 Jan 2009 04:09:53 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r731232 - /commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java Date: Sun, 04 Jan 2009 12:09:53 -0000 To: commits@commons.apache.org From: luc@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090104120953.EC34B23888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: luc Date: Sun Jan 4 04:09:53 2009 New Revision: 731232 URL: http://svn.apache.org/viewvc?rev=731232&view=rev Log: avoid ugly call to getDataRef that relies on vector internal implementation Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java?rev=731232&r1=731231&r2=731232&view=diff ============================================================================== --- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java (original) +++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java Sun Jan 4 04:09:53 2009 @@ -1032,13 +1032,12 @@ throws MatrixIndexException { checkRowIndex(row); - final RealVectorImpl out = new RealVectorImpl(columns); + final double[] outData = new double[columns]; // perform copy block-wise, to ensure good cache behavior final int iBlock = row / BLOCK_SIZE; final int iRow = row - iBlock * BLOCK_SIZE; int outIndex = 0; - double[] outData = out.getDataRef(); for (int jBlock = 0; jBlock < blockColumns; ++jBlock) { final int jWidth = blockWidth(jBlock); final double[] block = blocks[iBlock * blockColumns + jBlock]; @@ -1046,7 +1045,7 @@ outIndex += jWidth; } - return out; + return new RealVectorImpl(outData, false); } @@ -1065,14 +1064,13 @@ throws MatrixIndexException { checkColumnIndex(column); - final RealVectorImpl out = new RealVectorImpl(rows); + final double[] outData = new double[rows]; // perform copy block-wise, to ensure good cache behavior final int jBlock = column / BLOCK_SIZE; final int jColumn = column - jBlock * BLOCK_SIZE; final int jWidth = blockWidth(jBlock); int outIndex = 0; - double[] outData = out.getDataRef(); for (int iBlock = 0; iBlock < blockRows; ++iBlock) { final int iHeight = blockHeight(iBlock); final double[] block = blocks[iBlock * blockColumns + jBlock]; @@ -1081,7 +1079,7 @@ } } - return out; + return new RealVectorImpl(outData, false); }