# solving triadiagonal (and banded in general) systems of linear equations Classic List Threaded 4 messages Open this post in threaded view
|

## solving triadiagonal (and banded in general) systems of linear equations

 Hello, performing web search I quickly came across http://www.gnu.org/software/octave/doc/interpreter/Basic-Matrix-Functions.html -> matrix_type , and in the latter I read: " 'banded' 'banded positive definite' Banded matrix with the band size of nl below the diagonal and nu above it.  If nl and nu are 1, then the matrix is tridiagonal and treated with specialized code.  In addition the matrix can be marked as probably a positive definite.  (Sparse matrices only) ... Note that the matrix type will be discovered automatically on the first attempt to solve a linear equation involving A.  Therefore matrix_type is only useful to give Octave hints of the matrix type. Incorrectly defining the matrix type will result in incorrect results from solutions of linear equations; it is entirely the responsibility of the user to correctly identify the matrix type. ". So, do I understand it correctly, that I simply need to provide matrix to the solver, and it will detect automatically that the matrix is banded and choose the most optimal algorithm ? Matrix size is about 200 * 200, so do I need to specify it as a sparse matrix, or regular matrix should be OK ? Number of elements is about 4e4, the matrix is real, i.e. it should occupy 3.2e5 bytes which is not much by modern standards. Thanks,   Sergei. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: solving triadiagonal (and banded in general) systems of linear equations

 On 26 September 2012 18:48, Sergei Steshenko <[hidden email]> wrote: > So, do I understand it correctly, that I simply need to provide > matrix to the solver, and it will detect automatically that the > matrix is banded and choose the most optimal algorithm ?     http://hg.savannah.gnu.org/hgweb/octave/file/46dd555edd33/liboctave/array/MatrixType.cc#l268Note that the argument for this function is a sparse matrix, so the check only occurs for sparse matrices. For full matrices the check is      http://hg.savannah.gnu.org/hgweb/octave/file/46dd555edd33/liboctave/array/MatrixType.cc#l60only upper, lower, and hermitian matrices. No bandedness is checked if the matrix isn't of sparse type. This is consistent with the documentation:     octave:1> x = toeplitz ([1 2 0 0 0 0]); y = toeplitz ([1 2 3 0 0 0]);     octave:2> matrix_type (x), matrix_type (y)     ans = Full     ans = Full     octave:3> matrix_type (sparse (x)), matrix_type (sparse (y))     ans = Tridiagonal     ans = Banded HTH, - Jordi G. H. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave