You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 typesbool, unsignedchar, unsignedshort, unsignedint, unsignedlong,
signedchar, 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<unsignedchar>, std::vector<unsignedshort>,
std::vector<unsignedint>, std::vector<unsignedlong>, std::vector<signedchar>,
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 Tags 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> replace std::vector<T> in PMT, or should both be maintained in parallel?
Note: Tensor<T> can be cast to std::vector<T> in language bindings when only 1D data is required.
Maintaining both would increase the number of supported types from 31 to 46.
Supported Base Types: Should Tensor<T> support all base types currently in PMT, or only a subset such as float, double, and std::string?
Additionally, should complex types like std::complex<float> and std::complex<double> be included?
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.
The text was updated successfully, but these errors were encountered:
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: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?Tensor<T>
can be cast tostd::vector<T>
in language bindings when only 1D data is required.Supported Base Types: Should
Tensor<T>
support all base types currently in PMT, or only a subset such asfloat
,double
, andstd::string
?std::complex<float>
andstd::complex<double>
be included?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.
The text was updated successfully, but these errors were encountered: