-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Background
The current PMT (Polymorphic Type) property_map
in GNU Radio 4 supports 31 types, including base types, vectors of base types, and recursive maps:
using property_map = std::map<std::string, rva::variant< // recursive/nested
std::monostate,
// 15 base types
bool, unsigned char, unsigned short, unsigned int, unsigned long,
signed char, short, int, long, float, double,
std::complex<float>, std::complex<double>, std::string,
// 15 std::vector of base types and a self-reference
std::vector<bool>, std::vector<unsigned char>, std::vector<unsigned short>,
std::vector<unsigned int>, std::vector<unsigned long>, std::vector<signed char>,
std::vector<short>, std::vector<int>, std::vector<long>, std::vector<float>,
std::vector<double>, std::vector<std::complex<float>>,
std::vector<std::complex<double>>, std::vector<std::string>,
std::vector<rva::self_t>,
// std::map as a recursive self-reference
std::map<std::string, rva::self_t>
>>;
PMTs are primarily used in the GNU Radio 4 core for Tag
s and inter-domain exchange of settings, notably between C/C++ and Python. Limiting the number of canonical types transferred between domains simplifies the API for language bindings and UI integrations and reduces the need for extensive type checking and guarding against corner cases.
However, some blocks require more complex settings types, such as matrices and higher-dimensional data structures, which cannot currently be expressed using PMTs.
Proposal
Introduce a new Tensor<T>
storage type in PMT to generalize vectors, matrices, and higher-dimensional data structures. A prototype implementation is available for reference: Godbolt Compiler Explorer.
Open Questions
-
Pre-condition: Evaluate whether using
std::any
in PMT reduces compile-time overhead. @jsallay has offered to investigate this. -
Implementation Choice: Should we use the provided
Tensor<T>
implementation or adopt an external library that offers a standard data format in machine learning and linear algebra contexts? -
Integration with Existing Types: Should
Tensor<T>
replacestd::vector<T>
in PMT, or should both be maintained in parallel?- Note:
Tensor<T>
can be cast tostd::vector<T>
in language bindings when only 1D data is required. - Maintaining both would increase the number of supported types from 31 to 46.
- Note:
-
Supported Base Types: Should
Tensor<T>
support all base types currently in PMT, or only a subset such asfloat
,double
, andstd::string
?- Additionally, should complex types like
std::complex<float>
andstd::complex<double>
be included?
- Additionally, should complex types like
Next Steps: This proposal aims to enhance PMT's capability to handle more complex data structures required by certain blocks. Input and discussions on the open questions are welcome to refine the approach and implementation details.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status