comparison 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
comparison
equal deleted inserted replaced
7788:45f5faba05a2 7789:82be108cc558
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 31
32 #include "CmplxCHOL.h" 32 #include "CmplxCHOL.h"
33 #include "dbleCHOL.h" 33 #include "dbleCHOL.h"
34 #include "fCmplxCHOL.h"
35 #include "floatCHOL.h"
34 #include "SparseCmplxCHOL.h" 36 #include "SparseCmplxCHOL.h"
35 #include "SparsedbleCHOL.h" 37 #include "SparsedbleCHOL.h"
36 #include "oct-spparms.h" 38 #include "oct-spparms.h"
37 #include "sparse-util.h" 39 #include "sparse-util.h"
38 40
224 } 226 }
225 } 227 }
226 else 228 else
227 gripe_wrong_type_arg ("chol", arg); 229 gripe_wrong_type_arg ("chol", arg);
228 } 230 }
231 else if (arg.is_single_type ())
232 {
233 if (arg.is_real_type ())
234 {
235 FloatMatrix m = arg.float_matrix_value ();
236
237 if (! error_state)
238 {
239 octave_idx_type info;
240 FloatCHOL fact (m, info);
241 if (nargout == 2 || info == 0)
242 {
243 retval(1) = static_cast<float> (info);
244 if (LLt)
245 retval(0) = fact.chol_matrix ().transpose ();
246 else
247 retval(0) = fact.chol_matrix ();
248 }
249 else
250 error ("chol: matrix not positive definite");
251 }
252 }
253 else if (arg.is_complex_type ())
254 {
255 FloatComplexMatrix m = arg.float_complex_matrix_value ();
256
257 if (! error_state)
258 {
259 octave_idx_type info;
260 FloatComplexCHOL fact (m, info);
261 if (nargout == 2 || info == 0)
262 {
263 retval(1) = static_cast<float> (info);
264 if (LLt)
265 retval(0) = fact.chol_matrix ().hermitian ();
266 else
267 retval(0) = fact.chol_matrix ();
268 }
269 else
270 error ("chol: matrix not positive definite");
271 }
272 }
273 else
274 gripe_wrong_type_arg ("chol", arg);
275 }
229 else 276 else
230 { 277 {
231 if (arg.is_real_type ()) 278 if (arg.is_real_type ())
232 { 279 {
233 Matrix m = arg.matrix_value (); 280 Matrix m = arg.matrix_value ();