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,39 @@
#ifndef TENSOR_EVALUATOR_H
#define TENSOR_EVALUATOR_H
// Expression templates evaluators
//----------------------------------------------------------------------------------------------------------//
template<typename U=T>
FASTOR_INLINE SIMDVector<U,simd_abi_type> eval(FASTOR_INDEX i) const {
SIMDVector<U,simd_abi_type> _vec;
_vec.load(&_data[get_mem_index(i)],false);
return _vec;
}
template<typename U=T>
FASTOR_INLINE T eval_s(FASTOR_INDEX i) const {
return _data[get_mem_index(i)];
}
template<typename U=T>
FASTOR_INLINE SIMDVector<U,simd_abi_type> eval(FASTOR_INDEX i, FASTOR_INDEX j) const {
SIMDVector<U,simd_abi_type> _vec;
_vec.load(&_data[get_flat_index(i,j)],false);
return _vec;
}
template<typename U=T>
FASTOR_INLINE T eval_s(FASTOR_INDEX i, FASTOR_INDEX j) const {
return _data[get_flat_index(i,j)];
}
template<typename U=T>
FASTOR_INLINE SIMDVector<U,simd_abi_type> teval(const std::array<int, dimension_t::value> &as) const {
SIMDVector<U,simd_abi_type> _vec;
_vec.load(&_data[get_flat_index(as)],false);
return _vec;
}
template<typename U=T>
FASTOR_INLINE T teval_s(const std::array<int, dimension_t::value> &as) const {
return _data[get_flat_index(as)];
}
//----------------------------------------------------------------------------------------------------------//
#endif // end of TENSOR_EVALUATOR_H