20 size_t ndim() const noexcept {
return dims.size(); }
28 return msgpack::unpack(
static_cast<const char *
>(msg.data()), msg.size());
30 return msgpack::object_handle();
34 template <
typename S,
typename T>
36 std::conditional_t<std::is_const_v<S>, std::add_const_t<T>, T>;
38 template <
typename MatrixType>
42 const Eigen::Index rows = spec.
dims[0];
43 using MapType = Eigen::Map<MatrixType>;
44 if constexpr (MatrixType::IsVectorAtCompileTime) {
45 return MapType{data, rows};
47 const Eigen::Index cols =
50 return MapType{data, rows, cols};
56 template <
typename MatrixType>
58 using Scalar =
typename MatrixType::Scalar;
59 Scalar *data =
reinterpret_cast<Scalar *
>(spec.
data.data());
64 template <
typename MatrixType>
65 Eigen::Map<const MatrixType>
67 using Scalar =
typename MatrixType::Scalar;
68 const Scalar *data =
reinterpret_cast<const Scalar *
>(spec.
data.data());
std::conditional_t< std::is_const_v< S >, std::add_const_t< T >, T > add_const_if_const_t
Definition Messages.h:35
Eigen::Map< MatrixType > get_eigen_view_msg_impl(const ArrayMessage &spec, add_const_if_const_t< MatrixType, typename MatrixType::Scalar > *data)
Definition Messages.h:39
Eigen::Map< MatrixType > get_eigen_view_from_spec(ArrayMessage &spec)
Convert ArrayMessage to a mutable Eigen::Matrix view.
Definition Messages.h:57
msgpack::object_handle get_handle_from_zmq_msg(zmq::message_t &&msg)
Convert a ZMQ message (by move) to to a msgpack object.
Definition Messages.h:26
Message for intermediate representation of a vector or matrix.
Definition Messages.h:15
size_t ndim() const noexcept
Definition Messages.h:20
MSGPACK_DEFINE(dtype, dims, data)
std::vector< long > dims
Definition Messages.h:17
std::vector< uint8_t > data
Definition Messages.h:18
std::string dtype
Definition Messages.h:16