Some operations of sparse matrices (multiplication, exponentiation, addition, transposition)_Can sparse matrices be multiplied with ordinary matrices_sundial dreams’ blog
I believe everyone knows the matrix, and some common operations, such as multiplication and addition, I believe everyone is familiar with it. Take matrix multiplication as an example. Is the conventional implementation of the computer just a three-layer for? long[][] sum = new long[n][m]; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) for (int k = 0; k < l; k++) sum[i][j] += a[i][k] * b[k][j]; What about sparse matrices? First introduce the sparse matrix. To put it bluntly, most of the positions in the matrix are 0, and only a small part is not 0, just like the matrix below . . . . . . . . . . . . . . . . \\ 0 & 1 & 0 & 1 & 0\\ 0 & 2 & 0 & 0 & 0\\ 0 & 0 & 1 & 0 & 0\\ 0 & 4 & 0 & 0 & 1 \end{pmatrix}” class=”mathcode” src=”https://private.codecogs.com/gif.latex?%5Clarge%20%20%20%5Cbegin%7Bpmatrix%7D%200%20%26%200%20%26%200%20%26%200%20%26%200%5C%5C%200%20%26%201%20%26%200%20%20%20%26%201%20%26%200%5C%5C%200%20%26%202%20%26%200%20%26%200%20%26%200%5C%5C%200%20%20%20%26%200%20%26%201%20%26%200%20%26%200%5C%5C%200%20%26%204%20%26%200%20%26%200%20%26%20%20%201%20%5Cend%7Bpmatrix%7D”> In terms of storage, if there is a two-dimensional array in the conventional matrix storage method, a lot of space must be wasted, so we can use the adjacency list in graph theory…