Multiplication fix. #39

Merged
merged 1 commit into from Jul 17, 2015

Conversation

Projects
None yet
2 participants
Member

 The following case fails ```julia> a = full(tensor(lowerop(2), QuArray(eye(2)))) 4x4 QuMatrix in FiniteBasis{Orthonormal}: ...coefficients: Array{Float64,2} [0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0] julia> sm = full(tensor(QuArray(eye(2)), lowerop(2))) 4x4 QuMatrix in FiniteBasis{Orthonormal}: ...coefficients: Array{Float64,2} [0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0] julia> a*sm' 4x4 QuMatrix in FiniteBasis{Orthonormal}: ...coefficients: Array{Float64,2} [0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0]``` the last one has to be ```julia> a*sm' 4x4 QuMatrix in FiniteBasis{Orthonormal}: ...coefficients: Array{Float64,2} [0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0]```
Contributor

acroy commented Jul 16, 2015

 Well spotted! Could you add a test for this case? (I guess something like `sigmax*sigmaz'` vs `coeffs(sigmax)*coeffs(sigmaz)'` would be sufficient)
Member

acroy reviewed Jul 16, 2015

 @@ -11,6 +11,7 @@ qv = QuArray(v) @assert rawcoeffs(qm'*qm') == m*m

acroy Jul 16, 2015

Contributor

Uh, I guess all of those should be `coeffs` rather than `rawcoeffs`? This would probably also cover the new test case?

Member

`rawcoeffs` and `coeffs` return the same for all the cases except for the recent commit. @acroy please do let me know if am missing something further here.

acroy Jul 16, 2015

Contributor

You are right, although we probably could/should consistently use `coeffs` everywhere (unless we really mean `rawcoeffs`).

Member

 @acroy I hope this is ready.
``` Multiplication fix, tests added. ```
``` df012e3 ```

acroy added a commit that referenced this pull request Jul 17, 2015

``` Merge pull request #39 from amitjamadagni/mul ```
`Fix multiplication of QuMatrix and DualMatrix. Tests updated.`
``` d31b688 ```

acroy merged commit `d31b688` into JuliaQuantum:master Jul 17, 2015 1 check passed

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details