This is an automated email from the ASF dual-hosted git repository.

baunsgaard 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 d770ff6  [MINOR] Fix License
d770ff6 is described below

commit d770ff63142dd11e8e24130fa64fa8bdd8f17a2a
Author: baunsgaard <[email protected]>
AuthorDate: Tue Jan 25 22:28:06 2022 +0100

    [MINOR] Fix License
    
    Fixing license in new DeltaDict test and file, and add license skip
    for perf-benchmark temp folder.
---
 pom.xml                                            |   1 +
 .../colgroup/dictionary/DeltaDictionary.java       |  70 +++++---
 .../compress/dictionary/DeltaDictionaryTest.java   | 180 +++++++++++----------
 3 files changed, 145 insertions(+), 106 deletions(-)

diff --git a/pom.xml b/pom.xml
index 51f38c2..bd80829 100644
--- a/pom.xml
+++ b/pom.xml
@@ -576,6 +576,7 @@
                                                <configuration>
                                                        <excludes>
                                                                
<exclude>scripts/perftest/results/**</exclude>
+                                                               
<exclude>scripts/perftest/temp/**</exclude>
                                                                
<exclude>.gitignore</exclude>
                                                                
<exclude>src/main/python/.gitignore</exclude>
                                                                
<exclude>.gitmodules</exclude>
diff --git 
a/src/main/java/org/apache/sysds/runtime/compress/colgroup/dictionary/DeltaDictionary.java
 
b/src/main/java/org/apache/sysds/runtime/compress/colgroup/dictionary/DeltaDictionary.java
index 9942d7e..eb0af85 100644
--- 
a/src/main/java/org/apache/sysds/runtime/compress/colgroup/dictionary/DeltaDictionary.java
+++ 
b/src/main/java/org/apache/sysds/runtime/compress/colgroup/dictionary/DeltaDictionary.java
@@ -1,10 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package org.apache.sysds.runtime.compress.colgroup.dictionary;
 
 import org.apache.commons.lang.NotImplementedException;
 import org.apache.sysds.runtime.functionobjects.Divide;
+import org.apache.sysds.runtime.functionobjects.Minus;
 import org.apache.sysds.runtime.functionobjects.Multiply;
 import org.apache.sysds.runtime.functionobjects.Plus;
-import org.apache.sysds.runtime.functionobjects.Minus;
 import org.apache.sysds.runtime.matrix.operators.ScalarOperator;
 
 /**
@@ -13,31 +32,32 @@ import 
org.apache.sysds.runtime.matrix.operators.ScalarOperator;
  */
 public class DeltaDictionary extends Dictionary {
 
-    private final int _numCols;
+       private final int _numCols;
 
-    public DeltaDictionary(double[] values, int numCols) {
-        super(values);
-        _numCols = numCols;
-    }
+       public DeltaDictionary(double[] values, int numCols) {
+               super(values);
+               _numCols = numCols;
+       }
 
-    @Override
-    public DeltaDictionary applyScalarOp(ScalarOperator op) {
-        final double[] retV = new double[_values.length];
-        if (op.fn instanceof Multiply || op.fn instanceof Divide) {
-            for(int i = 0; i < _values.length; i++)
-                retV[i] = op.executeScalar(_values[i]);
-        }
-        else if (op.fn instanceof Plus || op.fn instanceof Minus) {
-            // With Plus and Minus only the first row needs to be updated when 
delta encoded
-            for(int i = 0; i < _values.length; i++) {
-                if (i < _numCols)
-                    retV[i] = op.executeScalar(_values[i]);
-                else
-                    retV[i] = _values[i];
-            }
-        } else
-            throw new NotImplementedException();
+       @Override
+       public DeltaDictionary applyScalarOp(ScalarOperator op) {
+               final double[] retV = new double[_values.length];
+               if(op.fn instanceof Multiply || op.fn instanceof Divide) {
+                       for(int i = 0; i < _values.length; i++)
+                               retV[i] = op.executeScalar(_values[i]);
+               }
+               else if(op.fn instanceof Plus || op.fn instanceof Minus) {
+                       // With Plus and Minus only the first row needs to be 
updated when delta encoded
+                       for(int i = 0; i < _values.length; i++) {
+                               if(i < _numCols)
+                                       retV[i] = op.executeScalar(_values[i]);
+                               else
+                                       retV[i] = _values[i];
+                       }
+               }
+               else
+                       throw new NotImplementedException();
 
-        return new DeltaDictionary(retV, _numCols);
-    }
+               return new DeltaDictionary(retV, _numCols);
+       }
 }
diff --git 
a/src/test/java/org/apache/sysds/test/component/compress/dictionary/DeltaDictionaryTest.java
 
b/src/test/java/org/apache/sysds/test/component/compress/dictionary/DeltaDictionaryTest.java
index 69fc14b..e94f0b9 100644
--- 
a/src/test/java/org/apache/sysds/test/component/compress/dictionary/DeltaDictionaryTest.java
+++ 
b/src/test/java/org/apache/sysds/test/component/compress/dictionary/DeltaDictionaryTest.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.sysds.test.component.compress.dictionary;
 
 import org.apache.sysds.runtime.compress.colgroup.dictionary.DeltaDictionary;
@@ -13,93 +31,93 @@ import org.junit.Test;
 
 public class DeltaDictionaryTest {
 
-    @Test
-    public void testScalarOpRightMultiplySingleColumn() {
-        double scalar = 2;
-        DeltaDictionary d = new DeltaDictionary(new double[] {1, 2}, 1);
-        ScalarOperator sop = new 
RightScalarOperator(Multiply.getMultiplyFnObject(), scalar, 1);
-        d = d.applyScalarOp(sop);
-        double[] expected = new double[] {2, 4};
-        Assert.assertArrayEquals(expected, d.getValues(), 0.01);
-    }
+       @Test
+       public void testScalarOpRightMultiplySingleColumn() {
+               double scalar = 2;
+               DeltaDictionary d = new DeltaDictionary(new double[] {1, 2}, 1);
+               ScalarOperator sop = new 
RightScalarOperator(Multiply.getMultiplyFnObject(), scalar, 1);
+               d = d.applyScalarOp(sop);
+               double[] expected = new double[] {2, 4};
+               Assert.assertArrayEquals(expected, d.getValues(), 0.01);
+       }
 
-    @Test
-    public void testScalarOpRightMultiplyTwoColumns() {
-        double scalar = 2;
-        DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 4}, 2);
-        ScalarOperator sop = new 
RightScalarOperator(Multiply.getMultiplyFnObject(), scalar, 1);
-        d = d.applyScalarOp(sop);
-        double[] expected = new double[] {2, 4, 6, 8};
-        Assert.assertArrayEquals(expected, d.getValues(), 0.01);
-    }
+       @Test
+       public void testScalarOpRightMultiplyTwoColumns() {
+               double scalar = 2;
+               DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 
4}, 2);
+               ScalarOperator sop = new 
RightScalarOperator(Multiply.getMultiplyFnObject(), scalar, 1);
+               d = d.applyScalarOp(sop);
+               double[] expected = new double[] {2, 4, 6, 8};
+               Assert.assertArrayEquals(expected, d.getValues(), 0.01);
+       }
 
-    @Test
-    public void testNegScalarOpRightMultiplyTwoColumns() {
-        double scalar = -2;
-        DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 4}, 2);
-        ScalarOperator sop = new 
RightScalarOperator(Multiply.getMultiplyFnObject(), scalar, 1);
-        d = d.applyScalarOp(sop);
-        double[] expected = new double[] {-2, -4, -6, -8};
-        Assert.assertArrayEquals(expected, d.getValues(), 0.01);
-    }
+       @Test
+       public void testNegScalarOpRightMultiplyTwoColumns() {
+               double scalar = -2;
+               DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 
4}, 2);
+               ScalarOperator sop = new 
RightScalarOperator(Multiply.getMultiplyFnObject(), scalar, 1);
+               d = d.applyScalarOp(sop);
+               double[] expected = new double[] {-2, -4, -6, -8};
+               Assert.assertArrayEquals(expected, d.getValues(), 0.01);
+       }
 
-    @Test
-    public void testScalarOpLeftMultiplyTwoColumns() {
-        double scalar = 2;
-        DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 4}, 2);
-        ScalarOperator sop = new 
LeftScalarOperator(Multiply.getMultiplyFnObject(), scalar, 1);
-        d = d.applyScalarOp(sop);
-        double[] expected = new double[] {2, 4, 6, 8};
-        Assert.assertArrayEquals(expected, d.getValues(), 0.01);
-    }
+       @Test
+       public void testScalarOpLeftMultiplyTwoColumns() {
+               double scalar = 2;
+               DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 
4}, 2);
+               ScalarOperator sop = new 
LeftScalarOperator(Multiply.getMultiplyFnObject(), scalar, 1);
+               d = d.applyScalarOp(sop);
+               double[] expected = new double[] {2, 4, 6, 8};
+               Assert.assertArrayEquals(expected, d.getValues(), 0.01);
+       }
 
-    @Test
-    public void testScalarOpRightDivideTwoColumns() {
-        double scalar = 0.5;
-        DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 4}, 2);
-        ScalarOperator sop = new 
RightScalarOperator(Divide.getDivideFnObject(), scalar, 1);
-        d = d.applyScalarOp(sop);
-        double[] expected = new double[] {2, 4, 6, 8};
-        Assert.assertArrayEquals(expected, d.getValues(), 0.01);
-    }
+       @Test
+       public void testScalarOpRightDivideTwoColumns() {
+               double scalar = 0.5;
+               DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 
4}, 2);
+               ScalarOperator sop = new 
RightScalarOperator(Divide.getDivideFnObject(), scalar, 1);
+               d = d.applyScalarOp(sop);
+               double[] expected = new double[] {2, 4, 6, 8};
+               Assert.assertArrayEquals(expected, d.getValues(), 0.01);
+       }
 
-    @Test
-    public void testScalarOpRightPlusSingleColumn() {
-        double scalar = 2;
-        DeltaDictionary d = new DeltaDictionary(new double[] {1, 2}, 1);
-        ScalarOperator sop = new RightScalarOperator(Plus.getPlusFnObject(), 
scalar, 1);
-        d = d.applyScalarOp(sop);
-        double[] expected = new double[] {3, 2};
-        Assert.assertArrayEquals(expected, d.getValues(), 0.01);
-    }
+       @Test
+       public void testScalarOpRightPlusSingleColumn() {
+               double scalar = 2;
+               DeltaDictionary d = new DeltaDictionary(new double[] {1, 2}, 1);
+               ScalarOperator sop = new 
RightScalarOperator(Plus.getPlusFnObject(), scalar, 1);
+               d = d.applyScalarOp(sop);
+               double[] expected = new double[] {3, 2};
+               Assert.assertArrayEquals(expected, d.getValues(), 0.01);
+       }
 
-    @Test
-    public void testScalarOpRightPlusTwoColumns() {
-        double scalar = 2;
-        DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 4}, 2);
-        ScalarOperator sop = new RightScalarOperator(Plus.getPlusFnObject(), 
scalar, 1);
-        d = d.applyScalarOp(sop);
-        double[] expected = new double[] {3, 4, 3, 4};
-        Assert.assertArrayEquals(expected, d.getValues(), 0.01);
-    }
+       @Test
+       public void testScalarOpRightPlusTwoColumns() {
+               double scalar = 2;
+               DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 
4}, 2);
+               ScalarOperator sop = new 
RightScalarOperator(Plus.getPlusFnObject(), scalar, 1);
+               d = d.applyScalarOp(sop);
+               double[] expected = new double[] {3, 4, 3, 4};
+               Assert.assertArrayEquals(expected, d.getValues(), 0.01);
+       }
 
-    @Test
-    public void testScalarOpRightMinusTwoColumns() {
-        double scalar = 2;
-        DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 4}, 2);
-        ScalarOperator sop = new RightScalarOperator(Minus.getMinusFnObject(), 
scalar, 1);
-        d = d.applyScalarOp(sop);
-        double[] expected = new double[] {-1, 0, 3, 4};
-        Assert.assertArrayEquals(expected, d.getValues(), 0.01);
-    }
+       @Test
+       public void testScalarOpRightMinusTwoColumns() {
+               double scalar = 2;
+               DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 
4}, 2);
+               ScalarOperator sop = new 
RightScalarOperator(Minus.getMinusFnObject(), scalar, 1);
+               d = d.applyScalarOp(sop);
+               double[] expected = new double[] {-1, 0, 3, 4};
+               Assert.assertArrayEquals(expected, d.getValues(), 0.01);
+       }
 
-    @Test
-    public void testScalarOpLeftPlusTwoColumns() {
-        double scalar = 2;
-        DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 4}, 2);
-        ScalarOperator sop = new LeftScalarOperator(Plus.getPlusFnObject(), 
scalar, 1);
-        d = d.applyScalarOp(sop);
-        double[] expected = new double[] {3, 4, 3, 4};
-        Assert.assertArrayEquals(expected, d.getValues(), 0.01);
-    }
+       @Test
+       public void testScalarOpLeftPlusTwoColumns() {
+               double scalar = 2;
+               DeltaDictionary d = new DeltaDictionary(new double[] {1, 2, 3, 
4}, 2);
+               ScalarOperator sop = new 
LeftScalarOperator(Plus.getPlusFnObject(), scalar, 1);
+               d = d.applyScalarOp(sop);
+               double[] expected = new double[] {3, 4, 3, 4};
+               Assert.assertArrayEquals(expected, d.getValues(), 0.01);
+       }
 }

Reply via email to