/= doesn't do what you think it does?
It will make sense once you're done reading...
Code:
for ( ...k++)
for (int i = 0; i <= argc-3; i++){
cout << kFmap[k][namesmap[i]] << " kFmap | ";
cout << F[kFmap[k][namesmap[i]]] << " | ";
F[kFmap[k][namesmap[i]]] /= argc-2;
cout << F[kFmap[k][namesmap[i]]];
cout << endl;
}
I would have something like this as result:
F(before /=) probability(Fafter /=)
1 0.10
1 0.10
1 0.10
3 0.30
1 0.10
1 0.10
3 0.03 --> It took the value above, 0.3, and divided it by the total
1 0.10
1 0.10
1 0.10
..so it took the probability twice on the second value that was the same as a value already calculated! Whats the deal with this? Logically, F[kFmap[k][namesmap[i]]] /= argc-2, should replace the current value of each F value with the divided by (argc-2) value of the current F. Why is it doing dividing the the n-1 value of F for the calculation of F(n). This behavior seems to be recursive as I get multiple divisions for multiple similar values. Removing the identical occuring values is planned but why am I seeing this weird behavior? This behavior may be limited to vectors.
This raises a concern. I want to create a function that takes a vector, and removes multiple occurances of members, like this: vectA = removecopies(vectA). This may not work since vectA is made to equal a called(and modified) instance of itself. Is this the case?