{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/35236567","id":35236567,"diff_hunk":"@@ -431,7 +454,42 @@ long n = mat.numCols();\n // Drop its row indices.\n RowMatrix rowMat = mat.toRowMatrix();\n {% endhighlight %}\n-</div></div>\n+</div>\n+\n+<div data-lang=\"python\" markdown=\"1\">\n+\n+An [`IndexedRowMatrix`](api/python/pyspark.mllib.html#pyspark.mllib.linalg.IndexedRowMatrix) can be created from an \n+`RDD` of IndexedRows, where [`IndexedRow`](api/python/pyspark.mllib.html#pyspark.mllib.linalg.IndexedRow) is a \n+wrapper over `(long, Vector)`.  An `IndexedRowMatrix` can be converted to a `RowMatrix` by dropping its row indices.","path":"docs/mllib-data-types.md","position":41,"original_position":41,"commit_id":"f0c19a015778e5086b50398d7e24787f80b68c0d","original_commit_id":"f0c19a015778e5086b50398d7e24787f80b68c0d","user":{"login":"MechCoder","id":1867024,"avatar_url":"https://avatars.githubusercontent.com/u/1867024?v=3","gravatar_id":"","url":"https://api.github.com/users/MechCoder","html_url":"https://github.com/MechCoder","followers_url":"https://api.github.com/users/MechCoder/followers","following_url":"https://api.github.com/users/MechCoder/following{/other_user}","gists_url":"https://api.github.com/users/MechCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/MechCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MechCoder/subscriptions","organizations_url":"https://api.github.com/users/MechCoder/orgs","repos_url":"https://api.github.com/users/MechCoder/repos","events_url":"https://api.github.com/users/MechCoder/events{/privacy}","received_events_url":"https://api.github.com/users/MechCoder/received_events","type":"User","site_admin":false},"body":"Going by the code samples below, I assume it is not necessary to be long anymore?","created_at":"2015-07-22T17:02:12Z","updated_at":"2015-07-22T17:02:12Z","html_url":"https://github.com/apache/spark/pull/7554#discussion_r35236567","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/7554","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/35236567"},"html":{"href":"https://github.com/apache/spark/pull/7554#discussion_r35236567"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/7554"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/7554","id":40416926,"html_url":"https://github.com/apache/spark/pull/7554","diff_url":"https://github.com/apache/spark/pull/7554.diff","patch_url":"https://github.com/apache/spark/pull/7554.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/7554","number":7554,"state":"open","locked":false,"title":"[SPARK-6485] [MLlib] [Python] Add CoordinateMatrix/RowMatrix/IndexedRowMatrix to PySpark.","user":{"login":"dusenberrymw","id":5431337,"avatar_url":"https://avatars.githubusercontent.com/u/5431337?v=3","gravatar_id":"","url":"https://api.github.com/users/dusenberrymw","html_url":"https://github.com/dusenberrymw","followers_url":"https://api.github.com/users/dusenberrymw/followers","following_url":"https://api.github.com/users/dusenberrymw/following{/other_user}","gists_url":"https://api.github.com/users/dusenberrymw/gists{/gist_id}","starred_url":"https://api.github.com/users/dusenberrymw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dusenberrymw/subscriptions","organizations_url":"https://api.github.com/users/dusenberrymw/orgs","repos_url":"https://api.github.com/users/dusenberrymw/repos","events_url":"https://api.github.com/users/dusenberrymw/events{/privacy}","received_events_url":"https://api.github.com/users/dusenberrymw/received_events","type":"User","site_admin":false},"body":"This PR adds the RowMatrix, IndexedRowMatrix, and CoordinateMatrix distributed matrices to PySpark.  Each distributed matrix class acts as a wrapper around the Scala/Java counterpart by maintaining a reference to the Java object.  New distributed matrices can be created using factory methods added to DistributedMatrices, which creates the Java distributed matrix and then wraps it with the corresponding PySpark class.  This design allows for simple conversion between the various distributed matrices, and lets us re-use the Scala code.  Serialization between Python and Java is implemented using DataFrames as needed for IndexedRowMatrix and CoordinateMatrix for simplicity.  Associated documentation and unit-tests have also been added.  To facilitate code review, this PR implements access to the rows/entries as RDDs, the number of rows & columns, and conversions between the various distributed matrices (not including BlockMatrix), and does not implement the other linear algebra functions of the matrices, although this will be very simple to add now.","created_at":"2015-07-21T02:23:11Z","updated_at":"2015-07-22T17:02:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d55f1db6065f00e85e9c7dfdda1a3b5aba0144fd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/7554/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/7554/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/7554/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/f0c19a015778e5086b50398d7e24787f80b68c0d","head":{"label":"dusenberrymw:SPARK-6485_Add_CoordinateMatrix_RowMatrix_IndexedMatrix_to_PySpark","ref":"SPARK-6485_Add_CoordinateMatrix_RowMatrix_IndexedMatrix_to_PySpark","sha":"f0c19a015778e5086b50398d7e24787f80b68c0d","user":{"login":"dusenberrymw","id":5431337,"avatar_url":"https://avatars.githubusercontent.com/u/5431337?v=3","gravatar_id":"","url":"https://api.github.com/users/dusenberrymw","html_url":"https://github.com/dusenberrymw","followers_url":"https://api.github.com/users/dusenberrymw/followers","following_url":"https://api.github.com/users/dusenberrymw/following{/other_user}","gists_url":"https://api.github.com/users/dusenberrymw/gists{/gist_id}","starred_url":"https://api.github.com/users/dusenberrymw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dusenberrymw/subscriptions","organizations_url":"https://api.github.com/users/dusenberrymw/orgs","repos_url":"https://api.github.com/users/dusenberrymw/repos","events_url":"https://api.github.com/users/dusenberrymw/events{/privacy}","received_events_url":"https://api.github.com/users/dusenberrymw/received_events","type":"User","site_admin":false},"repo":{"id":35676174,"name":"spark","full_name":"dusenberrymw/spark","owner":{"login":"dusenberrymw","id":5431337,"avatar_url":"https://avatars.githubusercontent.com/u/5431337?v=3","gravatar_id":"","url":"https://api.github.com/users/dusenberrymw","html_url":"https://github.com/dusenberrymw","followers_url":"https://api.github.com/users/dusenberrymw/followers","following_url":"https://api.github.com/users/dusenberrymw/following{/other_user}","gists_url":"https://api.github.com/users/dusenberrymw/gists{/gist_id}","starred_url":"https://api.github.com/users/dusenberrymw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dusenberrymw/subscriptions","organizations_url":"https://api.github.com/users/dusenberrymw/orgs","repos_url":"https://api.github.com/users/dusenberrymw/repos","events_url":"https://api.github.com/users/dusenberrymw/events{/privacy}","received_events_url":"https://api.github.com/users/dusenberrymw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dusenberrymw/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/dusenberrymw/spark","forks_url":"https://api.github.com/repos/dusenberrymw/spark/forks","keys_url":"https://api.github.com/repos/dusenberrymw/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dusenberrymw/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dusenberrymw/spark/teams","hooks_url":"https://api.github.com/repos/dusenberrymw/spark/hooks","issue_events_url":"https://api.github.com/repos/dusenberrymw/spark/issues/events{/number}","events_url":"https://api.github.com/repos/dusenberrymw/spark/events","assignees_url":"https://api.github.com/repos/dusenberrymw/spark/assignees{/user}","branches_url":"https://api.github.com/repos/dusenberrymw/spark/branches{/branch}","tags_url":"https://api.github.com/repos/dusenberrymw/spark/tags","blobs_url":"https://api.github.com/repos/dusenberrymw/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dusenberrymw/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dusenberrymw/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/dusenberrymw/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dusenberrymw/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/dusenberrymw/spark/languages","stargazers_url":"https://api.github.com/repos/dusenberrymw/spark/stargazers","contributors_url":"https://api.github.com/repos/dusenberrymw/spark/contributors","subscribers_url":"https://api.github.com/repos/dusenberrymw/spark/subscribers","subscription_url":"https://api.github.com/repos/dusenberrymw/spark/subscription","commits_url":"https://api.github.com/repos/dusenberrymw/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/dusenberrymw/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/dusenberrymw/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/dusenberrymw/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/dusenberrymw/spark/contents/{+path}","compare_url":"https://api.github.com/repos/dusenberrymw/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dusenberrymw/spark/merges","archive_url":"https://api.github.com/repos/dusenberrymw/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dusenberrymw/spark/downloads","issues_url":"https://api.github.com/repos/dusenberrymw/spark/issues{/number}","pulls_url":"https://api.github.com/repos/dusenberrymw/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/dusenberrymw/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/dusenberrymw/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dusenberrymw/spark/labels{/name}","releases_url":"https://api.github.com/repos/dusenberrymw/spark/releases{/id}","created_at":"2015-05-15T13:41:57Z","updated_at":"2015-05-15T13:42:19Z","pushed_at":"2015-07-21T23:14:47Z","git_url":"git://github.com/dusenberrymw/spark.git","ssh_url":"git@github.com:dusenberrymw/spark.git","clone_url":"https://github.com/dusenberrymw/spark.git","svn_url":"https://github.com/dusenberrymw/spark","homepage":null,"size":113094,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"936a96cb31a6dd7d8685bce05103e779ca02e763","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","created_at":"2014-02-25T08:00:08Z","updated_at":"2015-07-22T13:31:37Z","pushed_at":"2015-07-22T16:47:17Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":1558510,"stargazers_count":4827,"watchers_count":4827,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4334,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":340,"forks":4334,"open_issues":340,"watchers":4827,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/7554"},"html":{"href":"https://github.com/apache/spark/pull/7554"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/7554"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/7554/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/7554/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/7554/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/f0c19a015778e5086b50398d7e24787f80b68c0d"}}}}