Mercurial > octave-nkf
diff src/DLD-FUNCTIONS/chol.cc @ 7789:82be108cc558
First attempt at single precision tyeps
* * *
corrections to qrupdate single precision routines
* * *
prefer demotion to single over promotion to double
* * *
Add single precision support to log2 function
* * *
Trivial PROJECT file update
* * *
Cache optimized hermitian/transpose methods
* * *
Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author | David Bateman <dbateman@free.fr> |
---|---|
date | Sun, 27 Apr 2008 22:34:17 +0200 |
parents | efccca5f2ad7 |
children | 87865ed7405f |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/chol.cc Wed May 14 18:09:56 2008 +0200 +++ b/src/DLD-FUNCTIONS/chol.cc Sun Apr 27 22:34:17 2008 +0200 @@ -31,6 +31,8 @@ #include "CmplxCHOL.h" #include "dbleCHOL.h" +#include "fCmplxCHOL.h" +#include "floatCHOL.h" #include "SparseCmplxCHOL.h" #include "SparsedbleCHOL.h" #include "oct-spparms.h" @@ -226,6 +228,51 @@ else gripe_wrong_type_arg ("chol", arg); } + else if (arg.is_single_type ()) + { + if (arg.is_real_type ()) + { + FloatMatrix m = arg.float_matrix_value (); + + if (! error_state) + { + octave_idx_type info; + FloatCHOL fact (m, info); + if (nargout == 2 || info == 0) + { + retval(1) = static_cast<float> (info); + if (LLt) + retval(0) = fact.chol_matrix ().transpose (); + else + retval(0) = fact.chol_matrix (); + } + else + error ("chol: matrix not positive definite"); + } + } + else if (arg.is_complex_type ()) + { + FloatComplexMatrix m = arg.float_complex_matrix_value (); + + if (! error_state) + { + octave_idx_type info; + FloatComplexCHOL fact (m, info); + if (nargout == 2 || info == 0) + { + retval(1) = static_cast<float> (info); + if (LLt) + retval(0) = fact.chol_matrix ().hermitian (); + else + retval(0) = fact.chol_matrix (); + } + else + error ("chol: matrix not positive definite"); + } + } + else + gripe_wrong_type_arg ("chol", arg); + } else { if (arg.is_real_type ())