various fixes
This commit is contained in:
parent
e016059ad0
commit
2864c10056
3 changed files with 9 additions and 5 deletions
|
@ -18,14 +18,14 @@ namespace CNORXZ
|
||||||
template <class F, class IndexT>
|
template <class F, class IndexT>
|
||||||
constexpr decltype(auto) COpInterface<OpT>::c(F&& f, const Sptr<IndexT>& ind) const
|
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 OpT>
|
||||||
template <class IndexT>
|
template <class IndexT>
|
||||||
constexpr decltype(auto) COpInterface<OpT>::c(const Sptr<IndexT>& ind) const
|
constexpr decltype(auto) COpInterface<OpT>::c(const Sptr<IndexT>& ind) const
|
||||||
{
|
{
|
||||||
return mkContraction([](auto& a, const auto& b) { a += b; },
|
return contraction([](auto& a, const auto& b) { a += b; },
|
||||||
THIS(), ind);
|
THIS(), ind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ namespace CNORXZ
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class F, class Op, class IndexT>
|
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!!!
|
typedef decltype(i->ifor( op, f )) CXprT; // TODO: implement ifor with func arg!!!
|
||||||
return Contraction<CXprT>( i->ifor( op, f ) );
|
return Contraction<CXprT>( i->ifor( op, f ) );
|
||||||
|
|
|
@ -239,7 +239,7 @@ namespace CNORXZ
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class F, class Op, class IndexT>
|
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>
|
template <class IndexT>
|
||||||
constexpr decltype(auto) indexOp(const Sptr<IndexT>& i);
|
constexpr decltype(auto) indexOp(const Sptr<IndexT>& i);
|
||||||
|
|
|
@ -40,7 +40,9 @@ namespace CNORXZ
|
||||||
void writeFile(const String& name, const MArray<T>& data)
|
void writeFile(const String& name, const MArray<T>& data)
|
||||||
{
|
{
|
||||||
std::fstream os(name, std::ios::binary | std::ios::out);
|
std::fstream os(name, std::ios::binary | std::ios::out);
|
||||||
|
CXZ_ASSERT(os.good(), "could not open output file " << name);
|
||||||
write<F>(os, data);
|
write<F>(os, data);
|
||||||
|
CXZ_ASSERT(os.good(), "an error occurred while writing data to file " << name);
|
||||||
os.close();
|
os.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +50,9 @@ namespace CNORXZ
|
||||||
void readFile(const String& name, MArray<T>& data)
|
void readFile(const String& name, MArray<T>& data)
|
||||||
{
|
{
|
||||||
std::fstream is(name, std::ios::binary | std::ios::in);
|
std::fstream is(name, std::ios::binary | std::ios::in);
|
||||||
|
CXZ_ASSERT(is.good(), "could not open input file " << name);
|
||||||
read<F>(is, data);
|
read<F>(is, data);
|
||||||
|
//CXZ_ASSERT(not is.fail(), "an error occurred reading data from file " << name);
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue