Multiplication fix. #39

Merged
merged 1 commit into from Jul 17, 2015

Conversation

Projects
None yet
2 participants
@amitjamadagni
Member

amitjamadagni commented Jul 16, 2015

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]
@acroy

This comment has been minimized.

Show comment
Hide comment
@acroy

acroy Jul 16, 2015

Contributor

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

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)

@amitjamadagni

This comment has been minimized.

Show comment
Hide comment
@amitjamadagni

amitjamadagni Jul 16, 2015

Member

@acroy tests added and squashed. Ready to be merged !

Member

amitjamadagni commented Jul 16, 2015

@acroy tests added and squashed. Ready to be merged !

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

This comment has been minimized.

@acroy

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?

@acroy

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?

This comment has been minimized.

@amitjamadagni

amitjamadagni Jul 16, 2015

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.

@amitjamadagni

amitjamadagni Jul 16, 2015

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.

This comment has been minimized.

@acroy

acroy Jul 16, 2015

Contributor

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

@acroy

acroy Jul 16, 2015

Contributor

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

@amitjamadagni

This comment has been minimized.

Show comment
Hide comment
@amitjamadagni

amitjamadagni Jul 17, 2015

Member

@acroy I hope this is ready.

Member

amitjamadagni commented Jul 17, 2015

@acroy I hope this is ready.

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.

@acroy acroy merged commit d31b688 into JuliaQuantum:master Jul 17, 2015

1 check passed

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

@amitjamadagni amitjamadagni deleted the amitjamadagni:mul branch Jul 17, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment