Mercurial > hg > octave-nkf
comparison liboctave/numeric/SparseCmplxLU.cc @ 17769:49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
* liboctave/array/Array-C.cc, liboctave/array/Array-b.cc,
liboctave/array/Array-ch.cc, liboctave/array/Array-d.cc,
liboctave/array/Array-f.cc, liboctave/array/Array-fC.cc,
liboctave/array/Array-util.cc, liboctave/array/Array-util.h,
liboctave/array/Array.cc, liboctave/array/Array.h, liboctave/array/Array3.h,
liboctave/array/CColVector.cc, liboctave/array/CColVector.h,
liboctave/array/CDiagMatrix.cc, liboctave/array/CDiagMatrix.h,
liboctave/array/CMatrix.cc, liboctave/array/CMatrix.h,
liboctave/array/CNDArray.cc, liboctave/array/CNDArray.h,
liboctave/array/CRowVector.cc, liboctave/array/CRowVector.h,
liboctave/array/CSparse.cc, liboctave/array/CSparse.h,
liboctave/array/DiagArray2.h, liboctave/array/MArray.cc,
liboctave/array/MArray.h, liboctave/array/MDiagArray2.cc,
liboctave/array/MDiagArray2.h, liboctave/array/MSparse.cc,
liboctave/array/MSparse.h, liboctave/array/MatrixType.cc,
liboctave/array/MatrixType.h, liboctave/array/PermMatrix.h,
liboctave/array/Range.cc, liboctave/array/Range.h, liboctave/array/Sparse.cc,
liboctave/array/Sparse.h, liboctave/array/boolMatrix.cc,
liboctave/array/boolMatrix.h, liboctave/array/boolNDArray.cc,
liboctave/array/boolNDArray.h, liboctave/array/boolSparse.cc,
liboctave/array/boolSparse.h, liboctave/array/chMatrix.cc,
liboctave/array/chMatrix.h, liboctave/array/chNDArray.cc,
liboctave/array/chNDArray.h, liboctave/array/dColVector.h,
liboctave/array/dDiagMatrix.cc, liboctave/array/dDiagMatrix.h,
liboctave/array/dMatrix.cc, liboctave/array/dMatrix.h,
liboctave/array/dNDArray.cc, liboctave/array/dNDArray.h,
liboctave/array/dRowVector.h, liboctave/array/dSparse.cc,
liboctave/array/dSparse.h, liboctave/array/dim-vector.cc,
liboctave/array/dim-vector.h, liboctave/array/fCColVector.cc,
liboctave/array/fCColVector.h, liboctave/array/fCDiagMatrix.cc,
liboctave/array/fCDiagMatrix.h, liboctave/array/fCMatrix.cc,
liboctave/array/fCMatrix.h, liboctave/array/fCNDArray.cc,
liboctave/array/fCNDArray.h, liboctave/array/fCRowVector.cc,
liboctave/array/fCRowVector.h, liboctave/array/fColVector.h,
liboctave/array/fDiagMatrix.cc, liboctave/array/fDiagMatrix.h,
liboctave/array/fMatrix.cc, liboctave/array/fMatrix.h,
liboctave/array/fNDArray.cc, liboctave/array/fNDArray.h,
liboctave/array/fRowVector.h, liboctave/array/idx-vector.cc,
liboctave/array/idx-vector.h, liboctave/array/intNDArray.cc,
liboctave/array/intNDArray.h, liboctave/cruft/misc/blaswrap.c,
liboctave/cruft/misc/quit.cc, liboctave/numeric/CmplxCHOL.cc,
liboctave/numeric/CmplxCHOL.h, liboctave/numeric/CmplxGEPBAL.cc,
liboctave/numeric/CmplxGEPBAL.h, liboctave/numeric/CmplxHESS.h,
liboctave/numeric/CmplxLU.cc, liboctave/numeric/CmplxLU.h,
liboctave/numeric/CmplxQR.cc, liboctave/numeric/CmplxQRP.cc,
liboctave/numeric/CmplxQRP.h, liboctave/numeric/CmplxSCHUR.h,
liboctave/numeric/CmplxSVD.cc, liboctave/numeric/CmplxSVD.h,
liboctave/numeric/CollocWt.h, liboctave/numeric/DAE.h,
liboctave/numeric/DAEFunc.h, liboctave/numeric/DAERT.h,
liboctave/numeric/DAERTFunc.h, liboctave/numeric/DASPK.cc,
liboctave/numeric/DASRT.cc, liboctave/numeric/DASRT.h,
liboctave/numeric/DASSL.cc, liboctave/numeric/DET.h, liboctave/numeric/EIG.cc,
liboctave/numeric/EIG.h, liboctave/numeric/LSODE.cc, liboctave/numeric/ODE.h,
liboctave/numeric/ODEFunc.h, liboctave/numeric/ODES.h,
liboctave/numeric/ODESFunc.h, liboctave/numeric/Quad.cc,
liboctave/numeric/Quad.h, liboctave/numeric/SparseCmplxCHOL.h,
liboctave/numeric/SparseCmplxLU.cc, liboctave/numeric/SparseCmplxLU.h,
liboctave/numeric/SparseCmplxQR.cc, liboctave/numeric/SparseCmplxQR.h,
liboctave/numeric/SparseQR.cc, liboctave/numeric/SparseQR.h,
liboctave/numeric/SparsedbleCHOL.h, liboctave/numeric/SparsedbleLU.cc,
liboctave/numeric/SparsedbleLU.h, liboctave/numeric/base-aepbal.h,
liboctave/numeric/base-dae.h, liboctave/numeric/base-de.h,
liboctave/numeric/base-lu.cc, liboctave/numeric/base-lu.h,
liboctave/numeric/base-min.h, liboctave/numeric/base-qr.h,
liboctave/numeric/bsxfun.h, liboctave/numeric/dbleCHOL.cc,
liboctave/numeric/dbleCHOL.h, liboctave/numeric/dbleGEPBAL.h,
liboctave/numeric/dbleHESS.h, liboctave/numeric/dbleLU.cc,
liboctave/numeric/dbleLU.h, liboctave/numeric/dbleQR.cc,
liboctave/numeric/dbleQRP.cc, liboctave/numeric/dbleQRP.h,
liboctave/numeric/dbleSCHUR.cc, liboctave/numeric/dbleSCHUR.h,
liboctave/numeric/dbleSVD.cc, liboctave/numeric/dbleSVD.h,
liboctave/numeric/eigs-base.cc, liboctave/numeric/fCmplxAEPBAL.cc,
liboctave/numeric/fCmplxAEPBAL.h, liboctave/numeric/fCmplxCHOL.cc,
liboctave/numeric/fCmplxCHOL.h, liboctave/numeric/fCmplxGEPBAL.cc,
liboctave/numeric/fCmplxGEPBAL.h, liboctave/numeric/fCmplxHESS.h,
liboctave/numeric/fCmplxLU.cc, liboctave/numeric/fCmplxLU.h,
liboctave/numeric/fCmplxQR.cc, liboctave/numeric/fCmplxQR.h,
liboctave/numeric/fCmplxQRP.cc, liboctave/numeric/fCmplxQRP.h,
liboctave/numeric/fCmplxSCHUR.cc, liboctave/numeric/fCmplxSCHUR.h,
liboctave/numeric/fCmplxSVD.h, liboctave/numeric/fEIG.cc,
liboctave/numeric/fEIG.h, liboctave/numeric/floatCHOL.cc,
liboctave/numeric/floatCHOL.h, liboctave/numeric/floatGEPBAL.cc,
liboctave/numeric/floatGEPBAL.h, liboctave/numeric/floatHESS.h,
liboctave/numeric/floatLU.cc, liboctave/numeric/floatLU.h,
liboctave/numeric/floatQR.cc, liboctave/numeric/floatQRP.cc,
liboctave/numeric/floatQRP.h, liboctave/numeric/floatSCHUR.cc,
liboctave/numeric/floatSCHUR.h, liboctave/numeric/floatSVD.cc,
liboctave/numeric/floatSVD.h, liboctave/numeric/lo-mappers.cc,
liboctave/numeric/lo-mappers.h, liboctave/numeric/lo-specfun.cc,
liboctave/numeric/lo-specfun.h, liboctave/numeric/oct-convn.cc,
liboctave/numeric/oct-fftw.cc, liboctave/numeric/oct-fftw.h,
liboctave/numeric/oct-norm.cc, liboctave/numeric/oct-rand.cc,
liboctave/numeric/oct-rand.h, liboctave/numeric/randgamma.c,
liboctave/numeric/randgamma.h, liboctave/numeric/randmtzig.c,
liboctave/numeric/randpoisson.c, liboctave/numeric/randpoisson.h,
liboctave/numeric/sparse-base-chol.h, liboctave/numeric/sparse-base-lu.h,
liboctave/numeric/sparse-dmsolve.cc, liboctave/operators/Sparse-diag-op-defs.h,
liboctave/operators/Sparse-op-defs.h, liboctave/operators/mx-inlines.cc,
liboctave/system/dir-ops.h, liboctave/system/file-ops.cc,
liboctave/system/file-stat.cc, liboctave/system/file-stat.h,
liboctave/system/lo-sysdep.cc, liboctave/system/lo-sysdep.h,
liboctave/system/mach-info.cc, liboctave/system/mach-info.h,
liboctave/system/oct-env.cc, liboctave/system/oct-group.cc,
liboctave/system/oct-syscalls.cc, liboctave/system/oct-syscalls.h,
liboctave/system/oct-time.h, liboctave/system/tempname.c,
liboctave/util/action-container.h, liboctave/util/base-list.h,
liboctave/util/cmd-edit.cc, liboctave/util/cmd-edit.h,
liboctave/util/cmd-hist.cc, liboctave/util/cmd-hist.h,
liboctave/util/data-conv.cc, liboctave/util/data-conv.h,
liboctave/util/kpse.cc, liboctave/util/lo-array-gripes.cc,
liboctave/util/lo-cieee.c, liboctave/util/lo-regexp.cc,
liboctave/util/lo-utils.cc, liboctave/util/oct-alloc.cc,
liboctave/util/oct-base64.cc, liboctave/util/oct-binmap.h,
liboctave/util/oct-cmplx.h, liboctave/util/oct-glob.cc,
liboctave/util/oct-inttypes.cc, liboctave/util/oct-inttypes.h,
liboctave/util/oct-locbuf.cc, liboctave/util/oct-locbuf.h,
liboctave/util/oct-mem.h, liboctave/util/oct-mutex.cc,
liboctave/util/oct-refcount.h, liboctave/util/oct-shlib.cc,
liboctave/util/oct-shlib.h, liboctave/util/oct-sort.cc,
liboctave/util/oct-sort.h, liboctave/util/pathsearch.cc,
liboctave/util/pathsearch.h, liboctave/util/sparse-util.cc,
liboctave/util/str-vec.cc, liboctave/util/str-vec.h,
liboctave/util/unwind-prot.h, liboctave/util/url-transfer.cc,
liboctave/util/url-transfer.h: Use GNU style coding conventions.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 26 Oct 2013 18:57:05 -0700 |
parents | d63878346099 |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
17768:271c0cce0f64 | 17769:49a5a4be04a1 |
---|---|
36 // Instantiate the base LU class for the types we need. | 36 // Instantiate the base LU class for the types we need. |
37 | 37 |
38 #include "sparse-base-lu.h" | 38 #include "sparse-base-lu.h" |
39 #include "sparse-base-lu.cc" | 39 #include "sparse-base-lu.cc" |
40 | 40 |
41 template class sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, double>; | 41 template class sparse_base_lu <SparseComplexMatrix, Complex, |
42 SparseMatrix, double>; | |
42 | 43 |
43 #include "oct-sparse.h" | 44 #include "oct-sparse.h" |
44 | 45 |
45 SparseComplexLU::SparseComplexLU (const SparseComplexMatrix& a, | 46 SparseComplexLU::SparseComplexLU (const SparseComplexMatrix& a, |
46 const Matrix& piv_thres, bool scale) | 47 const Matrix& piv_thres, bool scale) |
72 if (!xisnan (tmp)) | 73 if (!xisnan (tmp)) |
73 Control (UMFPACK_PIVOT_TOLERANCE) = tmp; | 74 Control (UMFPACK_PIVOT_TOLERANCE) = tmp; |
74 | 75 |
75 tmp = octave_sparse_params::get_key ("sym_tol"); | 76 tmp = octave_sparse_params::get_key ("sym_tol"); |
76 if (!xisnan (tmp)) | 77 if (!xisnan (tmp)) |
77 Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp; | 78 Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp; |
78 } | 79 } |
79 | 80 |
80 // Set whether we are allowed to modify Q or not | 81 // Set whether we are allowed to modify Q or not |
81 tmp = octave_sparse_params::get_key ("autoamd"); | 82 tmp = octave_sparse_params::get_key ("autoamd"); |
82 if (!xisnan (tmp)) | 83 if (!xisnan (tmp)) |
107 &Symbolic, control, info); | 108 &Symbolic, control, info); |
108 | 109 |
109 if (status < 0) | 110 if (status < 0) |
110 { | 111 { |
111 (*current_liboctave_error_handler) | 112 (*current_liboctave_error_handler) |
112 ("SparseComplexLU::SparseComplexLU symbolic factorization failed"); | 113 ("SparseComplexLU::SparseComplexLU symbolic factorization failed"); |
113 | 114 |
114 UMFPACK_ZNAME (report_status) (control, status); | 115 UMFPACK_ZNAME (report_status) (control, status); |
115 UMFPACK_ZNAME (report_info) (control, info); | 116 UMFPACK_ZNAME (report_info) (control, info); |
116 | 117 |
117 UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; | 118 UMFPACK_ZNAME (free_symbolic) (&Symbolic); |
118 } | 119 } |
119 else | 120 else |
120 { | 121 { |
121 UMFPACK_ZNAME (report_symbolic) (Symbolic, control); | 122 UMFPACK_ZNAME (report_symbolic) (Symbolic, control); |
122 | 123 |
123 void *Numeric; | 124 void *Numeric; |
124 status = UMFPACK_ZNAME (numeric) (Ap, Ai, | 125 status = UMFPACK_ZNAME (numeric) (Ap, Ai, |
125 reinterpret_cast<const double *> (Ax), | 126 reinterpret_cast<const double *> (Ax), |
126 0, Symbolic, &Numeric, control, | 127 0, Symbolic, &Numeric, control, |
127 info); | 128 info); |
128 UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; | 129 UMFPACK_ZNAME (free_symbolic) (&Symbolic); |
129 | 130 |
130 cond = Info (UMFPACK_RCOND); | 131 cond = Info (UMFPACK_RCOND); |
131 | 132 |
132 if (status < 0) | 133 if (status < 0) |
133 { | 134 { |
143 { | 144 { |
144 UMFPACK_ZNAME (report_numeric) (Numeric, control); | 145 UMFPACK_ZNAME (report_numeric) (Numeric, control); |
145 | 146 |
146 octave_idx_type lnz, unz, ignore1, ignore2, ignore3; | 147 octave_idx_type lnz, unz, ignore1, ignore2, ignore3; |
147 status = UMFPACK_ZNAME (get_lunz) (&lnz, &unz, &ignore1, | 148 status = UMFPACK_ZNAME (get_lunz) (&lnz, &unz, &ignore1, |
148 &ignore2, &ignore3, Numeric) ; | 149 &ignore2, &ignore3, Numeric); |
149 | 150 |
150 if (status < 0) | 151 if (status < 0) |
151 { | 152 { |
152 (*current_liboctave_error_handler) | 153 (*current_liboctave_error_handler) |
153 ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); | 154 ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); |
202 0, Up, Uj, | 203 0, Up, Uj, |
203 reinterpret_cast <double *> (Ux), | 204 reinterpret_cast <double *> (Ux), |
204 0, p, q, 0, 0, | 205 0, p, q, 0, 0, |
205 &do_recip, Rx, Numeric); | 206 &do_recip, Rx, Numeric); |
206 | 207 |
207 UMFPACK_ZNAME (free_numeric) (&Numeric) ; | 208 UMFPACK_ZNAME (free_numeric) (&Numeric); |
208 | 209 |
209 if (status < 0) | 210 if (status < 0) |
210 { | 211 { |
211 (*current_liboctave_error_handler) | 212 (*current_liboctave_error_handler) |
212 ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); | 213 ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); |
220 if (do_recip) | 221 if (do_recip) |
221 for (octave_idx_type i = 0; i < nr; i++) | 222 for (octave_idx_type i = 0; i < nr; i++) |
222 Rx[i] = 1.0 / Rx[i]; | 223 Rx[i] = 1.0 / Rx[i]; |
223 | 224 |
224 UMFPACK_ZNAME (report_matrix) (nr, n_inner, | 225 UMFPACK_ZNAME (report_matrix) (nr, n_inner, |
225 Lfact.cidx (), Lfact.ridx (), | 226 Lfact.cidx (), Lfact.ridx (), |
226 reinterpret_cast<double *> (Lfact.data ()), | 227 reinterpret_cast<double *> (Lfact.data ()), |
227 0, 1, control); | 228 0, 1, control); |
228 | 229 |
229 UMFPACK_ZNAME (report_matrix) (n_inner, nc, | 230 UMFPACK_ZNAME (report_matrix) (n_inner, nc, |
230 Ufact.cidx (), Ufact.ridx (), | 231 Ufact.cidx (), Ufact.ridx (), |
231 reinterpret_cast<double *> (Ufact.data ()), | 232 reinterpret_cast<double *> (Ufact.data ()), |
232 0, 1, control); | 233 0, 1, control); |
233 UMFPACK_ZNAME (report_perm) (nr, p, control); | 234 UMFPACK_ZNAME (report_perm) (nr, p, control); |
234 UMFPACK_ZNAME (report_perm) (nc, q, control); | 235 UMFPACK_ZNAME (report_perm) (nc, q, control); |
235 } | 236 } |
236 | 237 |
237 UMFPACK_ZNAME (report_info) (control, info); | 238 UMFPACK_ZNAME (report_info) (control, info); |
310 const octave_idx_type *Ap = a.cidx (); | 311 const octave_idx_type *Ap = a.cidx (); |
311 const octave_idx_type *Ai = a.ridx (); | 312 const octave_idx_type *Ai = a.ridx (); |
312 const Complex *Ax = a.data (); | 313 const Complex *Ax = a.data (); |
313 | 314 |
314 UMFPACK_ZNAME (report_matrix) (nr, nc, Ap, Ai, | 315 UMFPACK_ZNAME (report_matrix) (nr, nc, Ap, Ai, |
315 reinterpret_cast<const double *> (Ax), 0, | 316 reinterpret_cast<const double *> (Ax), 0, |
316 1, control); | 317 1, control); |
317 | 318 |
318 void *Symbolic; | 319 void *Symbolic; |
319 Matrix Info (1, UMFPACK_INFO); | 320 Matrix Info (1, UMFPACK_INFO); |
320 double *info = Info.fortran_vec (); | 321 double *info = Info.fortran_vec (); |
321 int status; | 322 int status; |
322 | 323 |
323 // Null loop so that qinit is imediately deallocated when not | 324 // Null loop so that qinit is imediately deallocated when not |
324 // needed | 325 // needed |
325 do { | 326 do |
326 OCTAVE_LOCAL_BUFFER (octave_idx_type, qinit, nc); | 327 { |
327 | 328 OCTAVE_LOCAL_BUFFER (octave_idx_type, qinit, nc); |
328 for (octave_idx_type i = 0; i < nc; i++) | 329 |
329 qinit[i] = static_cast<octave_idx_type> (Qinit (i)); | 330 for (octave_idx_type i = 0; i < nc; i++) |
330 | 331 qinit[i] = static_cast<octave_idx_type> (Qinit (i)); |
331 status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, | 332 |
332 reinterpret_cast<const double *> (Ax), | 333 status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, |
333 0, qinit, &Symbolic, control, | 334 reinterpret_cast<const double *> (Ax), |
334 info); | 335 0, qinit, &Symbolic, control, |
335 } while (0); | 336 info); |
337 } | |
338 while (0); | |
336 | 339 |
337 if (status < 0) | 340 if (status < 0) |
338 { | 341 { |
339 (*current_liboctave_error_handler) | 342 (*current_liboctave_error_handler) |
340 ("SparseComplexLU::SparseComplexLU symbolic factorization failed"); | 343 ("SparseComplexLU::SparseComplexLU symbolic factorization failed"); |
341 | 344 |
342 UMFPACK_ZNAME (report_status) (control, status); | 345 UMFPACK_ZNAME (report_status) (control, status); |
343 UMFPACK_ZNAME (report_info) (control, info); | 346 UMFPACK_ZNAME (report_info) (control, info); |
344 | 347 |
345 UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; | 348 UMFPACK_ZNAME (free_symbolic) (&Symbolic); |
346 } | 349 } |
347 else | 350 else |
348 { | 351 { |
349 UMFPACK_ZNAME (report_symbolic) (Symbolic, control); | 352 UMFPACK_ZNAME (report_symbolic) (Symbolic, control); |
350 | 353 |
351 void *Numeric; | 354 void *Numeric; |
352 status = UMFPACK_ZNAME (numeric) (Ap, Ai, | 355 status = UMFPACK_ZNAME (numeric) (Ap, Ai, |
353 reinterpret_cast<const double *> (Ax), 0, | 356 reinterpret_cast<const double *> (Ax), 0, |
354 Symbolic, &Numeric, control, info) ; | 357 Symbolic, &Numeric, control, info); |
355 UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; | 358 UMFPACK_ZNAME (free_symbolic) (&Symbolic); |
356 | 359 |
357 cond = Info (UMFPACK_RCOND); | 360 cond = Info (UMFPACK_RCOND); |
358 | 361 |
359 if (status < 0) | 362 if (status < 0) |
360 { | 363 { |
370 { | 373 { |
371 UMFPACK_ZNAME (report_numeric) (Numeric, control); | 374 UMFPACK_ZNAME (report_numeric) (Numeric, control); |
372 | 375 |
373 octave_idx_type lnz, unz, ignore1, ignore2, ignore3; | 376 octave_idx_type lnz, unz, ignore1, ignore2, ignore3; |
374 status = UMFPACK_ZNAME (get_lunz) (&lnz, &unz, | 377 status = UMFPACK_ZNAME (get_lunz) (&lnz, &unz, |
375 &ignore1, &ignore2, &ignore3, Numeric); | 378 &ignore1, &ignore2, &ignore3, |
379 Numeric); | |
376 | 380 |
377 if (status < 0) | 381 if (status < 0) |
378 { | 382 { |
379 (*current_liboctave_error_handler) | 383 (*current_liboctave_error_handler) |
380 ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); | 384 ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); |
388 { | 392 { |
389 octave_idx_type n_inner = (nr < nc ? nr : nc); | 393 octave_idx_type n_inner = (nr < nc ? nr : nc); |
390 | 394 |
391 if (lnz < 1) | 395 if (lnz < 1) |
392 Lfact = SparseComplexMatrix (n_inner, nr, | 396 Lfact = SparseComplexMatrix (n_inner, nr, |
393 static_cast<octave_idx_type> (1)); | 397 static_cast<octave_idx_type> (1)); |
394 else | 398 else |
395 Lfact = SparseComplexMatrix (n_inner, nr, lnz); | 399 Lfact = SparseComplexMatrix (n_inner, nr, lnz); |
396 | 400 |
397 octave_idx_type *Ltp = Lfact.cidx (); | 401 octave_idx_type *Ltp = Lfact.cidx (); |
398 octave_idx_type *Ltj = Lfact.ridx (); | 402 octave_idx_type *Ltj = Lfact.ridx (); |
399 Complex *Ltx = Lfact.data (); | 403 Complex *Ltx = Lfact.data (); |
400 | 404 |
401 if (unz < 1) | 405 if (unz < 1) |
402 Ufact = SparseComplexMatrix (n_inner, nc, | 406 Ufact = SparseComplexMatrix (n_inner, nc, |
403 static_cast<octave_idx_type> (1)); | 407 static_cast<octave_idx_type> (1)); |
404 else | 408 else |
405 Ufact = SparseComplexMatrix (n_inner, nc, unz); | 409 Ufact = SparseComplexMatrix (n_inner, nc, unz); |
406 | 410 |
407 octave_idx_type *Up = Ufact.cidx (); | 411 octave_idx_type *Up = Ufact.cidx (); |
408 octave_idx_type *Uj = Ufact.ridx (); | 412 octave_idx_type *Uj = Ufact.ridx (); |
424 octave_idx_type *q = Q.fortran_vec (); | 428 octave_idx_type *q = Q.fortran_vec (); |
425 | 429 |
426 octave_idx_type do_recip; | 430 octave_idx_type do_recip; |
427 status = | 431 status = |
428 UMFPACK_ZNAME (get_numeric) (Ltp, Ltj, | 432 UMFPACK_ZNAME (get_numeric) (Ltp, Ltj, |
429 reinterpret_cast<double *> (Ltx), | 433 reinterpret_cast<double *> (Ltx), |
430 0, Up, Uj, | 434 0, Up, Uj, |
431 reinterpret_cast<double *> (Ux), | 435 reinterpret_cast<double *> (Ux), |
432 0, p, q, 0, 0, | 436 0, p, q, 0, 0, |
433 &do_recip, Rx, Numeric) ; | 437 &do_recip, Rx, Numeric); |
434 | 438 |
435 UMFPACK_ZNAME (free_numeric) (&Numeric) ; | 439 UMFPACK_ZNAME (free_numeric) (&Numeric); |
436 | 440 |
437 if (status < 0) | 441 if (status < 0) |
438 { | 442 { |
439 (*current_liboctave_error_handler) | 443 (*current_liboctave_error_handler) |
440 ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); | 444 ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); |
448 if (do_recip) | 452 if (do_recip) |
449 for (octave_idx_type i = 0; i < nr; i++) | 453 for (octave_idx_type i = 0; i < nr; i++) |
450 Rx[i] = 1.0 / Rx[i]; | 454 Rx[i] = 1.0 / Rx[i]; |
451 | 455 |
452 UMFPACK_ZNAME (report_matrix) (nr, n_inner, | 456 UMFPACK_ZNAME (report_matrix) (nr, n_inner, |
453 Lfact.cidx (), | 457 Lfact.cidx (), |
454 Lfact.ridx (), | 458 Lfact.ridx (), |
455 reinterpret_cast<double *> (Lfact.data ()), | 459 reinterpret_cast<double *> (Lfact.data ()), |
456 0, 1, control); | 460 0, 1, control); |
457 | 461 |
458 UMFPACK_ZNAME (report_matrix) (n_inner, nc, | 462 UMFPACK_ZNAME (report_matrix) (n_inner, nc, |
459 Ufact.cidx (), | 463 Ufact.cidx (), |
460 Ufact.ridx (), | 464 Ufact.ridx (), |
461 reinterpret_cast<double *> (Ufact.data ()), | 465 reinterpret_cast<double *> (Ufact.data ()), |
462 0, 1, control); | 466 0, 1, control); |
463 UMFPACK_ZNAME (report_perm) (nr, p, control); | 467 UMFPACK_ZNAME (report_perm) (nr, p, control); |
464 UMFPACK_ZNAME (report_perm) (nc, q, control); | 468 UMFPACK_ZNAME (report_perm) (nc, q, control); |
465 } | 469 } |
466 | 470 |
467 UMFPACK_ZNAME (report_info) (control, info); | 471 UMFPACK_ZNAME (report_info) (control, info); |