The programs in the file neurals.zip are
NEURAL48, a program directory for HP48, 
NEURAL49, a program directory for HP49 and
neurals.txt, this file.

Program listings and information on their use are given below. Listings are for both HP48 and HP49 except that TRAN is a HP49 command and the HP48 equivalent is TRN. (TRN seems to work for both machines). Further information on the use of the programs may be found in my article "Neural Networks Part I" in HPCC Datafile V21N1.

Program PREP prepares the units for any 3-layer feedforward hardlimited network.
The function of each variable is shown by its INPUT string. Inputs and weighting values are stored as arrays. Weighted sums are computed by matrix multiplication. A carriage return is needed in one of the INPUT strings. Approx mode must be checked. In use, multiple input values at the prompts are separated by spaces.

 "PREP" DROP
"Enter no. inputs" "" INPUT OBJ-> 'Ino' STO
"Enter no. hidden units" "" INPUT OBJ-> 'Hno' STO 1 Hno
     FOR j "Enter weights 0 to " Ino +
     " for hidden unit " + j + "" INPUT OBJ->
     NEXT
Hno 'Ino+1' 2 ->LIST ->ARRY TRAN 'Hwts' STO
"Enter no. outputs" "" INPUT OBJ-> 'Ono' STO 1 Ono
     FOR j "Enter weights 0 to " Hno +
     " for output unit " + j + "" INPUT OBJ->
     NEXT
Ono 'Hno+1' 2 ->LIST ->ARRY TRAN 'Owts' STO 

Program RUNIT gets and processes input using units set up by PREP, or otherwise. User INPUTs the networks input signal at the prompt. Output is displayed as a list with the output of the first output unit at the head.

 "RUNIT" DROP
1 "Enter inputs 1 to " Ino + "" INPUT
OBJ-> 1 'Ino + 1' 2 ->LIST ->ARRY Hwts * hardlimit
[ 1 ] 1 COL+ Owts * hardlimit
OBJ-> OBJ-> DROP SWAP DROP ->LIST 

Program hardlimit is called by RUNIT to evaluate the binary output for a weighted sum using the hardlimiting function. As printed here it delivers 1 for a zero weighted sum.

 "hardlimit" DROP
OBJ-> OBJ-> DROP SWAP DROP -> c
     1 c
        START 0 >= c ROLLD   @ alter the test if desired
        NEXT
    1 c 2 ->LIST ->ARRY  

Programs composed and this file written by
Peter Gatenby  pvg@freenet.co.uk
who would be delighted to hear from anyone who uses the programs.