# Incomplete LU decomposition of sparse matrix

I have a sparse matrix stored in CSR format. For this matrix, I would like to get the incomplete LU decomposition. I tried to find algorithms which can utilize the CSR format but I could not find anything. All work, papers, software seem to access the matrix by giving row index and column index like for COO format (A[i,j]).

Yes, this can be done, but I think that doing it this way costs a lot of time for looking for the correct matrix entry in CSR format as one has to iterate through a complete row to find the correct column. Any ideas or papers or git repositories which I haven't found?

If there is no other possibility, what would be the fastest way to access elements in a CSR matrix? Simply iterate through the given row until the defined column is reached?

In terms of implementation, you definitely should take a look at Intel MKL's one. Say, dcsrilu0 and dcsrilut (with threshold) accept the matrix in a DSS format (I linked to a nonsymmetric one), which is a wrapper on top of a three-array CSR storage. (both pages would contain the same matrix as an example).

So, implementation-wise, you should be able to get the ILU from CSR without you reordering yourself.

It also certainly is worth taking a look at SuperLU. However, it works with CCS, natively. Excerpt from the documentation:

The factorization and solve routines in SuperLU are designed to handle column-wise storage only. If the input matrix $$A$$ is in row-oriented storage, i.e., in SLU_NR format, then the driver routines (dgssv() and dgssvx()) actually perform the LU decomposition on $$A^T$$, which is column-wise, and solve the system using the $$L^T$$ and $$U^T$$ factors. The data structures holding $$L$$ and $$U$$ on output are different (swapped) from the data structures you get from column-wise input.

...

Alternatively, the users may call a utility routine dCompRow_to_CompCol() to convert the input matrix in SLU_NR format to another matrix in SLU_NC format, before calling SuperLU.

While the excerpt talks about the full factorize and solve, the same should be true for the incomplete "preconditioner"-related counterparts.

• Thanks for the hint to look at Intel MKL. I missed the most obvious source. Just for information: Intel MKL has a reference to the book of Saad which actually has a Fortran routine. – vydesaster Aug 29 '19 at 20:30
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 6, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.4879119396209717, "perplexity": 1121.854921181649}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-40/segments/1600400211096.40/warc/CC-MAIN-20200923144247-20200923174247-00632.warc.gz"}