mirror of
https://github.com/BlackLight/neuralpp.git
synced 2024-12-28 04:05:12 +01:00
Fixed a lot of stuff, Makefile fixed, but it's not over yet
This commit is contained in:
parent
80f9c4f5e6
commit
1f65c8a26b
15 changed files with 100 additions and 32 deletions
36
Makefile
Normal file
36
Makefile
Normal file
|
@ -0,0 +1,36 @@
|
|||
SRCDIR=src
|
||||
INCLUDEDIR=include
|
||||
PREFIX=/usr
|
||||
LIB=neural++
|
||||
CC=g++
|
||||
CFLAGS=-Wall -pedantic -pedantic-errors
|
||||
|
||||
all:
|
||||
${CC} -I${INCLUDEDIR} ${CFLAGS} -fPIC -g -c ${SRCDIR}/neuralnet.cpp
|
||||
${CC} -I${INCLUDEDIR} ${CFLAGS} -fPIC -g -c ${SRCDIR}/layer.cpp
|
||||
${CC} -I${INCLUDEDIR} ${CFLAGS} -fPIC -g -c ${SRCDIR}/neuron.cpp
|
||||
${CC} -I${INCLUDEDIR} ${CFLAGS} -fPIC -g -c ${SRCDIR}/synapsis.cpp
|
||||
${CC} -I${INCLUDEDIR} ${CFLAGS} -fPIC -g -c ${SRCDIR}/Markup.cpp
|
||||
${CC} -shared -Wl,-soname,lib$(LIB).so.0 -o lib${LIB}.so.0.0.0 neuralnet.o layer.o neuron.o synapsis.o Markup.o
|
||||
ar rcs lib${LIB}.a neuralnet.o layer.o neuron.o synapsis.o Markup.o
|
||||
|
||||
install:
|
||||
mkdir -p ${PREFIX}/lib
|
||||
mkdir -p ${PREFIX}/${INCLUDEDIR}
|
||||
install -m 0755 lib${LIB}.so.0.0.0 ${PREFIX}/lib/lib${LIB}.so.0.0.0
|
||||
install -m 0644 lib${LIB}.a ${PREFIX}/lib/lib${LIB}.a
|
||||
install -m 0644 ${INCLUDEDIR}/${LIB}.hpp ${PREFIX}/${INCLUDEDIR}
|
||||
install -m 0644 ${INCLUDEDIR}/${LIB}_exception.hpp ${PREFIX}/${INCLUDEDIR}
|
||||
ln -sf ${PREFIX}/lib/lib${LIB}.so.0.0.0 ${PREFIX}/lib/lib${LIB}.so.0
|
||||
|
||||
uninstall:
|
||||
rm ${PREFIX}/lib/lib${LIB}.a
|
||||
rm ${PREFIX}/${INCLUDEDIR}/${LIB}.hpp
|
||||
rm ${PREFIX}/${INCLUDEDIR}/${LIB}_exception.hpp
|
||||
rm ${PREFIX}/lib/lib${LIB}.so.0.0.0
|
||||
rm ${PREFIX}/lib/lib${LIB}.so.0
|
||||
|
||||
clean:
|
||||
rm *.o
|
||||
rm lib${LIB}.so.0.0.0
|
||||
rm lib${LIB}.a
|
Binary file not shown.
Binary file not shown.
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <neural++.h>
|
||||
#include <neural++.hpp>
|
||||
using namespace neuralpp;
|
||||
|
||||
int main() {
|
||||
|
|
BIN
examples/doAdd
BIN
examples/doAdd
Binary file not shown.
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <neural++.h>
|
||||
#include <neural++.hpp>
|
||||
using namespace neuralpp;
|
||||
|
||||
#define NETFILE "adder.net"
|
||||
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <neural++.h>
|
||||
#include <neural++.hpp>
|
||||
using namespace neuralpp;
|
||||
|
||||
int main() {
|
||||
|
|
|
@ -11,18 +11,21 @@
|
|||
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
**************************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef __cplusplus
|
||||
#error "This is a C++ library, you know, so you'd better use a C++ compiler to compile it"
|
||||
#else
|
||||
|
||||
#ifndef __NEURALPP
|
||||
#define __NEURALPP
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <exception>
|
||||
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
#include <cstdio>
|
||||
|
||||
#include "neural++_exception.hpp"
|
||||
using namespace std;
|
||||
|
||||
namespace neuralpp {
|
||||
|
@ -36,26 +39,6 @@ namespace neuralpp {
|
|||
class NetworkFileNotFoundException;
|
||||
class InvalidXMLException;
|
||||
|
||||
/**
|
||||
* @class NetworkFileNotFoundException
|
||||
* @brief Exception thrown when doing an attempt to load a network from an invalid file
|
||||
*/
|
||||
class NetworkFileNotFoundException : public exception {
|
||||
public:
|
||||
NetworkFileNotFoundException() {}
|
||||
const char* what() const throw() { return strdup("Attempt to load a neural network from an invalid network file\n"); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @class InvalidXMLException
|
||||
* @brief Exception thrown when trying parsing an invalid XML
|
||||
*/
|
||||
class InvalidXMLException : public exception {
|
||||
public:
|
||||
InvalidXMLException() {}
|
||||
const char* what() const throw() { return strdup("Attempt to load an invalid XML file\n"); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @class NeuralNet
|
||||
* @brief Main project's class. Use *ONLY* this class, unless you know what you're doing
|
47
include/neural++_exception.hpp
Normal file
47
include/neural++_exception.hpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
/**************************************************************************************************
|
||||
* LibNeural++ v.0.2 - All-purpose library for managing neural networks *
|
||||
* Copyright (C) 2009, BlackLight *
|
||||
* *
|
||||
* 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 3 of *
|
||||
* the License, or (at your option) any later version. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
|
||||
* more details. You should have received a copy of the GNU General Public License along with *
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
**************************************************************************************************/
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error "This is a C++ library, you know, so you'd better use a C++ compiler to compile it"
|
||||
#else
|
||||
|
||||
#ifndef __NEURALPP_EXCEPTION
|
||||
#define __NEURALPP_EXCEPTION
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace neuralpp {
|
||||
/**
|
||||
* @class NetworkFileNotFoundException
|
||||
* @brief Exception thrown when doing an attempt to load a network from an invalid file
|
||||
*/
|
||||
class NetworkFileNotFoundException : public std::exception {
|
||||
public:
|
||||
NetworkFileNotFoundException() {}
|
||||
const char* what() const throw() { return "Attempt to load a neural network from an invalid network file"; }
|
||||
};
|
||||
|
||||
/**
|
||||
* @class InvalidXMLException
|
||||
* @brief Exception thrown when trying parsing an invalid XML
|
||||
*/
|
||||
class InvalidXMLException : public std::exception {
|
||||
public:
|
||||
InvalidXMLException() {}
|
||||
const char* what() const throw() { return "Attempt to load an invalid XML file"; }
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -130,7 +130,7 @@ bool CMarkup::SetDoc( MCD_PCSZ pDoc )
|
|||
|
||||
MCD_STRCLEAR(m_strError);
|
||||
return x_ParseDoc();
|
||||
};
|
||||
}
|
||||
|
||||
bool CMarkup::SetDoc( const MCD_STR& strDoc )
|
||||
{
|
||||
|
@ -1386,7 +1386,7 @@ bool CMarkup::x_ParseDoc()
|
|||
}
|
||||
|
||||
return IsWellFormed();
|
||||
};
|
||||
}
|
||||
|
||||
int CMarkup::x_ParseElem( int iPosParent, TokenPos& token )
|
||||
{
|
||||
|
@ -1675,7 +1675,7 @@ int CMarkup::x_ParseNode( CMarkup::TokenPos& token, CMarkup::NodePos& node )
|
|||
PD_DOCTYPE = 32,
|
||||
PD_INQUOTE_S = 64,
|
||||
PD_INQUOTE_D = 128,
|
||||
PD_EQUALS = 256,
|
||||
PD_EQUALS = 256
|
||||
};
|
||||
int nParseFlags = 0;
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
**************************************************************************************************/
|
||||
|
||||
#include "neural++.h"
|
||||
#include <cstdlib>
|
||||
#include "neural++.hpp"
|
||||
using namespace neuralpp;
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
**************************************************************************************************/
|
||||
|
||||
#include "neural++.h"
|
||||
#include "neural++.hpp"
|
||||
#include "Markup.h"
|
||||
#include <iostream>
|
||||
using namespace neuralpp;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
**************************************************************************************************/
|
||||
|
||||
#include "neural++.h"
|
||||
#include "neural++.hpp"
|
||||
using namespace neuralpp;
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
* this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
**************************************************************************************************/
|
||||
|
||||
#include "neural++.h"
|
||||
#include <cstdlib>
|
||||
#include "neural++.hpp"
|
||||
using namespace neuralpp;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue