From 137e9ab463896b2fa26073295db351bd7e2f9b03 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Wed, 1 May 2024 23:58:25 +0200 Subject: [PATCH] fixes + WIP: rop test --- src/include/operation/op_utility.cc.h | 2 +- src/include/ranges/mrange.cc.h | 15 ++++++++++----- src/include/xpr/map_xpr.cc.h | 2 +- src/opt/mpi/include/rmap_xpr.cc.h | 2 +- src/opt/mpi/include/rop_types.h | 2 +- src/opt/mpi/tests/roperation_unit_test.cc | 16 +++++++++++----- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/include/operation/op_utility.cc.h b/src/include/operation/op_utility.cc.h index 62f9b3d..508e1a7 100644 --- a/src/include/operation/op_utility.cc.h +++ b/src/include/operation/op_utility.cc.h @@ -52,7 +52,7 @@ namespace CNORXZ inline auto pos_unpack_args(const F& f, const PosT& pos, const Tuple& args) { static_assert(is_pos_type::value, "got non-pos-type"); - static_assert((is_operation::value and ...), "got non-operation type"); + static_assert((is_xpr::value and ...), "got non-operation type"); typedef std::make_index_sequence Idxs; typedef std::index_sequence::value...> OpSizes; return pos_unpack_args_i(f, pos, args, OpSizes{}, Idxs{}); diff --git a/src/include/ranges/mrange.cc.h b/src/include/ranges/mrange.cc.h index f1fc5d6..ee29536 100644 --- a/src/include/ranges/mrange.cc.h +++ b/src/include/ranges/mrange.cc.h @@ -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 diff --git a/src/include/xpr/map_xpr.cc.h b/src/include/xpr/map_xpr.cc.h index b62d4d8..902ed2b 100644 --- a/src/include/xpr/map_xpr.cc.h +++ b/src/include/xpr/map_xpr.cc.h @@ -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(); } } diff --git a/src/opt/mpi/include/rmap_xpr.cc.h b/src/opt/mpi/include/rmap_xpr.cc.h index 5d244c6..cde7969 100644 --- a/src/opt/mpi/include/rmap_xpr.cc.h +++ b/src/opt/mpi/include/rmap_xpr.cc.h @@ -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(); } } } diff --git a/src/opt/mpi/include/rop_types.h b/src/opt/mpi/include/rop_types.h index 1b23d39..896cae2 100644 --- a/src/opt/mpi/include/rop_types.h +++ b/src/opt/mpi/include/rop_types.h @@ -46,7 +46,7 @@ namespace CNORXZ template constexpr decltype(auto) croproot(const RCArray& a, const Sptr& ri, const Sptr& li); - + template class ROpRoot : public OpInterface> { diff --git a/src/opt/mpi/tests/roperation_unit_test.cc b/src/opt/mpi/tests/roperation_unit_test.cc index 8efa7f1..7b245bb 100644 --- a/src/opt/mpi/tests/roperation_unit_test.cc +++ b/src/opt/mpi/tests/roperation_unit_test.cc @@ -108,22 +108,28 @@ namespace RArray res( MArray(mRXRange->sub(1)), mGeom2 ); EXPECT_EQ(res.size(), comp.size()); typedef UIndex UI; - auto x = std::make_shared,MIndex>>(mRXRange); + auto xl = std::make_shared,MIndex>>(mRXRange); auto y = std::make_shared,MIndex>>(mRXRange); auto xy = std::make_shared,MIndex>>(mRXRange); + auto x = std::make_shared,MIndex>>(mRXRange); auto A = std::make_shared>(mSpRange); auto B = std::make_shared>(mSpRange); Sptr> imap1; Sptr> 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));