[ https://issues.apache.org/jira/browse/SPARK-9003?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yanbo Liang updated SPARK-9003: ------------------------------- Description: MLlib/Vector only support foreachActive function and is short of map/update which is inconvenience for some Vector operations. For example: val a = Vectors.dense(...) If we want to compute math.log for each elements of a and get Vector as return value, we can only code as: val b = Vectors.dense(a.toArray.map(math.log)) or we can use "toBreeze" and "fromBreeze" make transformation with breeze API. The code snippet is not elegant, we want it can implement: val c = a.map(math.log) Also currently MLlib/Matrix has implemented map/update/foreachActive function. I think Vector should also has map/update. was: MLlib/Vector only support foreachActive function and is short of map/update which is inconvenience for some Vector operations. For example: val a = Vectors.dense(...) If we want to compute math.log for each elements of a and get Vector as return value, we can only code as: val b = Vectors.dense(a.toArray.map(math.log)) or we can use "toBreeze" and make transformation with breeze API. The code snippet is not elegant, we want it can implement: val c = a.map(math.log) Also currently MLlib/Matrix has implemented map/update/foreachActive function. I think Vector should also has map/update. > Add map/update function to MLlib/Vector > --------------------------------------- > > Key: SPARK-9003 > URL: https://issues.apache.org/jira/browse/SPARK-9003 > Project: Spark > Issue Type: Improvement > Components: MLlib > Reporter: Yanbo Liang > Priority: Minor > > MLlib/Vector only support foreachActive function and is short of map/update > which is inconvenience for some Vector operations. > For example: > val a = Vectors.dense(...) > If we want to compute math.log for each elements of a and get Vector as > return value, we can only code as: > val b = Vectors.dense(a.toArray.map(math.log)) > or we can use "toBreeze" and "fromBreeze" make transformation with breeze API. > The code snippet is not elegant, we want it can implement: > val c = a.map(math.log) > Also currently MLlib/Matrix has implemented map/update/foreachActive > function. I think Vector should also has map/update. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org