JuliaAttic / QuBase.jl

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

Added Normalize to QuArray. #15

Closed amitjamadagni closed 9 years ago

amitjamadagni commented 9 years ago

This is my first attempt at contributing. Though not that significant, please do comment. Thanks.

acroy commented 9 years ago

Thanks for your contribution! It's a good start. Accidentally I thought that adding norms would be a natural next step ...

Regarding your code I have some comments (mostly because we don't have an explicit guide how such functions for QuArrays should work, but I have many implicit ideas ;-)

Sorry for the long list of comments. Maybe the more general points should go into some "guideline issue".

amitjamadagni commented 9 years ago

@acroy I have worked on the commit. Here are the details :

WIP :

Doubts :

  1. Requirement of rawcoeffs when .coeffs is doing the same job ??
acroy commented 9 years ago

Nice! The point of using rawcoeffs is that you can use it for QuArrays and CTranspose, i.e., norm could take qa::Union(QuArray,CTranspose) and you can simply call rawcoeffs(qa).

acroy commented 9 years ago

If you use rawcoeffs and bases instead of accessing the fields (qa.coeffs) you can replace the arguments qa::QuArray by qa::Union(QuArray,CTranspose) (I think). Don't forget to add norm to the import at the top of arraymath.jl. For the test you can basically use the same approach as Jarrett.

amitjamadagni commented 9 years ago

@acroy is this good to go ?? Any comments would be helpful.

acroy commented 9 years ago

Looks good now. Thanks! Just one minor point: could you squash your commits into a single one? It's not really necessary but makes the history more readable.

amitjamadagni commented 9 years ago

@acroy done. Thanks for all the help.