SmartInv

Large sparse matrix inversion. Returns block diagonal, tridiagonal or pentadiagonal elements.
668 Downloads
Updated 26 Jun 2009

View License

Returns block mono, tri or penta diagonal elements of the inverse of a symetric square matrix.

Useful for large sparse matrix which LU decomposition is easy to compute for. Not the fastest way to compute inverse matrix, but avoid memory problem of a full matrix storage.

Optional progressive diagonal computation display. Useful to quickly observe an important modification on the diagonal.

% Q = smartinv(N) returns the N^-1. N is a square symetric matrix n x n.
%
% Q = smartinv(N,blocksize) returns the block (blocksize x blocksize)
% diagonal elements of N^-1.
%
% Q = smartinv(N,blocksize,type) returns the block type-diagonal
% elements of N^-1 type can be mono, tri or penta. The type
% determines the inclusion of diagonal block computation,
% i.e there is redundancy for tri (25%) and for penta (~45%).
%
% Q = smartinv(N,blocksize,position) returns the block diagonal elements
% of N^-1 at position. Q is blocksize x blocksize if position
% is a single value or n x n if posistion is a vector. If
% position is not set, the block values will be computed in an
% order so the curve shape will appear progressively (if graph
% displaymode is used).
%
% Q = smartinv(N,blocksize,...,'displaymode',displaymodevalue) specifies
% process graphical display: none, waitbar (default), graph.
% If position exists and is scalar, no display is set up at all.
% Graph mode will draw a curve for each diagonal element of block
% (i.e. a block represents an epoch, and each element of a block
% a variable to display).
%
% Q = smartinv(N,blocksize,...,'linelegend',linelegendvalue) where
% linelegendvalue is a cell array of string specifying legend
% strings to display for each block element (used for graph
% display mode).
%
% Q = smartinv(N,blocksize,...,'linecolor',linecolorvalue) where
% linecolorvalue is a cell array of color string or RGB value
% to display for each block element (used for graph display mode).
%
% Q = smartinv(N,blocksize,...,'linefunction',linefunctionname) where
% linefunctionname is a function called to display value in
% graph displaymode. linefunctionname can be a string (the same
% function will be used for each element in the block) or a cell
% array of strings of blocksize length.

Cite As

Rouzaud Denis (2026). SmartInv (https://www.mathworks.com/matlabcentral/fileexchange/24513-smartinv), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Operating on Diagonal Matrices in Help Center and MATLAB Answers
Version Published Release Notes
1.6.0.0

corrected bug line 283 and 284.