Phil,
Heres a patch that shows the changes which would solve this copying issue in the current RealMatrixImpl.
Index: RealMatrixImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/linear/RealMatrixImpl.java,v
retrieving revision 1.32
diff -u -r1.32 RealMatrixImpl.java
--- RealMatrixImpl.java 10 Oct 2004 18:00:33 -0000 1.32
+++ RealMatrixImpl.java 11 Oct 2004 19:09:03 -0000
@@ -48,7 +48,7 @@
*
* @version $Revision: 1.32 $ $Date: 2004/10/10 18:00:33 $
*/
-public class RealMatrixImpl implements RealMatrix, Serializable {
+public class RealMatrixImpl implements RealMatrix, InternalMatrixSupport, Serializable {
/** Serializable version identifier */
static final long serialVersionUID = 4237564493130426188L;
@@ -160,7 +160,7 @@
int rowCount = this.getRowDimension();
int columnCount = this.getColumnDimension();
double[][] outData = new double[rowCount][columnCount];
- double[][] mData = m.getData();
+ double[][] mData = ((InternalMatrixSupport)m).getDataRef();
for (int row = 0; row < rowCount; row++) {
for (int col = 0; col < columnCount; col++) {
outData[row][col] = data[row][col] + mData[row][col];
@@ -184,7 +184,7 @@
int rowCount = this.getRowDimension();
int columnCount = this.getColumnDimension();
double[][] outData = new double[rowCount][columnCount];
- double[][] mData = m.getData();
+ double[][] mData = ((InternalMatrixSupport)m).getDataRef();
for (int row = 0; row < rowCount; row++) {
for (int col = 0; col < columnCount; col++) {
outData[row][col] = data[row][col] - mData[row][col];
@@ -242,7 +242,7 @@
int nRows = this.getRowDimension();
int nCols = m.getColumnDimension();
int nSum = this.getColumnDimension();
- double[][] mData = m.getData();
+ double[][] mData = ((InternalMatrixSupport)m).getDataRef();
double[][] outData = new double[nRows][nCols];
double sum = 0;
for (int row = 0; row < nRows; row++) {
@@ -716,7 +716,7 @@
int nRowB = b.getRowDimension(); // Apply permutations to b
- double[][] bv = b.getData();
+ double[][] bv = ((InternalMatrixSupport)b).getDataRef();
double[][] bp = new double[nRowB][nColB];
for (int row = 0; row < nRowB; row++) {
for (int col = 0; col < nColB; col++) {
Index: InternalMatrixSupport.java
===================================================================
RCS file: InternalMatrixSupport.java
diff -N InternalMatrixSupport.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ InternalMatrixSupport.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,26 @@
+/*
+ * Created on Oct 11, 2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.commons.math.linear;
+
+/**
+ * @author Administrator
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public interface InternalMatrixSupport {
+
+ /**
+ * Returns a reference to the underlying data array.
+ * <p>
+ * Does not make a fresh copy of the underlying data.
+ *
+ * @return 2-dimensional array of entries
+ */
+ public double[][] getDataRef();
+
+}--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
