Code:
map<string, int> Fmap;
vector<map<string,int> > kFmap;
cout << "... Indexing feature-values ... ";
for (unsigned int k = 0; k < spec.features.size(); k++){
//Fmap.resize(spec.features.size());
for (int i = 3; i <= argc; i++){
dataset_loader loader(argv[i]);
Fmap[namesmap[i]] = spec.features[k].load(loader);
}
kFmap[k] = Fmap;
Fmap.empty();
}
cout << "OK" << endl;
this one gave a seg fault
have also tried:
Code:
map<string, int> Fmap;
vector<map<string,int> > kFmap;
cout << "... Indexing feature-values ... ";
for (unsigned int k = 0; k < spec.features.size(); k++){
//Fmap.resize(spec.features.size());
for (int i = 3; i <= argc; i++){
dataset_loader loader(argv[i]);
Fmap[namesmap[i]] = spec.features[k].load(loader);
}
kFmap.push_back(Fmap);
Fmap.empty();
}
cout << "OK" << endl;
this one worked, but I'm afraid it has been done incorrectly, because after I execute a similar loop following this, my program breaks RIGHT AFTER the "cout << "OK" << endl; of the 2nd block of code posted ABOVE. Here is the THIRD block of code that follows the SECOND (the FIRST is no longer in the picture):
[
Code:
// Index P(F) matrices
cout << "... Indexing P(F) matrices ...";
vector<vector<int> > kF;
vector<int> F;
for (unsigned int k = 0; k < spec.features.size(); k++){
F.resize(spec.features[k].max_val());
for (int i = 3; i <= argc; i++){
F[kFmap[k][namesmap[i]]]++;
}
kF.push_back(F);
F.clear();
cout << "k = " << k << endl;
}
cout << "OK" << endl;
for (unsigned int i = 0; i < kF.size(); i++){
for (unsigned int j = 0; j < kF[i].size(); j++){
cout << kF[i][j] << " ";
}
cout << endl;
}
for this part of code, the program runs all of this code, but then gives me the *** glibc detected *** entropy: free(): invalid next size (normal): 0x0875ccb0 *** error. When i remove
Code:
for (unsigned int i = 0; i < kF.size(); i++){
for (unsigned int j = 0; j < kF[i].size(); j++){
cout << kF[i][j] << " ";
}
cout << endl;
}
from code the third code block, it runs about halfway (k = 32, but k=53 normally), and gives *** glibc detected *** entropy: munmap_chunk(): invalid pointer: 0x08752d88 ***