Repository: mahout Updated Branches: refs/heads/mahout-0.10.x 2f4a51b46 -> 1efca59f3
MAHOUT-1696: QRDecomposition.solve(...) can return incorrect Matrix types Project: http://git-wip-us.apache.org/repos/asf/mahout/repo Commit: http://git-wip-us.apache.org/repos/asf/mahout/commit/1efca59f Tree: http://git-wip-us.apache.org/repos/asf/mahout/tree/1efca59f Diff: http://git-wip-us.apache.org/repos/asf/mahout/diff/1efca59f Branch: refs/heads/mahout-0.10.x Commit: 1efca59f3ebbbad0ffd631e5e70a086b3285cd93 Parents: 2f4a51b Author: Andrew Palumbo <[email protected]> Authored: Fri Apr 24 19:39:41 2015 -0400 Committer: Andrew Palumbo <[email protected]> Committed: Fri Apr 24 19:39:41 2015 -0400 ---------------------------------------------------------------------- math/src/main/java/org/apache/mahout/math/QRDecomposition.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mahout/blob/1efca59f/math/src/main/java/org/apache/mahout/math/QRDecomposition.java ---------------------------------------------------------------------- diff --git a/math/src/main/java/org/apache/mahout/math/QRDecomposition.java b/math/src/main/java/org/apache/mahout/math/QRDecomposition.java index 5a3d918..db7f8d6 100644 --- a/math/src/main/java/org/apache/mahout/math/QRDecomposition.java +++ b/math/src/main/java/org/apache/mahout/math/QRDecomposition.java @@ -42,6 +42,7 @@ import java.util.Locale; public class QRDecomposition implements QR { private final Matrix q; private final Matrix r; + private final Matrix mType; private final boolean fullRank; private final int rows; private final int columns; @@ -59,6 +60,7 @@ public class QRDecomposition implements QR { rows = a.rowSize(); int min = Math.min(a.rowSize(), a.columnSize()); columns = a.columnSize(); + mType = a.like(1,1); Matrix qTmp = a.clone(); @@ -147,7 +149,7 @@ public class QRDecomposition implements QR { } int cols = B.numCols(); - Matrix x = B.like(columns, cols); + Matrix x = mType.like(columns, cols); // this can all be done a bit more efficiently if we don't actually // form explicit versions of Q^T and R but this code isn't so bad
