JuliaAttic / QuBase.jl

A foundational library for quantum mechanics in Julia
Other
43 stars 6 forks source link

Labeled Fock bases for QuArrays #18

Closed jrevels closed 9 years ago

jrevels commented 9 years ago

This PR implements a new basis type (LabelBasis) that allows label access into QuArrays by exploiting an assumed Fock structure. This is code that I've had floating around for a while, and I think it belongs here now.

I've written comments to describe how LabelBasis works, and the provided tests should give one an intuition of how it works with QuArrays.

The ability to use LabelBasis is more of an analytic feature than a computational one; while basis storage is very efficient, access time is relatively slow since the label indexing is generated on the fly (access complexity is mainly predicated on the number of basis factors, i.e. N in LabelBasis{S,N}). However, you can access a QuArray{B<:LabelBasis} using normal indexing as well as label indexing (getindex/setindex! is overloaded on QuArray{B<:LabelBasis} to treat only tuple arguments as labels), so there shouldn't be any significant performance hit for normal algorithms.