Main Page   Data Structures   File List   Data Fields   Globals  

nnutil.c File Reference

Utility functions. More...

#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "nn.h"

Functions

double nnGetLayerError (nnLayer *layer)
 Calculate error of nodes in a layer.

double nnGetLayerRMSError (nnLayer *layer)
 Calculate RMS error of nodes in a layer.

void nnIterateNetworkNodes (nnNet *net, void(*f)(nnLayer *layer, nnNode *node, void *data), void *data)
 Call a function for each node in a network.

void nnIterateNetworkLinks (nnNet *net, void(*f)(nnNode *dest, nnLink *link, void *data), void *data)
 Call a function for each link in a network.

void nnDestroyNetwork (nnNet *net)
 free() a network and all associated structures.

nnNetnnCreateFullyConnectedNetwork (int nlayers, const int nnodes[])
 Create a fully-connected network.

nnNetnnCopyNetwork (nnNet *net)
 Make a deep-copy of a network.


Detailed Description

Utility functions.


Function Documentation

nnNet* nnCopyNetwork nnNet   net
 

Make a deep-copy of a network.

Performs a deep-copy of a network. The new network will be an exact copy of source, having the same topology, weights, etc.

Parameters:
net  The network to copy.
Returns:
The new network or NULL on failure.

nnNet* nnCreateFullyConnectedNetwork int    nlayers,
const int    nnodes[]
 

Create a fully-connected network.

Creates a fully-connected neural network with nlayers layers. The first layer will have nnodes[0] nodes in it, the second layer will have nnodes[1] nodes in it, etc. The network will have a bias node.

Parameters:
nlayers  The number of layers in the network.
nnodes  An array of nlayers ints that specifies how many nodes to have in each layer.
Returns:
The network or NULL if the network couldn't be created.

void nnDestroyNetwork nnNet   net
 

free() a network and all associated structures.

Frees a network and all associated structures (layers, nodes, links). Any non-NULL structure pointers are recursively freed.

Parameters:
net  The network to free. May be NULL.

double nnGetLayerError nnLayer   layer
 

Calculate error of nodes in a layer.

Parameters:
layer  Layer to calculate error for.
Returns:
Error.

double nnGetLayerRMSError nnLayer   layer
 

Calculate RMS error of nodes in a layer.

Parameters:
layer  Layer to calculate error for.
Returns:
RMS error.

void nnIterateNetworkLinks nnNet   net,
void(*    f)(nnNode *dest, nnLink *link, void *data),
void *    data
 

Call a function for each link in a network.

Parameters:
net  The network to iterate over
f  Pointer to the function to call
data  Passed verbatim to the function

void nnIterateNetworkNodes nnNet   net,
void(*    f)(nnLayer *layer, nnNode *node, void *data),
void *    data
 

Call a function for each node in a network.

Calls func for each node in a network, including the bias node, if any. args is passed to func as the argument data. func's layer argument will be NULL for the bias node.

Parameters:
net  The network to iterate over
f  Pointer to the function to call
data  Passed verbatim to the function


Variable Documentation

const char rcsid[] [static]
 

Initial value:

        "$Id: nnutil.c 319 2003-02-22 08:57:23Z asaddi $"


Generated on Sat Feb 22 03:39:25 2003 for nn by doxygen1.2.18