Hi Kuno,

Thanks for trying out SystemML. One way to implement your logic in SystemML
is as follows:
X = matrix("1 4 -99 2 5 -99", rows=6, cols=1)
Y = removeEmpty(target=(X > 2)*seq(1, nrow(X)), margin="rows")
print("\nIndexes:\n" + toString(Y))

For handling NAs, you can replace NAs by certain value (in this case -99 or
one of the builtin constants, i.e. Inf or NaN ... see
) using the "na.strings" parameter of the transform builtin function (

Hope this helps.


Niketan Pansare
IBM Almaden Research Center
E-mail: npansar At us.ibm.com

From: "Baeriswyl Kuno (IT-SWE-CC1-JV6)" <[EMAIL PROTECTED]>
Date: 07/05/2018 05:29 AM
Subject: which() Function in SystemML


I'm a developer want to use SystemMl for running R-Code from our business
people on a Spark cluster.

I've studied
 , however, haven't found a implementation of the R function "which" or any
alternative functionality. Has anyone an idea how I could

# Given
v = c(1,4,NA,2, 5, NA)

# Expect indexes where value meets condition =  int[] 2 5
v2 = which(v>2)

# Expect indexes where is.na returns TRUE =   int[] 3 6
v3 = which(is.na(v))

I've already considered the functions replace() and removeEmpty(), but they
don't exactly meets my needs.

Thanks a lot in advance
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB