|
I am attempting to build a dll from some functions that
were written in C, but I am running into some compiler
errors. I am writting code in the dll as follows:
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include "stdafx.h"
#include "NeuralGenetic.h"
#include <valarray>
#include <iostream>
#include <iomanip>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
using namespace std;
static int transfer (double *v, int n, int sel)
{
double tp, x, tx, cons; int hundreds, init;
valarray<double> va1(n);
/* set threshold neuron */
hundreds = (sel / 100) % 10;
if (hundreds == 0) v[n] = 1.0;
else if (hundreds == 1) v[n] = 0.0;
else if (hundreds == 2) v[n] = -1.0;
else return -1;
switch (sel % 100) {
// standard short-tailed sigmoid transfer
function
case 1:
init = n;
while (n--) {
va1[init-n] = *v;
v++;
}
va1 = 1.0 / (exp (-va1) + 1.0);
for (int j = 0; j < init; j++)
v[j] = va1[j];
return 0;
}
The problem is that I get error messages such as C2059
and C2334, C2143 which in turn refer bach to the
valarray.h header file.
The purpose of this routine is to generate a vector v
that contains values raised to an exponential. This
format of designating a valarray and using it follows
closely with examples given.
What do you think is the problem here?
David |