ALGLIB forum
It is currently Wed Dec 06, 2023 2:00 pm

All times are UTC

Forum rules

1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: minbleicsetscale throws ap_error
PostPosted: Thu Jan 26, 2012 5:11 pm 

Joined: Sat Jan 21, 2012 7:00 pm
Posts: 3
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'.

#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;
   alglib::real_1d_array lscale;
   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.


 Post subject: Re: minbleicsetscale throws ap_error
PostPosted: Fri Jan 27, 2012 5:32 am 
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 894

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:

   .... 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

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group