Author: erans
Date: Tue Jan 1 01:41:09 2013
New Revision: 1427276
URL: http://svn.apache.org/viewvc?rev=1427276&view=rev
Log:
MATH-925
Added "final" keyword.
Removed degenerate case (matrix with no data).
Used constructor chaining.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java?rev=1427276&r1=1427275&r2=1427276&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java
Tue Jan 1 01:41:09 2013
@@ -36,12 +36,7 @@ public class DiagonalMatrix extends Abst
/** Serializable version identifier. */
private static final long serialVersionUID = 20121229L;
/** Entries of the diagonal. */
- private double[] data;
-
- /**
- * Creates a matrix with no data.
- */
- public DiagonalMatrix() {}
+ private final double[] data;
/**
* Creates a matrix with the supplied dimension.
@@ -64,16 +59,17 @@ public class DiagonalMatrix extends Abst
* @param d Data for the new matrix.
*/
public DiagonalMatrix(final double[] d) {
- data = d.clone();
+ this(d, true);
}
/**
* Creates a matrix using the input array as the underlying data.
* <br/>
- * If an array is built specially in order to be embedded in a
- * RealMatrix and not used directly, the {@code copyArray} may be
- * set to {@code false}. This will prevent the copying and improve
- * performance as no new array will be built and no data will be copied.
+ * If an array is created specially in order to be embedded in a
+ * this instance and not used directly, the {@code copyArray} may be
+ * set to {@code false}.
+ * This will prevent the copying and improve performance as no new
+ * array will be built and no data will be copied.
*
* @param d Data for new matrix.
* @param copyArray if {@code true}, the input array will be copied,