Inverse of sparse matrix

hi there,

How to do a inverse of a sparse matrix? Now i use inv(sptodense()) to realize this, is there any more efficient or specific command for sparse matrix inverse? Thanks.

1 Answer


If you have the available memory to hold the matrix as dense, this is almost certainly the fastest way to perform the operation. It seems wasteful to perform calculations on elements that you already know are zeros. However, on modern computers, the main bottleneck is usually memory access and not arithmetic operations (floating point operations or flops). The GAUSS matrix operations are highly tuned to reuse memory--increasing the arithmetic density from each fetch from memory. In many cases, sparse matrix computations are slower unless the percent of non-zero elements is quite low.

Though I wonder if the matrix inverse is the best operation to use. It is
generally recommended to avoid the matrix inverse because it is a less numerically stable algorithm. Often times a line of code can be reordered in terms of a Cholesky or other matrix decomposition. If you are interested, please post your line of code as a new question and we will see if it is possible to favorably rearrange it.

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy