Monday, June 3, 2013

Sparse exercise: a potential interface for ITSOL or CRS-based functions

The user wants to factorize this sparse matrix


$ A = \begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 3 & 0 & 0 & 7 \\ 0 & 0 & 4 & 5 & 0 \\ 2 & 0 & 0 & 6 & 0 \\ 0 & 0 & 0 & 0 & 8 \\ \end{pmatrix} $

Get the matrix into Octave

Just provide a Matrix with three columns:

>> A_sparse = spconvert([...
     1 4 2 3 3 4 2 5; % row indices
     1 1 2 3 4 4 5 5; % column indices
     1 2 3 4 5 6 7 8  % non-zero values
     ]')

A_sparse =

Compressed Column Sparse (rows = 5, cols = 5, nnz = 8 [32%])

  (1, 1) ->  1
  (4, 1) ->  2
  (2, 2) ->  3
  (3, 3) ->  4
  (3, 4) ->  5
  (4, 4) ->  6
  (2, 5) ->  7
  (5, 5) ->  8

What needs to be passed to ITSOL

The approach I would favor in order to interface the ITSOL library is to factorize the transposed matrix to avoid timing problems resulting from input and output format conversion.
$ \mathbf{A} = \mathbf{L}\mathbf{U} \Leftrightarrow \mathbf{A^{T}} = \mathbf{U^{T}}\mathbf{L^{T}} $
Conversion with implicit tranposition.

Information on the Octave sparse matrix format:

No comments:

Post a Comment