Add Fastor library

This commit is contained in:
Bassem Girgis
2025-03-22 01:17:52 -05:00
parent 5546e086f6
commit 4dd5939693
132 changed files with 55086 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#ifndef TENSORBASE_H
#define TENSORBASE_H
#include "Fastor/config/config.h"
#include "Fastor/meta/tensor_meta.h"
namespace Fastor {
template<typename T, size_t ... Rest>
class Tensor;
template<typename T, size_t ... Rest>
class TensorMap;
template<class Derived, FASTOR_INDEX Rank>
class AbstractTensor {
public:
constexpr FASTOR_INLINE AbstractTensor() = default;
constexpr FASTOR_INLINE const Derived& self() const {return *static_cast<const Derived*>(this);}
FASTOR_INLINE Derived& self() {return *static_cast<Derived*>(this);}
static constexpr FASTOR_INDEX Dimension = Rank;
#ifndef FASTOR_DYNAMIC_MODE
static constexpr FASTOR_INDEX size() {return Derived::Size;}
#else
FASTOR_INDEX size() const {return (*static_cast<const Derived*>(this)).size();}
#endif
};
}
#endif // TENSORBASE_H