various fixes

This commit is contained in:
Christian Zimmermann 2023-03-07 20:12:11 +01:00
parent e016059ad0
commit 2864c10056
3 changed files with 9 additions and 5 deletions

View file

@ -18,15 +18,15 @@ namespace CNORXZ
template <class F, class IndexT>
constexpr decltype(auto) COpInterface<OpT>::c(F&& f, const Sptr<IndexT>& ind) const
{
return mkContraction(std::forward<F>(f), THIS().r(), ind);
return contraction(std::forward<F>(f), THIS().r(), ind);
}
template <class OpT>
template <class IndexT>
constexpr decltype(auto) COpInterface<OpT>::c(const Sptr<IndexT>& ind) const
{
return mkContraction([](auto& a, const auto& b) { a += b; },
THIS(), ind);
return contraction([](auto& a, const auto& b) { a += b; },
THIS(), ind);
}
template <class OpT>
@ -406,7 +406,7 @@ namespace CNORXZ
}
template <class F, class Op, class IndexT>
constexpr decltype(auto) contracion(F&& f, Op&& op, const Sptr<IndexT>& i)
constexpr decltype(auto) contraction(F&& f, Op&& op, const Sptr<IndexT>& i)
{
typedef decltype(i->ifor( op, f )) CXprT; // TODO: implement ifor with func arg!!!
return Contraction<CXprT>( i->ifor( op, f ) );

View file

@ -239,7 +239,7 @@ namespace CNORXZ
};
template <class F, class Op, class IndexT>
constexpr decltype(auto) contracion(F&& f, Op&& op, const Sptr<IndexT>& i);
constexpr decltype(auto) contraction(F&& f, Op&& op, const Sptr<IndexT>& i);
template <class IndexT>
constexpr decltype(auto) indexOp(const Sptr<IndexT>& i);

View file

@ -40,7 +40,9 @@ namespace CNORXZ
void writeFile(const String& name, const MArray<T>& data)
{
std::fstream os(name, std::ios::binary | std::ios::out);
CXZ_ASSERT(os.good(), "could not open output file " << name);
write<F>(os, data);
CXZ_ASSERT(os.good(), "an error occurred while writing data to file " << name);
os.close();
}
@ -48,7 +50,9 @@ namespace CNORXZ
void readFile(const String& name, MArray<T>& data)
{
std::fstream is(name, std::ios::binary | std::ios::in);
CXZ_ASSERT(is.good(), "could not open input file " << name);
read<F>(is, data);
//CXZ_ASSERT(not is.fail(), "an error occurred reading data from file " << name);
is.close();
}