next up previous contents index
Next: Special Network Architectures Up: Including the Compiled Previous: Interfaces:

Example:

If a trained network, was saved as ``myNetwork.net'' and compiled with snns2c myNetwork.net

then the generated Network can be compiled with gcc -c myNetwork.c

To include the network in your own application the header file must be included. There should also two arrays being provided, one for the input and one for the output of the network. The number of inputs and outputs can be derived from a record in the header file. This struct is named like the function which contains the compiled network and has the suffix REC to mark the record. So the number of input units is determined with myNetworkREC.NoOfInput and the number of outputs with myNetworkREC.NoOfOutput in this example. Hence, your own application should contain:

#include "myNetwork.h"
float *netInput, *netOutput; /* Input and Output arrays of the Network */
netInput  = malloc(myNetworkREC.NoOfInput  * sizeof(float));
netOutput = malloc(myNetworkREC.NoOfOutput * sizeof(float));
myNetwork(netInput, netOutput, 0)

Don't forget to link the object code of the network to your application



Niels Mache
Wed May 17 11:23:58 MET DST 1995