CLASS:: Dneuromodule
SUMMARY:: discrete time neurodynamics
CATEGORIES:: UGens>Demand

DESCRIPTION::
The discrete time dynamics of a neural network can be described by initial state, bias, and the weights of the influence between the nodes. This demand rate ugen simulates the bahavior for any number of nodes.

The implementation follows the paper: Frank Pasemann, Complex dynamics and the structure of small neural networks, Network: Comput. Neural Syst. 13 (2002) p. 195–216.

In the core, Dneuromodule implements the following formula:

image::neuromodule.png::

As transfer function (sigma) code::tanh:: is used.

CLASSMETHODS::

METHOD::new

ARGUMENT::numChannels
Number of nodes that represent cells, which is also the number of output channels of the UGen.

ARGUMENT::theta
Bias for each node. Should be an array on code::numChannels:: size. This argument is also the usual way to define an input into the node. It can contain demand rate ugens or any other ugens or numbers.

ARGUMENT::x
Initial value of each node. Should be an array on code::numChannels:: size.

ARGUMENT::weights
An code::n x n:: matrix of inter-node connections that represent synapses. Should be an array of code::numChannels * numChannels:: size. It can contain demand rate ugens or any other ugens or numbers.


EXAMPLES::

CODE::
(
{
	var dt, module, m;
	dt = 0.001;
	module = DNeuromodule(2,
			theta: [MouseX.kr(-2, 2), MouseY.kr(-2, 2)],
			x: [0.1, 0.3],
			weights: [-3, 2, -2, 0]
	);
	m = Duty.ar(dt, 0, module).lag3(dt);
	SinOsc.ar(m * 400 + 600) * 0.1
}.play
)
::
