Repository: systemml
Updated Branches:
  refs/heads/gh-pages 936846406 -> 36e9f1f21


[SYSTEMML-2135] Extended removeEmpty with outputs of zero rows/cols

This patch extends the support for matrices with zero rows and columns
to removeEmpty. So far this operation returned a single row/column of
zeros for empty inputs. For backwards compatibility, we keep these
semantics, but introduce a new flag that allows to disable this special
case in order to return matrices with zero rows and columns,
respectively. In addition, this patch also includes the related update
of the dml language guide.


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

Branch: refs/heads/gh-pages
Commit: 34d817b31e3d13e10f920b4033fa86b9c49b29c7
Parents: 9368464
Author: Matthias Boehm <mboe...@gmail.com>
Authored: Thu Feb 8 18:12:32 2018 -0800
Committer: Matthias Boehm <mboe...@gmail.com>
Committed: Thu Feb 8 22:04:03 2018 -0800

----------------------------------------------------------------------
 dml-language-reference.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/34d817b3/dml-language-reference.md
----------------------------------------------------------------------
diff --git a/dml-language-reference.md b/dml-language-reference.md
index 5fb9de5..355b507 100644
--- a/dml-language-reference.md
+++ b/dml-language-reference.md
@@ -648,7 +648,7 @@ nrow(), <br/> ncol(), <br/> length() | Return the number of 
rows, number of colu
 prod() | Return the product of all cells in matrix | Input: matrix <br/> 
Output: scalarj | prod(X)
 rand() | Generates a random matrix | Input: (rows=&lt;value&gt;, 
cols=&lt;value&gt;, min=&lt;value&gt;, max=&lt;value&gt;, 
sparsity=&lt;value&gt;, pdf=&lt;string&gt;, seed=&lt;value&gt;) <br/> 
rows/cols: Number of rows/cols (expression) <br/> min/max: Min/max value for 
cells (either constant value, or variable that evaluates to constant value) 
<br/> sparsity: fraction of non-zero cells (constant value) <br/> pdf: 
"uniform" (min, max) distribution, or "normal" (0,1) distribution; or "poisson" 
(lambda=1) distribution. string; default value is "uniform". Note that, for the 
Poisson distribution, users can provide the mean/lambda parameter as follows: 
<br/> rand(rows=1000,cols=1000, pdf="poisson", lambda=2.5). <br/> The default 
value for lambda is 1. <br/> seed: Every invocation of rand() internally 
generates a random seed with which the cell values are generated. One can 
optionally provide a seed when repeatability is desired.  <br/> Output: matrix 
| X = rand(rows=10, cols=20, min=0, m
 ax=1, pdf="uniform", sparsity=0.2) <br/> The example generates a 10 x 20 
matrix, with cell values uniformly chosen at random between 0 and 1, and 
approximately 20% of cells will have non-zero values.
 rbind() | Row-wise matrix concatenation. Concatenates the second matrix as 
additional rows to the first matrix | Input: (X &lt;matrix&gt;, Y 
&lt;matrix&gt;) <br/>Output: &lt;matrix&gt; <br/> X and Y are matrices, where 
the number of columns in X and the number of columns in Y are the same. | A = 
matrix(1, rows=2,cols=3) <br/> B = matrix(2, rows=2,cols=3) <br/> C = 
rbind(A,B) <br/> print("Dimensions of C: " + nrow(C) + " X " + ncol(C)) <br/> 
Output: <br/> Dimensions of C: 4 X 3
-removeEmpty() | Removes all empty rows or columns from the input matrix target 
X according to the specified margin. Also, allows to apply a filter F before 
removing the empty rows/cols. | Input : (target= X &lt;matrix&gt;, 
margin="...", select=F) <br/> Output : &lt;matrix&gt; <br/> Valid values for 
margin are "rows" or "cols". | A = removeEmpty(target=X, margin="rows", 
select=F)
+removeEmpty() | Removes all empty rows or columns from the input matrix target 
X according to the specified margin. The optional select vector F specifies 
selected rows or columns; if not provided, the semantics are 
F=(rowSums(X!=0)&gt;0) and F=(colSums(X!=0)&gt;0) for removeEmpty "rows" and 
"cols", respectively. The optional empty.return flag indicates if a row or 
column of zeros should be returned for empty inputs. | Input : (target= X 
&lt;matrix&gt;, margin="..."[, select=F][, empty.return=TRUE]) <br/> Output : 
&lt;matrix&gt; <br/> Valid values for margin are "rows" or "cols". | A = 
removeEmpty(target=X, margin="rows", select=F)
 replace() | Creates a copy of input matrix X, where all values that are equal 
to the scalar pattern s1 are replaced with the scalar replacement s2. | Input : 
(target= X &lt;matrix&gt;, pattern=&lt;scalar&gt;, replacement=&lt;scalar&gt;) 
<br/> Output : &lt;matrix&gt; <br/> If s1 is NaN, then all NaN values of X are 
treated as equal and hence replaced with s2. Positive and negative infinity are 
treated as different values. | A = replace(target=X, pattern=s1, replacement=s2)
 rev() | Reverses the rows in a matrix | Input : (&lt;matrix&gt;) <br/> Output 
: &lt;matrix&gt; | <span style="white-space: nowrap;">A = matrix("1 2 3 4", 
rows=2, cols=2)</span> <br/> <span style="white-space: nowrap;">B = matrix("1 2 
3 4", rows=4, cols=1)</span> <br/> <span style="white-space: nowrap;">C = 
matrix("1 2 3 4", rows=1, cols=4)</span> <br/> revA = rev(A) <br/> revB = 
rev(B) <br/> revC = rev(C) <br/> Matrix revA: [[3, 4], [1, 2]]<br/> Matrix 
revB: [[4], [3], [2], [1]]<br/> Matrix revC: [[1, 2, 3, 4]]<br/>
 seq() | Creates a single column vector with values starting from &lt;from&gt;, 
to &lt;to&gt;, in increments of &lt;increment&gt; | Input: (&lt;from&gt;, 
&lt;to&gt;, &lt;increment&gt;) <br/> Output: &lt;matrix&gt; | S = seq (10, 200, 
10)

Reply via email to