Purpose
To compute the Jacobian of the error function for a neural network of the structure - tanh(w1*z+b1) - / : \ z --- : --- sum(ws(i)*...)+ b(n+1) --- y, \ : / - tanh(wn*z+bn) - for the single-output case. The Jacobian has the form d e(1) / d WB(1) ... d e(1) / d WB(NWB) J = : : , d e(NSMP) / d WB(1) ... d e(NSMP) / d WB(NWB) where e(z) is the error function, WB is the set of weights and biases of the network (for the considered output), and NWB is the number of elements of this set, NWB = IPAR(1)*(NZ+2)+1 (see below). In the multi-output case, this routine should be called for each output. NOTE: this routine must have the same arguments as SLICOT Library routine NF01BD.Specification
SUBROUTINE NF01BY( CJTE, NSMP, NZ, L, IPAR, LIPAR, WB, LWB, Z, $ LDZ, E, J, LDJ, JTE, DWORK, LDWORK, INFO ) C .. Scalar Arguments .. CHARACTER CJTE INTEGER INFO, L, LDJ, LDWORK, LDZ, LIPAR, LWB, NSMP, NZ C .. Array Arguments .. DOUBLE PRECISION DWORK(*), E(*), J(LDJ,*), JTE(*), WB(*), $ Z(LDZ,*) INTEGER IPAR(*)Arguments
Mode Parameters
CJTE CHARACTER*1 Specifies whether the matrix-vector product J'*e should be computed or not, as follows: = 'C' : compute J'*e; = 'N' : do not compute J'*e.Input/Output Parameters
NSMP (input) INTEGER The number of training samples. NSMP >= 0. NZ (input) INTEGER The length of each input sample. NZ >= 0. L (input) INTEGER The length of each output sample. Currently, L must be 1. IPAR (input/output) INTEGER array, dimension (LIPAR) The integer parameters needed. On entry, the first element of this array must contain a value related to the number of neurons, n; specifically, n = abs(IPAR(1)), since setting IPAR(1) < 0 has a special meaning (see below). On exit, if IPAR(1) < 0 on entry, then no computations are performed, except the needed tests on input parameters, but the following values are returned: IPAR(1) contains the length of the array J, LJ; LDJ contains the leading dimension of array J. Otherwise, IPAR(1) and LDJ are unchanged on exit. LIPAR (input) INTEGER The length of the vector IPAR. LIPAR >= 1. WB (input) DOUBLE PRECISION array, dimension (LWB) The leading NWB = IPAR(1)*(NZ+2)+1 part of this array must contain the weights and biases of the network, WB = ( w(1,1), ..., w(1,NZ), ..., w(n,1), ..., w(n,NZ), ws(1), ..., ws(n), b(1), ..., b(n+1) ), where w(i,j) are the weights of the hidden layer, ws(i) are the weights of the linear output layer and b(i) are the biases. LWB (input) INTEGER The length of array WB. LWB >= NWB. Z (input) DOUBLE PRECISION array, dimension (LDZ, NZ) The leading NSMP-by-NZ part of this array must contain the set of input samples, Z = ( Z(1,1),...,Z(1,NZ); ...; Z(NSMP,1),...,Z(NSMP,NZ) ). LDZ INTEGER The leading dimension of array Z. LDZ >= MAX(1,NSMP). E (input) DOUBLE PRECISION array, dimension (NSMP) If CJTE = 'C', this array must contain the error vector e. If CJTE = 'N', this array is not referenced. J (output) DOUBLE PRECISION array, dimension (LDJ, NWB) The leading NSMP-by-NWB part of this array contains the Jacobian of the error function. LDJ INTEGER The leading dimension of array J. LDJ >= MAX(1,NSMP). Note that LDJ is an input parameter, except for IPAR(1) < 0 on entry, when it is an output parameter. JTE (output) DOUBLE PRECISION array, dimension (NWB) If CJTE = 'C', this array contains the matrix-vector product J'*e. If CJTE = 'N', this array is not referenced.Workspace
DWORK DOUBLE PRECISION array, dimension (LDWORK) This argument is included for combatibility with SLICOT Library routine NF01BD. LDWORK INTEGER Normally, the length of the array DWORK. LDWORK >= 0.Error Indicator
INFO INTEGER = 0: successful exit; < 0: if INFO = -i, the i-th argument had an illegal value.Method
The Jacobian is computed analytically.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None