{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/30384574","id":30384574,"diff_hunk":"@@ -717,6 +719,23 @@ class SparseVector(\n       new SparseVector(size, ii, vv)\n     }\n   }\n+\n+  override def argmax: Int = {\n+    if (size == 0) {\n+      -1\n+    } else {\n+      var maxIdx = indices(0)\n+      var maxValue = values(0)\n+\n+      foreachActive { (i, v) =>","path":"mllib/src/main/scala/org/apache/spark/mllib/linalg/Vectors.scala","position":38,"original_position":38,"commit_id":"df9538a51d02e35ea12a0759726975ecb1a89981","original_commit_id":"df9538a51d02e35ea12a0759726975ecb1a89981","user":{"login":"GeorgeDittmar","id":589530,"avatar_url":"https://avatars.githubusercontent.com/u/589530?v=3","gravatar_id":"","url":"https://api.github.com/users/GeorgeDittmar","html_url":"https://github.com/GeorgeDittmar","followers_url":"https://api.github.com/users/GeorgeDittmar/followers","following_url":"https://api.github.com/users/GeorgeDittmar/following{/other_user}","gists_url":"https://api.github.com/users/GeorgeDittmar/gists{/gist_id}","starred_url":"https://api.github.com/users/GeorgeDittmar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeorgeDittmar/subscriptions","organizations_url":"https://api.github.com/users/GeorgeDittmar/orgs","repos_url":"https://api.github.com/users/GeorgeDittmar/repos","events_url":"https://api.github.com/users/GeorgeDittmar/events{/privacy}","received_events_url":"https://api.github.com/users/GeorgeDittmar/received_events","type":"User","site_admin":false},"body":"Wait are you getting at say I have a sparse vector with zero in it and an assigned index? Like indices = (1,2,3) values = (-1,0,-.5)? If thats the case then yes I now see what you are saying but doesnt that same behavior then happen in dense vectors as well right now?","created_at":"2015-05-15T04:36:24Z","updated_at":"2015-05-15T04:36:24Z","html_url":"https://github.com/apache/spark/pull/6112#discussion_r30384574","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/6112","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/30384574"},"html":{"href":"https://github.com/apache/spark/pull/6112#discussion_r30384574"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/6112"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/6112","id":35297851,"html_url":"https://github.com/apache/spark/pull/6112","diff_url":"https://github.com/apache/spark/pull/6112.diff","patch_url":"https://github.com/apache/spark/pull/6112.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/6112","number":6112,"state":"open","locked":false,"title":"[Spark-7422][MLLIB] Add argmax to Vector, SparseVector","user":{"login":"GeorgeDittmar","id":589530,"avatar_url":"https://avatars.githubusercontent.com/u/589530?v=3","gravatar_id":"","url":"https://api.github.com/users/GeorgeDittmar","html_url":"https://github.com/GeorgeDittmar","followers_url":"https://api.github.com/users/GeorgeDittmar/followers","following_url":"https://api.github.com/users/GeorgeDittmar/following{/other_user}","gists_url":"https://api.github.com/users/GeorgeDittmar/gists{/gist_id}","starred_url":"https://api.github.com/users/GeorgeDittmar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeorgeDittmar/subscriptions","organizations_url":"https://api.github.com/users/GeorgeDittmar/orgs","repos_url":"https://api.github.com/users/GeorgeDittmar/repos","events_url":"https://api.github.com/users/GeorgeDittmar/events{/privacy}","received_events_url":"https://api.github.com/users/GeorgeDittmar/received_events","type":"User","site_admin":false},"body":"Modifying Vector, DenseVector, and SparseVector to implement argmax functionality. This work is to set the stage for changes to be done in Spark-7423.","created_at":"2015-05-13T06:32:03Z","updated_at":"2015-05-15T04:36:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"390c9b0867f3698d14affb6b4af9cc19d477675b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/6112/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/6112/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/6112/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/df9538a51d02e35ea12a0759726975ecb1a89981","head":{"label":"GeorgeDittmar:SPARK-7422","ref":"SPARK-7422","sha":"df9538a51d02e35ea12a0759726975ecb1a89981","user":{"login":"GeorgeDittmar","id":589530,"avatar_url":"https://avatars.githubusercontent.com/u/589530?v=3","gravatar_id":"","url":"https://api.github.com/users/GeorgeDittmar","html_url":"https://github.com/GeorgeDittmar","followers_url":"https://api.github.com/users/GeorgeDittmar/followers","following_url":"https://api.github.com/users/GeorgeDittmar/following{/other_user}","gists_url":"https://api.github.com/users/GeorgeDittmar/gists{/gist_id}","starred_url":"https://api.github.com/users/GeorgeDittmar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeorgeDittmar/subscriptions","organizations_url":"https://api.github.com/users/GeorgeDittmar/orgs","repos_url":"https://api.github.com/users/GeorgeDittmar/repos","events_url":"https://api.github.com/users/GeorgeDittmar/events{/privacy}","received_events_url":"https://api.github.com/users/GeorgeDittmar/received_events","type":"User","site_admin":false},"repo":{"id":35392096,"name":"spark","full_name":"GeorgeDittmar/spark","owner":{"login":"GeorgeDittmar","id":589530,"avatar_url":"https://avatars.githubusercontent.com/u/589530?v=3","gravatar_id":"","url":"https://api.github.com/users/GeorgeDittmar","html_url":"https://github.com/GeorgeDittmar","followers_url":"https://api.github.com/users/GeorgeDittmar/followers","following_url":"https://api.github.com/users/GeorgeDittmar/following{/other_user}","gists_url":"https://api.github.com/users/GeorgeDittmar/gists{/gist_id}","starred_url":"https://api.github.com/users/GeorgeDittmar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeorgeDittmar/subscriptions","organizations_url":"https://api.github.com/users/GeorgeDittmar/orgs","repos_url":"https://api.github.com/users/GeorgeDittmar/repos","events_url":"https://api.github.com/users/GeorgeDittmar/events{/privacy}","received_events_url":"https://api.github.com/users/GeorgeDittmar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/GeorgeDittmar/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/GeorgeDittmar/spark","forks_url":"https://api.github.com/repos/GeorgeDittmar/spark/forks","keys_url":"https://api.github.com/repos/GeorgeDittmar/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GeorgeDittmar/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GeorgeDittmar/spark/teams","hooks_url":"https://api.github.com/repos/GeorgeDittmar/spark/hooks","issue_events_url":"https://api.github.com/repos/GeorgeDittmar/spark/issues/events{/number}","events_url":"https://api.github.com/repos/GeorgeDittmar/spark/events","assignees_url":"https://api.github.com/repos/GeorgeDittmar/spark/assignees{/user}","branches_url":"https://api.github.com/repos/GeorgeDittmar/spark/branches{/branch}","tags_url":"https://api.github.com/repos/GeorgeDittmar/spark/tags","blobs_url":"https://api.github.com/repos/GeorgeDittmar/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GeorgeDittmar/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GeorgeDittmar/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/GeorgeDittmar/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GeorgeDittmar/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/GeorgeDittmar/spark/languages","stargazers_url":"https://api.github.com/repos/GeorgeDittmar/spark/stargazers","contributors_url":"https://api.github.com/repos/GeorgeDittmar/spark/contributors","subscribers_url":"https://api.github.com/repos/GeorgeDittmar/spark/subscribers","subscription_url":"https://api.github.com/repos/GeorgeDittmar/spark/subscription","commits_url":"https://api.github.com/repos/GeorgeDittmar/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/GeorgeDittmar/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/GeorgeDittmar/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/GeorgeDittmar/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/GeorgeDittmar/spark/contents/{+path}","compare_url":"https://api.github.com/repos/GeorgeDittmar/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GeorgeDittmar/spark/merges","archive_url":"https://api.github.com/repos/GeorgeDittmar/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GeorgeDittmar/spark/downloads","issues_url":"https://api.github.com/repos/GeorgeDittmar/spark/issues{/number}","pulls_url":"https://api.github.com/repos/GeorgeDittmar/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/GeorgeDittmar/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/GeorgeDittmar/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GeorgeDittmar/spark/labels{/name}","releases_url":"https://api.github.com/repos/GeorgeDittmar/spark/releases{/id}","created_at":"2015-05-10T23:25:58Z","updated_at":"2015-05-10T23:26:19Z","pushed_at":"2015-05-12T06:00:23Z","git_url":"git://github.com/GeorgeDittmar/spark.git","ssh_url":"git@github.com:GeorgeDittmar/spark.git","clone_url":"https://github.com/GeorgeDittmar/spark.git","svn_url":"https://github.com/GeorgeDittmar/spark","homepage":null,"size":105889,"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":"97dee313f23b00f15638cb72a4a80c1f197f8a9d","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-05-14T23:01:35Z","pushed_at":"2015-05-15T04:31:35Z","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":1652836,"stargazers_count":3975,"watchers_count":3975,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3489,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":306,"forks":3489,"open_issues":306,"watchers":3975,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/6112"},"html":{"href":"https://github.com/apache/spark/pull/6112"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/6112"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/6112/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/6112/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/6112/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/df9538a51d02e35ea12a0759726975ecb1a89981"}}}}