getting submatrices from an existing sparse CSR matrix


Is there any way in NGSolve to get submatrices from an existing sparse CSR matrix (i.e. extracting rows, columns, or small matrices from a sparse matrix of CSR format).

I am grateful for any explanation

Here are my python script and output file.

Hi Elsakori,

no, you cannot. You CAN export the whole matrix to scipy (using mat.CSR() or mat.COO()), and get the sub-matrices view scipy.

Within NGSolve we can invert sub-matrices, as we need for preconditioning. Either one ‘large’ one using sparse direct factorization, or many ‘small’ ones using dense matrix operations, see more in the tutorials:


PS: you missed the attachment

Hello Joachim,
Thank you so much. Actually this is what I did, But I thought that there is another way in NGSolve.