From e69e3cb018619b51f35004284056af383eab0bd7 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 25 Sep 2025 11:00:53 +0200 Subject: Check if vector would be 0 --- modules/codec/c++/math.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/codec/c++/math.hpp b/modules/codec/c++/math.hpp index ec051df..090005c 100644 --- a/modules/codec/c++/math.hpp +++ b/modules/codec/c++/math.hpp @@ -32,6 +32,9 @@ data,Encoding> sqrt(const data,Encoding>& in template data, Encoding> normalize(const data>& input ) { auto inp_dot = dot(input,input); + if(inp_dot.at({}).get() <= 0){ + return input; + } auto sqrt_inp_dot = sqrt(inp_dot); saw::data, Encoding> out; -- cgit v1.2.3