diff options
author | Jason W. Bacon <jwb@FreeBSD.org> | 2018-04-16 18:15:30 +0000 |
---|---|---|
committer | Jason W. Bacon <jwb@FreeBSD.org> | 2018-04-16 18:15:30 +0000 |
commit | 1dfb1d60047d01f32318525b7c34439d313f5f1e (patch) | |
tree | bfa74f0462f421361b3f0bd4c5ba091211c87bce | |
parent | fb6084427c0988d260d436f69724fc085db36bbc (diff) | |
download | ports-1dfb1d60047d01f32318525b7c34439d313f5f1e.tar.gz ports-1dfb1d60047d01f32318525b7c34439d313f5f1e.zip |
Notes
-rw-r--r-- | science/Makefile | 1 | ||||
-rw-r--r-- | science/fsom/Makefile | 26 | ||||
-rw-r--r-- | science/fsom/distinfo | 3 | ||||
-rw-r--r-- | science/fsom/files/Makefile | 52 | ||||
-rw-r--r-- | science/fsom/files/patch-fsom.c | 26 | ||||
-rw-r--r-- | science/fsom/pkg-descr | 6 |
6 files changed, 114 insertions, 0 deletions
diff --git a/science/Makefile b/science/Makefile index 2fea54d73f41..caf9326d57a1 100644 --- a/science/Makefile +++ b/science/Makefile @@ -53,6 +53,7 @@ SUBDIR += fastcap SUBDIR += fasthenry SUBDIR += fisicalab + SUBDIR += fsom SUBDIR += fvcom SUBDIR += fvcom-mpi SUBDIR += fvm diff --git a/science/fsom/Makefile b/science/fsom/Makefile new file mode 100644 index 000000000000..8c52b66967ea --- /dev/null +++ b/science/fsom/Makefile @@ -0,0 +1,26 @@ +# $FreeBSD$ + +PORTNAME= fsom +DISTVERSION= g20151117 +CATEGORIES= science + +MAINTAINER= jwb@FreeBSD.org +COMMENT= Tiny C library for managing SOM (Self-Organizing Maps) neural networks + +LICENSE= GPLv3 + +USE_GITHUB= yes +GH_ACCOUNT= ekg +GH_TAGNAME= 56695e1611d824cda97f08e932d25d08419170cd + +INSTALL_TARGET= install-strip + +PLIST_FILES= bin/fsom \ + include/fsom/convert.h \ + include/fsom/fsom.h \ + include/fsom/split.h \ + lib/libfsom.a + +MAKEFILE= ${FILESDIR}/Makefile + +.include <bsd.port.mk> diff --git a/science/fsom/distinfo b/science/fsom/distinfo new file mode 100644 index 000000000000..0e8063cbe3c9 --- /dev/null +++ b/science/fsom/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1523601004 +SHA256 (ekg-fsom-g20151117-56695e1611d824cda97f08e932d25d08419170cd_GH0.tar.gz) = 1ba3360985be781bb9f79d974705c86e7bb0719cb83638955e113b5dd83ec8dd +SIZE (ekg-fsom-g20151117-56695e1611d824cda97f08e932d25d08419170cd_GH0.tar.gz) = 9771 diff --git a/science/fsom/files/Makefile b/science/fsom/files/Makefile new file mode 100644 index 000000000000..7e41acae8b98 --- /dev/null +++ b/science/fsom/files/Makefile @@ -0,0 +1,52 @@ + +# Use ?= to allow overriding from the env or command-line, e.g. +# +# make CXXFLAGS="-O3 -fPIC" install +# +# Package managers will override many of these variables automatically, so +# this is aimed at making it easy to create packages (Debian packages, +# FreeBSD ports, MacPorts, pkgsrc, etc.) + +CXX ?= g++ +CXXFLAGS ?= -w -O3 -pipe -fomit-frame-pointer -ffast-math +AR ?= ar +MKDIR ?= mkdir +STRIP ?= strip +DESTDIR ?= stage +PREFIX ?= /usr/local + +BIN = fsom +LIB = libfsom.a +OBJS = fsom.o split.o +MAIN = main.o + +all: ${BIN} ${LIB} + +${BIN}: ${OBJS} ${MAIN} + ${CXX} -o fsom ${OBJS} ${MAIN} -lm + +${LIB}: ${OBJS} + ${AR} -rs ${LIB} ${OBJS} + +fsom.o: fsom.c + ${CXX} ${CXXFLAGS} -c fsom.c + +split.o: split.cpp + ${CXX} ${CXXFLAGS} -c split.cpp + +main.o: main.cpp + ${CXX} ${CXXFLAGS} -c main.cpp + +install: all + ${MKDIR} -p ${DESTDIR}${PREFIX}/bin + ${MKDIR} -p ${DESTDIR}${PREFIX}/include/fsom + ${MKDIR} -p ${DESTDIR}${PREFIX}/lib + ${INSTALL} ${BIN} ${DESTDIR}${PREFIX}/bin + ${INSTALL} *.h ${DESTDIR}${PREFIX}/include/fsom + ${INSTALL} ${LIB} ${DESTDIR}${PREFIX}/lib + +install-strip: install + ${STRIP} ${DESTDIR}${PREFIX}/bin/${BIN} + +clean: + rm -rf *.o ${BIN} ${LIB} ${DESTDIR} diff --git a/science/fsom/files/patch-fsom.c b/science/fsom/files/patch-fsom.c new file mode 100644 index 000000000000..8a32822cd4b3 --- /dev/null +++ b/science/fsom/files/patch-fsom.c @@ -0,0 +1,26 @@ +--- fsom.c.orig 2015-11-21 16:35:06 UTC ++++ fsom.c +@@ -31,6 +31,10 @@ + #define M_E 2.7182818284590452354 + #endif + ++#ifndef ABS ++#define ABS(x) ((x) < 0 ? -(x) : (x)) ++#endif ++ + /** + * \brief Create a new synapsis between two neurons + * \param input_neuron Input neuron for the synapsis +@@ -591,10 +595,10 @@ som_train_iteration ( som_network_t *net + som_neuron_t *neuron; + for ( i=0; i < net->output_layer->neurons_rows; ++i ) + { +- dist_i = abs( x - i ); ++ dist_i = ABS( x - i ); + for ( j=0; j < net->output_layer->neurons_cols; ++j ) + { +- dist = pow( dist_i + abs ( y - j ), 4 ); ++ dist = pow( dist_i + ABS ( y - j ), 4 ); + inv_dist = (1.0 / ((double) dist + 1)) * l_rate; + neuron = net->output_layer->neurons[i][j]; + for ( k=0; k < net->input_layer->neurons_count; ++k ) diff --git a/science/fsom/pkg-descr b/science/fsom/pkg-descr new file mode 100644 index 000000000000..66f1c23005f2 --- /dev/null +++ b/science/fsom/pkg-descr @@ -0,0 +1,6 @@ +FSOM is a tiny C library for managing SOM (Self-Organizing Maps) neural +networks, a type of artificial neural network (ANN) that is trained using +unsupervised learning to produce a low-dimensional (typically two-dimensional), +discretized representation of the input space of the training samples. + +WWW: https://github.com/ekg/fsom |