Dear Oshalla,
Just to let you know. I've ported your ingenious code
to C++. They are so indispensable! Thanks a million again.
#include <iostream>
#include <vector>
#include <boost/assign/std/vector.hpp>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace boost::assign;
using namespace std;
int main ( int arg_count, char *arg_vec[] ) {
vector <double> realValue;
realValue +=
0.994704478,
0.989459074,
0.994717023,
1.000000000,
1.000000000,
0.002647761,
0.005282977,
0.000882587,
0.005270463,
0.000882587,
0.002635231,
0.000882587,
0.002635231;
vector<int>rowIndex;
rowIndex += 1, 2, 3, 4, 5, 1, 3, 1, 2, 1, 2, 1, 2;
vector<int>colIndex;
colIndex += 1, 2, 3, 4 ,5, 5, 3, 2, 1, 3, 3, 4, 4;
vector<int>matDim;
matDim += 5,5; // M always equal to N
vector <double> theP;
theP += 0.4, 0.2, 0.2, 0.2, 0.2;
vector <double> Result;
Result.assign(theP.size(), 0);
for (int i= 0; i < rowIndex.size(); i++) {
Result[rowIndex[i]-1] += realValue[i] * theP[colIndex[i]-1];
}
// print it
for (int k =0; k < Result.size(); k++){
cout << Result[k] << endl;
}
return 0;
}
---
neversaint and everlastingly indebted.......