wolfwolf
11-12-2008, 03:30 AM
Hi there,
I am using amoeba in visual studio 9 and am having a few problems.
Here is the relevant piece of code:
#include "amoeba.h"
#include "function.h"
main(){
Amoeba am(0.001);
vector<double> point;
for (int i=0; i<3; i++) point.push_back(0);
vector<double> dels(3);
vector<double> pmin;
func sinusoid;
pmin = am.minimize(point,dels,sinusoid);
}
I have declared my function as a structure in function.h (see code below):
struct func {
vector<double> operator() (const double x){
vector <double> ans(3);
ans[0] = 1.;
ans[1] = x ;
ans[2] = sin(x) ;
return ans;
}
};
When I try to compile with "cl - EHsc myProgram.cpp", I get the following error message:
myProgram.cpp
myProgram.cpp(687) : error C2780: 'std::vector<_Ty> Amoeba::minimize(MatDoub_I &,std::vector<_Ty> &)' : expects 2 arguments - 3 provided
with
[
_Ty=double
]
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\amoeba.h(30) : see declaration of 'Amoeba::minimize'
myProgram.cpp(687) : error C2783: 'std::vector<_Ty> Amoeba::minimize(std::vector<_Ty> &,std::vector<_Ty> &,std::vector<_Ty> &)' : could not deduc
e template argument for 'T'
with
[
_Ty=double
]
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\amoeba.h(18) : see declaration of 'Amoeba::minimize'
myProgram.cpp(687) : error C2783: 'std::vector<_Ty> Amoeba::minimize(std::vector<_Ty> &,double,std::vector<_Ty> &)' : could not deduce template a
rgument for 'T'
with
[
_Ty=double
]
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\amoeba.h(12) : see declaration of 'Amoeba::minimize'
Could anyone please suggest why the appropriate template is not being recognised? There are three distinct templates, yet the compiler does not seem to recognise that. Any help would be very much appreciated.
Many thanks.
Wolf
I am using amoeba in visual studio 9 and am having a few problems.
Here is the relevant piece of code:
#include "amoeba.h"
#include "function.h"
main(){
Amoeba am(0.001);
vector<double> point;
for (int i=0; i<3; i++) point.push_back(0);
vector<double> dels(3);
vector<double> pmin;
func sinusoid;
pmin = am.minimize(point,dels,sinusoid);
}
I have declared my function as a structure in function.h (see code below):
struct func {
vector<double> operator() (const double x){
vector <double> ans(3);
ans[0] = 1.;
ans[1] = x ;
ans[2] = sin(x) ;
return ans;
}
};
When I try to compile with "cl - EHsc myProgram.cpp", I get the following error message:
myProgram.cpp
myProgram.cpp(687) : error C2780: 'std::vector<_Ty> Amoeba::minimize(MatDoub_I &,std::vector<_Ty> &)' : expects 2 arguments - 3 provided
with
[
_Ty=double
]
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\amoeba.h(30) : see declaration of 'Amoeba::minimize'
myProgram.cpp(687) : error C2783: 'std::vector<_Ty> Amoeba::minimize(std::vector<_Ty> &,std::vector<_Ty> &,std::vector<_Ty> &)' : could not deduc
e template argument for 'T'
with
[
_Ty=double
]
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\amoeba.h(18) : see declaration of 'Amoeba::minimize'
myProgram.cpp(687) : error C2783: 'std::vector<_Ty> Amoeba::minimize(std::vector<_Ty> &,double,std::vector<_Ty> &)' : could not deduce template a
rgument for 'T'
with
[
_Ty=double
]
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\amoeba.h(12) : see declaration of 'Amoeba::minimize'
Could anyone please suggest why the appropriate template is not being recognised? There are three distinct templates, yet the compiler does not seem to recognise that. Any help would be very much appreciated.
Many thanks.
Wolf