{"action":"created","issue":{"url":"https://api.github.com/repos/stan-dev/stan/issues/1339","labels_url":"https://api.github.com/repos/stan-dev/stan/issues/1339/labels{/name}","comments_url":"https://api.github.com/repos/stan-dev/stan/issues/1339/comments","events_url":"https://api.github.com/repos/stan-dev/stan/issues/1339/events","html_url":"https://github.com/stan-dev/stan/issues/1339","id":59769317,"number":1339,"title":"use our multiply overrides for matrix arithmetic","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},"labels":[{"url":"https://api.github.com/repos/stan-dev/stan/labels/Code%20cleanup","name":"Code cleanup","color":"006b75"},{"url":"https://api.github.com/repos/stan-dev/stan/labels/Feature","name":"Feature","color":"84b6eb"},{"url":"https://api.github.com/repos/stan-dev/stan/labels/language","name":"language","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"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},"milestone":{"url":"https://api.github.com/repos/stan-dev/stan/milestones/14","html_url":"https://github.com/stan-dev/stan/milestones/v2.6.1++","labels_url":"https://api.github.com/repos/stan-dev/stan/milestones/14/labels","id":1004310,"number":14,"title":"v2.6.1++","description":"Next version after 2.6.1.","creator":{"login":"syclik","id":425751,"avatar_url":"https://avatars.githubusercontent.com/u/425751?v=3","gravatar_id":"","url":"https://api.github.com/users/syclik","html_url":"https://github.com/syclik","followers_url":"https://api.github.com/users/syclik/followers","following_url":"https://api.github.com/users/syclik/following{/other_user}","gists_url":"https://api.github.com/users/syclik/gists{/gist_id}","starred_url":"https://api.github.com/users/syclik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syclik/subscriptions","organizations_url":"https://api.github.com/users/syclik/orgs","repos_url":"https://api.github.com/users/syclik/repos","events_url":"https://api.github.com/users/syclik/events{/privacy}","received_events_url":"https://api.github.com/users/syclik/received_events","type":"User","site_admin":false},"open_issues":38,"closed_issues":4,"state":"open","created_at":"2015-03-03T16:55:40Z","updated_at":"2015-03-04T15:40:35Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2015-03-04T09:08:53Z","updated_at":"2015-03-05T07:55:25Z","closed_at":null,"body":"For all of our internal matrix arithmetic, we should be using our own `multiply()` functions if there are autodiff variables involved rather than `operator*()` from Eigen.  There are currently instances in functions that are relying on implicit promotion.  One example is `lkj_cholesky_cor_log`\r\n\r\nOne approach is to:\r\n\r\n* [ ] implement `operator*()` for all the `var` and `fvar` matrix types\r\n\r\nThe benefits are\r\n\r\n* argument-dependent lookup would pull in the right definition\r\n* this would be used by Eigen programs we autodiff through\r\n* it'd be easier for users of our C++ API \r\n\r\nThis one's important because I believe we're inadvertently promoting to var and using generic Eigen types algorithms ather than getting our more effficient specialized `multiply()` operators.  This has the potential to be a huge speedup for the implicated functions which we'll have to hunt down in the code.  "},"comment":{"url":"https://api.github.com/repos/stan-dev/stan/issues/comments/77321336","html_url":"https://github.com/stan-dev/stan/issues/1339#issuecomment-77321336","issue_url":"https://api.github.com/repos/stan-dev/stan/issues/1339","id":77321336,"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":"2015-03-05T07:55:25Z","updated_at":"2015-03-05T07:55:25Z","body":"The first issue writeup was dead wrong.  We *are* compiling to `multiply()` in the language.  I rewrote the issue because the problem actually lies in functions like `lkj_cholesky_corr_log`, which are using Eigen `operator*` operators, which will inadvertently promote `double` values to `var` and then use Eigen's built-in operator definitions, which are much less efficient for autodiff than our specialized ones."}}