From 5bc469296b7c6366977fa3f95f7a96f6d023cf6e Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Wed, 15 Nov 2017 17:35:44 +0100 Subject: [PATCH] ... --- src/block.cc | 1 + src/block.h | 13 ++++++++++++- src/multi_array_operation.cc | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/block.cc b/src/block.cc index a351545..8ad4f19 100644 --- a/src/block.cc +++ b/src/block.cc @@ -32,6 +32,7 @@ namespace MultiArrayHelper static OpFunc f; if(mRes.size() == 0) { mRes.assign(arg.size(), static_cast(0)); } assert(mRes.size() == arg.size()); + VCHECK(arg); for(size_t i = 0; i != arg.size(); ++i){ mRes[i] = f(mRes[i], arg[i]); } diff --git a/src/block.h b/src/block.h index ffb6610..e007350 100644 --- a/src/block.h +++ b/src/block.h @@ -56,7 +56,7 @@ namespace MultiArrayHelper }; template - std::ostream& operator<<(std::ostream& out, const BlockBase& block) + std::ostream& operator<<(std::ostream& out, const MBlock& block) { out << block[0]; for(size_t i = 1; i != block.size(); ++i){ @@ -64,6 +64,17 @@ namespace MultiArrayHelper } return out; } + + template + std::ostream& operator<<(std::ostream& out, const BlockResult& block) + { + out << block[0]; + for(size_t i = 1; i != block.size(); ++i){ + out << ", " << block[i]; + } + return out; + } + template class MutableBlockBase : public BlockBase diff --git a/src/multi_array_operation.cc b/src/multi_array_operation.cc index 647e882..54bee2c 100644 --- a/src/multi_array_operation.cc +++ b/src/multi_array_operation.cc @@ -355,8 +355,9 @@ namespace MultiArrayTools template const BlockResult& Contraction::get() const { - BlockBinaryOpSelf,BlockResult > f(mRes); + BlockBinaryOpSelf,decltype(mOp.get())> f(mRes); for(*mInd = 0; mInd->pos() != mInd->max(); ++(*mInd)){ + VCHECK(mInd->pos()); f(mOp.get()); } return mRes;