summaryrefslogtreecommitdiff
path: root/modules/codec/c++/schema_math.hpp
blob: fa73ba5c8f78b2d3afb6d412c8e6c162e70c11af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include "schema.hpp"
#include "schema_meta.hpp"

namespace saw {
namespace schema {

/**
 * Tensor Schema. I think I need this due to the amount of mathematical operators being able to be represented by this one construct.
 */
template<typename Inner, uint64_t... D>
struct Tensor {
	static constexpr uint64_t Rank = sizeof...(D);
	static constexpr std::array<uint64_t,Rank> Dimension{D...};
	static constexpr string_literal name = "Tensor";
};

template<typename Inner>
using Scalar = Tensor<Inner>;

template<typename Inner, uint64_t D>
using Vector = Tensor<Inner,D>;

template<typename Inner, uint64_t D1, uint64_t D2>
using Matrix = Tensor<Inner,D1,D2>;

}

template<typename Inner, uint64_t... D>
struct meta_schema<schema::Tensor<Inner, D...>> {
	using Schema = schema::Tensor<Inner, D...>;
	using MetaSchema = schema::FixedArray<schema::UInt64, sizeof...(D)>;
};
}