MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ reconstruct_from_double() [1/2]

template<ComputeData T>
requires (!is_IO<T>::value)
static T MayaFlux::Yantra::OperationHelper::reconstruct_from_double ( const std::vector< std::vector< double > > &  double_data,
const DataStructureInfo structure_info 
)
inlinestatic

Reconstruct ComputeData type from double vector and structure info.

Template Parameters
TTarget ComputeData type
Parameters
double_dataProcessed double vector
structure_infoOriginal structure metadata
Returns
Reconstructed data of type T

Definition at line 255 of file OperationHelper.hpp.

257 {
258 if constexpr (std::is_same_v<T, std::vector<std::vector<double>>>) {
259 return double_data;
260 } else if constexpr (std::is_same_v<T, Eigen::MatrixXd>) {
261 return recreate_eigen_matrix(double_data, structure_info);
262 } else if constexpr (std::is_same_v<T, std::vector<Kakshya::DataVariant>>) {
263 std::vector<Kakshya::DataVariant> variants;
264 variants.reserve(double_data.size());
265 for (const auto& vec : double_data) {
266 variants.emplace_back(vec);
267 }
268 return variants;
269 } else if constexpr (std::is_same_v<T, Kakshya::DataVariant>) {
270 auto data = Kakshya::interleave_channels<double>(double_data);
271 return reconstruct_data_variant_from_double(data, structure_info);
272 } else {
273 throw std::runtime_error("Reconstruction not implemented for target type");
274 }
275 }
static Kakshya::DataVariant reconstruct_data_variant_from_double(const std::vector< double > &double_data, const DataStructureInfo &structure_info)
Reconstruct DataVariant from double data and structure info.
static Eigen::MatrixXd recreate_eigen_matrix(const std::vector< std::vector< double > > &columns, const DataStructureInfo &structure_info)
Infer data structure from ComputeData type.

References reconstruct_data_variant_from_double(), and recreate_eigen_matrix().

+ Here is the call graph for this function: