Repository: incubator-systemml
Updated Branches:
  refs/heads/master 22c5049f8 -> 7491a680b


[SYSTEMML-1441] New codegen vector primitives for row comparisons

Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/70e5aa19
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/70e5aa19
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/70e5aa19

Branch: refs/heads/master
Commit: 70e5aa19cdead982fdeb9ed5c00c6d758db11e5c
Parents: 22c5049
Author: Matthias Boehm <mboe...@gmail.com>
Authored: Tue Mar 28 17:29:24 2017 -0700
Committer: Matthias Boehm <mboe...@gmail.com>
Committed: Tue Mar 28 22:29:52 2017 -0700

----------------------------------------------------------------------
 .../sysml/hops/codegen/cplan/CNodeBinary.java   |  90 ++++--
 .../hops/codegen/template/TemplateRowAgg.java   |  23 +-
 .../runtime/codegen/LibSpoofPrimitives.java     | 300 ++++++++++---------
 .../codegen/RowVectorComparisonTest.java        | 179 +++++++++++
 .../scripts/functions/codegen/rowComparisonEq.R |  29 ++
 .../functions/codegen/rowComparisonEq.dml       |  25 ++
 .../scripts/functions/codegen/rowComparisonGt.R |  29 ++
 .../functions/codegen/rowComparisonGt.dml       |  25 ++
 .../functions/codegen/rowComparisonGte.R        |  29 ++
 .../functions/codegen/rowComparisonGte.dml      |  25 ++
 .../scripts/functions/codegen/rowComparisonLt.R |  29 ++
 .../functions/codegen/rowComparisonLt.dml       |  25 ++
 .../functions/codegen/rowComparisonLte.R        |  29 ++
 .../functions/codegen/rowComparisonLte.dml      |  25 ++
 .../functions/codegen/rowComparisonNeq.R        |  29 ++
 .../functions/codegen/rowComparisonNeq.dml      |  25 ++
 .../functions/codegen/ZPackageSuite.java        |   1 +
 17 files changed, 747 insertions(+), 170 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/main/java/org/apache/sysml/hops/codegen/cplan/CNodeBinary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/hops/codegen/cplan/CNodeBinary.java 
b/src/main/java/org/apache/sysml/hops/codegen/cplan/CNodeBinary.java
index 9da9915..36b0354 100644
--- a/src/main/java/org/apache/sysml/hops/codegen/cplan/CNodeBinary.java
+++ b/src/main/java/org/apache/sysml/hops/codegen/cplan/CNodeBinary.java
@@ -21,6 +21,7 @@ package org.apache.sysml.hops.codegen.cplan;
 
 import java.util.Arrays;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.sysml.parser.Expression.DataType;
 
 
@@ -28,8 +29,10 @@ public class CNodeBinary extends CNode
 {
        public enum BinType {
                DOT_PRODUCT,
-               VECT_MULT_ADD, VECT_DIV_ADD,
-               VECT_MULT_SCALAR, VECT_DIV_SCALAR, 
+               VECT_MULT_ADD, VECT_DIV_ADD, VECT_EQUAL_ADD, VECT_NOTEQUAL_ADD, 
+               VECT_LESS_ADD, VECT_LESSEQUAL_ADD, VECT_GREATER_ADD, 
VECT_GREATEREQUAL_ADD,
+               VECT_MULT_SCALAR, VECT_DIV_SCALAR, VECT_EQUAL_SCALAR, 
VECT_NOTEQUAL_SCALAR, 
+               VECT_LESS_SCALAR, VECT_LESSEQUAL_SCALAR, VECT_GREATER_SCALAR, 
VECT_GREATEREQUAL_SCALAR,
                MULT, DIV, PLUS, MINUS, MODULUS, INTDIV, 
                LESS, LESSEQUAL, GREATER, GREATEREQUAL, EQUAL,NOTEQUAL,
                MIN, MAX, AND, OR, LOG, POW,
@@ -53,23 +56,31 @@ public class CNodeBinary extends CNode
                                case DOT_PRODUCT:   
                                        return sparse ? "    double %TMP% = 
LibSpoofPrimitives.dotProduct(%IN1v%, %IN2%, %IN1i%, %POS1%, %POS2%, %LEN%);\n" 
:
                                                                        "    
double %TMP% = LibSpoofPrimitives.dotProduct(%IN1%, %IN2%, %POS1%, %POS2%, 
%LEN%);\n";
-                       
-                               case VECT_MULT_ADD: 
-                                       return sparse ? "    
LibSpoofPrimitives.vectMultiplyAdd(%IN1%, %IN2v%, %OUT%, %IN2i%, %POS2%, 
%POSOUT%, %LEN%);\n" : 
-                                                                       "    
LibSpoofPrimitives.vectMultiplyAdd(%IN1%, %IN2%, %OUT%, %POS2%, %POSOUT%, 
%LEN%);\n";
-                               
-                               case VECT_DIV_ADD: 
-                                       return sparse ? "    
LibSpoofPrimitives.vectDivAdd(%IN1v%, %IN2%, %OUT%, %IN1i%, %POS1%, %POSOUT%, 
%LEN%);\n" : 
-                                                                       "    
LibSpoofPrimitives.vectDivAdd(%IN1%, %IN2%, %OUT%, %POS1%, %POSOUT%, %LEN%);\n";
-                               
-                               case VECT_DIV_SCALAR: 
-                                       return sparse ? "    
LibSpoofPrimitives.vectDivWrite(%IN1v%, %IN1i%, %IN2%,  %OUT%, %POS1%, 
%POSOUT%, %LEN%);\n" : 
-                                                                       "    
LibSpoofPrimitives.vectDivWrite(%IN1%, %IN2%, %OUT%, %POS1%, %POSOUT%, 
%LEN%);\n";
-                               
-                               case VECT_MULT_SCALAR: 
-                                       return "    
LibSpoofPrimitives.vectMultiplyWrite(%IN2%, %IN1%, %POS1%, %OUT%, 0, %LEN%);\n";
-                                                       
-                               
+                                       
+                               case VECT_MULT_ADD:
+                               case VECT_DIV_ADD:
+                               case VECT_EQUAL_ADD:
+                               case VECT_NOTEQUAL_ADD:
+                               case VECT_LESS_ADD:
+                               case VECT_LESSEQUAL_ADD:
+                               case VECT_GREATER_ADD:
+                               case VECT_GREATEREQUAL_ADD: {
+                                       String vectName = 
getVectorPrimitiveName();
+                                       return sparse ? "    
LibSpoofPrimitives.vect"+vectName+"Add(%IN1%, %IN2v%, %OUT%, %IN2i%, %POS2%, 
%POSOUT%, %LEN%);\n" : 
+                                                                       "    
LibSpoofPrimitives.vect"+vectName+"Add(%IN1%, %IN2%, %OUT%, %POS2%, %POSOUT%, 
%LEN%);\n";
+                               }
+                               case VECT_DIV_SCALAR:
+                               case VECT_MULT_SCALAR:
+                               case VECT_EQUAL_SCALAR:
+                               case VECT_NOTEQUAL_SCALAR:
+                               case VECT_LESS_SCALAR:
+                               case VECT_LESSEQUAL_SCALAR:
+                               case VECT_GREATER_SCALAR:
+                               case VECT_GREATEREQUAL_SCALAR: {
+                                       String vectName = 
getVectorPrimitiveName();
+                                       return sparse ? "    
LibSpoofPrimitives.vect"+vectName+"Write(%IN1v%, %IN1i%, %IN2%,  %OUT%, %POS1%, 
%POSOUT%, %LEN%);\n" : 
+                                                                       "    
LibSpoofPrimitives.vect"+vectName+"Write(%IN1%, %IN2%, %OUT%, %POS1%, %POSOUT%, 
%LEN%);\n";
+                               }
                                /*Can be replaced by function objects*/
                                case MULT:
                                        return "    double %TMP% = %IN1% * 
%IN2%;\n" ;
@@ -112,6 +123,19 @@ public class CNodeBinary extends CNode
                                        throw new RuntimeException("Invalid 
binary type: "+this.toString());
                        }
                }
+               public boolean isVectorScalarPrimitive() {
+                       return this == VECT_DIV_SCALAR || this == 
VECT_MULT_SCALAR
+                               || this == VECT_EQUAL_SCALAR || this == 
VECT_NOTEQUAL_SCALAR
+                               || this == VECT_LESS_SCALAR || this == 
VECT_LESSEQUAL_SCALAR
+                               || this == VECT_GREATER_SCALAR || this == 
VECT_GREATEREQUAL_SCALAR;
+               }
+               public BinType getVectorAddPrimitive() {
+                       return 
BinType.valueOf("VECT_"+getVectorPrimitiveName().toUpperCase()+"_ADD");
+               }
+               public String getVectorPrimitiveName() {
+                       String [] tmp = this.name().split("_");
+                       return StringUtils.capitalize(tmp[1].toLowerCase());
+               }
        }
        
        private final BinType _type;
@@ -179,6 +203,20 @@ public class CNodeBinary extends CNode
                        case DOT_PRODUCT: return "b(dot)";
                        case VECT_MULT_ADD: return "b(vma)";
                        case VECT_DIV_ADD: return "b(vda)";
+                       case VECT_EQUAL_ADD: return "b(veqa)";
+                       case VECT_NOTEQUAL_ADD: return "b(vneqa)";
+                       case VECT_LESS_ADD: return "b(vlta)";
+                       case VECT_LESSEQUAL_ADD: return "b(vltea)";
+                       case VECT_GREATEREQUAL_ADD: return "b(vgtea)";
+                       case VECT_GREATER_ADD: return "b(vgta)";
+                       case VECT_MULT_SCALAR:  return "b(vm)";
+                       case VECT_DIV_SCALAR:  return "b(vd)";
+                       case VECT_EQUAL_SCALAR: return "b(veq)";
+                       case VECT_NOTEQUAL_SCALAR: return "b(vneq)";
+                       case VECT_LESS_SCALAR: return "b(vlt)";
+                       case VECT_LESSEQUAL_SCALAR: return "b(vlte)";
+                       case VECT_GREATEREQUAL_SCALAR: return "b(vgte)";
+                       case VECT_GREATER_SCALAR: return "b(vgt)";
                        case MULT: return "b(*)";
                        case DIV: return "b(/)";
                        case PLUS: return "b(+)";
@@ -192,8 +230,6 @@ public class CNodeBinary extends CNode
                        case EQUAL: return "b(==)";
                        case NOTEQUAL: return "b(!=)";
                        case MINUS1_MULT: return "b(1-*)";
-                       case VECT_DIV_SCALAR:  return "b(vector/)";
-                       case VECT_MULT_SCALAR:  return "b(vector*)";
                        default: return "b("+_type.name()+")";
                }
        }
@@ -205,6 +241,12 @@ public class CNodeBinary extends CNode
                        //VECT
                        case VECT_MULT_ADD: 
                        case VECT_DIV_ADD:
+                       case VECT_EQUAL_ADD: 
+                       case VECT_NOTEQUAL_ADD: 
+                       case VECT_LESS_ADD: 
+                       case VECT_LESSEQUAL_ADD: 
+                       case VECT_GREATER_ADD: 
+                       case VECT_GREATEREQUAL_ADD:
                                _rows = _inputs.get(1)._rows;
                                _cols = _inputs.get(1)._cols;
                                _dataType= DataType.MATRIX;
@@ -212,6 +254,12 @@ public class CNodeBinary extends CNode
                                
                        case VECT_DIV_SCALAR:   
                        case VECT_MULT_SCALAR:
+                       case VECT_EQUAL_SCALAR: 
+                       case VECT_NOTEQUAL_SCALAR: 
+                       case VECT_LESS_SCALAR: 
+                       case VECT_LESSEQUAL_SCALAR: 
+                       case VECT_GREATER_SCALAR: 
+                       case VECT_GREATEREQUAL_SCALAR:
                                _rows = _inputs.get(0)._rows;
                                _cols = _inputs.get(0)._cols;
                                _dataType= DataType.MATRIX;

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/main/java/org/apache/sysml/hops/codegen/template/TemplateRowAgg.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/hops/codegen/template/TemplateRowAgg.java 
b/src/main/java/org/apache/sysml/hops/codegen/template/TemplateRowAgg.java
index 61c73d3..31c0f79 100644
--- a/src/main/java/org/apache/sysml/hops/codegen/template/TemplateRowAgg.java
+++ b/src/main/java/org/apache/sysml/hops/codegen/template/TemplateRowAgg.java
@@ -51,8 +51,11 @@ import org.apache.sysml.hops.Hop.OpOp2;
 import org.apache.sysml.parser.Expression.DataType;
 import org.apache.sysml.runtime.matrix.data.Pair;
 
-public class TemplateRowAgg extends TemplateBase {
-
+public class TemplateRowAgg extends TemplateBase 
+{
+       private static final Hop.OpOp2[] SUPPORTED_VECT_BINARY = new 
OpOp2[]{OpOp2.MULT, OpOp2.DIV, 
+                       OpOp2.EQUAL, OpOp2.NOTEQUAL, OpOp2.LESS, 
OpOp2.LESSEQUAL, OpOp2.GREATER, OpOp2.GREATEREQUAL};
+       
        public TemplateRowAgg() {
                super(TemplateType.RowAggTpl);
        }
@@ -149,9 +152,10 @@ public class TemplateRowAgg extends TemplateBase {
                                }
                        }
                        else  if (((AggUnaryOp)hop).getDirection() == 
Direction.Col && ((AggUnaryOp)hop).getOp() == AggOp.SUM ) {
-                               //vector div add without temporary copy
-                               if(cdata1 instanceof CNodeBinary && 
((CNodeBinary)cdata1).getType()==BinType.VECT_DIV_SCALAR)
-                                       out = new 
CNodeBinary(cdata1.getInput().get(0), cdata1.getInput().get(1), 
BinType.VECT_DIV_ADD);
+                               //vector add without temporary copy
+                               if( cdata1 instanceof CNodeBinary && 
((CNodeBinary)cdata1).getType().isVectorScalarPrimitive() )
+                                       out = new 
CNodeBinary(cdata1.getInput().get(0), cdata1.getInput().get(1), 
+                                                       
((CNodeBinary)cdata1).getType().getVectorAddPrimitive());
                                else    
                                        out = cdata1;
                        }
@@ -200,8 +204,13 @@ public class TemplateRowAgg extends TemplateBase {
                        // if one input is a matrix then we need to do vector 
by scalar operations
                        if(hop.getInput().get(0).getDim1() > 1 && 
hop.getInput().get(0).getDim2() > 1 )
                        {
-                               if (((BinaryOp)hop).getOp()== OpOp2.DIV)
-                                       out = new CNodeBinary(cdata1, cdata2, 
BinType.VECT_DIV_SCALAR);
+                               if( HopRewriteUtils.isBinary(hop, 
SUPPORTED_VECT_BINARY) ) {
+                                       String opname = 
"VECT_"+((BinaryOp)hop).getOp().name()+"_SCALAR";
+                                       out = new CNodeBinary(cdata2, cdata1, 
BinType.valueOf(opname));
+                               }
+                               else 
+                                       throw new RuntimeException("Unsupported 
binary matrix "
+                                                       + "operation: " + 
((BinaryOp)hop).getOp().name());
                        }
                        else //one input is a vector/scalar other is a scalar
                        {

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/main/java/org/apache/sysml/runtime/codegen/LibSpoofPrimitives.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/runtime/codegen/LibSpoofPrimitives.java 
b/src/main/java/org/apache/sysml/runtime/codegen/LibSpoofPrimitives.java
index c73456d..9b83006 100644
--- a/src/main/java/org/apache/sysml/runtime/codegen/LibSpoofPrimitives.java
+++ b/src/main/java/org/apache/sysml/runtime/codegen/LibSpoofPrimitives.java
@@ -32,27 +32,31 @@ public class LibSpoofPrimitives
 {
        // forwarded calls to LibMatrixMult
        
-       public static double dotProduct( double[] a, double[] b, int ai, int 
bi, final int len ) {
+       public static double dotProduct(double[] a, double[] b, int ai, int bi, 
int len) {
                return LibMatrixMult.dotProduct(a, b, ai, bi, len);
        }
        
-       public static double dotProduct( double[] a, double[] b, int[] aix, int 
ai, final int bi, final int len ) {
+       public static double dotProduct(double[] a, double[] b, int[] aix, int 
ai, int bi, int len) {
                return LibMatrixMult.dotProduct(a, b, aix, ai, bi, len);
        }
        
-       public static void vectMultiplyAdd( final double aval, double[] b, 
double[] c, int bi, int ci, final int len ) {
+       public static void vectMultAdd(double aval, double[] b, double[] c, int 
bi, int ci, int len) {
                LibMatrixMult.vectMultiplyAdd(aval, b, c, bi, ci, len);
        }
        
-       public static void vectMultiplyAdd( final double aval, double[] b, 
double[] c, int[] bix, final int bi, final int ci, final int len ) {
+       public static void vectMultAdd(double aval, double[] b, double[] c, 
int[] bix, int bi, int ci, int len) {
                LibMatrixMult.vectMultiplyAdd(aval, b, c, bix, bi, ci, len);
        }
        
-       public static void vectMultiplyWrite( final double aval, double[] b, 
double[] c, int bi, int ci, final int len ) {
+       public static void vectMultWrite(double aval, double[] b, double[] c, 
int bi, int ci, int len) {
                LibMatrixMult.vectMultiplyWrite(aval, b, c, bi, ci, len);
        }
+       
+       public static void vectMultWrite(double aval, double[] b, double[] c, 
int[] bix, int bi, int ci, int len) {
+               LibMatrixMult.vectMultiplyAdd(aval, b, c, bix, bi, ci, len);
+       }
 
-       // custom methods
+       // custom vector sums
        
        /**
         * Computes c = sum(A), where A is a dense vectors. 
@@ -62,7 +66,7 @@ public class LibSpoofPrimitives
         * @param len number of processed elements
         * @return sum value
         */
-       public static double vectSum( double[] a, int ai, final int len ) { 
+       public static double vectSum(double[] a, int ai, int len) { 
                double val = 0;
                final int bn = len%8;
                                
@@ -90,7 +94,7 @@ public class LibSpoofPrimitives
         * @param len number of processed elements
         * @return sum value
         */
-       public static double vectSum( double[] avals, int[] aix, int ai, int 
len) {
+       public static double vectSum(double[] avals, int[] aix, int ai, int 
len) {
                double val = 0;
                final int bn = len%8;
                                
@@ -113,145 +117,157 @@ public class LibSpoofPrimitives
                return val; 
        } 
        
-       /**
-        * Computes C += A / b, where C and A are dense vectors and b is a 
scalar. 
-        * 
-        * @param a dense input vector A
-        * @param bval input scalar b 
-        * @param c dense input-output vector C
-        * @param ai start position in A
-        * @param ci start position in C
-        * @param len number of processed elements.
-        */
-       public static void vectDivAdd( double[] a, final double bval, double[] 
c, int ai, int ci, final int len )
-       {
-               final int bn = len%8;
-               
-               //rest, not aligned to 8-blocks
-               for( int j = 0; j < bn; j++, ai++, ci++)
-                       c[ ci ] +=  a[ ai ] / bval;
-               
-               //unrolled 8-block  (for better instruction-level parallelism)
-               for( int j = bn; j < len; j+=8, ai+=8, ci+=8) 
-               {
-                       //read 64B cachelines of b and c
-                       //compute c' = aval * b + c
-                       //write back 64B cacheline of c = c'
-                       c[ ci+0 ] += a[ ai+0 ] / bval;
-                       c[ ci+1 ] += a[ ai+1 ] / bval;
-                       c[ ci+2 ] += a[ ai+2 ] / bval;
-                       c[ ci+3 ] += a[ ai+3 ] / bval;
-                       c[ ci+4 ] += a[ ai+4 ] / bval;
-                       c[ ci+5 ] += a[ ai+5 ] / bval;
-                       c[ ci+6 ] += a[ ai+6 ] / bval;
-                       c[ ci+7 ] += a[ ai+7 ] / bval;
-               }
+       //custom vector div
+       
+       public static void vectDivAdd(double bval, double[] a, double[] c, int 
ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] +=  a[j] / bval;
        } 
+
+       public static void vectDivAdd(double bval, double[] a, double[] c, 
int[] aix, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] += a[j] / bval;
+       }
        
-       /**
-        * Computes C += A / b, where C is a dense vector, A is a sparse 
vector, and b is a scalar. 
-        * 
-        * @param a sparse input vector A values
-        * @param bval input scalar b 
-        * @param c dense input-output vector C
-        * @param aix sparse input vector A column indexes
-        * @param ai start position in A
-        * @param ci start position in C
-        * @param len number of processed elements.
-        */
-       public static void vectDivAdd( double[] a, final double bval, double[] 
c, int[] aix, final int ai, final int ci, final int len )
-       {
-               final int bn = len%8;
-               
-               //rest, not aligned to 8-blocks
-               for( int j = ai; j < ai+bn; j++ )
-                       c[ ci + aix[j] ] += a[ j ] / bval;
-               
-               //unrolled 8-block (for better instruction-level parallelism)
-               for( int j = ai+bn; j < ai+len; j+=8 )
-               {
-                       //read 64B cacheline of b
-                       //read 64B of c via 'gather'
-                       //compute c' = aval * b + c
-                       //write back 64B of c = c' via 'scatter'
-                       c[ ci+aix[j+0] ] += a[ j+0 ] / bval;
-                       c[ ci+aix[j+1] ] += a[ j+1 ] / bval;
-                       c[ ci+aix[j+2] ] += a[ j+2 ] / bval;
-                       c[ ci+aix[j+3] ] += a[ j+3 ] / bval;
-                       c[ ci+aix[j+4] ] += a[ j+4 ] / bval;
-                       c[ ci+aix[j+5] ] += a[ j+5 ] / bval;
-                       c[ ci+aix[j+6] ] += a[ j+6 ] / bval;
-                       c[ ci+aix[j+7] ] += a[ j+7 ] / bval;
-               }
+       public static void vectDivWrite(double bval, double[] a, double[] c, 
int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] = a[j] / bval;
+       }
+
+       public static void vectDivWrite(double bval, double[] a, int[] aix, 
double[] c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] = a[j] / bval;
        }
        
-       /**
-        * Computes C = A / b, where C and A are dense vectors, and b is a 
scalar. 
-        * 
-        * @param a dense input vector A
-        * @param bval input scalar b 
-        * @param c dense input-output vector C
-        * @param ai start position in A
-        * @param ci start position in C
-        * @param len number of processed elements.
-        */
-       public static void vectDivWrite( double[] a, final double bval, 
double[] c, int ai, int ci, final int len )
-       {
-               final int bn = len%8;
-               
-               //rest, not aligned to 8-blocks
-               for( int j = 0; j < bn; j++, ai++, ci++)
-                       c[ ci ] = a[ ai ] / bval;
-               
-               //unrolled 8-block  (for better instruction-level parallelism)
-               for( int j = bn; j < len; j+=8, ai+=8, ci+=8) 
-               {
-                       //read 64B cachelines of a and c
-                       //compute c' = a / bval + c
-                       //write back 64B cacheline of c = c'
-                       c[ ci+0 ] = a[ ai+0 ] / bval;
-                       c[ ci+1 ] = a[ ai+1 ] / bval;
-                       c[ ci+2 ] = a[ ai+2 ] / bval;
-                       c[ ci+3 ] = a[ ai+3 ] / bval;
-                       c[ ci+4 ] = a[ ai+4 ] / bval;
-                       c[ ci+5 ] = a[ ai+5 ] / bval;
-                       c[ ci+6 ] = a[ ai+6 ] / bval;
-                       c[ ci+7 ] = a[ ai+7 ] / bval;
-               }
+       //custom vector equal
+       
+       public static void vectEqualAdd(double bval, double[] a, double[] c, 
int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] += (a[j] == bval) ? 1 : 0;
+       } 
+
+       public static void vectEqualAdd(double bval, double[] a, double[] c, 
int[] aix, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] += (a[j] == bval) ? 1 : 0;
        }
        
-       /**
-        * Computes C = A / b, where C is a dense vector and A is a sparse 
vector, and b is a scalar. 
-        * 
-        * @param a sparse input vector A values
-        * @param aix sparse input vector A column indexes
-        * @param bval input scalar b 
-        * @param c dense input-output vector C
-        * @param ai start position in A
-        * @param ci start position in C
-        * @param len number of processed elements.
-        */
-       public static void vectDivWrite( double[] a, int[] aix, final double 
bval, double[] c, final int ai, final int ci, final int len )
-       {
-               final int bn = len%8;
-               
-               //rest, not aligned to 8-blocks
-               for( int j = ai; j < ai+bn; j++ )
-                       c[ ci + aix[j] ] += a[ j ] / bval;
-               
-               //unrolled 8-block (for better instruction-level parallelism)
-               for( int j = ai+bn; j < ai+len; j+=8 )
-               {
-                       //read 64B cachelines of a, compute c = a/b
-                       //and write back c via 'scatter'
-                       c[ ci+aix[j+0] ] = a[ j+0 ] / bval;
-                       c[ ci+aix[j+1] ] = a[ j+1 ] / bval;
-                       c[ ci+aix[j+2] ] = a[ j+2 ] / bval;
-                       c[ ci+aix[j+3] ] = a[ j+3 ] / bval;
-                       c[ ci+aix[j+4] ] = a[ j+4 ] / bval;
-                       c[ ci+aix[j+5] ] = a[ j+5 ] / bval;
-                       c[ ci+aix[j+6] ] = a[ j+6 ] / bval;
-                       c[ ci+aix[j+7] ] = a[ j+7 ] / bval;
-               }
+       public static void vectEqualWrite(double bval, double[] a, double[] c, 
int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] = (a[j] == bval) ? 1 : 0;
+       }
+
+       public static void vectEqualWrite(double bval, double[] a, int[] aix, 
double[] c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] = (a[j] == bval) ? 1 : 0;
+       }
+       
+       //custom vector notequal
+       
+       public static void vectNotequalAdd(double bval, double[] a, double[] c, 
int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] += (a[j] != bval) ? 1 : 0;
+       } 
+
+       public static void vectNotequalAdd(double bval, double[] a, double[] c, 
int[] aix, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] += (a[j] != bval) ? 1 : 0;
+       }
+       
+       public static void vectNotequalWrite(double bval, double[] a, double[] 
c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] = (a[j] != bval) ? 1 : 0;
+       }
+
+       public static void vectNotequalWrite(double bval, double[] a, int[] 
aix, double[] c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] = (a[j] != bval) ? 1 : 0;
+       }
+       
+       //custom vector less
+       
+       public static void vectLessAdd(double bval, double[] a, double[] c, int 
ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] += (a[j] < bval) ? 1 : 0;
+       } 
+
+       public static void vectLessAdd(double bval, double[] a, double[] c, 
int[] aix, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] += (a[j] < bval) ? 1 : 0;
+       }
+       
+       public static void vectLessWrite(double bval, double[] a, double[] c, 
int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] = (a[j] < bval) ? 1 : 0;
+       }
+
+       public static void vectLessWrite(double bval, double[] a, int[] aix, 
double[] c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] = (a[j] < bval) ? 1 : 0;
+       }
+       
+       //custom vector lessequal
+       
+       public static void vectLessequalAdd(double bval, double[] a, double[] 
c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] += (a[j] <= bval) ? 1 : 0;
+       } 
+
+       public static void vectLessequalAdd(double bval, double[] a, double[] 
c, int[] aix, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] += (a[j] <= bval) ? 1 : 0;
+       }
+       
+       public static void vectLessequalWrite(double bval, double[] a, double[] 
c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] = (a[j] <= bval) ? 1 : 0;
+       }
+
+       public static void vectLessequalWrite(double bval, double[] a, int[] 
aix, double[] c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] = (a[j] <= bval) ? 1 : 0;
+       }
+
+       //custom vector greater
+       
+       public static void vectGreaterAdd(double bval, double[] a, double[] c, 
int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] += (a[j] > bval) ? 1 : 0;
+       } 
+
+       public static void vectGreaterAdd(double bval, double[] a, double[] c, 
int[] aix, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] += (a[j] > bval) ? 1 : 0;
+       }
+       
+       public static void vectGreaterWrite(double bval, double[] a, double[] 
c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] = (a[j] > bval) ? 1 : 0;
+       }
+
+       public static void vectGreaterWrite(double bval, double[] a, int[] aix, 
double[] c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] = (a[j] > bval) ? 1 : 0;
+       }
+       
+       //custom vector greaterequal
+       
+       public static void vectGreaterequalAdd(double bval, double[] a, 
double[] c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] += (a[j] >= bval) ? 1 : 0;
+       } 
+
+       public static void vectGreaterequalAdd(double bval, double[] a, 
double[] c, int[] aix, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] += (a[j] >= bval) ? 1 : 0;
+       }
+       
+       public static void vectGreaterequalWrite(double bval, double[] a, 
double[] c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++, ci++)
+                       c[ci] = (a[j] >= bval) ? 1 : 0;
+       }
+
+       public static void vectGreaterequalWrite(double bval, double[] a, int[] 
aix, double[] c, int ai, int ci, int len) {
+               for( int j = ai; j < ai+len; j++ )
+                       c[ci + aix[j]] = (a[j] >= bval) ? 1 : 0;
        }
 }

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/java/org/apache/sysml/test/integration/functions/codegen/RowVectorComparisonTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/sysml/test/integration/functions/codegen/RowVectorComparisonTest.java
 
b/src/test/java/org/apache/sysml/test/integration/functions/codegen/RowVectorComparisonTest.java
new file mode 100644
index 0000000..d73f00e
--- /dev/null
+++ 
b/src/test/java/org/apache/sysml/test/integration/functions/codegen/RowVectorComparisonTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.sysml.test.integration.functions.codegen;
+
+import java.io.File;
+import java.util.HashMap;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.apache.sysml.api.DMLScript;
+import org.apache.sysml.api.DMLScript.RUNTIME_PLATFORM;
+import org.apache.sysml.hops.OptimizerUtils;
+import org.apache.sysml.lops.LopProperties.ExecType;
+import org.apache.sysml.runtime.matrix.data.MatrixValue.CellIndex;
+import org.apache.sysml.test.integration.AutomatedTestBase;
+import org.apache.sysml.test.integration.TestConfiguration;
+import org.apache.sysml.test.utils.TestUtils;
+
+public class RowVectorComparisonTest extends AutomatedTestBase 
+{
+       private static final String TEST_NAME1 = "rowComparisonEq";
+       private static final String TEST_NAME2 = "rowComparisonNeq";
+       private static final String TEST_NAME3 = "rowComparisonLte";
+       private static final String TEST_NAME4 = "rowComparisonLt";
+       private static final String TEST_NAME5 = "rowComparisonGte";
+       private static final String TEST_NAME6 = "rowComparisonGt";
+
+       private static final String TEST_DIR = "functions/codegen/";
+       private static final String TEST_CLASS_DIR = TEST_DIR + 
RowVectorComparisonTest.class.getSimpleName() + "/";
+       private final static String TEST_CONF = "SystemML-config-codegen.xml";
+       private final static File   TEST_CONF_FILE = new File(SCRIPT_DIR + 
TEST_DIR, TEST_CONF);
+       
+       private static final double eps = Math.pow(10, -10);
+       
+       @Override
+       public void setUp() {
+               TestUtils.clearAssertionInformation();
+               addTestConfiguration( TEST_NAME1, new 
TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "R" }) );
+               addTestConfiguration( TEST_NAME2, new 
TestConfiguration(TEST_CLASS_DIR, TEST_NAME2, new String[] { "R" }) );
+               addTestConfiguration( TEST_NAME3, new 
TestConfiguration(TEST_CLASS_DIR, TEST_NAME3, new String[] { "R" }) );
+               addTestConfiguration( TEST_NAME4, new 
TestConfiguration(TEST_CLASS_DIR, TEST_NAME4, new String[] { "R" }) );
+               addTestConfiguration( TEST_NAME5, new 
TestConfiguration(TEST_CLASS_DIR, TEST_NAME5, new String[] { "R" }) );
+               addTestConfiguration( TEST_NAME6, new 
TestConfiguration(TEST_CLASS_DIR, TEST_NAME6, new String[] { "R" }) );
+       }
+       
+       @Test   
+       public void testCodegenRowComparison1() {
+               testCodegenIntegration( TEST_NAME1, false, ExecType.CP );
+       }
+       
+       @Test
+       public void testCodegenRowComparison2() {
+               testCodegenIntegration( TEST_NAME2, false, ExecType.CP );
+       }
+       
+       @Test
+       public void testCodegenRowComparison3() {
+               testCodegenIntegration( TEST_NAME3, false, ExecType.CP );
+       }
+       
+       @Test
+       public void testCodegenRowComparison4() {
+               testCodegenIntegration( TEST_NAME4, false, ExecType.CP );       
+       }
+       
+       @Test
+       public void testCodegenRowComparison5() {
+               testCodegenIntegration( TEST_NAME5, false, ExecType.CP );       
+       }
+       
+       @Test
+       public void testCodegenRowComparison6() {
+               testCodegenIntegration( TEST_NAME6, false, ExecType.CP );       
+       }
+       
+       @Test   
+       public void testCodegenRowComparisonRewrite1() {
+               testCodegenIntegration( TEST_NAME1, true, ExecType.CP );
+       }
+       
+       @Test
+       public void testCodegenRowComparisonRewrite2() {
+               testCodegenIntegration( TEST_NAME2, true, ExecType.CP );
+       }
+       
+       @Test
+       public void testCodegenRowComparisonRewrite3() {
+               testCodegenIntegration( TEST_NAME3, true, ExecType.CP );
+       }
+       
+       @Test
+       public void testCodegenRowComparisonRewrite4() {
+               testCodegenIntegration( TEST_NAME4, true, ExecType.CP );        
+       }
+       
+       @Test
+       public void testCodegenRowComparisonRewrite5() {
+               testCodegenIntegration( TEST_NAME5, true, ExecType.CP );        
+       }
+       
+       @Test
+       public void testCodegenRowComparisonRewrite6() {
+               testCodegenIntegration( TEST_NAME6, true, ExecType.CP );        
+       }
+       
+       
+       private void testCodegenIntegration( String testname, boolean rewrites, 
ExecType instType )
+       {       
+               boolean oldFlag = OptimizerUtils.ALLOW_ALGEBRAIC_SIMPLIFICATION;
+               RUNTIME_PLATFORM oldPlatform = rtplatform;
+               switch( instType ){
+                       case MR: rtplatform = RUNTIME_PLATFORM.HADOOP; break;
+                       case SPARK: 
+                               rtplatform = RUNTIME_PLATFORM.SPARK;
+                               DMLScript.USE_LOCAL_SPARK_CONFIG = true; 
+                               break;
+                       default: rtplatform = RUNTIME_PLATFORM.HYBRID; break;
+               }
+               
+               try
+               {
+                       TestConfiguration config = 
getTestConfiguration(testname);
+                       loadTestConfiguration(config);
+                       
+                       String HOME = SCRIPT_DIR + TEST_DIR;
+                       fullDMLScriptName = HOME + testname + ".dml";
+                       programArgs = new String[]{"-explain", "-stats", 
"-args", output("R") };
+                       
+                       fullRScriptName = HOME + testname + ".R";
+                       rCmd = getRCmd(inputDir(), expectedDir());              
        
+
+                       OptimizerUtils.ALLOW_ALGEBRAIC_SIMPLIFICATION = 
rewrites;
+
+                       runTest(true, false, null, -1); 
+                       runRScript(true); 
+                       
+                       //compare matrices 
+                       HashMap<CellIndex, Double> dmlfile = 
readDMLMatrixFromHDFS("R");
+                       HashMap<CellIndex, Double> rfile  = 
readRMatrixFromFS("R");
+                       TestUtils.compareMatrices(dmlfile, rfile, eps, 
"Stat-DML", "Stat-R");
+                       
Assert.assertTrue(heavyHittersContainsSubString("spoofRA") 
+                                       || 
heavyHittersContainsSubString("sp_spoofRA"));
+               }
+               finally {
+                       OptimizerUtils.ALLOW_ALGEBRAIC_SIMPLIFICATION = oldFlag;
+                       OptimizerUtils.ALLOW_AUTO_VECTORIZATION = true;
+                       OptimizerUtils.ALLOW_OPERATOR_FUSION = true;
+                       rtplatform = oldPlatform;
+               }
+       }       
+
+       /**
+        * Override default configuration with custom test configuration to 
ensure
+        * scratch space and local temporary directory locations are also 
updated.
+        */
+       @Override
+       protected File getConfigTemplateFile() {
+               // Instrumentation in this test's output log to show custom 
configuration file used for template.
+               System.out.println("This test case overrides default 
configuration with " + TEST_CONF_FILE.getPath());
+               return TEST_CONF_FILE;
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonEq.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonEq.R 
b/src/test/scripts/functions/codegen/rowComparisonEq.R
new file mode 100644
index 0000000..214127f
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonEq.R
@@ -0,0 +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.
+#
+#-------------------------------------------------------------
+
+args<-commandArgs(TRUE)
+options(digits=22)
+library("Matrix")
+
+X = matrix(seq(1,1500), 375, 4);
+R = t(colSums(X==rowSums(X)));
+
+writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); 

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonEq.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonEq.dml 
b/src/test/scripts/functions/codegen/rowComparisonEq.dml
new file mode 100644
index 0000000..af76170
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonEq.dml
@@ -0,0 +1,25 @@
+#-------------------------------------------------------------
+#
+# 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.
+#
+#-------------------------------------------------------------
+
+X = matrix(seq(1,1500), 375, 4);
+R = colSums(X==rowSums(X));
+
+write(R,$1)

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonGt.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonGt.R 
b/src/test/scripts/functions/codegen/rowComparisonGt.R
new file mode 100644
index 0000000..107f0a2
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonGt.R
@@ -0,0 +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.
+#
+#-------------------------------------------------------------
+
+args<-commandArgs(TRUE)
+options(digits=22)
+library("Matrix")
+
+X = matrix(seq(1,1500), 375, 4);
+R = t(colSums(X>rowSums(X)));
+
+writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); 

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonGt.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonGt.dml 
b/src/test/scripts/functions/codegen/rowComparisonGt.dml
new file mode 100644
index 0000000..b3877aa
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonGt.dml
@@ -0,0 +1,25 @@
+#-------------------------------------------------------------
+#
+# 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.
+#
+#-------------------------------------------------------------
+
+X = matrix(seq(1,1500), 375, 4);
+R = colSums(X>rowSums(X));
+
+write(R,$1)

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonGte.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonGte.R 
b/src/test/scripts/functions/codegen/rowComparisonGte.R
new file mode 100644
index 0000000..2196766
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonGte.R
@@ -0,0 +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.
+#
+#-------------------------------------------------------------
+
+args<-commandArgs(TRUE)
+options(digits=22)
+library("Matrix")
+
+X = matrix(seq(1,1500), 375, 4);
+R = t(colSums(X>=rowSums(X)));
+
+writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); 

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonGte.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonGte.dml 
b/src/test/scripts/functions/codegen/rowComparisonGte.dml
new file mode 100644
index 0000000..5311f08
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonGte.dml
@@ -0,0 +1,25 @@
+#-------------------------------------------------------------
+#
+# 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.
+#
+#-------------------------------------------------------------
+
+X = matrix(seq(1,1500), 375, 4);
+R = colSums(X>=rowSums(X));
+
+write(R,$1)

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonLt.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonLt.R 
b/src/test/scripts/functions/codegen/rowComparisonLt.R
new file mode 100644
index 0000000..ed2588b
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonLt.R
@@ -0,0 +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.
+#
+#-------------------------------------------------------------
+
+args<-commandArgs(TRUE)
+options(digits=22)
+library("Matrix")
+
+X = matrix(seq(1,1500), 375, 4);
+R = t(colSums(X<rowSums(X)));
+
+writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); 

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonLt.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonLt.dml 
b/src/test/scripts/functions/codegen/rowComparisonLt.dml
new file mode 100644
index 0000000..1914bff
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonLt.dml
@@ -0,0 +1,25 @@
+#-------------------------------------------------------------
+#
+# 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.
+#
+#-------------------------------------------------------------
+
+X = matrix(seq(1,1500), 375, 4);
+R = colSums(X<rowSums(X));
+
+write(R,$1)

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonLte.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonLte.R 
b/src/test/scripts/functions/codegen/rowComparisonLte.R
new file mode 100644
index 0000000..962894d
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonLte.R
@@ -0,0 +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.
+#
+#-------------------------------------------------------------
+
+args<-commandArgs(TRUE)
+options(digits=22)
+library("Matrix")
+
+X = matrix(seq(1,1500), 375, 4);
+R = t(colSums(X<=rowSums(X)));
+
+writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); 

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonLte.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonLte.dml 
b/src/test/scripts/functions/codegen/rowComparisonLte.dml
new file mode 100644
index 0000000..4ffc7f2
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonLte.dml
@@ -0,0 +1,25 @@
+#-------------------------------------------------------------
+#
+# 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.
+#
+#-------------------------------------------------------------
+
+X = matrix(seq(1,1500), 375, 4);
+R = colSums(X<=rowSums(X));
+
+write(R,$1)

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonNeq.R
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonNeq.R 
b/src/test/scripts/functions/codegen/rowComparisonNeq.R
new file mode 100644
index 0000000..ad0aeb2
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonNeq.R
@@ -0,0 +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.
+#
+#-------------------------------------------------------------
+
+args<-commandArgs(TRUE)
+options(digits=22)
+library("Matrix")
+
+X = matrix(seq(1,1500), 375, 4);
+R = t(colSums(X!=rowSums(X)));
+
+writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); 

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test/scripts/functions/codegen/rowComparisonNeq.dml
----------------------------------------------------------------------
diff --git a/src/test/scripts/functions/codegen/rowComparisonNeq.dml 
b/src/test/scripts/functions/codegen/rowComparisonNeq.dml
new file mode 100644
index 0000000..f63de13
--- /dev/null
+++ b/src/test/scripts/functions/codegen/rowComparisonNeq.dml
@@ -0,0 +1,25 @@
+#-------------------------------------------------------------
+#
+# 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.
+#
+#-------------------------------------------------------------
+
+X = matrix(seq(1,1500), 375, 4);
+R = colSums(X!=rowSums(X));
+
+write(R,$1)

http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/70e5aa19/src/test_suites/java/org/apache/sysml/test/integration/functions/codegen/ZPackageSuite.java
----------------------------------------------------------------------
diff --git 
a/src/test_suites/java/org/apache/sysml/test/integration/functions/codegen/ZPackageSuite.java
 
b/src/test_suites/java/org/apache/sysml/test/integration/functions/codegen/ZPackageSuite.java
index dd960bf..abba49e 100644
--- 
a/src/test_suites/java/org/apache/sysml/test/integration/functions/codegen/ZPackageSuite.java
+++ 
b/src/test_suites/java/org/apache/sysml/test/integration/functions/codegen/ZPackageSuite.java
@@ -36,6 +36,7 @@ import org.junit.runners.Suite;
        DAGCellwiseTmplTest.class,
        OuterProdTmplTest.class,
        RowAggTmplTest.class,
+       RowVectorComparisonTest.class,
        SumProductChainTest.class,
 })
 

Reply via email to