{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/comments/22433606","id":22433606,"diff_hunk":"@@ -0,0 +1,68 @@\n+###########################\n+# Ladder Operator Methods #\n+########################### \n+    # n specifies which particle (a.k.a tensor product \n+    # factor) the operator acts on\n+    raisematrix(lens, n=1) = laddermatrix(lens, RaiseOpFlag, n)\n+    lowermatrix(lens, n=1) = laddermatrix(lens, LowerOpFlag, n)\n+\n+    raiseop(b::AbstractBasis, n=1) = QuArray(raisematrix(size(b), n), b, b)\n+    raiseop(lens::Tuple, n=1) = raiseop(FiniteBasis(lens), n)\n+    \n+    lowerop(b::AbstractBasis, n=1) = QuArray(lowermatrix(size(b), n), b, b)\n+    lowerop(lens::Tuple, n=1) = lowerop(FiniteBasis(lens), n)\n+\n+    ##########################\n+    # Helper Functions/Types #\n+    ##########################\n+    abstract LadderOpFlag\n+    abstract RaiseOpFlag <: LadderOpFlag\n+    abstract LowerOpFlag <: LadderOpFlag    \n+\n+    ladder_inds(n, ::Type{RaiseOpFlag}) = ([1:n-1], [2:n])\n+    ladder_inds(n, ::Type{LowerOpFlag}) = ([2:n], [1:n-1])\n+    laddercoeffs(n) = complex(sqrt(linspace(1, n, n)))","path":"src/arrays/ladderops.jl","position":24,"original_position":24,"commit_id":"022257cf93c500d37f1c5db2bb9600c49c04d26e","original_commit_id":"022257cf93c500d37f1c5db2bb9600c49c04d26e","user":{"login":"jrevels","id":3277443,"avatar_url":"https://avatars.githubusercontent.com/u/3277443?v=3","gravatar_id":"","url":"https://api.github.com/users/jrevels","html_url":"https://github.com/jrevels","followers_url":"https://api.github.com/users/jrevels/followers","following_url":"https://api.github.com/users/jrevels/following{/other_user}","gists_url":"https://api.github.com/users/jrevels/gists{/gist_id}","starred_url":"https://api.github.com/users/jrevels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrevels/subscriptions","organizations_url":"https://api.github.com/users/jrevels/orgs","repos_url":"https://api.github.com/users/jrevels/repos","events_url":"https://api.github.com/users/jrevels/events{/privacy}","received_events_url":"https://api.github.com/users/jrevels/received_events","type":"User","site_admin":false},"body":"It's actually slightly more performant to do the conversion here than at the time of `setindex!` when filling the array in `fill_op_arr!` (this is of course assuming that we want our \"default\" element type to be `Complex128`, which I believe we do). I think the performance boost is due to it being easier for the compiler to optimize a map versus the mutation that would otherwise have to occur in the `for` loop, though I'm not entirely sure. ","created_at":"2015-01-03T17:41:33Z","updated_at":"2015-01-03T17:41:33Z","html_url":"https://github.com/JuliaQuantum/QuBase.jl/pull/5#discussion_r22433606","pull_request_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/comments/22433606"},"html":{"href":"https://github.com/JuliaQuantum/QuBase.jl/pull/5#discussion_r22433606"},"pull_request":{"href":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/5","id":26670498,"html_url":"https://github.com/JuliaQuantum/QuBase.jl/pull/5","diff_url":"https://github.com/JuliaQuantum/QuBase.jl/pull/5.diff","patch_url":"https://github.com/JuliaQuantum/QuBase.jl/pull/5.patch","issue_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/5","number":5,"state":"open","locked":false,"title":"Basic framework for QuArrays and basis types","user":{"login":"jrevels","id":3277443,"avatar_url":"https://avatars.githubusercontent.com/u/3277443?v=3","gravatar_id":"","url":"https://api.github.com/users/jrevels","html_url":"https://github.com/jrevels","followers_url":"https://api.github.com/users/jrevels/followers","following_url":"https://api.github.com/users/jrevels/following{/other_user}","gists_url":"https://api.github.com/users/jrevels/gists{/gist_id}","starred_url":"https://api.github.com/users/jrevels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrevels/subscriptions","organizations_url":"https://api.github.com/users/jrevels/orgs","repos_url":"https://api.github.com/users/jrevels/repos","events_url":"https://api.github.com/users/jrevels/events{/privacy}","received_events_url":"https://api.github.com/users/jrevels/received_events","type":"User","site_admin":false},"body":"This PR splits off the non-QuDirac work from #4. To copy the summary from there, here's what this PR does:\r\n\r\n1. Provides a cleaner directory structure and a more comprehensive type hierarchy.\r\n2. Organizes/cleans up existing code, as well as splits off QuDirac-related work into the [QuDirac repo, which got moved under the JuliaQuantum organization.](https://github.com/JuliaQuantum/QuDirac.jl) That repo is where abstract Dirac-notated states and operator functionality will live for the time being, whereas QuBase will be focused on: \r\n    - solvers/modeling capability for coefficient arrays\r\n    - a foundational type system\r\n    - a solid, general implementation for `QuArray`s and fundamental basis types\r\n3. Updates the `creationop` method provided by @acroy to work with arbitrary number of particles (you can pick which particle the operator should act on). I renamed it to `raiseop` for brevity's sake and implemented `lowerop` as well. These methods aren't optimized in the slightest (likely a tad slower than @acroy's original implementation), but provide a good starting point for ladder operations in multi-particle systems.\r\n4. Gives a single type implementation of `FiniteBasis` that supports a tensor product structure\r\n5. Implements a couple of functions for `QuArray`/`FiniteBasis`, including pretty-printing for `QuArray`s (let me know what you think, it's hard to compactly convey all that info).\r\n \r\nSorry for the previous commit; I had to go back and fix the tabs-to-spaces thing again for some reason.  ","created_at":"2014-12-30T01:40:12Z","updated_at":"2015-01-03T17:41:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"53d1cd2029f4852bf5635922de63a21faf1e836f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/5/commits","review_comments_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/5/comments","review_comment_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/comments/{number}","comments_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/5/comments","statuses_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/statuses/022257cf93c500d37f1c5db2bb9600c49c04d26e","head":{"label":"JuliaQuantum:basic-func","ref":"basic-func","sha":"022257cf93c500d37f1c5db2bb9600c49c04d26e","user":{"login":"JuliaQuantum","id":8118127,"avatar_url":"https://avatars.githubusercontent.com/u/8118127?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaQuantum","html_url":"https://github.com/JuliaQuantum","followers_url":"https://api.github.com/users/JuliaQuantum/followers","following_url":"https://api.github.com/users/JuliaQuantum/following{/other_user}","gists_url":"https://api.github.com/users/JuliaQuantum/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaQuantum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaQuantum/subscriptions","organizations_url":"https://api.github.com/users/JuliaQuantum/orgs","repos_url":"https://api.github.com/users/JuliaQuantum/repos","events_url":"https://api.github.com/users/JuliaQuantum/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaQuantum/received_events","type":"Organization","site_admin":false},"repo":{"id":28000700,"name":"QuBase.jl","full_name":"JuliaQuantum/QuBase.jl","owner":{"login":"JuliaQuantum","id":8118127,"avatar_url":"https://avatars.githubusercontent.com/u/8118127?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaQuantum","html_url":"https://github.com/JuliaQuantum","followers_url":"https://api.github.com/users/JuliaQuantum/followers","following_url":"https://api.github.com/users/JuliaQuantum/following{/other_user}","gists_url":"https://api.github.com/users/JuliaQuantum/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaQuantum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaQuantum/subscriptions","organizations_url":"https://api.github.com/users/JuliaQuantum/orgs","repos_url":"https://api.github.com/users/JuliaQuantum/repos","events_url":"https://api.github.com/users/JuliaQuantum/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaQuantum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaQuantum/QuBase.jl","description":"A foundational library for quantum mechanics in Julia","fork":false,"url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl","forks_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/forks","keys_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/teams","hooks_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/events","assignees_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/tags","blobs_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/subscription","commits_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/comments/{number}","contents_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/merges","archive_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/downloads","issues_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/releases{/id}","created_at":"2014-12-14T16:45:57Z","updated_at":"2014-12-25T16:11:35Z","pushed_at":"2015-01-02T01:06:11Z","git_url":"git://github.com/JuliaQuantum/QuBase.jl.git","ssh_url":"git@github.com:JuliaQuantum/QuBase.jl.git","clone_url":"https://github.com/JuliaQuantum/QuBase.jl.git","svn_url":"https://github.com/JuliaQuantum/QuBase.jl","homepage":null,"size":334,"stargazers_count":3,"watchers_count":3,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":3,"default_branch":"master"}},"base":{"label":"JuliaQuantum:master","ref":"master","sha":"81f3ddb1caecae15cecb9d4f6244eb1df8f4fed1","user":{"login":"JuliaQuantum","id":8118127,"avatar_url":"https://avatars.githubusercontent.com/u/8118127?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaQuantum","html_url":"https://github.com/JuliaQuantum","followers_url":"https://api.github.com/users/JuliaQuantum/followers","following_url":"https://api.github.com/users/JuliaQuantum/following{/other_user}","gists_url":"https://api.github.com/users/JuliaQuantum/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaQuantum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaQuantum/subscriptions","organizations_url":"https://api.github.com/users/JuliaQuantum/orgs","repos_url":"https://api.github.com/users/JuliaQuantum/repos","events_url":"https://api.github.com/users/JuliaQuantum/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaQuantum/received_events","type":"Organization","site_admin":false},"repo":{"id":28000700,"name":"QuBase.jl","full_name":"JuliaQuantum/QuBase.jl","owner":{"login":"JuliaQuantum","id":8118127,"avatar_url":"https://avatars.githubusercontent.com/u/8118127?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaQuantum","html_url":"https://github.com/JuliaQuantum","followers_url":"https://api.github.com/users/JuliaQuantum/followers","following_url":"https://api.github.com/users/JuliaQuantum/following{/other_user}","gists_url":"https://api.github.com/users/JuliaQuantum/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaQuantum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaQuantum/subscriptions","organizations_url":"https://api.github.com/users/JuliaQuantum/orgs","repos_url":"https://api.github.com/users/JuliaQuantum/repos","events_url":"https://api.github.com/users/JuliaQuantum/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaQuantum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaQuantum/QuBase.jl","description":"A foundational library for quantum mechanics in Julia","fork":false,"url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl","forks_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/forks","keys_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/teams","hooks_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/hooks","issue_events_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/events","assignees_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/tags","blobs_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/languages","stargazers_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/stargazers","contributors_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/contributors","subscribers_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/subscribers","subscription_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/subscription","commits_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/comments/{number}","contents_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/merges","archive_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/downloads","issues_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/labels{/name}","releases_url":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/releases{/id}","created_at":"2014-12-14T16:45:57Z","updated_at":"2014-12-25T16:11:35Z","pushed_at":"2015-01-02T01:06:11Z","git_url":"git://github.com/JuliaQuantum/QuBase.jl.git","ssh_url":"git@github.com:JuliaQuantum/QuBase.jl.git","clone_url":"https://github.com/JuliaQuantum/QuBase.jl.git","svn_url":"https://github.com/JuliaQuantum/QuBase.jl","homepage":null,"size":334,"stargazers_count":3,"watchers_count":3,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/5"},"html":{"href":"https://github.com/JuliaQuantum/QuBase.jl/pull/5"},"issue":{"href":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/5"},"comments":{"href":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaQuantum/QuBase.jl/statuses/022257cf93c500d37f1c5db2bb9600c49c04d26e"}}}}