⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 axon.h

📁 amygdata的神经网络算法源代码
💻 H
字号:
/***************************************************************************                          axon.h  -  description                             -------------------    begin                : Thu Sep 19 2002    copyright            : (C) 2002 by Matt Grover    email                : mgrover@amygdala.org ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#ifndef AXON_H#define AXON_H#include <vector>#include <string>#include <map>#include <iostream>#include <amygdala/amygdalaclass.h>namespace Amygdala {class Synapse;class AxonNode;struct AxonNodeKey {    std::string className;  // synapse class name    AmTimeInt delay;    unsigned int size;    bool operator<(const AxonNodeKey& rhs) const {        if (delay<rhs.delay) {            return true;        }        else if (delay>rhs.delay) {            return false;        }        else {            return className<rhs.className;        }    }};class Axon: public AmygdalaClass {public:    Axon();    ~Axon();    /** Add a synapse to the axon. BuildNodes() or RebuildNodes() must be     *  called to move the synapse from temporary storage to an AxonNode. */    void AddSynapse(Synapse* syn, unsigned int synSize, AmTimeInt delay);    /** @returns AxonNode* An indexed AxonNode. */    //AxonNode* GetNode(unsigned int idx) const { return nodes[idx]; }    /** @returns unsigned int The number of AxonNodes contained by     *  the Axon. */    unsigned int NodeCount() const { return nodes.size(); }    /** @return Number of output synapses contained in all AxonNodes. */    unsigned int SynapseCount() const;    /** Move Synapses from temporary storage to AxonNodes.     *  This must be called before any AxonNodes have been     *  created.  Call RebuildNodes if nodes already exist. */    void BuildNodes();    typedef std::vector<AxonNode*>::iterator iterator;    iterator begin() { return nodes.begin(); }    iterator end() { return nodes.end(); }    unsigned int size() { return nodes.size(); }protected:    std::vector<AxonNode*> nodes;        // NOTE:    // store the synapse ptrs in tempSynStore while the network    // is being built.  When BuildNodes() is called, AxonNodes w/    // the appropriate size and delay values will be constructed    // and the synapses will be copied into permanent stores    // in the AxonNodes (via synapse copy constructors). The     // temporary synapses stored here can be destroyed after the    // copies are made.    std::map<AxonNodeKey, std::vector<Synapse*> > tempSynStore;};} // namespace Amygdala#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -