Skip to content
Snippets Groups Projects
Commit 4136a0e6 authored by Lukas Stadler's avatar Lukas Stadler
Browse files

[GR-9978] Fix bug in La_chol (incorrect pivot attribute in return).

PullRequest: fastr/1652
parents d2afe6ff b2504227
No related branches found
No related tags found
No related merge requests found
...@@ -593,7 +593,7 @@ public class LaFunctions { ...@@ -593,7 +593,7 @@ public class LaFunctions {
} }
RDoubleVector result = (RDoubleVector) copyAttributesNode.execute(RDataFactory.createDoubleVector(aData, RDataFactory.INCOMPLETE_VECTOR), aIn); RDoubleVector result = (RDoubleVector) copyAttributesNode.execute(RDataFactory.createDoubleVector(aData, RDataFactory.INCOMPLETE_VECTOR), aIn);
setPivotAttrNode.execute(result, RRuntime.asLogical(piv)); setPivotAttrNode.execute(result, RDataFactory.createIntVector(ipiv, false));
setRankAttrNode.execute(result, rank[0]); setRankAttrNode.execute(result, rank[0]);
RList dn = getDimNamesNode.getDimNames(aIn); RList dn = getDimNamesNode.getDimNames(aIn);
if (dn != null && dn.getDataAt(0) != null) { if (dn != null && dn.getDataAt(0) != null) {
......
...@@ -15467,6 +15467,16 @@ Error in chartr(c("abq"), "cd", c("agbc", "efb")) : ...@@ -15467,6 +15467,16 @@ Error in chartr(c("abq"), "cd", c("agbc", "efb")) :
Error in chartr(c(3, 2), c("q", "c"), c("abc", "efb")) : Error in chartr(c(3, 2), c("q", "c"), c("abc", "efb")) :
invalid 'old' argument invalid 'old' argument
   
##com.oracle.truffle.r.test.builtins.TestBuiltin_chol.testChol#
#chol(matrix(c(4,2,2,3), ncol=2), pivot=TRUE)
[,1] [,2]
[1,] 2 1.000000
[2,] 0 1.414214
attr(,"pivot")
[1] 1 2
attr(,"rank")
[1] 2
##com.oracle.truffle.r.test.builtins.TestBuiltin_chol.testChol# ##com.oracle.truffle.r.test.builtins.TestBuiltin_chol.testChol#
#{ chol(1) } #{ chol(1) }
[,1] [,1]
...@@ -44,5 +44,6 @@ public class TestBuiltin_chol extends TestBase { ...@@ -44,5 +44,6 @@ public class TestBuiltin_chol extends TestBase {
// the leading minor of order 2 is not positive definite // the leading minor of order 2 is not positive definite
// FastR output: Error in chol.default(m) : error code 2 from Lapack routine 'dpotrf' // FastR output: Error in chol.default(m) : error code 2 from Lapack routine 'dpotrf'
assertEval(Output.IgnoreErrorMessage, "{ m <- matrix(c(5,-5,-5,3),2,2) ; chol(m) }"); assertEval(Output.IgnoreErrorMessage, "{ m <- matrix(c(5,-5,-5,3),2,2) ; chol(m) }");
assertEval("chol(matrix(c(4,2,2,3), ncol=2), pivot=TRUE)");
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment