fixes + WIP: rop test

This commit is contained in:
Christian Zimmermann 2024-05-01 23:58:25 +02:00
parent be33c429bf
commit 137e9ab463
6 changed files with 25 additions and 14 deletions

View file

@ -52,7 +52,7 @@ namespace CNORXZ
inline auto pos_unpack_args(const F& f, const PosT& pos, const Tuple<Ops...>& args)
{
static_assert(is_pos_type<PosT>::value, "got non-pos-type");
static_assert((is_operation<Ops>::value and ...), "got non-operation type");
static_assert((is_xpr<Ops>::value and ...), "got non-operation type");
typedef std::make_index_sequence<sizeof...(Ops)> Idxs;
typedef std::index_sequence<op_size<Ops>::value...> OpSizes;
return pos_unpack_args_i(f, pos, args, OpSizes{}, Idxs{});

View file

@ -428,11 +428,16 @@ namespace CNORXZ
const String blim = "(";
const String elim = ")";
const String dlim = ",";
return iter<1,NI>
( [&](auto i) { return mIPack[i]->stringMeta(); },
[&](const auto&... xs) {
return blim + mIPack[CSizeT<0>{}]->stringMeta() + ( (dlim + xs) + ... ) + elim;
} );
if constexpr(NI == 1){
return blim + mIPack[CSizeT<0>{}]->stringMeta() + elim;
}
else {
return iter<1,NI>
( [&](auto i) { return mIPack[i]->stringMeta(); },
[&](const auto&... xs) {
return blim + mIPack[CSizeT<0>{}]->stringMeta() + ( (dlim + xs) + ... ) + elim;
} );
}
}
template <class FormatT, class... Indices>

View file

@ -26,7 +26,7 @@ namespace CNORXZ
auto tix = *ti;
for(six = 0; six != sie; ++six){
tix.at( f(*six) );
(*m)[six->lex()] = tix.pos();
(*m)[six.pos()] = tix.pos();
}
}

View file

@ -28,7 +28,7 @@ namespace CNORXZ
for(six = 0; six != sie; ++six){
tix.at( f(*six) );
if(six.rank() == mpi::getRankNumber()){
(*m)[six.local()->lex()] = tix.pos();
(*m)[six.local()->pos()] = tix.pos();
}
}
}

View file

@ -46,7 +46,7 @@ namespace CNORXZ
template <typename T, class RIndexT, class IndexT>
constexpr decltype(auto) croproot(const RCArray<T>& a, const Sptr<RIndexT>& ri,
const Sptr<IndexT>& li);
template <typename T, class RIndexT, class IndexT>
class ROpRoot : public OpInterface<ROpRoot<T,RIndexT,IndexT>>
{

View file

@ -108,22 +108,28 @@ namespace
RArray<Double> res( MArray<Double>(mRXRange->sub(1)), mGeom2 );
EXPECT_EQ(res.size(), comp.size());
typedef UIndex<SizeT> UI;
auto x = std::make_shared<RIndex<MIndex<UI,UI,UI,UI>,MIndex<UI,UI,UI,UI>>>(mRXRange);
auto xl = std::make_shared<RIndex<MIndex<UI,UI,UI,UI>,MIndex<UI,UI,UI,UI>>>(mRXRange);
auto y = std::make_shared<RIndex<MIndex<UI,UI,UI,UI>,MIndex<UI,UI,UI,UI>>>(mRXRange);
auto xy = std::make_shared<RIndex<MIndex<UI,UI,UI,UI>,MIndex<UI,UI,UI,UI>>>(mRXRange);
auto x = std::make_shared<RIndex<MIndex<UI,UI,UI,UI>,MIndex<UI,UI,UI,UI>>>(mRXRange);
auto A = std::make_shared<SIndex<SizeT,4>>(mSpRange);
auto B = std::make_shared<SIndex<SizeT,4>>(mSpRange);
Sptr<Vector<SizeT>> imap1;
Sptr<Vector<SizeT>> imap2;
auto AB = mindexPtr(A*B);
auto BA = mindexPtr(B*A);
auto myx = mindexPtr(y*xl);
// block 1:
//mM1.load(mindexPtr(y*x), x, mindexPtr(A*B), imap1);
//mM2.load(mindexPtr(y*x), xy, mindexPtr(A*B), imap2);
//imap1 = setupMap(x, xl, [](const auto& vec) { return vec; } );
//imap2 = setupMap(xy, myx, [](const auto& vec) { return std::get<0>(vec); } );
//mM1.load(xl, x, AB, imap1);
//mM2.load(myx, xy, BA, imap2);
//res(y).a(mindexPtr(y*xl), [](auto& t, const auto& s) { t += s; },
// mapXpr( x, xl, imap1, mapXpr( xy, myx, imap2, (mM1(x*A*B) * mM2(xy*B*A)).c(AB) ) ) );
/*
res(y) = ( mM1(x*A*B) * mM2(xy*B*A)).c(mindexPtr(x*A*B));
// block 2:
mM1.load(,A*B*a*b);
mM2.load(,A*B*a*b);
res(y) += (mM1(x*A*B*a*b) * mM2(xy*B*A*b*a)).c(mindexPtr(x*A*B));