Add convertToLinearIndices to common
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "common/ceMatchedFilterHandling.h"
|
||||
#include "common/common.h"
|
||||
#include "common/convertfp16tofloat.h"
|
||||
#include "MatlabReader.h"
|
||||
|
||||
@@ -55,4 +56,30 @@ TEST_F(Common_Test, convertfp16tofloat) {
|
||||
EXPECT_EQ(result[i], output.getData()[i])<<"index:"<<i<<",input:"<< ((short*)ma.getData())[i]<<",input2:"<<input.get()[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST_F(Common_Test, convertToLinearIndices) {
|
||||
//2D
|
||||
{
|
||||
double *dataA = new double[6]{1, 9, 4, 0, .01, 1.9};
|
||||
auto A = Aurora::Matrix::fromRawData(dataA, 3, 2);
|
||||
double *dataB = new double[2]{3, 2};
|
||||
auto B = Aurora::Matrix::fromRawData(dataB, 2, 1);
|
||||
auto output =Recon::convertToLinearIndices(B,A);
|
||||
EXPECT_DOUBLE_AE(-2,output.getData()[0]);
|
||||
EXPECT_DOUBLE_AE(6.03,output.getData()[1]);
|
||||
EXPECT_DOUBLE_AE(6.7,output.getData()[2]);
|
||||
}
|
||||
//3D
|
||||
{
|
||||
double *dataA = new double[12]{1, 9, 4, 0, .01, 1.9, 1, 9, 4, 0, .01, 1.9};
|
||||
auto A = Aurora::Matrix::fromRawData(dataA, 2, 3, 2);
|
||||
double *dataB = new double[3]{3, 2, 2};
|
||||
auto B = Aurora::Matrix::fromRawData(dataB, 3, 1);
|
||||
auto output =Recon::convertToLinearIndices(B,A);
|
||||
EXPECT_DOUBLE_AE(4.06,output.getData()[0]);
|
||||
EXPECT_DOUBLE_AE(11.4,output.getData()[1]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user