{"action":"created","comment":{"url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/comments/68808033","id":68808033,"diff_hunk":"@@ -0,0 +1,181 @@\n+#pragma once\n+#include <stdio.h>\n+#include <iostream>\n+#include <stdlib.h>\n+#include <string.h>\n+\n+#ifndef _WIN32\n+#include <sys/mman.h>\n+#endif\n+\n+using namespace std;\n+typedef float weight;\n+\n+class weight_vector;\n+\n+class weights_iterator_iterator\n+{\n+private:\n+\tweight* _cur;\n+public:\n+\tweights_iterator_iterator(weight* cur)\n+\t\t: _cur(cur)\n+\t{ }\n+\t\n+\tweight& operator*() { return *_cur; }\n+\n+\tweights_iterator_iterator& operator++()\n+\t{\n+\t\t_cur++;\n+\t\treturn *this;\n+\t}\n+\n+\ttemplate<typename T>\n+\tweights_iterator_iterator operator+(T index) { return weights_iterator_iterator(_cur + index); }\n+\n+\ttemplate<typename T>\n+\tweights_iterator_iterator& operator+=(T index)\n+\t{\n+\t\t_cur += index;\n+\t\treturn *this;\n+\t}\n+\n+\tweights_iterator_iterator& operator=(const weights_iterator_iterator& other)\n+\t{\n+\t\t_cur = other._cur;\n+\t\treturn *this;\n+\t}\n+\n+\tbool operator==(const weights_iterator_iterator& rhs) { return _cur == rhs._cur; }\n+\tbool operator!=(const weights_iterator_iterator& rhs) { return _cur != rhs._cur; }\n+\n+};\n+class weights_iterator\n+{\n+private:\n+\tweight* _current;\n+\tuint32_t _stride_shift;\n+\n+public:\n+\ttypedef weights_iterator_iterator w_iter;\n+\n+\tweights_iterator(weight* current, uint32_t stride_shift)\n+\t\t: _current(current), _stride_shift(stride_shift)\n+\t{ }\n+\n+\tweight& operator*() { return *_current; }\n+\n+\tweights_iterator& operator++()\n+\t{\n+\t\t_current += _stride_shift;\n+\t\treturn *this;\n+\t}\n+\n+\ttemplate<typename T>\n+\tweights_iterator operator+(T index) { return weights_iterator(_current + (index*_stride_shift), _stride_shift); }\n+\n+\ttemplate<typename T>\n+\tweights_iterator& operator+=(T index)\n+\t{\n+\t\t_current += (index*_stride_shift);\n+\t\treturn *this;\n+\t}\n+\n+\tweights_iterator& operator=(const weights_iterator& other)\n+\t{\n+\t\t_current = other._current;\n+\t\t_stride_shift = other._stride_shift;\n+\t\treturn *this;\n+\t}\n+\n+\tbool operator==(const weights_iterator& rhs) { return _current == rhs._current; }\n+\tbool operator!=(const weights_iterator& rhs) { return _current != rhs._current; }\n+\n+\t//to iterate within a bucket\n+\tw_iter begin() { return w_iter(_current); }\n+\tw_iter end(size_t offset) { return w_iter(_current + offset); }\n+\n+};\n+\n+class weight_vector //different name? (previously array_parameters)\n+{\n+private:\n+\tweight* _begin;\n+\tuint64_t _weight_mask;  // (stride*(1 << num_bits) -1)\n+\tuint32_t _stride_shift;\n+\tsize_t _size;\n+\tbool _seeded;\n+\n+public:\n+\ttypedef weights_iterator iterator;\n+\n+\tweight_vector()\n+\t\t: _begin(nullptr), _weight_mask((uint64_t)LONG_MAX), _size(0), _stride_shift(0),_seeded(false)\n+\t{ }\n+","path":"vowpalwabbit/array_parameters.h","position":115,"original_position":115,"commit_id":"d792eb33cc19d5e7b7214f45686afcb37a31ad45","original_commit_id":"d792eb33cc19d5e7b7214f45686afcb37a31ad45","user":{"login":"JohnLangford","id":79590,"avatar_url":"https://avatars.githubusercontent.com/u/79590?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnLangford","html_url":"https://github.com/JohnLangford","followers_url":"https://api.github.com/users/JohnLangford/followers","following_url":"https://api.github.com/users/JohnLangford/following{/other_user}","gists_url":"https://api.github.com/users/JohnLangford/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnLangford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnLangford/subscriptions","organizations_url":"https://api.github.com/users/JohnLangford/orgs","repos_url":"https://api.github.com/users/JohnLangford/repos","events_url":"https://api.github.com/users/JohnLangford/events{/privacy}","received_events_url":"https://api.github.com/users/JohnLangford/received_events","type":"User","site_admin":false},"body":"Why do we need a non-constructor like this?","created_at":"2016-06-28T17:54:11Z","updated_at":"2016-06-28T17:54:11Z","html_url":"https://github.com/JohnLangford/vowpal_wabbit/pull/1009#discussion_r68808033","pull_request_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/1009","_links":{"self":{"href":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/comments/68808033"},"html":{"href":"https://github.com/JohnLangford/vowpal_wabbit/pull/1009#discussion_r68808033"},"pull_request":{"href":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/1009"}}},"pull_request":{"url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/1009","id":72974230,"html_url":"https://github.com/JohnLangford/vowpal_wabbit/pull/1009","diff_url":"https://github.com/JohnLangford/vowpal_wabbit/pull/1009.diff","patch_url":"https://github.com/JohnLangford/vowpal_wabbit/pull/1009.patch","issue_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/1009","number":1009,"state":"open","locked":false,"title":"Implementation using base C++ array internally","user":{"login":"aartibagul","id":7064434,"avatar_url":"https://avatars.githubusercontent.com/u/7064434?v=3","gravatar_id":"","url":"https://api.github.com/users/aartibagul","html_url":"https://github.com/aartibagul","followers_url":"https://api.github.com/users/aartibagul/followers","following_url":"https://api.github.com/users/aartibagul/following{/other_user}","gists_url":"https://api.github.com/users/aartibagul/gists{/gist_id}","starred_url":"https://api.github.com/users/aartibagul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aartibagul/subscriptions","organizations_url":"https://api.github.com/users/aartibagul/orgs","repos_url":"https://api.github.com/users/aartibagul/repos","events_url":"https://api.github.com/users/aartibagul/events{/privacy}","received_events_url":"https://api.github.com/users/aartibagul/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-08T01:27:39Z","updated_at":"2016-06-28T17:54:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3bf20fdda37588abc357472275646e9b66e8445","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/1009/commits","review_comments_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/1009/comments","review_comment_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/1009/comments","statuses_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/statuses/d792eb33cc19d5e7b7214f45686afcb37a31ad45","head":{"label":"aartibagul:master","ref":"master","sha":"d792eb33cc19d5e7b7214f45686afcb37a31ad45","user":{"login":"aartibagul","id":7064434,"avatar_url":"https://avatars.githubusercontent.com/u/7064434?v=3","gravatar_id":"","url":"https://api.github.com/users/aartibagul","html_url":"https://github.com/aartibagul","followers_url":"https://api.github.com/users/aartibagul/followers","following_url":"https://api.github.com/users/aartibagul/following{/other_user}","gists_url":"https://api.github.com/users/aartibagul/gists{/gist_id}","starred_url":"https://api.github.com/users/aartibagul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aartibagul/subscriptions","organizations_url":"https://api.github.com/users/aartibagul/orgs","repos_url":"https://api.github.com/users/aartibagul/repos","events_url":"https://api.github.com/users/aartibagul/events{/privacy}","received_events_url":"https://api.github.com/users/aartibagul/received_events","type":"User","site_admin":false},"repo":{"id":60201670,"name":"vowpal_wabbit","full_name":"aartibagul/vowpal_wabbit","owner":{"login":"aartibagul","id":7064434,"avatar_url":"https://avatars.githubusercontent.com/u/7064434?v=3","gravatar_id":"","url":"https://api.github.com/users/aartibagul","html_url":"https://github.com/aartibagul","followers_url":"https://api.github.com/users/aartibagul/followers","following_url":"https://api.github.com/users/aartibagul/following{/other_user}","gists_url":"https://api.github.com/users/aartibagul/gists{/gist_id}","starred_url":"https://api.github.com/users/aartibagul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aartibagul/subscriptions","organizations_url":"https://api.github.com/users/aartibagul/orgs","repos_url":"https://api.github.com/users/aartibagul/repos","events_url":"https://api.github.com/users/aartibagul/events{/privacy}","received_events_url":"https://api.github.com/users/aartibagul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aartibagul/vowpal_wabbit","description":"Vowpal Wabbit is a machine learning system which pushes the frontier of machine learning with techniques such as online, hashing, allreduce, reductions, learning2search, active, and interactive learning.","fork":true,"url":"https://api.github.com/repos/aartibagul/vowpal_wabbit","forks_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/forks","keys_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/teams","hooks_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/hooks","issue_events_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/issues/events{/number}","events_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/events","assignees_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/assignees{/user}","branches_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/branches{/branch}","tags_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/tags","blobs_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/git/refs{/sha}","trees_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/statuses/{sha}","languages_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/languages","stargazers_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/stargazers","contributors_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/contributors","subscribers_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/subscribers","subscription_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/subscription","commits_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/commits{/sha}","git_commits_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/git/commits{/sha}","comments_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/comments{/number}","issue_comment_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/issues/comments{/number}","contents_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/contents/{+path}","compare_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/merges","archive_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/downloads","issues_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/issues{/number}","pulls_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/pulls{/number}","milestones_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/milestones{/number}","notifications_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/labels{/name}","releases_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/releases{/id}","deployments_url":"https://api.github.com/repos/aartibagul/vowpal_wabbit/deployments","created_at":"2016-06-01T18:35:41Z","updated_at":"2016-06-01T18:35:45Z","pushed_at":"2016-06-28T15:57:03Z","git_url":"git://github.com/aartibagul/vowpal_wabbit.git","ssh_url":"git@github.com:aartibagul/vowpal_wabbit.git","clone_url":"https://github.com/aartibagul/vowpal_wabbit.git","svn_url":"https://github.com/aartibagul/vowpal_wabbit","homepage":"http://hunch.net/~vw/","size":101217,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"JohnLangford:master","ref":"master","sha":"8e0fd1ce3c3124858577b81e6663368be8cdbf16","user":{"login":"JohnLangford","id":79590,"avatar_url":"https://avatars.githubusercontent.com/u/79590?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnLangford","html_url":"https://github.com/JohnLangford","followers_url":"https://api.github.com/users/JohnLangford/followers","following_url":"https://api.github.com/users/JohnLangford/following{/other_user}","gists_url":"https://api.github.com/users/JohnLangford/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnLangford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnLangford/subscriptions","organizations_url":"https://api.github.com/users/JohnLangford/orgs","repos_url":"https://api.github.com/users/JohnLangford/repos","events_url":"https://api.github.com/users/JohnLangford/events{/privacy}","received_events_url":"https://api.github.com/users/JohnLangford/received_events","type":"User","site_admin":false},"repo":{"id":265995,"name":"vowpal_wabbit","full_name":"JohnLangford/vowpal_wabbit","owner":{"login":"JohnLangford","id":79590,"avatar_url":"https://avatars.githubusercontent.com/u/79590?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnLangford","html_url":"https://github.com/JohnLangford","followers_url":"https://api.github.com/users/JohnLangford/followers","following_url":"https://api.github.com/users/JohnLangford/following{/other_user}","gists_url":"https://api.github.com/users/JohnLangford/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnLangford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnLangford/subscriptions","organizations_url":"https://api.github.com/users/JohnLangford/orgs","repos_url":"https://api.github.com/users/JohnLangford/repos","events_url":"https://api.github.com/users/JohnLangford/events{/privacy}","received_events_url":"https://api.github.com/users/JohnLangford/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JohnLangford/vowpal_wabbit","description":"Vowpal Wabbit is a machine learning system which pushes the frontier of machine learning with techniques such as online, hashing, allreduce, reductions, learning2search, active, and interactive learning.","fork":false,"url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit","forks_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/forks","keys_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/teams","hooks_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/hooks","issue_events_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/events{/number}","events_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/events","assignees_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/assignees{/user}","branches_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/branches{/branch}","tags_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/tags","blobs_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/git/refs{/sha}","trees_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/statuses/{sha}","languages_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/languages","stargazers_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/stargazers","contributors_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/contributors","subscribers_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/subscribers","subscription_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/subscription","commits_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/commits{/sha}","git_commits_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/git/commits{/sha}","comments_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/comments{/number}","issue_comment_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/comments{/number}","contents_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/contents/{+path}","compare_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/merges","archive_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/downloads","issues_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues{/number}","pulls_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls{/number}","milestones_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/milestones{/number}","notifications_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/labels{/name}","releases_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/releases{/id}","deployments_url":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/deployments","created_at":"2009-07-31T19:36:58Z","updated_at":"2016-06-28T08:46:42Z","pushed_at":"2016-06-28T17:45:02Z","git_url":"git://github.com/JohnLangford/vowpal_wabbit.git","ssh_url":"git@github.com:JohnLangford/vowpal_wabbit.git","clone_url":"https://github.com/JohnLangford/vowpal_wabbit.git","svn_url":"https://github.com/JohnLangford/vowpal_wabbit","homepage":"http://hunch.net/~vw/","size":107636,"stargazers_count":3531,"watchers_count":3531,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":976,"mirror_url":null,"open_issues_count":51,"forks":976,"open_issues":51,"watchers":3531,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/1009"},"html":{"href":"https://github.com/JohnLangford/vowpal_wabbit/pull/1009"},"issue":{"href":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/1009"},"comments":{"href":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/issues/1009/comments"},"review_comments":{"href":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/1009/comments"},"review_comment":{"href":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/pulls/1009/commits"},"statuses":{"href":"https://api.github.com/repos/JohnLangford/vowpal_wabbit/statuses/d792eb33cc19d5e7b7214f45686afcb37a31ad45"}}}}
{"actor":{"display_login":"JohnLangford"}}