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

◆ to_matrix()

Eigen::MatrixXd MayaFlux::Kakshya::EigenAccess::to_matrix ( ) const

Convert DataVariant to Eigen matrix.

Returns
Matrix representation
  • Scalar types: 1xN matrix (single row)
  • Complex types: 2xN matrix (row 0 = real, row 1 = imag)
  • GLM vec2: 2xN matrix
  • GLM vec3: 3xN matrix
  • GLM vec4: 4xN matrix
  • GLM mat4: 16xN matrix (flattened)

Definition at line 37 of file EigenAccess.cpp.

38{
39 return std::visit([this](const auto& vec) -> Eigen::MatrixXd {
40 using T = typename std::decay_t<decltype(vec)>::value_type;
41
42 if constexpr (std::is_arithmetic_v<T>) {
43 return scalar_to_matrix(vec);
44 } else if constexpr (std::is_same_v<T, std::complex<float>> || std::is_same_v<T, std::complex<double>>) {
45 return complex_to_matrix(vec);
46 } else if constexpr (GlmType<T>) {
47 return glm_to_matrix(vec);
48 } else {
49 error<std::invalid_argument>(
52 std::source_location::current(),
53 "Unsupported type for Eigen conversion: {}",
54 typeid(T).name());
55 }
56 },
57 m_variant);
58}
Eigen::MatrixXd scalar_to_matrix(const std::vector< T > &vec) const
Eigen::MatrixXd glm_to_matrix(const std::vector< T > &vec) const
const Kakshya::DataVariant & m_variant
Eigen::MatrixXd complex_to_matrix(const std::vector< std::complex< T > > &vec) const
@ Runtime
General runtime operations (default fallback)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.

References complex_to_matrix(), glm_to_matrix(), MayaFlux::Journal::Kakshya, m_variant, MayaFlux::Journal::Runtime, and scalar_to_matrix().

Referenced by MayaFlux::Kakshya::to_eigen_matrix().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: