Main Content

dotprod

Dot product weight function

Syntax

Z = dotprod(W,P,FP)
dim = dotprod('size',S,R,FP)
dw = dotprod('dw',W,P,Z,FP)
info = dotprod('code')

Description

Weight functions apply weights to an input to get weighted inputs.

Z = dotprod(W,P,FP) takes these inputs,

W

S-by-R weight matrix

P

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

FP

Struct of function parameters (optional, ignored)

and returns the S-by-Q dot product of W and P.

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

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

info = dotprod('code') returns information about this function. The following codes are defined:

'deriv'

Name of derivative function

'pfullderiv'

Input: reduced derivative = 2, full derivative = 1, linear derivative = 0

'wfullderiv'

Weight: reduced derivative = 2, full derivative = 1, linear derivative = 0

'name'

Full name

'fpnames'

Returns names of function parameters

'fpdefaults'

Returns default function parameters

Examples

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

W = rand(4,3);
P = rand(3,1);
Z = dotprod(W,P)

Network Use

You can create a standard network that uses dotprod by calling feedforwardnet.

To change a network so an input weight uses dotprod, set net.inputWeights{i,j}.weightFcn to 'dotprod'. For a layer weight, set net.layerWeights{i,j}.weightFcn to 'dotprod'.

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

Version History

Introduced before R2006a