[libfann] 108/242: Various fixes for MSVC++6
Christian Kastner
chrisk-guest at moszumanska.debian.org
Sat Oct 4 21:10:25 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 73c7216fc0b68420cc92ceac7a857c79bb6acc05
Author: Evan Nemerson <evan at coeus-group.com>
Date: Sat Mar 20 07:50:59 2004 +0000
Various fixes for MSVC++6
---
src/fann.c | 11 +++++++++--
src/fann_error.c | 5 +++++
src/fann_train.c | 4 ++--
src/include/fann_activation.h | 2 +-
src/include/fann_internal.h | 2 +-
5 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/fann.c b/src/fann.c
index 4eb0046..924f7c6 100644
--- a/src/fann.c
+++ b/src/fann.c
@@ -22,12 +22,19 @@
#include <stdarg.h>
#include <string.h>
#include <time.h>
+#include <math.h>
#include "config.h"
#include "fann.h"
#include "fann_errno.h"
-
+#ifdef _MSC_VER
+/* MSVC++6 does not have powf in math.h
+ */
+float powf(float _X, float _Y){
+ return ((float)pow((double)_X, (double)_Y));
+}
+#endif
/* create a neural network.
*/
@@ -43,7 +50,7 @@ struct fann * fann_create(float connection_rate, float learning_rate,
int i = 0;
va_start(layer_sizes, num_layers);
- for ( i=0 ; i<num_layers ; i++ ) {
+ for ( i=0 ; i<(int)num_layers ; i++ ) {
layers[i] = va_arg(layer_sizes, unsigned int);
}
va_end(layer_sizes);
diff --git a/src/fann_error.c b/src/fann_error.c
index 70e5585..b1b4c04 100644
--- a/src/fann_error.c
+++ b/src/fann_error.c
@@ -26,6 +26,11 @@
#include "fann.h"
#include "fann_errno.h"
+#ifdef _MSC_VER
+#define vsnprintf _vsnprintf
+#define snprintf _snprintf
+#endif
+
/* resets the last error number
*/
void fann_reset_errno(struct fann_error *errdat)
diff --git a/src/fann_train.c b/src/fann_train.c
index 94a68e7..6f9ddf6 100644
--- a/src/fann_train.c
+++ b/src/fann_train.c
@@ -143,7 +143,7 @@ void fann_train(struct fann *ann, fann_type *input, fann_type *desired_output)
for(neuron_it = (layer_it-1)->first_neuron;
neuron_it != last_neuron; neuron_it++){
neuron_value = neuron_it->value;
- neuron_value = fann_clip(neuron_value, 0.01, 0.99);
+ neuron_value = fann_clip(neuron_value, 0.01f, 0.99f);
*delta_it *= (fann_type)fann_sigmoid_derive(activation_hidden_steepness, neuron_value);
#ifdef DEBUGTRAIN
printf("delta3[%d] = "FANNPRINTF" *= fann_sigmoid_derive(%f, %f) * %f\n", (delta_it - delta_begin), *delta_it, activation_hidden_steepness, neuron_value, learning_rate);
@@ -156,7 +156,7 @@ void fann_train(struct fann *ann, fann_type *input, fann_type *desired_output)
for(neuron_it = (layer_it-1)->first_neuron;
neuron_it != last_neuron; neuron_it++){
neuron_value = neuron_it->value;
- neuron_value = fann_clip(neuron_value, -0.98, 0.98);
+ neuron_value = fann_clip(neuron_value, -0.98f, 0.98f);
*delta_it *= (fann_type)fann_sigmoid_symmetric_derive(activation_hidden_steepness, neuron_value);
#ifdef DEBUGTRAIN
printf("delta3[%d] = "FANNPRINTF" *= fann_sigmoid_symmetric_derive(%f, %f) * %f\n", (delta_it - delta_begin), *delta_it, activation_hidden_steepness, neuron_value, learning_rate);
diff --git a/src/include/fann_activation.h b/src/include/fann_activation.h
index bd31c2c..10b11aa 100644
--- a/src/include/fann_activation.h
+++ b/src/include/fann_activation.h
@@ -119,7 +119,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/* FANN_SIGMOID_SYMMETRIC */
#define fann_sigmoid_symmetric(steepness, value) (2.0/(1.0 + exp(-2.0 * steepness * value)) - 1.0)
-#define fann_sigmoid_symmetric_derive(steepness, value) steepness * (1.0 - (value*value))
+#define fann_sigmoid_symmetric_derive(steepness, value) steepness * (1.0f - (value*value))
/* FANN_GAUSSIAN */
#define fann_gaussian(steepness, value) (exp(-value * steepness * value * steepness))
diff --git a/src/include/fann_internal.h b/src/include/fann_internal.h
index 033c5ad..53691a0 100644
--- a/src/include/fann_internal.h
+++ b/src/include/fann_internal.h
@@ -50,7 +50,7 @@ void fann_seed_rand();
void fann_update_stepwise_hidden(struct fann *ann);
void fann_update_stepwise_output(struct fann *ann);
-void fann_error(struct fann_error *errdat, unsigned int errno, ...);
+void fann_error(struct fann_error *errdat, const unsigned int errno, ...);
void fann_init_error_data(struct fann_error *errdat);
struct fann * fann_create_from_fd(FILE *conf, const char *configuration_file);
--
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