http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/constant_propagation_while.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/constant_propagation_while.R b/src/test/scripts/functions/recompile/constant_propagation_while.R index d764d8f..a6bfa9a 100644 --- a/src/test/scripts/functions/recompile/constant_propagation_while.R +++ b/src/test/scripts/functions/recompile/constant_propagation_while.R @@ -19,25 +19,25 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -numrows = as.integer(args[1]); -numcols = as.integer(args[2]); - -i = 1; -while( i<3 ) -{ - numrows = numrows + 1; - numcols = numcols + 2; - i = i + 1; -} - -X = matrix(1, numrows, numcols); - -writeMM(as(X, "CsparseMatrix"), paste(args[3], "X", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +numrows = as.integer(args[1]); +numcols = as.integer(args[2]); + +i = 1; +while( i<3 ) +{ + numrows = numrows + 1; + numcols = numcols + 2; + i = i + 1; +} + +X = matrix(1, numrows, numcols); + +writeMM(as(X, "CsparseMatrix"), paste(args[3], "X", sep="")); + +
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/constant_propagation_while.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/constant_propagation_while.dml b/src/test/scripts/functions/recompile/constant_propagation_while.dml index 98012a0..d6ae610 100644 --- a/src/test/scripts/functions/recompile/constant_propagation_while.dml +++ b/src/test/scripts/functions/recompile/constant_propagation_while.dml @@ -19,18 +19,18 @@ # #------------------------------------------------------------- - -numrows = $1; -numcols = $2; - -i = 1; -while( i<3 ) -{ - numrows = numrows + 1; - numcols = numcols + 2; - i = i + 1; -} - -X = matrix(1, rows=numrows, cols=numcols); - -write(X, $3); + +numrows = $1; +numcols = $2; + +i = 1; +while( i<3 ) +{ + numrows = numrows + 1; + numcols = numcols + 2; + i = i + 1; +} + +X = matrix(1, rows=numrows, cols=numcols); + +write(X, $3); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/csv_read_unknown.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/csv_read_unknown.dml b/src/test/scripts/functions/recompile/csv_read_unknown.dml index 08de77b..bcac3ae 100644 --- a/src/test/scripts/functions/recompile/csv_read_unknown.dml +++ b/src/test/scripts/functions/recompile/csv_read_unknown.dml @@ -19,16 +19,16 @@ # #------------------------------------------------------------- - -X = read($1); - -#test for multiple parents -R = X + X; -R = R - X; - -write(R, $2); - - - - + +X = read($1); + +#test for multiple parents +R = X + X; +R = R - X; + +write(R, $2); + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/for_recompile.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/for_recompile.dml b/src/test/scripts/functions/recompile/for_recompile.dml index 04a4f10..96d7dac 100644 --- a/src/test/scripts/functions/recompile/for_recompile.dml +++ b/src/test/scripts/functions/recompile/for_recompile.dml @@ -19,11 +19,11 @@ # #------------------------------------------------------------- - -V = Rand(rows=$1+1, cols=$2+1, min=$3, max=$3); -Z = Rand(rows=1,cols=1,min=0,max=0); -for( i in $3:castAsScalar(V[1,1]) ) -{ - Z[1,1] = V[1,1]; -} + +V = Rand(rows=$1+1, cols=$2+1, min=$3, max=$3); +Z = Rand(rows=1,cols=1,min=0,max=0); +for( i in $3:castAsScalar(V[1,1]) ) +{ + Z[1,1] = V[1,1]; +} write(Z, $4); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/for_recompile_func_sparse.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/for_recompile_func_sparse.dml b/src/test/scripts/functions/recompile/for_recompile_func_sparse.dml index 2eb38ad..3ab662b 100644 --- a/src/test/scripts/functions/recompile/for_recompile_func_sparse.dml +++ b/src/test/scripts/functions/recompile/for_recompile_func_sparse.dml @@ -19,36 +19,36 @@ # #------------------------------------------------------------- - -foo1 = function (Matrix[Double] X) - return (Matrix[Double] Y) -{ - V = X; - print(sum(V)); - for( i in 1:1 ) - { - print(sum(V)); - V = foo2(V,i); - } - Y = V; -} - -foo2 = function (Matrix[Double] X, Integer i) - return (Matrix[Double] Y) -{ - V = X; - for( j in 1:1 ) - { - V[i,j] = $2; - } - Y = V; -} - -V = read($1); -V = foo1(V); -write(V, $3); - - - - + +foo1 = function (Matrix[Double] X) + return (Matrix[Double] Y) +{ + V = X; + print(sum(V)); + for( i in 1:1 ) + { + print(sum(V)); + V = foo2(V,i); + } + Y = V; +} + +foo2 = function (Matrix[Double] X, Integer i) + return (Matrix[Double] Y) +{ + V = X; + for( j in 1:1 ) + { + V[i,j] = $2; + } + Y = V; +} + +V = read($1); +V = foo1(V); +write(V, $3); + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/for_recompile_sparse.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/for_recompile_sparse.dml b/src/test/scripts/functions/recompile/for_recompile_sparse.dml index 7ce9550..05bdb74 100644 --- a/src/test/scripts/functions/recompile/for_recompile_sparse.dml +++ b/src/test/scripts/functions/recompile/for_recompile_sparse.dml @@ -19,21 +19,21 @@ # #------------------------------------------------------------- - -V = read($1); -print(sum(V)); -for( i in 1:1 ) -{ - print(sum(V)); - - for( j in 1:1 ) - { - V[i,j] = $2; - } -} -write(V, $3); - - - - + +V = read($1); +print(sum(V)); +for( i in 1:1 ) +{ + print(sum(V)); + + for( j in 1:1 ) + { + V[i,j] = $2; + } +} +write(V, $3); + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/funct_recompile.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/funct_recompile.R b/src/test/scripts/functions/recompile/funct_recompile.R index 830fb96..0f1e010 100644 --- a/src/test/scripts/functions/recompile/funct_recompile.R +++ b/src/test/scripts/functions/recompile/funct_recompile.R @@ -19,21 +19,21 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -V <- readMM(paste(args[1], "V.mtx", sep="")) -n <- ncol(V); - -R <- array(0,dim=c(n,1)) - -for( i in 1:n ) -{ - X <- V[2:nrow(V),i]; - R[i,1] <- sum(X %*% t(X)); -} - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +V <- readMM(paste(args[1], "V.mtx", sep="")) +n <- ncol(V); + +R <- array(0,dim=c(n,1)) + +for( i in 1:n ) +{ + X <- V[2:nrow(V),i]; + R[i,1] <- sum(X %*% t(X)); +} + writeMM(as(R, "CsparseMatrix"), paste(args[2], "Rout", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/funct_recompile.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/funct_recompile.dml b/src/test/scripts/functions/recompile/funct_recompile.dml index 2059181..90f757f 100644 --- a/src/test/scripts/functions/recompile/funct_recompile.dml +++ b/src/test/scripts/functions/recompile/funct_recompile.dml @@ -19,33 +19,33 @@ # #------------------------------------------------------------- - -execFun = function(Matrix[Double] Xin) return (Double sx) -{ - X = Xin[2:nrow(Xin),] - - if( nrow(X)>1 ) - { - Y = X %*% t(X); - sx = sum(Y); - } - else - { - sx = 0; - } -} - -V = read($1, rows=$2, cols=$3); - -R = Rand(rows=$3,cols=1,min=0,max=0); -dummy = Rand(rows=1, cols=1, min=1, max=1); - -for( i in 1:$3 ) -{ - X = V[,i]; - sumx = execFun(X); - - R[i,1] = dummy * sumx; -} - + +execFun = function(Matrix[Double] Xin) return (Double sx) +{ + X = Xin[2:nrow(Xin),] + + if( nrow(X)>1 ) + { + Y = X %*% t(X); + sx = sum(Y); + } + else + { + sx = 0; + } +} + +V = read($1, rows=$2, cols=$3); + +R = Rand(rows=$3,cols=1,min=0,max=0); +dummy = Rand(rows=1, cols=1, min=1, max=1); + +for( i in 1:$3 ) +{ + X = V[,i]; + sumx = execFun(X); + + R[i,1] = dummy * sumx; +} + write(R, $4); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/grpagg_rand_recompile.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/grpagg_rand_recompile.R b/src/test/scripts/functions/recompile/grpagg_rand_recompile.R index 70c20d7..0f06ea4 100644 --- a/src/test/scripts/functions/recompile/grpagg_rand_recompile.R +++ b/src/test/scripts/functions/recompile/grpagg_rand_recompile.R @@ -19,15 +19,15 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -X <- as.matrix(readMM(paste(args[1], "X.mtx", sep=""))) - -Y = as.matrix(aggregate(X[,1] ~ X[,2], data=X, length)[,1]); -Z = matrix(7, nrow(Y)+ncol(Y), nrow(Y)+ncol(Y)+1); - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +X <- as.matrix(readMM(paste(args[1], "X.mtx", sep=""))) + +Y = as.matrix(aggregate(X[,1] ~ X[,2], data=X, length)[,1]); +Z = matrix(7, nrow(Y)+ncol(Y), nrow(Y)+ncol(Y)+1); + writeMM(as(Z, "CsparseMatrix"), paste(args[2], "Z", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/grpagg_rand_recompile.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/grpagg_rand_recompile.dml b/src/test/scripts/functions/recompile/grpagg_rand_recompile.dml index 69a5a90..0dce630 100644 --- a/src/test/scripts/functions/recompile/grpagg_rand_recompile.dml +++ b/src/test/scripts/functions/recompile/grpagg_rand_recompile.dml @@ -19,10 +19,10 @@ # #------------------------------------------------------------- - -X = read($1, rows=$2, cols=2); - -Y = aggregate(target=X[,1],groups=X[,2], fn="count"); -Z = matrix(7, rows=nrow(Y)+ncol(Y), cols=nrow(Y)+ncol(Y)+1); - + +X = read($1, rows=$2, cols=2); + +Y = aggregate(target=X[,1],groups=X[,2], fn="count"); +Z = matrix(7, rows=nrow(Y)+ncol(Y), cols=nrow(Y)+ncol(Y)+1); + write(Z, $3); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/if_branch_removal.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/if_branch_removal.R b/src/test/scripts/functions/recompile/if_branch_removal.R index 2eefbff..5a771d1 100644 --- a/src/test/scripts/functions/recompile/if_branch_removal.R +++ b/src/test/scripts/functions/recompile/if_branch_removal.R @@ -19,30 +19,30 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -X <- as.matrix(readMM(paste(args[1], "X.mtx", sep=""))) - -if( as.integer(args[2])==1 ) -{ - v = matrix(1,nrow(X),1); - X = as.matrix(cbind(X, v)); -} - -if( as.integer(args[2])!=1 ) -{ - v = matrix(1,nrow(X),1); - X = as.matrix(cbind(X, v)); -} else -{ - v1 = matrix(1,nrow(X),1); - X = as.matrix(cbind(X, v1)); - v2 = matrix(1,nrow(X),1); - X = as.matrix(cbind(X, v2)); -} - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +X <- as.matrix(readMM(paste(args[1], "X.mtx", sep=""))) + +if( as.integer(args[2])==1 ) +{ + v = matrix(1,nrow(X),1); + X = as.matrix(cbind(X, v)); +} + +if( as.integer(args[2])!=1 ) +{ + v = matrix(1,nrow(X),1); + X = as.matrix(cbind(X, v)); +} else +{ + v1 = matrix(1,nrow(X),1); + X = as.matrix(cbind(X, v1)); + v2 = matrix(1,nrow(X),1); + X = as.matrix(cbind(X, v2)); +} + writeMM(as(X, "CsparseMatrix"), paste(args[3], "X", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/if_branch_removal.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/if_branch_removal.dml b/src/test/scripts/functions/recompile/if_branch_removal.dml index e84b57e..68f1eae 100644 --- a/src/test/scripts/functions/recompile/if_branch_removal.dml +++ b/src/test/scripts/functions/recompile/if_branch_removal.dml @@ -19,28 +19,28 @@ # #------------------------------------------------------------- - -X = read($1, rows=$2, cols=$3); - -# test if-only -if( $4==1 ) -{ - v = matrix(1,rows=nrow(X),cols=1); - X = append(X, v); -} - -# test if-else branches -if( $4!=1 ) -{ - v = matrix(1,rows=nrow(X),cols=1); - X = append(X, v); -} -else -{ - v1 = matrix(1,rows=nrow(X),cols=1); - X = append(X, v1); - v2 = matrix(1,rows=nrow(X),cols=1); - X = append(X, v2); -} - + +X = read($1, rows=$2, cols=$3); + +# test if-only +if( $4==1 ) +{ + v = matrix(1,rows=nrow(X),cols=1); + X = append(X, v); +} + +# test if-else branches +if( $4!=1 ) +{ + v = matrix(1,rows=nrow(X),cols=1); + X = append(X, v); +} +else +{ + v1 = matrix(1,rows=nrow(X),cols=1); + X = append(X, v1); + v2 = matrix(1,rows=nrow(X),cols=1); + X = append(X, v2); +} + write(X, $5); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/if_recompile.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/if_recompile.dml b/src/test/scripts/functions/recompile/if_recompile.dml index f8a4555..2d02e01 100644 --- a/src/test/scripts/functions/recompile/if_recompile.dml +++ b/src/test/scripts/functions/recompile/if_recompile.dml @@ -19,11 +19,11 @@ # #------------------------------------------------------------- - -V = Rand(rows=$1+1, cols=$2+1, min=$3, max=$3); -Z = Rand(rows=1,cols=1,min=0,max=0); -if( castAsScalar(V[1,1])>castAsScalar(Z[1,1]) ) -{ - Z[1,1] = V[1,1]; -} + +V = Rand(rows=$1+1, cols=$2+1, min=$3, max=$3); +Z = Rand(rows=1,cols=1,min=0,max=0); +if( castAsScalar(V[1,1])>castAsScalar(Z[1,1]) ) +{ + Z[1,1] = V[1,1]; +} write(Z, $4); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/if_recompile_func_sparse.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/if_recompile_func_sparse.dml b/src/test/scripts/functions/recompile/if_recompile_func_sparse.dml index 985e5a2..424c062 100644 --- a/src/test/scripts/functions/recompile/if_recompile_func_sparse.dml +++ b/src/test/scripts/functions/recompile/if_recompile_func_sparse.dml @@ -19,32 +19,32 @@ # #------------------------------------------------------------- - -foo1 = function (Matrix[Double] X) - return (Matrix[Double] Y) -{ - V = X; - print(sum(V)); - if( 1==1 ){ - V[1,1] = $2; - } - else { - print(sum(V)); - } - Y = V; -} - -foo2 = function (Matrix[Double] X) - return (Matrix[Double] Y) -{ - V = X; - if( 1==1 ){ - print(sum(V)); - } - Y = V; -} - -V = read($1); -V = foo1(V); -V = foo2(V); + +foo1 = function (Matrix[Double] X) + return (Matrix[Double] Y) +{ + V = X; + print(sum(V)); + if( 1==1 ){ + V[1,1] = $2; + } + else { + print(sum(V)); + } + Y = V; +} + +foo2 = function (Matrix[Double] X) + return (Matrix[Double] Y) +{ + V = X; + if( 1==1 ){ + print(sum(V)); + } + Y = V; +} + +V = read($1); +V = foo1(V); +V = foo2(V); write(V, $3); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/if_recompile_sparse.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/if_recompile_sparse.dml b/src/test/scripts/functions/recompile/if_recompile_sparse.dml index cf7fcc7..9b878cc 100644 --- a/src/test/scripts/functions/recompile/if_recompile_sparse.dml +++ b/src/test/scripts/functions/recompile/if_recompile_sparse.dml @@ -19,17 +19,17 @@ # #------------------------------------------------------------- - -V = read($1); -print(sum(V)); -if( 1==1 ){ - V[1,1] = $2; -} -else { - print(sum(V)); -} -if( 1==1 ){ - print(sum(V)); -} - + +V = read($1); +print(sum(V)); +if( 1==1 ){ + V[1,1] = $2; +} +else { + print(sum(V)); +} +if( 1==1 ){ + print(sum(V)); +} + write(V, $3); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_function_calls1.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_function_calls1.R b/src/test/scripts/functions/recompile/multiple_function_calls1.R index 68af751..7c16f72 100644 --- a/src/test/scripts/functions/recompile/multiple_function_calls1.R +++ b/src/test/scripts/functions/recompile/multiple_function_calls1.R @@ -19,22 +19,22 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -V <- readMM(paste(args[1], "V.mtx", sep="")) -V1 = V; -V2 = V; - -if( nrow(V)>5 ) { - V1 = V1 + 5; -} -if( nrow(V)>5 ) { - V2 = V2 + 5; -} - -R = V1+V2; + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +V <- readMM(paste(args[1], "V.mtx", sep="")) +V1 = V; +V2 = V; + +if( nrow(V)>5 ) { + V1 = V1 + 5; +} +if( nrow(V)>5 ) { + V2 = V2 + 5; +} + +R = V1+V2; writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_function_calls1.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_function_calls1.dml b/src/test/scripts/functions/recompile/multiple_function_calls1.dml index 592f490..fa2a97d 100644 --- a/src/test/scripts/functions/recompile/multiple_function_calls1.dml +++ b/src/test/scripts/functions/recompile/multiple_function_calls1.dml @@ -19,31 +19,31 @@ # #------------------------------------------------------------- - -# conditional propagate size, because called multiple times -foo1 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) -{ - X = Xin; - if( nrow(Xin)>5 ) - X = X + 5; - - Xout = X; -} - -# to be removed because never called -foo2 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) -{ - X = Xin; - if( nrow(Xin)<5 ) - X = X - 5; - - Xout = X; -} - -V = read($1); - -R1 = foo1(V); -R2 = foo1(V); -R = R1+R2; - -write(R, $2); + +# conditional propagate size, because called multiple times +foo1 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) +{ + X = Xin; + if( nrow(Xin)>5 ) + X = X + 5; + + Xout = X; +} + +# to be removed because never called +foo2 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) +{ + X = Xin; + if( nrow(Xin)<5 ) + X = X - 5; + + Xout = X; +} + +V = read($1); + +R1 = foo1(V); +R2 = foo1(V); +R = R1+R2; + +write(R, $2); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_function_calls2.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_function_calls2.R b/src/test/scripts/functions/recompile/multiple_function_calls2.R index 0512553..d82d33c 100644 --- a/src/test/scripts/functions/recompile/multiple_function_calls2.R +++ b/src/test/scripts/functions/recompile/multiple_function_calls2.R @@ -19,22 +19,22 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -V <- readMM(paste(args[1], "V.mtx", sep="")) -V1 = V-0.5; -V2 = V; - -if( nrow(V)>5 ) { - V1 = V1 + 5; -} -if( nrow(V)>5 ) { - V2 = V2 + 5; -} - -R = V1+V2; + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +V <- readMM(paste(args[1], "V.mtx", sep="")) +V1 = V-0.5; +V2 = V; + +if( nrow(V)>5 ) { + V1 = V1 + 5; +} +if( nrow(V)>5 ) { + V2 = V2 + 5; +} + +R = V1+V2; writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_function_calls2.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_function_calls2.dml b/src/test/scripts/functions/recompile/multiple_function_calls2.dml index 421deec..ea0e322 100644 --- a/src/test/scripts/functions/recompile/multiple_function_calls2.dml +++ b/src/test/scripts/functions/recompile/multiple_function_calls2.dml @@ -19,31 +19,31 @@ # #------------------------------------------------------------- - -# conditional propagate size, because called multiple times -foo1 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) -{ - X = Xin; - if( nrow(Xin)>5 ) - X = X + 5; - - Xout = X; -} - -# to be removed because never called -foo2 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) -{ - X = Xin; - if( nrow(Xin)<5 ) - X = X - 5; - - Xout = X; -} - -V = read($1); - -R1 = foo1(V-0.5); -R2 = foo1(V); -R = R1+R2; - -write(R, $2); + +# conditional propagate size, because called multiple times +foo1 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) +{ + X = Xin; + if( nrow(Xin)>5 ) + X = X + 5; + + Xout = X; +} + +# to be removed because never called +foo2 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) +{ + X = Xin; + if( nrow(Xin)<5 ) + X = X - 5; + + Xout = X; +} + +V = read($1); + +R1 = foo1(V-0.5); +R2 = foo1(V); +R = R1+R2; + +write(R, $2); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_function_calls3.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_function_calls3.R b/src/test/scripts/functions/recompile/multiple_function_calls3.R index 14001d6..eb8ea57 100644 --- a/src/test/scripts/functions/recompile/multiple_function_calls3.R +++ b/src/test/scripts/functions/recompile/multiple_function_calls3.R @@ -19,22 +19,22 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -V <- readMM(paste(args[1], "V.mtx", sep="")) -V1 = V; -V2 = V-0.5; - -if( nrow(V)>5 ) { - V1 = V1 + 5; -} -if( nrow(V)>5 ) { - V2 = V2 + 5; -} - -R = V1+V2; + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +V <- readMM(paste(args[1], "V.mtx", sep="")) +V1 = V; +V2 = V-0.5; + +if( nrow(V)>5 ) { + V1 = V1 + 5; +} +if( nrow(V)>5 ) { + V2 = V2 + 5; +} + +R = V1+V2; writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_function_calls3.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_function_calls3.dml b/src/test/scripts/functions/recompile/multiple_function_calls3.dml index 1962304..73ea192 100644 --- a/src/test/scripts/functions/recompile/multiple_function_calls3.dml +++ b/src/test/scripts/functions/recompile/multiple_function_calls3.dml @@ -19,31 +19,31 @@ # #------------------------------------------------------------- - -# conditional propagate size, because called multiple times -foo1 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) -{ - X = Xin; - if( nrow(Xin)>5 ) - X = X + 5; - - Xout = X; -} - -# to be removed because never called -foo2 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) -{ - X = Xin; - if( nrow(Xin)<5 ) - X = X - 5; - - Xout = X; -} - -V = read($1); - -R1 = foo1(V); -R2 = foo1(V-0.5); -R = R1+R2; - -write(R, $2); + +# conditional propagate size, because called multiple times +foo1 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) +{ + X = Xin; + if( nrow(Xin)>5 ) + X = X + 5; + + Xout = X; +} + +# to be removed because never called +foo2 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) +{ + X = Xin; + if( nrow(Xin)<5 ) + X = X - 5; + + Xout = X; +} + +V = read($1); + +R1 = foo1(V); +R2 = foo1(V-0.5); +R = R1+R2; + +write(R, $2); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_function_calls4.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_function_calls4.R b/src/test/scripts/functions/recompile/multiple_function_calls4.R index 07b33ea..f910736 100644 --- a/src/test/scripts/functions/recompile/multiple_function_calls4.R +++ b/src/test/scripts/functions/recompile/multiple_function_calls4.R @@ -19,22 +19,22 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -V <- readMM(paste(args[1], "V.mtx", sep="")) -V1 = V-0.5; -V2 = V-0.5; - -if( nrow(V)>5 ) { - V1 = V1 + 5; -} -if( nrow(V)>5 ) { - V2 = V2 + 5; -} - -R = V1+V2; + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +V <- readMM(paste(args[1], "V.mtx", sep="")) +V1 = V-0.5; +V2 = V-0.5; + +if( nrow(V)>5 ) { + V1 = V1 + 5; +} +if( nrow(V)>5 ) { + V2 = V2 + 5; +} + +R = V1+V2; writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_function_calls4.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_function_calls4.dml b/src/test/scripts/functions/recompile/multiple_function_calls4.dml index fec658c..da6d34a 100644 --- a/src/test/scripts/functions/recompile/multiple_function_calls4.dml +++ b/src/test/scripts/functions/recompile/multiple_function_calls4.dml @@ -19,31 +19,31 @@ # #------------------------------------------------------------- - -# conditional propagate size, because called multiple times -foo1 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) -{ - X = Xin; - if( nrow(Xin)>5 ) - X = X + 5; - - Xout = X; -} - -# to be removed because never called -foo2 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) -{ - X = Xin; - if( nrow(Xin)<5 ) - X = X - 5; - - Xout = X; -} - -V = read($1); - -R1 = foo1(V-0.5); -R2 = foo1(V-0.5); -R = R1+R2; - -write(R, $2); + +# conditional propagate size, because called multiple times +foo1 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) +{ + X = Xin; + if( nrow(Xin)>5 ) + X = X + 5; + + Xout = X; +} + +# to be removed because never called +foo2 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) +{ + X = Xin; + if( nrow(Xin)<5 ) + X = X - 5; + + Xout = X; +} + +V = read($1); + +R1 = foo1(V-0.5); +R2 = foo1(V-0.5); +R = R1+R2; + +write(R, $2); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_function_calls5.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_function_calls5.R b/src/test/scripts/functions/recompile/multiple_function_calls5.R index 68af751..7c16f72 100644 --- a/src/test/scripts/functions/recompile/multiple_function_calls5.R +++ b/src/test/scripts/functions/recompile/multiple_function_calls5.R @@ -19,22 +19,22 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -V <- readMM(paste(args[1], "V.mtx", sep="")) -V1 = V; -V2 = V; - -if( nrow(V)>5 ) { - V1 = V1 + 5; -} -if( nrow(V)>5 ) { - V2 = V2 + 5; -} - -R = V1+V2; + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +V <- readMM(paste(args[1], "V.mtx", sep="")) +V1 = V; +V2 = V; + +if( nrow(V)>5 ) { + V1 = V1 + 5; +} +if( nrow(V)>5 ) { + V2 = V2 + 5; +} + +R = V1+V2; writeMM(as(R, "CsparseMatrix"), paste(args[2], "R", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_function_calls5.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_function_calls5.dml b/src/test/scripts/functions/recompile/multiple_function_calls5.dml index 8f71c5f..dc1b420 100644 --- a/src/test/scripts/functions/recompile/multiple_function_calls5.dml +++ b/src/test/scripts/functions/recompile/multiple_function_calls5.dml @@ -19,32 +19,32 @@ # #------------------------------------------------------------- - -# conditional propagate size, because called multiple times -foo1 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) -{ - X = Xin; - if( nrow(Xin)>5 ) - X = X + 5; - - Xout = X; -} - -# to be removed because never called -foo2 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) -{ - X = Xin; - if( nrow(Xin)<5 ) - X = X - 5; - - Xout = X; -} - -V = read($1); - -R1 = foo1(V); -Vp = append(V,matrix(1,rows=nrow(V),cols=1)) -R2 = foo1(Vp); -R = R1+R2[,1:ncol(V)]; - -write(R, $2); + +# conditional propagate size, because called multiple times +foo1 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) +{ + X = Xin; + if( nrow(Xin)>5 ) + X = X + 5; + + Xout = X; +} + +# to be removed because never called +foo2 = function(Matrix[Double] Xin) return (Matrix[Double] Xout) +{ + X = Xin; + if( nrow(Xin)<5 ) + X = X - 5; + + Xout = X; +} + +V = read($1); + +R1 = foo1(V); +Vp = append(V,matrix(1,rows=nrow(V),cols=1)) +R2 = foo1(Vp); +R = R1+R2[,1:ncol(V)]; + +write(R, $2); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_reads.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_reads.R b/src/test/scripts/functions/recompile/multiple_reads.R index ecb2cad..9f86072 100644 --- a/src/test/scripts/functions/recompile/multiple_reads.R +++ b/src/test/scripts/functions/recompile/multiple_reads.R @@ -19,17 +19,17 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -X <- readMM(paste(args[1], "X1.mtx", sep="")) - -if( 1==1 ) -{ - X <- readMM(paste(args[1], "X2.mtx", sep="")) -} - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +X <- readMM(paste(args[1], "X1.mtx", sep="")) + +if( 1==1 ) +{ + X <- readMM(paste(args[1], "X2.mtx", sep="")) +} + writeMM(as(X, "CsparseMatrix"), paste(args[2], "X", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/multiple_reads.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/multiple_reads.dml b/src/test/scripts/functions/recompile/multiple_reads.dml index 31efdd3..021b11d 100644 --- a/src/test/scripts/functions/recompile/multiple_reads.dml +++ b/src/test/scripts/functions/recompile/multiple_reads.dml @@ -19,12 +19,12 @@ # #------------------------------------------------------------- - -X = read($1, rows=$2, cols=$3); - -if( 1==1 ) -{ - X = read($4, rows=$5, cols=$6); -} - + +X = read($1, rows=$2, cols=$3); + +if( 1==1 ) +{ + X = read($4, rows=$5, cols=$6); +} + write(X, $7); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/parfor_recompile.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/parfor_recompile.dml b/src/test/scripts/functions/recompile/parfor_recompile.dml index fe74001..5e14440 100644 --- a/src/test/scripts/functions/recompile/parfor_recompile.dml +++ b/src/test/scripts/functions/recompile/parfor_recompile.dml @@ -19,11 +19,11 @@ # #------------------------------------------------------------- - -V = Rand(rows=$1+1, cols=$2+1, min=$3, max=$3); -Z = Rand(rows=1,cols=1,min=0,max=0); -parfor( i in $3:castAsScalar(V[1,1]), check=0 ) -{ - Z[1,1] = V[1,1]; -} + +V = Rand(rows=$1+1, cols=$2+1, min=$3, max=$3); +Z = Rand(rows=1,cols=1,min=0,max=0); +parfor( i in $3:castAsScalar(V[1,1]), check=0 ) +{ + Z[1,1] = V[1,1]; +} write(Z, $4); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/parfor_recompile_func_sparse.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/parfor_recompile_func_sparse.dml b/src/test/scripts/functions/recompile/parfor_recompile_func_sparse.dml index 5f80b44..78dcff0 100644 --- a/src/test/scripts/functions/recompile/parfor_recompile_func_sparse.dml +++ b/src/test/scripts/functions/recompile/parfor_recompile_func_sparse.dml @@ -19,32 +19,32 @@ # #------------------------------------------------------------- - -foo1 = function (Matrix[Double] X) - return (Matrix[Double] Y) -{ - V = X; - print(sum(V)); - parfor( i in 1:1, check=0 ) - { - print(sum(V)); - V = foo2(V,i) - } - Y = V; -} - -foo2 = function (Matrix[Double] X, Integer i) - return (Matrix[Double] Y) -{ - V = X; - parfor( j in 1:1 ) - { - V[i,j] = $2; - } - Y = V; -} - - -V = read($1); -V = foo1(V); + +foo1 = function (Matrix[Double] X) + return (Matrix[Double] Y) +{ + V = X; + print(sum(V)); + parfor( i in 1:1, check=0 ) + { + print(sum(V)); + V = foo2(V,i) + } + Y = V; +} + +foo2 = function (Matrix[Double] X, Integer i) + return (Matrix[Double] Y) +{ + V = X; + parfor( j in 1:1 ) + { + V[i,j] = $2; + } + Y = V; +} + + +V = read($1); +V = foo1(V); write(V, $3); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/parfor_recompile_sparse.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/parfor_recompile_sparse.dml b/src/test/scripts/functions/recompile/parfor_recompile_sparse.dml index e251115..ae66c57 100644 --- a/src/test/scripts/functions/recompile/parfor_recompile_sparse.dml +++ b/src/test/scripts/functions/recompile/parfor_recompile_sparse.dml @@ -19,16 +19,16 @@ # #------------------------------------------------------------- - -V = read($1); -print(sum(V)); -parfor( i in 1:1 ) -{ - print(sum(V[i,])); - - parfor( j in 1:1 ) - { - V[i,j] = $2; - } -} + +V = read($1); +print(sum(V)); +parfor( i in 1:1 ) +{ + print(sum(V[i,])); + + parfor( j in 1:1 ) + { + V[i,j] = $2; + } +} write(V, $3); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rand_recompile.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rand_recompile.dml b/src/test/scripts/functions/recompile/rand_recompile.dml index 3f842b7..c3ec6f1 100644 --- a/src/test/scripts/functions/recompile/rand_recompile.dml +++ b/src/test/scripts/functions/recompile/rand_recompile.dml @@ -19,17 +19,17 @@ # #------------------------------------------------------------- - -n = $1; -s = 0; - -x1= n+5; -x2= n+7; - -if( 1==1 ) -{ - D = Rand(rows=x1, cols=x2); - s = s + sum(D); -} - + +n = $1; +s = 0; + +x1= n+5; +x2= n+7; + +if( 1==1 ) +{ + D = Rand(rows=x1, cols=x2); + s = s + sum(D); +} + print(s); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rand_recompile2.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rand_recompile2.dml b/src/test/scripts/functions/recompile/rand_recompile2.dml index 0a0bfca..281939b 100644 --- a/src/test/scripts/functions/recompile/rand_recompile2.dml +++ b/src/test/scripts/functions/recompile/rand_recompile2.dml @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -testFun = function (Matrix[double] X) - return (Double s) -{ - if(0==0){} #prevent inlining - - m = nrow(X); - D = Rand(rows=m,cols=1); - s = sum(D); -} - -m = $1; -n = $2; - -X = Rand(rows=10,cols=10); -s = testFun(X); + +testFun = function (Matrix[double] X) + return (Double s) +{ + if(0==0){} #prevent inlining + + m = nrow(X); + D = Rand(rows=m,cols=1); + s = sum(D); +} + +m = $1; +n = $2; + +X = Rand(rows=10,cols=10); +s = testFun(X); print(s); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rand_recompile3.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rand_recompile3.dml b/src/test/scripts/functions/recompile/rand_recompile3.dml index 3cf1300..1faacfa 100644 --- a/src/test/scripts/functions/recompile/rand_recompile3.dml +++ b/src/test/scripts/functions/recompile/rand_recompile3.dml @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -testFun = function (Matrix[double] X) - return (Double s) -{ - if(0==0){} #prevent inlining - - n = ncol(X); - D = Rand(rows=1,cols=n); - s = sum(D); -} - -m = $1; -n = $2; - -X = Rand(rows=10,cols=10); -s = testFun(X); + +testFun = function (Matrix[double] X) + return (Double s) +{ + if(0==0){} #prevent inlining + + n = ncol(X); + D = Rand(rows=1,cols=n); + s = sum(D); +} + +m = $1; +n = $2; + +X = Rand(rows=10,cols=10); +s = testFun(X); print(s); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rand_size_expr_eval.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rand_size_expr_eval.dml b/src/test/scripts/functions/recompile/rand_size_expr_eval.dml index 300f9b1..eddb4a5 100644 --- a/src/test/scripts/functions/recompile/rand_size_expr_eval.dml +++ b/src/test/scripts/functions/recompile/rand_size_expr_eval.dml @@ -19,18 +19,18 @@ # #------------------------------------------------------------- - -m = $1; -n = $2; - -A = matrix(1, rows=m, cols=n); -B = A %*% A; - -C1 = matrix(1, rows=nrow(B)*ncol(B), cols=1); -C2 = matrix(1, rows=1, cols=nrow(B)*ncol(B)); -C3 = matrix(1, rows=(0+1*ncol(B)+1-1/1), cols=(0+1*nrow(B)+1-1/1) ); - -R = matrix(1, rows=1, cols=1); -R[1,1] = sum(C1)+sum(C2)+sum(C3); - + +m = $1; +n = $2; + +A = matrix(1, rows=m, cols=n); +B = A %*% A; + +C1 = matrix(1, rows=nrow(B)*ncol(B), cols=1); +C2 = matrix(1, rows=1, cols=nrow(B)*ncol(B)); +C3 = matrix(1, rows=(0+1*ncol(B)+1-1/1), cols=(0+1*nrow(B)+1-1/1) ); + +R = matrix(1, rows=1, cols=1); +R[1,1] = sum(C1)+sum(C2)+sum(C3); + write(R, $3, format="text"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rblk_recompile1.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rblk_recompile1.R b/src/test/scripts/functions/recompile/rblk_recompile1.R index eb679df..8b29dfe 100644 --- a/src/test/scripts/functions/recompile/rblk_recompile1.R +++ b/src/test/scripts/functions/recompile/rblk_recompile1.R @@ -19,11 +19,11 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -V <- readMM(paste(args[1], "V.mtx", sep="")) + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +V <- readMM(paste(args[1], "V.mtx", sep="")) writeMM(as(V, "CsparseMatrix"), paste(args[2], "Rout", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rblk_recompile1.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rblk_recompile1.dml b/src/test/scripts/functions/recompile/rblk_recompile1.dml index ffafa2b..cdef589 100644 --- a/src/test/scripts/functions/recompile/rblk_recompile1.dml +++ b/src/test/scripts/functions/recompile/rblk_recompile1.dml @@ -19,6 +19,6 @@ # #------------------------------------------------------------- - -V = read($1, rows=$2, cols=1, format="text"); + +V = read($1, rows=$2, cols=1, format="text"); write(V, $3, format="binary"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rblk_recompile2.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rblk_recompile2.R b/src/test/scripts/functions/recompile/rblk_recompile2.R index 4ea8531..3898b44 100644 --- a/src/test/scripts/functions/recompile/rblk_recompile2.R +++ b/src/test/scripts/functions/recompile/rblk_recompile2.R @@ -19,13 +19,13 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -V <- readMM(paste(args[1], "V.mtx", sep="")) -V <- floor(V) -W <- table(as.vector(V)) + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +V <- readMM(paste(args[1], "V.mtx", sep="")) +V <- floor(V) +W <- table(as.vector(V)) writeMM(as(as.matrix(W), "CsparseMatrix"), paste(args[2], "Rout", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rblk_recompile2.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rblk_recompile2.dml b/src/test/scripts/functions/recompile/rblk_recompile2.dml index 44e5761..081d2d3 100644 --- a/src/test/scripts/functions/recompile/rblk_recompile2.dml +++ b/src/test/scripts/functions/recompile/rblk_recompile2.dml @@ -19,7 +19,7 @@ # #------------------------------------------------------------- - -V = read($1, rows=$2, cols=1, format="text"); -W = table(V,1); + +V = read($1, rows=$2, cols=1, format="text"); +W = table(V,1); write(W, $3, format="binary"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rblk_recompile3.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rblk_recompile3.R b/src/test/scripts/functions/recompile/rblk_recompile3.R index 4ea8531..3898b44 100644 --- a/src/test/scripts/functions/recompile/rblk_recompile3.R +++ b/src/test/scripts/functions/recompile/rblk_recompile3.R @@ -19,13 +19,13 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -V <- readMM(paste(args[1], "V.mtx", sep="")) -V <- floor(V) -W <- table(as.vector(V)) + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +V <- readMM(paste(args[1], "V.mtx", sep="")) +V <- floor(V) +W <- table(as.vector(V)) writeMM(as(as.matrix(W), "CsparseMatrix"), paste(args[2], "Rout", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rblk_recompile3.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rblk_recompile3.dml b/src/test/scripts/functions/recompile/rblk_recompile3.dml index a2afc25..1c21579 100644 --- a/src/test/scripts/functions/recompile/rblk_recompile3.dml +++ b/src/test/scripts/functions/recompile/rblk_recompile3.dml @@ -19,8 +19,8 @@ # #------------------------------------------------------------- - -V = read($1, rows=$2, cols=1, format="text"); -W = V*1; -X = aggregate(target=V, groups=W, fn="count"); + +V = read($1, rows=$2, cols=1, format="text"); +W = V*1; +X = aggregate(target=V, groups=W, fn="count"); write(X, $3, format="binary"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/remove_empty_potpourri1.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/remove_empty_potpourri1.R b/src/test/scripts/functions/recompile/remove_empty_potpourri1.R index 622a1a8..eb16ff8 100644 --- a/src/test/scripts/functions/recompile/remove_empty_potpourri1.R +++ b/src/test/scripts/functions/recompile/remove_empty_potpourri1.R @@ -19,13 +19,13 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -M = seq (1, 100, 1) -R = matrix (M, 20, 5, byrow=TRUE) - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +M = seq (1, 100, 1) +R = matrix (M, 20, 5, byrow=TRUE) + writeMM(as(R, "CsparseMatrix"), paste(args[1], "R", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/remove_empty_potpourri1.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/remove_empty_potpourri1.dml b/src/test/scripts/functions/recompile/remove_empty_potpourri1.dml index 7ffc903..37eb904 100644 --- a/src/test/scripts/functions/recompile/remove_empty_potpourri1.dml +++ b/src/test/scripts/functions/recompile/remove_empty_potpourri1.dml @@ -19,7 +19,7 @@ # #------------------------------------------------------------- - -M = seq (1, 100, 1) -R = matrix (M, rows=20, cols=5) + +M = seq (1, 100, 1) +R = matrix (M, rows=20, cols=5) write(R, $1); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/remove_empty_potpourri2.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/remove_empty_potpourri2.R b/src/test/scripts/functions/recompile/remove_empty_potpourri2.R index 945aace..39ef00c 100644 --- a/src/test/scripts/functions/recompile/remove_empty_potpourri2.R +++ b/src/test/scripts/functions/recompile/remove_empty_potpourri2.R @@ -19,12 +19,12 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A = matrix(0, 100, 1); -R = colSums(A) + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A = matrix(0, 100, 1); +R = colSums(A) writeMM(as(R, "CsparseMatrix"), paste(args[1], "R", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/remove_empty_potpourri2.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/remove_empty_potpourri2.dml b/src/test/scripts/functions/recompile/remove_empty_potpourri2.dml index 1c72f17..70027dd 100644 --- a/src/test/scripts/functions/recompile/remove_empty_potpourri2.dml +++ b/src/test/scripts/functions/recompile/remove_empty_potpourri2.dml @@ -19,11 +19,11 @@ # #------------------------------------------------------------- - -A = matrix(0, rows=100,cols=1); -R = colSums(A) - -#force original error on cpvar -if(1==1){} - + +A = matrix(0, rows=100,cols=1); +R = colSums(A) + +#force original error on cpvar +if(1==1){} + write(R, $1); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/remove_empty_potpourri3.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/remove_empty_potpourri3.R b/src/test/scripts/functions/recompile/remove_empty_potpourri3.R index 5f8ea6d..b2fde40 100644 --- a/src/test/scripts/functions/recompile/remove_empty_potpourri3.R +++ b/src/test/scripts/functions/recompile/remove_empty_potpourri3.R @@ -19,17 +19,17 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -S = matrix(1,100,1); -A = diag(as.vector(S)); -B = A %*% S; -C = table (B, seq (1, nrow(A), 1)); -R = colSums(C); -R = R %*% A; - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +S = matrix(1,100,1); +A = diag(as.vector(S)); +B = A %*% S; +C = table (B, seq (1, nrow(A), 1)); +R = colSums(C); +R = R %*% A; + writeMM(as(R, "CsparseMatrix"), paste(args[1], "R", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/remove_empty_potpourri3.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/remove_empty_potpourri3.dml b/src/test/scripts/functions/recompile/remove_empty_potpourri3.dml index c5e8288..a29acd6 100644 --- a/src/test/scripts/functions/recompile/remove_empty_potpourri3.dml +++ b/src/test/scripts/functions/recompile/remove_empty_potpourri3.dml @@ -19,18 +19,18 @@ # #------------------------------------------------------------- - -S = matrix(1,rows=100,cols=1); -if(1==1){} - -A = diag(S); -A = removeEmpty (target = A, margin = "rows"); -B = A %*% S; -C = table (B, seq (1, nrow(A), 1)); -R = removeEmpty (target = C, margin = "rows"); -R = R %*% A; - -if(1==1){} - -print(sum(R)); + +S = matrix(1,rows=100,cols=1); +if(1==1){} + +A = diag(S); +A = removeEmpty (target = A, margin = "rows"); +B = A %*% S; +C = table (B, seq (1, nrow(A), 1)); +R = removeEmpty (target = C, margin = "rows"); +R = R %*% A; + +if(1==1){} + +print(sum(R)); write(R, $1); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/remove_empty_potpourri4.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/remove_empty_potpourri4.R b/src/test/scripts/functions/recompile/remove_empty_potpourri4.R index 36bc892..e07f18f 100644 --- a/src/test/scripts/functions/recompile/remove_empty_potpourri4.R +++ b/src/test/scripts/functions/recompile/remove_empty_potpourri4.R @@ -1,41 +1,41 @@ -#------------------------------------------------------------- -# -# 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(1, 1000, 3); -B = matrix(1, 1000, 2); -C = matrix(7, 1000, 1); -D = matrix(3, 1000, 1); - -E = cbind(X [, 1 : 2], B) * ((C * (1 - D))%*%matrix(1,1,4)); -X = X * C%*%matrix(1,1,3); -n = nrow (X); - -R = X + sum(E) + n; - -cat(sum(R)) - +#------------------------------------------------------------- +# +# 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(1, 1000, 3); +B = matrix(1, 1000, 2); +C = matrix(7, 1000, 1); +D = matrix(3, 1000, 1); + +E = cbind(X [, 1 : 2], B) * ((C * (1 - D))%*%matrix(1,1,4)); +X = X * C%*%matrix(1,1,3); +n = nrow (X); + +R = X + sum(E) + n; + +cat(sum(R)) + writeMM(as(R, "CsparseMatrix"), paste(args[1], "R", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/remove_empty_potpourri4.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/remove_empty_potpourri4.dml b/src/test/scripts/functions/recompile/remove_empty_potpourri4.dml index 54f890c..d651ed6 100644 --- a/src/test/scripts/functions/recompile/remove_empty_potpourri4.dml +++ b/src/test/scripts/functions/recompile/remove_empty_potpourri4.dml @@ -1,42 +1,42 @@ -#------------------------------------------------------------- -# -# 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(1, rows=1000, cols=3); -B = matrix(1, rows=1000, cols=2); -C = matrix(7, rows=1000, cols=1); -D = matrix(3, rows=1000, cols=1); - -if(1==1){} - -tmp = append(X [, 1 : 2], B) * (C * (1 - D)); -E = removeEmpty (target = tmp, margin = "rows"); - -X = removeEmpty (target = X * C, margin = "rows"); -n = nrow (X); - -if(1==1){} - -R = X + sum(E) + n; - -print(sum(R)) - +#------------------------------------------------------------- +# +# 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(1, rows=1000, cols=3); +B = matrix(1, rows=1000, cols=2); +C = matrix(7, rows=1000, cols=1); +D = matrix(3, rows=1000, cols=1); + +if(1==1){} + +tmp = append(X [, 1 : 2], B) * (C * (1 - D)); +E = removeEmpty (target = tmp, margin = "rows"); + +X = removeEmpty (target = X * C, margin = "rows"); +n = nrow (X); + +if(1==1){} + +R = X + sum(E) + n; + +print(sum(R)) + write(R, $1); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/remove_empty_recompile.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/remove_empty_recompile.R b/src/test/scripts/functions/recompile/remove_empty_recompile.R index 41a62df..da11c49 100644 --- a/src/test/scripts/functions/recompile/remove_empty_recompile.R +++ b/src/test/scripts/functions/recompile/remove_empty_recompile.R @@ -19,57 +19,57 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -X <- readMM(paste(args[1], "X.mtx", sep="")) - -type = as.integer(args[2]); - -R = X; - -if( type==0 ){ - R = as.matrix( sum(X) ); -} -if( type==1 ){ - R = round(X); -} -if( type==2 ){ - R = t(X); -} -if( type==3 ){ - R = X*(X-1); -} -if( type==4 ){ - R = (X-1)*X; -} -if( type==5 ){ - R = X+(X-1); -} -if( type==6 ){ - R = (X-1)+X; -} -if( type==7 ){ - R = X-(X+2); -} -if( type==8 ){ - R = (X+2)-X; -} -if( type==9 ){ - R = X%*%(X-1); -} -if( type==10 ){ - R = (X-1)%*%X; -} -if( type==11 ){ - R = X[1:(nrow(X)-1), 1:(ncol(X)-1)]; -} -if( type==12 ){ - X[1,] = X[2,]; - R = X; -} - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +X <- readMM(paste(args[1], "X.mtx", sep="")) + +type = as.integer(args[2]); + +R = X; + +if( type==0 ){ + R = as.matrix( sum(X) ); +} +if( type==1 ){ + R = round(X); +} +if( type==2 ){ + R = t(X); +} +if( type==3 ){ + R = X*(X-1); +} +if( type==4 ){ + R = (X-1)*X; +} +if( type==5 ){ + R = X+(X-1); +} +if( type==6 ){ + R = (X-1)+X; +} +if( type==7 ){ + R = X-(X+2); +} +if( type==8 ){ + R = (X+2)-X; +} +if( type==9 ){ + R = X%*%(X-1); +} +if( type==10 ){ + R = (X-1)%*%X; +} +if( type==11 ){ + R = X[1:(nrow(X)-1), 1:(ncol(X)-1)]; +} +if( type==12 ){ + X[1,] = X[2,]; + R = X; +} + writeMM(as(R, "CsparseMatrix"), paste(args[3], "R", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/remove_empty_recompile.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/remove_empty_recompile.dml b/src/test/scripts/functions/recompile/remove_empty_recompile.dml index 35682bc..a4ee8be 100644 --- a/src/test/scripts/functions/recompile/remove_empty_recompile.dml +++ b/src/test/scripts/functions/recompile/remove_empty_recompile.dml @@ -19,54 +19,54 @@ # #------------------------------------------------------------- - -execFun = function(Matrix[Double] X, Integer type) - return (Matrix[Double] R) -{ - R = X; - - if( type==0 ){ - R = as.matrix( sum(X) ); - } - if( type==1 ){ - R = round(X); - } - if( type==2 ){ - R = t(X); - } - if( type==3 ){ - R = X*(X-1); - } - if( type==4 ){ - R = (X-1)*X; - } - if( type==5 ){ - R = X+(X-1); - } - if( type==6 ){ - R = (X-1)+X; - } - if( type==7 ){ - R = X-(X+2); - } - if( type==8 ){ - R = (X+2)-X; - } - if( type==9 ){ - R = X%*%(X-1); - } - if( type==10 ){ - R = (X-1)%*%X; - } - if( type==11 ){ - R = X[1:(nrow(X)-1), 1:(ncol(X)-1)]; - } - if( type==12 ){ - X[1,] = X[2,]; - R = X; - } -} - -X = read($1); -R = execFun( X, $2 ) + +execFun = function(Matrix[Double] X, Integer type) + return (Matrix[Double] R) +{ + R = X; + + if( type==0 ){ + R = as.matrix( sum(X) ); + } + if( type==1 ){ + R = round(X); + } + if( type==2 ){ + R = t(X); + } + if( type==3 ){ + R = X*(X-1); + } + if( type==4 ){ + R = (X-1)*X; + } + if( type==5 ){ + R = X+(X-1); + } + if( type==6 ){ + R = (X-1)+X; + } + if( type==7 ){ + R = X-(X+2); + } + if( type==8 ){ + R = (X+2)-X; + } + if( type==9 ){ + R = X%*%(X-1); + } + if( type==10 ){ + R = (X-1)%*%X; + } + if( type==11 ){ + R = X[1:(nrow(X)-1), 1:(ncol(X)-1)]; + } + if( type==12 ){ + X[1,] = X[2,]; + R = X; + } +} + +X = read($1); +R = execFun( X, $2 ) write(R, $3); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rewrite_mapmultchain1.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rewrite_mapmultchain1.R b/src/test/scripts/functions/recompile/rewrite_mapmultchain1.R index 23d66e4..72e9b1d 100644 --- a/src/test/scripts/functions/recompile/rewrite_mapmultchain1.R +++ b/src/test/scripts/functions/recompile/rewrite_mapmultchain1.R @@ -19,18 +19,18 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -X <- readMM(paste(args[1], "X.mtx", sep="")) -P <- readMM(paste(args[1], "P.mtx", sep="")) -v <- readMM(paste(args[1], "v.mtx", sep="")) -k = ncol(P); - -Q = P * (X %*% v); -HV = t(X) %*% (Q - P * (rowSums (Q) %*% matrix(1, 1, k))); - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +X <- readMM(paste(args[1], "X.mtx", sep="")) +P <- readMM(paste(args[1], "P.mtx", sep="")) +v <- readMM(paste(args[1], "v.mtx", sep="")) +k = ncol(P); + +Q = P * (X %*% v); +HV = t(X) %*% (Q - P * (rowSums (Q) %*% matrix(1, 1, k))); + writeMM(as(HV, "CsparseMatrix"), paste(args[2], "HV", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rewrite_mapmultchain1.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rewrite_mapmultchain1.dml b/src/test/scripts/functions/recompile/rewrite_mapmultchain1.dml index ac3c7ed..ab4eef2 100644 --- a/src/test/scripts/functions/recompile/rewrite_mapmultchain1.dml +++ b/src/test/scripts/functions/recompile/rewrite_mapmultchain1.dml @@ -19,17 +19,17 @@ # #------------------------------------------------------------- - -X = read($1); -P = read($2); -v = read($3); -k = ncol(P); - -if(1==1){} - -Q = P * (X %*% v); -HV = t(X) %*% (Q - P * (rowSums (Q) %*% matrix(1, rows=1, cols=k))); - -if(1==1){} - -write(HV, $4); + +X = read($1); +P = read($2); +v = read($3); +k = ncol(P); + +if(1==1){} + +Q = P * (X %*% v); +HV = t(X) %*% (Q - P * (rowSums (Q) %*% matrix(1, rows=1, cols=k))); + +if(1==1){} + +write(HV, $4); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rewrite_mapmultchain2.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rewrite_mapmultchain2.R b/src/test/scripts/functions/recompile/rewrite_mapmultchain2.R index 21baaab..1d2ff59 100644 --- a/src/test/scripts/functions/recompile/rewrite_mapmultchain2.R +++ b/src/test/scripts/functions/recompile/rewrite_mapmultchain2.R @@ -19,18 +19,18 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -X <- readMM(paste(args[1], "X.mtx", sep="")) -P <- readMM(paste(args[1], "P.mtx", sep="")) -v <- readMM(paste(args[1], "v.mtx", sep="")) -k = ncol(P); - -Q = P[, 1:k] * (X %*% v); -HV = t(X) %*% (Q - P[, 1:k] * (rowSums (Q) %*% matrix(1, 1, k))); - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +X <- readMM(paste(args[1], "X.mtx", sep="")) +P <- readMM(paste(args[1], "P.mtx", sep="")) +v <- readMM(paste(args[1], "v.mtx", sep="")) +k = ncol(P); + +Q = P[, 1:k] * (X %*% v); +HV = t(X) %*% (Q - P[, 1:k] * (rowSums (Q) %*% matrix(1, 1, k))); + writeMM(as(HV, "CsparseMatrix"), paste(args[2], "HV", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/rewrite_mapmultchain2.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/rewrite_mapmultchain2.dml b/src/test/scripts/functions/recompile/rewrite_mapmultchain2.dml index 0e7a83e..fa4db5f 100644 --- a/src/test/scripts/functions/recompile/rewrite_mapmultchain2.dml +++ b/src/test/scripts/functions/recompile/rewrite_mapmultchain2.dml @@ -19,17 +19,17 @@ # #------------------------------------------------------------- - -X = read($1); -P = read($2); -v = read($3); -k = ncol(P); - -if(1==1){} - -Q = P[, 1:k] * (X %*% v); -HV = t(X) %*% (Q - P[, 1:k] * (rowSums (Q) %*% matrix(1, rows=1, cols=k))); - -if(1==1){} - -write(HV, $4); + +X = read($1); +P = read($2); +v = read($3); +k = ncol(P); + +if(1==1){} + +Q = P[, 1:k] * (X %*% v); +HV = t(X) %*% (Q - P[, 1:k] * (rowSums (Q) %*% matrix(1, rows=1, cols=k))); + +if(1==1){} + +write(HV, $4); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/while_recompile.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/while_recompile.dml b/src/test/scripts/functions/recompile/while_recompile.dml index ba30c92..05dd424 100644 --- a/src/test/scripts/functions/recompile/while_recompile.dml +++ b/src/test/scripts/functions/recompile/while_recompile.dml @@ -19,11 +19,11 @@ # #------------------------------------------------------------- - -V = Rand(rows=$1+1, cols=$2+1, min=$3, max=$3); -Z = Rand(rows=1,cols=1,min=0,max=0); -while( castAsScalar(V[1,1])>castAsScalar(Z[1,1]) ) -{ - Z[1,1] = V[1,1]; -} + +V = Rand(rows=$1+1, cols=$2+1, min=$3, max=$3); +Z = Rand(rows=1,cols=1,min=0,max=0); +while( castAsScalar(V[1,1])>castAsScalar(Z[1,1]) ) +{ + Z[1,1] = V[1,1]; +} write(Z, $4); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/while_recompile_func_sparse.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/while_recompile_func_sparse.dml b/src/test/scripts/functions/recompile/while_recompile_func_sparse.dml index 1870afb..882fd10 100644 --- a/src/test/scripts/functions/recompile/while_recompile_func_sparse.dml +++ b/src/test/scripts/functions/recompile/while_recompile_func_sparse.dml @@ -19,35 +19,35 @@ # #------------------------------------------------------------- - -foo1 = function (Matrix[Double] X) - return (Matrix[Double] Y) -{ - V = X; - print(sum(V)); - i = 1; - while( i <= 1 ) - { - print(sum(V)); - V = foo2(V,i); - i = i+1; - } - Y = V; -} - -foo2 = function (Matrix[Double] X, Integer i) - return (Matrix[Double] Y) -{ - V = X; - j = 1; - while( j <= 1 ) - { - V[i,j] = $2; - j = j+1; - } - Y = V; -} - -V = read($1); -V = foo1( V ); + +foo1 = function (Matrix[Double] X) + return (Matrix[Double] Y) +{ + V = X; + print(sum(V)); + i = 1; + while( i <= 1 ) + { + print(sum(V)); + V = foo2(V,i); + i = i+1; + } + Y = V; +} + +foo2 = function (Matrix[Double] X, Integer i) + return (Matrix[Double] Y) +{ + V = X; + j = 1; + while( j <= 1 ) + { + V[i,j] = $2; + j = j+1; + } + Y = V; +} + +V = read($1); +V = foo1( V ); write(V, $3); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/recompile/while_recompile_sparse.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/recompile/while_recompile_sparse.dml b/src/test/scripts/functions/recompile/while_recompile_sparse.dml index 73fbf0f..c0a9858 100644 --- a/src/test/scripts/functions/recompile/while_recompile_sparse.dml +++ b/src/test/scripts/functions/recompile/while_recompile_sparse.dml @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -V = read($1); -print(sum(V)); -i = 1; -while( i <= 1 ) -{ - print(sum(V)); - - j = 1; - while( j <= 1 ) - { - V[i,j] = $2; - j = j+1; - } - i = i+1; -} + +V = read($1); +print(sum(V)); +i = 1; +while( i <= 1 ) +{ + print(sum(V)); + + j = 1; + while( j <= 1 ) + { + V[i,j] = $2; + j = j+1; + } + i = i+1; +} write(V, $3); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/DiagV2MTest.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/DiagV2MTest.R b/src/test/scripts/functions/reorg/DiagV2MTest.R index d6e0159..7627d42 100644 --- a/src/test/scripts/functions/reorg/DiagV2MTest.R +++ b/src/test/scripts/functions/reorg/DiagV2MTest.R @@ -19,15 +19,15 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) -library("Matrix") -A1=readMM(paste(args[1], "A.mtx", sep="")) -A = as.vector(A1); -B=diag(A) -C=matrix(1, nrow(B), ncol(B)); -D=B%*%C -C=B+D -writeMM(as(C,"CsparseMatrix"), paste(args[2], "C", sep=""), format="text") - + +args <- commandArgs(TRUE) +options(digits=22) +library("Matrix") +A1=readMM(paste(args[1], "A.mtx", sep="")) +A = as.vector(A1); +B=diag(A) +C=matrix(1, nrow(B), ncol(B)); +D=B%*%C +C=B+D +writeMM(as(C,"CsparseMatrix"), paste(args[2], "C", sep=""), format="text") + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/DiagV2MTest.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/DiagV2MTest.dml b/src/test/scripts/functions/reorg/DiagV2MTest.dml index 90341a7..2fdf5c9 100644 --- a/src/test/scripts/functions/reorg/DiagV2MTest.dml +++ b/src/test/scripts/functions/reorg/DiagV2MTest.dml @@ -19,10 +19,10 @@ # #------------------------------------------------------------- - -A=read($1, rows=$2, cols=1, format="text") -B=diag(A) -C=matrix(1, rows=nrow(B), cols=ncol(B)); -D=B%*%C -C=B+D + +A=read($1, rows=$2, cols=1, format="text") +B=diag(A) +C=matrix(1, rows=nrow(B), cols=ncol(B)); +D=B%*%C +C=B+D write(C, $3, format="text") \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/MatrixReshape1.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/MatrixReshape1.R b/src/test/scripts/functions/reorg/MatrixReshape1.R index 5344dff..9532686 100644 --- a/src/test/scripts/functions/reorg/MatrixReshape1.R +++ b/src/test/scripts/functions/reorg/MatrixReshape1.R @@ -19,15 +19,15 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) -library("Matrix") - -X=readMM(paste(args[1], "X.mtx", sep="")) -Y=matrix(t(X),nrow=as.numeric(args[2]),ncol=as.numeric(args[3]),byrow=TRUE) -writeMM(as(Y,"CsparseMatrix"), paste(args[4], "Y", sep=""), format="text") - - - - + +args <- commandArgs(TRUE) +options(digits=22) +library("Matrix") + +X=readMM(paste(args[1], "X.mtx", sep="")) +Y=matrix(t(X),nrow=as.numeric(args[2]),ncol=as.numeric(args[3]),byrow=TRUE) +writeMM(as(Y,"CsparseMatrix"), paste(args[4], "Y", sep=""), format="text") + + + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/MatrixReshape1.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/MatrixReshape1.dml b/src/test/scripts/functions/reorg/MatrixReshape1.dml index e8ad560..6931287 100644 --- a/src/test/scripts/functions/reorg/MatrixReshape1.dml +++ b/src/test/scripts/functions/reorg/MatrixReshape1.dml @@ -19,8 +19,8 @@ # #------------------------------------------------------------- - -X = read($1, rows=$2, cols=$3, format="text"); - -Y = matrix(X, rows=$4, cols=$5, byrow=TRUE); + +X = read($1, rows=$2, cols=$3, format="text"); + +Y = matrix(X, rows=$4, cols=$5, byrow=TRUE); write(Y, $6, format="text"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/MatrixReshape2.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/MatrixReshape2.R b/src/test/scripts/functions/reorg/MatrixReshape2.R index 6963a06..5d59269 100644 --- a/src/test/scripts/functions/reorg/MatrixReshape2.R +++ b/src/test/scripts/functions/reorg/MatrixReshape2.R @@ -19,15 +19,15 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) -library("Matrix") - -X=readMM(paste(args[1], "X.mtx", sep="")) -Y=matrix(X,nrow=as.numeric(args[2]),ncol=as.numeric(args[3]),byrow=FALSE) -writeMM(as(Y,"CsparseMatrix"), paste(args[4], "Y", sep=""), format="text") - - - - + +args <- commandArgs(TRUE) +options(digits=22) +library("Matrix") + +X=readMM(paste(args[1], "X.mtx", sep="")) +Y=matrix(X,nrow=as.numeric(args[2]),ncol=as.numeric(args[3]),byrow=FALSE) +writeMM(as(Y,"CsparseMatrix"), paste(args[4], "Y", sep=""), format="text") + + + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/MatrixReshape2.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/MatrixReshape2.dml b/src/test/scripts/functions/reorg/MatrixReshape2.dml index 9160028..3f6fc7f 100644 --- a/src/test/scripts/functions/reorg/MatrixReshape2.dml +++ b/src/test/scripts/functions/reorg/MatrixReshape2.dml @@ -19,8 +19,8 @@ # #------------------------------------------------------------- - -X = read($1, rows=$2, cols=$3, format="text"); - -Y = matrix(X, rows=$4, cols=$5, byrow=FALSE); + +X = read($1, rows=$2, cols=$3, format="text"); + +Y = matrix(X, rows=$4, cols=$5, byrow=FALSE); write(Y, $6, format="text"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/Order.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/Order.R b/src/test/scripts/functions/reorg/Order.R index e3c1f9d..db5d7f5 100644 --- a/src/test/scripts/functions/reorg/Order.R +++ b/src/test/scripts/functions/reorg/Order.R @@ -19,26 +19,26 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) -library("Matrix") - -A = readMM(paste(args[1], "A.mtx", sep="")) -by = as.integer(args[2]); -desc = as.logical(args[3]); -ixret = as.logical(args[4]); - -col = A[,by]; - -if( ixret ) { - B = order(col, decreasing=desc); -} else { - B = A[order(col, decreasing=desc),]; -} - -writeMM(as(B,"CsparseMatrix"), paste(args[5], "B", sep="")) - - - - + +args <- commandArgs(TRUE) +options(digits=22) +library("Matrix") + +A = readMM(paste(args[1], "A.mtx", sep="")) +by = as.integer(args[2]); +desc = as.logical(args[3]); +ixret = as.logical(args[4]); + +col = A[,by]; + +if( ixret ) { + B = order(col, decreasing=desc); +} else { + B = A[order(col, decreasing=desc),]; +} + +writeMM(as(B,"CsparseMatrix"), paste(args[5], "B", sep="")) + + + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/Order.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/Order.dml b/src/test/scripts/functions/reorg/Order.dml index aa45aad..3ac2fce 100644 --- a/src/test/scripts/functions/reorg/Order.dml +++ b/src/test/scripts/functions/reorg/Order.dml @@ -19,11 +19,11 @@ # #------------------------------------------------------------- - -A = read($1); - -if(1==1){} #for recompilation rewrites - -B = order(target=A, by=$2, decreasing=$3, index.return=$4); - + +A = read($1); + +if(1==1){} #for recompilation rewrites + +B = order(target=A, by=$2, decreasing=$3, index.return=$4); + write(B, $5, format="text"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/OrderDyn.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/OrderDyn.R b/src/test/scripts/functions/reorg/OrderDyn.R index 74bc47b..5eb3518 100644 --- a/src/test/scripts/functions/reorg/OrderDyn.R +++ b/src/test/scripts/functions/reorg/OrderDyn.R @@ -19,25 +19,25 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) -library("Matrix") - -A = readMM(paste(args[1], "A.mtx", sep="")) -by = as.integer(args[2]); -desc = (sum(A)>100) -ixret = (sum(A)>200) -col = A[,by]; - -if( ixret ) { - B = order(col, decreasing=desc); -} else { - B = A[order(col, decreasing=desc),]; -} - -writeMM(as(B,"CsparseMatrix"), paste(args[5], "B", sep="")) - - - - + +args <- commandArgs(TRUE) +options(digits=22) +library("Matrix") + +A = readMM(paste(args[1], "A.mtx", sep="")) +by = as.integer(args[2]); +desc = (sum(A)>100) +ixret = (sum(A)>200) +col = A[,by]; + +if( ixret ) { + B = order(col, decreasing=desc); +} else { + B = A[order(col, decreasing=desc),]; +} + +writeMM(as(B,"CsparseMatrix"), paste(args[5], "B", sep="")) + + + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/OrderDyn.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/OrderDyn.dml b/src/test/scripts/functions/reorg/OrderDyn.dml index f8c6558..35f4d0a 100644 --- a/src/test/scripts/functions/reorg/OrderDyn.dml +++ b/src/test/scripts/functions/reorg/OrderDyn.dml @@ -19,13 +19,13 @@ # #------------------------------------------------------------- - -A = read($1); - -if(1==1){} #for recompilation rewrites - -desc = (sum(A)>100) -ixret = (sum(A)>200) -B = order(target=A, by=$2, decreasing=desc, index.return=ixret); - + +A = read($1); + +if(1==1){} #for recompilation rewrites + +desc = (sum(A)>100) +ixret = (sum(A)>200) +B = order(target=A, by=$2, decreasing=desc, index.return=ixret); + write(B, $5, format="text"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/Reverse1.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/Reverse1.R b/src/test/scripts/functions/reorg/Reverse1.R index 7537fe9..1599d60 100644 --- a/src/test/scripts/functions/reorg/Reverse1.R +++ b/src/test/scripts/functions/reorg/Reverse1.R @@ -1,41 +1,41 @@ -#------------------------------------------------------------- -# -# 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") - -A = as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) - -B = matrix(0, nrow(A), ncol(A)); -for( i in 1:ncol(A) ) -{ - col = as.vector(A[,i]) - col = rev(col); - B[,i] = col; -} - -writeMM(as(B,"CsparseMatrix"), paste(args[2], "B", sep="")) - - - - +#------------------------------------------------------------- +# +# 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") + +A = as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) + +B = matrix(0, nrow(A), ncol(A)); +for( i in 1:ncol(A) ) +{ + col = as.vector(A[,i]) + col = rev(col); + B[,i] = col; +} + +writeMM(as(B,"CsparseMatrix"), paste(args[2], "B", sep="")) + + + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/reorg/Reverse1.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/reorg/Reverse1.dml b/src/test/scripts/functions/reorg/Reverse1.dml index 586d05a..7a7abe6 100644 --- a/src/test/scripts/functions/reorg/Reverse1.dml +++ b/src/test/scripts/functions/reorg/Reverse1.dml @@ -1,25 +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. -# -#------------------------------------------------------------- - - -A = read($1); -B = rev(A); +#------------------------------------------------------------- +# +# 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. +# +#------------------------------------------------------------- + + +A = read($1); +B = rev(A); write(B, $2); \ No newline at end of file
