stdml / stdtensor

STL style Tensor Template Library
MIT License
9 stars 2 forks source link

Roadmap #1

Open lgarithm opened 6 years ago

lgarithm commented 6 years ago

Overview

The goal of stdtensor is to provide a C++ library for tensors in STL style. It will allow user to write program in a type safe and generic way.

Components

generic container data types

template <typename R, rank_t r>
tensor_t<R, r>;  // the data owner type

template <typename R, rank_t r>
tensor_ref_t<R, r>; // the reference type

template <typename R, rank_t r>
tensor_view_t<R, r>; // the read only reference type, like https://en.cppreference.com/w/cpp/header/string_view

All the 3 kinds of data types should have the following methods: They should be as consist as https://en.cppreference.com/w/cpp/container/vector

R* data();
const R* data();

R &at(...);
const R at();

rank_t rank();
std::array_t<dim_t, r> dims();

size_t size(); // the product of all dims

generic algorithms for tensors

advanced features

Potential usages:

lgarithm commented 5 years ago

Lattice of types

  typed flat raw
own tensor<R, r> flat_tensor<R> raw_tensor
ref tensor_ref<R, r> flat_tensor_ref<R> raw_tensor_ref
view tensor_view<R, r> flat_tensor_view<R> raw_tensor_view