home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-03-25 | 1.5 KB | 53 lines | [TEXT/CWIE] |
- // ===========================================================================
- // CStdNeuralNet.cp ©1996 Timo Eloranta
- // ===========================================================================
- // A concrete neural net class derived from the abstract CNeuralNet class
-
- #include "CStdNeuralNet.h"
- #include "CStdNeuron.h"
-
- // ---------------------------------------------------------------------------
- // • CStdNeuralNet
- //
- // Called by: CNeuroSimApp::InitNewNet
- // ---------------------------------------------------------------------------
- // Constructor. Note that the constructor of the abstract base class
- // (CNeuralNet) must be called before creating and initializing the matrix.
-
- CStdNeuralNet::CStdNeuralNet(
- const SGenParams &inParams )
- : CNeuralNet( inParams.size )
- {
- CreateMatrix();
- InitMatrix( inParams );
- }
-
- // ---------------------------------------------------------------------------
- // • ~CStdNeuralNet
- // ---------------------------------------------------------------------------
- // Destructor. Junk the matrix if it exists.
-
- CStdNeuralNet::~CStdNeuralNet()
- {
- if ( mMatrix ) {
- delete [] mMatrix;
- mMatrix = NULL;
- }
- }
-
- // ---------------------------------------------------------------------------
- // • CreateMatrix
- //
- // Called by: CStdNeuralNet::CStdNeuralNet
- // ---------------------------------------------------------------------------
- // Create the matrix as an array of neurons (of type CStdNeuron).
-
- void
- CStdNeuralNet::CreateMatrix()
- {
- if ( mMatrix )
- delete [] mMatrix;
-
- mMatrix = new CStdNeuron[ mSize * mSize ];
- }
-