# HG changeset patch # User jwe # Date 824259023 0 # Node ID 8cb4d3008c76172aaf43995d375ac8406adafd07 # Parent 24f35e425e6af80a20e470759eb2e839a7c29af2 [project @ 1996-02-14 00:45:04 by jwe] diff -r 24f35e425e6a -r 8cb4d3008c76 liboctave/CmplxCHOL.cc --- a/liboctave/CmplxCHOL.cc Tue Feb 13 20:55:20 1996 +0000 +++ b/liboctave/CmplxCHOL.cc Wed Feb 14 00:50:23 1996 +0000 @@ -45,31 +45,36 @@ { int a_nr = a.rows (); int a_nc = a.cols (); - if (a_nr != a_nc) - { - (*current_liboctave_error_handler) - ("ComplexCHOL requires square matrix"); - return -1; - } - int n = a_nc; - int info; + if (a_nr != a_nc) + { + (*current_liboctave_error_handler) + ("ComplexCHOL requires square matrix"); + return -1; + } - Complex *h = dup (a.data (), a.length ()); + int n = a_nc; + int info; + + chol_mat = a; + Complex *h = chol_mat.fortran_vec (); - F77_FCN (zpotrf, ZPOTRF) ("U", n, h, n, info, 1L); - - chol_mat = ComplexMatrix (h, n, n); - - // If someone thinks of a more graceful way of doing this (or faster - // for that matter :-)), please let me know! + F77_XFCN (zpotrf, ZPOTRF, ("U", n, h, n, info, 1L)); - if (n > 1) - for (int j = 0; j < a_nc; j++) - for (int i = j+1; i < a_nr; i++) - chol_mat.elem (i, j) = 0.0; + if (f77_exception_encountered) + (*current_liboctave_error_handler) ("unrecoverable error in zpotrf"); + else + { + // If someone thinks of a more graceful way of doing this (or + // faster for that matter :-)), please let me know! - return info; + if (n > 1) + for (int j = 0; j < a_nc; j++) + for (int i = j+1; i < a_nr; i++) + chol_mat.elem (i, j) = 0.0; + } + + return info; } /* diff -r 24f35e425e6a -r 8cb4d3008c76 liboctave/QPSOL.cc --- a/liboctave/QPSOL.cc Tue Feb 13 20:55:20 1996 +0000 +++ b/liboctave/QPSOL.cc Wed Feb 14 00:50:23 1996 +0000 @@ -155,11 +155,14 @@ Array aw (lenw); double *w = aw.fortran_vec (); - F77_FCN (qpsol, QPSOL) (itmax, msglvl, n, nclin, nctotl, ncon, n, - n, bigbnd, pa, pbl, pbu, pc, featol, ph, - qphess, cold, lp, orthog, istate, px, - inform, iter, objf, pclambda, iw, leniw, w, - lenw); + F77_XFCN (qpsol, QPSOL, (itmax, msglvl, n, nclin, nctotl, ncon, n, + n, bigbnd, pa, pbl, pbu, pc, featol, ph, + qphess, cold, lp, orthog, istate, px, + inform, iter, objf, pclambda, iw, leniw, w, + lenw)); + + if (f77_exception_encountered) + (*current_liboctave_error_handler) ("unrecoverable error in qpsol"); return x; } diff -r 24f35e425e6a -r 8cb4d3008c76 liboctave/dbleCHOL.cc --- a/liboctave/dbleCHOL.cc Tue Feb 13 20:55:20 1996 +0000 +++ b/liboctave/dbleCHOL.cc Wed Feb 14 00:50:23 1996 +0000 @@ -45,6 +45,7 @@ { int a_nr = a.rows (); int a_nc = a.cols (); + if (a_nr != a_nc) { (*current_liboctave_error_handler) ("CHOL requires square matrix"); @@ -54,19 +55,23 @@ int n = a_nc; int info; - double *h = dup (a.data (), a.length ()); + chol_mat = a; + double *h = chol_mat.fortran_vec (); - F77_FCN (dpotrf, DPOTRF) ("U", n, h, n, info, 1L); - - chol_mat = Matrix (h, n, n); + F77_XFCN (dpotrf, DPOTRF, ("U", n, h, n, info, 1L)); - // If someone thinks of a more graceful way of doing this (or faster - // for that matter :-)), please let me know! + if (f77_exception_encountered) + (*current_liboctave_error_handler) ("unrecoverable error in dpotrf"); + else + { + // If someone thinks of a more graceful way of doing this (or + // faster for that matter :-)), please let me know! - if (n > 1) - for (int j = 0; j < a_nc; j++) - for (int i = j+1; i < a_nr; i++) - chol_mat.elem (i, j) = 0.0; + if (n > 1) + for (int j = 0; j < a_nc; j++) + for (int i = j+1; i < a_nr; i++) + chol_mat.elem (i, j) = 0.0; + } return info; }