vec.add( vector1 as vec.vector, vector2 as vec.vector ) as vec.vector
Returns the sum of two vectors. The vectors must be of the same dimension.
Parameters | |
---|---|
vector1 | The first addend vector. |
vector2 | The second addend vector. |
const vec1 = vec.vector([3.14,1.59,2.65]) const vec2 = vec.vector([3.58,9.79,3.23]) vec.add(vec1,vec2) => "[ 6.72, 11.38, 5.88 ]"
const vec1 = vec.vector(xdmp.toJSON(fn.doc('pronethalol.json')).xpath('/data/array-node{embedding}')) const vec2 = vec.vector(fn.head(fn.doc('cell_renewal.json')).xpath('/data/array-node{embedding}')) vec.add(vec1,vec2) => The sum between vectors in JSON arrays named 'embedding' in documents 'pronethalol.json' and 'cell_renewal.json'
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.