{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/comments/65462951","id":65462951,"diff_hunk":"@@ -599,6 +599,108 @@ function Base.sum{T}(x::Vec{T})\n   s[]\n end\n \n+###############################################################################\n+# map and friends\n+import Base: map!, map\n+# this should be inhertied from base\n+#=\n+function map(f, c)\n+  out = copy(c)\n+  for (idx, val) in enumerate(c)\n+    out_idx = similar(val)\n+    map!(f, out_idx, val)\n+    out[idx] = out_idx\n+  end\n+\n+  return out\n+end\n+=#\n+#TODO: c should be a varargs, but that makes it ambiguous with map! defined\n+# below\n+function map!(f, c)\n+  map!(f, c, c)\n+end\n+\n+\"\"\"\n+Applys f element-wise to src to populate dest.  If src is a ghost vector,\n+then f is applied to the ghost elements as well as the local elements.\n+\"\"\"\n+function map!{T}(f, dest::Vec{T}, src::Vec)\n+  if length(dest) != length(src)\n+    throw(ArgumentError(\"Vectors must be same length\"))\n+  end\n+  dest_arr = LocalArray(dest)\n+  src_arr = LocalArrayRead(src)\n+  for (idx, val) in enumerate(src)\n+    dest[idx] = f(val)\n+  end\n+  LocalArrayRestore(dest_arr)","path":"src/vec.jl","position":39,"original_position":39,"commit_id":"322f9434a8b8df6eb4a9dea4c1bc13fd58b6831e","original_commit_id":"322f9434a8b8df6eb4a9dea4c1bc13fd58b6831e","user":{"login":"JaredCrean2","id":10292902,"avatar_url":"https://avatars.githubusercontent.com/u/10292902?v=3","gravatar_id":"","url":"https://api.github.com/users/JaredCrean2","html_url":"https://github.com/JaredCrean2","followers_url":"https://api.github.com/users/JaredCrean2/followers","following_url":"https://api.github.com/users/JaredCrean2/following{/other_user}","gists_url":"https://api.github.com/users/JaredCrean2/gists{/gist_id}","starred_url":"https://api.github.com/users/JaredCrean2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JaredCrean2/subscriptions","organizations_url":"https://api.github.com/users/JaredCrean2/orgs","repos_url":"https://api.github.com/users/JaredCrean2/repos","events_url":"https://api.github.com/users/JaredCrean2/events{/privacy}","received_events_url":"https://api.github.com/users/JaredCrean2/received_events","type":"User","site_admin":false},"body":"How expensive are `try/finally` blocks (and `try/catch` blocks for that matter)?  `LocalArray`s do have finalizes, so the memory will get cleaned up eventually.","created_at":"2016-06-01T23:45:39Z","updated_at":"2016-06-01T23:45:39Z","html_url":"https://github.com/JuliaParallel/PETSc.jl/pull/73#discussion_r65462951","pull_request_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/73","_links":{"self":{"href":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/comments/65462951"},"html":{"href":"https://github.com/JuliaParallel/PETSc.jl/pull/73#discussion_r65462951"},"pull_request":{"href":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/73"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/73","id":72266367,"html_url":"https://github.com/JuliaParallel/PETSc.jl/pull/73","diff_url":"https://github.com/JuliaParallel/PETSc.jl/pull/73.diff","patch_url":"https://github.com/JuliaParallel/PETSc.jl/pull/73.patch","issue_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/issues/73","number":73,"state":"open","locked":false,"title":"Implement Map for Vectors","user":{"login":"JaredCrean2","id":10292902,"avatar_url":"https://avatars.githubusercontent.com/u/10292902?v=3","gravatar_id":"","url":"https://api.github.com/users/JaredCrean2","html_url":"https://github.com/JaredCrean2","followers_url":"https://api.github.com/users/JaredCrean2/followers","following_url":"https://api.github.com/users/JaredCrean2/following{/other_user}","gists_url":"https://api.github.com/users/JaredCrean2/gists{/gist_id}","starred_url":"https://api.github.com/users/JaredCrean2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JaredCrean2/subscriptions","organizations_url":"https://api.github.com/users/JaredCrean2/orgs","repos_url":"https://api.github.com/users/JaredCrean2/repos","events_url":"https://api.github.com/users/JaredCrean2/events{/privacy}","received_events_url":"https://api.github.com/users/JaredCrean2/received_events","type":"User","site_admin":false},"body":"Implements `map` for Petsc vectors.  Each process applies the operation to the local part of the vector.  When there is more than 1 source vector, the implementation is a bit weird pending JuliaLang/julia#13651 being resolved, but it works.","created_at":"2016-06-01T23:02:24Z","updated_at":"2016-06-01T23:45:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"606cb190b57ae35d4846d51bec24a6d4a20f7f0b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/73/commits","review_comments_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/73/comments","review_comment_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/issues/73/comments","statuses_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/statuses/322f9434a8b8df6eb4a9dea4c1bc13fd58b6831e","head":{"label":"JuliaParallel:map","ref":"map","sha":"322f9434a8b8df6eb4a9dea4c1bc13fd58b6831e","user":{"login":"JuliaParallel","id":10119367,"avatar_url":"https://avatars.githubusercontent.com/u/10119367?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaParallel","html_url":"https://github.com/JuliaParallel","followers_url":"https://api.github.com/users/JuliaParallel/followers","following_url":"https://api.github.com/users/JuliaParallel/following{/other_user}","gists_url":"https://api.github.com/users/JuliaParallel/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaParallel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaParallel/subscriptions","organizations_url":"https://api.github.com/users/JuliaParallel/orgs","repos_url":"https://api.github.com/users/JuliaParallel/repos","events_url":"https://api.github.com/users/JuliaParallel/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaParallel/received_events","type":"Organization","site_admin":false},"repo":{"id":38933145,"name":"PETSc.jl","full_name":"JuliaParallel/PETSc.jl","owner":{"login":"JuliaParallel","id":10119367,"avatar_url":"https://avatars.githubusercontent.com/u/10119367?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaParallel","html_url":"https://github.com/JuliaParallel","followers_url":"https://api.github.com/users/JuliaParallel/followers","following_url":"https://api.github.com/users/JuliaParallel/following{/other_user}","gists_url":"https://api.github.com/users/JuliaParallel/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaParallel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaParallel/subscriptions","organizations_url":"https://api.github.com/users/JuliaParallel/orgs","repos_url":"https://api.github.com/users/JuliaParallel/repos","events_url":"https://api.github.com/users/JuliaParallel/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaParallel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaParallel/PETSc.jl","description":"Julia wrappers for Petsc library","fork":false,"url":"https://api.github.com/repos/JuliaParallel/PETSc.jl","forks_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/forks","keys_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/teams","hooks_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/events","assignees_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/tags","blobs_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/subscription","commits_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/merges","archive_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/downloads","issues_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/deployments","created_at":"2015-07-11T16:49:27Z","updated_at":"2016-04-24T05:24:34Z","pushed_at":"2016-06-01T23:02:24Z","git_url":"git://github.com/JuliaParallel/PETSc.jl.git","ssh_url":"git@github.com:JuliaParallel/PETSc.jl.git","clone_url":"https://github.com/JuliaParallel/PETSc.jl.git","svn_url":"https://github.com/JuliaParallel/PETSc.jl","homepage":null,"size":5537,"stargazers_count":15,"watchers_count":15,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":19,"forks":7,"open_issues":19,"watchers":15,"default_branch":"master"}},"base":{"label":"JuliaParallel:master","ref":"master","sha":"bf10c5f9847a1bab646e48a207dd1cf7e05c919d","user":{"login":"JuliaParallel","id":10119367,"avatar_url":"https://avatars.githubusercontent.com/u/10119367?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaParallel","html_url":"https://github.com/JuliaParallel","followers_url":"https://api.github.com/users/JuliaParallel/followers","following_url":"https://api.github.com/users/JuliaParallel/following{/other_user}","gists_url":"https://api.github.com/users/JuliaParallel/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaParallel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaParallel/subscriptions","organizations_url":"https://api.github.com/users/JuliaParallel/orgs","repos_url":"https://api.github.com/users/JuliaParallel/repos","events_url":"https://api.github.com/users/JuliaParallel/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaParallel/received_events","type":"Organization","site_admin":false},"repo":{"id":38933145,"name":"PETSc.jl","full_name":"JuliaParallel/PETSc.jl","owner":{"login":"JuliaParallel","id":10119367,"avatar_url":"https://avatars.githubusercontent.com/u/10119367?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaParallel","html_url":"https://github.com/JuliaParallel","followers_url":"https://api.github.com/users/JuliaParallel/followers","following_url":"https://api.github.com/users/JuliaParallel/following{/other_user}","gists_url":"https://api.github.com/users/JuliaParallel/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaParallel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaParallel/subscriptions","organizations_url":"https://api.github.com/users/JuliaParallel/orgs","repos_url":"https://api.github.com/users/JuliaParallel/repos","events_url":"https://api.github.com/users/JuliaParallel/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaParallel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaParallel/PETSc.jl","description":"Julia wrappers for Petsc library","fork":false,"url":"https://api.github.com/repos/JuliaParallel/PETSc.jl","forks_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/forks","keys_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/teams","hooks_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/events","assignees_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/tags","blobs_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/subscription","commits_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/merges","archive_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/downloads","issues_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaParallel/PETSc.jl/deployments","created_at":"2015-07-11T16:49:27Z","updated_at":"2016-04-24T05:24:34Z","pushed_at":"2016-06-01T23:02:24Z","git_url":"git://github.com/JuliaParallel/PETSc.jl.git","ssh_url":"git@github.com:JuliaParallel/PETSc.jl.git","clone_url":"https://github.com/JuliaParallel/PETSc.jl.git","svn_url":"https://github.com/JuliaParallel/PETSc.jl","homepage":null,"size":5537,"stargazers_count":15,"watchers_count":15,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":19,"forks":7,"open_issues":19,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/73"},"html":{"href":"https://github.com/JuliaParallel/PETSc.jl/pull/73"},"issue":{"href":"https://api.github.com/repos/JuliaParallel/PETSc.jl/issues/73"},"comments":{"href":"https://api.github.com/repos/JuliaParallel/PETSc.jl/issues/73/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/73/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaParallel/PETSc.jl/pulls/73/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaParallel/PETSc.jl/statuses/322f9434a8b8df6eb4a9dea4c1bc13fd58b6831e"}}}}
{"actor":{"display_login":"JaredCrean2"}}