From 8e14f3716935eb4cfb9e622c6227b80ac180cb88 Mon Sep 17 00:00:00 2001 From: Thomas Neidhart Date: Wed, 13 Mar 2013 22:02:07 +0000 Subject: [PATCH] Fix Clirr error wrt return type of DiagonalMatrix#copy. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1456179 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/commons/math3/linear/DiagonalMatrix.java | 2 +- .../org/apache/commons/math3/linear/DiagonalMatrixTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java b/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java index 237fa2665..b8dccbb2f 100644 --- a/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java +++ b/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java @@ -103,7 +103,7 @@ public class DiagonalMatrix extends AbstractRealMatrix /** {@inheritDoc} */ @Override - public DiagonalMatrix copy() { + public RealMatrix copy() { return new DiagonalMatrix(data); } diff --git a/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java b/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java index 097b5d3f8..3379dbf5e 100644 --- a/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java +++ b/src/test/java/org/apache/commons/math3/linear/DiagonalMatrixTest.java @@ -97,7 +97,7 @@ public class DiagonalMatrixTest { public void testCopy() { final double[] d = { -1.2, 3.4, 5 }; final DiagonalMatrix m = new DiagonalMatrix(d, false); - final DiagonalMatrix p = m.copy(); + final DiagonalMatrix p = (DiagonalMatrix) m.copy(); for (int i = 0; i < m.getRowDimension(); ++i) { Assert.assertEquals(m.getEntry(i, i), p.getEntry(i, i), 1.0e-20); }