32 #include <RobotAPI/interface/aron.h>
42 convert_to_1d_vector(
const unsigned char*
data,
const int offset,
const int size)
46 int elements = size /
sizeof(
T);
48 std::vector<T>
v(elements);
49 memcpy(
v.data(),
data + offset, size);
58 static std::vector<std::vector<T>>
63 if (dims.size() == 0 || dim0size == 0)
70 dim0size = dims.at(0);
76 const int fullDataSize = fullDataByteSize /
sizeof(
T);
79 const int dim1size = fullDataSize / dim0size;
81 const int oneRowByteSize = dim1size *
sizeof(
T);
82 std::vector<std::vector<T>>
v(dims.at(0));
83 for (
int i = 0; i < dim0size; i++)
85 v[i] = convert_to_1d_vector<T>(nav.
getData(), i * oneRowByteSize, oneRowByteSize);
92 static std::vector<std::vector<T>>
97 return ConvertTo2DVector<T>(*nav);
100 template <
typename T>
101 static std::vector<T>
106 if (dims.size() == 0)
114 const int dim0size = fullDataByteSize /
sizeof(
T);
116 const int oneRowByteSize = dim0size *
sizeof(
T);
117 std::vector<T>
v = convert_to_1d_vector<T>(nav.
getData(), 0, oneRowByteSize);
121 template <
typename T>
122 static std::vector<T>
127 return ConvertTo1DVector<T>(*nav);
131 template <
typename T>
132 static std::vector<T>
135 return ConvertTo1DVector<T>(nav);
139 template <
typename T>
145 ndArr->setShape({
static_cast<int>(
data.size()),
sizeof(
T)});
146 ndArr->setData(
sizeof(
T) *
data.size(),
147 reinterpret_cast<const unsigned char*
>(
data.data()));
153 template <
typename T>
157 return ConvertFrom1DVector<T>(
data);