{"action":"created","comment":{"url":"https://api.github.com/repos/scipy/scipy/pulls/comments/193166357","pull_request_review_id":126085509,"id":193166357,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MzE2NjM1Nw==","diff_hunk":"@@ -244,6 +264,96 @@ def newton(func, x0, fprime=None, args=(), tol=1.48e-8, maxiter=50,\n     return _results_select(full_output, (p, funcalls, itr + 1, _ECONVERR))\n \n \n+def _array_newton(func, x0, fprime, args, tol, maxiter, fprime2,\n+                  failure_idx_flag=False):\n+    \"\"\"\n+    A vectorized version of Newton, Halley, and secant methods for arrays. Do\n+    not use this method directly. This method is called from :func:`newton`\n+    when ``np.isscalar(x0)`` is true. For docstring, see :func:`newton`.\n+    \"\"\"\n+    try:\n+        p = np.asarray(x0, dtype=float)\n+    except TypeError:  # can't convert complex to float\n+        p = np.asarray(x0)\n+    failures = np.ones_like(p, dtype=bool)  # at start, nothing converged\n+    if fprime is not None:\n+        # Newton-Raphson method\n+        for iteration in range(maxiter):\n+            fder = np.asarray(fprime(p, *args))\n+            nz_der = (fder != 0)\n+            # stop iterating if all derivatives are zero\n+            if not nz_der.any():","path":"scipy/optimize/zeros.py","position":153,"original_position":153,"commit_id":"3746e287cae3b961a7330a4f2a96140b7115fd1d","original_commit_id":"51b870c89090fc32f4e489528065380255842dc8","user":{"login":"mikofski","id":1385621,"node_id":"MDQ6VXNlcjEzODU2MjE=","avatar_url":"https://avatars1.githubusercontent.com/u/1385621?v=4","gravatar_id":"","url":"https://api.github.com/users/mikofski","html_url":"https://github.com/mikofski","followers_url":"https://api.github.com/users/mikofski/followers","following_url":"https://api.github.com/users/mikofski/following{/other_user}","gists_url":"https://api.github.com/users/mikofski/gists{/gist_id}","starred_url":"https://api.github.com/users/mikofski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikofski/subscriptions","organizations_url":"https://api.github.com/users/mikofski/orgs","repos_url":"https://api.github.com/users/mikofski/repos","events_url":"https://api.github.com/users/mikofski/events{/privacy}","received_events_url":"https://api.github.com/users/mikofski/received_events","type":"User","site_admin":false},"body":"Hi @rgommers and @pvanmulbregt , IMHO #8904 should be handled in a separate PR, and I don't think it should block this PR. Making changes to the what is considered `RuntimeWarning` is IMO a larger issue that should be addressed by more members of the SciPy community. I believe addressing them in this PR may possibly create confusion later on as to why or when the philosophy was changed for when we consider an infinite Newton step a convergence error. I discuss this in #8904 and [I've posted a question on the SciPy mailing list](https://mail.python.org/pipermail/scipy-dev/2018-June/022861.html).","created_at":"2018-06-05T17:59:10Z","updated_at":"2018-06-05T17:59:11Z","html_url":"https://github.com/scipy/scipy/pull/8357#discussion_r193166357","pull_request_url":"https://api.github.com/repos/scipy/scipy/pulls/8357","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/scipy/scipy/pulls/comments/193166357"},"html":{"href":"https://github.com/scipy/scipy/pull/8357#discussion_r193166357"},"pull_request":{"href":"https://api.github.com/repos/scipy/scipy/pulls/8357"}},"in_reply_to_id":192612946},"pull_request":{"url":"https://api.github.com/repos/scipy/scipy/pulls/8357","id":166743796,"node_id":"MDExOlB1bGxSZXF1ZXN0MTY2NzQzNzk2","html_url":"https://github.com/scipy/scipy/pull/8357","diff_url":"https://github.com/scipy/scipy/pull/8357.diff","patch_url":"https://github.com/scipy/scipy/pull/8357.patch","issue_url":"https://api.github.com/repos/scipy/scipy/issues/8357","number":8357,"state":"open","locked":false,"title":"BUG: ENH: vectorize scalar zero-search-functions","user":{"login":"mikofski","id":1385621,"node_id":"MDQ6VXNlcjEzODU2MjE=","avatar_url":"https://avatars1.githubusercontent.com/u/1385621?v=4","gravatar_id":"","url":"https://api.github.com/users/mikofski","html_url":"https://github.com/mikofski","followers_url":"https://api.github.com/users/mikofski/followers","following_url":"https://api.github.com/users/mikofski/following{/other_user}","gists_url":"https://api.github.com/users/mikofski/gists{/gist_id}","starred_url":"https://api.github.com/users/mikofski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikofski/subscriptions","organizations_url":"https://api.github.com/users/mikofski/orgs","repos_url":"https://api.github.com/users/mikofski/repos","events_url":"https://api.github.com/users/mikofski/events{/privacy}","received_events_url":"https://api.github.com/users/mikofski/received_events","type":"User","site_admin":false},"body":"Fixes #8354 \r\n\r\nThis PR also addresses #7242. \r\n\r\n* add test for newton with arrays\r\n* import asarray and np.abs\r\n* check any of the derivatives for zero, cast fder to array\r\n* check all newton step deltas, use numpy abs to cast (p-p0) to arary\r\n\r\nSigned-off-by: Mark Mikofski <bwana.marko@yahoo.com>","created_at":"2018-02-02T08:32:08Z","updated_at":"2018-06-05T17:59:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1dd0c961f74ca839851d0be61ffddc8875bc9258","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":108549863,"node_id":"MDU6TGFiZWwxMDg1NDk4NjM=","url":"https://api.github.com/repos/scipy/scipy/labels/maintenance","name":"maintenance","color":"fef2c0","default":false},{"id":37341011,"node_id":"MDU6TGFiZWwzNzM0MTAxMQ==","url":"https://api.github.com/repos/scipy/scipy/labels/scipy.optimize","name":"scipy.optimize","color":"207de5","default":false}],"milestone":{"url":"https://api.github.com/repos/scipy/scipy/milestones/36","html_url":"https://github.com/scipy/scipy/milestone/36","labels_url":"https://api.github.com/repos/scipy/scipy/milestones/36/labels","id":3257163,"node_id":"MDk6TWlsZXN0b25lMzI1NzE2Mw==","number":36,"title":"1.2.0","description":"","creator":{"login":"pv","id":35046,"node_id":"MDQ6VXNlcjM1MDQ2","avatar_url":"https://avatars1.githubusercontent.com/u/35046?v=4","gravatar_id":"","url":"https://api.github.com/users/pv","html_url":"https://github.com/pv","followers_url":"https://api.github.com/users/pv/followers","following_url":"https://api.github.com/users/pv/following{/other_user}","gists_url":"https://api.github.com/users/pv/gists{/gist_id}","starred_url":"https://api.github.com/users/pv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pv/subscriptions","organizations_url":"https://api.github.com/users/pv/orgs","repos_url":"https://api.github.com/users/pv/repos","events_url":"https://api.github.com/users/pv/events{/privacy}","received_events_url":"https://api.github.com/users/pv/received_events","type":"User","site_admin":false},"open_issues":23,"closed_issues":37,"state":"open","created_at":"2018-04-10T20:26:02Z","updated_at":"2018-06-05T16:13:36Z","due_on":"2018-11-09T08:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scipy/scipy/pulls/8357/commits","review_comments_url":"https://api.github.com/repos/scipy/scipy/pulls/8357/comments","review_comment_url":"https://api.github.com/repos/scipy/scipy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scipy/scipy/issues/8357/comments","statuses_url":"https://api.github.com/repos/scipy/scipy/statuses/3746e287cae3b961a7330a4f2a96140b7115fd1d","head":{"label":"mikofski:vectorize_newton","ref":"vectorize_newton","sha":"3746e287cae3b961a7330a4f2a96140b7115fd1d","user":{"login":"mikofski","id":1385621,"node_id":"MDQ6VXNlcjEzODU2MjE=","avatar_url":"https://avatars1.githubusercontent.com/u/1385621?v=4","gravatar_id":"","url":"https://api.github.com/users/mikofski","html_url":"https://github.com/mikofski","followers_url":"https://api.github.com/users/mikofski/followers","following_url":"https://api.github.com/users/mikofski/following{/other_user}","gists_url":"https://api.github.com/users/mikofski/gists{/gist_id}","starred_url":"https://api.github.com/users/mikofski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikofski/subscriptions","organizations_url":"https://api.github.com/users/mikofski/orgs","repos_url":"https://api.github.com/users/mikofski/repos","events_url":"https://api.github.com/users/mikofski/events{/privacy}","received_events_url":"https://api.github.com/users/mikofski/received_events","type":"User","site_admin":false},"repo":{"id":119912574,"node_id":"MDEwOlJlcG9zaXRvcnkxMTk5MTI1NzQ=","name":"scipy","full_name":"mikofski/scipy","owner":{"login":"mikofski","id":1385621,"node_id":"MDQ6VXNlcjEzODU2MjE=","avatar_url":"https://avatars1.githubusercontent.com/u/1385621?v=4","gravatar_id":"","url":"https://api.github.com/users/mikofski","html_url":"https://github.com/mikofski","followers_url":"https://api.github.com/users/mikofski/followers","following_url":"https://api.github.com/users/mikofski/following{/other_user}","gists_url":"https://api.github.com/users/mikofski/gists{/gist_id}","starred_url":"https://api.github.com/users/mikofski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikofski/subscriptions","organizations_url":"https://api.github.com/users/mikofski/orgs","repos_url":"https://api.github.com/users/mikofski/repos","events_url":"https://api.github.com/users/mikofski/events{/privacy}","received_events_url":"https://api.github.com/users/mikofski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mikofski/scipy","description":"Scipy library main repository","fork":true,"url":"https://api.github.com/repos/mikofski/scipy","forks_url":"https://api.github.com/repos/mikofski/scipy/forks","keys_url":"https://api.github.com/repos/mikofski/scipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mikofski/scipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mikofski/scipy/teams","hooks_url":"https://api.github.com/repos/mikofski/scipy/hooks","issue_events_url":"https://api.github.com/repos/mikofski/scipy/issues/events{/number}","events_url":"https://api.github.com/repos/mikofski/scipy/events","assignees_url":"https://api.github.com/repos/mikofski/scipy/assignees{/user}","branches_url":"https://api.github.com/repos/mikofski/scipy/branches{/branch}","tags_url":"https://api.github.com/repos/mikofski/scipy/tags","blobs_url":"https://api.github.com/repos/mikofski/scipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mikofski/scipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mikofski/scipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/mikofski/scipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mikofski/scipy/statuses/{sha}","languages_url":"https://api.github.com/repos/mikofski/scipy/languages","stargazers_url":"https://api.github.com/repos/mikofski/scipy/stargazers","contributors_url":"https://api.github.com/repos/mikofski/scipy/contributors","subscribers_url":"https://api.github.com/repos/mikofski/scipy/subscribers","subscription_url":"https://api.github.com/repos/mikofski/scipy/subscription","commits_url":"https://api.github.com/repos/mikofski/scipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/mikofski/scipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/mikofski/scipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/mikofski/scipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/mikofski/scipy/contents/{+path}","compare_url":"https://api.github.com/repos/mikofski/scipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mikofski/scipy/merges","archive_url":"https://api.github.com/repos/mikofski/scipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mikofski/scipy/downloads","issues_url":"https://api.github.com/repos/mikofski/scipy/issues{/number}","pulls_url":"https://api.github.com/repos/mikofski/scipy/pulls{/number}","milestones_url":"https://api.github.com/repos/mikofski/scipy/milestones{/number}","notifications_url":"https://api.github.com/repos/mikofski/scipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mikofski/scipy/labels{/name}","releases_url":"https://api.github.com/repos/mikofski/scipy/releases{/id}","deployments_url":"https://api.github.com/repos/mikofski/scipy/deployments","created_at":"2018-02-02T00:57:37Z","updated_at":"2018-06-05T16:06:26Z","pushed_at":"2018-06-05T16:06:24Z","git_url":"git://github.com/mikofski/scipy.git","ssh_url":"git@github.com:mikofski/scipy.git","clone_url":"https://github.com/mikofski/scipy.git","svn_url":"https://github.com/mikofski/scipy","homepage":"http://scipy.org/scipylib/","size":78114,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"scipy:master","ref":"master","sha":"14de485c053cc275682bc7de0316fcca72b341f8","user":{"login":"scipy","id":288277,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4ODI3Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/288277?v=4","gravatar_id":"","url":"https://api.github.com/users/scipy","html_url":"https://github.com/scipy","followers_url":"https://api.github.com/users/scipy/followers","following_url":"https://api.github.com/users/scipy/following{/other_user}","gists_url":"https://api.github.com/users/scipy/gists{/gist_id}","starred_url":"https://api.github.com/users/scipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scipy/subscriptions","organizations_url":"https://api.github.com/users/scipy/orgs","repos_url":"https://api.github.com/users/scipy/repos","events_url":"https://api.github.com/users/scipy/events{/privacy}","received_events_url":"https://api.github.com/users/scipy/received_events","type":"Organization","site_admin":false},"repo":{"id":1460385,"node_id":"MDEwOlJlcG9zaXRvcnkxNDYwMzg1","name":"scipy","full_name":"scipy/scipy","owner":{"login":"scipy","id":288277,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4ODI3Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/288277?v=4","gravatar_id":"","url":"https://api.github.com/users/scipy","html_url":"https://github.com/scipy","followers_url":"https://api.github.com/users/scipy/followers","following_url":"https://api.github.com/users/scipy/following{/other_user}","gists_url":"https://api.github.com/users/scipy/gists{/gist_id}","starred_url":"https://api.github.com/users/scipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scipy/subscriptions","organizations_url":"https://api.github.com/users/scipy/orgs","repos_url":"https://api.github.com/users/scipy/repos","events_url":"https://api.github.com/users/scipy/events{/privacy}","received_events_url":"https://api.github.com/users/scipy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scipy/scipy","description":"Scipy library main repository","fork":false,"url":"https://api.github.com/repos/scipy/scipy","forks_url":"https://api.github.com/repos/scipy/scipy/forks","keys_url":"https://api.github.com/repos/scipy/scipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scipy/scipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scipy/scipy/teams","hooks_url":"https://api.github.com/repos/scipy/scipy/hooks","issue_events_url":"https://api.github.com/repos/scipy/scipy/issues/events{/number}","events_url":"https://api.github.com/repos/scipy/scipy/events","assignees_url":"https://api.github.com/repos/scipy/scipy/assignees{/user}","branches_url":"https://api.github.com/repos/scipy/scipy/branches{/branch}","tags_url":"https://api.github.com/repos/scipy/scipy/tags","blobs_url":"https://api.github.com/repos/scipy/scipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scipy/scipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scipy/scipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/scipy/scipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scipy/scipy/statuses/{sha}","languages_url":"https://api.github.com/repos/scipy/scipy/languages","stargazers_url":"https://api.github.com/repos/scipy/scipy/stargazers","contributors_url":"https://api.github.com/repos/scipy/scipy/contributors","subscribers_url":"https://api.github.com/repos/scipy/scipy/subscribers","subscription_url":"https://api.github.com/repos/scipy/scipy/subscription","commits_url":"https://api.github.com/repos/scipy/scipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/scipy/scipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/scipy/scipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/scipy/scipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/scipy/scipy/contents/{+path}","compare_url":"https://api.github.com/repos/scipy/scipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scipy/scipy/merges","archive_url":"https://api.github.com/repos/scipy/scipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scipy/scipy/downloads","issues_url":"https://api.github.com/repos/scipy/scipy/issues{/number}","pulls_url":"https://api.github.com/repos/scipy/scipy/pulls{/number}","milestones_url":"https://api.github.com/repos/scipy/scipy/milestones{/number}","notifications_url":"https://api.github.com/repos/scipy/scipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scipy/scipy/labels{/name}","releases_url":"https://api.github.com/repos/scipy/scipy/releases{/id}","deployments_url":"https://api.github.com/repos/scipy/scipy/deployments","created_at":"2011-03-09T18:52:03Z","updated_at":"2018-06-05T15:52:06Z","pushed_at":"2018-06-05T15:51:34Z","git_url":"git://github.com/scipy/scipy.git","ssh_url":"git@github.com:scipy/scipy.git","clone_url":"https://github.com/scipy/scipy.git","svn_url":"https://github.com/scipy/scipy","homepage":"http://scipy.org/scipylib/","size":80095,"stargazers_count":4516,"watchers_count":4516,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2339,"mirror_url":null,"archived":false,"open_issues_count":1258,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2339,"open_issues":1258,"watchers":4516,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scipy/scipy/pulls/8357"},"html":{"href":"https://github.com/scipy/scipy/pull/8357"},"issue":{"href":"https://api.github.com/repos/scipy/scipy/issues/8357"},"comments":{"href":"https://api.github.com/repos/scipy/scipy/issues/8357/comments"},"review_comments":{"href":"https://api.github.com/repos/scipy/scipy/pulls/8357/comments"},"review_comment":{"href":"https://api.github.com/repos/scipy/scipy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scipy/scipy/pulls/8357/commits"},"statuses":{"href":"https://api.github.com/repos/scipy/scipy/statuses/3746e287cae3b961a7330a4f2a96140b7115fd1d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mikofski"}}