diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-08-06 14:20:21 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-08-06 14:20:21 +0200 |
commit | f36a545b0f814d8d35e87262dd80d4d8d8dc4405 (patch) | |
tree | 828927280b83f6f43eb0b30bc3c99c3d3546511e /modules/codec/c++/data_math.hpp | |
parent | 25ccfc72c5851b2ff59daadad3aeef85b22a6bce (diff) |
Extended math setup. Need meta iteration for multi dim array :/
Diffstat (limited to 'modules/codec/c++/data_math.hpp')
-rw-r--r-- | modules/codec/c++/data_math.hpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/modules/codec/c++/data_math.hpp b/modules/codec/c++/data_math.hpp index a5c50fc..7277168 100644 --- a/modules/codec/c++/data_math.hpp +++ b/modules/codec/c++/data_math.hpp @@ -1,10 +1,12 @@ #pragma once +#include "data.hpp" #include "schema_math.hpp" #include <cmath> namespace saw { +/* template<typename T> class data<schema::Quaternion<T>,encode::Native> { public: @@ -61,5 +63,40 @@ public: return mult; } }; +*/ + +template<typename Inner, uint64_t... Dims> +class data<schema::Tensor<Inner, Dims...>, encode::Native> { +public: + using Schema = schema::Tensor<Inner, Dims...>; +private: + data<schema::Array<Inner,Schema::Rank>, encode::Native> values_; +public: + data(): + values_{data<schema::FixedArray<schema::UInt64,sizeof...(Dims)>>{{data<schema::UInt64, encode::Native>{Dims}...}}} + {} + + data<Inner, encode::Native>& at(const data<schema::FixedArray<schema::UInt64>, encode::Native>& index){ + return values_.at(index); + } + + const data<Inner, encode::Native>& at(const data<schema::FixedArray<schema::UInt64>, encode::Native>& index) const { + return values_.at(index); + } + + data<Inner, encode::Native>& operator()(const data<schema::FixedArray<schema::UInt64>, encode::Native>& index){ + return values_.at(index); + } + + const data<Inner, encode::Native>& operator()(const data<schema::FixedArray<schema::UInt64>, encode::Native>& index) const { + return values_.at(index); + } + + data<schema::Tensor<Inner, Dims...>, encode::Native> operator+(const data<schema::Tensor<Inner, Dims...>, encode::Native>& rhs) const { + data<schema::Tensor<Inner, Dims...>, encode::Native> c; + + return {}; + } +}; } |