Mercurial > hg > octave-lyh
comparison liboctave/CSparse.cc @ 8335:64cf956a109c
templatize & fix DET
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 19 Nov 2008 11:23:07 +0100 |
parents | b11c31849b44 |
children | 8b1a2555c4e2 |
comparison
equal
deleted
inserted
replaced
8334:70dd33450061 | 8335:64cf956a109c |
---|---|
1112 octave_idx_type nr = rows (); | 1112 octave_idx_type nr = rows (); |
1113 octave_idx_type nc = cols (); | 1113 octave_idx_type nc = cols (); |
1114 | 1114 |
1115 if (nr == 0 || nc == 0 || nr != nc) | 1115 if (nr == 0 || nc == 0 || nr != nc) |
1116 { | 1116 { |
1117 Complex d[2]; | 1117 retval = ComplexDET (1.0); |
1118 d[0] = 1.0; | |
1119 d[1] = 0.0; | |
1120 retval = ComplexDET (d); | |
1121 } | 1118 } |
1122 else | 1119 else |
1123 { | 1120 { |
1124 err = 0; | 1121 err = 0; |
1125 | 1122 |
1199 } | 1196 } |
1200 else | 1197 else |
1201 { | 1198 { |
1202 UMFPACK_ZNAME (report_numeric) (Numeric, control); | 1199 UMFPACK_ZNAME (report_numeric) (Numeric, control); |
1203 | 1200 |
1204 Complex d[2]; | 1201 double c10[2], e10; |
1205 double d_exponent; | 1202 |
1206 | 1203 status = UMFPACK_ZNAME (get_determinant) (c10, 0, &e10, |
1207 status = UMFPACK_ZNAME (get_determinant) | 1204 Numeric, info); |
1208 (reinterpret_cast<double *> (&d[0]), 0, &d_exponent, | |
1209 Numeric, info); | |
1210 d[1] = d_exponent; | |
1211 | 1205 |
1212 if (status < 0) | 1206 if (status < 0) |
1213 { | 1207 { |
1214 (*current_liboctave_error_handler) | 1208 (*current_liboctave_error_handler) |
1215 ("SparseComplexMatrix::determinant error calculating determinant"); | 1209 ("SparseComplexMatrix::determinant error calculating determinant"); |
1216 | 1210 |
1217 UMFPACK_ZNAME (report_status) (control, status); | 1211 UMFPACK_ZNAME (report_status) (control, status); |
1218 UMFPACK_ZNAME (report_info) (control, info); | 1212 UMFPACK_ZNAME (report_info) (control, info); |
1219 } | 1213 } |
1220 else | 1214 else |
1221 retval = ComplexDET (d); | 1215 retval = ComplexDET (Complex (c10[0], c10[1]), e10, 10); |
1222 | 1216 |
1223 UMFPACK_ZNAME (free_numeric) (&Numeric); | 1217 UMFPACK_ZNAME (free_numeric) (&Numeric); |
1224 } | 1218 } |
1225 } | 1219 } |
1226 } | 1220 } |