GNU Radio Manual and C++ API Reference 3.7.14.0
The Free & Open Software Radio Ecosystem
multiply_matrix_ff.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2014, 2017 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23// WARNING: this file is machine generated. Edits will be overwritten
24
25#ifndef INCLUDED_BLOCKS_MULTIPLY_MATRIX_FF_H
26#define INCLUDED_BLOCKS_MULTIPLY_MATRIX_FF_H
27
28#include <gnuradio/blocks/api.h>
29#include <gnuradio/sync_block.h>
30
31namespace gr {
32 namespace blocks {
33
34 /*!
35 * \brief Matrix multiplexer/multiplier: y(k) = A x(k)
36 * \ingroup blocks
37 *
38 * This block is similar to gr::blocks::multiply_const_ff, the difference
39 * being it can handle several inputs and outputs, and the input-to-output
40 * relation can be described by the following mathematical equation:
41 * \f[
42 * \mathbf{y}(k) = \mathbf{A} \mathbf{x}(k) \, , \, y \in \mathbb{R}^N, \mathbf{x} \in \mathbb{R}^M, A \in \mathbb{R}^{N \times M}
43 * \f]
44 * \f$\mathbf{y}(k)\f$ and \f$\mathbf{x}(i)\f$ are column-vectors describing the elements on the input port
45 * at time step \f$k\f$ (this is a sync block with no memory).
46 *
47 * Examples for where to use this block include:
48 * - Switch matrices (i.e. switch which ports go where), assuming all ports run on the same rate
49 * - Simulation of static MIMO-Channels (in that case, \f$\mathbf{A}\f$ is the channel matrix)
50 * - Summing up streams with variable coefficients
51 *
52 * This block features a special tag propagation mode: When setting the tag propagation policy
53 * to gr::block::TPP_CUSTOM, a tag is propagated from input \f$k\f$
54 * to output \f$l\f$, if \f$(A)_{l,k} \neq 0\f$.
55 *
56 * \section blocks_matrixmult_msgports_multiply_matrix_ff Message Ports
57 *
58 * This block as one input message port (\p set_A). A message sent to this port will
59 * be converted to a std::vector<std::vector<float> >, and then passed on to set_A().
60 * If no conversion is possible, a warning is issued via the logging interface, and
61 * A remains unchanged.
62 *
63 * *Note*: It is not possible to change the dimension of the matrix after initialization,
64 * as this affects the I/O signature! If a matrix of invalid size is passed to the block,
65 * an alert is raised via the logging interface, and A remains unchanged.
66 */
68 {
69 public:
70 typedef boost::shared_ptr<multiply_matrix_ff> sptr;
71
72 /*!
73 * \param A The matrix
74 * \param tag_propagation_policy The tag propagation policy.
75 * Note this can be any
76 * gr::block::tag_propagation_policy_t
77 * value. In case of TPP_CUSTOM, tags are
78 * only transferred from input \f$k\f$ to
79 * output \f$l \iff (A)_{l,k} \neq 0\f$.
80 */
81 static sptr make(
82 std::vector<std::vector<float> > A,
84 );
85
86 //! Returns the current matrix
87 virtual const std::vector<std::vector<float> >& get_A() const = 0;
88 //! Sets the matrix to a new value \p new_A. Returns true if the new matrix was valid and could be changed.
89 virtual bool set_A(const std::vector<std::vector<float> > &new_A) = 0;
90
91 static const std::string MSG_PORT_NAME_SET_A;
92 };
93
94 } // namespace blocks
95} // namespace gr
96
97#endif /* @GUARD_NAME */
tag_propagation_policy_t
enum to represent different tag propagation policies.
Definition: block.h:74
@ TPP_ALL_TO_ALL
Definition: block.h:77
Matrix multiplexer/multiplier: y(k) = A x(k)
Definition: multiply_matrix_ff.h:68
static sptr make(std::vector< std::vector< float > > A, gr::block::tag_propagation_policy_t tag_propagation_policy=gr::block::TPP_ALL_TO_ALL)
virtual bool set_A(const std::vector< std::vector< float > > &new_A)=0
Sets the matrix to a new value new_A. Returns true if the new matrix was valid and could be changed.
boost::shared_ptr< multiply_matrix_ff > sptr
Definition: multiply_matrix_ff.h:70
static const std::string MSG_PORT_NAME_SET_A
Definition: multiply_matrix_ff.h:91
virtual const std::vector< std::vector< float > > & get_A() const =0
Returns the current matrix.
synchronous 1:1 input to output with history
Definition: sync_block.h:38
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:30
Include this header to use the message passing features.
Definition: basic_block.h:45