#include #include #include #include #include #include using namespace boost::assign; using namespace std; int main ( int arg_count, char *arg_vec[] ) { vector 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; vectorrowIndex; rowIndex += 1, 2, 3, 4, 5, 1, 3, 1, 2, 1, 2, 1, 2; vectorcolIndex; colIndex += 1, 2, 3, 4 ,5, 5, 3, 2, 1, 3, 3, 4, 4; vectormatDim; matDim += 5,5; // M always equal to N vector theP; theP += 0.4, 0.2, 0.2, 0.2, 0.2; vector 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; }