MayaFlux 0.3.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 254 of file OperationHelper.hpp.

256 {
257 if constexpr (std::is_same_v<T, std::vector<std::vector<double>>>) {
258 return double_data;
259 } else if constexpr (std::is_same_v<T, Eigen::MatrixXd>) {
260 return recreate_eigen_matrix(double_data, structure_info);
261 } else if constexpr (std::is_same_v<T, std::vector<Kakshya::DataVariant>>) {
262 std::vector<Kakshya::DataVariant> variants;
263 variants.reserve(double_data.size());
264 for (const auto& vec : double_data) {
265 variants.emplace_back(vec);
266 }
267 return variants;
268 } else if constexpr (std::is_same_v<T, Kakshya::DataVariant>) {
269 auto data = Kakshya::interleave_channels<double>(double_data);
270 return reconstruct_data_variant_from_double(data, structure_info);
271 } else {
272 throw std::runtime_error("Reconstruction not implemented for target type");
273 }
274 }
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: