This commit is contained in:
parent
5acd80bdcb
commit
81a21120ed
3 changed files with 11 additions and 41 deletions
|
@ -222,8 +222,7 @@ namespace CNORXZ
|
|||
OpRoot<T,Index> ArrayBase<T>::operator()(const Sptr<Index>& i)
|
||||
{
|
||||
//CXZ_WARNING("FORMAT / BLOCKSIZES!!!");
|
||||
auto j = moveToPtr( begin()->formatTo(i) ); // moveToPtr: keep original instance of sub indices
|
||||
return oproot(*this, j);
|
||||
return oproot(*this, i);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -231,16 +230,14 @@ namespace CNORXZ
|
|||
inline decltype(auto) ArrayBase<T>::operator()(const SPack<Indices...>& pack)
|
||||
{
|
||||
//CXZ_WARNING("FORMAT / BLOCKSIZES!!!");
|
||||
auto j = moveToPtr( begin()->formatTo(mindexPtr(pack)) );
|
||||
return oproot(*this, j);
|
||||
return oproot(*this, mindexPtr(pack));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline decltype(auto) ArrayBase<T>::operator()(const DPack& pack)
|
||||
{
|
||||
//CXZ_WARNING("FORMAT / BLOCKSIZES!!!");
|
||||
auto j = moveToPtr( begin()->formatTo(yindexPtr(pack)) );
|
||||
return oproot(*this, j);
|
||||
return oproot(*this, yindexPtr(pack));
|
||||
}
|
||||
|
||||
/*****************************
|
||||
|
|
|
@ -390,41 +390,6 @@ namespace CNORXZ
|
|||
static_assert(is_index<Index>::value, "got non-index");
|
||||
CXZ_ASSERT(ind.dim() >= dim(), "for formatting index of dimension " << dim()
|
||||
<< " need index of at least the same dimension, got " << ind.dim());
|
||||
|
||||
if constexpr(index_is_multi<Index>::value){
|
||||
if constexpr(has_static_sub<Index>::value){ // static dim (GMIndex)
|
||||
// assert either same dim, dim == 1, or static sizes
|
||||
CXZ_WARNING("not implemented!");
|
||||
}
|
||||
else { // YIndex
|
||||
SizeT j = 0;
|
||||
iter<0,NI>
|
||||
( [&](auto i){
|
||||
CXZ_ASSERT(j < ind.dim(), "no sub indices left");
|
||||
const auto isize = pack()[i]->size();
|
||||
SizeT ssize = 1;
|
||||
for(; j < ind.dim() and ssize < isize; ++j){
|
||||
ssize *= ind.pack()[j];
|
||||
}
|
||||
CXZ_ASSERT(ssize == isize, "incompatible sizes: " << ssize
|
||||
<< " vs " << isize);
|
||||
},
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(ind.dim() > 1) { // DIndex to YIndex
|
||||
|
||||
}
|
||||
else { // this->dim() == 1 and ind.dim() == 1
|
||||
static_assert
|
||||
(std::is_same<FormatT,std::remove_reference<decltype(ind.format())>>::type,
|
||||
"got incompatible static index format types");
|
||||
mFormat = ind.format();
|
||||
// assert that all lower indices in ind have dim == 1!!!
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -514,6 +479,13 @@ namespace CNORXZ
|
|||
return mLexFormat;
|
||||
}
|
||||
|
||||
template <class FormatT, class... Indices>
|
||||
auto GMIndex<FormatT,Indices...>::deepFormat() const
|
||||
{
|
||||
return iter<0,NI>( [&](auto i) { return std::get<i>(mIPack)->deepFormat(); },
|
||||
[&](const auto&... e) { return (e * ...); } );
|
||||
}
|
||||
|
||||
template <class FormatT, class... Indices>
|
||||
GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::setFormat(const FormatT& bs)
|
||||
{
|
||||
|
|
|
@ -81,6 +81,7 @@ namespace CNORXZ
|
|||
const SPack<Indices...>& pack() const;
|
||||
const auto& format() const;
|
||||
const auto& lexFormat() const;
|
||||
auto deepFormat() const;
|
||||
GMIndex& setFormat(const FormatT& bs);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue