#include <vnl_sparse_lu.h>
Encapsulating Sparse 1.3 by Kenneth S. Kundert. The matrix is factored before solution. Any number of b vectors can be applied after the matrix is factored with out recomputation of the LU form. It is advised to construct with mode==estimate_condition and check that rcond()>sqrt(machine precision). If this is not the case the solution may be suspect. An upper bound on error is provided. The solution of M^t x = b is also available.
Definition at line 32 of file vnl_sparse_lu.h.
Public Types | |
| enum | operation { quiet, verbose, estimate_condition, estimate_condition_verbose } |
| Modes of computation. See constructor for details. More... | |
Public Member Functions | |
| vnl_sparse_lu (vnl_sparse_matrix< double > const &M, operation mode=quiet) | |
| Make sparse_lu decomposition of M optionally computing the reciprocal condition number. | |
| ~vnl_sparse_lu () | |
| void | set_pivot_thresh (double pivot_thresh) |
| set the relative pivot threshold should be between 0 and 1. | |
| void | set_absolute_thresh (double absolute_thresh) |
| set the threshold on absolute element magnitude for pivoting. | |
| void | set_diagonal_pivoting (int diag_pivoting) |
| set diagonal pivoting mode, normally 1 which gives priority to diagonal elements. | |
| vnl_vector< double > | solve (vnl_vector< double > const &b) |
| Solve problem M x = b. | |
| void | solve (vnl_vector< double > const &b, vnl_vector< double > *x) |
| Solve problem M x = b. | |
| vnl_vector< double > | solve_transpose (vnl_vector< double > const &b) |
| Solve problem M^t x = b. | |
| void | solve_transpose (vnl_vector< double > const &b, vnl_vector< double > *x) |
| Solve problem M^t x = b. | |
| double | determinant () |
| Compute determinant. | |
| double | rcond () |
| Return reciprocal condition number (smallest/largest singular values). | |
| double | max_error_bound () |
| An estimate of maximum error in solution. | |
Protected Member Functions | |
| void | decompose_matrix () |
| bool | est_condition () |
| estimate the condition number. | |
Protected Attributes | |
| vnl_sparse_matrix< double > | A_ |
| bool | factored_ |
| bool | condition_computed_ |
| operation | mode_ |
| double | norm_ |
| double | rcond_ |
| double | largest_ |
| double | pivot_thresh_ |
| double | absolute_thresh_ |
| int | diag_pivoting_ |
Private Member Functions | |
| vnl_sparse_lu (vnl_sparse_lu const &that) | |
| Copy constructor - privatised to avoid it being used. | |
| vnl_sparse_lu & | operator= (vnl_sparse_lu const &that) |
| Assignment operator - privatised to avoid it being used. | |
Private Attributes | |
| spMatrix | pmatrix_ |
| The internal matrix representation. | |
| vnl_sparse_lu::vnl_sparse_lu | ( | vnl_sparse_matrix< double > const & | M, | |
| operation | mode = quiet | |||
| ) |
Make sparse_lu decomposition of M optionally computing the reciprocal condition number.
Definition at line 19 of file vnl_sparse_lu.cxx.
| vnl_sparse_lu::~vnl_sparse_lu | ( | ) |
Definition at line 13 of file vnl_sparse_lu.cxx.
| vnl_sparse_lu::vnl_sparse_lu | ( | vnl_sparse_lu const & | that | ) | [private] |
Copy constructor - privatised to avoid it being used.
| void vnl_sparse_lu::set_pivot_thresh | ( | double | pivot_thresh | ) | [inline] |
set the relative pivot threshold should be between 0 and 1.
If set to one then pivoting is complete and slow If near zero then roundoff error may be prohibitive but compuation is fast Typical values are between 0.01 and 0.1.
Definition at line 51 of file vnl_sparse_lu.h.
| void vnl_sparse_lu::set_absolute_thresh | ( | double | absolute_thresh | ) | [inline] |
set the threshold on absolute element magnitude for pivoting.
Should be either zero or significantly smaller than the absolute value of the smallest diagonal element.
Definition at line 56 of file vnl_sparse_lu.h.
| void vnl_sparse_lu::set_diagonal_pivoting | ( | int | diag_pivoting | ) | [inline] |
set diagonal pivoting mode, normally 1 which gives priority to diagonal elements.
Definition at line 58 of file vnl_sparse_lu.h.
| vnl_vector< double > vnl_sparse_lu::solve | ( | vnl_vector< double > const & | b | ) |
| void vnl_sparse_lu::solve | ( | vnl_vector< double > const & | b, | |
| vnl_vector< double > * | x | |||
| ) |
| vnl_vector< double > vnl_sparse_lu::solve_transpose | ( | vnl_vector< double > const & | b | ) |
| void vnl_sparse_lu::solve_transpose | ( | vnl_vector< double > const & | b, | |
| vnl_vector< double > * | x | |||
| ) |
| double vnl_sparse_lu::determinant | ( | ) |
| double vnl_sparse_lu::rcond | ( | ) |
Return reciprocal condition number (smallest/largest singular values).
As long as rcond()>sqrt(precision) the decomposition can be used for solving equations safely. Not calculated unless operation mode at construction includes estimate_condition.
Definition at line 276 of file vnl_sparse_lu.cxx.
| double vnl_sparse_lu::max_error_bound | ( | ) |
An estimate of maximum error in solution.
Not calculated unless operation mode at construction includes estimate_condition.
Definition at line 290 of file vnl_sparse_lu.cxx.
| void vnl_sparse_lu::decompose_matrix | ( | ) | [protected] |
| bool vnl_sparse_lu::est_condition | ( | ) | [protected] |
| vnl_sparse_lu& vnl_sparse_lu::operator= | ( | vnl_sparse_lu const & | that | ) | [private] |
Assignment operator - privatised to avoid it being used.
vnl_sparse_matrix<double> vnl_sparse_lu::A_ [protected] |
Definition at line 95 of file vnl_sparse_lu.h.
bool vnl_sparse_lu::factored_ [protected] |
Definition at line 96 of file vnl_sparse_lu.h.
bool vnl_sparse_lu::condition_computed_ [protected] |
Definition at line 97 of file vnl_sparse_lu.h.
operation vnl_sparse_lu::mode_ [protected] |
Definition at line 98 of file vnl_sparse_lu.h.
double vnl_sparse_lu::norm_ [protected] |
Definition at line 99 of file vnl_sparse_lu.h.
double vnl_sparse_lu::rcond_ [protected] |
Definition at line 100 of file vnl_sparse_lu.h.
double vnl_sparse_lu::largest_ [protected] |
Definition at line 101 of file vnl_sparse_lu.h.
double vnl_sparse_lu::pivot_thresh_ [protected] |
Definition at line 102 of file vnl_sparse_lu.h.
double vnl_sparse_lu::absolute_thresh_ [protected] |
Definition at line 103 of file vnl_sparse_lu.h.
int vnl_sparse_lu::diag_pivoting_ [protected] |
Definition at line 104 of file vnl_sparse_lu.h.
spMatrix vnl_sparse_lu::pmatrix_ [private] |
1.5.1