This is an automated email from the ASF dual-hosted git repository.
mboehm7 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git
The following commit(s) were added to refs/heads/main by this push:
new e3d64f041d [MINOR] Fix corrupted LibSVM writer (data access methods)
e3d64f041d is described below
commit e3d64f041dc7682df7d1bb71c96d93776a82feda
Author: Matthias Boehm <[email protected]>
AuthorDate: Thu Apr 18 22:54:14 2024 +0200
[MINOR] Fix corrupted LibSVM writer (data access methods)
---
.../org/apache/sysds/runtime/io/WriterTextLIBSVM.java | 2 +-
.../test/functions/io/libsvm/WriteLIBSVMTest.java | 18 ++++++++++++------
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/sysds/runtime/io/WriterTextLIBSVM.java
b/src/main/java/org/apache/sysds/runtime/io/WriterTextLIBSVM.java
index 6fd3a5940e..125217a2a0 100644
--- a/src/main/java/org/apache/sysds/runtime/io/WriterTextLIBSVM.java
+++ b/src/main/java/org/apache/sysds/runtime/io/WriterTextLIBSVM.java
@@ -132,7 +132,7 @@ public class WriterTextLIBSVM extends MatrixWriter {
// append dense row
for( int j=0; j<clen-1; j++ ) {
- double val = d!=null ? d.get(i,
clen-1) : 0;
+ double val = d!=null ? d.get(i,
j) : 0;
if( val != 0 ) {
sb.append(_props.getDelim());
appendIndexValLibsvm(sb, j, val);
diff --git
a/src/test/java/org/apache/sysds/test/functions/io/libsvm/WriteLIBSVMTest.java
b/src/test/java/org/apache/sysds/test/functions/io/libsvm/WriteLIBSVMTest.java
index eb9955b7b5..3d7ab9fb69 100644
---
a/src/test/java/org/apache/sysds/test/functions/io/libsvm/WriteLIBSVMTest.java
+++
b/src/test/java/org/apache/sysds/test/functions/io/libsvm/WriteLIBSVMTest.java
@@ -38,27 +38,33 @@ public abstract class WriteLIBSVMTest extends
WriteLIBSVMTestBase {
private final static double eps = 1e-9;
- @Test public void testlibsvm1_Seq_CP() {
+ @Test
+ public void testlibsvm1_Seq_CP() {
runWriteLIBSVMTest(getId(), ExecMode.SINGLE_NODE, false,
getLIBSVMConfig(), false);
}
- @Test public void testlibsvm2_Seq_CP() {
+ @Test
+ public void testlibsvm2_Seq_CP() {
runWriteLIBSVMTest(getId(), ExecMode.SINGLE_NODE, false,
getLIBSVMConfig(), true);
}
- @Test public void testlibsvm1_Pllel_CP() {
+ @Test
+ public void testlibsvm1_Pllel_CP() {
runWriteLIBSVMTest(getId(), ExecMode.SINGLE_NODE, true,
getLIBSVMConfig(), true);
}
- @Test public void testlibsvm2_Pllel_CP() {
+ @Test
+ public void testlibsvm2_Pllel_CP() {
runWriteLIBSVMTest(getId(), ExecMode.SINGLE_NODE, true,
getLIBSVMConfig(), false);
}
- @Test public void testlibsvm1_SP() {
+ @Test
+ public void testlibsvm1_SP() {
runWriteLIBSVMTest(getId(), ExecMode.SPARK, false,
getLIBSVMConfig(), true);
}
- @Test public void testlibsvm2_SP() {
+ @Test
+ public void testlibsvm2_SP() {
runWriteLIBSVMTest(getId(), ExecMode.SPARK, false,
getLIBSVMConfig(), false);
}