I am considering alternative ways of doing matrix multiplication. Instead of storing my matrix as a two-dimensional array, I use a vector like
vector<pair<pair<int,int >,int > >
to save my matrix. The pair inside my pair (s) stores my indices (i, j), and the other int stores the value for this pair (i, j). I thought I would be able to implement my sparse array this way.
The problem is that I am trying to multiply this matrix by myself.
If it was an implementation of an array of the 2nd array, I would multiply the matrix as follows:
for(i=0; i<row1; i++)
{
for(j=0; j<col1; j++)
{
C[i][j] = 0;
for(k=0; k<col2; k++)
C[i][j] += A[i][j] * A[j][k];
}
}
Can someone point out a way to achieve the same result using my pair pair vector?
thank