OpTest_MDim.ExecOp2 works... OpTest_MDim.ExecOp3 does not but at least compiles...
This commit is contained in:
parent
7a17aba37d
commit
bb6f18cf1c
2 changed files with 18 additions and 22 deletions
32
src/block.h
32
src/block.h
|
@ -33,11 +33,8 @@ namespace MultiArrayHelper
|
||||||
class BlockBase
|
class BlockBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BlockBase() = default;
|
DEFAULT_MEMBERS(BlockBase);
|
||||||
BlockBase(size_t size);
|
BlockBase(size_t size);
|
||||||
|
|
||||||
BlockBase(BlockBase&& res) = default;
|
|
||||||
BlockBase& operator=(BlockBase&& res) = default;
|
|
||||||
|
|
||||||
virtual BlockType type() const = 0;
|
virtual BlockType type() const = 0;
|
||||||
virtual size_t stepSize() const = 0;
|
virtual size_t stepSize() const = 0;
|
||||||
|
@ -74,13 +71,10 @@ namespace MultiArrayHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MutableBlockBase() = default;
|
DEFAULT_MEMBERS(MutableBlockBase);
|
||||||
MutableBlockBase(size_t size);
|
MutableBlockBase(size_t size);
|
||||||
|
|
||||||
MutableBlockBase& operator=(const BlockBase<T>& in);
|
MutableBlockBase& operator=(const BlockBase<T>& in);
|
||||||
|
|
||||||
MutableBlockBase(MutableBlockBase&& res) = default;
|
|
||||||
MutableBlockBase& operator=(MutableBlockBase&& res) = default;
|
|
||||||
|
|
||||||
virtual T& operator[](size_t pos) = 0;
|
virtual T& operator[](size_t pos) = 0;
|
||||||
|
|
||||||
|
@ -90,7 +84,7 @@ namespace MultiArrayHelper
|
||||||
class Block : public BlockBase<T>
|
class Block : public BlockBase<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Block() = default;
|
DEFAULT_MEMBERS(Block);
|
||||||
Block(const std::vector<T>& data, size_t begPos, size_t size);
|
Block(const std::vector<T>& data, size_t begPos, size_t size);
|
||||||
|
|
||||||
virtual BlockType type() const override;
|
virtual BlockType type() const override;
|
||||||
|
@ -107,7 +101,7 @@ namespace MultiArrayHelper
|
||||||
class MBlock : public MutableBlockBase<T>
|
class MBlock : public MutableBlockBase<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MBlock() = default;
|
DEFAULT_MEMBERS(MBlock);
|
||||||
MBlock(std::vector<T>& data, size_t begPos, size_t size);
|
MBlock(std::vector<T>& data, size_t begPos, size_t size);
|
||||||
|
|
||||||
virtual BlockType type() const override;
|
virtual BlockType type() const override;
|
||||||
|
@ -125,7 +119,8 @@ namespace MultiArrayHelper
|
||||||
class BlockValue : public BlockBase<T>
|
class BlockValue : public BlockBase<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BlockValue() = default;
|
DEFAULT_MEMBERS(BlockValue);
|
||||||
|
|
||||||
BlockValue(const std::vector<T>& data,
|
BlockValue(const std::vector<T>& data,
|
||||||
size_t pos, size_t size);
|
size_t pos, size_t size);
|
||||||
|
|
||||||
|
@ -143,7 +138,8 @@ namespace MultiArrayHelper
|
||||||
class MBlockValue : public MutableBlockBase<T>
|
class MBlockValue : public MutableBlockBase<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MBlockValue() = default;
|
DEFAULT_MEMBERS(MBlockValue);
|
||||||
|
|
||||||
MBlockValue(std::vector<T>& data,
|
MBlockValue(std::vector<T>& data,
|
||||||
size_t pos, size_t size);
|
size_t pos, size_t size);
|
||||||
|
|
||||||
|
@ -163,7 +159,8 @@ namespace MultiArrayHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SplitBlock() = default;
|
DEFAULT_MEMBERS(SplitBlock);
|
||||||
|
|
||||||
SplitBlock(const std::vector<T>& data, size_t begPos,
|
SplitBlock(const std::vector<T>& data, size_t begPos,
|
||||||
size_t stepSize, size_t size);
|
size_t stepSize, size_t size);
|
||||||
|
|
||||||
|
@ -183,7 +180,8 @@ namespace MultiArrayHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MSplitBlock() = default;
|
DEFAULT_MEMBERS(MSplitBlock);
|
||||||
|
|
||||||
MSplitBlock(std::vector<T>& data, size_t begPos,
|
MSplitBlock(std::vector<T>& data, size_t begPos,
|
||||||
size_t stepSize, size_t size);
|
size_t stepSize, size_t size);
|
||||||
|
|
||||||
|
@ -204,11 +202,9 @@ namespace MultiArrayHelper
|
||||||
class BlockResult : public MutableBlockBase<T>
|
class BlockResult : public MutableBlockBase<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BlockResult() = default;
|
DEFAULT_MEMBERS(BlockResult);
|
||||||
|
|
||||||
BlockResult(size_t size);
|
BlockResult(size_t size);
|
||||||
|
|
||||||
BlockResult(BlockResult&& res) = default;
|
|
||||||
BlockResult& operator=(BlockResult&& res) = default;
|
|
||||||
|
|
||||||
virtual BlockType type() const override;
|
virtual BlockType type() const override;
|
||||||
virtual const T& operator[](size_t pos) const override;
|
virtual const T& operator[](size_t pos) const override;
|
||||||
|
|
|
@ -132,7 +132,7 @@ namespace {
|
||||||
EXPECT_EQ( fabs( res.at(mkt('3','B')) - (0.373 * 4.790) ) < 0.0001, true );
|
EXPECT_EQ( fabs( res.at(mkt('3','B')) - (0.373 * 4.790) ) < 0.0001, true );
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
TEST_F(OpTest_MDim, ExecOp2)
|
TEST_F(OpTest_MDim, ExecOp2)
|
||||||
{
|
{
|
||||||
MultiArray<double,MRange,SRange> res(mr1ptr,sr4ptr);
|
MultiArray<double,MRange,SRange> res(mr1ptr,sr4ptr);
|
||||||
|
@ -143,7 +143,7 @@ namespace {
|
||||||
auto i1 = std::dynamic_pointer_cast<MRange::IndexType>( mr1ptr->index() );
|
auto i1 = std::dynamic_pointer_cast<MRange::IndexType>( mr1ptr->index() );
|
||||||
auto i2 = std::dynamic_pointer_cast<SRange::IndexType>( sr4ptr->index() );
|
auto i2 = std::dynamic_pointer_cast<SRange::IndexType>( sr4ptr->index() );
|
||||||
|
|
||||||
res(i1,i2) = ma1(i1) + ma2(i2) - ma3(i2);
|
res(i1,i2) = ( ma1(i1) + ma2(i2) ) - ma3(i2);
|
||||||
|
|
||||||
EXPECT_EQ( fabs( res.at(mkt(mkt('1','a'),'A')) - (0.353 + 8.870 - 1.470) ) < 0.0001, true );
|
EXPECT_EQ( fabs( res.at(mkt(mkt('1','a'),'A')) - (0.353 + 8.870 - 1.470) ) < 0.0001, true );
|
||||||
EXPECT_EQ( fabs( res.at(mkt(mkt('1','a'),'B')) - (0.353 + 4.790 - 2.210) ) < 0.0001, true );
|
EXPECT_EQ( fabs( res.at(mkt(mkt('1','a'),'B')) - (0.353 + 4.790 - 2.210) ) < 0.0001, true );
|
||||||
|
@ -160,7 +160,7 @@ namespace {
|
||||||
EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'A')) - (2.911 + 8.870 - 1.470) ) < 0.0001, true );
|
EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'A')) - (2.911 + 8.870 - 1.470) ) < 0.0001, true );
|
||||||
EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'B')) - (2.911 + 4.790 - 2.210) ) < 0.0001, true );
|
EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'B')) - (2.911 + 4.790 - 2.210) ) < 0.0001, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(OpTest_MDim, ExecOp3)
|
TEST_F(OpTest_MDim, ExecOp3)
|
||||||
{
|
{
|
||||||
MultiArray<double,MRange,SRange> res(mr1ptr,sr4ptr);
|
MultiArray<double,MRange,SRange> res(mr1ptr,sr4ptr);
|
||||||
|
@ -191,7 +191,7 @@ namespace {
|
||||||
EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'A')) - (2.911 + 0.373 + 1.470) ) < 0.0001, true );
|
EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'A')) - (2.911 + 0.373 + 1.470) ) < 0.0001, true );
|
||||||
EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'B')) - (2.911 + 0.373 + 2.210) ) < 0.0001, true );
|
EXPECT_EQ( fabs( res.at(mkt(mkt('3','b'),'B')) - (2.911 + 0.373 + 2.210) ) < 0.0001, true );
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
} // anonymous namspace
|
} // anonymous namspace
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
|
Loading…
Reference in a new issue