commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
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 GMT
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);
 
     }
 



Mime
View raw message