MCPcopy Create free account
hub / github.com/BinomialLLC/basis_universal / normalize

Method normalize

example_transcoding/utils.h:1018–1029  ·  view source on GitHub ↗

returns squared length (norm)

Source from the content-addressed store, hash-verified

1016
1017 // returns squared length (norm)
1018 inline double normalize(const vec* pDefaultVec = NULL)
1019 {
1020 double n = m_s[0] * m_s[0];
1021 for (uint32_t i = 1; i < N; i++)
1022 n += m_s[i] * m_s[i];
1023
1024 if (n != 0)
1025 *this *= static_cast<T>(1.0f / sqrt(n));
1026 else if (pDefaultVec)
1027 *this = *pDefaultVec;
1028 return n;
1029 }
1030
1031 inline double normalize3(const vec* pDefaultVec = NULL)
1032 {

Callers 1

get_normalizedMethod · 0.45

Calls 1

sqrtFunction · 0.85

Tested by

no test coverage detected