question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Complex dot product doesn't conjugate

See original GitHub issue

Inner product on ℂ is supposed to be sesquilinear – it should conjugate one of the two vectors before multiplying them. Source.

const I = math.complex(0,1)
math.dot( [1,0], [I,0] ) // I
math.dot( [I,0], [1,0] ) // I

The current dot product clearly doesn’t conjugate neither one of the vectors. This is also true of multiply(Vector, Vector) which apparently has a different implementation than dot.

While the Wikipedia article I linked uses the convention <v, w> = vᵀ w̅ (inner product is linear in the first argument and antilinear in the second argument), the opposite convention <v, w> = v⁺ w = v̅ ᵀ w is used as often, if not more. (For example in quantum mechanics, the first argument is exclusively antilinear.)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
josdejongcommented, Mar 14, 2020

Thanks Michal!

  1. Since the behavior changes (though you could maybe pitch it as a bug fix) I think it’s best to make it a major, breaking change. Which is no problem at all, it’s just changing a different number in the version number 😃
  2. I’m not an expert on this subject, so I think it would be best to follow what other math applications do (Matlab, Mathematica, Python numpy, …). What do you think?
0reactions
m93acommented, Mar 26, 2020

Hey Jos, Yes, I agree that in mathjs it makes sense to offer just one solution which does conjugate. I also confirm that the PR is ready to be merged 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is dot product for complex numbers as such
While the complex conjugate doesn't have an effect on real numbers, it does effect the dot product for scalar numbers.
Read more >
DO YOU EVEN COMPLEX DOT PRODUCT BRO!? - YouTube
How to take the dot product of complex vectors? I want to get into dirac notation for quantum mechanics, but figured this might...
Read more >
The complex dot product - YouTube
This video lesson is part of a complete course on neuroscience time series analyses.The full course includes - over 47 hours of video ......
Read more >
Why do inner products over the complex numbers ... - Quora
An inner product should always have the following properties * Positive definiteness / Definition of the ... Complex product does not need the...
Read more >
Why is MATLAB definition of complex dot product the complex ...
@Metahominid Please stop stating that there is no difference in the computation. The two results are not equal. As stated in both of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found