Loading TOC...

MarkLogic 12 EA 1 Product Documentation
vec.normalize

vec.normalize(
   vector1 as vec.vector
) as vec.vector

Summary

Returns the vector passed in, normalized to a length of 1.

Parameters
vector1 The vector to normalize.

Example

  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 iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.