{"action":"created","comment":{"url":"https://api.github.com/repos/stan-dev/math/pulls/comments/136191589","pull_request_review_id":59678600,"id":136191589,"diff_hunk":"@@ -69,37 +148,38 @@ void setValue(T1& v, double value) {\n  * @param value Value to assign\n  */\n template<>\n-void setValue(double& v, double value) {\n+void set_value(double& v, double value) {\n   v = value;\n }\n \n /*\n- * Return true if variables defined with constraint c1 do not violate constraint\n- * c2\n+ * Check that every element of p (if p is a vector) passes check. If p is a\n+ * scalar, then just make sure it passes the check.\n  *\n- * @param c1 First constraint\n- * @param c2 Second constraint\n- * @return True if values with constraint c1 and compatible with c2\n+ * @tparam T_check Callable type that takes in one double and returns a bool\n+ * @tparam T_param Any type compatible with stan::scalar_seq_view\n+ * @param check Callable for validating (values of) p\n+ * @param p Parameter to check\n  */\n-bool compatible(Constraint c1, Constraint c2) {\n-  if (c1 == Constraint::NonNegative && c2 == Constraint::Positive)\n-    return false;\n-\n-  if (c1 == Constraint::None && c2 == Constraint::NonNegative)\n-    return false;\n+template<typename T_check, typename T_param>\n+bool VectorizeCheck(T_check check, T_param p) {","path":"test/unit/math/prim/mat/prob/vector_rng_test_helper.hpp","position":null,"original_position":205,"commit_id":"c4467078328ac740ae44818b10c579fc713cb5c5","original_commit_id":"c4467078328ac740ae44818b10c579fc713cb5c5","user":{"login":"seantalts","id":805356,"avatar_url":"https://avatars1.githubusercontent.com/u/805356?v=4","gravatar_id":"","url":"https://api.github.com/users/seantalts","html_url":"https://github.com/seantalts","followers_url":"https://api.github.com/users/seantalts/followers","following_url":"https://api.github.com/users/seantalts/following{/other_user}","gists_url":"https://api.github.com/users/seantalts/gists{/gist_id}","starred_url":"https://api.github.com/users/seantalts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seantalts/subscriptions","organizations_url":"https://api.github.com/users/seantalts/orgs","repos_url":"https://api.github.com/users/seantalts/repos","events_url":"https://api.github.com/users/seantalts/events{/privacy}","received_events_url":"https://api.github.com/users/seantalts/received_events","type":"User","site_admin":false},"body":"This function is typically called something like [every?](https://clojuredocs.org/clojure.core/every_q), [all](http://hackage.haskell.org/package/base-4.10.0.0/docs/Prelude.html#v:all), or [forall](http://www.scala-lang.org/api/2.12.1/scala/collection/immutable/List.html#forall(p:A=>Boolean):Boolean). I'd re-use an existing name for it (whichever is fine), or maybe try to use [something like this](http://www.cplusplus.com/reference/algorithm/all_of/) in the stdlib, though that's unaware of things like `scalar_seq_view`.","created_at":"2017-08-30T21:14:45Z","updated_at":"2017-08-30T21:41:19Z","html_url":"https://github.com/stan-dev/math/pull/605#discussion_r136191589","pull_request_url":"https://api.github.com/repos/stan-dev/math/pulls/605","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/stan-dev/math/pulls/comments/136191589"},"html":{"href":"https://github.com/stan-dev/math/pull/605#discussion_r136191589"},"pull_request":{"href":"https://api.github.com/repos/stan-dev/math/pulls/605"}}},"pull_request":{"url":"https://api.github.com/repos/stan-dev/math/pulls/605","id":136666636,"html_url":"https://github.com/stan-dev/math/pull/605","diff_url":"https://github.com/stan-dev/math/pull/605.diff","patch_url":"https://github.com/stan-dev/math/pull/605.patch","issue_url":"https://api.github.com/repos/stan-dev/math/issues/605","number":605,"state":"open","locked":false,"title":"Vectorize rngs (Issue 45)","user":{"login":"bbbales2","id":4742424,"avatar_url":"https://avatars1.githubusercontent.com/u/4742424?v=4","gravatar_id":"","url":"https://api.github.com/users/bbbales2","html_url":"https://github.com/bbbales2","followers_url":"https://api.github.com/users/bbbales2/followers","following_url":"https://api.github.com/users/bbbales2/following{/other_user}","gists_url":"https://api.github.com/users/bbbales2/gists{/gist_id}","starred_url":"https://api.github.com/users/bbbales2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbbales2/subscriptions","organizations_url":"https://api.github.com/users/bbbales2/orgs","repos_url":"https://api.github.com/users/bbbales2/repos","events_url":"https://api.github.com/users/bbbales2/events{/privacy}","received_events_url":"https://api.github.com/users/bbbales2/received_events","type":"User","site_admin":false},"body":"#### Submission Checklist\r\n\r\n- [x] Run unit tests: `./runTests.py test/unit`\r\n- [x] Run cpplint: `make cpplint`\r\n- [x] Declare copyright holder and open-source license: see below\r\n\r\n#### Summary:\r\n\r\nThis picks up from where #578 (now closed) left off. Made a new pull to simplify the code.\r\n\r\nThis attempts to address: #45 (Vectorize rngs)\r\n\r\nI used a tiny amount of C++11. I noticed it's in the makefiles. I can work around that if necessary.\r\n\r\nI added a bunch of code to generalize the vectorized tests so it'll be easy to expand this to the other distributions. Check https://github.com/bbbales2/math/blob/cf77cba6221e8cd2db701a5563383623daa103b0/test/unit/math/prim/mat/prob/normal_test.cpp for the use.\r\n\r\n```twoParamDistCheckThrowsAllTypes``` and ```chiSquareTestAllTypes``` are the two big entry points. Maybe not named the best but oh well for now I guess.\r\n\r\nThe new testing functions automatically generate simple sets of parameters that satisfy the necessary constraints (Positive, NonNegative, or None) and validate these with the _rngs and combinations of all the different vector types.\r\n\r\nWhat has to be provided is a callable that wraps the _rng function and a callable that generates quantiles that will be used to validate sets of randomly generated numbers. I'd have to add stuff for 1 and 3 argument functions, and it'd have to change to discrete things as well, but it's a start.\r\n\r\nNow that I think about it, it might be better to make it where the parameters are generated by parameter generating callables that are passed in. But this way is simpler.\r\n\r\n#### How to Verify:\r\n\r\n```\r\n./runTests.py test/unit/math/prim/scal/prob/normal_test.cpp\r\n./runTests.py test/unit/math/prim/mat/prob/normal_test.cpp\r\n```\r\n\r\n#### Side Effects:\r\n\r\nHopefully none\r\n\r\n#### Documentation:\r\n\r\nDocs are inline in Doxygen (though I'm not sure Doxygen actually generates docs from test headers)\r\n\r\n#### Copyright and Licensing\r\n\r\nPlease list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): University of California, Santa Barbara\r\n\r\nBy submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:\r\n- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)\r\n- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)\r\n","created_at":"2017-08-21T01:19:42Z","updated_at":"2017-08-30T21:41:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fd45f3c24a522e6b02bf60e95d2d3db3921e55de","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/stan-dev/math/pulls/605/commits","review_comments_url":"https://api.github.com/repos/stan-dev/math/pulls/605/comments","review_comment_url":"https://api.github.com/repos/stan-dev/math/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stan-dev/math/issues/605/comments","statuses_url":"https://api.github.com/repos/stan-dev/math/statuses/c4467078328ac740ae44818b10c579fc713cb5c5","head":{"label":"bbbales2:feature/issue-45-vectorized_rngs_just_normal","ref":"feature/issue-45-vectorized_rngs_just_normal","sha":"c4467078328ac740ae44818b10c579fc713cb5c5","user":{"login":"bbbales2","id":4742424,"avatar_url":"https://avatars1.githubusercontent.com/u/4742424?v=4","gravatar_id":"","url":"https://api.github.com/users/bbbales2","html_url":"https://github.com/bbbales2","followers_url":"https://api.github.com/users/bbbales2/followers","following_url":"https://api.github.com/users/bbbales2/following{/other_user}","gists_url":"https://api.github.com/users/bbbales2/gists{/gist_id}","starred_url":"https://api.github.com/users/bbbales2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbbales2/subscriptions","organizations_url":"https://api.github.com/users/bbbales2/orgs","repos_url":"https://api.github.com/users/bbbales2/repos","events_url":"https://api.github.com/users/bbbales2/events{/privacy}","received_events_url":"https://api.github.com/users/bbbales2/received_events","type":"User","site_admin":false},"repo":{"id":86724369,"name":"math","full_name":"bbbales2/math","owner":{"login":"bbbales2","id":4742424,"avatar_url":"https://avatars1.githubusercontent.com/u/4742424?v=4","gravatar_id":"","url":"https://api.github.com/users/bbbales2","html_url":"https://github.com/bbbales2","followers_url":"https://api.github.com/users/bbbales2/followers","following_url":"https://api.github.com/users/bbbales2/following{/other_user}","gists_url":"https://api.github.com/users/bbbales2/gists{/gist_id}","starred_url":"https://api.github.com/users/bbbales2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbbales2/subscriptions","organizations_url":"https://api.github.com/users/bbbales2/orgs","repos_url":"https://api.github.com/users/bbbales2/repos","events_url":"https://api.github.com/users/bbbales2/events{/privacy}","received_events_url":"https://api.github.com/users/bbbales2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bbbales2/math","description":"Stan Math Library","fork":true,"url":"https://api.github.com/repos/bbbales2/math","forks_url":"https://api.github.com/repos/bbbales2/math/forks","keys_url":"https://api.github.com/repos/bbbales2/math/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbbales2/math/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbbales2/math/teams","hooks_url":"https://api.github.com/repos/bbbales2/math/hooks","issue_events_url":"https://api.github.com/repos/bbbales2/math/issues/events{/number}","events_url":"https://api.github.com/repos/bbbales2/math/events","assignees_url":"https://api.github.com/repos/bbbales2/math/assignees{/user}","branches_url":"https://api.github.com/repos/bbbales2/math/branches{/branch}","tags_url":"https://api.github.com/repos/bbbales2/math/tags","blobs_url":"https://api.github.com/repos/bbbales2/math/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbbales2/math/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbbales2/math/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbbales2/math/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbbales2/math/statuses/{sha}","languages_url":"https://api.github.com/repos/bbbales2/math/languages","stargazers_url":"https://api.github.com/repos/bbbales2/math/stargazers","contributors_url":"https://api.github.com/repos/bbbales2/math/contributors","subscribers_url":"https://api.github.com/repos/bbbales2/math/subscribers","subscription_url":"https://api.github.com/repos/bbbales2/math/subscription","commits_url":"https://api.github.com/repos/bbbales2/math/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbbales2/math/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbbales2/math/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbbales2/math/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbbales2/math/contents/{+path}","compare_url":"https://api.github.com/repos/bbbales2/math/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbbales2/math/merges","archive_url":"https://api.github.com/repos/bbbales2/math/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbbales2/math/downloads","issues_url":"https://api.github.com/repos/bbbales2/math/issues{/number}","pulls_url":"https://api.github.com/repos/bbbales2/math/pulls{/number}","milestones_url":"https://api.github.com/repos/bbbales2/math/milestones{/number}","notifications_url":"https://api.github.com/repos/bbbales2/math/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbbales2/math/labels{/name}","releases_url":"https://api.github.com/repos/bbbales2/math/releases{/id}","deployments_url":"https://api.github.com/repos/bbbales2/math/deployments","created_at":"2017-03-30T16:26:58Z","updated_at":"2017-03-30T16:27:37Z","pushed_at":"2017-08-28T19:18:38Z","git_url":"git://github.com/bbbales2/math.git","ssh_url":"git@github.com:bbbales2/math.git","clone_url":"https://github.com/bbbales2/math.git","svn_url":"https://github.com/bbbales2/math","homepage":null,"size":235546,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"stan-dev:develop","ref":"develop","sha":"82ca96a44358f8f68ed31051a109128a54296090","user":{"login":"stan-dev","id":3374820,"avatar_url":"https://avatars2.githubusercontent.com/u/3374820?v=4","gravatar_id":"","url":"https://api.github.com/users/stan-dev","html_url":"https://github.com/stan-dev","followers_url":"https://api.github.com/users/stan-dev/followers","following_url":"https://api.github.com/users/stan-dev/following{/other_user}","gists_url":"https://api.github.com/users/stan-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/stan-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stan-dev/subscriptions","organizations_url":"https://api.github.com/users/stan-dev/orgs","repos_url":"https://api.github.com/users/stan-dev/repos","events_url":"https://api.github.com/users/stan-dev/events{/privacy}","received_events_url":"https://api.github.com/users/stan-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":38388440,"name":"math","full_name":"stan-dev/math","owner":{"login":"stan-dev","id":3374820,"avatar_url":"https://avatars2.githubusercontent.com/u/3374820?v=4","gravatar_id":"","url":"https://api.github.com/users/stan-dev","html_url":"https://github.com/stan-dev","followers_url":"https://api.github.com/users/stan-dev/followers","following_url":"https://api.github.com/users/stan-dev/following{/other_user}","gists_url":"https://api.github.com/users/stan-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/stan-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stan-dev/subscriptions","organizations_url":"https://api.github.com/users/stan-dev/orgs","repos_url":"https://api.github.com/users/stan-dev/repos","events_url":"https://api.github.com/users/stan-dev/events{/privacy}","received_events_url":"https://api.github.com/users/stan-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stan-dev/math","description":"Stan Math Library","fork":false,"url":"https://api.github.com/repos/stan-dev/math","forks_url":"https://api.github.com/repos/stan-dev/math/forks","keys_url":"https://api.github.com/repos/stan-dev/math/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stan-dev/math/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stan-dev/math/teams","hooks_url":"https://api.github.com/repos/stan-dev/math/hooks","issue_events_url":"https://api.github.com/repos/stan-dev/math/issues/events{/number}","events_url":"https://api.github.com/repos/stan-dev/math/events","assignees_url":"https://api.github.com/repos/stan-dev/math/assignees{/user}","branches_url":"https://api.github.com/repos/stan-dev/math/branches{/branch}","tags_url":"https://api.github.com/repos/stan-dev/math/tags","blobs_url":"https://api.github.com/repos/stan-dev/math/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stan-dev/math/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stan-dev/math/git/refs{/sha}","trees_url":"https://api.github.com/repos/stan-dev/math/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stan-dev/math/statuses/{sha}","languages_url":"https://api.github.com/repos/stan-dev/math/languages","stargazers_url":"https://api.github.com/repos/stan-dev/math/stargazers","contributors_url":"https://api.github.com/repos/stan-dev/math/contributors","subscribers_url":"https://api.github.com/repos/stan-dev/math/subscribers","subscription_url":"https://api.github.com/repos/stan-dev/math/subscription","commits_url":"https://api.github.com/repos/stan-dev/math/commits{/sha}","git_commits_url":"https://api.github.com/repos/stan-dev/math/git/commits{/sha}","comments_url":"https://api.github.com/repos/stan-dev/math/comments{/number}","issue_comment_url":"https://api.github.com/repos/stan-dev/math/issues/comments{/number}","contents_url":"https://api.github.com/repos/stan-dev/math/contents/{+path}","compare_url":"https://api.github.com/repos/stan-dev/math/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stan-dev/math/merges","archive_url":"https://api.github.com/repos/stan-dev/math/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stan-dev/math/downloads","issues_url":"https://api.github.com/repos/stan-dev/math/issues{/number}","pulls_url":"https://api.github.com/repos/stan-dev/math/pulls{/number}","milestones_url":"https://api.github.com/repos/stan-dev/math/milestones{/number}","notifications_url":"https://api.github.com/repos/stan-dev/math/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stan-dev/math/labels{/name}","releases_url":"https://api.github.com/repos/stan-dev/math/releases{/id}","deployments_url":"https://api.github.com/repos/stan-dev/math/deployments","created_at":"2015-07-01T18:40:54Z","updated_at":"2017-08-24T19:44:09Z","pushed_at":"2017-08-30T21:13:19Z","git_url":"git://github.com/stan-dev/math.git","ssh_url":"git@github.com:stan-dev/math.git","clone_url":"https://github.com/stan-dev/math.git","svn_url":"https://github.com/stan-dev/math","homepage":null,"size":325824,"stargazers_count":127,"watchers_count":127,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":51,"mirror_url":null,"open_issues_count":121,"forks":51,"open_issues":121,"watchers":127,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/stan-dev/math/pulls/605"},"html":{"href":"https://github.com/stan-dev/math/pull/605"},"issue":{"href":"https://api.github.com/repos/stan-dev/math/issues/605"},"comments":{"href":"https://api.github.com/repos/stan-dev/math/issues/605/comments"},"review_comments":{"href":"https://api.github.com/repos/stan-dev/math/pulls/605/comments"},"review_comment":{"href":"https://api.github.com/repos/stan-dev/math/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stan-dev/math/pulls/605/commits"},"statuses":{"href":"https://api.github.com/repos/stan-dev/math/statuses/c4467078328ac740ae44818b10c579fc713cb5c5"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"seantalts"}}