Contents

scalprod

Scalar product weight function

Syntax

Z = scalprod(W,P)
dim = scalprod('size',S,R,FP)
dw = scalprod('dw',W,P,Z,FP)

Description

scalprod is the scalar product weight function. Weight functions apply weights to an input to get weighted inputs.

Z = scalprod(W,P) takes these inputs,

W

1-by-1 weight matrix

P

R-by-Q matrix of Q input (column) vectors

and returns the R-by-Q scalar product of W and P defined by Z = w*P.

dim = scalprod('size',S,R,FP) takes the layer dimension S, input dimension R, and function parameters, and returns the weight size [1-by-1].

dw = scalprod('dw',W,P,Z,FP) returns the derivative of Z with respect to W.

Examples

Here you define a random weight matrix W and input vector P and calculate the corresponding weighted input Z.

W = rand(1,1);
P = rand(3,1);
Z = scalprod(W,P)

Network Use

To change a network so an input weight uses scalprod, set net.inputWeight{i,j}.weightFcn to 'scalprod'.

For a layer weight, set net.layerWeight{i,j}.weightFcn to 'scalprod'.

In either case, call sim to simulate the network with scalprod.

See help newp and help newlin for simulation examples.

See Also

| | | |

Was this topic helpful?