{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/comments/191192142","pull_request_review_id":123717677,"id":191192142,"diff_hunk":"@@ -17,67 +17,53 @@ function initial_mu(gfunc::AbstractArray{T}, gbarrier::AbstractArray{T}, mu0fact\n end\n \n function barrier_box(g, x::AbstractArray{T}, l::AbstractArray{T}, u::AbstractArray{T}) where T\n-    n = length(x)\n-    calc_g = !(g === nothing)\n+    calc_g = g !== nothing\n \n     v = zero(T)\n-    for i = 1:n\n+    @inbounds for i in eachindex(x)\n         thisl = l[i]\n         if isfinite(thisl)\n             dx = x[i] - thisl\n-            if dx <= 0\n-                return convert(T, Inf)\n-            end\n+            (dx <= zero(T)) && return convert(T, Inf)\n             v -= log(dx)\n-            if calc_g\n-                g[i] = -one(T)/dx\n-            end\n+            calc_g && (g[i] = -one(T)/dx)\n         else\n-            if calc_g\n-                g[i] = zero(T)\n-            end\n+            calc_g && (g[i] = zero(T))\n         end\n         thisu = u[i]\n         if isfinite(thisu)\n             dx = thisu - x[i]\n-            if dx <= 0\n-                return convert(T, Inf)\n-            end\n+            (dx <= zero(T)) && return convert(T, Inf)\n             v -= log(dx)\n-            if calc_g\n-                g[i] += one(T)/dx\n-            end\n+            calc_g && (g[i] += one(T)/dx)\n         end\n     end\n     return v\n end\n \n-function function_barrier(gfunc, gbarrier, x::AbstractArray{T}, f::F, fbarrier::FB) where {T, F<:Function, FB<:Function}\n+function function_barrier(gfunc, gbarrier, x::AbstractArray,\n+                          f::Function, fbarrier::Function)","path":"src/multivariate/solvers/constrained/fminbox.jl","position":48,"original_position":48,"commit_id":"319bcfbc95729c5b76b54c0004d8b119553f457e","original_commit_id":"319bcfbc95729c5b76b54c0004d8b119553f457e","user":{"login":"alyst","id":348591,"avatar_url":"https://avatars2.githubusercontent.com/u/348591?v=4","gravatar_id":"","url":"https://api.github.com/users/alyst","html_url":"https://github.com/alyst","followers_url":"https://api.github.com/users/alyst/followers","following_url":"https://api.github.com/users/alyst/following{/other_user}","gists_url":"https://api.github.com/users/alyst/gists{/gist_id}","starred_url":"https://api.github.com/users/alyst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alyst/subscriptions","organizations_url":"https://api.github.com/users/alyst/orgs","repos_url":"https://api.github.com/users/alyst/repos","events_url":"https://api.github.com/users/alyst/events{/privacy}","received_events_url":"https://api.github.com/users/alyst/received_events","type":"User","site_admin":false},"body":"My idea is that type annotation helps autodocumenting the code and detecting argument mismatch bugs early.\r\nIs there a way to express in v0.7 that `f` could be either function or callable object?","created_at":"2018-05-28T12:18:37Z","updated_at":"2018-05-28T12:18:37Z","html_url":"https://github.com/JuliaNLSolvers/Optim.jl/pull/605#discussion_r191192142","pull_request_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/605","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/comments/191192142"},"html":{"href":"https://github.com/JuliaNLSolvers/Optim.jl/pull/605#discussion_r191192142"},"pull_request":{"href":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/605"}},"in_reply_to_id":191137765},"pull_request":{"url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/605","id":190759919,"html_url":"https://github.com/JuliaNLSolvers/Optim.jl/pull/605","diff_url":"https://github.com/JuliaNLSolvers/Optim.jl/pull/605.diff","patch_url":"https://github.com/JuliaNLSolvers/Optim.jl/pull/605.patch","issue_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/issues/605","number":605,"state":"open","locked":false,"title":"Fminbox enhancements","user":{"login":"alyst","id":348591,"avatar_url":"https://avatars2.githubusercontent.com/u/348591?v=4","gravatar_id":"","url":"https://api.github.com/users/alyst","html_url":"https://github.com/alyst","followers_url":"https://api.github.com/users/alyst/followers","following_url":"https://api.github.com/users/alyst/following{/other_user}","gists_url":"https://api.github.com/users/alyst/gists{/gist_id}","starred_url":"https://api.github.com/users/alyst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alyst/subscriptions","organizations_url":"https://api.github.com/users/alyst/orgs","repos_url":"https://api.github.com/users/alyst/repos","events_url":"https://api.github.com/users/alyst/events{/privacy}","received_events_url":"https://api.github.com/users/alyst/received_events","type":"User","site_admin":false},"body":"Miscellaneous code enhancements/cleanups, mostly around Fminbox.","created_at":"2018-05-26T21:30:39Z","updated_at":"2018-05-28T12:18:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41ecf556146a9f9c4b88d5c1263933a453f00aae","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/605/commits","review_comments_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/605/comments","review_comment_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/issues/605/comments","statuses_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/statuses/319bcfbc95729c5b76b54c0004d8b119553f457e","head":{"label":"alyst:fminbox_enh","ref":"fminbox_enh","sha":"319bcfbc95729c5b76b54c0004d8b119553f457e","user":{"login":"alyst","id":348591,"avatar_url":"https://avatars2.githubusercontent.com/u/348591?v=4","gravatar_id":"","url":"https://api.github.com/users/alyst","html_url":"https://github.com/alyst","followers_url":"https://api.github.com/users/alyst/followers","following_url":"https://api.github.com/users/alyst/following{/other_user}","gists_url":"https://api.github.com/users/alyst/gists{/gist_id}","starred_url":"https://api.github.com/users/alyst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alyst/subscriptions","organizations_url":"https://api.github.com/users/alyst/orgs","repos_url":"https://api.github.com/users/alyst/repos","events_url":"https://api.github.com/users/alyst/events{/privacy}","received_events_url":"https://api.github.com/users/alyst/received_events","type":"User","site_admin":false},"repo":{"id":38754159,"name":"Optim.jl","full_name":"alyst/Optim.jl","owner":{"login":"alyst","id":348591,"avatar_url":"https://avatars2.githubusercontent.com/u/348591?v=4","gravatar_id":"","url":"https://api.github.com/users/alyst","html_url":"https://github.com/alyst","followers_url":"https://api.github.com/users/alyst/followers","following_url":"https://api.github.com/users/alyst/following{/other_user}","gists_url":"https://api.github.com/users/alyst/gists{/gist_id}","starred_url":"https://api.github.com/users/alyst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alyst/subscriptions","organizations_url":"https://api.github.com/users/alyst/orgs","repos_url":"https://api.github.com/users/alyst/repos","events_url":"https://api.github.com/users/alyst/events{/privacy}","received_events_url":"https://api.github.com/users/alyst/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alyst/Optim.jl","description":"Optimization functions for Julia","fork":true,"url":"https://api.github.com/repos/alyst/Optim.jl","forks_url":"https://api.github.com/repos/alyst/Optim.jl/forks","keys_url":"https://api.github.com/repos/alyst/Optim.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alyst/Optim.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alyst/Optim.jl/teams","hooks_url":"https://api.github.com/repos/alyst/Optim.jl/hooks","issue_events_url":"https://api.github.com/repos/alyst/Optim.jl/issues/events{/number}","events_url":"https://api.github.com/repos/alyst/Optim.jl/events","assignees_url":"https://api.github.com/repos/alyst/Optim.jl/assignees{/user}","branches_url":"https://api.github.com/repos/alyst/Optim.jl/branches{/branch}","tags_url":"https://api.github.com/repos/alyst/Optim.jl/tags","blobs_url":"https://api.github.com/repos/alyst/Optim.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alyst/Optim.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alyst/Optim.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/alyst/Optim.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alyst/Optim.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/alyst/Optim.jl/languages","stargazers_url":"https://api.github.com/repos/alyst/Optim.jl/stargazers","contributors_url":"https://api.github.com/repos/alyst/Optim.jl/contributors","subscribers_url":"https://api.github.com/repos/alyst/Optim.jl/subscribers","subscription_url":"https://api.github.com/repos/alyst/Optim.jl/subscription","commits_url":"https://api.github.com/repos/alyst/Optim.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/alyst/Optim.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/alyst/Optim.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/alyst/Optim.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/alyst/Optim.jl/contents/{+path}","compare_url":"https://api.github.com/repos/alyst/Optim.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alyst/Optim.jl/merges","archive_url":"https://api.github.com/repos/alyst/Optim.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alyst/Optim.jl/downloads","issues_url":"https://api.github.com/repos/alyst/Optim.jl/issues{/number}","pulls_url":"https://api.github.com/repos/alyst/Optim.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/alyst/Optim.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/alyst/Optim.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alyst/Optim.jl/labels{/name}","releases_url":"https://api.github.com/repos/alyst/Optim.jl/releases{/id}","deployments_url":"https://api.github.com/repos/alyst/Optim.jl/deployments","created_at":"2015-07-08T12:59:12Z","updated_at":"2017-02-13T07:11:00Z","pushed_at":"2018-05-26T21:28:22Z","git_url":"git://github.com/alyst/Optim.jl.git","ssh_url":"git@github.com:alyst/Optim.jl.git","clone_url":"https://github.com/alyst/Optim.jl.git","svn_url":"https://github.com/alyst/Optim.jl","homepage":"","size":1562,"stargazers_count":0,"watchers_count":0,"language":"Julia","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"JuliaNLSolvers:master","ref":"master","sha":"f6b294811fa2dfecf1d598170e91b0d4ba0bb7b0","user":{"login":"JuliaNLSolvers","id":25707270,"avatar_url":"https://avatars0.githubusercontent.com/u/25707270?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaNLSolvers","html_url":"https://github.com/JuliaNLSolvers","followers_url":"https://api.github.com/users/JuliaNLSolvers/followers","following_url":"https://api.github.com/users/JuliaNLSolvers/following{/other_user}","gists_url":"https://api.github.com/users/JuliaNLSolvers/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaNLSolvers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaNLSolvers/subscriptions","organizations_url":"https://api.github.com/users/JuliaNLSolvers/orgs","repos_url":"https://api.github.com/users/JuliaNLSolvers/repos","events_url":"https://api.github.com/users/JuliaNLSolvers/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaNLSolvers/received_events","type":"Organization","site_admin":false},"repo":{"id":3933868,"name":"Optim.jl","full_name":"JuliaNLSolvers/Optim.jl","owner":{"login":"JuliaNLSolvers","id":25707270,"avatar_url":"https://avatars0.githubusercontent.com/u/25707270?v=4","gravatar_id":"","url":"https://api.github.com/users/JuliaNLSolvers","html_url":"https://github.com/JuliaNLSolvers","followers_url":"https://api.github.com/users/JuliaNLSolvers/followers","following_url":"https://api.github.com/users/JuliaNLSolvers/following{/other_user}","gists_url":"https://api.github.com/users/JuliaNLSolvers/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaNLSolvers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaNLSolvers/subscriptions","organizations_url":"https://api.github.com/users/JuliaNLSolvers/orgs","repos_url":"https://api.github.com/users/JuliaNLSolvers/repos","events_url":"https://api.github.com/users/JuliaNLSolvers/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaNLSolvers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaNLSolvers/Optim.jl","description":"Optimization functions for Julia","fork":false,"url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl","forks_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/forks","keys_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/teams","hooks_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/events","assignees_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/tags","blobs_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/subscription","commits_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/merges","archive_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/downloads","issues_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/releases{/id}","deployments_url":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/deployments","created_at":"2012-04-04T22:19:35Z","updated_at":"2018-05-28T02:11:06Z","pushed_at":"2018-05-26T21:30:40Z","git_url":"git://github.com/JuliaNLSolvers/Optim.jl.git","ssh_url":"git@github.com:JuliaNLSolvers/Optim.jl.git","clone_url":"https://github.com/JuliaNLSolvers/Optim.jl.git","svn_url":"https://github.com/JuliaNLSolvers/Optim.jl","homepage":"","size":3877,"stargazers_count":294,"watchers_count":294,"language":"Julia","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":104,"mirror_url":null,"archived":false,"open_issues_count":63,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":104,"open_issues":63,"watchers":294,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/605"},"html":{"href":"https://github.com/JuliaNLSolvers/Optim.jl/pull/605"},"issue":{"href":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/issues/605"},"comments":{"href":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/issues/605/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/605/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/pulls/605/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaNLSolvers/Optim.jl/statuses/319bcfbc95729c5b76b54c0004d8b119553f457e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"alyst"}}