Vector API and dot product

Chris Hegarty chegar999 at gmail.com
Mon Dec 12 14:33:40 UTC 2022


Hi,

I'm sure that this must have come up before, but I cannot find it so I'm 
asking here.

Over in Elasticsearch and Lucene we've been experimenting a little with 
the incubating Vector API, for use-cases relating to Approximate Nearest 
Neighbour vector search. We see approx 4x performance improvement in 
some experiments - which is amazing. Thank you. By far, our most 
significant use-case is dot product of two k dimensional vectors - 
float/double arrays.

The Vector API is low-level and incredibly flexible, and will be a great 
addition to the Platform when it eventually moves out of incubation. 
But, since dot product is an extremely common operation it could be 
helpful to provide a "convenience" for it out-of-the-box, say 
Math.dot(float[], float[]) [*], etc.

Ultimately, I believe that the Vector API is the right approach to 
supporting the rich set of linear algebra and machine learning 
algorithms, but there could be a sweet-spot for supporting a minimal set 
of extremely common functions too. I am explicitly not proposing that 
the JDK should become a linear algebra library! ;-)

Additionally, `Math::dot` could be added to the platform now, no need to 
wait, or preview or incubate. The implementation could use already 
existing internal primitives (without an dependency on Vector API), and 
eventually become a "simple convenience", when the Vector API is finalized.

I believe that this approach remains largely inline with the goals of 
the project (as I understand them), but just reframes the potential to 
deliver small improvements in this area incrementally.

Yes, but whose goina do the work? If the idea is positively received, 
then I am happy to drive this non-trivial contribution.

-Chris.

[*] or some other location where it can be easily found and imported


More information about the panama-dev mailing list