[ https://issues.apache.org/jira/browse/SPARK-10127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14705524#comment-14705524 ]
Joseph K. Bradley commented on SPARK-10127: ------------------------------------------- There have been a number of discussions about whether we should develop a fully local linear algebra library. It will be important to follow a consistent API which has a global design, rather than built up incrementally. There is already a design doc: [SPARK-6442], and further additions should probably be discussed on that JIRA. Could you please close your PR for now, pending discussion on that JIRA? For now, users can use existing libraries such as Breeze. Thanks! > Add numpy-like indexing interface for DenceMatrix > ------------------------------------------------- > > Key: SPARK-10127 > URL: https://issues.apache.org/jira/browse/SPARK-10127 > Project: Spark > Issue Type: New Feature > Components: MLlib > Affects Versions: 1.4.1 > Reporter: Hiroshi Takahashi > > Currently, we don't have good interface to access sub-matrix. > It's inconvenience to prototype manipulate matrix via spark-shell for the > reason. > My suggestion is to add operator "!" as operator of accessing sub-matrix > instead of numpy's (). > for example: > {code} > scala> import org.apache.spark.mllib.linalg.DenseMatrix > import org.apache.spark.mllib.linalg.DenseMatrix > scala> val dm = new DenseMatrix(3, 3, Array(1.0, 4.0, 7.0, 2.0, 5.0, 8.0, > 3.0, 6.0, 9.0)) > dm: org.apache.spark.mllib.linalg.DenseMatrix = > 1.0 2.0 3.0 > 4.0 5.0 6.0 > 7.0 8.0 9.0 > // get row > scala> dm!(1) > res0: org.apache.spark.mllib.linalg.DenseMatrix = 4.0 5.0 6.0 > // get (i, j) > scala> dm!(1, 2) > res1: Double = 6.0 > // get colmun > scala> dm!((), 1) > res2: org.apache.spark.mllib.linalg.DenseMatrix = > 2.0 > 5.0 > 8.0 > // get columns between i and j-1 > scala> dm!((), (1, 3)) > res3: org.apache.spark.mllib.linalg.DenseMatrix = > 2.0 3.0 > 5.0 6.0 > 8.0 9.0 > // get rows between i and j-1 > scala> dm!((1, 3)) > res4: org.apache.spark.mllib.linalg.DenseMatrix = > 4.0 5.0 6.0 > 7.0 8.0 9.0 > // get sub-matrix between (i1, j1-1) and (i2, j2-1) > scala> dm!((1, 3), (1, 3)) > res5: org.apache.spark.mllib.linalg.DenseMatrix = > 5.0 6.0 > 8.0 9.0 > {code} -- 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