GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
multiply_matrix_ff.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2014 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 
31 namespace 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::blocks::multiply_matrix_ff::TPP_SELECT_BY_MATRIX, a tag is propagated from input k
54  * to output l 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 gr::block::tag_propagation_policy_t value, or TPP_SELECT_BY_MATRIX.
76  */
77  static sptr make(
78  std::vector<std::vector<float> > A,
80  );
81 
82  //! Returns the current matrix
83  virtual const std::vector<std::vector<float> >& get_A() const = 0;
84  //! Sets the matrix to a new value \p new_A. Returns true if the new matrix was valid and could be changed.
85  virtual bool set_A(const std::vector<std::vector<float> > &new_A) = 0;
86 
87  /*!
88  * \brief Set the policy by the scheduler to determine how tags are moved downstream.
89  *
90  * This will also accept the value TPP_SELECT_BY_MATRIX.
91  */
92  virtual void set_tag_propagation_policy(gr::block::tag_propagation_policy_t p) = 0;
93 
94  static const int TPP_SELECT_BY_MATRIX;
95  static const std::string MSG_PORT_NAME_SET_A;
96  };
97 
98  } // namespace blocks
99 } // namespace gr
100 
101 #endif /* @GUARD_NAME */
Matrix multiplexer/multiplier: y(k) = A * x(k)This block is similar to gr::blocks::multiply_const_ff...
Definition: multiply_matrix_ff.h:67
Definition: block.h:72
static const int TPP_SELECT_BY_MATRIX
Definition: multiply_matrix_ff.h:94
static const std::string MSG_PORT_NAME_SET_A
Definition: multiply_matrix_ff.h:95
tag_propagation_policy_t
Definition: block.h:70
Include this header to use the message passing features.
Definition: logger.h:131
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:30
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
boost::shared_ptr< multiply_matrix_ff > sptr
Definition: multiply_matrix_ff.h:70