fix ipow bug and anonymous meta string bug
This commit is contained in:
parent
aceffc1af6
commit
6d52a6cdd9
5 changed files with 8 additions and 7 deletions
|
@ -18,7 +18,6 @@ namespace MultiArrayTools
|
||||||
std::vector<typename Index::MetaType> vv(i->range()->size());
|
std::vector<typename Index::MetaType> vv(i->range()->size());
|
||||||
for(Index j = (*i); j.pos() != j.max(); ++j){
|
for(Index j = (*i); j.pos() != j.max(); ++j){
|
||||||
vv[j.pos()] = j.meta();
|
vv[j.pos()] = j.meta();
|
||||||
VCHECK(j.meta());
|
|
||||||
}
|
}
|
||||||
return MultiArray<typename Index::MetaType, typename Index::RangeType>( i->range(), vv );
|
return MultiArray<typename Index::MetaType, typename Index::RangeType>( i->range(), vv );
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,9 +83,9 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
template <size_t N, typename T, class OperationClass>
|
template <size_t N, typename T, class OperationClass>
|
||||||
auto ipow(const OperationBase<T,OperationClass>& a)
|
auto ipow(const OperationBase<T,OperationClass>& a)
|
||||||
-> Operation<T,x_ipow<N>,OperationClass>
|
-> Operation<T,x_ipow<N-1>,OperationClass>
|
||||||
{
|
{
|
||||||
return Operation<T,x_ipow<N>,OperationClass>(a.THIS());
|
return Operation<T,x_ipow<N-1>,OperationClass>(a.THIS());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
//#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
namespace MultiArrayTools
|
namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,7 @@ namespace MultiArrayTools
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void stringCat(std::vector<char>& out, const std::vector<T>& in)
|
inline void stringCat(std::vector<char>& out, const std::vector<T>& in)
|
||||||
{
|
{
|
||||||
|
//for(auto& x: in) { std::cout << x << std::endl; }
|
||||||
const char* scp = reinterpret_cast<const char*>(in.data());
|
const char* scp = reinterpret_cast<const char*>(in.data());
|
||||||
out.insert(out.end(), scp, scp + in.size() * sizeof(T));
|
out.insert(out.end(), scp, scp + in.size() * sizeof(T));
|
||||||
}
|
}
|
||||||
|
@ -44,6 +45,7 @@ namespace MultiArrayTools
|
||||||
template <>
|
template <>
|
||||||
inline void stringCat<std::string>(std::vector<char>& out, const std::vector<std::string>& in)
|
inline void stringCat<std::string>(std::vector<char>& out, const std::vector<std::string>& in)
|
||||||
{
|
{
|
||||||
|
//for(auto& x: in) { std::cout << x << std::endl; }
|
||||||
std::string tmp = "";
|
std::string tmp = "";
|
||||||
for(auto& x: in){
|
for(auto& x: in){
|
||||||
tmp += x + '\n';
|
tmp += x + '\n';
|
||||||
|
|
|
@ -85,12 +85,13 @@ namespace MultiArrayTools
|
||||||
std::string AnonymousRange::stringMeta(size_t pos) const
|
std::string AnonymousRange::stringMeta(size_t pos) const
|
||||||
{
|
{
|
||||||
std::string out = "[ ";
|
std::string out = "[ ";
|
||||||
size_t xpos = pos;
|
//size_t xpos = pos;
|
||||||
for(size_t i = mOrig.size(); i != 0; --i) {
|
for(size_t i = mOrig.size(); i != 0; --i) {
|
||||||
auto& x = mOrig[i-1];
|
auto& x = mOrig[i-1];
|
||||||
const size_t redpos = pos % x->size();
|
const size_t redpos = pos % x->size();
|
||||||
out = ( (i == mOrig.size()) ? out : out + " , " ) + x->stringMeta(redpos);
|
out = ( (i == mOrig.size()) ? out : out + " , " ) + x->stringMeta(redpos);
|
||||||
xpos -= redpos;
|
pos -= redpos;
|
||||||
|
pos /= x->size();
|
||||||
}
|
}
|
||||||
out += " ]";
|
out += " ]";
|
||||||
return out;
|
return out;
|
||||||
|
|
|
@ -20,7 +20,6 @@ namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
static NullRF nrf; // just that mRInstance is initialized
|
static NullRF nrf; // just that mRInstance is initialized
|
||||||
static auto nr = std::dynamic_pointer_cast<NullRange>( nrf.create() );
|
static auto nr = std::dynamic_pointer_cast<NullRange>( nrf.create() );
|
||||||
VCHECK(NullRF::mRInstance);
|
|
||||||
return NullRF::mRInstance;
|
return NullRF::mRInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue