Multiply Const: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
No edit summary
No edit summary
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Block Docs]]
[[Category:Block Docs]]
[[Category:Stub Docs]]
Multiplies the input stream by a scalar or vector constant (element-wise if vector).
output = input * constant scalar/vector (element-wise if vector)


See [[Fast Multiply Const]] for a more performant version of this block.
output = input * constant


As this is a basic template, it's also in the [[:Category:Stub_Docs|"Stub Docs category"]]. Please improve it.
See [[Fast_Multiply_Const]] for a more performant version of this block for '''scalar''' values only.
 
<code>Added in 3.8</code> If the input is a '''not''' a vector, the "Fast" version is automatically invoked (done behind the scenes).


== Parameters ==
== Parameters ==
(''R''): <span class="plainlinks">[https://wiki.gnuradio.org/index.php/GNURadioCompanion#Variable_Controls ''Run-time adjustable'']</span>
(''R''): <span class="plainlinks">[https://wiki.gnuradio.org/index.php/GNURadioCompanion#Variable_Controls ''Run-time adjustable'']</span>


; Param 1 (''R'')
; Constant (''R'')
: Description of parameter, provide any tips or recommended values. Note that the name of the parameter above should match the param's label that shows up in grc (e.g. Sample Rate).
: Scalar or vector constant. If the input is a vector, this parameter must be a vector of the same size. To multiply all the input items by the same value, use [[Fast_Multiply_Const]].
 
== Example Flowgraph ==


; Param 2
This flowgraph uses three Multiply type blocks. The top Multiply Const Block and middle Multiply Block are driven by the GUI Chooser to act as a Transmit / Receive switch. The bottom Multiply Const Block is a Volume control, the 'constant' being the 'volume' parameter from the QT GUI Range block.
: blah blah blah


== Example Flowgraph ==
Note: The lower section is a working 2 meter NBFM receiver.


Insert description of flowgraph here, then show a screenshot of the flowgraph and the output if there is an interesting GUI.  Currently we have no standard method of uploading the actual flowgraph to the wiki or git repo, unfortunately.  The plan is to have an example flowgraph showing how the block might be used, for every block, and the flowgraphs will live in the git repo.
[[File:Selector_demo.png|800px]]


== Source Files ==
== Source Files ==


; C++ files
; C++ files
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/lib/multiply_const_impl.cc If single sample input]
: [https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/lib/multiply_const_v_impl.cc If vector input]


; Header files
; Header files
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/lib/multiply_const_impl.h If single sample input]
: [https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/lib/multiply_const_v_impl.h If vector input]


; Public header files
; Public header files
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/include/gnuradio/blocks/multiply_const.h If single sample input]
: [https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/include/gnuradio/blocks/multiply_const_v.h If vector input]


; Block definition
; Block definition
: [https://github.com/gnuradio/gnuradio TODO]
: [https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/grc/blocks_multiply_const_vxx.block.yml]

Revision as of 11:10, 31 October 2019

Multiplies the input stream by a scalar or vector constant (element-wise if vector).

output = input * constant

See Fast_Multiply_Const for a more performant version of this block for scalar values only.

Added in 3.8 If the input is a not a vector, the "Fast" version is automatically invoked (done behind the scenes).

Parameters

(R): Run-time adjustable

Constant (R)
Scalar or vector constant. If the input is a vector, this parameter must be a vector of the same size. To multiply all the input items by the same value, use Fast_Multiply_Const.

Example Flowgraph

This flowgraph uses three Multiply type blocks. The top Multiply Const Block and middle Multiply Block are driven by the GUI Chooser to act as a Transmit / Receive switch. The bottom Multiply Const Block is a Volume control, the 'constant' being the 'volume' parameter from the QT GUI Range block.

Note: The lower section is a working 2 meter NBFM receiver.

Selector demo.png

Source Files

C++ files
If single sample input
If vector input
Header files
If single sample input
If vector input
Public header files
If single sample input
If vector input
Block definition
[1]