Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplication fix. #39

Merged
merged 1 commit into from
Jul 17, 2015
Merged

Multiplication fix. #39

merged 1 commit into from
Jul 17, 2015

Conversation

amitjamadagni
Copy link
Contributor

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
Copy link
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
Copy link
Contributor Author

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@amitjamadagni
Copy link
Contributor Author

@acroy I hope this is ready.

acroy added a commit that referenced this pull request Jul 17, 2015
Fix multiplication of QuMatrix and DualMatrix. Tests updated.
@acroy acroy merged commit d31b688 into JuliaAttic:master Jul 17, 2015
@amitjamadagni amitjamadagni deleted the mul branch July 17, 2015 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants