[libfann] 199/242: Documentation
Christian Kastner
chrisk-guest at moszumanska.debian.org
Sat Oct 4 21:10:44 UTC 2014
This is an automated email from the git hooks/post-receive script.
chrisk-guest pushed a commit to tag Version2_0_0
in repository libfann.
commit 06f03e3934214233cbcf8d8c31b1aacc5bd68d50
Author: Steffen Nissen <lukesky at diku.dk>
Date: Mon Oct 17 22:35:04 2005 +0000
Documentation
---
examples/cascade_train.c | 26 +-
ltmain.sh | 716 ++++++++++++++++++++++++++-------------------
src/fann.c | 1 +
src/fann_cascade.c | 25 +-
src/fann_error.c | 3 +
src/fann_train_data.c | 191 +++++++++---
src/include/fann_cascade.h | 10 +-
src/include/fann_data.h | 26 +-
src/include/fann_error.h | 4 +-
src/include/fann_train.h | 192 +++++++++++-
10 files changed, 806 insertions(+), 388 deletions(-)
diff --git a/examples/cascade_train.c b/examples/cascade_train.c
index 6353620..d297296 100644
--- a/examples/cascade_train.c
+++ b/examples/cascade_train.c
@@ -24,7 +24,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
struct fann *ann;
struct fann_train_data *train_data, *test_data;
-int print_callback(unsigned int epochs, float error)
+int FANN_API print_callback(struct fann *ann, struct fann_train_data *train,
+ unsigned int max_epochs, unsigned int epochs_between_reports,
+ float desired_error, unsigned int epochs)
{
int bit1, bit2;
float mse1, mse2;
@@ -32,10 +34,11 @@ int print_callback(unsigned int epochs, float error)
mse2 = fann_test_data(ann, test_data);
bit2 = ann->num_bit_fail;
- mse1 = fann_test_data(ann, train_data);
+ mse1 = fann_test_data(ann, train);
bit1 = ann->num_bit_fail;
- printf("Nerons %4d. Epochs: %7d ", epochs, (int)error);
+ printf("Nerons %4d. Epochs: %7d ",
+ fann_get_total_neurons(ann)-(fann_get_num_input(ann)+fann_get_num_output(ann)), epochs);
printf("Train error: %.10f (%d), Test error: %.10f (%d)\n", mse1, bit1, mse2, bit2);
return 0;
}
@@ -45,6 +48,7 @@ int main()
const float desired_error = (const float) 0.00001;
unsigned int max_neurons = 40;
unsigned int neurons_between_reports = 1;
+ struct fann_train_data *test = NULL;
printf("Reading data.\n");
@@ -60,9 +64,6 @@ int main()
train_data = fann_read_train_from_file("../benchmarks/datasets/two-spiral.train");
test_data = fann_read_train_from_file("../benchmarks/datasets/two-spiral.test");
- train_data = fann_read_train_from_file("xor.data");
- test_data = fann_read_train_from_file("xor.data");
-
train_data = fann_read_train_from_file("../benchmarks/datasets/mushroom.train");
test_data = fann_read_train_from_file("../benchmarks/datasets/mushroom.test");
@@ -90,9 +91,17 @@ int main()
train_data = fann_read_train_from_file("../benchmarks/datasets/parity13.test");
test_data = fann_read_train_from_file("../benchmarks/datasets/parity13.test");
+ train_data = fann_read_train_from_file("xor.data");
+ test_data = fann_read_train_from_file("xor.data");
+
fann_scale_train_data(train_data, 0, 1);
fann_scale_train_data(test_data, 0, 1);
+ test = fann_subset_train_data(train_data, 0, 2);
+ test_data = fann_subset_train_data(train_data, 2, 2);
+ test = fann_merge_train_data(test, test_data);
+ fann_save_train(test, "test_test.data");
+
printf("Creating network.\n");
ann = fann_create_shortcut(2, train_data->num_input, train_data->num_output);
@@ -123,13 +132,14 @@ int main()
fann_set_cascade_max_cand_epochs(ann, 150);
fann_set_cascade_num_candidate_groups(ann, 1);
+ fann_set_callback(ann, print_callback);
+
fann_print_parameters(ann);
/*fann_print_connections(ann); */
printf("Training network.\n");
- fann_cascadetrain_on_data_callback(ann, train_data, desired_error, print_callback,
- max_neurons, neurons_between_reports);
+ fann_cascadetrain_on_data(ann, train_data, max_neurons, neurons_between_reports, desired_error);
/*fann_train_on_data(ann, train_data, 300, 1, desired_error); */
/*printf("\nTrain error: %f, Test error: %f\n\n", fann_test_data(ann, train_data), fann_test_data(ann, test_data)); */
diff --git a/ltmain.sh b/ltmain.sh
index 1a224ac..db4982d 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,7 +1,7 @@
# ltmain.sh - Provide generalized library-building support services.
# NOTE: Changing this file will not affect anything until you rerun configure.
#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
#
@@ -17,7 +17,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -43,9 +43,14 @@ EXIT_FAILURE=1
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=1.5.6
-TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 224 $"
+VERSION="1.5.20 Debian 1.5.20-2"
+TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)"
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes.
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
# Check that we have a working $echo.
if test "X$1" = X--no-reexec; then
@@ -83,14 +88,15 @@ rm="rm -f"
Xsed="${SED}"' -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
# test EBCDIC or ASCII
-case `echo A|tr A '\301'` in
- A) # EBCDIC based system
- SP2NL="tr '\100' '\n'"
- NL2SP="tr '\r\n' '\100\100'"
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ SP2NL='tr \040 \012'
+ NL2SP='tr \015\012 \040\040'
;;
- *) # Assume ASCII based system
- SP2NL="tr '\040' '\012'"
- NL2SP="tr '\015\012' '\040\040'"
+ *) # EBCDIC based system
+ SP2NL='tr \100 \n'
+ NL2SP='tr \r\n \100\100'
;;
esac
@@ -107,8 +113,9 @@ if test "${LANG+set}" = set; then
fi
# Make sure IFS has a sensible default
-: ${IFS="
-"}
+lt_nl='
+'
+IFS=" $lt_nl"
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
$echo "$modename: not configured to build any kind of library" 1>&2
@@ -138,7 +145,8 @@ o2lo="s/\\.${objext}\$/.lo/"
# Need a lot of goo to handle *both* DLLs and import libs
# Has to be a shell function in order to 'eat' the argument
# that is supplied when $file_magic_command is called.
-func_win32_libid () {
+func_win32_libid ()
+{
win32_libid_type="unknown"
win32_fileres=`file -L $1 2>/dev/null`
case $win32_fileres in
@@ -178,7 +186,8 @@ func_win32_libid () {
# Only attempt this if the compiler in the base compile
# command doesn't match the default compiler.
# arg is usually of the form 'gcc ...'
-func_infer_tag () {
+func_infer_tag ()
+{
if test -n "$available_tags" && test -z "$tagname"; then
CC_quoted=
for arg in $CC; do
@@ -235,6 +244,108 @@ func_infer_tag () {
esac
fi
}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+
+ $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+ $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+ exit $EXIT_FAILURE
+ fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+ my_status=""
+
+ $show "${rm}r $my_gentop"
+ $run ${rm}r "$my_gentop"
+ $show "$mkdir $my_gentop"
+ $run $mkdir "$my_gentop"
+ my_status=$?
+ if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+ exit $my_status
+ fi
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+ my_xdir="$my_gentop/$my_xlib"
+
+ $show "${rm}r $my_xdir"
+ $run ${rm}r "$my_xdir"
+ $show "$mkdir $my_xdir"
+ $run $mkdir "$my_xdir"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$my_xdir"; then
+ exit $status
+ fi
+ case $host in
+ *-darwin*)
+ $show "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ if test -z "$run"; then
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+ darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ $show "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+ lipo -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ ${rm}r unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd "$darwin_orig_dir"
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ fi # $run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+ done
+ func_extract_archives_result="$my_oldobjs"
+}
# End of Shell function definitions
#####################################
@@ -305,10 +416,10 @@ do
--version)
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
$echo
- $echo "Copyright (C) 2003 Free Software Foundation, Inc."
+ $echo "Copyright (C) 2005 Free Software Foundation, Inc."
$echo "This is free software; see the source for copying conditions. There is NO"
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
- exit $EXIT_SUCCESS
+ exit $?
;;
--config)
@@ -317,7 +428,7 @@ do
for tagname in $taglist; do
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
done
- exit $EXIT_SUCCESS
+ exit $?
;;
--debug)
@@ -342,7 +453,7 @@ do
else
$echo "disable static libraries"
fi
- exit $EXIT_SUCCESS
+ exit $?
;;
--finish) mode="finish" ;;
@@ -399,7 +510,7 @@ if test -z "$show_help"; then
# Infer the operation mode.
if test -z "$mode"; then
$echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
- $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
+ $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
case $nonopt in
*cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
mode=link
@@ -465,7 +576,7 @@ if test -z "$show_help"; then
for arg
do
- case "$arg_mode" in
+ case $arg_mode in
arg )
# do not "continue". Instead, add this to base_compile
lastarg="$arg"
@@ -547,7 +658,10 @@ if test -z "$show_help"; then
case $lastarg in
# Double-quote args containing other shell metacharacters.
# Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
+ # in scan sets, and some SunOS ksh mistreat backslash-escaping
+ # in scan sets (worked around with variable expansion),
+ # and furthermore cannot handle '|' '&' '(' ')' in scan sets
+ # at all, so we specify them separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
lastarg="\"$lastarg\""
;;
@@ -621,6 +735,14 @@ if test -z "$show_help"; then
esac
done
+ qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+ case $qlibobj in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qlibobj="\"$qlibobj\"" ;;
+ esac
+ test "X$libobj" != "X$qlibobj" \
+ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
if test "X$xdir" = "X$obj"; then
@@ -693,12 +815,17 @@ compiler."
$run $rm $removelist
exit $EXIT_FAILURE
fi
- $echo $srcfile > "$lockfile"
+ $echo "$srcfile" > "$lockfile"
fi
if test -n "$fix_srcfile_path"; then
eval srcfile=\"$fix_srcfile_path\"
fi
+ qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+ case $qsrcfile in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qsrcfile="\"$qsrcfile\"" ;;
+ esac
$run $rm "$libobj" "${libobj}T"
@@ -720,10 +847,10 @@ EOF
fbsd_hideous_sh_bug=$base_compile
if test "$pic_mode" != no; then
- command="$base_compile $srcfile $pic_flag"
+ command="$base_compile $qsrcfile $pic_flag"
else
# Don't build PIC code
- command="$base_compile $srcfile"
+ command="$base_compile $qsrcfile"
fi
if test ! -d "${xdir}$objdir"; then
@@ -803,9 +930,9 @@ EOF
if test "$build_old_libs" = yes; then
if test "$pic_mode" != yes; then
# Don't build PIC code
- command="$base_compile $srcfile"
+ command="$base_compile $qsrcfile"
else
- command="$base_compile $srcfile $pic_flag"
+ command="$base_compile $qsrcfile $pic_flag"
fi
if test "$compiler_c_o" = yes; then
command="$command -o $obj"
@@ -1227,6 +1354,13 @@ EOF
prev=
continue
;;
+ darwin_framework)
+ compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ prev=
+ continue
+ ;;
*)
eval "$prev=\"\$arg\""
prev=
@@ -1285,6 +1419,14 @@ EOF
continue
;;
+ -framework|-arch)
+ prev=darwin_framework
+ compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ continue
+ ;;
+
-inst-prefix-dir)
prev=inst_prefix
continue
@@ -1345,7 +1487,7 @@ EOF
# These systems don't actually have a C library (as such)
test "X$arg" = "X-lc" && continue
;;
- *-*-openbsd* | *-*-freebsd*)
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue
;;
@@ -1356,7 +1498,7 @@ EOF
esac
elif test "X$arg" = "X-lc_r"; then
case $host in
- *-*-openbsd* | *-*-freebsd*)
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc_r directly, use -pthread flag.
continue
;;
@@ -1366,8 +1508,20 @@ EOF
continue
;;
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ -model)
+ compile_command="$compile_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ finalize_command="$finalize_command $arg"
+ prev=xcompiler
+ continue
+ ;;
+
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
- deplibs="$deplibs $arg"
+ compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
continue
;;
@@ -1376,13 +1530,14 @@ EOF
continue
;;
- # gcc -m* arguments should be passed to the linker via $compiler_flags
- # in order to pass architecture information to the linker
- # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
- # but this is not reliable with gcc because gcc may use -mfoo to
- # select a different linker, different libraries, etc, while
- # -Wl,-mfoo simply passes -mfoo to the linker.
- -m*)
+ # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+ # -r[0-9][0-9]* specifies the processor on the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+ # +DA*, +DD* enable 64-bit mode on the HP compiler
+ # -q* pass through compiler args for the IBM compiler
+ # -m* pass through architecture-specific compiler args for GCC
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
+
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
@@ -1858,7 +2013,7 @@ EOF
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
- deplibs="$deplib $deplibs"
+ compiler_flags="$compiler_flags $deplib"
fi
continue
;;
@@ -1977,7 +2132,22 @@ EOF
fi
case $linkmode in
lib)
- if test "$deplibs_check_method" != pass_all; then
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ if eval $echo \"$deplib\" 2>/dev/null \
+ | $SED 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ valid_a_lib=yes
+ fi
+ ;;
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
$echo
$echo "*** Warning: Trying to link with static lib archive $deplib."
$echo "*** I have the capability to make that library automatically link in when"
@@ -2051,6 +2221,8 @@ EOF
# it will not redefine variables installed, or shouldnotlink
installed=yes
shouldnotlink=no
+ avoidtemprpath=
+
# Read the .la file
case $lib in
@@ -2149,11 +2321,19 @@ EOF
dir="$libdir"
absdir="$libdir"
fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
else
- dir="$ladir/$objdir"
- absdir="$abs_ladir/$objdir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ fi
fi # $installed = yes
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
@@ -2226,12 +2406,12 @@ EOF
if test -n "$library_names" &&
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
# We need to hardcode the library path
- if test -n "$shlibpath_var"; then
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
# Make sure the rpath contains only unique directories.
case "$temp_rpath " in
*" $dir "*) ;;
*" $absdir "*) ;;
- *) temp_rpath="$temp_rpath $dir" ;;
+ *) temp_rpath="$temp_rpath $absdir" ;;
esac
fi
@@ -2417,7 +2597,7 @@ EOF
add_dir="-L$dir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
- case "$libdir" in
+ case $libdir in
[\\/]*)
add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
@@ -2490,7 +2670,7 @@ EOF
add_dir="-L$libdir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
- case "$libdir" in
+ case $libdir in
[\\/]*)
add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
@@ -2551,8 +2731,6 @@ EOF
fi
fi
else
- convenience="$convenience $dir/$old_library"
- old_convenience="$old_convenience $dir/$old_library"
deplibs="$dir/$old_library $deplibs"
link_static=yes
fi
@@ -2670,12 +2848,12 @@ EOF
*) continue ;;
esac
case " $deplibs " in
- *" $depdepl "*) ;;
- *) deplibs="$depdepl $deplibs" ;;
+ *" $path "*) ;;
+ *) deplibs="$path $deplibs" ;;
esac
case " $deplibs " in
- *" $path "*) ;;
- *) deplibs="$deplibs $path" ;;
+ *" $depdepl "*) ;;
+ *) deplibs="$depdepl $deplibs" ;;
esac
done
fi # link_all_deplibs != no
@@ -2947,7 +3125,7 @@ EOF
case $current in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
- $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+ $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE
;;
@@ -2956,7 +3134,7 @@ EOF
case $revision in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
- $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+ $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE
;;
@@ -2965,7 +3143,7 @@ EOF
case $age in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
- $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+ $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
exit $EXIT_FAILURE
;;
@@ -2991,7 +3169,7 @@ EOF
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
minor_current=`expr $current + 1`
- verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
;;
freebsd-aout)
@@ -3197,7 +3375,7 @@ EOF
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
;;
- *-*-openbsd* | *-*-freebsd*)
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
# Do not include libc due to us having libc/libc_r.
test "X$arg" = "X-lc" && continue
;;
@@ -3247,7 +3425,7 @@ EOF
if test "$?" -eq 0 ; then
ldd_output=`ldd conftest`
for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
+ name=`expr $i : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" -ne "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
@@ -3284,7 +3462,7 @@ EOF
# Error occurred in the first compile. Let's try to salvage
# the situation: Compile a separate program for each library.
for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
+ name=`expr $i : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" != "0"; then
$rm conftest
@@ -3336,7 +3514,7 @@ EOF
set dummy $deplibs_check_method
file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
for a_deplib in $deplibs; do
- name="`expr $a_deplib : '-l\(.*\)'`"
+ name=`expr $a_deplib : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument.
if test "$name" != "" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
@@ -3405,7 +3583,7 @@ EOF
set dummy $deplibs_check_method
match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
for a_deplib in $deplibs; do
- name="`expr $a_deplib : '-l\(.*\)'`"
+ name=`expr $a_deplib : '-l\(.*\)'`
# If $name is empty we are operating on a -L argument.
if test -n "$name" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
@@ -3646,6 +3824,9 @@ EOF
# The command line is too long to execute in one step.
$show "using reloadable object file for export list..."
skipped_export=:
+ # Break out early, otherwise skipped_export may be
+ # set to false by a later but shorter cmd.
+ break
fi
done
IFS="$save_ifs"
@@ -3679,67 +3860,13 @@ EOF
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
else
gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
generated="$generated $gentop"
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
- done
+ func_extract_archives $gentop $convenience
+ libobjs="$libobjs $func_extract_archives_result"
fi
fi
-
+
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
eval flag=\"$thread_safe_flag_spec\"
linker_flags="$linker_flags $flag"
@@ -3769,7 +3896,8 @@ EOF
fi
fi
- if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
+ if test "X$skipped_export" != "X:" &&
+ len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
:
else
@@ -3788,6 +3916,7 @@ EOF
save_libobjs=$libobjs
fi
save_output=$output
+ output_la=`$echo "X$output" | $Xsed -e "$basename"`
# Clear the reloadable object creation command queue and
# initialize k to one.
@@ -3797,13 +3926,13 @@ EOF
delfiles=
last_robj=
k=1
- output=$output_objdir/$save_output-${k}.$objext
+ output=$output_objdir/$output_la-${k}.$objext
# Loop over the list of objects to be linked.
for obj in $save_libobjs
do
eval test_cmds=\"$reload_cmds $objlist $last_robj\"
if test "X$objlist" = X ||
- { len=`expr "X$test_cmds" : ".*"` &&
+ { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
test "$len" -le "$max_cmd_len"; }; then
objlist="$objlist $obj"
else
@@ -3817,9 +3946,9 @@ EOF
# the last one created.
eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
fi
- last_robj=$output_objdir/$save_output-${k}.$objext
+ last_robj=$output_objdir/$output_la-${k}.$objext
k=`expr $k + 1`
- output=$output_objdir/$save_output-${k}.$objext
+ output=$output_objdir/$output_la-${k}.$objext
objlist=$obj
len=1
fi
@@ -3839,13 +3968,13 @@ EOF
eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
fi
- # Set up a command to remove the reloadale object files
+ # Set up a command to remove the reloadable object files
# after they are used.
i=0
while test "$i" -lt "$k"
do
i=`expr $i + 1`
- delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
+ delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
done
$echo "creating a temporary reloadable object file: $output"
@@ -3893,13 +4022,30 @@ EOF
IFS="$save_ifs"
eval cmd=\"$cmd\"
$show "$cmd"
- $run eval "$cmd" || exit $?
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
done
IFS="$save_ifs"
# Restore the uninstalled library and exit
if test "$mode" = relink; then
$run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ fi
+ fi
+
exit $EXIT_SUCCESS
fi
@@ -3977,64 +4123,10 @@ EOF
eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
else
gentop="$output_objdir/${obj}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
generated="$generated $gentop"
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
- done
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
fi
fi
@@ -4296,12 +4388,12 @@ extern \"C\" {
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
- export_symbols="$output_objdir/$output.exp"
+ export_symbols="$output_objdir/$outputname.exp"
$run $rm $export_symbols
- $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
else
- $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
- $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+ $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
$run eval 'mv "$nlist"T "$nlist"'
fi
fi
@@ -4353,7 +4445,26 @@ extern \"C\" {
#endif
/* The mapping between symbol names and symbols. */
+"
+
+ case $host in
+ *cygwin* | *mingw* )
+ $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+ runtime relocations are performed -- see ld's documentation
+ on pseudo-relocs */
+struct {
+"
+ ;;
+ * )
+ $echo >> "$output_objdir/$dlsyms" "\
const struct {
+"
+ ;;
+ esac
+
+
+ $echo >> "$output_objdir/$dlsyms" "\
const char *name;
lt_ptr address;
}
@@ -4582,7 +4693,7 @@ static const void *lt_preloaded_setup() {
esac
case $host in
*cygwin* | *mingw* )
- cwrappersource=`$echo ${objdir}/lt-${output}.c`
+ cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
cwrapper=`$echo ${output}.exe`
$rm $cwrappersource $cwrapper
trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
@@ -4681,6 +4792,7 @@ EOF
EOF
cat >> $cwrappersource <<"EOF"
+ return 127;
}
void *
@@ -4815,7 +4927,7 @@ sed_quote_subst='$sed_quote_subst'
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
-if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
relink_command=\"$relink_command\"
@@ -4944,13 +5056,13 @@ else
# Backslashes separate directories on plain windows
*-*-mingw | *-*-os2*)
$echo >> $output "\
- exec \$progdir\\\\\$program \${1+\"\$@\"}
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
"
;;
*)
$echo >> $output "\
- exec \$progdir/\$program \${1+\"\$@\"}
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
"
;;
esac
@@ -4960,7 +5072,7 @@ else
fi
else
# The program doesn't exist.
- \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+ \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
\$echo \"This script is just a wrapper for \$program.\" 1>&2
$echo \"See the $PACKAGE documentation for more information.\" 1>&2
exit $EXIT_FAILURE
@@ -4992,71 +5104,73 @@ fi\
if test -n "$addlibs"; then
gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
generated="$generated $gentop"
- # Add in members from convenience archives.
- for xlib in $addlibs; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
- done
+ func_extract_archives $gentop $addlibs
+ oldobjs="$oldobjs $func_extract_archives_result"
fi
# Do each command in the archive commands.
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
cmds=$old_archive_from_new_cmds
else
+ # POSIX demands no paths to be encoded in archives. We have
+ # to avoid creating archives with duplicate basenames if we
+ # might have to extract them afterwards, e.g., when creating a
+ # static archive out of a convenience library, or when linking
+ # the entirety of a libtool archive into another (currently
+ # not supported by libtool).
+ if (for obj in $oldobjs
+ do
+ $echo "X$obj" | $Xsed -e 's%^.*/%%'
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "copying selected object files to avoid basename conflicts..."
+
+ if test -z "$gentop"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ fi
+
+ save_oldobjs=$oldobjs
+ oldobjs=
+ counter=1
+ for obj in $save_oldobjs
+ do
+ objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ case " $oldobjs " in
+ " ") oldobjs=$obj ;;
+ *[\ /]"$objbase "*)
+ while :; do
+ # Make sure we don't pick an alternate name that also
+ # overlaps.
+ newobj=lt$counter-$objbase
+ counter=`expr $counter + 1`
+ case " $oldobjs " in
+ *[\ /]"$newobj "*) ;;
+ *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+ esac
+ done
+ $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ $run ln "$obj" "$gentop/$newobj" ||
+ $run cp "$obj" "$gentop/$newobj"
+ oldobjs="$oldobjs $gentop/$newobj"
+ ;;
+ *) oldobjs="$oldobjs $obj" ;;
+ esac
+ done
+ fi
+
eval cmds=\"$old_archive_cmds\"
if len=`expr "X$cmds" : ".*"` &&
@@ -5070,20 +5184,7 @@ fi\
objlist=
concat_cmds=
save_oldobjs=$oldobjs
- # GNU ar 2.10+ was changed to match POSIX; thus no paths are
- # encoded into archives. This makes 'ar r' malfunction in
- # this piecewise linking case whenever conflicting object
- # names appear in distinct ar calls; check, warn and compensate.
- if (for obj in $save_oldobjs
- do
- $echo "X$obj" | $Xsed -e 's%^.*/%%'
- done | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
- $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
- AR_FLAGS=cq
- fi
+
# Is there a better way of finding the last object in the list?
for obj in $save_oldobjs
do
@@ -5094,7 +5195,7 @@ fi\
oldobjs="$objlist $obj"
objlist="$objlist $obj"
eval test_cmds=\"$old_archive_cmds\"
- if len=`expr "X$test_cmds" : ".*"` &&
+ if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
test "$len" -le "$max_cmd_len"; then
:
else
@@ -5291,11 +5392,11 @@ relink_command=\"$relink_command\""
# install_prog (especially on Windows NT).
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
# Allow the use of GNU shtool's install command.
- $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+ $echo "X$nonopt" | grep shtool > /dev/null; then
# Aesthetically quote it.
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\""
;;
esac
@@ -5304,14 +5405,14 @@ relink_command=\"$relink_command\""
shift
else
install_prog=
- arg="$nonopt"
+ arg=$nonopt
fi
# The real first argument should be the name of the installation program.
# Aesthetically quote it.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\""
;;
esac
@@ -5329,28 +5430,31 @@ relink_command=\"$relink_command\""
do
if test -n "$dest"; then
files="$files $dest"
- dest="$arg"
+ dest=$arg
continue
fi
case $arg in
-d) isdir=yes ;;
- -f) prev="-f" ;;
- -g) prev="-g" ;;
- -m) prev="-m" ;;
- -o) prev="-o" ;;
+ -f)
+ case " $install_prog " in
+ *[\\\ /]cp\ *) ;;
+ *) prev=$arg ;;
+ esac
+ ;;
+ -g | -m | -o) prev=$arg ;;
-s)
stripme=" -s"
continue
;;
- -*) ;;
-
+ -*)
+ ;;
*)
# If the previous option needed an argument, then skip it.
if test -n "$prev"; then
prev=
else
- dest="$arg"
+ dest=$arg
continue
fi
;;
@@ -5359,7 +5463,7 @@ relink_command=\"$relink_command\""
# Aesthetically quote the argument.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
arg="\"$arg\""
;;
esac
@@ -5528,11 +5632,14 @@ relink_command=\"$relink_command\""
if test "$#" -gt 0; then
# Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
for linkname
do
if test "$linkname" != "$realname"; then
- $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
fi
done
fi
@@ -5545,7 +5652,16 @@ relink_command=\"$relink_command\""
IFS="$save_ifs"
eval cmd=\"$cmd\"
$show "$cmd"
- $run eval "$cmd" || exit $?
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
done
IFS="$save_ifs"
fi
@@ -5639,17 +5755,15 @@ relink_command=\"$relink_command\""
notinst_deplibs=
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
# If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
esac
# Check the variables that should have been set.
@@ -5677,17 +5791,15 @@ relink_command=\"$relink_command\""
done
relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
# If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
esac
outputname=
@@ -5728,7 +5840,7 @@ relink_command=\"$relink_command\""
fi
# remove .exe since cygwin /usr/bin/install will append another
- # one anyways
+ # one anyway
case $install_prog,$host in
*/usr/bin/install*,*cygwin*)
case $file:$destfile in
@@ -6398,7 +6510,7 @@ esac
$echo
$echo "Try \`$modename --help' for more information about other modes."
-exit $EXIT_SUCCESS
+exit $?
# The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries. Given conflicting
diff --git a/src/fann.c b/src/fann.c
index 3654e1b..0765aae 100644
--- a/src/fann.c
+++ b/src/fann.c
@@ -1116,6 +1116,7 @@ struct fann *fann_allocate_structure(unsigned int num_layers)
ann->shortcut_connections = 0;
ann->train_error_function = FANN_ERRORFUNC_TANH;
ann->train_stop_function = FANN_STOPFUNC_MSE;
+ ann->callback = NULL;
/* variables used for cascade correlation (reasonable defaults) */
ann->cascade_change_fraction = 0.01;
diff --git a/src/fann_cascade.c b/src/fann_cascade.c
index 7d0bb32..7cf62d7 100644
--- a/src/fann_cascade.c
+++ b/src/fann_cascade.c
@@ -26,12 +26,6 @@
/* #define CASCADE_DEBUG */
/* #define CASCADE_DEBUG_FULL */
-void fann_cascadetrain_on_data_callback(struct fann *ann, struct fann_train_data *data,
- float desired_error, int (*callback) (unsigned int epochs,
- float error),
- unsigned int max_neurons,
- unsigned int neurons_between_reports);
-
int fann_train_outputs(struct fann *ann, struct fann_train_data *data, float desired_error);
float fann_train_outputs_epoch(struct fann *ann, struct fann_train_data *data);
@@ -65,18 +59,17 @@ void fann_print_connections_raw(struct fann *ann)
The connected_neurons pointers are not valid during training,
but they will be again after training.
*/
-void fann_cascadetrain_on_data_callback(struct fann *ann, struct fann_train_data *data,
- float desired_error, int (*callback) (unsigned int epochs,
- float error),
+void fann_cascadetrain_on_data(struct fann *ann, struct fann_train_data *data,
unsigned int max_neurons,
- unsigned int neurons_between_reports)
+ unsigned int neurons_between_reports,
+ float desired_error)
{
float error;
unsigned int i;
unsigned int total_epochs = 0;
int desired_error_reached;
- if(neurons_between_reports && callback == NULL)
+ if(neurons_between_reports && ann->callback == NULL)
{
printf("Max neurons %6d. Desired error: %.6f\n", max_neurons, desired_error);
}
@@ -106,16 +99,14 @@ void fann_cascadetrain_on_data_callback(struct fann *ann, struct fann_train_data
(i % neurons_between_reports == 0
|| i == max_neurons || i == 1 || desired_error_reached == 0))
{
- if(callback == NULL)
+ if(ann->callback == NULL)
{
printf
("Neurons %6d. Current error: %.6f. Total error: %.6f. Epochs %6d. Bit fail %d.\n",
i, error, ann->MSE_value, total_epochs, ann->num_bit_fail);
}
- else if((*callback) (i, total_epochs) == -1)
- /* TODO the callback should be changed, to include more info
- * now total_epochs is included in the error field.
- */
+ else if((*ann->callback) (ann, data, max_neurons,
+ neurons_between_reports, desired_error, total_epochs) == -1)
{
/* you can break the training by returning -1 */
break;
@@ -160,7 +151,7 @@ void fann_cascadetrain_on_data_callback(struct fann *ann, struct fann_train_data
/* Train outputs one last time but without any desired error */
total_epochs += fann_train_outputs(ann, data, 0.0);
- if(neurons_between_reports && callback == NULL)
+ if(neurons_between_reports && ann->callback == NULL)
{
printf("Train outputs Current error: %.6f. Epochs %6d\n", fann_get_MSE(ann),
total_epochs);
diff --git a/src/fann_error.c b/src/fann_error.c
index 451c7fe..b4f4c3c 100644
--- a/src/fann_error.c
+++ b/src/fann_error.c
@@ -159,6 +159,9 @@ void fann_error(struct fann_error *errdat, const enum fann_errno_enum errno_f, .
case FANN_E_CANT_USE_TRAIN_ALG:
sprintf(errstr, "Unable to use the selected training algorithm.\n");
break;
+ case FANN_E_TRAIN_DATA_SUBSET:
+ vsprintf(errstr, "Subset from %d of length %d not valid in training set of length %d.\n", ap);
+ break;
}
va_end(ap);
diff --git a/src/fann_train_data.c b/src/fann_train_data.c
index 599ded3..0432c1b 100644
--- a/src/fann_train_data.c
+++ b/src/fann_train_data.c
@@ -396,62 +396,79 @@ FANN_EXTERNAL void FANN_API fann_scale_train_data(struct fann_train_data *train_
/*
* merges training data into a single struct.
- * TODO this function memory leaks
*/
FANN_EXTERNAL struct fann_train_data *FANN_API fann_merge_train_data(struct fann_train_data *data1,
struct fann_train_data *data2)
{
- struct fann_train_data *train_data;
- unsigned int x;
+ unsigned int i;
+ fann_type *data_input, *data_output;
+ struct fann_train_data *dest =
+ (struct fann_train_data *) malloc(sizeof(struct fann_train_data));
+
+ if(dest == NULL)
+ {
+ fann_error((struct fann_error*)data1, FANN_E_CANT_ALLOCATE_MEM);
+ return NULL;
+ }
if((data1->num_input != data2->num_input) || (data1->num_output != data2->num_output))
{
- fann_error(NULL, FANN_E_TRAIN_DATA_MISMATCH);
+ fann_error((struct fann_error*)data1, FANN_E_TRAIN_DATA_MISMATCH);
return NULL;
}
- train_data = (struct fann_train_data *) malloc(sizeof(struct fann_train_data));
+ fann_init_error_data((struct fann_error *) dest);
+ dest->error_log = data1->error_log;
- fann_init_error_data((struct fann_error *) train_data);
+ dest->num_data = data1->num_data+data2->num_data;
+ dest->num_input = data1->num_input;
+ dest->num_output = data1->num_output;
+ dest->input = (fann_type **) calloc(dest->num_data, sizeof(fann_type *));
+ if(dest->input == NULL)
+ {
+ fann_error((struct fann_error*)data1, FANN_E_CANT_ALLOCATE_MEM);
+ fann_destroy_train(dest);
+ return NULL;
+ }
- train_data->num_data = data1->num_data + data2->num_data;
- train_data->num_input = data1->num_input;
- train_data->num_output = data1->num_output;
+ dest->output = (fann_type **) calloc(dest->num_data, sizeof(fann_type *));
+ if(dest->output == NULL)
+ {
+ fann_error((struct fann_error*)data1, FANN_E_CANT_ALLOCATE_MEM);
+ fann_destroy_train(dest);
+ return NULL;
+ }
- if(((train_data->input =
- (fann_type **) calloc(train_data->num_data, sizeof(fann_type *))) == NULL)
- || ((train_data->output = (fann_type **) calloc(train_data->num_data, sizeof(fann_type *)))
- == NULL))
+ data_input = (fann_type *) calloc(dest->num_input * dest->num_data, sizeof(fann_type));
+ if(data_input == NULL)
{
- fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);
- fann_destroy_train(train_data);
+ fann_error((struct fann_error*)data1, FANN_E_CANT_ALLOCATE_MEM);
+ fann_destroy_train(dest);
return NULL;
}
+ memcpy(data_input, data1->input[0], dest->num_input * data1->num_data * sizeof(fann_type));
+ memcpy(data_input + (dest->num_input*data1->num_data),
+ data2->input[0], dest->num_input * data2->num_data * sizeof(fann_type));
- for(x = 0; x < train_data->num_data; x++)
+ data_output = (fann_type *) calloc(dest->num_output * dest->num_data, sizeof(fann_type));
+ if(data_output == NULL)
{
- if(((train_data->input[x] = (fann_type *) calloc(train_data->num_input,
- sizeof(fann_type))) == NULL)
- ||
- ((train_data->output[x] =
- (fann_type *) calloc(train_data->num_output, sizeof(fann_type))) == NULL))
- {
- fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);
- fann_destroy_train(train_data);
- return NULL;
- }
- memcpy(train_data->input[x],
- (x <
- data1->num_data) ? data1->input[x] : data2->input[x -
- data1->
- num_data],
- train_data->num_input * sizeof(fann_type));
- memcpy(train_data->output[x],
- (x < data1->num_data) ? data1->output[x] : data2->output[x - data1->num_data],
- train_data->num_output * sizeof(fann_type));
- }
-
- return train_data;
+ fann_error((struct fann_error*)data1, FANN_E_CANT_ALLOCATE_MEM);
+ fann_destroy_train(dest);
+ return NULL;
+ }
+ memcpy(data_output, data1->output[0], dest->num_output * data1->num_data * sizeof(fann_type));
+ memcpy(data_output + (dest->num_output*data1->num_data),
+ data2->output[0], dest->num_output * data2->num_data * sizeof(fann_type));
+
+ for(i = 0; i != dest->num_data; i++)
+ {
+ dest->input[i] = data_input;
+ data_input += dest->num_input;
+ dest->output[i] = data_output;
+ data_output += dest->num_output;
+ }
+ return dest;
}
/*
@@ -467,11 +484,12 @@ FANN_EXTERNAL struct fann_train_data *FANN_API fann_duplicate_train_data(struct
if(dest == NULL)
{
- fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);
+ fann_error((struct fann_error*)data, FANN_E_CANT_ALLOCATE_MEM);
return NULL;
}
fann_init_error_data((struct fann_error *) dest);
+ dest->error_log = data->error_log;
dest->num_data = data->num_data;
dest->num_input = data->num_input;
@@ -479,7 +497,7 @@ FANN_EXTERNAL struct fann_train_data *FANN_API fann_duplicate_train_data(struct
dest->input = (fann_type **) calloc(dest->num_data, sizeof(fann_type *));
if(dest->input == NULL)
{
- fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);
+ fann_error((struct fann_error*)data, FANN_E_CANT_ALLOCATE_MEM);
fann_destroy_train(dest);
return NULL;
}
@@ -487,7 +505,7 @@ FANN_EXTERNAL struct fann_train_data *FANN_API fann_duplicate_train_data(struct
dest->output = (fann_type **) calloc(dest->num_data, sizeof(fann_type *));
if(dest->output == NULL)
{
- fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);
+ fann_error((struct fann_error*)data, FANN_E_CANT_ALLOCATE_MEM);
fann_destroy_train(dest);
return NULL;
}
@@ -495,7 +513,7 @@ FANN_EXTERNAL struct fann_train_data *FANN_API fann_duplicate_train_data(struct
data_input = (fann_type *) calloc(dest->num_input * dest->num_data, sizeof(fann_type));
if(data_input == NULL)
{
- fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);
+ fann_error((struct fann_error*)data, FANN_E_CANT_ALLOCATE_MEM);
fann_destroy_train(dest);
return NULL;
}
@@ -504,7 +522,7 @@ FANN_EXTERNAL struct fann_train_data *FANN_API fann_duplicate_train_data(struct
data_output = (fann_type *) calloc(dest->num_output * dest->num_data, sizeof(fann_type));
if(data_output == NULL)
{
- fann_error(NULL, FANN_E_CANT_ALLOCATE_MEM);
+ fann_error((struct fann_error*)data, FANN_E_CANT_ALLOCATE_MEM);
fann_destroy_train(dest);
return NULL;
}
@@ -520,6 +538,93 @@ FANN_EXTERNAL struct fann_train_data *FANN_API fann_duplicate_train_data(struct
return dest;
}
+FANN_EXTERNAL struct fann_train_data *FANN_API fann_subset_train_data(struct fann_train_data
+ *data, unsigned int pos,
+ unsigned int length)
+{
+ unsigned int i;
+ fann_type *data_input, *data_output;
+ struct fann_train_data *dest =
+ (struct fann_train_data *) malloc(sizeof(struct fann_train_data));
+
+ if(dest == NULL)
+ {
+ fann_error((struct fann_error*)data, FANN_E_CANT_ALLOCATE_MEM);
+ return NULL;
+ }
+
+ if(pos > data->num_data || pos+length > data->num_data)
+ {
+ fann_error((struct fann_error*)data, FANN_E_TRAIN_DATA_SUBSET, pos, length, data->num_data);
+ return NULL;
+ }
+
+ fann_init_error_data((struct fann_error *) dest);
+ dest->error_log = data->error_log;
+
+ dest->num_data = length;
+ dest->num_input = data->num_input;
+ dest->num_output = data->num_output;
+ dest->input = (fann_type **) calloc(dest->num_data, sizeof(fann_type *));
+ if(dest->input == NULL)
+ {
+ fann_error((struct fann_error*)data, FANN_E_CANT_ALLOCATE_MEM);
+ fann_destroy_train(dest);
+ return NULL;
+ }
+
+ dest->output = (fann_type **) calloc(dest->num_data, sizeof(fann_type *));
+ if(dest->output == NULL)
+ {
+ fann_error((struct fann_error*)data, FANN_E_CANT_ALLOCATE_MEM);
+ fann_destroy_train(dest);
+ return NULL;
+ }
+
+ data_input = (fann_type *) calloc(dest->num_input * dest->num_data, sizeof(fann_type));
+ if(data_input == NULL)
+ {
+ fann_error((struct fann_error*)data, FANN_E_CANT_ALLOCATE_MEM);
+ fann_destroy_train(dest);
+ return NULL;
+ }
+ memcpy(data_input, data->input[pos], dest->num_input * dest->num_data * sizeof(fann_type));
+
+ data_output = (fann_type *) calloc(dest->num_output * dest->num_data, sizeof(fann_type));
+ if(data_output == NULL)
+ {
+ fann_error((struct fann_error*)data, FANN_E_CANT_ALLOCATE_MEM);
+ fann_destroy_train(dest);
+ return NULL;
+ }
+ memcpy(data_output, data->output[pos], dest->num_output * dest->num_data * sizeof(fann_type));
+
+ for(i = 0; i != dest->num_data; i++)
+ {
+ dest->input[i] = data_input;
+ data_input += dest->num_input;
+ dest->output[i] = data_output;
+ data_output += dest->num_output;
+ }
+ return dest;
+}
+
+FANN_EXTERNAL unsigned int FANN_API fann_length_train_data(struct fann_train_data *data)
+{
+ return data->num_data;
+}
+
+FANN_EXTERNAL unsigned int FANN_API fann_num_input_train_data(struct fann_train_data *data)
+{
+ return data->num_input;
+}
+
+FANN_EXTERNAL unsigned int FANN_API fann_num_output_train_data(struct fann_train_data *data)
+{
+ return data->num_output;
+}
+
+
/*
* INTERNAL FUNCTION Reads training data from a file descriptor.
*/
diff --git a/src/include/fann_cascade.h b/src/include/fann_cascade.h
index f0f8cf9..517938b 100644
--- a/src/include/fann_cascade.h
+++ b/src/include/fann_cascade.h
@@ -26,15 +26,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/* Group: Cascade Training */
-/* Function: fann_cascadetrain_on_data_callback
+/* Function: fann_cascadetrain_on_data
*/
-FANN_EXTERNAL void fann_cascadetrain_on_data_callback(struct fann *ann,
+FANN_EXTERNAL void fann_cascadetrain_on_data(struct fann *ann,
struct fann_train_data *data,
- float desired_error,
- int (*callback) (unsigned int epochs,
- float error),
unsigned int max_out_epochs,
- unsigned int neurons_between_reports);
+ unsigned int neurons_between_reports,
+ float desired_error);
/* Group: Parameters */
diff --git a/src/include/fann_data.h b/src/include/fann_data.h
index f70c025..f7f108c 100644
--- a/src/include/fann_data.h
+++ b/src/include/fann_data.h
@@ -39,10 +39,28 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
after each time it is presented an input pattern, while batch only alters the weights once after
it has been presented to all the patterns.
- FANN_TRAIN_INCREMENTAL - Standard backpropagation incremental or online training
- FANN_TRAIN_BATCH - Standard backpropagation batch training
- FANN_TRAIN_RPROP - The iRprop- training algorithm
- FANN_TRAIN_QUICKPROP - The Quickprop training algorithm
+ FANN_TRAIN_INCREMENTAL - Standard backpropagation algorithm, where the weights are
+ updated after each training pattern. This means that the weights are updated many
+ times during a single epoch. For this reason some problems, will train very fast with
+ this algorithm, while other more advanced problems will not train very well.
+ FANN_TRAIN_BATCH - Standard backpropagation algorithm, where the weights are updated after
+ calculating the mean square error for the whole training set. This means that the weights
+ are only updated once during a epoch. For this reason some problems, will train slower with
+ this algorithm. But since the mean square error is calculated more correctly than in
+ incremental training, some problems will reach a better solutions with this algorithm.
+ FANN_TRAIN_RPROP - A more advanced batch training algorithm which achieves good results
+ for many problems. The RPROP training algorithm is adaptive, and does therefore not
+ use the learning_rate. Some other parameters can however be set to change the way the
+ RPROP algorithm works, but it is only recommended for users with insight in how the RPROP
+ training algorithm works. The RPROP training algorithm is described by
+ [Riedmiller and Braun, 1993], but the actual learning algorithm used here is the
+ iRPROP- training algorithm which is described by [Igel and Husken, 2000] which
+ is an variety of the standard RPROP training algorithm.
+ FANN_TRAIN_QUICKPROP - A more advanced batch training algorithm which achieves good results
+ for many problems. The quickprop training algorithm uses the learning_rate parameter
+ along with other more advanced parameters, but it is only recommended to change these
+ advanced parameters, for users with insight in how the quickprop training algorithm works.
+ The quickprop training algorithm is described by [Fahlman, 1988].
See also:
<fann_set_training_algorithm>, <fann_get_training_algorithm>
diff --git a/src/include/fann_error.h b/src/include/fann_error.h
index dbb82c1..60f617e 100644
--- a/src/include/fann_error.h
+++ b/src/include/fann_error.h
@@ -49,6 +49,7 @@ struct fann_error;
FANN_E_CANT_USE_ACTIVATION - Unable to use the selected activation function
FANN_E_TRAIN_DATA_MISMATCH - Irreconcilable differences between two <struct fann_train_data> structures
FANN_E_CANT_USE_TRAIN_ALG - Unable to use the selected training algorithm
+ FANN_E_TRAIN_DATA_SUBSET - Trying to take subset which is not within the training set
*/
enum fann_errno_enum
{
@@ -67,7 +68,8 @@ enum fann_errno_enum
FANN_E_CANT_TRAIN_ACTIVATION,
FANN_E_CANT_USE_ACTIVATION,
FANN_E_TRAIN_DATA_MISMATCH,
- FANN_E_CANT_USE_TRAIN_ALG
+ FANN_E_CANT_USE_TRAIN_ALG,
+ FANN_E_TRAIN_DATA_SUBSET
};
/* Group: Error Handling */
diff --git a/src/include/fann_train.h b/src/include/fann_train.h
index fd43252..d63c7bf 100644
--- a/src/include/fann_train.h
+++ b/src/include/fann_train.h
@@ -212,6 +212,7 @@ FANN_EXTERNAL void FANN_API fann_train_on_file(struct fann *ann, char *filename,
This function appears in FANN >= 1.2.0.
*/
FANN_EXTERNAL float FANN_API fann_train_epoch(struct fann *ann, struct fann_train_data *data);
+#endif /* NOT FIXEDFANN */
/* Function: fann_test_data
@@ -311,7 +312,9 @@ FANN_EXTERNAL void FANN_API fann_scale_train_data(struct fann_train_data *train_
/* Function: fann_merge_train_data
- Merges the data from data1 and data2 into a new <struct fann_train_data>training data into a single struct.
+ Merges the data from *data1* and *data2* into a new <struct fann_train_data>.
+
+ This function appears in FANN >= 1.1.0.
*/
FANN_EXTERNAL struct fann_train_data *FANN_API fann_merge_train_data(struct fann_train_data *data1,
struct fann_train_data *data2);
@@ -319,17 +322,69 @@ FANN_EXTERNAL struct fann_train_data *FANN_API fann_merge_train_data(struct fann
/* Function: fann_duplicate_train_data
- return a copy of a fann_train_data struct
+ Returns an exact copy of a <struct fann_train_data>.
+
+ This function appears in FANN >= 1.1.0.
*/
FANN_EXTERNAL struct fann_train_data *FANN_API fann_duplicate_train_data(struct fann_train_data
*data);
+
+/* Function: fann_subset_train_data
+
+ Returns an copy of a subset of the <struct fann_train_data>, starting at position *pos*
+ and *length* elements forward.
+
+ >fann_subset_train_data(train_data, 0, fann_length_train_data(train_data))
+
+ Will do the same as <fann_duplicate_train_data>.
+
+ See also:
+ <fann_length_train_data>
+ This function appears in FANN >= 2.0.0.
+ */
+FANN_EXTERNAL struct fann_train_data *FANN_API fann_subset_train_data(struct fann_train_data
+ *data, unsigned int pos,
+ unsigned int length);
+
+/* Function: fann_length_train_data
+
+ Returns the number of training patterns in the <struct fann_train_data>.
-#endif /* NOT FIXEDFANN */
+ This function appears in FANN >= 2.0.0.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_length_train_data(struct fann_train_data *data);
+
+/* Function: fann_num_input_train_data
+
+ Returns the number of inputs in each of the training patterns in the <struct fann_train_data>.
+
+ See also:
+ <fann_num_train_data>, <fann_num_output_train_data>
+
+ This function appears in FANN >= 2.0.0.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_num_input_train_data(struct fann_train_data *data);
+
+/* Function: fann_num_input_train_data
+
+ Returns the number of outputs in each of the training patterns in the <struct fann_train_data>.
+
+ See also:
+ <fann_num_train_data>, <fann_num_input_train_data>
+
+ This function appears in FANN >= 2.0.0.
+ */
+FANN_EXTERNAL unsigned int FANN_API fann_num_output_train_data(struct fann_train_data *data);
/* Function: fann_save_train
- Save the training structure to a file.
+ Save the training structure to a file, with the format as specified in <fann_read_train_from_file>
+
+ See also:
+ <fann_read_train_from_file>, <fann_save_train_to_fixed>
+
+ This function appears in FANN >= 1.0.0.
*/
FANN_EXTERNAL void FANN_API fann_save_train(struct fann_train_data *data, char *filename);
@@ -337,7 +392,13 @@ FANN_EXTERNAL void FANN_API fann_save_train(struct fann_train_data *data, char *
/* Function: fann_save_train_to_fixed
Saves the training structure to a fixed point data file.
- * (Very usefull for testing the quality of a fixed point network).
+
+ This function is very usefull for testing the quality of a fixed point network.
+
+ See also:
+ <fann_save_train>
+
+ This function appears in FANN >= 1.0.0.
*/
FANN_EXTERNAL void FANN_API fann_save_train_to_fixed(struct fann_train_data *data, char *filename,
unsigned int decimal_point);
@@ -347,7 +408,18 @@ FANN_EXTERNAL void FANN_API fann_save_train_to_fixed(struct fann_train_data *dat
/* Function: fann_get_training_algorithm
- Get the training algorithm.
+ Return the training algorithm as described by <fann_train_enum>. This training algorithm
+ is used by <fann_train_on_data> and associated functions.
+
+ Note that this algorithm is also used during <fann_cascadetrain_on_data>, although only
+ FANN_TRAIN_RPROP and FANN_TRAIN_QUICKPROP is allowed during cascade training.
+
+ The default training algorithm is FANN_TRAIN_RPROP.
+
+ See also:
+ <fann_set_training_algorithm>, <fann_train_enum>
+
+ This function appears in FANN >= 1.0.0.
*/
FANN_EXTERNAL enum fann_train_enum FANN_API fann_get_training_algorithm(struct fann *ann);
@@ -355,6 +427,10 @@ FANN_EXTERNAL enum fann_train_enum FANN_API fann_get_training_algorithm(struct f
/* Function: fann_set_training_algorithm
Set the training algorithm.
+
+ More info available in <fann_get_training_algorithm>
+
+ This function appears in FANN >= 1.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_training_algorithm(struct fann *ann,
enum fann_train_enum training_algorithm);
@@ -362,7 +438,18 @@ FANN_EXTERNAL void FANN_API fann_set_training_algorithm(struct fann *ann,
/* Function: fann_get_learning_rate
- Get the learning rate.
+ Return the learning rate.
+
+ The learning rate is used to determine how aggressive training should be for some of the
+ training algorithms (FANN_TRAIN_INCREMENTAL, FANN_TRAIN_BATCH, FANN_TRAIN_QUICKPROP).
+ Do however note that it is not used in FANN_TRAIN_RPROP.
+
+ The default learning rate is 0.7.
+
+ See also:
+ <fann_set_learning_rate>, <fann_set_training_algorithm>
+
+ This function appears in FANN >= 1.0.0.
*/
FANN_EXTERNAL float FANN_API fann_get_learning_rate(struct fann *ann);
@@ -370,9 +457,57 @@ FANN_EXTERNAL float FANN_API fann_get_learning_rate(struct fann *ann);
/* Function: fann_set_learning_rate
Set the learning rate.
+
+ More info available in <fann_get_learning_rate>
+
+ This function appears in FANN >= 1.0.0.
*/
FANN_EXTERNAL void FANN_API fann_set_learning_rate(struct fann *ann, float learning_rate);
+/* Function: fann_set_activation_function
+
+ Set the activation function for neuron number *neuron* in layer number *layer*,
+ counting the input layer as layer 0.
+
+ It is not possible to set activation functions for the neurons in the input layer.
+
+ TODO description about the activation function
+
+ TODO implement
+
+ The default activation function is FANN_SIGMOID_STEPWISE.
+
+ See also:
+ <fann_set_activation_function_layer>, <fann_set_activation_function_hidden>,
+ <fann_set_activation_function_output>, <fann_set_activation_steepness>
+
+ This function appears in FANN >= 2.0.0.
+ */
+FANN_EXTERNAL void FANN_API fann_set_activation_function(struct fann *ann,
+ enum fann_activationfunc_enum
+ activation_function,
+ unsigned int layer,
+ unsigned int neuron);
+
+/* Function: fann_set_activation_function_layer
+
+ Set the activation function for all the neurons in the layer number *layer*,
+ counting the input layer as layer 0.
+
+ It is not possible to set activation functions for the neurons in the input layer.
+
+ TODO implement
+
+ See also:
+ <fann_set_activation_function>, <fann_set_activation_function_hidden>,
+ <fann_set_activation_function_output>, <fann_set_activation_steepness_layer>
+
+ This function appears in FANN >= 2.0.0.
+ */
+FANN_EXTERNAL void FANN_API fann_set_activation_function_layer(struct fann *ann,
+ enum fann_activationfunc_enum
+ activation_function,
+ unsigned int layer);
/* Function: fann_set_activation_function_hidden
@@ -391,6 +526,49 @@ FANN_EXTERNAL void FANN_API fann_set_activation_function_output(struct fann *ann
enum fann_activationfunc_enum
activation_function);
+/* Function: fann_set_activation_steepness
+
+ Set the activation steepness for neuron number *neuron* in layer number *layer*,
+ counting the input layer as layer 0.
+
+ It is not possible to set activation steepness for the neurons in the input layer.
+
+ TODO description about the steepness
+
+ TODO implement
+
+ The default activation steepness is 0.5.
+
+ See also:
+ <fann_set_activation_steepness_layer>, <fann_set_activation_steepness_hidden>,
+ <fann_set_activation_steepness_output>, <fann_set_activation_function>
+
+ This function appears in FANN >= 2.0.0.
+ */
+FANN_EXTERNAL void FANN_API fann_set_activation_steepness(struct fann *ann,
+ fann_type steepness,
+ unsigned int layer,
+ unsigned int neuron);
+
+/* Function: fann_set_activation_steepness_layer
+
+ Set the activation steepness all of the neurons in layer number *layer*,
+ counting the input layer as layer 0.
+
+ It is not possible to set activation steepness for the neurons in the input layer.
+
+ TODO implement
+
+ See also:
+ <fann_set_activation_steepness>, <fann_set_activation_steepness_hidden>,
+ <fann_set_activation_steepness_output>, <fann_set_activation_function>
+
+ This function appears in FANN >= 2.0.0.
+ */
+FANN_EXTERNAL void FANN_API fann_set_activation_steepness_layer(struct fann *ann,
+ fann_type steepness,
+ unsigned int neuron);
+
/* Function: fann_set_activation_steepness_hidden
Set the steepness of the sigmoid function used in the hidden layers.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libfann.git
More information about the debian-science-commits
mailing list