{"action":"created","issue":{"url":"https://api.github.com/repos/stan-dev/stan/issues/1861","repository_url":"https://api.github.com/repos/stan-dev/stan","labels_url":"https://api.github.com/repos/stan-dev/stan/issues/1861/labels{/name}","comments_url":"https://api.github.com/repos/stan-dev/stan/issues/1861/comments","events_url":"https://api.github.com/repos/stan-dev/stan/issues/1861/events","html_url":"https://github.com/stan-dev/stan/pull/1861","id":148329992,"number":1861,"title":"Feature/issue 304 add rhmc","user":{"login":"betanalpha","id":1527190,"avatar_url":"https://avatars.githubusercontent.com/u/1527190?v=3","gravatar_id":"","url":"https://api.github.com/users/betanalpha","html_url":"https://github.com/betanalpha","followers_url":"https://api.github.com/users/betanalpha/followers","following_url":"https://api.github.com/users/betanalpha/following{/other_user}","gists_url":"https://api.github.com/users/betanalpha/gists{/gist_id}","starred_url":"https://api.github.com/users/betanalpha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/betanalpha/subscriptions","organizations_url":"https://api.github.com/users/betanalpha/orgs","repos_url":"https://api.github.com/users/betanalpha/repos","events_url":"https://api.github.com/users/betanalpha/events{/privacy}","received_events_url":"https://api.github.com/users/betanalpha/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-14T11:24:00Z","updated_at":"2016-04-15T16:37:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/stan-dev/stan/pulls/1861","html_url":"https://github.com/stan-dev/stan/pull/1861","diff_url":"https://github.com/stan-dev/stan/pull/1861.diff","patch_url":"https://github.com/stan-dev/stan/pull/1861.patch"},"body":"#### Submisison Checklist\r\n\r\n- [x] Run unit tests: `./runTests.py src/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\nIntroduce Riemannian SoftAbs metrics to the active samplers.\r\n\r\n#### Intended Effect\r\n\r\nAllows each sampler to use the SoftAbs metric in addition to\r\nthe existing Euclidean metric variants.\r\n\r\n#### How to Verify\r\n\r\nRun unit tests, inspect code.  There are lots of potential design\r\nand performance improvements so this is to be considered\r\na preliminary implementation.\r\n\r\n#### Side Effects\r\n\r\nNone.\r\n\r\n#### Documentation\r\n\r\nNone.\r\n\r\n#### Reviewer Suggestions\r\n\r\nAnyone.\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):\r\n\r\nUniversity of Warwick\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/)"},"comment":{"url":"https://api.github.com/repos/stan-dev/stan/issues/comments/210536615","html_url":"https://github.com/stan-dev/stan/pull/1861#issuecomment-210536615","issue_url":"https://api.github.com/repos/stan-dev/stan/issues/1861","id":210536615,"user":{"login":"bob-carpenter","id":3383807,"avatar_url":"https://avatars.githubusercontent.com/u/3383807?v=3","gravatar_id":"","url":"https://api.github.com/users/bob-carpenter","html_url":"https://github.com/bob-carpenter","followers_url":"https://api.github.com/users/bob-carpenter/followers","following_url":"https://api.github.com/users/bob-carpenter/following{/other_user}","gists_url":"https://api.github.com/users/bob-carpenter/gists{/gist_id}","starred_url":"https://api.github.com/users/bob-carpenter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bob-carpenter/subscriptions","organizations_url":"https://api.github.com/users/bob-carpenter/orgs","repos_url":"https://api.github.com/users/bob-carpenter/repos","events_url":"https://api.github.com/users/bob-carpenter/events{/privacy}","received_events_url":"https://api.github.com/users/bob-carpenter/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T16:37:28Z","updated_at":"2016-04-15T16:37:28Z","body":"You just need to make sure the declarations (not necessarily the\ndefinitions) come before the instantiations.\n\nThe bad case is this:\n\n====================================\ntemplate <typename A>\nstruct foo {\n  A a_;\n  foo(const A& a) : a_(a) { }\n};\n\nint bar() {\n  return foo<int>(3).a_;\n}\n\ntemplate <>\nstruct foo<int> {\n  int x_;\n  foo(int x) : x_(2 * x) { }\n}\n\nint main() {\n  return bar();\n}\n=====================================\n\n./bad.cpp:12:8: error: explicit specialization of 'foo<int>' after instantiation\nstruct foo<int> {\n       ^~~~~~~~\n\nIf you drop in the forward declaration before the definition of bar():\n\n\n=======================================\ntemplate <> struct foo<int>;\n===================================\n\nyou get\n\n./bad.cpp:10:10: error: 'foo<int>' is an incomplete type\n  return foo<int>(3).a_;\n         ^\n./bad.cpp:7:20: note: forward declaration of 'foo<int>'\ntemplate <> struct foo<int>;\n\n\nSo the point is that \n\n1)  you can't instantiate a general template class then specialize\nlater (first case)\n\n2)  you must define before you instantiate (second case)\n\n- Bob\n\n> On Apr 14, 2016, at 6:05 PM, Michael Betancourt <notifications@github.com> wrote:\n> \n> So I need prototypes of the specializations of the autodiff functions\n> with higher-order autodiff types and the softabs functional defined\n> in softabs_metric?\n> \n> On Apr 14, 2016, at 10:53 PM, Bob Carpenter <notifications@github.com> wrote:\n> \n> > See\n> > \n> > http://stackoverflow.com/questions/21112148/specialization-of-member-function-template-after-instantiation-error-and-order\n> > \n> > http://stackoverflow.com/questions/7774188/explicit-specialization-after-instantiation\n> > \n> > It's about member functions, but the point's the same. You need\n> > to have all the definitions included before any of the instantiations.\n> > For some reason, some compilers are pickier than others about this.\n> > \n> > Oh how I miss Java, where the order didn't matter!\n> > \n> > > On Apr 14, 2016, at 8:10 AM, Michael Betancourt <notifications@github.com> wrote:\n> > > \n> > > Anyone understand the Windows error trying to instantiate the higher-order autodiff types?\n> > > \n> > > —\n> > > You are receiving this because you are subscribed to this thread.\n> > > Reply to this email directly or view it on GitHub\n> > > \n> > \n> > —\n> > You are receiving this because you authored the thread.\n> > Reply to this email directly or view it on GitHub\n> > \n> \n> —\n> You are receiving this because you commented.\n> Reply to this email directly or view it on GitHub\n> \n\n"}}