March 2020
Intermediate to advanced
406 pages
8h 39m
English
A CSC matrix has an identical format to CSR matrices, but with one small difference. The column index slice is the element that is compressed, rather than the row index slice, as we saw within the CSR matrix. This means CSC matrices store their values in column-major order, instead of row-major order. This can also be viewed as a natural transposition of a CSR matrix. We can manipulate the example that we used in the previous section to look at how a CSC matrix is created, as shown in the following code block:
package mainimport ( "fmt" "github.com/james-bowman/sparse" "gonum.org/v1/gonum/mat")func main() { sparseMatrix := sparse.NewDOK(4, 4) sparseMatrix.Set(0, 2, 1) sparseMatrix.Set(1, 0, 2) sparseMatrix.Set(2, 3, 3) sparseMatrix.Set(3, ...Read now
Unlock full access