forum.alglib.net http://forum.alglib.net/ |
|
minbleicsetscale throws ap_error http://forum.alglib.net/viewtopic.php?f=2&t=528 |
Page 1 of 1 |
Author: | Hen3ry [ Thu Jan 26, 2012 5:11 pm ] |
Post subject: | minbleicsetscale throws ap_error |
I am trying to use the BLEIC optimiser. However, everytime my code gets to minbleicsetscale it terminates after throwing an instance of 'alglib::ap_error'. Code: #include <stdio.h> #include <cstdio> #include <cmath> #include <math.h> #include <stdlib.h> #define TWO_PI 6.28318530732959 #define PI 3.14159255 //include libraries #include <string> //for joining the strings #include <sstream> //for naming the output files. #include <iostream> #include <omp.h> #include <ctime> //for random numbers #include <cstdlib> //for srand() and rand() #include <iostream> #include "/hwdisks/home/al544/ALGLIB/cpp/src/stdafx.h" #include "/hwdisks/home/al544/ALGLIB/cpp/src/ap.h" #include "/hwdisks/home/al544/ALGLIB/cpp/src/ap.cpp" #include "/hwdisks/home/al544/ALGLIB/cpp/src/linalg.h" #include "/hwdisks/home/al544/ALGLIB/cpp/src/linalg.cpp" #include "/hwdisks/home/al544/ALGLIB/cpp/src/alglibinternal.h" #include "/hwdisks/home/al544/ALGLIB/cpp/src/alglibmisc.h" #include "/hwdisks/home/al544/ALGLIB/cpp/src/alglibinternal.cpp" #include "/hwdisks/home/al544/ALGLIB/cpp/src/alglibmisc.cpp" #include "/hwdisks/home/al544/ALGLIB/cpp/src/solvers.h" #include "/hwdisks/home/al544/ALGLIB/cpp/src/solvers.cpp" #include "/hwdisks/home/al544/ALGLIB/cpp/src/interpolation.h" #include "/hwdisks/home/al544/ALGLIB/cpp/src/interpolation.cpp" #include "/hwdisks/home/al544/ALGLIB/cpp/src/specialfunctions.cpp" #include "/hwdisks/home/al544/ALGLIB/cpp/src/specialfunctions.h" #include "/hwdisks/home/al544/ALGLIB/cpp/src/statistics.cpp" #include "/hwdisks/home/al544/ALGLIB/cpp/src/statistics.h" #include "/hwdisks/home/al544/ALGLIB/cpp/src/optimization.cpp" #include "/hwdisks/home/al544/ALGLIB/cpp/src/optimization.h" #include "/hwdisks/home/al544/ALGLIB/cpp/src/integration.cpp" #include "/hwdisks/home/al544/ALGLIB/cpp/src/integration.h" using namespace std; int main (int argc, char* argv[]) { int lenJ = 400; double diffstep = 1e-6; alglib::minbleicstate bleicstate; alglib::minbleicreport bleicrep; alglib::real_1d_array lambdaJguess; lambdaJguess.setlength(lenJ); alglib::real_1d_array lscale; lscale.setlength(lenJ); for (int i = 0; i < lenJ; i++) { lambdaJguess[i] = 0.0; lscale[i] = 10.*double(i); } alglib::minbleiccreatef(lenJ, lambdaJguess, diffstep, bleicstate); printf("after creating minbleiccreatef\n"); alglib::minbleicsetscale(bleicstate, lscale); printf("after setting scale\n"); return 0; } This is simply a cut-down code, to show the problem. Any suggestions would be welcomed. Thanks. |
Author: | Sergey.Bochkanov [ Fri Jan 27, 2012 5:32 am ] |
Post subject: | Re: minbleicsetscale throws ap_error |
Hello! You've passed incorrect scale - first component is zero. If you enclose your code in the try/catch, you will be able to get short description of the error in the msg field of the ap_error instance: Code: try { .... your code .... } catch(alglib::ap_error e) { printf("error msg: %s\n", e.msg.c_str()); } Code above will print msg: MinBLEICSetScale: S contains zero elements |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |