Transpose of a sparse matrix is not a sparse matrix?

I don’t understand what is happening here:

julia> transpose(sparse(Matrix(1I, 5, 5)))
5×5 Transpose{Int64,SparseMatrixCSC{Int64,Int64}}:
 1  0  0  0  0
 0  1  0  0  0
 0  0  1  0  0
 0  0  0  1  0
 0  0  0  0  1

What is the type Transpose{Int64,SparseMatrixCSC{Int64,Int64}}? Why the transpose of SparseMatrixCSC{Int64,Int64} is not of the same type?

1 Like

The Transpose is a wrapper that avoids copying any data. It behaves like the original matrix transposed. The same will happen if you transpose a normal array, or any other array for that matter.

5 Likes