{"action":"created","issue":{"url":"https://api.github.com/repos/sympy/sympy/issues/11637","repository_url":"https://api.github.com/repos/sympy/sympy","labels_url":"https://api.github.com/repos/sympy/sympy/issues/11637/labels{/name}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/11637/comments","events_url":"https://api.github.com/repos/sympy/sympy/issues/11637/events","html_url":"https://github.com/sympy/sympy/pull/11637","id":178072610,"number":11637,"title":"Expose C99/C++11 functions in printers","user":{"login":"bjodah","id":485936,"avatar_url":"https://avatars.githubusercontent.com/u/485936?v=3","gravatar_id":"","url":"https://api.github.com/users/bjodah","html_url":"https://github.com/bjodah","followers_url":"https://api.github.com/users/bjodah/followers","following_url":"https://api.github.com/users/bjodah/following{/other_user}","gists_url":"https://api.github.com/users/bjodah/gists{/gist_id}","starred_url":"https://api.github.com/users/bjodah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjodah/subscriptions","organizations_url":"https://api.github.com/users/bjodah/orgs","repos_url":"https://api.github.com/users/bjodah/repos","events_url":"https://api.github.com/users/bjodah/events{/privacy}","received_events_url":"https://api.github.com/users/bjodah/received_events","type":"User","site_admin":false},"labels":[{"id":327068273,"url":"https://api.github.com/repos/sympy/sympy/labels/codegen","name":"codegen","color":"0000ff","default":false},{"id":84627348,"url":"https://api.github.com/repos/sympy/sympy/labels/enhancement","name":"enhancement","color":"d4c5f9","default":true},{"id":84627347,"url":"https://api.github.com/repos/sympy/sympy/labels/printing","name":"printing","color":"0000FF","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-09-20T14:15:47Z","updated_at":"2016-12-23T18:52:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sympy/sympy/pulls/11637","html_url":"https://github.com/sympy/sympy/pull/11637","diff_url":"https://github.com/sympy/sympy/pull/11637.diff","patch_url":"https://github.com/sympy/sympy/pull/11637.patch"},"body":"### Summary\r\n- New modules: `sympy.printing.cxxcode`, `sympy.codegen.cfunctions`\r\n- New printers: `C99CodePrinter`, `CXX98CodePrinter`, `CXX11CodePrinter` & provisional `_CXX17CodePrinter`\r\n- New kwarg in `ccode`: `standard`\r\n- New function: `cxxcode`\r\n- New SymPy classes for C99/C++11 functions (e.g. `expm1`, `log1p` etc.) (in `.codegen.cfunctions`).\r\n- Fixes #11353 \r\n- Fixes #11953\r\n- Fixes #11969 \r\n\r\n#### TODO\r\n- [x] handle `standard` kwarg in `ccode`.\r\n- [x] move `cfunctions` to `.util.codegen`\r\n\r\nEventually we would like to have a helper function along the lines of:\r\n\r\n```\r\n>>> smart_ccode(2**x + log(x)/log(2))\r\n'exp2(x) + log2(x)'\r\n>>> smart_ccode((2*exp(x) - 2)*(3*exp(y) - 3), typically={x: x < 0.1})\r\n'6*expm1(x)*(exp(y) - 1)'\r\n```\r\n\r\nbut there is already a lot of things to discuss around this PR so I thought this was an appropriate time for a review.\r\n\r\nSome bullet points for discussion:\r\n- how should we handle different standards? e.g. C89 vs. C99 vs. C11, e.g. now I created a subclass printer and set ~~`language='C99'`~~ `standard='C99`\r\n- The helper functions in `printing.cfunctions` now define `_eval_expand_func`, `_eval_rewrite_as_tractable` and `fdiff`, anything more that would be useful here?\r\n- I introduced `CXX98CodePrinter` and `CXX11CodePrinter` in `printing.cxxcode`, using qualified names (`std::` whenever possible). ~~There is most certainly still work to be done here.~~\r\n- I would have liked to introduce a `C89CodePrinter` (which would have been the `CCodePrinter` minus some C99 features which have crept in), but I think that it would confuse more than anything else: people will wonder what role `CCodePrinter` has then.\r\n"},"comment":{"url":"https://api.github.com/repos/sympy/sympy/issues/comments/269031363","html_url":"https://github.com/sympy/sympy/pull/11637#issuecomment-269031363","issue_url":"https://api.github.com/repos/sympy/sympy/issues/11637","id":269031363,"user":{"login":"asmeurer","id":71486,"avatar_url":"https://avatars.githubusercontent.com/u/71486?v=3","gravatar_id":"","url":"https://api.github.com/users/asmeurer","html_url":"https://github.com/asmeurer","followers_url":"https://api.github.com/users/asmeurer/followers","following_url":"https://api.github.com/users/asmeurer/following{/other_user}","gists_url":"https://api.github.com/users/asmeurer/gists{/gist_id}","starred_url":"https://api.github.com/users/asmeurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmeurer/subscriptions","organizations_url":"https://api.github.com/users/asmeurer/orgs","repos_url":"https://api.github.com/users/asmeurer/repos","events_url":"https://api.github.com/users/asmeurer/events{/privacy}","received_events_url":"https://api.github.com/users/asmeurer/received_events","type":"User","site_admin":false},"created_at":"2016-12-23T18:52:36Z","updated_at":"2016-12-23T18:52:36Z","body":"Maybe add some docstrings/doctests to the cfunctions (and add them to the Sphinx docs). "}}
{"actor":{"display_login":"asmeurer"}}