Closed NumHack closed 4 years ago
Gain is a static system whose input-output relation (i.e. the readout function) is of the form
y = K u
where K
is the gain, u
is the input and y
is the output. The relation here is a general matrix-vector product. u
may be an m
-dimensional vector and y
may be a n
-dimensional vector, which implies K
is mxn
-dimensional matrix. In the code line length(gain * zeros(length(input)))
, the length m
of y
is inferred from the sizes of K
and u
.
Here, the general case is assumed where m
is not equal to n
. If the specific case where m
is equal to n
, then the code you suggest length(zeros(length(input)))
becomes true.
Thank you for your very clear answer. Another powerful Julia trick learned :+1:
I closed the Pull Request and this issue.
I was trying to understand this piece of Causal.jl code that defines the "Gain" static system : https://github.com/zekeriyasari/Causal.jl/blob/master/src/components/systems/staticsystems/staticsystems.jl :
Shouldn't the 'output' line be (remove 'gain *'):
Probably a typo since 'gain *' is also present on next line.
Created Pull Request https://github.com/NumHack/Causal.jl/pull/1