Mercurial > octave-nkf
diff libinterp/dldfcn/chol.cc @ 15264:94cdf82d4a0c
don't overload meaning of info in Sparse Cholesky factorization functions
* chol.cc (Fchol): New variable, force. Always pass natural
and force to SparseCHOL and SparseComplexCHOL constructors.
* SparsedbleCHOL.h, SparsedbleCHOL.cc (SparseCHOL::SparseCHOL):
New arg, force. Pass it to sparse_base_chol constructor.
* SparseCmplxCHOL.h, SparseCmplxCHOL.cc
(SparseComplexCHOL::SparseComplexCHOL): Likewise.
* sparse-base-chol.h (sparse_base_chol<>::sparse_base_chol_rep::init):
* sparse-base-chol.h, sparse-base-chol.cc
(sparse_base_chol<>::sparse_base_chol_rep::init): Replace nargout
argument with force. Check force, not nargout > 1.
* sparse-base-chol.h
(sparse_base_chol::sparse_base_chol_rep::sparse_base_chol_rep):
New arg, force. Pass it to init.
(sparse_base_chol::sparse_base_chol): New arg force. Pass it to rep
constructor.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 30 Aug 2012 16:57:24 -0400 |
parents | 2fc554ffbc28 |
children | 53eaa83e4181 |
line wrap: on
line diff
--- a/libinterp/dldfcn/chol.cc Thu Aug 30 20:52:40 2012 +0200 +++ b/libinterp/dldfcn/chol.cc Thu Aug 30 16:57:24 2012 -0400 @@ -180,7 +180,6 @@ octave_idx_type nr = arg.rows (); octave_idx_type nc = arg.columns (); - bool natural = (nargout != 3); int arg_is_empty = empty_arg ("chol", nr, nc); @@ -191,14 +190,18 @@ if (arg.is_sparse_type ()) { + octave_idx_type info; + bool natural = (nargout != 3); + bool force = nargout > 1; + if (arg.is_real_type ()) { SparseMatrix m = arg.sparse_matrix_value (); if (! error_state) { - octave_idx_type info = nargout; - SparseCHOL fact (m, info, natural); + SparseCHOL fact (m, info, natural, force); + if (nargout == 3) { if (vecout) @@ -225,8 +228,7 @@ if (! error_state) { - octave_idx_type info = nargout; - SparseComplexCHOL fact (m, info, natural); + SparseComplexCHOL fact (m, info, natural, force); if (nargout == 3) { @@ -405,14 +407,16 @@ { if (arg.is_sparse_type ()) { + octave_idx_type info; + if (arg.is_real_type ()) { SparseMatrix m = arg.sparse_matrix_value (); if (! error_state) { - octave_idx_type info; SparseCHOL chol (m, info); + if (info == 0) retval = chol.inverse (); else @@ -425,8 +429,8 @@ if (! error_state) { - octave_idx_type info; SparseComplexCHOL chol (m, info); + if (info == 0) retval = chol.inverse (); else