{"action":"created","comment":{"url":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/comments/74735747","id":74735747,"diff_hunk":"@@ -0,0 +1,120 @@\n+# Multidimensional arrays\n+\n+D provides support for multidimensional arrays directly in its standard library\n+Phobos. It allows fast iteration, access and manipulation of multidimensional\n+data. In comparison to popular software packages in other languages (e.g. `ndarray`\n+in NumPy or `Array` in Julia), it doesn't become slow for computations not\n+covered by preexisting functionality in a bound C-library nor forces the user\n+to escape into another language. Additionally, due to its compile-time introspection\n+capabilities, D enables further optimizations for superior performance.\n+\n+## Slices\n+\n+A `Slice` is a view on a multidimensional view on usually an underlying raw,\n+one-dimensional array. With the `sliced` function a multidimensional array can\n+be constructed - in this example a `2x3` matrix is created:\n+\n+```d\n+auto arr = new double[6];       // allocate one-dimensional array\n+auto matrix = arr.sliced(2, 3); // construct view onto array\n+```\n+\n+As specifying the size of the to-be-allocated array is tedious, `ndslice` provides\n+a `slice` function, which will automatically allocate:\n+\n+```d\n+auto matrix = slice!int(2, 3);\n+```\n+\n+### Row/column styles\n+\n+For the more common row-first index-style (C, D) square brackets can be used `a[]`,\n+whereas the column-first index style (Matlab, Fortran) uses parenthesis `a()`.\n+A row or column is also a `Slice` and thus all operations that work on slices\n+work on selections, for example we can assign a value or values.\n+\n+```d\n+// [0, 1, 2]\n+// [3, 4, 5]\n+// [6, 7, 8]\n+auto matrix = iotaSlice(3, 3).slice; // `slice` allocates from the iotaSlice\n+matrix[1]   = [0, 1, 0]; // row-access, [3, 4, 5]\n+matrix(1)[] = 42; // column-acces, [1, 4, 7]","path":"public/content/en/gems/ndslice.md","position":42,"original_position":42,"commit_id":"17258ac27fdb8ad4bc9baa89950c71ee68630dd4","original_commit_id":"17258ac27fdb8ad4bc9baa89950c71ee68630dd4","user":{"login":"9il","id":845083,"avatar_url":"https://avatars.githubusercontent.com/u/845083?v=3","gravatar_id":"","url":"https://api.github.com/users/9il","html_url":"https://github.com/9il","followers_url":"https://api.github.com/users/9il/followers","following_url":"https://api.github.com/users/9il/following{/other_user}","gists_url":"https://api.github.com/users/9il/gists{/gist_id}","starred_url":"https://api.github.com/users/9il/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/9il/subscriptions","organizations_url":"https://api.github.com/users/9il/orgs","repos_url":"https://api.github.com/users/9il/repos","events_url":"https://api.github.com/users/9il/events{/privacy}","received_events_url":"https://api.github.com/users/9il/received_events","type":"User","site_admin":false},"body":"This does not work. User must specify all dimensions for column-major order","created_at":"2016-08-15T09:00:37Z","updated_at":"2016-08-15T09:00:37Z","html_url":"https://github.com/stonemaster/dlang-tour/pull/444#discussion_r74735747","pull_request_url":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/444","_links":{"self":{"href":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/comments/74735747"},"html":{"href":"https://github.com/stonemaster/dlang-tour/pull/444#discussion_r74735747"},"pull_request":{"href":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/444"}}},"pull_request":{"url":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/444","id":81260171,"html_url":"https://github.com/stonemaster/dlang-tour/pull/444","diff_url":"https://github.com/stonemaster/dlang-tour/pull/444.diff","patch_url":"https://github.com/stonemaster/dlang-tour/pull/444.patch","issue_url":"https://api.github.com/repos/stonemaster/dlang-tour/issues/444","number":444,"state":"open","locked":false,"title":"Add gem about ndslice (multidimensional arrays)","user":{"login":"wilzbach","id":4370550,"avatar_url":"https://avatars.githubusercontent.com/u/4370550?v=3","gravatar_id":"","url":"https://api.github.com/users/wilzbach","html_url":"https://github.com/wilzbach","followers_url":"https://api.github.com/users/wilzbach/followers","following_url":"https://api.github.com/users/wilzbach/following{/other_user}","gists_url":"https://api.github.com/users/wilzbach/gists{/gist_id}","starred_url":"https://api.github.com/users/wilzbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilzbach/subscriptions","organizations_url":"https://api.github.com/users/wilzbach/orgs","repos_url":"https://api.github.com/users/wilzbach/repos","events_url":"https://api.github.com/users/wilzbach/events{/privacy}","received_events_url":"https://api.github.com/users/wilzbach/received_events","type":"User","site_admin":false},"body":"I made a first step at writing a small gem about multi-dimensional arrays. It's not perfect at all & it's also a bit ugly because many \"cool\" features are in the pending 2.072 release or still pending as Phobos release.\r\n\r\nAnyway @9il please let me know your thoughts on this gem.","created_at":"2016-08-15T00:55:30Z","updated_at":"2016-08-15T09:00:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"10a5ea7998f3e31fdc13506b823e990217d5acad","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/444/commits","review_comments_url":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/444/comments","review_comment_url":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stonemaster/dlang-tour/issues/444/comments","statuses_url":"https://api.github.com/repos/stonemaster/dlang-tour/statuses/17258ac27fdb8ad4bc9baa89950c71ee68630dd4","head":{"label":"wilzbach:add-ndslice","ref":"add-ndslice","sha":"17258ac27fdb8ad4bc9baa89950c71ee68630dd4","user":{"login":"wilzbach","id":4370550,"avatar_url":"https://avatars.githubusercontent.com/u/4370550?v=3","gravatar_id":"","url":"https://api.github.com/users/wilzbach","html_url":"https://github.com/wilzbach","followers_url":"https://api.github.com/users/wilzbach/followers","following_url":"https://api.github.com/users/wilzbach/following{/other_user}","gists_url":"https://api.github.com/users/wilzbach/gists{/gist_id}","starred_url":"https://api.github.com/users/wilzbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilzbach/subscriptions","organizations_url":"https://api.github.com/users/wilzbach/orgs","repos_url":"https://api.github.com/users/wilzbach/repos","events_url":"https://api.github.com/users/wilzbach/events{/privacy}","received_events_url":"https://api.github.com/users/wilzbach/received_events","type":"User","site_admin":false},"repo":{"id":58666877,"name":"dlang-tour","full_name":"wilzbach/dlang-tour","owner":{"login":"wilzbach","id":4370550,"avatar_url":"https://avatars.githubusercontent.com/u/4370550?v=3","gravatar_id":"","url":"https://api.github.com/users/wilzbach","html_url":"https://github.com/wilzbach","followers_url":"https://api.github.com/users/wilzbach/followers","following_url":"https://api.github.com/users/wilzbach/following{/other_user}","gists_url":"https://api.github.com/users/wilzbach/gists{/gist_id}","starred_url":"https://api.github.com/users/wilzbach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilzbach/subscriptions","organizations_url":"https://api.github.com/users/wilzbach/orgs","repos_url":"https://api.github.com/users/wilzbach/repos","events_url":"https://api.github.com/users/wilzbach/events{/privacy}","received_events_url":"https://api.github.com/users/wilzbach/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wilzbach/dlang-tour","description":"D Language online tour","fork":true,"url":"https://api.github.com/repos/wilzbach/dlang-tour","forks_url":"https://api.github.com/repos/wilzbach/dlang-tour/forks","keys_url":"https://api.github.com/repos/wilzbach/dlang-tour/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wilzbach/dlang-tour/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wilzbach/dlang-tour/teams","hooks_url":"https://api.github.com/repos/wilzbach/dlang-tour/hooks","issue_events_url":"https://api.github.com/repos/wilzbach/dlang-tour/issues/events{/number}","events_url":"https://api.github.com/repos/wilzbach/dlang-tour/events","assignees_url":"https://api.github.com/repos/wilzbach/dlang-tour/assignees{/user}","branches_url":"https://api.github.com/repos/wilzbach/dlang-tour/branches{/branch}","tags_url":"https://api.github.com/repos/wilzbach/dlang-tour/tags","blobs_url":"https://api.github.com/repos/wilzbach/dlang-tour/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wilzbach/dlang-tour/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wilzbach/dlang-tour/git/refs{/sha}","trees_url":"https://api.github.com/repos/wilzbach/dlang-tour/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wilzbach/dlang-tour/statuses/{sha}","languages_url":"https://api.github.com/repos/wilzbach/dlang-tour/languages","stargazers_url":"https://api.github.com/repos/wilzbach/dlang-tour/stargazers","contributors_url":"https://api.github.com/repos/wilzbach/dlang-tour/contributors","subscribers_url":"https://api.github.com/repos/wilzbach/dlang-tour/subscribers","subscription_url":"https://api.github.com/repos/wilzbach/dlang-tour/subscription","commits_url":"https://api.github.com/repos/wilzbach/dlang-tour/commits{/sha}","git_commits_url":"https://api.github.com/repos/wilzbach/dlang-tour/git/commits{/sha}","comments_url":"https://api.github.com/repos/wilzbach/dlang-tour/comments{/number}","issue_comment_url":"https://api.github.com/repos/wilzbach/dlang-tour/issues/comments{/number}","contents_url":"https://api.github.com/repos/wilzbach/dlang-tour/contents/{+path}","compare_url":"https://api.github.com/repos/wilzbach/dlang-tour/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wilzbach/dlang-tour/merges","archive_url":"https://api.github.com/repos/wilzbach/dlang-tour/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wilzbach/dlang-tour/downloads","issues_url":"https://api.github.com/repos/wilzbach/dlang-tour/issues{/number}","pulls_url":"https://api.github.com/repos/wilzbach/dlang-tour/pulls{/number}","milestones_url":"https://api.github.com/repos/wilzbach/dlang-tour/milestones{/number}","notifications_url":"https://api.github.com/repos/wilzbach/dlang-tour/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wilzbach/dlang-tour/labels{/name}","releases_url":"https://api.github.com/repos/wilzbach/dlang-tour/releases{/id}","deployments_url":"https://api.github.com/repos/wilzbach/dlang-tour/deployments","created_at":"2016-05-12T18:32:53Z","updated_at":"2016-06-24T17:42:39Z","pushed_at":"2016-08-15T08:01:03Z","git_url":"git://github.com/wilzbach/dlang-tour.git","ssh_url":"git@github.com:wilzbach/dlang-tour.git","clone_url":"https://github.com/wilzbach/dlang-tour.git","svn_url":"https://github.com/wilzbach/dlang-tour","homepage":null,"size":966,"stargazers_count":1,"watchers_count":1,"language":"D","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":1,"default_branch":"master"}},"base":{"label":"stonemaster:master","ref":"master","sha":"8bcb1609f3fa49be4ddb2b58c675118e80cc805e","user":{"login":"stonemaster","id":1463490,"avatar_url":"https://avatars.githubusercontent.com/u/1463490?v=3","gravatar_id":"","url":"https://api.github.com/users/stonemaster","html_url":"https://github.com/stonemaster","followers_url":"https://api.github.com/users/stonemaster/followers","following_url":"https://api.github.com/users/stonemaster/following{/other_user}","gists_url":"https://api.github.com/users/stonemaster/gists{/gist_id}","starred_url":"https://api.github.com/users/stonemaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stonemaster/subscriptions","organizations_url":"https://api.github.com/users/stonemaster/orgs","repos_url":"https://api.github.com/users/stonemaster/repos","events_url":"https://api.github.com/users/stonemaster/events{/privacy}","received_events_url":"https://api.github.com/users/stonemaster/received_events","type":"User","site_admin":false},"repo":{"id":49131290,"name":"dlang-tour","full_name":"stonemaster/dlang-tour","owner":{"login":"stonemaster","id":1463490,"avatar_url":"https://avatars.githubusercontent.com/u/1463490?v=3","gravatar_id":"","url":"https://api.github.com/users/stonemaster","html_url":"https://github.com/stonemaster","followers_url":"https://api.github.com/users/stonemaster/followers","following_url":"https://api.github.com/users/stonemaster/following{/other_user}","gists_url":"https://api.github.com/users/stonemaster/gists{/gist_id}","starred_url":"https://api.github.com/users/stonemaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stonemaster/subscriptions","organizations_url":"https://api.github.com/users/stonemaster/orgs","repos_url":"https://api.github.com/users/stonemaster/repos","events_url":"https://api.github.com/users/stonemaster/events{/privacy}","received_events_url":"https://api.github.com/users/stonemaster/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stonemaster/dlang-tour","description":"D Language online tour","fork":false,"url":"https://api.github.com/repos/stonemaster/dlang-tour","forks_url":"https://api.github.com/repos/stonemaster/dlang-tour/forks","keys_url":"https://api.github.com/repos/stonemaster/dlang-tour/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stonemaster/dlang-tour/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stonemaster/dlang-tour/teams","hooks_url":"https://api.github.com/repos/stonemaster/dlang-tour/hooks","issue_events_url":"https://api.github.com/repos/stonemaster/dlang-tour/issues/events{/number}","events_url":"https://api.github.com/repos/stonemaster/dlang-tour/events","assignees_url":"https://api.github.com/repos/stonemaster/dlang-tour/assignees{/user}","branches_url":"https://api.github.com/repos/stonemaster/dlang-tour/branches{/branch}","tags_url":"https://api.github.com/repos/stonemaster/dlang-tour/tags","blobs_url":"https://api.github.com/repos/stonemaster/dlang-tour/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stonemaster/dlang-tour/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stonemaster/dlang-tour/git/refs{/sha}","trees_url":"https://api.github.com/repos/stonemaster/dlang-tour/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stonemaster/dlang-tour/statuses/{sha}","languages_url":"https://api.github.com/repos/stonemaster/dlang-tour/languages","stargazers_url":"https://api.github.com/repos/stonemaster/dlang-tour/stargazers","contributors_url":"https://api.github.com/repos/stonemaster/dlang-tour/contributors","subscribers_url":"https://api.github.com/repos/stonemaster/dlang-tour/subscribers","subscription_url":"https://api.github.com/repos/stonemaster/dlang-tour/subscription","commits_url":"https://api.github.com/repos/stonemaster/dlang-tour/commits{/sha}","git_commits_url":"https://api.github.com/repos/stonemaster/dlang-tour/git/commits{/sha}","comments_url":"https://api.github.com/repos/stonemaster/dlang-tour/comments{/number}","issue_comment_url":"https://api.github.com/repos/stonemaster/dlang-tour/issues/comments{/number}","contents_url":"https://api.github.com/repos/stonemaster/dlang-tour/contents/{+path}","compare_url":"https://api.github.com/repos/stonemaster/dlang-tour/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stonemaster/dlang-tour/merges","archive_url":"https://api.github.com/repos/stonemaster/dlang-tour/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stonemaster/dlang-tour/downloads","issues_url":"https://api.github.com/repos/stonemaster/dlang-tour/issues{/number}","pulls_url":"https://api.github.com/repos/stonemaster/dlang-tour/pulls{/number}","milestones_url":"https://api.github.com/repos/stonemaster/dlang-tour/milestones{/number}","notifications_url":"https://api.github.com/repos/stonemaster/dlang-tour/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stonemaster/dlang-tour/labels{/name}","releases_url":"https://api.github.com/repos/stonemaster/dlang-tour/releases{/id}","deployments_url":"https://api.github.com/repos/stonemaster/dlang-tour/deployments","created_at":"2016-01-06T11:31:27Z","updated_at":"2016-08-14T16:45:24Z","pushed_at":"2016-08-15T07:56:17Z","git_url":"git://github.com/stonemaster/dlang-tour.git","ssh_url":"git@github.com:stonemaster/dlang-tour.git","clone_url":"https://github.com/stonemaster/dlang-tour.git","svn_url":"https://github.com/stonemaster/dlang-tour","homepage":null,"size":1038,"stargazers_count":23,"watchers_count":23,"language":"D","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":25,"mirror_url":null,"open_issues_count":114,"forks":25,"open_issues":114,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/444"},"html":{"href":"https://github.com/stonemaster/dlang-tour/pull/444"},"issue":{"href":"https://api.github.com/repos/stonemaster/dlang-tour/issues/444"},"comments":{"href":"https://api.github.com/repos/stonemaster/dlang-tour/issues/444/comments"},"review_comments":{"href":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/444/comments"},"review_comment":{"href":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stonemaster/dlang-tour/pulls/444/commits"},"statuses":{"href":"https://api.github.com/repos/stonemaster/dlang-tour/statuses/17258ac27fdb8ad4bc9baa89950c71ee68630dd4"}}}}
{"actor":{"display_login":"9il"}}