x <- Matrix(rnorm(9), 3, 3)
lu(x)
pm <- as(readMM(system.file("external/pores_1.mtx",
package = "Matrix")),
"CsparseMatrix")
str(pmLU <- lu(pm)) # p is a 0-based permutation of the rows
# q is a 0-based permutation of the columns
## permute rows and columns of original matrix
ppm <- pm[pmLU@p + 1:1, pmLU@q + 1:1]
ppm[1:14, 1:5]
(pmLU@L %*% pmLU@U)[1:14, 1:5] # product can have extra zeros
Run the code above in your browser using DataLab