You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2009/06/11 10:54:04 UTC
svn commit: r783702 [1/4] - in /commons/proper/math/trunk: ./
src/experimental/org/apache/commons/math/linear/
src/java/org/apache/commons/math/
src/java/org/apache/commons/math/estimation/
src/java/org/apache/commons/math/linear/ src/java/org/apache/c...
Author: luc
Date: Thu Jun 11 08:54:02 2009
New Revision: 783702
URL: http://svn.apache.org/viewvc?rev=783702&view=rev
Log:
renamed RealMatrixImpl, RealVectorImpl, FieldMatrixImpl and FieldVectorImpl
into Array2DRowRealMatrix, ArrayRealVector, Array2DRowFieldMatrix and ArrayFieldVector
as suggested by Sam in http://markmail.org/message/hh37ivxpzaoapekj
Added:
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java
- copied, changed from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/FieldMatrixImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java
- copied, changed from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/ArrayFieldVector.java
- copied, changed from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/FieldVectorImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/ArrayRealVector.java
- copied, changed from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorImpl.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java
- copied, changed from r783662, commons/proper/math/trunk/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/ArrayFieldVectorTest.java
- copied, changed from r783662, commons/proper/math/trunk/src/test/org/apache/commons/math/linear/FieldVectorImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/ArrayRealVectorTest.java
- copied, changed from r783662, commons/proper/math/trunk/src/test/org/apache/commons/math/linear/RealVectorImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockFieldMatrixTest.java
- copied, changed from r783678, commons/proper/math/trunk/src/test/org/apache/commons/math/linear/DenseFieldMatrixTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/BlockRealMatrixTest.java
- copied, changed from r783678, commons/proper/math/trunk/src/test/org/apache/commons/math/linear/DenseRealMatrixTest.java
Removed:
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/FieldMatrixImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/FieldVectorImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorImpl.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/DenseFieldMatrixTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/DenseRealMatrixTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/FieldVectorImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/RealVectorImplTest.java
Modified:
commons/proper/math/trunk/findbugs-exclude-filter.xml
commons/proper/math/trunk/src/experimental/org/apache/commons/math/linear/CholeskySolver.java
commons/proper/math/trunk/src/experimental/org/apache/commons/math/linear/CholeskySolverTest.java
commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java
commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
commons/proper/math/trunk/src/java/org/apache/commons/math/estimation/GaussNewtonEstimator.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractFieldMatrix.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractRealMatrix.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockFieldMatrix.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockRealMatrix.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/LUDecompositionImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixUtils.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/QRDecompositionImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorFormat.java
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegrator.java
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegrator.java
commons/proper/math/trunk/src/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/linear/LinearConstraint.java
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/linear/LinearObjectiveFunction.java
commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/linear/SimplexTableau.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/AbstractMultipleLinearRegression.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/GLSMultipleLinearRegression.java
commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/OLSMultipleLinearRegression.java
commons/proper/math/trunk/src/site/xdoc/changes.xml
commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/CholeskySolverTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/EigenSolverTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/FieldLUDecompositionImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/FieldMatrixImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/LUSolverTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/MatrixUtilsTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/QRSolverTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/RealVectorFormatAbstractTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SingularValueSolverTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseFieldMatrixTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealMatrixTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/linear/SimplexSolverTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/correlation/CovarianceTest.java
commons/proper/math/trunk/src/test/org/apache/commons/math/stat/regression/OLSMultipleLinearRegressionTest.java
Modified: commons/proper/math/trunk/findbugs-exclude-filter.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/findbugs-exclude-filter.xml?rev=783702&r1=783701&r2=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/findbugs-exclude-filter.xml (original)
+++ commons/proper/math/trunk/findbugs-exclude-filter.xml Thu Jun 11 08:54:02 2009
@@ -100,12 +100,12 @@
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
- <Class name="org.apache.commons.math.linear.RealMatrixImpl"/>
+ <Class name="org.apache.commons.math.linear.Array2DRowRealMatrix"/>
<Method name="<init>" params="double[][],boolean" returns="void" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
- <Class name="org.apache.commons.math.linear.RealMatrixImpl"/>
+ <Class name="org.apache.commons.math.linear.Array2DRowRealMatrix"/>
<Method name="getDataRef" params="" returns="double[][]" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
@@ -115,12 +115,12 @@
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
- <Class name="org.apache.commons.math.linear.FieldMatrixImpl"/>
+ <Class name="org.apache.commons.math.linear.Array2DRowFieldMatrix"/>
<Method name="<init>" params="org.apache.commons.math.FieldElement[][],boolean" returns="void" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
- <Class name="org.apache.commons.math.linear.FieldMatrixImpl"/>
+ <Class name="org.apache.commons.math.linear.Array2DRowFieldMatrix"/>
<Method name="getDataRef" params="" returns="org.apache.commons.math.FieldElement[][]" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
@@ -138,12 +138,12 @@
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
- <Class name="org.apache.commons.math.linear.RealVectorImpl"/>
+ <Class name="org.apache.commons.math.linear.ArrayRealVector"/>
<Method name="getDataRef" params="" returns="double[]" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
<Match>
- <Class name="org.apache.commons.math.linear.FieldVectorImpl"/>
+ <Class name="org.apache.commons.math.linear.ArrayFieldVector"/>
<Method name="getDataRef" params="" returns="org.apache.commons.math.FieldElement[]" />
<Bug pattern="EI_EXPOSE_REP" />
</Match>
Modified: commons/proper/math/trunk/src/experimental/org/apache/commons/math/linear/CholeskySolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/experimental/org/apache/commons/math/linear/CholeskySolver.java?rev=783702&r1=783701&r2=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/experimental/org/apache/commons/math/linear/CholeskySolver.java (original)
+++ commons/proper/math/trunk/src/experimental/org/apache/commons/math/linear/CholeskySolver.java Thu Jun 11 08:54:02 2009
@@ -37,7 +37,7 @@
private double numericalZero = 10E-12;
/** The lower triangular matrix */
- private RealMatrixImpl decompMatrix;
+ private Array2DRowRealMatrix decompMatrix;
/**
@@ -108,7 +108,7 @@
}//for all columns
- decompMatrix = new RealMatrixImpl(decomp);
+ decompMatrix = new Array2DRowRealMatrix(decomp);
}//decompose
@@ -119,7 +119,7 @@
* Caution: Every call of this Method will return the same object.
* Decomposing another matrix will generate a new one.
*/
- public RealMatrixImpl getDecomposition() {
+ public Array2DRowRealMatrix getDecomposition() {
return decompMatrix;
}//getDecomposition
Modified: commons/proper/math/trunk/src/experimental/org/apache/commons/math/linear/CholeskySolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/experimental/org/apache/commons/math/linear/CholeskySolverTest.java?rev=783702&r1=783701&r2=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/experimental/org/apache/commons/math/linear/CholeskySolverTest.java (original)
+++ commons/proper/math/trunk/src/experimental/org/apache/commons/math/linear/CholeskySolverTest.java Thu Jun 11 08:54:02 2009
@@ -98,7 +98,7 @@
try {
solver.decompose(
- new RealMatrixImpl(new double[][]{{numericalZero/2, 0},
+ new Array2DRowRealMatrix(new double[][]{{numericalZero/2, 0},
{0, numericalZero/2}}));
fail("testing numericalZero");
} catch (IllegalArgumentException e) {}
@@ -127,7 +127,7 @@
try {
CholeskySolver solver = new CholeskySolver();
- solver.decompose(new RealMatrixImpl(m7));
+ solver.decompose(new Array2DRowRealMatrix(m7));
fail("Decomposing matrix m7");
} catch (IllegalArgumentException e) {}
@@ -162,7 +162,7 @@
try {
CholeskySolver solver = new CholeskySolver();
- solver.solve(new RealMatrixImpl(m3), new double[] {1, 2, 3, 4});
+ solver.solve(new Array2DRowRealMatrix(m3), new double[] {1, 2, 3, 4});
fail("Solving matrix m3[3x3], v[4]");
} catch (IllegalArgumentException e) {}
@@ -201,7 +201,7 @@
private void testDecompose(double[][] lowerTriangularMatrix, String message)
throws IllegalArgumentException {
- RealMatrix triangularMatrix = new RealMatrixImpl(lowerTriangularMatrix);
+ RealMatrix triangularMatrix = new Array2DRowRealMatrix(lowerTriangularMatrix);
RealMatrix pdMatrix =
triangularMatrix.multiply(triangularMatrix.transpose());
@@ -220,9 +220,9 @@
private void testSolve(double[][] lowerTriangularMatrix, String message) {
RealMatrix triangularMatrix =
- new RealMatrixImpl(lowerTriangularMatrix);
- RealMatrixImpl pdMatrix =
- (RealMatrixImpl) triangularMatrix.multiply(triangularMatrix.transpose());
+ new Array2DRowRealMatrix(lowerTriangularMatrix);
+ Array2DRowRealMatrix pdMatrix =
+ (Array2DRowRealMatrix) triangularMatrix.multiply(triangularMatrix.transpose());
CholeskySolver solver =
new CholeskySolver();
@@ -232,10 +232,10 @@
c[i] += lowerTriangularMatrix[i][j];
solver.decompose(pdMatrix);
- RealMatrix x = new RealMatrixImpl(solver.solve(c));
+ RealMatrix x = new Array2DRowRealMatrix(solver.solve(c));
assertTrue(message,
- areEqual(pdMatrix.multiply(x), new RealMatrixImpl(c), 1.0E-10));
+ areEqual(pdMatrix.multiply(x), new Array2DRowRealMatrix(c), 1.0E-10));
}//testSolve
@@ -247,7 +247,7 @@
String message)
throws IllegalArgumentException {
- RealMatrix triangularMatrix = new RealMatrixImpl(lowerTriangularMatrix);
+ RealMatrix triangularMatrix = new Array2DRowRealMatrix(lowerTriangularMatrix);
RealMatrix pdMatrix =
triangularMatrix.multiply(triangularMatrix.transpose());
double pdDeterminant = determinant * determinant;
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java?rev=783702&r1=783701&r2=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java Thu Jun 11 08:54:02 2009
@@ -16,7 +16,7 @@
*/
package org.apache.commons.math;
-import org.apache.commons.math.linear.RealVectorImpl;
+import org.apache.commons.math.linear.ArrayRealVector;
/**
* Exception thrown when an error occurs evaluating a function.
@@ -53,7 +53,7 @@
* @since 2.0
*/
public FunctionEvaluationException(double[] argument) {
- super("evaluation failed for argument = {0}", new RealVectorImpl(argument));
+ super("evaluation failed for argument = {0}", new ArrayRealVector(argument));
this.argument = argument.clone();
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java?rev=783702&r1=783701&r2=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java Thu Jun 11 08:54:02 2009
@@ -365,13 +365,13 @@
// org.apache.commons.math.linear.decomposition.LUDecompositionImpl
// org.apache.commons.math.linear.decomposition.QRDecompositionImpl
// org.apache.commons.math.linear.decomposition.SingularValueDecompositionImpl
- // org.apache.commons.math.linear.RealVectorImpl
+ // org.apache.commons.math.linear.ArrayRealVector
// org.apache.commons.math.linear.SparseRealVector
{ "vector length mismatch: got {0} but expected {1}",
"dimension de vecteur erronn\u00e9e : {0} \u00e0 la place de {1}" },
- // org.apache.commons.math.linear.RealVectorImpl
- // org.apache.commons.math.linear.FieldVectorImpl
+ // org.apache.commons.math.linear.ArrayRealVector
+ // org.apache.commons.math.linear.ArrayFieldVector
// org.apache.commons.math.linear.SparseRealVector
{ "index {0} out of allowed range [{1}, {2}]",
"index {0} hors de la plage autoris\u00e9e [{1}, {2}]" },
@@ -566,7 +566,7 @@
"norme nulle pour un axe de d\u00e9finition de rotation" },
// org.apache.commons.math.geometry.Vector3D
- // org.apache.commons.math.linear.RealVectorImpl
+ // org.apache.commons.math.linear.ArrayRealVector
{ "cannot normalize a zero norm vector",
"impossible de normer un vecteur de norme nulle" },
{ "zero norm",
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/estimation/GaussNewtonEstimator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/estimation/GaussNewtonEstimator.java?rev=783702&r1=783701&r2=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/estimation/GaussNewtonEstimator.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/estimation/GaussNewtonEstimator.java Thu Jun 11 08:54:02 2009
@@ -24,7 +24,7 @@
import org.apache.commons.math.linear.MatrixUtils;
import org.apache.commons.math.linear.RealMatrix;
import org.apache.commons.math.linear.RealVector;
-import org.apache.commons.math.linear.RealVectorImpl;
+import org.apache.commons.math.linear.ArrayRealVector;
/**
* This class implements a solver for estimation problems.
@@ -163,7 +163,7 @@
// work matrices
double[] grad = new double[parameters.length];
- RealVectorImpl bDecrement = new RealVectorImpl(parameters.length);
+ ArrayRealVector bDecrement = new ArrayRealVector(parameters.length);
double[] bDecrementData = bDecrement.getDataRef();
RealMatrix wGradGradT = MatrixUtils.createRealMatrix(parameters.length, parameters.length);
@@ -173,7 +173,7 @@
// build the linear problem
incrementJacobianEvaluationsCounter();
- RealVector b = new RealVectorImpl(parameters.length);
+ RealVector b = new ArrayRealVector(parameters.length);
RealMatrix a = MatrixUtils.createRealMatrix(parameters.length, parameters.length);
for (int i = 0; i < measurements.length; ++i) {
if (! measurements [i].isIgnored()) {
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractFieldMatrix.java?rev=783702&r1=783701&r2=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractFieldMatrix.java Thu Jun 11 08:54:02 2009
@@ -499,7 +499,7 @@
/** {@inheritDoc} */
public FieldVector<T> getRowVector(final int row)
throws MatrixIndexException {
- return new FieldVectorImpl<T>(getRow(row), false);
+ return new ArrayFieldVector<T>(getRow(row), false);
}
/** {@inheritDoc} */
@@ -522,7 +522,7 @@
/** {@inheritDoc} */
public FieldVector<T> getColumnVector(final int column)
throws MatrixIndexException {
- return new FieldVectorImpl<T>(getColumn(column), false);
+ return new ArrayFieldVector<T>(getColumn(column), false);
}
/** {@inheritDoc} */
@@ -697,7 +697,7 @@
public FieldVector<T> operate(final FieldVector<T> v)
throws IllegalArgumentException {
try {
- return new FieldVectorImpl<T>(operate(((FieldVectorImpl<T>) v).getDataRef()), false);
+ return new ArrayFieldVector<T>(operate(((ArrayFieldVector<T>) v).getDataRef()), false);
} catch (ClassCastException cce) {
final int nRows = getRowDimension();
final int nCols = getColumnDimension();
@@ -716,7 +716,7 @@
out[row] = sum;
}
- return new FieldVectorImpl<T>(out, false);
+ return new ArrayFieldVector<T>(out, false);
}
}
@@ -749,7 +749,7 @@
public FieldVector<T> preMultiply(final FieldVector<T> v)
throws IllegalArgumentException {
try {
- return new FieldVectorImpl<T>(preMultiply(((FieldVectorImpl<T>) v).getDataRef()), false);
+ return new ArrayFieldVector<T>(preMultiply(((ArrayFieldVector<T>) v).getDataRef()), false);
} catch (ClassCastException cce) {
final int nRows = getRowDimension();
@@ -769,7 +769,7 @@
out[col] = sum;
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractRealMatrix.java?rev=783702&r1=783701&r2=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractRealMatrix.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/AbstractRealMatrix.java Thu Jun 11 08:54:02 2009
@@ -474,7 +474,7 @@
/** {@inheritDoc} */
public RealVector getRowVector(final int row)
throws MatrixIndexException {
- return new RealVectorImpl(getRow(row), false);
+ return new ArrayRealVector(getRow(row), false);
}
/** {@inheritDoc} */
@@ -497,7 +497,7 @@
/** {@inheritDoc} */
public RealVector getColumnVector(final int column)
throws MatrixIndexException {
- return new RealVectorImpl(getColumn(column), false);
+ return new ArrayRealVector(getColumn(column), false);
}
/** {@inheritDoc} */
@@ -698,7 +698,7 @@
public RealVector operate(final RealVector v)
throws IllegalArgumentException {
try {
- return new RealVectorImpl(operate(((RealVectorImpl) v).getDataRef()), false);
+ return new ArrayRealVector(operate(((ArrayRealVector) v).getDataRef()), false);
} catch (ClassCastException cce) {
final int nRows = getRowDimension();
final int nCols = getColumnDimension();
@@ -717,7 +717,7 @@
out[row] = sum;
}
- return new RealVectorImpl(out, false);
+ return new ArrayRealVector(out, false);
}
}
@@ -750,7 +750,7 @@
public RealVector preMultiply(final RealVector v)
throws IllegalArgumentException {
try {
- return new RealVectorImpl(preMultiply(((RealVectorImpl) v).getDataRef()), false);
+ return new ArrayRealVector(preMultiply(((ArrayRealVector) v).getDataRef()), false);
} catch (ClassCastException cce) {
final int nRows = getRowDimension();
@@ -770,7 +770,7 @@
out[col] = sum;
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
}
Copied: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java (from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/FieldMatrixImpl.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java?p2=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java&p1=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/FieldMatrixImpl.java&r1=783662&r2=783702&rev=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/FieldMatrixImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java Thu Jun 11 08:54:02 2009
@@ -34,7 +34,7 @@
* @param <T> the type of the field elements
* @version $Revision$ $Date$
*/
-public class FieldMatrixImpl<T extends FieldElement<T>> extends AbstractFieldMatrix<T> implements Serializable {
+public class Array2DRowFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMatrix<T> implements Serializable {
/** Serializable version identifier */
private static final long serialVersionUID = 7260756672015356458L;
@@ -46,7 +46,7 @@
* Creates a matrix with no data
* @param field field to which the elements belong
*/
- public FieldMatrixImpl(final Field<T> field) {
+ public Array2DRowFieldMatrix(final Field<T> field) {
super(field);
}
@@ -59,7 +59,7 @@
* @throws IllegalArgumentException if row or column dimension is not
* positive
*/
- public FieldMatrixImpl(final Field<T> field,
+ public Array2DRowFieldMatrix(final Field<T> field,
final int rowDimension, final int columnDimension)
throws IllegalArgumentException {
super(field, rowDimension, columnDimension);
@@ -70,16 +70,16 @@
* Create a new FieldMatrix<T> using the input array as the underlying
* data array.
* <p>The input array is copied, not referenced. This constructor has
- * the same effect as calling {@link #FieldMatrixImpl(FieldElement[][], boolean)}
+ * the same effect as calling {@link #Array2DRowFieldMatrix(FieldElement[][], boolean)}
* with the second argument set to <code>true</code>.</p>
*
* @param d data for new matrix
* @throws IllegalArgumentException if <code>d</code> is not rectangular
* (not all rows have the same length) or empty
* @throws NullPointerException if <code>d</code> is null
- * @see #FieldMatrixImpl(FieldElement[][], boolean)
+ * @see #Array2DRowFieldMatrix(FieldElement[][], boolean)
*/
- public FieldMatrixImpl(final T[][] d)
+ public Array2DRowFieldMatrix(final T[][] d)
throws IllegalArgumentException, NullPointerException {
super(extractField(d));
copyIn(d);
@@ -98,9 +98,9 @@
* @throws IllegalArgumentException if <code>d</code> is not rectangular
* (not all rows have the same length) or empty
* @throws NullPointerException if <code>d</code> is null
- * @see #FieldMatrixImpl(FieldElement[][])
+ * @see #Array2DRowFieldMatrix(FieldElement[][])
*/
- public FieldMatrixImpl(final T[][] d, final boolean copyArray)
+ public Array2DRowFieldMatrix(final T[][] d, final boolean copyArray)
throws IllegalArgumentException, NullPointerException {
super(extractField(d));
if (copyArray) {
@@ -136,7 +136,7 @@
*
* @param v column vector holding data for new matrix
*/
- public FieldMatrixImpl(final T[] v) {
+ public Array2DRowFieldMatrix(final T[] v) {
super(extractField(v));
final int nRows = v.length;
data = buildArray(getField(), nRows, 1);
@@ -149,13 +149,13 @@
@Override
public FieldMatrix<T> createMatrix(final int rowDimension, final int columnDimension)
throws IllegalArgumentException {
- return new FieldMatrixImpl<T>(getField(), rowDimension, columnDimension);
+ return new Array2DRowFieldMatrix<T>(getField(), rowDimension, columnDimension);
}
/** {@inheritDoc} */
@Override
public FieldMatrix<T> copy() {
- return new FieldMatrixImpl<T>(copyOut(), false);
+ return new Array2DRowFieldMatrix<T>(copyOut(), false);
}
/** {@inheritDoc} */
@@ -163,7 +163,7 @@
public FieldMatrix<T> add(final FieldMatrix<T> m)
throws IllegalArgumentException {
try {
- return add((FieldMatrixImpl<T>) m);
+ return add((Array2DRowFieldMatrix<T>) m);
} catch (ClassCastException cce) {
return super.add(m);
}
@@ -176,7 +176,7 @@
* @return this + m
* @throws IllegalArgumentException if m is not the same size as this
*/
- public FieldMatrixImpl<T> add(final FieldMatrixImpl<T> m)
+ public Array2DRowFieldMatrix<T> add(final Array2DRowFieldMatrix<T> m)
throws IllegalArgumentException {
// safety check
@@ -194,7 +194,7 @@
}
}
- return new FieldMatrixImpl<T>(outData, false);
+ return new Array2DRowFieldMatrix<T>(outData, false);
}
@@ -203,7 +203,7 @@
public FieldMatrix<T> subtract(final FieldMatrix<T> m)
throws IllegalArgumentException {
try {
- return subtract((FieldMatrixImpl<T>) m);
+ return subtract((Array2DRowFieldMatrix<T>) m);
} catch (ClassCastException cce) {
return super.subtract(m);
}
@@ -216,7 +216,7 @@
* @return this + m
* @throws IllegalArgumentException if m is not the same size as this
*/
- public FieldMatrixImpl<T> subtract(final FieldMatrixImpl<T> m)
+ public Array2DRowFieldMatrix<T> subtract(final Array2DRowFieldMatrix<T> m)
throws IllegalArgumentException {
// safety check
@@ -234,7 +234,7 @@
}
}
- return new FieldMatrixImpl<T>(outData, false);
+ return new Array2DRowFieldMatrix<T>(outData, false);
}
@@ -243,7 +243,7 @@
public FieldMatrix<T> multiply(final FieldMatrix<T> m)
throws IllegalArgumentException {
try {
- return multiply((FieldMatrixImpl<T>) m);
+ return multiply((Array2DRowFieldMatrix<T>) m);
} catch (ClassCastException cce) {
return super.multiply(m);
}
@@ -256,7 +256,7 @@
* @throws IllegalArgumentException
* if columnDimension(this) != rowDimension(m)
*/
- public FieldMatrixImpl<T> multiply(final FieldMatrixImpl<T> m)
+ public Array2DRowFieldMatrix<T> multiply(final Array2DRowFieldMatrix<T> m)
throws IllegalArgumentException {
// safety check
@@ -278,7 +278,7 @@
}
}
- return new FieldMatrixImpl<T>(outData, false);
+ return new Array2DRowFieldMatrix<T>(outData, false);
}
Copied: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java (from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java?p2=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java&p1=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java&r1=783662&r2=783702&rev=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java Thu Jun 11 08:54:02 2009
@@ -49,7 +49,7 @@
*
* @version $Revision$ $Date$
*/
-public class RealMatrixImpl extends AbstractRealMatrix implements Serializable {
+public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializable {
/** Serializable version identifier */
private static final long serialVersionUID = -1067294169172445528L;
@@ -60,7 +60,7 @@
/**
* Creates a matrix with no data
*/
- public RealMatrixImpl() {
+ public Array2DRowRealMatrix() {
}
/**
@@ -71,7 +71,7 @@
* @throws IllegalArgumentException if row or column dimension is not
* positive
*/
- public RealMatrixImpl(final int rowDimension, final int columnDimension)
+ public Array2DRowRealMatrix(final int rowDimension, final int columnDimension)
throws IllegalArgumentException {
super(rowDimension, columnDimension);
data = new double[rowDimension][columnDimension];
@@ -81,16 +81,16 @@
* Create a new RealMatrix using the input array as the underlying
* data array.
* <p>The input array is copied, not referenced. This constructor has
- * the same effect as calling {@link #RealMatrixImpl(double[][], boolean)}
+ * the same effect as calling {@link #Array2DRowRealMatrix(double[][], boolean)}
* with the second argument set to <code>true</code>.</p>
*
* @param d data for new matrix
* @throws IllegalArgumentException if <code>d</code> is not rectangular
* (not all rows have the same length) or empty
* @throws NullPointerException if <code>d</code> is null
- * @see #RealMatrixImpl(double[][], boolean)
+ * @see #Array2DRowRealMatrix(double[][], boolean)
*/
- public RealMatrixImpl(final double[][] d)
+ public Array2DRowRealMatrix(final double[][] d)
throws IllegalArgumentException, NullPointerException {
copyIn(d);
}
@@ -108,9 +108,9 @@
* @throws IllegalArgumentException if <code>d</code> is not rectangular
* (not all rows have the same length) or empty
* @throws NullPointerException if <code>d</code> is null
- * @see #RealMatrixImpl(double[][])
+ * @see #Array2DRowRealMatrix(double[][])
*/
- public RealMatrixImpl(final double[][] d, final boolean copyArray)
+ public Array2DRowRealMatrix(final double[][] d, final boolean copyArray)
throws IllegalArgumentException, NullPointerException {
if (copyArray) {
copyIn(d);
@@ -145,7 +145,7 @@
*
* @param v column vector holding data for new matrix
*/
- public RealMatrixImpl(final double[] v) {
+ public Array2DRowRealMatrix(final double[] v) {
final int nRows = v.length;
data = new double[nRows][1];
for (int row = 0; row < nRows; row++) {
@@ -157,13 +157,13 @@
@Override
public RealMatrix createMatrix(final int rowDimension, final int columnDimension)
throws IllegalArgumentException {
- return new RealMatrixImpl(rowDimension, columnDimension);
+ return new Array2DRowRealMatrix(rowDimension, columnDimension);
}
/** {@inheritDoc} */
@Override
public RealMatrix copy() {
- return new RealMatrixImpl(copyOut(), false);
+ return new Array2DRowRealMatrix(copyOut(), false);
}
/** {@inheritDoc} */
@@ -171,7 +171,7 @@
public RealMatrix add(final RealMatrix m)
throws IllegalArgumentException {
try {
- return add((RealMatrixImpl) m);
+ return add((Array2DRowRealMatrix) m);
} catch (ClassCastException cce) {
return super.add(m);
}
@@ -184,7 +184,7 @@
* @return this + m
* @throws IllegalArgumentException if m is not the same size as this
*/
- public RealMatrixImpl add(final RealMatrixImpl m)
+ public Array2DRowRealMatrix add(final Array2DRowRealMatrix m)
throws IllegalArgumentException {
// safety check
@@ -202,7 +202,7 @@
}
}
- return new RealMatrixImpl(outData, false);
+ return new Array2DRowRealMatrix(outData, false);
}
@@ -211,7 +211,7 @@
public RealMatrix subtract(final RealMatrix m)
throws IllegalArgumentException {
try {
- return subtract((RealMatrixImpl) m);
+ return subtract((Array2DRowRealMatrix) m);
} catch (ClassCastException cce) {
return super.subtract(m);
}
@@ -224,7 +224,7 @@
* @return this + m
* @throws IllegalArgumentException if m is not the same size as this
*/
- public RealMatrixImpl subtract(final RealMatrixImpl m)
+ public Array2DRowRealMatrix subtract(final Array2DRowRealMatrix m)
throws IllegalArgumentException {
// safety check
@@ -242,7 +242,7 @@
}
}
- return new RealMatrixImpl(outData, false);
+ return new Array2DRowRealMatrix(outData, false);
}
@@ -251,7 +251,7 @@
public RealMatrix multiply(final RealMatrix m)
throws IllegalArgumentException {
try {
- return multiply((RealMatrixImpl) m);
+ return multiply((Array2DRowRealMatrix) m);
} catch (ClassCastException cce) {
return super.multiply(m);
}
@@ -264,7 +264,7 @@
* @throws IllegalArgumentException
* if columnDimension(this) != rowDimension(m)
*/
- public RealMatrixImpl multiply(final RealMatrixImpl m)
+ public Array2DRowRealMatrix multiply(final Array2DRowRealMatrix m)
throws IllegalArgumentException {
// safety check
@@ -286,7 +286,7 @@
}
}
- return new RealMatrixImpl(outData, false);
+ return new Array2DRowRealMatrix(outData, false);
}
Copied: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/ArrayFieldVector.java (from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/FieldVectorImpl.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/ArrayFieldVector.java?p2=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/ArrayFieldVector.java&p1=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/FieldVectorImpl.java&r1=783662&r2=783702&rev=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/FieldVectorImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/ArrayFieldVector.java Thu Jun 11 08:54:02 2009
@@ -30,7 +30,7 @@
* @version $Revision$ $Date$
* @since 2.0
*/
-public class FieldVectorImpl<T extends FieldElement<T>> implements FieldVector<T>, Serializable {
+public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<T>, Serializable {
/** Serializable version identifier. */
private static final long serialVersionUID = 7648186910365927050L;
@@ -54,13 +54,13 @@
* Build a 0-length vector.
* <p>Zero-length vectors may be used to initialized construction of vectors
* by data gathering. We start with zero-length and use either the {@link
- * #FieldVectorImpl(FieldVectorImpl, FieldVectorImpl)} constructor
+ * #ArrayFieldVector(ArrayFieldVector, ArrayFieldVector)} constructor
* or one of the <code>append</code> methods ({@link #append(FieldElement[])},
- * {@link #add(FieldVector)}, {@link #append(FieldVectorImpl)}) to gather data
+ * {@link #add(FieldVector)}, {@link #append(ArrayFieldVector)}) to gather data
* into this vector.</p>
* @param field field to which the elements belong
*/
- public FieldVectorImpl(final Field<T> field) {
+ public ArrayFieldVector(final Field<T> field) {
this(field, 0);
}
@@ -69,7 +69,7 @@
* @param field field to which the elements belong
* @param size size of the vector
*/
- public FieldVectorImpl(Field<T> field, int size) {
+ public ArrayFieldVector(Field<T> field, int size) {
this.field = field;
data = buildArray(size);
Arrays.fill(data, field.getZero());
@@ -80,7 +80,7 @@
* @param size size of the vector
* @param preset fill the vector with this scalar value
*/
- public FieldVectorImpl(int size, T preset) {
+ public ArrayFieldVector(int size, T preset) {
this(preset.getField(), size);
Arrays.fill(data, preset);
}
@@ -90,7 +90,7 @@
* @param d array of Ts.
* @throws IllegalArgumentException if <code>d</code> is empty
*/
- public FieldVectorImpl(T[] d)
+ public ArrayFieldVector(T[] d)
throws IllegalArgumentException {
try {
field = d[0].getField();
@@ -102,10 +102,10 @@
}
/**
- * Create a new FieldVectorImpl using the input array as the underlying
+ * Create a new ArrayFieldVector using the input array as the underlying
* data array.
* <p>If an array is built specially in order to be embedded in a
- * FieldVectorImpl and not used directly, the <code>copyArray</code> may be
+ * ArrayFieldVector and not used directly, the <code>copyArray</code> may be
* set to <code>false</code. This will prevent the copying and improve
* performance as no new array will be built and no data will be copied.</p>
* @param d data for new vector
@@ -113,9 +113,9 @@
* it will be referenced
* @throws IllegalArgumentException if <code>d</code> is empty
* @throws NullPointerException if <code>d</code> is null
- * @see #FieldVectorImpl(FieldElement[])
+ * @see #ArrayFieldVector(FieldElement[])
*/
- public FieldVectorImpl(T[] d, boolean copyArray)
+ public ArrayFieldVector(T[] d, boolean copyArray)
throws NullPointerException, IllegalArgumentException {
try {
field = d[0].getField();
@@ -132,7 +132,7 @@
* @param pos position of first entry
* @param size number of entries to copy
*/
- public FieldVectorImpl(T[] d, int pos, int size) {
+ public ArrayFieldVector(T[] d, int pos, int size) {
if (d.length < pos + size) {
throw MathRuntimeException.createIllegalArgumentException(
"position {0} and size {1} don't fit to the size of the input array {2}",
@@ -147,7 +147,7 @@
* Construct a vector from another vector, using a deep copy.
* @param v vector to copy
*/
- public FieldVectorImpl(FieldVector<T> v) {
+ public ArrayFieldVector(FieldVector<T> v) {
field = v.getField();
data = buildArray(v.getDimension());
for (int i = 0; i < data.length; ++i) {
@@ -159,7 +159,7 @@
* Construct a vector from another vector, using a deep copy.
* @param v vector to copy
*/
- public FieldVectorImpl(FieldVectorImpl<T> v) {
+ public ArrayFieldVector(ArrayFieldVector<T> v) {
field = v.getField();
data = v.data.clone();
}
@@ -169,7 +169,7 @@
* @param v vector to copy
* @param deep if true perform a deep copy otherwise perform a shallow copy
*/
- public FieldVectorImpl(FieldVectorImpl<T> v, boolean deep) {
+ public ArrayFieldVector(ArrayFieldVector<T> v, boolean deep) {
field = v.getField();
data = deep ? v.data.clone() : v.data;
}
@@ -179,7 +179,7 @@
* @param v1 first vector (will be put in front of the new vector)
* @param v2 second vector (will be put at back of the new vector)
*/
- public FieldVectorImpl(FieldVectorImpl<T> v1, FieldVectorImpl<T> v2) {
+ public ArrayFieldVector(ArrayFieldVector<T> v1, ArrayFieldVector<T> v2) {
field = v1.getField();
data = buildArray(v1.data.length + v2.data.length);
System.arraycopy(v1.data, 0, data, 0, v1.data.length);
@@ -191,7 +191,7 @@
* @param v1 first vector (will be put in front of the new vector)
* @param v2 second vector (will be put at back of the new vector)
*/
- public FieldVectorImpl(FieldVectorImpl<T> v1, T[] v2) {
+ public ArrayFieldVector(ArrayFieldVector<T> v1, T[] v2) {
field = v1.getField();
data = buildArray(v1.data.length + v2.length);
System.arraycopy(v1.data, 0, data, 0, v1.data.length);
@@ -203,7 +203,7 @@
* @param v1 first vector (will be put in front of the new vector)
* @param v2 second vector (will be put at back of the new vector)
*/
- public FieldVectorImpl(T[] v1, FieldVectorImpl<T> v2) {
+ public ArrayFieldVector(T[] v1, ArrayFieldVector<T> v2) {
field = v2.getField();
data = buildArray(v1.length + v2.data.length);
System.arraycopy(v1, 0, data, 0, v1.length);
@@ -216,7 +216,7 @@
* @param v2 second vector (will be put at back of the new vector)
* @exception IllegalArgumentException if both vectors are empty
*/
- public FieldVectorImpl(T[] v1, T[] v2) {
+ public ArrayFieldVector(T[] v1, T[] v2) {
try {
data = buildArray(v1.length + v2.length);
System.arraycopy(v1, 0, data, 0, v1.length);
@@ -235,20 +235,20 @@
/** {@inheritDoc} */
public FieldVector<T> copy() {
- return new FieldVectorImpl<T>(this, true);
+ return new ArrayFieldVector<T>(this, true);
}
/** {@inheritDoc} */
public FieldVector<T> add(FieldVector<T> v) throws IllegalArgumentException {
try {
- return add((FieldVectorImpl<T>) v);
+ return add((ArrayFieldVector<T>) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
T[] out = buildArray(data.length);
for (int i = 0; i < data.length; i++) {
out[i] = data[i].add(v.getEntry(i));
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
}
@@ -259,7 +259,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i].add(v[i]);
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
/**
@@ -268,22 +268,22 @@
* @return this + v
* @throws IllegalArgumentException if v is not the same size as this
*/
- public FieldVectorImpl<T> add(FieldVectorImpl<T> v)
+ public ArrayFieldVector<T> add(ArrayFieldVector<T> v)
throws IllegalArgumentException {
- return (FieldVectorImpl<T>) add(v.data);
+ return (ArrayFieldVector<T>) add(v.data);
}
/** {@inheritDoc} */
public FieldVector<T> subtract(FieldVector<T> v) throws IllegalArgumentException {
try {
- return subtract((FieldVectorImpl<T>) v);
+ return subtract((ArrayFieldVector<T>) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
T[] out = buildArray(data.length);
for (int i = 0; i < data.length; i++) {
out[i] = data[i].subtract(v.getEntry(i));
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
}
@@ -294,7 +294,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i].subtract(v[i]);
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
/**
@@ -303,9 +303,9 @@
* @return this + v
* @throws IllegalArgumentException if v is not the same size as this
*/
- public FieldVectorImpl<T> subtract(FieldVectorImpl<T> v)
+ public ArrayFieldVector<T> subtract(ArrayFieldVector<T> v)
throws IllegalArgumentException {
- return (FieldVectorImpl<T>) subtract(v.data);
+ return (ArrayFieldVector<T>) subtract(v.data);
}
/** {@inheritDoc} */
@@ -314,7 +314,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i].add(d);
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
/** {@inheritDoc} */
@@ -331,7 +331,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i].subtract(d);
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
/** {@inheritDoc} */
@@ -348,7 +348,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i].multiply(d);
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
/** {@inheritDoc} */
@@ -365,7 +365,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i].divide(d);
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
/** {@inheritDoc} */
@@ -383,7 +383,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = one.divide(data[i]);
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
/** {@inheritDoc} */
@@ -399,14 +399,14 @@
public FieldVector<T> ebeMultiply(FieldVector<T> v)
throws IllegalArgumentException {
try {
- return ebeMultiply((FieldVectorImpl<T>) v);
+ return ebeMultiply((ArrayFieldVector<T>) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
T[] out = buildArray(data.length);
for (int i = 0; i < data.length; i++) {
out[i] = data[i].multiply(v.getEntry(i));
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
}
@@ -418,7 +418,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i].multiply(v[i]);
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
/**
@@ -427,23 +427,23 @@
* @return a vector containing this[i] * v[i] for all i
* @exception IllegalArgumentException if v is not the same size as this
*/
- public FieldVectorImpl<T> ebeMultiply(FieldVectorImpl<T> v)
+ public ArrayFieldVector<T> ebeMultiply(ArrayFieldVector<T> v)
throws IllegalArgumentException {
- return (FieldVectorImpl<T>) ebeMultiply(v.data);
+ return (ArrayFieldVector<T>) ebeMultiply(v.data);
}
/** {@inheritDoc} */
public FieldVector<T> ebeDivide(FieldVector<T> v)
throws IllegalArgumentException {
try {
- return ebeDivide((FieldVectorImpl<T>) v);
+ return ebeDivide((ArrayFieldVector<T>) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
T[] out = buildArray(data.length);
for (int i = 0; i < data.length; i++) {
out[i] = data[i].divide(v.getEntry(i));
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
}
@@ -455,7 +455,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i].divide(v[i]);
}
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
/**
@@ -464,9 +464,9 @@
* @return a vector containing this[i] / v[i] for all i
* @throws IllegalArgumentException if v is not the same size as this
*/
- public FieldVectorImpl<T> ebeDivide(FieldVectorImpl<T> v)
+ public ArrayFieldVector<T> ebeDivide(ArrayFieldVector<T> v)
throws IllegalArgumentException {
- return (FieldVectorImpl<T>) ebeDivide(v.data);
+ return (ArrayFieldVector<T>) ebeDivide(v.data);
}
/** {@inheritDoc} */
@@ -487,7 +487,7 @@
public T dotProduct(FieldVector<T> v)
throws IllegalArgumentException {
try {
- return dotProduct((FieldVectorImpl<T>) v);
+ return dotProduct((ArrayFieldVector<T>) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
T dot = field.getZero();
@@ -515,7 +515,7 @@
* @return the scalar dot product between instance and v
* @exception IllegalArgumentException if v is not the same size as this
*/
- public T dotProduct(FieldVectorImpl<T> v)
+ public T dotProduct(ArrayFieldVector<T> v)
throws IllegalArgumentException {
return dotProduct(v.data);
}
@@ -527,7 +527,7 @@
/** {@inheritDoc} */
public FieldVector<T> projection(T[] v) {
- return projection(new FieldVectorImpl<T>(v, false));
+ return projection(new ArrayFieldVector<T>(v, false));
}
/** Find the orthogonal projection of this vector onto another vector.
@@ -535,19 +535,19 @@
* @return projection of the instance onto v
* @throws IllegalArgumentException if v is not the same size as this
*/
- public FieldVectorImpl<T> projection(FieldVectorImpl<T> v) {
- return (FieldVectorImpl<T>) v.mapMultiply(dotProduct(v).divide(v.dotProduct(v)));
+ public ArrayFieldVector<T> projection(ArrayFieldVector<T> v) {
+ return (ArrayFieldVector<T>) v.mapMultiply(dotProduct(v).divide(v.dotProduct(v)));
}
/** {@inheritDoc} */
public FieldMatrix<T> outerProduct(FieldVector<T> v)
throws IllegalArgumentException {
try {
- return outerProduct((FieldVectorImpl<T>) v);
+ return outerProduct((ArrayFieldVector<T>) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
final int m = data.length;
- final FieldMatrix<T> out = new FieldMatrixImpl<T>(field, m, m);
+ final FieldMatrix<T> out = new Array2DRowFieldMatrix<T>(field, m, m);
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data.length; j++) {
out.setEntry(i, j, data[i].multiply(v.getEntry(j)));
@@ -563,7 +563,7 @@
* @return the square matrix outer product between instance and v
* @exception IllegalArgumentException if v is not the same size as this
*/
- public FieldMatrix<T> outerProduct(FieldVectorImpl<T> v)
+ public FieldMatrix<T> outerProduct(ArrayFieldVector<T> v)
throws IllegalArgumentException {
return outerProduct(v.data);
}
@@ -573,7 +573,7 @@
throws IllegalArgumentException {
checkVectorDimensions(v.length);
final int m = data.length;
- final FieldMatrix<T> out = new FieldMatrixImpl<T>(field, m, m);
+ final FieldMatrix<T> out = new Array2DRowFieldMatrix<T>(field, m, m);
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data.length; j++) {
out.setEntry(i, j, data[i].multiply(v[j]));
@@ -595,9 +595,9 @@
/** {@inheritDoc} */
public FieldVector<T> append(FieldVector<T> v) {
try {
- return append((FieldVectorImpl<T>) v);
+ return append((ArrayFieldVector<T>) v);
} catch (ClassCastException cce) {
- return new FieldVectorImpl<T>(this,new FieldVectorImpl<T>(v));
+ return new ArrayFieldVector<T>(this,new ArrayFieldVector<T>(v));
}
}
@@ -606,8 +606,8 @@
* @param v vector to append to this one.
* @return a new vector
*/
- public FieldVectorImpl<T> append(FieldVectorImpl<T> v) {
- return new FieldVectorImpl<T>(this, v);
+ public ArrayFieldVector<T> append(ArrayFieldVector<T> v) {
+ return new ArrayFieldVector<T>(this, v);
}
/** {@inheritDoc} */
@@ -615,17 +615,17 @@
final T[] out = buildArray(data.length + 1);
System.arraycopy(data, 0, out, 0, data.length);
out[data.length] = in;
- return new FieldVectorImpl<T>(out);
+ return new ArrayFieldVector<T>(out);
}
/** {@inheritDoc} */
public FieldVector<T> append(T[] in) {
- return new FieldVectorImpl<T>(this, in);
+ return new ArrayFieldVector<T>(this, in);
}
/** {@inheritDoc} */
public FieldVector<T> getSubVector(int index, int n) {
- FieldVectorImpl<T> out = new FieldVectorImpl<T>(field, n);
+ ArrayFieldVector<T> out = new ArrayFieldVector<T>(field, n);
try {
System.arraycopy(data, index, out.data, 0, n);
} catch (IndexOutOfBoundsException e) {
@@ -648,7 +648,7 @@
public void setSubVector(int index, FieldVector<T> v) {
try {
try {
- set(index, (FieldVectorImpl<T>) v);
+ set(index, (ArrayFieldVector<T>) v);
} catch (ClassCastException cce) {
for (int i = index; i < index + v.getDimension(); ++i) {
data[i] = v.getEntry(i-index);
@@ -678,7 +678,7 @@
* @exception MatrixIndexException if the index is
* inconsistent with vector size
*/
- public void set(int index, FieldVectorImpl<T> v)
+ public void set(int index, ArrayFieldVector<T> v)
throws MatrixIndexException {
setSubVector(index, v.data);
}
Copied: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/ArrayRealVector.java (from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorImpl.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/ArrayRealVector.java?p2=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/ArrayRealVector.java&p1=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorImpl.java&r1=783662&r2=783702&rev=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealVectorImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/ArrayRealVector.java Thu Jun 11 08:54:02 2009
@@ -27,7 +27,7 @@
* @version $Revision$ $Date$
* @since 2.0
*/
-public class RealVectorImpl implements RealVector, Serializable {
+public class ArrayRealVector implements RealVector, Serializable {
/** Serializable version identifier. */
private static final long serialVersionUID = -1097961340710804027L;
@@ -43,12 +43,12 @@
* Build a 0-length vector.
* <p>Zero-length vectors may be used to initialized construction of vectors
* by data gathering. We start with zero-length and use either the {@link
- * #RealVectorImpl(RealVectorImpl, RealVectorImpl)} constructor
+ * #ArrayRealVector(ArrayRealVector, ArrayRealVector)} constructor
* or one of the <code>append</code> method ({@link #append(double)}, {@link
- * #append(double[])}, {@link #append(RealVectorImpl)}) to gather data
+ * #append(double[])}, {@link #append(ArrayRealVector)}) to gather data
* into this vector.</p>
*/
- public RealVectorImpl() {
+ public ArrayRealVector() {
data = new double[0];
}
@@ -56,7 +56,7 @@
* Construct a (size)-length vector of zeros.
* @param size size of the vector
*/
- public RealVectorImpl(int size) {
+ public ArrayRealVector(int size) {
data = new double[size];
}
@@ -65,7 +65,7 @@
* @param size size of the vector
* @param preset fill the vector with this scalar value
*/
- public RealVectorImpl(int size, double preset) {
+ public ArrayRealVector(int size, double preset) {
data = new double[size];
Arrays.fill(data, preset);
}
@@ -74,15 +74,15 @@
* Construct a vector from an array, copying the input array.
* @param d array of doubles.
*/
- public RealVectorImpl(double[] d) {
+ public ArrayRealVector(double[] d) {
data = d.clone();
}
/**
- * Create a new RealVectorImpl using the input array as the underlying
+ * Create a new ArrayRealVector using the input array as the underlying
* data array.
* <p>If an array is built specially in order to be embedded in a
- * RealVectorImpl and not used directly, the <code>copyArray</code> may be
+ * ArrayRealVector and not used directly, the <code>copyArray</code> may be
* set to <code>false</code. This will prevent the copying and improve
* performance as no new array will be built and no data will be copied.</p>
* @param d data for new vector
@@ -90,9 +90,9 @@
* it will be referenced
* @throws IllegalArgumentException if <code>d</code> is empty
* @throws NullPointerException if <code>d</code> is null
- * @see #RealVectorImpl(double[])
+ * @see #ArrayRealVector(double[])
*/
- public RealVectorImpl(double[] d, boolean copyArray)
+ public ArrayRealVector(double[] d, boolean copyArray)
throws NullPointerException, IllegalArgumentException {
if (d == null) {
throw new NullPointerException();
@@ -109,7 +109,7 @@
* @param pos position of first entry
* @param size number of entries to copy
*/
- public RealVectorImpl(double[] d, int pos, int size) {
+ public ArrayRealVector(double[] d, int pos, int size) {
if (d.length < pos + size) {
throw MathRuntimeException.createIllegalArgumentException(
"position {0} and size {1} don't fit to the size of the input array {2}",
@@ -123,7 +123,7 @@
* Construct a vector from an array.
* @param d array of Doubles.
*/
- public RealVectorImpl(Double[] d) {
+ public ArrayRealVector(Double[] d) {
data = new double[d.length];
for (int i = 0; i < d.length; i++) {
data[i] = d[i].doubleValue();
@@ -136,7 +136,7 @@
* @param pos position of first entry
* @param size number of entries to copy
*/
- public RealVectorImpl(Double[] d, int pos, int size) {
+ public ArrayRealVector(Double[] d, int pos, int size) {
if (d.length < pos + size) {
throw MathRuntimeException.createIllegalArgumentException(
"position {0} and size {1} don't fit to the size of the input array {2}",
@@ -152,7 +152,7 @@
* Construct a vector from another vector, using a deep copy.
* @param v vector to copy
*/
- public RealVectorImpl(RealVector v) {
+ public ArrayRealVector(RealVector v) {
data = new double[v.getDimension()];
for (int i = 0; i < data.length; ++i) {
data[i] = v.getEntry(i);
@@ -163,7 +163,7 @@
* Construct a vector from another vector, using a deep copy.
* @param v vector to copy
*/
- public RealVectorImpl(RealVectorImpl v) {
+ public ArrayRealVector(ArrayRealVector v) {
data = v.data.clone();
}
@@ -172,7 +172,7 @@
* @param v vector to copy
* @param deep if true perform a deep copy otherwise perform a shallow copy
*/
- public RealVectorImpl(RealVectorImpl v, boolean deep) {
+ public ArrayRealVector(ArrayRealVector v, boolean deep) {
data = deep ? v.data.clone() : v.data;
}
@@ -181,7 +181,7 @@
* @param v1 first vector (will be put in front of the new vector)
* @param v2 second vector (will be put at back of the new vector)
*/
- public RealVectorImpl(RealVectorImpl v1, RealVectorImpl v2) {
+ public ArrayRealVector(ArrayRealVector v1, ArrayRealVector v2) {
data = new double[v1.data.length + v2.data.length];
System.arraycopy(v1.data, 0, data, 0, v1.data.length);
System.arraycopy(v2.data, 0, data, v1.data.length, v2.data.length);
@@ -192,7 +192,7 @@
* @param v1 first vector (will be put in front of the new vector)
* @param v2 second vector (will be put at back of the new vector)
*/
- public RealVectorImpl(RealVectorImpl v1, double[] v2) {
+ public ArrayRealVector(ArrayRealVector v1, double[] v2) {
data = new double[v1.data.length + v2.length];
System.arraycopy(v1.data, 0, data, 0, v1.data.length);
System.arraycopy(v2, 0, data, v1.data.length, v2.length);
@@ -203,7 +203,7 @@
* @param v1 first vector (will be put in front of the new vector)
* @param v2 second vector (will be put at back of the new vector)
*/
- public RealVectorImpl(double[] v1, RealVectorImpl v2) {
+ public ArrayRealVector(double[] v1, ArrayRealVector v2) {
data = new double[v1.length + v2.data.length];
System.arraycopy(v1, 0, data, 0, v1.length);
System.arraycopy(v2.data, 0, data, v1.length, v2.data.length);
@@ -214,7 +214,7 @@
* @param v1 first vector (will be put in front of the new vector)
* @param v2 second vector (will be put at back of the new vector)
*/
- public RealVectorImpl(double[] v1, double[] v2) {
+ public ArrayRealVector(double[] v1, double[] v2) {
data = new double[v1.length + v2.length];
System.arraycopy(v1, 0, data, 0, v1.length);
System.arraycopy(v2, 0, data, v1.length, v2.length);
@@ -222,21 +222,21 @@
/** {@inheritDoc} */
public RealVector copy() {
- return new RealVectorImpl(this, true);
+ return new ArrayRealVector(this, true);
}
/** {@inheritDoc} */
public RealVector add(RealVector v)
throws IllegalArgumentException {
try {
- return add((RealVectorImpl) v);
+ return add((ArrayRealVector) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
double[] out = new double[data.length];
for (int i = 0; i < data.length; i++) {
out[i] = data[i] + v.getEntry(i);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
}
@@ -248,7 +248,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i] + v[i];
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/**
@@ -257,23 +257,23 @@
* @return this + v
* @throws IllegalArgumentException if v is not the same size as this
*/
- public RealVectorImpl add(RealVectorImpl v)
+ public ArrayRealVector add(ArrayRealVector v)
throws IllegalArgumentException {
- return (RealVectorImpl) add(v.data);
+ return (ArrayRealVector) add(v.data);
}
/** {@inheritDoc} */
public RealVector subtract(RealVector v)
throws IllegalArgumentException {
try {
- return subtract((RealVectorImpl) v);
+ return subtract((ArrayRealVector) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
double[] out = new double[data.length];
for (int i = 0; i < data.length; i++) {
out[i] = data[i] - v.getEntry(i);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
}
@@ -285,7 +285,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i] - v[i];
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/**
@@ -294,9 +294,9 @@
* @return this + v
* @throws IllegalArgumentException if v is not the same size as this
*/
- public RealVectorImpl subtract(RealVectorImpl v)
+ public ArrayRealVector subtract(ArrayRealVector v)
throws IllegalArgumentException {
- return (RealVectorImpl) subtract(v.data);
+ return (ArrayRealVector) subtract(v.data);
}
/** {@inheritDoc} */
@@ -305,7 +305,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i] + d;
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -322,7 +322,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i] - d;
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -339,7 +339,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i] * d;
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -356,7 +356,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i] / d;
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -373,7 +373,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.pow(data[i], d);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -390,7 +390,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.exp(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -407,7 +407,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.expm1(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -424,7 +424,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.log(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -441,7 +441,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.log10(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -458,7 +458,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.log1p(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -475,7 +475,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.cosh(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -492,7 +492,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.sinh(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -509,7 +509,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.tanh(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -526,7 +526,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.cos(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -543,7 +543,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.sin(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -560,7 +560,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.tan(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -577,7 +577,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.acos(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -594,7 +594,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.asin(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -611,7 +611,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.atan(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -628,7 +628,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = 1.0 / data[i];
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -645,7 +645,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.abs(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -662,7 +662,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.sqrt(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -679,7 +679,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.cbrt(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -696,7 +696,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.ceil(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -713,7 +713,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.floor(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -730,7 +730,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.rint(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -747,7 +747,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.signum(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -764,7 +764,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = Math.ulp(data[i]);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
@@ -779,14 +779,14 @@
public RealVector ebeMultiply(RealVector v)
throws IllegalArgumentException {
try {
- return ebeMultiply((RealVectorImpl) v);
+ return ebeMultiply((ArrayRealVector) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
double[] out = new double[data.length];
for (int i = 0; i < data.length; i++) {
out[i] = data[i] * v.getEntry(i);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
}
@@ -798,7 +798,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i] * v[i];
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/**
@@ -807,23 +807,23 @@
* @return a vector containing this[i] * v[i] for all i
* @exception IllegalArgumentException if v is not the same size as this
*/
- public RealVectorImpl ebeMultiply(RealVectorImpl v)
+ public ArrayRealVector ebeMultiply(ArrayRealVector v)
throws IllegalArgumentException {
- return (RealVectorImpl) ebeMultiply(v.data);
+ return (ArrayRealVector) ebeMultiply(v.data);
}
/** {@inheritDoc} */
public RealVector ebeDivide(RealVector v)
throws IllegalArgumentException {
try {
- return ebeDivide((RealVectorImpl) v);
+ return ebeDivide((ArrayRealVector) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
double[] out = new double[data.length];
for (int i = 0; i < data.length; i++) {
out[i] = data[i] / v.getEntry(i);
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
}
@@ -835,7 +835,7 @@
for (int i = 0; i < data.length; i++) {
out[i] = data[i] / v[i];
}
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/**
@@ -844,9 +844,9 @@
* @return a vector containing this[i] / v[i] for all i
* @throws IllegalArgumentException if v is not the same size as this
*/
- public RealVectorImpl ebeDivide(RealVectorImpl v)
+ public ArrayRealVector ebeDivide(ArrayRealVector v)
throws IllegalArgumentException {
- return (RealVectorImpl) ebeDivide(v.data);
+ return (ArrayRealVector) ebeDivide(v.data);
}
/** {@inheritDoc} */
@@ -867,7 +867,7 @@
public double dotProduct(RealVector v)
throws IllegalArgumentException {
try {
- return dotProduct((RealVectorImpl) v);
+ return dotProduct((ArrayRealVector) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
double dot = 0;
@@ -895,7 +895,7 @@
* @return the scalar dot product between instance and v
* @exception IllegalArgumentException if v is not the same size as this
*/
- public double dotProduct(RealVectorImpl v)
+ public double dotProduct(ArrayRealVector v)
throws IllegalArgumentException {
return dotProduct(v.data);
}
@@ -931,7 +931,7 @@
public double getDistance(RealVector v)
throws IllegalArgumentException {
try {
- return getDistance((RealVectorImpl) v);
+ return getDistance((ArrayRealVector) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
double sum = 0;
@@ -964,11 +964,11 @@
* @return distance between two vectors.
* @exception IllegalArgumentException if v is not the same size as this
* @see #getDistance(RealVector)
- * @see #getL1Distance(RealVectorImpl)
- * @see #getLInfDistance(RealVectorImpl)
+ * @see #getL1Distance(ArrayRealVector)
+ * @see #getLInfDistance(ArrayRealVector)
* @see #getNorm()
*/
- public double getDistance(RealVectorImpl v)
+ public double getDistance(ArrayRealVector v)
throws IllegalArgumentException {
return getDistance(v.data);
}
@@ -977,7 +977,7 @@
public double getL1Distance(RealVector v)
throws IllegalArgumentException {
try {
- return getL1Distance((RealVectorImpl) v);
+ return getL1Distance((ArrayRealVector) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
double sum = 0;
@@ -1010,11 +1010,11 @@
* @return distance between two vectors.
* @exception IllegalArgumentException if v is not the same size as this
* @see #getDistance(RealVector)
- * @see #getL1Distance(RealVectorImpl)
- * @see #getLInfDistance(RealVectorImpl)
+ * @see #getL1Distance(ArrayRealVector)
+ * @see #getLInfDistance(ArrayRealVector)
* @see #getNorm()
*/
- public double getL1Distance(RealVectorImpl v)
+ public double getL1Distance(ArrayRealVector v)
throws IllegalArgumentException {
return getL1Distance(v.data);
}
@@ -1023,7 +1023,7 @@
public double getLInfDistance(RealVector v)
throws IllegalArgumentException {
try {
- return getLInfDistance((RealVectorImpl) v);
+ return getLInfDistance((ArrayRealVector) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
double max = 0;
@@ -1056,11 +1056,11 @@
* @return distance between two vectors.
* @exception IllegalArgumentException if v is not the same size as this
* @see #getDistance(RealVector)
- * @see #getL1Distance(RealVectorImpl)
- * @see #getLInfDistance(RealVectorImpl)
+ * @see #getL1Distance(ArrayRealVector)
+ * @see #getLInfDistance(ArrayRealVector)
* @see #getNorm()
*/
- public double getLInfDistance(RealVectorImpl v)
+ public double getLInfDistance(ArrayRealVector v)
throws IllegalArgumentException {
return getLInfDistance(v.data);
}
@@ -1092,7 +1092,7 @@
/** {@inheritDoc} */
public RealVector projection(double[] v) {
- return projection(new RealVectorImpl(v, false));
+ return projection(new ArrayRealVector(v, false));
}
/** Find the orthogonal projection of this vector onto another vector.
@@ -1100,15 +1100,15 @@
* @return projection of the instance onto v
* @throws IllegalArgumentException if v is not the same size as this
*/
- public RealVectorImpl projection(RealVectorImpl v) {
- return (RealVectorImpl) v.mapMultiply(dotProduct(v) / v.dotProduct(v));
+ public ArrayRealVector projection(ArrayRealVector v) {
+ return (ArrayRealVector) v.mapMultiply(dotProduct(v) / v.dotProduct(v));
}
/** {@inheritDoc} */
public RealMatrix outerProduct(RealVector v)
throws IllegalArgumentException {
try {
- return outerProduct((RealVectorImpl) v);
+ return outerProduct((ArrayRealVector) v);
} catch (ClassCastException cce) {
checkVectorDimensions(v);
final int m = data.length;
@@ -1128,7 +1128,7 @@
* @return the square matrix outer product between instance and v
* @exception IllegalArgumentException if v is not the same size as this
*/
- public RealMatrix outerProduct(RealVectorImpl v)
+ public RealMatrix outerProduct(ArrayRealVector v)
throws IllegalArgumentException {
return outerProduct(v.data);
}
@@ -1160,9 +1160,9 @@
/** {@inheritDoc} */
public RealVector append(RealVector v) {
try {
- return append((RealVectorImpl) v);
+ return append((ArrayRealVector) v);
} catch (ClassCastException cce) {
- return new RealVectorImpl(this,new RealVectorImpl(v));
+ return new ArrayRealVector(this,new ArrayRealVector(v));
}
}
@@ -1171,8 +1171,8 @@
* @param v vector to append to this one.
* @return a new vector
*/
- public RealVectorImpl append(RealVectorImpl v) {
- return new RealVectorImpl(this, v);
+ public ArrayRealVector append(ArrayRealVector v) {
+ return new ArrayRealVector(this, v);
}
/** {@inheritDoc} */
@@ -1180,17 +1180,17 @@
final double[] out = new double[data.length + 1];
System.arraycopy(data, 0, out, 0, data.length);
out[data.length] = in;
- return new RealVectorImpl(out);
+ return new ArrayRealVector(out);
}
/** {@inheritDoc} */
public RealVector append(double[] in) {
- return new RealVectorImpl(this, in);
+ return new ArrayRealVector(this, in);
}
/** {@inheritDoc} */
public RealVector getSubVector(int index, int n) {
- RealVectorImpl out = new RealVectorImpl(n);
+ ArrayRealVector out = new ArrayRealVector(n);
try {
System.arraycopy(data, index, out.data, 0, n);
} catch (IndexOutOfBoundsException e) {
@@ -1213,7 +1213,7 @@
public void setSubVector(int index, RealVector v) {
try {
try {
- set(index, (RealVectorImpl) v);
+ set(index, (ArrayRealVector) v);
} catch (ClassCastException cce) {
for (int i = index; i < index + v.getDimension(); ++i) {
data[i] = v.getEntry(i-index);
@@ -1243,7 +1243,7 @@
* @exception MatrixIndexException if the index is
* inconsistent with vector size
*/
- public void set(int index, RealVectorImpl v)
+ public void set(int index, ArrayRealVector v)
throws MatrixIndexException {
setSubVector(index, v.data);
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java?rev=783702&r1=783701&r2=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java Thu Jun 11 08:54:02 2009
@@ -47,7 +47,7 @@
* is 0-based -- e.g., <code>getEntry(0, 0)</code>
* returns the element in the first row, first column of the matrix.</li></ul></p>
*
- * @deprecated as of 2.0, replaced by {@link FieldMatrixImpl} with a {@link
+ * @deprecated as of 2.0, replaced by {@link Array2DRowFieldMatrix} with a {@link
* org.apache.commons.math.util.BigReal} parameter
* @version $Revision$ $Date$
*/
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockFieldMatrix.java?rev=783702&r1=783701&r2=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockFieldMatrix.java Thu Jun 11 08:54:02 2009
@@ -1030,7 +1030,7 @@
outIndex += jWidth;
}
- return new FieldVectorImpl<T>(outData, false);
+ return new ArrayFieldVector<T>(outData, false);
}
@@ -1039,7 +1039,7 @@
public void setRowVector(final int row, final FieldVector<T> vector)
throws MatrixIndexException, InvalidMatrixException {
try {
- setRow(row, ((FieldVectorImpl<T>) vector).getDataRef());
+ setRow(row, ((ArrayFieldVector<T>) vector).getDataRef());
} catch (ClassCastException cce) {
super.setRowVector(row, vector);
}
@@ -1066,7 +1066,7 @@
}
}
- return new FieldVectorImpl<T>(outData, false);
+ return new ArrayFieldVector<T>(outData, false);
}
@@ -1075,7 +1075,7 @@
public void setColumnVector(final int column, final FieldVector<T> vector)
throws MatrixIndexException, InvalidMatrixException {
try {
- setColumn(column, ((FieldVectorImpl<T>) vector).getDataRef());
+ setColumn(column, ((ArrayFieldVector<T>) vector).getDataRef());
} catch (ClassCastException cce) {
super.setColumnVector(column, vector);
}
Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockRealMatrix.java?rev=783702&r1=783701&r2=783702&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockRealMatrix.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockRealMatrix.java Thu Jun 11 08:54:02 2009
@@ -1053,7 +1053,7 @@
outIndex += jWidth;
}
- return new RealVectorImpl(outData, false);
+ return new ArrayRealVector(outData, false);
}
@@ -1062,7 +1062,7 @@
public void setRowVector(final int row, final RealVector vector)
throws MatrixIndexException, InvalidMatrixException {
try {
- setRow(row, ((RealVectorImpl) vector).getDataRef());
+ setRow(row, ((ArrayRealVector) vector).getDataRef());
} catch (ClassCastException cce) {
super.setRowVector(row, vector);
}
@@ -1089,7 +1089,7 @@
}
}
- return new RealVectorImpl(outData, false);
+ return new ArrayRealVector(outData, false);
}
@@ -1098,7 +1098,7 @@
public void setColumnVector(final int column, final RealVector vector)
throws MatrixIndexException, InvalidMatrixException {
try {
- setColumn(column, ((RealVectorImpl) vector).getDataRef());
+ setColumn(column, ((ArrayRealVector) vector).getDataRef());
} catch (ClassCastException cce) {
super.setColumnVector(column, vector);
}