我的问题出在以下代码中(win8 x64,visual studio):
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define ARMA_USE_BLAS
#define ARMA_USE_LAPACK
#include <armadillo>
using namespace std;
using namespace arma;
int main() {
int b_mean = 20;
int b_max = 4 * b_mean;
double p = 0.04265748215642;
double F_bmax = 1 - pow((1 - p), (b_max + 1));
double alpha = 0.1;
vector<double> THR(EMAXRANGE + 1, 0);
vector <vector <int> > q_finali(EMAXRANGE + 1, vector <int>(4, 0));
const int MAX_E = 8;
const int ORDINE = (int) pow((MAX_E + 1), 2);
printf("EMAX=%d \n", MAX_E);
const int etilde = (int) ceil((double) (MAX_E) / 2);
//costruisco index
vector <vector <int> > index(ORDINE, vector <int>(2, 0));
int riga = 0;
int i, j;
for (i = 0; i <= MAX_E; i++) {
for (j = 0; j <= MAX_E; j++) {
index[riga][0] = i;
index[riga][1] = j;
//printf("i=%d, j=%d, riga=%d \n",i,j,riga);
riga++;
}
}
// costruisco Q
vector <vector <int> > Q((2 * MAX_E) + 1, vector <int>(2, 0));
Q[0][0] = 0; Q[0][1] = 0;
riga = 1;
for (j = 1; j <= MAX_E; j++) {
Q[riga][0] = 0;
Q[riga][1] = j;
riga++;
}
for (i = 1; i <= MAX_E; i++) {
Q[riga][0] = i;
Q[riga][1] = 0;
riga++;
}
int q_LL, q_LH, q_HL, q_HH;
double G_max = 0;
vector <vector <double> > P(ORDINE, vector <double>(ORDINE, 0));
vector <double> g(ORDINE);
int row;
int tmp1;
int tmp2;
double rew;
double temp;
#pragma omp parallel for
for (q_HH = 1; q_HH <= (2 * MAX_E); q_HH++) {
printf("q_HH=%d \n", q_HH);
mat A = mat(ORDINE, ORDINE);
/////// other things //////////
}
}
一切正常,直到矩阵定义发生错误。这是我的输出:
'Prova.exe' (Win32): caricamento di 'C:\Users\Davide\Documents\Visual Studio 2012\Projects\Prova\Debug\Prova.exe' completato. Simboli caricati.
'Prova.exe' (Win32): caricamento di 'C:\Windows\SysWOW64\ntdll.dll' completato. Impossibile trovare o aprire il file PDB.
'Prova.exe' (Win32): caricamento di 'C:\Program Files\AVAST Software\Avast\snxhk.dll' completato. Impossibile trovare o aprire il file PDB.
'Prova.exe' (Win32): caricamento di 'C:\Windows\SysWOW64\kernel32.dll' completato. Impossibile trovare o aprire il file PDB.
'Prova.exe' (Win32): caricamento di 'C:\Windows\SysWOW64\KernelBase.dll' completato. Impossibile trovare o aprire il file PDB.
'Prova.exe' (Win32): caricamento di 'C:\Windows\SysWOW64\msvcp110d.dll' completato. Simboli caricati.
'Prova.exe' (Win32): caricamento di 'C:\Windows\SysWOW64\msvcr110d.dll' completato. Simboli caricati.
'Prova.exe' (Win32): caricamento di 'C:\Windows\SysWOW64\vcomp110d.dll' completato. Simboli caricati.
'Prova.exe' (Win32): caricamento di 'C:\Windows\SysWOW64\user32.dll' completato. Impossibile trovare o aprire il file PDB.
'Prova.exe' (Win32): caricamento di 'C:\Windows\SysWOW64\gdi32.dll' completato. Impossibile trovare o aprire il file PDB.
'Prova.exe' (Win32): caricamento di 'C:\Windows\SysWOW64\imm32.dll' completato. Impossibile trovare o aprire il file PDB.
'Prova.exe' (Win32): caricamento di 'C:\Windows\SysWOW64\msctf.dll' completato. Impossibile trovare o aprire il file PDB.
'Prova.exe' (Win32): caricamento di 'C:\Windows\SysWOW64\msvcrt.dll' completato. Impossibile trovare o aprire il file PDB.
Debug Assertion Failed!
Program: C:\Windows\SYSTEM32\MSVCP110D.dll
File: c:\program files (x86)\microsoft visual studio 11.0\vc\include\vector
Line: 1140
Expression: vector subscript out of range
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
Second Chance Assertion Failed: File c:\program files (x86)\microsoft visual studio 11.0\vc\include\vector, Line 1140
Prova.exe ha avviato un punto di interruzione.
我认为这是由矩阵定义引起的,好像我评论那条线都运行顺利。
这是错误消息的翻译:
'Prova.exe' (Win32): loading of 'C:\Users\Davide\Documents\Visual Studio 2012\Projects\Prova\Debug\Prova.exe' completed. Symbols loaded.
'Prova.exe' (Win32): loading of 'C:\Windows\SysWOW64\ntdll.dll' completed. Impossible to find or open the PDB file.
'Prova.exe' (Win32): loading of 'C:\Program Files\AVAST Software\Avast\snxhk.dll' completed. Impossible to find or open the PDB file.
'Prova.exe' (Win32): loading of 'C:\Windows\SysWOW64\kernel32.dll' completed. Impossible to find or open the PDB file.
'Prova.exe' (Win32): loading of 'C:\Windows\SysWOW64\KernelBase.dll' completed. Impossible to find or open the PDB file.
'Prova.exe' (Win32): loading of 'C:\Windows\SysWOW64\msvcp110d.dll' completed. Symbols loaded.
'Prova.exe' (Win32): loading of 'C:\Windows\SysWOW64\msvcr110d.dll' completed. Symbols loaded.
'Prova.exe' (Win32): loading of 'C:\Windows\SysWOW64\vcomp110d.dll' completato. Symbols loaeded.
'Prova.exe' (Win32): loading of 'C:\Windows\SysWOW64\user32.dll' completed. Impossible to find or open the PDB file.
'Prova.exe' (Win32): loading of 'C:\Windows\SysWOW64\gdi32.dll' completed. Impossible to find or open the PDB file.
'Prova.exe' (Win32): loading of 'C:\Windows\SysWOW64\imm32.dll' completed. Impossible to find or open the PDB file.
'Prova.exe' (Win32): loading of 'C:\Windows\SysWOW64\msctf.dll' completed. Impossible to find or open the PDB file.
'Prova.exe' (Win32): loading of 'C:\Windows\SysWOW64\msvcrt.dll' completed. Impossible to find or open the PDB file.
Debug Assertion Failed!
Program: C:\Windows\SYSTEM32\MSVCP110D.dll
File: c:\program files (x86)\microsoft visual studio 11.0\vc\include\vector
Line: 1140
Expression: vector subscript out of range
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
Second Chance Assertion Failed: File c:\program files (x86)\microsoft visual studio 11.0\vc\include\vector, Line 1140
Prova.exe has run an interruption point.