vec:normalize( $vector1 as vec:vector ) as vec:vector
Returns the vector passed in, normalized to a length of 1.
Parameters | |
---|---|
vector1 | The vector to normalize. |
xquery version "1.0-ml"; vec:normalize(vec:vector((3.14, 1.59, 2.65))) => [ 0.712713, 0.360896, 0.601493 ] (: the vector value normalized to length 1 :)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.