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.

Definition of `vecdot` is ambiguous in the complex case.

See original GitHub issue

The function linalg.vecdot is defined as:

Computes the (vector) dot product of two arrays.

It is not clear what this means for complex vectors, as it could be \sum x_i y_i or it could be (as defined for a complex dot product) \sum \conj(x_i) y_i.

I am aware that the API does not cover complex tensors yet, but many of the libraries that are currently implementing this operation do support complex tensors, so it would be great to disambiguate the meaning of this operation now, so that libraries that implement it can safely implement the intended operation for complex tensors.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kgrytecommented, Jan 10, 2022

This issue was discussed during the most recent consortium meeting (1-6-2021). Consensus there was that the definition of the vector dot product for complex number input should conjugate (i.e., x^H y; similar to NumPy’s vdot).

Implementors can begin their complex number vecdot implementations assuming that this will be added to the specification along with more general complex number guidance.

0reactions
lezcanocommented, Jan 6, 2022

You can indeed replicate the this behaviour resizing the inputs adding a dimension of size 1 in both inputs (see https://github.com/pytorch/pytorch/issues/18027) but this seems fairly clunky. There is no easy way to do this at the moment with the API.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support Batch Dot Product · Issue #18027 · pytorch ... - GitHub
I added a case in my PR that reduces to torch.dot as it is significantly faster ... Definition of vecdot is ambiguous in...
Read more >
Why in complex dot product, →a⋅→b=0 when →a and →b ...
The definition of two vectors being orthogonal is that their dot product is zero. So you don't need to derive that a⋅b=0 implies...
Read more >
Linear Algebra · The Julia Language
Dot function for two complex vectors, consisting of n elements of array X with stride incx and n elements of array U with...
Read more >
Methods Julia 0.6官方教程 _w3cschool - 编程狮
To define a function with multiple methods, one simply defines the function ... In more complex cases, resolving method ambiguities involves a certain ......
Read more >
Dot product - MATLAB dot - MathWorks
In this case, the dot function treats A and B as collections of vectors. ... An exception is when you take the dot...
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