diff options
| -rw-r--r-- | modules/codec/c++/math.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/codec/c++/math.hpp b/modules/codec/c++/math.hpp index ca43dd0..c7da99e 100644 --- a/modules/codec/c++/math.hpp +++ b/modules/codec/c++/math.hpp @@ -35,8 +35,9 @@ data<schema::Vector<T,D>, Encoding> normalize(const data<schema::Vector<T,D>>& i auto sqrt_inp_dot = sqrt<T>(inp_dot); saw::data<schema::Vector<T,D>, Encoding> out; - out.at({{0u}}).set(input.at({{0u}}).get() / sqrt_inp_dot.at({}).get()); - out.at({{1u}}).set(input.at({{1u}}).get() / sqrt_inp_dot.at({}).get()); + for(uint64_t i = 0u; i < D; ++i){ + out.at({{i}}).set(input.at({{i}})).get() / sqrt_inp_dot.at({}).get()); + } return out; } } |
