{"action":"created","comment":{"url":"https://api.github.com/repos/3Hren/metrics/pulls/comments/89747350","pull_request_review_id":10276705,"id":89747350,"diff_hunk":"@@ -0,0 +1,52 @@\n+#include \"metrics/usts/ewma.hpp\"\n+\n+namespace metrics {\n+namespace usts {\n+\n+template<typename Clock>\n+ewma<Clock>::ewma(duration interval) :\n+    τ(std::chrono::duration_cast<std::chrono::nanoseconds>(interval).count()),\n+    average()\n+{\n+    if (interval == clock_type::duration::zero()) {\n+        throw std::invalid_argument(\"interval can not be zero\");\n+    }\n+}\n+\n+template<typename Clock>\n+auto ewma<Clock>::add(time_point time, double value) -> void {\n+    if (time < prev) {\n+        throw std::invalid_argument(\"time argument must monotonically increase\");\n+    }\n+\n+    if (initialized.test_and_set()) {\n+        const auto ẟ = std::chrono::duration_cast<std::chrono::nanoseconds>(time - prev).count();\n+        const auto α = ẟ / τ;\n+        const auto µ = std::exp(-α);\n+        average = µ * average + (1 - µ) * value;","path":"src/usts/ewma.cpp","position":null,"original_position":26,"commit_id":"35cb4a32c83f326acbd33cba76d8a7f0c4929f2c","original_commit_id":"6cb8adfd7050ea144d9ee8cee9e9a62676724245","user":{"login":"antmat","id":691770,"avatar_url":"https://avatars.githubusercontent.com/u/691770?v=3","gravatar_id":"","url":"https://api.github.com/users/antmat","html_url":"https://github.com/antmat","followers_url":"https://api.github.com/users/antmat/followers","following_url":"https://api.github.com/users/antmat/following{/other_user}","gists_url":"https://api.github.com/users/antmat/gists{/gist_id}","starred_url":"https://api.github.com/users/antmat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antmat/subscriptions","organizations_url":"https://api.github.com/users/antmat/orgs","repos_url":"https://api.github.com/users/antmat/repos","events_url":"https://api.github.com/users/antmat/events{/privacy}","received_events_url":"https://api.github.com/users/antmat/received_events","type":"User","site_admin":false},"body":"Looks valid, but I don't fully understand where does it go from.","created_at":"2016-11-28T09:54:31Z","updated_at":"2016-11-28T09:56:50Z","html_url":"https://github.com/3Hren/metrics/pull/10#discussion_r89747350","pull_request_url":"https://api.github.com/repos/3Hren/metrics/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/3Hren/metrics/pulls/comments/89747350"},"html":{"href":"https://github.com/3Hren/metrics/pull/10#discussion_r89747350"},"pull_request":{"href":"https://api.github.com/repos/3Hren/metrics/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/3Hren/metrics/pulls/10","id":95413288,"html_url":"https://github.com/3Hren/metrics/pull/10","diff_url":"https://github.com/3Hren/metrics/pull/10.diff","patch_url":"https://github.com/3Hren/metrics/pull/10.patch","issue_url":"https://api.github.com/repos/3Hren/metrics/issues/10","number":10,"state":"open","locked":false,"title":"feat: EMA for unequally sized time series","user":{"login":"3Hren","id":969900,"avatar_url":"https://avatars.githubusercontent.com/u/969900?v=3","gravatar_id":"","url":"https://api.github.com/users/3Hren","html_url":"https://github.com/3Hren","followers_url":"https://api.github.com/users/3Hren/followers","following_url":"https://api.github.com/users/3Hren/following{/other_user}","gists_url":"https://api.github.com/users/3Hren/gists{/gist_id}","starred_url":"https://api.github.com/users/3Hren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3Hren/subscriptions","organizations_url":"https://api.github.com/users/3Hren/orgs","repos_url":"https://api.github.com/users/3Hren/repos","events_url":"https://api.github.com/users/3Hren/events{/privacy}","received_events_url":"https://api.github.com/users/3Hren/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-27T19:32:28Z","updated_at":"2016-11-28T09:56:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac41365c71e9f8ca419ae077ee84f27d785ad567","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/3Hren/metrics/pulls/10/commits","review_comments_url":"https://api.github.com/repos/3Hren/metrics/pulls/10/comments","review_comment_url":"https://api.github.com/repos/3Hren/metrics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/3Hren/metrics/issues/10/comments","statuses_url":"https://api.github.com/repos/3Hren/metrics/statuses/35cb4a32c83f326acbd33cba76d8a7f0c4929f2c","head":{"label":"3Hren:develop","ref":"develop","sha":"35cb4a32c83f326acbd33cba76d8a7f0c4929f2c","user":{"login":"3Hren","id":969900,"avatar_url":"https://avatars.githubusercontent.com/u/969900?v=3","gravatar_id":"","url":"https://api.github.com/users/3Hren","html_url":"https://github.com/3Hren","followers_url":"https://api.github.com/users/3Hren/followers","following_url":"https://api.github.com/users/3Hren/following{/other_user}","gists_url":"https://api.github.com/users/3Hren/gists{/gist_id}","starred_url":"https://api.github.com/users/3Hren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3Hren/subscriptions","organizations_url":"https://api.github.com/users/3Hren/orgs","repos_url":"https://api.github.com/users/3Hren/repos","events_url":"https://api.github.com/users/3Hren/events{/privacy}","received_events_url":"https://api.github.com/users/3Hren/received_events","type":"User","site_admin":false},"repo":{"id":44523682,"name":"metrics","full_name":"3Hren/metrics","owner":{"login":"3Hren","id":969900,"avatar_url":"https://avatars.githubusercontent.com/u/969900?v=3","gravatar_id":"","url":"https://api.github.com/users/3Hren","html_url":"https://github.com/3Hren","followers_url":"https://api.github.com/users/3Hren/followers","following_url":"https://api.github.com/users/3Hren/following{/other_user}","gists_url":"https://api.github.com/users/3Hren/gists{/gist_id}","starred_url":"https://api.github.com/users/3Hren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3Hren/subscriptions","organizations_url":"https://api.github.com/users/3Hren/orgs","repos_url":"https://api.github.com/users/3Hren/repos","events_url":"https://api.github.com/users/3Hren/events{/privacy}","received_events_url":"https://api.github.com/users/3Hren/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/3Hren/metrics","description":null,"fork":false,"url":"https://api.github.com/repos/3Hren/metrics","forks_url":"https://api.github.com/repos/3Hren/metrics/forks","keys_url":"https://api.github.com/repos/3Hren/metrics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/3Hren/metrics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/3Hren/metrics/teams","hooks_url":"https://api.github.com/repos/3Hren/metrics/hooks","issue_events_url":"https://api.github.com/repos/3Hren/metrics/issues/events{/number}","events_url":"https://api.github.com/repos/3Hren/metrics/events","assignees_url":"https://api.github.com/repos/3Hren/metrics/assignees{/user}","branches_url":"https://api.github.com/repos/3Hren/metrics/branches{/branch}","tags_url":"https://api.github.com/repos/3Hren/metrics/tags","blobs_url":"https://api.github.com/repos/3Hren/metrics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/3Hren/metrics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/3Hren/metrics/git/refs{/sha}","trees_url":"https://api.github.com/repos/3Hren/metrics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/3Hren/metrics/statuses/{sha}","languages_url":"https://api.github.com/repos/3Hren/metrics/languages","stargazers_url":"https://api.github.com/repos/3Hren/metrics/stargazers","contributors_url":"https://api.github.com/repos/3Hren/metrics/contributors","subscribers_url":"https://api.github.com/repos/3Hren/metrics/subscribers","subscription_url":"https://api.github.com/repos/3Hren/metrics/subscription","commits_url":"https://api.github.com/repos/3Hren/metrics/commits{/sha}","git_commits_url":"https://api.github.com/repos/3Hren/metrics/git/commits{/sha}","comments_url":"https://api.github.com/repos/3Hren/metrics/comments{/number}","issue_comment_url":"https://api.github.com/repos/3Hren/metrics/issues/comments{/number}","contents_url":"https://api.github.com/repos/3Hren/metrics/contents/{+path}","compare_url":"https://api.github.com/repos/3Hren/metrics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/3Hren/metrics/merges","archive_url":"https://api.github.com/repos/3Hren/metrics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/3Hren/metrics/downloads","issues_url":"https://api.github.com/repos/3Hren/metrics/issues{/number}","pulls_url":"https://api.github.com/repos/3Hren/metrics/pulls{/number}","milestones_url":"https://api.github.com/repos/3Hren/metrics/milestones{/number}","notifications_url":"https://api.github.com/repos/3Hren/metrics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/3Hren/metrics/labels{/name}","releases_url":"https://api.github.com/repos/3Hren/metrics/releases{/id}","deployments_url":"https://api.github.com/repos/3Hren/metrics/deployments","created_at":"2015-10-19T09:17:23Z","updated_at":"2016-10-24T13:39:02Z","pushed_at":"2016-11-28T09:36:19Z","git_url":"git://github.com/3Hren/metrics.git","ssh_url":"git@github.com:3Hren/metrics.git","clone_url":"https://github.com/3Hren/metrics.git","svn_url":"https://github.com/3Hren/metrics","homepage":null,"size":132,"stargazers_count":3,"watchers_count":3,"language":"C++","has_issues":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":3,"default_branch":"master"}},"base":{"label":"3Hren:master","ref":"master","sha":"590586b199071fe7cffa3eeb03a71a0c98dcdc6b","user":{"login":"3Hren","id":969900,"avatar_url":"https://avatars.githubusercontent.com/u/969900?v=3","gravatar_id":"","url":"https://api.github.com/users/3Hren","html_url":"https://github.com/3Hren","followers_url":"https://api.github.com/users/3Hren/followers","following_url":"https://api.github.com/users/3Hren/following{/other_user}","gists_url":"https://api.github.com/users/3Hren/gists{/gist_id}","starred_url":"https://api.github.com/users/3Hren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3Hren/subscriptions","organizations_url":"https://api.github.com/users/3Hren/orgs","repos_url":"https://api.github.com/users/3Hren/repos","events_url":"https://api.github.com/users/3Hren/events{/privacy}","received_events_url":"https://api.github.com/users/3Hren/received_events","type":"User","site_admin":false},"repo":{"id":44523682,"name":"metrics","full_name":"3Hren/metrics","owner":{"login":"3Hren","id":969900,"avatar_url":"https://avatars.githubusercontent.com/u/969900?v=3","gravatar_id":"","url":"https://api.github.com/users/3Hren","html_url":"https://github.com/3Hren","followers_url":"https://api.github.com/users/3Hren/followers","following_url":"https://api.github.com/users/3Hren/following{/other_user}","gists_url":"https://api.github.com/users/3Hren/gists{/gist_id}","starred_url":"https://api.github.com/users/3Hren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/3Hren/subscriptions","organizations_url":"https://api.github.com/users/3Hren/orgs","repos_url":"https://api.github.com/users/3Hren/repos","events_url":"https://api.github.com/users/3Hren/events{/privacy}","received_events_url":"https://api.github.com/users/3Hren/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/3Hren/metrics","description":null,"fork":false,"url":"https://api.github.com/repos/3Hren/metrics","forks_url":"https://api.github.com/repos/3Hren/metrics/forks","keys_url":"https://api.github.com/repos/3Hren/metrics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/3Hren/metrics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/3Hren/metrics/teams","hooks_url":"https://api.github.com/repos/3Hren/metrics/hooks","issue_events_url":"https://api.github.com/repos/3Hren/metrics/issues/events{/number}","events_url":"https://api.github.com/repos/3Hren/metrics/events","assignees_url":"https://api.github.com/repos/3Hren/metrics/assignees{/user}","branches_url":"https://api.github.com/repos/3Hren/metrics/branches{/branch}","tags_url":"https://api.github.com/repos/3Hren/metrics/tags","blobs_url":"https://api.github.com/repos/3Hren/metrics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/3Hren/metrics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/3Hren/metrics/git/refs{/sha}","trees_url":"https://api.github.com/repos/3Hren/metrics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/3Hren/metrics/statuses/{sha}","languages_url":"https://api.github.com/repos/3Hren/metrics/languages","stargazers_url":"https://api.github.com/repos/3Hren/metrics/stargazers","contributors_url":"https://api.github.com/repos/3Hren/metrics/contributors","subscribers_url":"https://api.github.com/repos/3Hren/metrics/subscribers","subscription_url":"https://api.github.com/repos/3Hren/metrics/subscription","commits_url":"https://api.github.com/repos/3Hren/metrics/commits{/sha}","git_commits_url":"https://api.github.com/repos/3Hren/metrics/git/commits{/sha}","comments_url":"https://api.github.com/repos/3Hren/metrics/comments{/number}","issue_comment_url":"https://api.github.com/repos/3Hren/metrics/issues/comments{/number}","contents_url":"https://api.github.com/repos/3Hren/metrics/contents/{+path}","compare_url":"https://api.github.com/repos/3Hren/metrics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/3Hren/metrics/merges","archive_url":"https://api.github.com/repos/3Hren/metrics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/3Hren/metrics/downloads","issues_url":"https://api.github.com/repos/3Hren/metrics/issues{/number}","pulls_url":"https://api.github.com/repos/3Hren/metrics/pulls{/number}","milestones_url":"https://api.github.com/repos/3Hren/metrics/milestones{/number}","notifications_url":"https://api.github.com/repos/3Hren/metrics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/3Hren/metrics/labels{/name}","releases_url":"https://api.github.com/repos/3Hren/metrics/releases{/id}","deployments_url":"https://api.github.com/repos/3Hren/metrics/deployments","created_at":"2015-10-19T09:17:23Z","updated_at":"2016-10-24T13:39:02Z","pushed_at":"2016-11-28T09:36:19Z","git_url":"git://github.com/3Hren/metrics.git","ssh_url":"git@github.com:3Hren/metrics.git","clone_url":"https://github.com/3Hren/metrics.git","svn_url":"https://github.com/3Hren/metrics","homepage":null,"size":132,"stargazers_count":3,"watchers_count":3,"language":"C++","has_issues":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":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/3Hren/metrics/pulls/10"},"html":{"href":"https://github.com/3Hren/metrics/pull/10"},"issue":{"href":"https://api.github.com/repos/3Hren/metrics/issues/10"},"comments":{"href":"https://api.github.com/repos/3Hren/metrics/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/3Hren/metrics/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/3Hren/metrics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/3Hren/metrics/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/3Hren/metrics/statuses/35cb4a32c83f326acbd33cba76d8a7f0c4929f2c"}}}}
{"actor":{"display_login":"antmat"}}