[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/04: blocks: Added multiply_matrix_ff
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/04: blocks: Added multiply_matrix_ff |
Date: |
Thu, 24 Jul 2014 18:11:16 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 84827e9d7b39f06b3fa33c5d8eba38fbd72a43ca
Author: Martin Braun <address@hidden>
Date: Sun May 4 13:51:35 2014 +0200
blocks: Added multiply_matrix_ff
This block maps inputs to outputs by matrix multiplication.
Also includes QA.
---
gr-blocks/examples/matrix_multiplexer.grc | 1110 ++++++++++++++++++++
gr-blocks/grc/blocks_block_tree.xml | 1 +
gr-blocks/grc/blocks_multiply_matrix_xx.xml | 63 ++
gr-blocks/include/gnuradio/blocks/CMakeLists.txt | 2 +-
.../include/gnuradio/blocks/multiply_matrix_ff.h | 92 ++
gr-blocks/lib/CMakeLists.txt | 1 +
gr-blocks/lib/multiply_matrix_ff_impl.cc | 192 ++++
gr-blocks/lib/multiply_matrix_ff_impl.h | 59 ++
gr-blocks/python/blocks/qa_multiply_matrix_ff.py | 172 +++
gr-blocks/swig/blocks_swig3.i | 3 +
10 files changed, 1694 insertions(+), 1 deletion(-)
diff --git a/gr-blocks/examples/matrix_multiplexer.grc
b/gr-blocks/examples/matrix_multiplexer.grc
new file mode 100644
index 0000000..724c534
--- /dev/null
+++ b/gr-blocks/examples/matrix_multiplexer.grc
@@ -0,0 +1,1110 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Tue Jun 3 11:35:32 2014</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>matrix_multiply_demo</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Matrix Multiply/Multiplex Demo</value>
+ </param>
+ <param>
+ <key>author</key>
+ <value>Martin Braun</value>
+ </param>
+ <param>
+ <key>description</key>
+ <value>A demonstration of multiply_matrix_ff to demonstrate how to use
it for stream selection</value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>qt_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run_options</key>
+ <value>prompt</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(-2, -6)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(183, 5)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_null_source</key>
+ <param>
+ <key>id</key>
+ <value>blocks_null_source_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>num_outputs</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>bus_conns</key>
+ <value>[[0,],]</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(-1, 298)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>analog_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>analog_sig_source_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>analog.GR_COS_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(0, 136)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_time_sink_x_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>srate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>autoscale</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ymin</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>ymax</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>update_time</key>
+ <value>0.10</value>
+ </param>
+ <param>
+ <key>entags</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>tr_mode</key>
+ <value>qtgui.TRIG_MODE_FREE</value>
+ </param>
+ <param>
+ <key>tr_slope</key>
+ <value>qtgui.TRIG_SLOPE_POS</value>
+ </param>
+ <param>
+ <key>tr_level</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>tr_delay</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>tr_chan</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>tr_tag</key>
+ <value>""</value>
+ </param>
+ <param>
+ <key>label1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width1</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color1</key>
+ <value>"blue"</value>
+ </param>
+ <param>
+ <key>style1</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker1</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha1</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color2</key>
+ <value>"red"</value>
+ </param>
+ <param>
+ <key>style2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker2</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha2</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width3</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color3</key>
+ <value>"green"</value>
+ </param>
+ <param>
+ <key>style3</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker3</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha3</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width4</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color4</key>
+ <value>"black"</value>
+ </param>
+ <param>
+ <key>style4</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker4</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha4</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width5</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color5</key>
+ <value>"cyan"</value>
+ </param>
+ <param>
+ <key>style5</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker5</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha5</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width6</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color6</key>
+ <value>"magenta"</value>
+ </param>
+ <param>
+ <key>style6</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker6</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha6</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width7</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color7</key>
+ <value>"yellow"</value>
+ </param>
+ <param>
+ <key>style7</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker7</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha7</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label8</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width8</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color8</key>
+ <value>"dark red"</value>
+ </param>
+ <param>
+ <key>style8</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker8</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha8</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label9</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width9</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color9</key>
+ <value>"dark green"</value>
+ </param>
+ <param>
+ <key>style9</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker9</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha9</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label10</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width10</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color10</key>
+ <value>"blue"</value>
+ </param>
+ <param>
+ <key>style10</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker10</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha10</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(899, 106)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
+ <param>
+ <key>id</key>
+ <value>qtgui_time_sink_x_1</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>name</key>
+ <value>QT GUI Plot</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>srate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>autoscale</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>ymin</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>ymax</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>nconnections</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>update_time</key>
+ <value>0.10</value>
+ </param>
+ <param>
+ <key>entags</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>tr_mode</key>
+ <value>qtgui.TRIG_MODE_FREE</value>
+ </param>
+ <param>
+ <key>tr_slope</key>
+ <value>qtgui.TRIG_SLOPE_POS</value>
+ </param>
+ <param>
+ <key>tr_level</key>
+ <value>0.0</value>
+ </param>
+ <param>
+ <key>tr_delay</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>tr_chan</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>tr_tag</key>
+ <value>""</value>
+ </param>
+ <param>
+ <key>label1</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width1</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color1</key>
+ <value>"blue"</value>
+ </param>
+ <param>
+ <key>style1</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker1</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha1</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label2</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color2</key>
+ <value>"red"</value>
+ </param>
+ <param>
+ <key>style2</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker2</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha2</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width3</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color3</key>
+ <value>"green"</value>
+ </param>
+ <param>
+ <key>style3</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker3</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha3</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width4</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color4</key>
+ <value>"black"</value>
+ </param>
+ <param>
+ <key>style4</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker4</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha4</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label5</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width5</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color5</key>
+ <value>"cyan"</value>
+ </param>
+ <param>
+ <key>style5</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker5</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha5</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label6</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width6</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color6</key>
+ <value>"magenta"</value>
+ </param>
+ <param>
+ <key>style6</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker6</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha6</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label7</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width7</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color7</key>
+ <value>"yellow"</value>
+ </param>
+ <param>
+ <key>style7</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker7</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha7</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label8</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width8</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color8</key>
+ <value>"dark red"</value>
+ </param>
+ <param>
+ <key>style8</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker8</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha8</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label9</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width9</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color9</key>
+ <value>"dark green"</value>
+ </param>
+ <param>
+ <key>style9</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker9</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha9</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>label10</key>
+ <value></value>
+ </param>
+ <param>
+ <key>width10</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>color10</key>
+ <value>"blue"</value>
+ </param>
+ <param>
+ <key>style10</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>marker10</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>alpha10</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(904, 233)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_multiply_matrix_xx</key>
+ <param>
+ <key>id</key>
+ <value>blocks_multiply_matrix_xx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>A</key>
+ <value>((1, 0), (0, 1))</value>
+ </param>
+ <param>
+ <key>tag_propagation_policy</key>
+ <value>999</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(499, 172)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_stream_to_tagged_stream</key>
+ <param>
+ <key>id</key>
+ <value>blocks_stream_to_tagged_stream_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>packet_len</key>
+ <value>100</value>
+ </param>
+ <param>
+ <key>len_tag_key</key>
+ <value>"packet_len"</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(160, 286)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_message_strobe</key>
+ <param>
+ <key>id</key>
+ <value>blocks_message_strobe_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>msg</key>
+ <value>pmt.to_pmt(new_A)</value>
+ </param>
+ <param>
+ <key>period</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>minoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>maxoutbuf</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(204, 376)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_chooser</key>
+ <param>
+ <key>id</key>
+ <value>new_A</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Mode</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>raw</value>
+ </param>
+ <param>
+ <key>num_opts</key>
+ <value>3</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>((1, 0), (0, 1))</value>
+ </param>
+ <param>
+ <key>options</key>
+ <value>[0, 1, 2]</value>
+ </param>
+ <param>
+ <key>labels</key>
+ <value>[]</value>
+ </param>
+ <param>
+ <key>option0</key>
+ <value>((1, 0), (0, 1))</value>
+ </param>
+ <param>
+ <key>label0</key>
+ <value>Default</value>
+ </param>
+ <param>
+ <key>option1</key>
+ <value>((0, 1), (1, 0))</value>
+ </param>
+ <param>
+ <key>label1</key>
+ <value>Flip</value>
+ </param>
+ <param>
+ <key>option2</key>
+ <value>((.5, .5), (.5, .5))</value>
+ </param>
+ <param>
+ <key>label2</key>
+ <value>Mix</value>
+ </param>
+ <param>
+ <key>option3</key>
+ <value>3</value>
+ </param>
+ <param>
+ <key>label3</key>
+ <value></value>
+ </param>
+ <param>
+ <key>option4</key>
+ <value>4</value>
+ </param>
+ <param>
+ <key>label4</key>
+ <value></value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>combo_box</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.QVBoxLayout</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(277, 0)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>blocks_null_source_0</source_block_id>
+ <sink_block_id>blocks_stream_to_tagged_stream_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>analog_sig_source_x_0</source_block_id>
+ <sink_block_id>blocks_multiply_matrix_xx_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_stream_to_tagged_stream_0</source_block_id>
+ <sink_block_id>blocks_multiply_matrix_xx_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>1</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_multiply_matrix_xx_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_multiply_matrix_xx_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_1</sink_block_id>
+ <source_key>1</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>blocks_message_strobe_0</source_block_id>
+ <sink_block_id>blocks_multiply_matrix_xx_0</sink_block_id>
+ <source_key>strobe</source_key>
+ <sink_key>set_A</sink_key>
+ </connection>
+</flow_graph>
diff --git a/gr-blocks/grc/blocks_block_tree.xml
b/gr-blocks/grc/blocks_block_tree.xml
index 7001d90..b8221d7 100644
--- a/gr-blocks/grc/blocks_block_tree.xml
+++ b/gr-blocks/grc/blocks_block_tree.xml
@@ -94,6 +94,7 @@
<block>blocks_multiply_xx</block>
<block>blocks_multiply_const_vxx</block>
<block>blocks_multiply_conjugate_cc</block>
+ <block>blocks_multiply_matrix_xx</block>
<block>blocks_sub_xx</block>
<block>blocks_conjugate_cc</block>
<block>blocks_integrate_xx</block>
diff --git a/gr-blocks/grc/blocks_multiply_matrix_xx.xml
b/gr-blocks/grc/blocks_multiply_matrix_xx.xml
new file mode 100644
index 0000000..b0ba41d
--- /dev/null
+++ b/gr-blocks/grc/blocks_multiply_matrix_xx.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<block>
+ <name>Multiply by Matrix</name>
+ <key>blocks_multiply_matrix_xx</key>
+ <import>from gnuradio import blocks</import>
+ <make>blocks.multiply_matrix_$(type.fcn)($A, $tag_propagation_policy)</make>
+ <callback>set_A($A)</callback>
+ <param>
+ <name>IO Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>fcn:ff</opt>
+ </option>
+ </param>
+ <param>
+ <name>Matrix A</name>
+ <key>A</key>
+ <value>((1, 0), (0, 1))</value>
+ <type>raw</type>
+ </param>
+ <param>
+ <name>TPP</name>
+ <key>tag_propagation_policy</key>
+ <type>enum</type>
+ <option>
+ <name>All to All</name>
+ <key>gr.TPP_ALL_TO_ALL</key>
+ </option>
+ <option>
+ <name>One to One</name>
+ <key>gr.TPP_ONE_TO_ONE</key>
+ </option>
+ <option>
+ <name>No Propagation</name>
+ <key>gr.TPP_DONT</key>
+ </option>
+ <option>
+ <name>Matrix-Defined</name>
+ <key>999</key>
+ </option>
+ </param>
+ <check>len($A) > 0</check>
+ <check>len(${A}[0]) > 0</check>
+ <check>$tag_propagation_policy != gr.TPP_ONE_TO_ONE or (len($A) ==
len(${A}[0]))</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <nports>len(${A}[0])</nports>
+ </sink>
+ <sink>
+ <name>set_A</name>
+ <type>message</type>
+ <optional>1</optional>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <nports>len($A)</nports>
+ </source>
+</block>
diff --git a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt
b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt
index fa3c354..c0e20ae 100644
--- a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt
+++ b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt
@@ -219,7 +219,7 @@ install(FILES
vector_to_streams.h
wavfile_sink.h
wavfile_source.h
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks
+ multiply_matrix_ff.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks
COMPONENT "blocks_devel"
)
diff --git a/gr-blocks/include/gnuradio/blocks/multiply_matrix_ff.h
b/gr-blocks/include/gnuradio/blocks/multiply_matrix_ff.h
new file mode 100644
index 0000000..90bb688
--- /dev/null
+++ b/gr-blocks/include/gnuradio/blocks/multiply_matrix_ff.h
@@ -0,0 +1,92 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_BLOCKS_MULTIPLY_MATRIX_FF_H
+#define INCLUDED_BLOCKS_MULTIPLY_MATRIX_FF_H
+
+#include <gnuradio/blocks/api.h>
+#include <gnuradio/sync_block.h>
+
+namespace gr {
+ namespace blocks {
+
+ /*!
+ * \brief Matrix multiplexer/multiplier: y(k) = A * x(k)
+ * \ingroup blocks
+ *
+ * This block is similar to gr::blocks::multiply_const_ff, the difference
+ * being it can handle several inputs and outputs, and the input-to-output
+ * relation can be described by the following mathematical equation:
+ * \[
+ * y(k) = A x(k) \, , \, y \in \mathbb{R}^N, x \in \mathbb{R}^M, A \in
\mathbb{R}^{N \times M}
+ * \]
+ * \$y(k)\$ and \$x(i)\$ are column-vectors describing the elements on the
input port
+ * at time step \$k\$ (this is a sync block with no memory).
+ *
+ * Examples for where to use this block include:
+ * - Switch matrices (i.e. switch which ports go where)
+ * - Simulation of static MIMO-Channels (in that case, \$A\$ is the
channel matrix)
+ *
+ * This block features a special tag propagation mode: When setting the
tag propagation policy
+ * to gr::blocks::multiply_matrix_ff::TPP_SELECT_BY_MATRIX, a tag is
propagated from input k
+ * to output l if \$(A)_{l,k} \neq 0\$.
+ *
+ * A message port (\p set_A) allows to set the matrix. *Note*: It is not
possible to change
+ * the dimension of the matrix after initialization, as this affects the
I/O signature!
+ */
+ class BLOCKS_API multiply_matrix_ff : virtual public gr::sync_block
+ {
+ public:
+ typedef boost::shared_ptr<multiply_matrix_ff> sptr;
+
+ /*!
+ * \param A The matrix
+ * \param tag_propagation_policy The tag propagation policy.
+ * Note this can be any
gr::block::tag_propagation_policy_t value, or TPP_SELECT_BY_MATRIX.
+ */
+ static sptr make(
+ std::vector<std::vector<float> > A,
+ gr::block::tag_propagation_policy_t
tag_propagation_policy=gr::block::TPP_ALL_TO_ALL
+ );
+
+ //! Returns the current matrix
+ virtual const std::vector<std::vector<float> >& get_A() const = 0;
+ //! Sets the matrix to a new value \p new_A. Returns true if the new
matrix was valid and could be changed.
+ virtual bool set_A(const std::vector<std::vector<float> > &new_A) = 0;
+
+ /*!
+ * \brief Set the policy by the scheduler to determine how tags are
moved downstream.
+ *
+ * This will also accept the value TPP_SELECT_BY_MATRIX.
+ */
+ virtual void
set_tag_propagation_policy(gr::block::tag_propagation_policy_t p) = 0;
+
+ static const int TPP_SELECT_BY_MATRIX = 999;
+ static const std::string MSG_PORT_NAME_SET_A;
+ };
+ const std::string multiply_matrix_ff::MSG_PORT_NAME_SET_A = "set_A";
+
+ } // namespace blocks
+} // namespace gr
+
+#endif /* INCLUDED_BLOCKS_MULTIPLY_MATRIX_FF_H */
+
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
index 7702e4b..fe8fa5f 100644
--- a/gr-blocks/lib/CMakeLists.txt
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -262,6 +262,7 @@ list(APPEND gr_blocks_sources
vector_to_streams_impl.cc
wavfile_sink_impl.cc
wavfile_source_impl.cc
+ multiply_matrix_ff_impl.cc
)
if(ENABLE_GR_CTRLPORT)
diff --git a/gr-blocks/lib/multiply_matrix_ff_impl.cc
b/gr-blocks/lib/multiply_matrix_ff_impl.cc
new file mode 100644
index 0000000..564e673
--- /dev/null
+++ b/gr-blocks/lib/multiply_matrix_ff_impl.cc
@@ -0,0 +1,192 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gnuradio/io_signature.h>
+#include <volk/volk.h>
+#include "multiply_matrix_ff_impl.h"
+
+namespace gr {
+ namespace blocks {
+
+ multiply_matrix_ff::sptr
+ multiply_matrix_ff::make(std::vector<std::vector<float> > A,
gr::block::tag_propagation_policy_t tag_propagation_policy)
+ {
+ if (A.empty() or A[0].size() == 0) {
+ throw std::invalid_argument("matrix A has invalid dimensions.");
+ }
+ return gnuradio::get_initial_sptr
+ (new multiply_matrix_ff_impl(A, tag_propagation_policy));
+ }
+
+
multiply_matrix_ff_impl::multiply_matrix_ff_impl(std::vector<std::vector<float>
> A, gr::block::tag_propagation_policy_t tag_propagation_policy)
+ : gr::sync_block("multiply_matrix_ff",
+ gr::io_signature::make(A[0].size(), A[0].size(), sizeof(float)),
+ gr::io_signature::make(A.size(), A.size(), sizeof(float))),
+ d_A(A)
+ {
+ this->set_tag_propagation_policy(tag_propagation_policy);
+ const int alignment_multiple = volk_get_alignment() / sizeof(float);
+ set_alignment(std::max(1, alignment_multiple));
+
+ pmt::pmt_t port_name = pmt::string_to_symbol("set_A");
+ message_port_register_in(port_name);
+ set_msg_handler(
+ port_name,
+ boost::bind(&multiply_matrix_ff_impl::msg_handler_A, this, _1)
+ );
+ }
+
+ multiply_matrix_ff_impl::~multiply_matrix_ff_impl()
+ {
+ }
+
+ int
+ multiply_matrix_ff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ for (size_t out_idx = 0; out_idx < output_items.size(); out_idx++) {
+ float *out = reinterpret_cast<float *>(output_items[out_idx]);
+ // Do input 0 first, this saves a memset
+ const float *in = reinterpret_cast<const float *>(input_items[0]);
+ volk_32f_s32f_multiply_32f(out, in, d_A[out_idx][0], noutput_items);
+ // Then do inputs 1 through N
+ for (size_t in_idx = 1; in_idx < input_items.size(); in_idx++) {
+ in = reinterpret_cast<const float *>(input_items[in_idx]);
+ // Yeah, this needs VOLK-ifying (TODO)
+ for (int i = 0; i < noutput_items; i++) {
+ out[i] += in[i] * d_A[out_idx][in_idx];
+ }
+ }
+ }
+ if (d_tag_prop_select) {
+ propagate_tags_by_A(noutput_items, input_items.size(),
output_items.size());
+ }
+ return noutput_items;
+ }
+
+
+ // Copy tags from input k to output l if A[l][k] is not zero
+ void
+ multiply_matrix_ff_impl::propagate_tags_by_A(int noutput_items, size_t
ninput_ports, size_t noutput_ports)
+ {
+ std::vector<gr::tag_t> tags;
+ for (size_t in_idx = 0; in_idx < ninput_ports; in_idx++) {
+ get_tags_in_window(
+ tags,
+ in_idx,
+ 0,
+ noutput_items
+ );
+
+ for (size_t out_idx = 0; out_idx < noutput_ports; out_idx++) {
+ if (d_A[out_idx][in_idx] == 0) {
+ continue;
+ }
+ for (size_t i = 0; i < tags.size(); i++) {
+ add_item_tag(out_idx, tags[i]);
+ }
+ }
+ }
+ }
+
+ // Check dimensions before copying
+ bool
+ multiply_matrix_ff_impl::set_A(const std::vector<std::vector<float> >
&new_A)
+ {
+ if (d_A.size() != new_A.size()) {
+ GR_LOG_ALERT(d_logger, "Attempted to set matrix with invalid
dimensions.");
+ return false;
+ }
+ for (size_t i = 0; i < d_A.size(); i++) {
+ if (d_A[i].size() != new_A[i].size()) {
+ GR_LOG_ALERT(d_logger, "Attempted to set matrix with invalid
dimensions.");
+ return false;
+ }
+ }
+ d_A = new_A;
+ return true;
+ }
+
+ void
+ multiply_matrix_ff_impl::msg_handler_A(pmt::pmt_t A)
+ {
+ if (not pmt::is_vector(A) and not pmt::is_tuple(A)) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong type).");
+ return;
+ }
+ if (not pmt::length(A) == d_A.size()) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong size).");
+ return;
+ }
+
+ std::vector<std::vector<float> > new_A(d_A);
+ for (size_t i = 0; i < pmt::length(A); i++) {
+ pmt::pmt_t row;
+ if (pmt::is_vector(A)) {
+ row = pmt::vector_ref(A, i);
+ } else if (pmt::is_tuple(A)) {
+ row = pmt::tuple_ref(A, i);
+ }
+ if (pmt::is_vector(row) or pmt::is_tuple(row)) {
+ if (pmt::length(row) != d_A[0].size()) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of
columns).");
+ return;
+ }
+ for (size_t k = 0; k < pmt::length(row); k++) {
+ new_A[i][k] = pmt::to_double(pmt::is_vector(row) ?
pmt::vector_ref(row, k) : pmt::tuple_ref(row, k));
+ }
+ } else if (pmt::is_f32vector(row)) {
+ size_t row_len = 0;
+ const float *elements = pmt::f32vector_elements(row, row_len);
+ if (row_len != d_A[0].size()) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A (wrong number of
columns).");
+ return;
+ }
+ new_A[i].assign(elements, elements + row_len);
+ }
+ }
+
+ if (not set_A(new_A)) {
+ GR_LOG_ALERT(d_logger, "Invalid message to set A.");
+ }
+ }
+
+ void
+
multiply_matrix_ff_impl::set_tag_propagation_policy(gr::block::tag_propagation_policy_t
tpp)
+ {
+ if (tpp == TPP_SELECT_BY_MATRIX) {
+ set_tag_propagation_policy(TPP_DONT);
+ d_tag_prop_select = true;
+ } else {
+ gr::block::set_tag_propagation_policy(tpp);
+ d_tag_prop_select = false;
+ }
+ }
+
+ } /* namespace blocks */
+} /* namespace gr */
+
diff --git a/gr-blocks/lib/multiply_matrix_ff_impl.h
b/gr-blocks/lib/multiply_matrix_ff_impl.h
new file mode 100644
index 0000000..c9476bc
--- /dev/null
+++ b/gr-blocks/lib/multiply_matrix_ff_impl.h
@@ -0,0 +1,59 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2014 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_BLOCKS_MULTIPLY_MATRIX_FF_IMPL_H
+#define INCLUDED_BLOCKS_MULTIPLY_MATRIX_FF_IMPL_H
+
+#include <gnuradio/blocks/multiply_matrix_ff.h>
+
+namespace gr {
+ namespace blocks {
+
+ class multiply_matrix_ff_impl : public multiply_matrix_ff
+ {
+ private:
+ std::vector<std::vector<float> > d_A;
+ bool d_tag_prop_select; //!< If true, handle the tag propagation
ourselves
+
+ void propagate_tags_by_A(int noutput_items, size_t ninput_ports, size_t
noutput_ports);
+
+ void msg_handler_A(pmt::pmt_t A);
+
+ public:
+ multiply_matrix_ff_impl(std::vector<std::vector<float> > A,
gr::block::tag_propagation_policy_t tag_propagation_policy);
+ ~multiply_matrix_ff_impl();
+
+ const std::vector<std::vector<float> >& get_A() const { return d_A; };
+ bool set_A(const std::vector<std::vector<float> > &new_A);
+
+ void set_tag_propagation_policy(gr::block::tag_propagation_policy_t p);
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } // namespace blocks
+} // namespace gr
+
+#endif /* INCLUDED_BLOCKS_MULTIPLY_MATRIX_FF_IMPL_H */
+
diff --git a/gr-blocks/python/blocks/qa_multiply_matrix_ff.py
b/gr-blocks/python/blocks/qa_multiply_matrix_ff.py
new file mode 100755
index 0000000..fdf0205
--- /dev/null
+++ b/gr-blocks/python/blocks/qa_multiply_matrix_ff.py
@@ -0,0 +1,172 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+import time
+import numpy
+import os
+import pmt
+from gnuradio import gr, gr_unittest
+from gnuradio import blocks
+
+class test_multiply_matrix_ff (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+ self.multiplier = None
+
+ def tearDown (self):
+ self.tb = None
+ self.multiplier = None
+
+ def run_once(self, X_in, A, tpp=gr.TPP_DONT, A2=None, tags=None,
msg_A=None):
+ """ Run the test for given input-, output- and matrix values.
+ Every row from X_in is considered an input signal on a port. """
+ X_in = numpy.matrix(X_in)
+ A_matrix = numpy.matrix(A)
+ (N, M) = A_matrix.shape
+ self.assertTrue(N == X_in.shape[0])
+ # Calc expected
+ Y_out_exp = numpy.matrix(numpy.zeros((M, X_in.shape[1])))
+ self.multiplier = blocks.multiply_matrix_ff(A, tpp)
+ if A2 is not None:
+ self.multiplier.set_A(A2)
+ A = A2
+ A_matrix = numpy.matrix(A)
+ for i in xrange(N):
+ if tags is None:
+ these_tags = ()
+ else:
+ these_tags = (tags[i],)
+ self.tb.connect(blocks.vector_source_f(X_in[i].tolist()[0],
tags=these_tags), (self.multiplier, i))
+ sinks = []
+ for i in xrange(M):
+ sinks.append(blocks.vector_sink_f())
+ self.tb.connect((self.multiplier, i), sinks[i])
+ # Run and check
+ self.tb.run()
+ for i in xrange(X_in.shape[1]):
+ Y_out_exp[:,i] = A_matrix * X_in[:,i]
+ Y_out = [list(x.data()) for x in sinks]
+ if tags is not None:
+ self.the_tags = []
+ for i in xrange(M):
+ self.the_tags.append(sinks[i].tags())
+ self.assertEqual(list(Y_out), Y_out_exp.tolist())
+
+
+ def test_001_t (self):
+ """ Simplest possible check: N==M, unit matrix """
+ X_in = (
+ (1, 2, 3, 4),
+ (5, 6, 7, 8),
+ )
+ A = (
+ (1, 0),
+ (0, 1),
+ )
+ self.run_once(X_in, A)
+
+ def test_002_t (self):
+ """ Switch check: N==M, flipped unit matrix """
+ X_in = (
+ (1, 2, 3, 4),
+ (5, 6, 7, 8),
+ )
+ A = (
+ (0, 1),
+ (1, 0),
+ )
+ self.run_once(X_in, A)
+
+ def test_003_t (self):
+ """ Average """
+ X_in = (
+ (1, 1, 1, 1),
+ (2, 2, 2, 2),
+ )
+ A = (
+ (0.5, 0.5),
+ (0.5, 0.5),
+ )
+ self.run_once(X_in, A)
+
+ def test_004_t (self):
+ """ Set """
+ X_in = (
+ (1, 2, 3, 4),
+ (5, 6, 7, 8),
+ )
+ A1 = (
+ (1, 0),
+ (0, 1),
+ )
+ A2 = (
+ (0, 1),
+ (1, 0),
+ )
+ self.run_once(X_in, A1, A2=A2)
+
+ def test_005_t (self):
+ """ Tags """
+ X_in = (
+ (1, 2, 3, 4),
+ (5, 6, 7, 8),
+ )
+ A = (
+ (0, 1), # Flip them round
+ (1, 0),
+ )
+ tag1 = gr.tag_t()
+ tag1.offset = 0
+ tag1.key = pmt.intern("in1")
+ tag1.value = pmt.PMT_T
+ tag2 = gr.tag_t()
+ tag2.offset = 0
+ tag2.key = pmt.intern("in2")
+ tag2.value = pmt.PMT_T
+ self.run_once(X_in, A, tpp=999, tags=(tag1, tag2))
+ self.assertTrue(pmt.equal(tag1.key, self.the_tags[1][0].key))
+ self.assertTrue(pmt.equal(tag2.key, self.the_tags[0][0].key))
+
+ #def test_006_t (self):
+ #""" Message passing """
+ #X_in = (
+ #(1, 2, 3, 4),
+ #(5, 6, 7, 8),
+ #)
+ #A1 = (
+ #(1, 0),
+ #(0, 1),
+ #)
+ #msg_A = (
+ #(0, 1),
+ #(1, 0),
+ #)
+ #self.run_once(X_in, A1, msg_A=msg_A)
+
+
+
+if __name__ == '__main__':
+ #gr_unittest.run(test_multiply_matrix_ff, "test_multiply_matrix_ff.xml")
+ gr_unittest.run(test_multiply_matrix_ff)
+
diff --git a/gr-blocks/swig/blocks_swig3.i b/gr-blocks/swig/blocks_swig3.i
index ab921a5..43cc78a 100644
--- a/gr-blocks/swig/blocks_swig3.i
+++ b/gr-blocks/swig/blocks_swig3.i
@@ -64,6 +64,7 @@
#include "gnuradio/blocks/multiply_const_vii.h"
#include "gnuradio/blocks/multiply_const_vff.h"
#include "gnuradio/blocks/multiply_const_vcc.h"
+#include "gnuradio/blocks/multiply_matrix_ff.h"
#include "gnuradio/blocks/mute_ss.h"
#include "gnuradio/blocks/mute_ii.h"
#include "gnuradio/blocks/mute_ff.h"
@@ -106,6 +107,7 @@
%include "gnuradio/blocks/multiply_const_vii.h"
%include "gnuradio/blocks/multiply_const_vff.h"
%include "gnuradio/blocks/multiply_const_vcc.h"
+%include "gnuradio/blocks/multiply_matrix_ff.h"
%include "gnuradio/blocks/mute_ss.h"
%include "gnuradio/blocks/mute_ii.h"
%include "gnuradio/blocks/mute_ff.h"
@@ -147,6 +149,7 @@ GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vss);
GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vii);
GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vff);
GR_SWIG_BLOCK_MAGIC2(blocks, multiply_const_vcc);
+GR_SWIG_BLOCK_MAGIC2(blocks, multiply_matrix_ff);
GR_SWIG_BLOCK_MAGIC2(blocks, mute_ss);
GR_SWIG_BLOCK_MAGIC2(blocks, mute_ii);
GR_SWIG_BLOCK_MAGIC2(blocks, mute_ff);