{"action":"created","comment":{"url":"https://api.github.com/repos/C5T/Current/pulls/comments/92193090","pull_request_review_id":12703504,"id":92193090,"diff_hunk":"@@ -1,8 +1,131 @@\n # `FnCAS`\n \n-FnCAS, originally stands for \"FnCAS is not a Computer Algebra System\", is a fast and easy-to-use wrapper for gradient-descent-based optimization of convex functions. The speed is achieved by JIT-compilation of the function and its gradient, and the ease of use comes from automated analytical differnetiation.\n+FnCAS, originally stands for \"FnCAS is not a Computer Algebra System\", is a fast and easy-to-use wrapper for gradient-descent-based optimization of convex functions. The speed is achieved by JIT-compilation of the function and its gradient, and the ease of use comes from automated analytical differentiation.\n \n-More README to come soon. Sample code and examples can be found at:\n+## Gentle Introduction\n+\n+The snippets below require nothing but `git clone`-ing Current and `#include`-ing `FnCAS/fncas/fncas.h`.\n+\n+(Fine, for `JSON()` you'd also need `TypeSystem/Serialization/json.h`. But, really, that's it.)\n+\n+```cpp\n+\n+// Define a simple function of two arguments.\n+//\n+// Note that the only change required in the user code is to change `double`\n+// into `template T` in the good old `double f(const std::vector<double>& x)`\n+// declaration.\n+//\n+// The rest of the magic is handled transparently by FnCAS.\n+template <typename T>\n+T simple_function(const std::vector<T>& x) {\n+  ++number_of_calls;\n+  assert(x.size() == 2u);\n+  // `sqr(x)` is a convenience defined within `fncas::` for ML purposes,\n+  // along with `ramp(v)` and `unit_step(v)`.\n+  return fncas::sqr(x[0] + 1) + fncas::sqr(x[1] + 2);\n+  // Alternatively, `#define INJECT_FNCAS_INTO_NAMESPACE_STD` and use\n+  // the mathematical library from within the `std::` namespace.\n+}\n+\n+// Make a few native C++ calls.\n+number_of_calls = 0;\n+EXPECT_EQ(5, simple_function(std::vector<double>({0, 0})));\n+EXPECT_EQ(4*4 + 3*3, simple_function(std::vector<double>({-5, -5})));\n+ASSERT_EQ(2, number_of_calls);\n+\n+// Wrap a native C++ function into an FnCAS type.\n+// This type allows passing functions around without thinking of whether they\n+// are native functions, blueprints, or JIT-compiled dynamically linked `.so`-s.\n+// The `2` parameter is the dimensionality of the function.\n+fncas::function_reference_t native(simple_function<double>, 2);\n+const fncas::function_t& reference = native;\n+\n+number_of_calls = 0;\n+EXPECT_EQ(5, reference(std::vector<double>({0, 0})));\n+EXPECT_EQ(4*4 + 3*3, reference(std::vector<double>({-5, -5})));\n+ASSERT_EQ(2, number_of_calls);  // By-reference evaluation doesn't call the function.","path":"FnCAS/README.md","position":null,"original_position":49,"commit_id":"4ff97ce9c80f770797bdc62dbfb9607c45757531","original_commit_id":"a98f5ba4ad62d8489eaaa7de2ec77a9bdb0a40f5","user":{"login":"dkorolev","id":2159447,"avatar_url":"https://avatars.githubusercontent.com/u/2159447?v=3","gravatar_id":"","url":"https://api.github.com/users/dkorolev","html_url":"https://github.com/dkorolev","followers_url":"https://api.github.com/users/dkorolev/followers","following_url":"https://api.github.com/users/dkorolev/following{/other_user}","gists_url":"https://api.github.com/users/dkorolev/gists{/gist_id}","starred_url":"https://api.github.com/users/dkorolev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkorolev/subscriptions","organizations_url":"https://api.github.com/users/dkorolev/orgs","repos_url":"https://api.github.com/users/dkorolev/repos","events_url":"https://api.github.com/users/dkorolev/events{/privacy}","received_events_url":"https://api.github.com/users/dkorolev/received_events","type":"User","site_admin":false},"body":"Cleaned up in 88a8cea. Good catch!","created_at":"2016-12-13T15:33:06Z","updated_at":"2016-12-13T15:33:06Z","html_url":"https://github.com/C5T/Current/pull/699#discussion_r92193090","pull_request_url":"https://api.github.com/repos/C5T/Current/pulls/699","_links":{"self":{"href":"https://api.github.com/repos/C5T/Current/pulls/comments/92193090"},"html":{"href":"https://github.com/C5T/Current/pull/699#discussion_r92193090"},"pull_request":{"href":"https://api.github.com/repos/C5T/Current/pulls/699"}}},"pull_request":{"url":"https://api.github.com/repos/C5T/Current/pulls/699","id":97468818,"html_url":"https://github.com/C5T/Current/pull/699","diff_url":"https://github.com/C5T/Current/pull/699.diff","patch_url":"https://github.com/C5T/Current/pull/699.patch","issue_url":"https://api.github.com/repos/C5T/Current/issues/699","number":699,"state":"open","locked":false,"title":"Injected FnCAS math into `std::` as well.","user":{"login":"dkorolev","id":2159447,"avatar_url":"https://avatars.githubusercontent.com/u/2159447?v=3","gravatar_id":"","url":"https://api.github.com/users/dkorolev","html_url":"https://github.com/dkorolev","followers_url":"https://api.github.com/users/dkorolev/followers","following_url":"https://api.github.com/users/dkorolev/following{/other_user}","gists_url":"https://api.github.com/users/dkorolev/gists{/gist_id}","starred_url":"https://api.github.com/users/dkorolev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkorolev/subscriptions","organizations_url":"https://api.github.com/users/dkorolev/orgs","repos_url":"https://api.github.com/users/dkorolev/repos","events_url":"https://api.github.com/users/dkorolev/events{/privacy}","received_events_url":"https://api.github.com/users/dkorolev/received_events","type":"User","site_admin":false},"body":"CC @forwidur.","created_at":"2016-12-11T19:09:15Z","updated_at":"2016-12-13T15:33:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76ef3ffc2f29415a7970af3bd879e644451bef3c","assignee":{"login":"mzhurovich","id":11226961,"avatar_url":"https://avatars.githubusercontent.com/u/11226961?v=3","gravatar_id":"","url":"https://api.github.com/users/mzhurovich","html_url":"https://github.com/mzhurovich","followers_url":"https://api.github.com/users/mzhurovich/followers","following_url":"https://api.github.com/users/mzhurovich/following{/other_user}","gists_url":"https://api.github.com/users/mzhurovich/gists{/gist_id}","starred_url":"https://api.github.com/users/mzhurovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mzhurovich/subscriptions","organizations_url":"https://api.github.com/users/mzhurovich/orgs","repos_url":"https://api.github.com/users/mzhurovich/repos","events_url":"https://api.github.com/users/mzhurovich/events{/privacy}","received_events_url":"https://api.github.com/users/mzhurovich/received_events","type":"User","site_admin":false},"assignees":[{"login":"mzhurovich","id":11226961,"avatar_url":"https://avatars.githubusercontent.com/u/11226961?v=3","gravatar_id":"","url":"https://api.github.com/users/mzhurovich","html_url":"https://github.com/mzhurovich","followers_url":"https://api.github.com/users/mzhurovich/followers","following_url":"https://api.github.com/users/mzhurovich/following{/other_user}","gists_url":"https://api.github.com/users/mzhurovich/gists{/gist_id}","starred_url":"https://api.github.com/users/mzhurovich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mzhurovich/subscriptions","organizations_url":"https://api.github.com/users/mzhurovich/orgs","repos_url":"https://api.github.com/users/mzhurovich/repos","events_url":"https://api.github.com/users/mzhurovich/events{/privacy}","received_events_url":"https://api.github.com/users/mzhurovich/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/C5T/Current/pulls/699/commits","review_comments_url":"https://api.github.com/repos/C5T/Current/pulls/699/comments","review_comment_url":"https://api.github.com/repos/C5T/Current/pulls/comments{/number}","comments_url":"https://api.github.com/repos/C5T/Current/issues/699/comments","statuses_url":"https://api.github.com/repos/C5T/Current/statuses/4ff97ce9c80f770797bdc62dbfb9607c45757531","head":{"label":"dkorolev:master","ref":"master","sha":"4ff97ce9c80f770797bdc62dbfb9607c45757531","user":{"login":"dkorolev","id":2159447,"avatar_url":"https://avatars.githubusercontent.com/u/2159447?v=3","gravatar_id":"","url":"https://api.github.com/users/dkorolev","html_url":"https://github.com/dkorolev","followers_url":"https://api.github.com/users/dkorolev/followers","following_url":"https://api.github.com/users/dkorolev/following{/other_user}","gists_url":"https://api.github.com/users/dkorolev/gists{/gist_id}","starred_url":"https://api.github.com/users/dkorolev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkorolev/subscriptions","organizations_url":"https://api.github.com/users/dkorolev/orgs","repos_url":"https://api.github.com/users/dkorolev/repos","events_url":"https://api.github.com/users/dkorolev/events{/privacy}","received_events_url":"https://api.github.com/users/dkorolev/received_events","type":"User","site_admin":false},"repo":{"id":27625438,"name":"Current","full_name":"dkorolev/Current","owner":{"login":"dkorolev","id":2159447,"avatar_url":"https://avatars.githubusercontent.com/u/2159447?v=3","gravatar_id":"","url":"https://api.github.com/users/dkorolev","html_url":"https://github.com/dkorolev","followers_url":"https://api.github.com/users/dkorolev/followers","following_url":"https://api.github.com/users/dkorolev/following{/other_user}","gists_url":"https://api.github.com/users/dkorolev/gists{/gist_id}","starred_url":"https://api.github.com/users/dkorolev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkorolev/subscriptions","organizations_url":"https://api.github.com/users/dkorolev/orgs","repos_url":"https://api.github.com/users/dkorolev/repos","events_url":"https://api.github.com/users/dkorolev/events{/privacy}","received_events_url":"https://api.github.com/users/dkorolev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dkorolev/Current","description":"Data Infrastructure in a Box:","fork":true,"url":"https://api.github.com/repos/dkorolev/Current","forks_url":"https://api.github.com/repos/dkorolev/Current/forks","keys_url":"https://api.github.com/repos/dkorolev/Current/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dkorolev/Current/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dkorolev/Current/teams","hooks_url":"https://api.github.com/repos/dkorolev/Current/hooks","issue_events_url":"https://api.github.com/repos/dkorolev/Current/issues/events{/number}","events_url":"https://api.github.com/repos/dkorolev/Current/events","assignees_url":"https://api.github.com/repos/dkorolev/Current/assignees{/user}","branches_url":"https://api.github.com/repos/dkorolev/Current/branches{/branch}","tags_url":"https://api.github.com/repos/dkorolev/Current/tags","blobs_url":"https://api.github.com/repos/dkorolev/Current/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dkorolev/Current/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dkorolev/Current/git/refs{/sha}","trees_url":"https://api.github.com/repos/dkorolev/Current/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dkorolev/Current/statuses/{sha}","languages_url":"https://api.github.com/repos/dkorolev/Current/languages","stargazers_url":"https://api.github.com/repos/dkorolev/Current/stargazers","contributors_url":"https://api.github.com/repos/dkorolev/Current/contributors","subscribers_url":"https://api.github.com/repos/dkorolev/Current/subscribers","subscription_url":"https://api.github.com/repos/dkorolev/Current/subscription","commits_url":"https://api.github.com/repos/dkorolev/Current/commits{/sha}","git_commits_url":"https://api.github.com/repos/dkorolev/Current/git/commits{/sha}","comments_url":"https://api.github.com/repos/dkorolev/Current/comments{/number}","issue_comment_url":"https://api.github.com/repos/dkorolev/Current/issues/comments{/number}","contents_url":"https://api.github.com/repos/dkorolev/Current/contents/{+path}","compare_url":"https://api.github.com/repos/dkorolev/Current/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dkorolev/Current/merges","archive_url":"https://api.github.com/repos/dkorolev/Current/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dkorolev/Current/downloads","issues_url":"https://api.github.com/repos/dkorolev/Current/issues{/number}","pulls_url":"https://api.github.com/repos/dkorolev/Current/pulls{/number}","milestones_url":"https://api.github.com/repos/dkorolev/Current/milestones{/number}","notifications_url":"https://api.github.com/repos/dkorolev/Current/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dkorolev/Current/labels{/name}","releases_url":"https://api.github.com/repos/dkorolev/Current/releases{/id}","deployments_url":"https://api.github.com/repos/dkorolev/Current/deployments","created_at":"2014-12-06T06:52:51Z","updated_at":"2016-10-22T05:39:22Z","pushed_at":"2016-12-13T15:32:54Z","git_url":"git://github.com/dkorolev/Current.git","ssh_url":"git@github.com:dkorolev/Current.git","clone_url":"https://github.com/dkorolev/Current.git","svn_url":"https://github.com/dkorolev/Current","homepage":"http://dima.ai/static/current.pdf","size":13898,"stargazers_count":4,"watchers_count":4,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":4,"default_branch":"master"}},"base":{"label":"C5T:master","ref":"master","sha":"8130029a35b3924c531396cd56f78cfdab431163","user":{"login":"C5T","id":12224789,"avatar_url":"https://avatars.githubusercontent.com/u/12224789?v=3","gravatar_id":"","url":"https://api.github.com/users/C5T","html_url":"https://github.com/C5T","followers_url":"https://api.github.com/users/C5T/followers","following_url":"https://api.github.com/users/C5T/following{/other_user}","gists_url":"https://api.github.com/users/C5T/gists{/gist_id}","starred_url":"https://api.github.com/users/C5T/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/C5T/subscriptions","organizations_url":"https://api.github.com/users/C5T/orgs","repos_url":"https://api.github.com/users/C5T/repos","events_url":"https://api.github.com/users/C5T/events{/privacy}","received_events_url":"https://api.github.com/users/C5T/received_events","type":"Organization","site_admin":false},"repo":{"id":27625425,"name":"Current","full_name":"C5T/Current","owner":{"login":"C5T","id":12224789,"avatar_url":"https://avatars.githubusercontent.com/u/12224789?v=3","gravatar_id":"","url":"https://api.github.com/users/C5T","html_url":"https://github.com/C5T","followers_url":"https://api.github.com/users/C5T/followers","following_url":"https://api.github.com/users/C5T/following{/other_user}","gists_url":"https://api.github.com/users/C5T/gists{/gist_id}","starred_url":"https://api.github.com/users/C5T/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/C5T/subscriptions","organizations_url":"https://api.github.com/users/C5T/orgs","repos_url":"https://api.github.com/users/C5T/repos","events_url":"https://api.github.com/users/C5T/events{/privacy}","received_events_url":"https://api.github.com/users/C5T/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/C5T/Current","description":"Data Infrastructure in a Box.","fork":false,"url":"https://api.github.com/repos/C5T/Current","forks_url":"https://api.github.com/repos/C5T/Current/forks","keys_url":"https://api.github.com/repos/C5T/Current/keys{/key_id}","collaborators_url":"https://api.github.com/repos/C5T/Current/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/C5T/Current/teams","hooks_url":"https://api.github.com/repos/C5T/Current/hooks","issue_events_url":"https://api.github.com/repos/C5T/Current/issues/events{/number}","events_url":"https://api.github.com/repos/C5T/Current/events","assignees_url":"https://api.github.com/repos/C5T/Current/assignees{/user}","branches_url":"https://api.github.com/repos/C5T/Current/branches{/branch}","tags_url":"https://api.github.com/repos/C5T/Current/tags","blobs_url":"https://api.github.com/repos/C5T/Current/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/C5T/Current/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/C5T/Current/git/refs{/sha}","trees_url":"https://api.github.com/repos/C5T/Current/git/trees{/sha}","statuses_url":"https://api.github.com/repos/C5T/Current/statuses/{sha}","languages_url":"https://api.github.com/repos/C5T/Current/languages","stargazers_url":"https://api.github.com/repos/C5T/Current/stargazers","contributors_url":"https://api.github.com/repos/C5T/Current/contributors","subscribers_url":"https://api.github.com/repos/C5T/Current/subscribers","subscription_url":"https://api.github.com/repos/C5T/Current/subscription","commits_url":"https://api.github.com/repos/C5T/Current/commits{/sha}","git_commits_url":"https://api.github.com/repos/C5T/Current/git/commits{/sha}","comments_url":"https://api.github.com/repos/C5T/Current/comments{/number}","issue_comment_url":"https://api.github.com/repos/C5T/Current/issues/comments{/number}","contents_url":"https://api.github.com/repos/C5T/Current/contents/{+path}","compare_url":"https://api.github.com/repos/C5T/Current/compare/{base}...{head}","merges_url":"https://api.github.com/repos/C5T/Current/merges","archive_url":"https://api.github.com/repos/C5T/Current/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/C5T/Current/downloads","issues_url":"https://api.github.com/repos/C5T/Current/issues{/number}","pulls_url":"https://api.github.com/repos/C5T/Current/pulls{/number}","milestones_url":"https://api.github.com/repos/C5T/Current/milestones{/number}","notifications_url":"https://api.github.com/repos/C5T/Current/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/C5T/Current/labels{/name}","releases_url":"https://api.github.com/repos/C5T/Current/releases{/id}","deployments_url":"https://api.github.com/repos/C5T/Current/deployments","created_at":"2014-12-06T06:52:23Z","updated_at":"2016-10-24T14:02:04Z","pushed_at":"2016-12-13T15:32:54Z","git_url":"git://github.com/C5T/Current.git","ssh_url":"git@github.com:C5T/Current.git","clone_url":"https://github.com/C5T/Current.git","svn_url":"https://github.com/C5T/Current","homepage":"http://dima.ai/static/current.pdf","size":13683,"stargazers_count":29,"watchers_count":29,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":11,"forks":13,"open_issues":11,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/C5T/Current/pulls/699"},"html":{"href":"https://github.com/C5T/Current/pull/699"},"issue":{"href":"https://api.github.com/repos/C5T/Current/issues/699"},"comments":{"href":"https://api.github.com/repos/C5T/Current/issues/699/comments"},"review_comments":{"href":"https://api.github.com/repos/C5T/Current/pulls/699/comments"},"review_comment":{"href":"https://api.github.com/repos/C5T/Current/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/C5T/Current/pulls/699/commits"},"statuses":{"href":"https://api.github.com/repos/C5T/Current/statuses/4ff97ce9c80f770797bdc62dbfb9607c45757531"}}}}
{"actor":{"display_login":"dkorolev"}}