By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,356 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,356 IT Pros & Developers. It's quick & easy.

Question about using math functions

P: n/a
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

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
case 1:
init = n;
while (n--) {
va1[init-n] = *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?

Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.