diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-06-01 16:09:22 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-06-01 16:09:22 +0200 |
| commit | 60eefb228c9b5c2846d3640d68ae5a7ccb0c254d (patch) | |
| tree | 569583fd49a257d4f2efd2885ece2c0364d144a2 /modules/codec/c++/data_math.hpp | |
| parent | 4a667474433f18c60facd556daa5b73c6e651f4e (diff) | |
| download | forstio-forstio-60eefb228c9b5c2846d3640d68ae5a7ccb0c254d.tar.gz | |
Diffstat (limited to 'modules/codec/c++/data_math.hpp')
| -rw-r--r-- | modules/codec/c++/data_math.hpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/codec/c++/data_math.hpp b/modules/codec/c++/data_math.hpp index 48dae91..9d07eb3 100644 --- a/modules/codec/c++/data_math.hpp +++ b/modules/codec/c++/data_math.hpp @@ -131,6 +131,19 @@ public: return c; } + data<schema::Tensor<Inner, Dims...>, encode::Native> operator-() const { + data<schema::Tensor<Inner, Dims...>, encode::Native> c; + + rank_iterator<Dims...>::in_fixed_bounds([&](const data<schema::FixedArray<schema::UInt64, sizeof...(Dims)>, encode::Native>& index) -> error_or<void>{ + c.at(index) = -at(index); + return make_void(); + }); + + return c; + } + + + template<typename InnerChange> data<schema::Tensor<InnerChange, Dims...>, encode::Native> cast_to() const { data<schema::Tensor<InnerChange, Dims...>, encode::Native> native_change; |
