Mercurial > octave
changeset 30032:e156fce82e00
maint: use "m_" prefix for member variables for chol class.
* chol.cc, chol.h: Use "m_" prefix for member variables for chol class.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 24 Aug 2021 15:58:29 -0700 |
parents | cf60f8f636f6 |
children | d8ae55260760 |
files | liboctave/numeric/chol.cc liboctave/numeric/chol.h |
diffstat | 2 files changed, 142 insertions(+), 142 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/numeric/chol.cc Tue Aug 24 12:16:12 2021 -0700 +++ b/liboctave/numeric/chol.cc Tue Aug 24 15:58:29 2021 -0700 @@ -50,7 +50,7 @@ namespace octave { static Matrix - chol2inv_internal (const Matrix& r, bool is_upper = true) + chol2inv_internal (const Matrix& r, bool m_is_upper = true) { Matrix retval; @@ -66,7 +66,7 @@ Matrix tmp = r; double *v = tmp.fortran_vec (); - if (is_upper) + if (m_is_upper) F77_XFCN (dpotri, DPOTRI, (F77_CONST_CHAR_ARG2 ("U", 1), n, v, n, info F77_CHAR_ARG_LEN (1))); @@ -82,7 +82,7 @@ if (n > 1) { - if (is_upper) + if (m_is_upper) for (octave_idx_type j = 0; j < r_nc; j++) for (octave_idx_type i = j+1; i < r_nr; i++) tmp.xelem (i, j) = tmp.xelem (j, i); @@ -98,7 +98,7 @@ } static FloatMatrix - chol2inv_internal (const FloatMatrix& r, bool is_upper = true) + chol2inv_internal (const FloatMatrix& r, bool m_is_upper = true) { FloatMatrix retval; @@ -114,7 +114,7 @@ FloatMatrix tmp = r; float *v = tmp.fortran_vec (); - if (is_upper) + if (m_is_upper) F77_XFCN (spotri, SPOTRI, (F77_CONST_CHAR_ARG2 ("U", 1), n, v, n, info F77_CHAR_ARG_LEN (1))); @@ -130,7 +130,7 @@ if (n > 1) { - if (is_upper) + if (m_is_upper) for (octave_idx_type j = 0; j < r_nc; j++) for (octave_idx_type i = j+1; i < r_nr; i++) tmp.xelem (i, j) = tmp.xelem (j, i); @@ -146,7 +146,7 @@ } static ComplexMatrix - chol2inv_internal (const ComplexMatrix& r, bool is_upper = true) + chol2inv_internal (const ComplexMatrix& r, bool m_is_upper = true) { ComplexMatrix retval; @@ -161,7 +161,7 @@ ComplexMatrix tmp = r; - if (is_upper) + if (m_is_upper) F77_XFCN (zpotri, ZPOTRI, (F77_CONST_CHAR_ARG2 ("U", 1), n, F77_DBLE_CMPLX_ARG (tmp.fortran_vec ()), n, info F77_CHAR_ARG_LEN (1))); @@ -175,7 +175,7 @@ if (n > 1) { - if (is_upper) + if (m_is_upper) for (octave_idx_type j = 0; j < r_nc; j++) for (octave_idx_type i = j+1; i < r_nr; i++) tmp.xelem (i, j) = std::conj (tmp.xelem (j, i)); @@ -191,7 +191,7 @@ } static FloatComplexMatrix - chol2inv_internal (const FloatComplexMatrix& r, bool is_upper = true) + chol2inv_internal (const FloatComplexMatrix& r, bool m_is_upper = true) { FloatComplexMatrix retval; @@ -206,7 +206,7 @@ FloatComplexMatrix tmp = r; - if (is_upper) + if (m_is_upper) F77_XFCN (cpotri, CPOTRI, (F77_CONST_CHAR_ARG2 ("U", 1), n, F77_CMPLX_ARG (tmp.fortran_vec ()), n, info F77_CHAR_ARG_LEN (1))); @@ -220,7 +220,7 @@ if (n > 1) { - if (is_upper) + if (m_is_upper) for (octave_idx_type j = 0; j < r_nc; j++) for (octave_idx_type i = j+1; i < r_nr; i++) tmp.xelem (i, j) = std::conj (tmp.xelem (j, i)); @@ -249,7 +249,7 @@ T chol<T>::inverse (void) const { - return chol2inv_internal (chol_mat, is_upper); + return chol2inv_internal (m_chol_mat, m_is_upper); } template <typename T> @@ -259,7 +259,7 @@ if (! R.issquare ()) (*current_liboctave_error_handler) ("chol: requires square matrix"); - chol_mat = R; + m_chol_mat = R; } #if ! defined (HAVE_QRUPDATE) @@ -270,12 +270,12 @@ { warn_qrupdate_once (); - octave_idx_type n = chol_mat.rows (); + octave_idx_type n = m_chol_mat.rows (); if (u.numel () != n) (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); - init (chol_mat.hermitian () * chol_mat + T (u) * T (u).hermitian (), + init (m_chol_mat.hermitian () * m_chol_mat + T (u) * T (u).hermitian (), true, false); } @@ -297,16 +297,16 @@ octave_idx_type info = -1; - octave_idx_type n = chol_mat.rows (); + octave_idx_type n = m_chol_mat.rows (); if (u.numel () != n) (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); - if (singular (chol_mat)) + if (singular (m_chol_mat)) info = 2; else { - info = init (chol_mat.hermitian () * chol_mat + info = init (m_chol_mat.hermitian () * m_chol_mat - T (u) * T (u).hermitian (), true, false); if (info) info = 1; } @@ -324,20 +324,20 @@ octave_idx_type info = -1; - octave_idx_type n = chol_mat.rows (); + octave_idx_type n = m_chol_mat.rows (); if (u.numel () != n + 1) (*current_liboctave_error_handler) ("cholinsert: dimension mismatch"); if (j < 0 || j > n) (*current_liboctave_error_handler) ("cholinsert: index out of range"); - if (singular (chol_mat)) + if (singular (m_chol_mat)) info = 2; else if (std::imag (u(j)) != zero) info = 3; else { - T a = chol_mat.hermitian () * chol_mat; + T a = m_chol_mat.hermitian () * m_chol_mat; T a1 (n+1, n+1); for (octave_idx_type k = 0; k < n+1; k++) for (octave_idx_type l = 0; l < n+1; l++) @@ -362,12 +362,12 @@ { warn_qrupdate_once (); - octave_idx_type n = chol_mat.rows (); + octave_idx_type n = m_chol_mat.rows (); if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("choldelete: index out of range"); - T a = chol_mat.hermitian () * chol_mat; + T a = m_chol_mat.hermitian () * m_chol_mat; a.delete_elements (1, idx_vector (j)); a.delete_elements (0, idx_vector (j)); init (a, true, false); @@ -379,12 +379,12 @@ { warn_qrupdate_once (); - octave_idx_type n = chol_mat.rows (); + octave_idx_type n = m_chol_mat.rows (); if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("cholshift: index out of range"); - T a = chol_mat.hermitian () * chol_mat; + T a = m_chol_mat.hermitian () * m_chol_mat; Array<octave_idx_type> p (dim_vector (n, 1)); for (octave_idx_type k = 0; k < n; k++) p(k) = k; if (i < j) @@ -418,42 +418,42 @@ F77_INT n = to_f77_int (a_nc); F77_INT info; - is_upper = upper; + m_is_upper = upper; - chol_mat.clear (n, n); - if (is_upper) + m_chol_mat.clear (n, n); + if (m_is_upper) for (octave_idx_type j = 0; j < n; j++) { for (octave_idx_type i = 0; i <= j; i++) - chol_mat.xelem (i, j) = a(i, j); + m_chol_mat.xelem (i, j) = a(i, j); for (octave_idx_type i = j+1; i < n; i++) - chol_mat.xelem (i, j) = 0.0; + m_chol_mat.xelem (i, j) = 0.0; } else for (octave_idx_type j = 0; j < n; j++) { for (octave_idx_type i = 0; i < j; i++) - chol_mat.xelem (i, j) = 0.0; + m_chol_mat.xelem (i, j) = 0.0; for (octave_idx_type i = j; i < n; i++) - chol_mat.xelem (i, j) = a(i, j); + m_chol_mat.xelem (i, j) = a(i, j); } - double *h = chol_mat.fortran_vec (); + double *h = m_chol_mat.fortran_vec (); // Calculate the norm of the matrix, for later use. double anorm = 0; if (calc_cond) anorm = octave::xnorm (a, 1); - if (is_upper) + if (m_is_upper) F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, n, info F77_CHAR_ARG_LEN (1))); else F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 ("L", 1), n, h, n, info F77_CHAR_ARG_LEN (1))); - xrcond = 0.0; + m_rcond = 0.0; if (info > 0) - chol_mat.resize (info - 1, info - 1); + m_chol_mat.resize (info - 1, info - 1); else if (calc_cond) { F77_INT dpocon_info = 0; @@ -462,13 +462,13 @@ Array<double> z (dim_vector (3*n, 1)); double *pz = z.fortran_vec (); OCTAVE_LOCAL_BUFFER (F77_INT, iz, n); - if (is_upper) + if (m_is_upper) F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, - n, anorm, xrcond, pz, iz, dpocon_info + n, anorm, m_rcond, pz, iz, dpocon_info F77_CHAR_ARG_LEN (1))); else F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 ("L", 1), n, h, - n, anorm, xrcond, pz, iz, dpocon_info + n, anorm, m_rcond, pz, iz, dpocon_info F77_CHAR_ARG_LEN (1))); if (dpocon_info != 0) @@ -484,7 +484,7 @@ OCTAVE_API void chol<Matrix>::update (const ColumnVector& u) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); if (u.numel () != n) (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); @@ -493,7 +493,7 @@ OCTAVE_LOCAL_BUFFER (double, w, n); - F77_XFCN (dch1up, DCH1UP, (n, chol_mat.fortran_vec (), n, + F77_XFCN (dch1up, DCH1UP, (n, m_chol_mat.fortran_vec (), n, utmp.fortran_vec (), w)); } @@ -503,7 +503,7 @@ { F77_INT info = -1; - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); if (u.numel () != n) (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); @@ -512,7 +512,7 @@ OCTAVE_LOCAL_BUFFER (double, w, n); - F77_XFCN (dch1dn, DCH1DN, (n, chol_mat.fortran_vec (), n, + F77_XFCN (dch1dn, DCH1DN, (n, m_chol_mat.fortran_vec (), n, utmp.fortran_vec (), w, info)); return info; @@ -524,7 +524,7 @@ { F77_INT info = -1; - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); F77_INT j = to_f77_int (j_arg); if (u.numel () != n + 1) @@ -536,10 +536,10 @@ OCTAVE_LOCAL_BUFFER (double, w, n); - chol_mat.resize (n+1, n+1); - F77_INT ldcm = to_f77_int (chol_mat.rows ()); + m_chol_mat.resize (n+1, n+1); + F77_INT ldcm = to_f77_int (m_chol_mat.rows ()); - F77_XFCN (dchinx, DCHINX, (n, chol_mat.fortran_vec (), ldcm, + F77_XFCN (dchinx, DCHINX, (n, m_chol_mat.fortran_vec (), ldcm, j + 1, utmp.fortran_vec (), w, info)); return info; @@ -549,7 +549,7 @@ OCTAVE_API void chol<Matrix>::delete_sym (octave_idx_type j_arg) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); F77_INT j = to_f77_int (j_arg); if (j < 0 || j > n-1) @@ -557,16 +557,16 @@ OCTAVE_LOCAL_BUFFER (double, w, n); - F77_XFCN (dchdex, DCHDEX, (n, chol_mat.fortran_vec (), n, j + 1, w)); + F77_XFCN (dchdex, DCHDEX, (n, m_chol_mat.fortran_vec (), n, j + 1, w)); - chol_mat.resize (n-1, n-1); + m_chol_mat.resize (n-1, n-1); } template <> OCTAVE_API void chol<Matrix>::shift_sym (octave_idx_type i_arg, octave_idx_type j_arg) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); F77_INT i = to_f77_int (i_arg); F77_INT j = to_f77_int (j_arg); @@ -575,7 +575,7 @@ OCTAVE_LOCAL_BUFFER (double, w, 2*n); - F77_XFCN (dchshx, DCHSHX, (n, chol_mat.fortran_vec (), n, + F77_XFCN (dchshx, DCHSHX, (n, m_chol_mat.fortran_vec (), n, i + 1, j + 1, w)); } @@ -594,42 +594,42 @@ F77_INT n = to_f77_int (a_nc); F77_INT info; - is_upper = upper; + m_is_upper = upper; - chol_mat.clear (n, n); - if (is_upper) + m_chol_mat.clear (n, n); + if (m_is_upper) for (octave_idx_type j = 0; j < n; j++) { for (octave_idx_type i = 0; i <= j; i++) - chol_mat.xelem (i, j) = a(i, j); + m_chol_mat.xelem (i, j) = a(i, j); for (octave_idx_type i = j+1; i < n; i++) - chol_mat.xelem (i, j) = 0.0f; + m_chol_mat.xelem (i, j) = 0.0f; } else for (octave_idx_type j = 0; j < n; j++) { for (octave_idx_type i = 0; i < j; i++) - chol_mat.xelem (i, j) = 0.0f; + m_chol_mat.xelem (i, j) = 0.0f; for (octave_idx_type i = j; i < n; i++) - chol_mat.xelem (i, j) = a(i, j); + m_chol_mat.xelem (i, j) = a(i, j); } - float *h = chol_mat.fortran_vec (); + float *h = m_chol_mat.fortran_vec (); // Calculate the norm of the matrix, for later use. float anorm = 0; if (calc_cond) anorm = octave::xnorm (a, 1); - if (is_upper) + if (m_is_upper) F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, n, info F77_CHAR_ARG_LEN (1))); else F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 ("L", 1), n, h, n, info F77_CHAR_ARG_LEN (1))); - xrcond = 0.0; + m_rcond = 0.0; if (info > 0) - chol_mat.resize (info - 1, info - 1); + m_chol_mat.resize (info - 1, info - 1); else if (calc_cond) { F77_INT spocon_info = 0; @@ -638,13 +638,13 @@ Array<float> z (dim_vector (3*n, 1)); float *pz = z.fortran_vec (); OCTAVE_LOCAL_BUFFER (F77_INT, iz, n); - if (is_upper) + if (m_is_upper) F77_XFCN (spocon, SPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, - n, anorm, xrcond, pz, iz, spocon_info + n, anorm, m_rcond, pz, iz, spocon_info F77_CHAR_ARG_LEN (1))); else F77_XFCN (spocon, SPOCON, (F77_CONST_CHAR_ARG2 ("L", 1), n, h, - n, anorm, xrcond, pz, iz, spocon_info + n, anorm, m_rcond, pz, iz, spocon_info F77_CHAR_ARG_LEN (1))); if (spocon_info != 0) @@ -660,7 +660,7 @@ OCTAVE_API void chol<FloatMatrix>::update (const FloatColumnVector& u) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); if (u.numel () != n) (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); @@ -669,7 +669,7 @@ OCTAVE_LOCAL_BUFFER (float, w, n); - F77_XFCN (sch1up, SCH1UP, (n, chol_mat.fortran_vec (), n, + F77_XFCN (sch1up, SCH1UP, (n, m_chol_mat.fortran_vec (), n, utmp.fortran_vec (), w)); } @@ -679,7 +679,7 @@ { F77_INT info = -1; - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); if (u.numel () != n) (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); @@ -688,7 +688,7 @@ OCTAVE_LOCAL_BUFFER (float, w, n); - F77_XFCN (sch1dn, SCH1DN, (n, chol_mat.fortran_vec (), n, + F77_XFCN (sch1dn, SCH1DN, (n, m_chol_mat.fortran_vec (), n, utmp.fortran_vec (), w, info)); return info; @@ -701,7 +701,7 @@ { F77_INT info = -1; - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); F77_INT j = to_f77_int (j_arg); if (u.numel () != n + 1) @@ -713,10 +713,10 @@ OCTAVE_LOCAL_BUFFER (float, w, n); - chol_mat.resize (n+1, n+1); - F77_INT ldcm = to_f77_int (chol_mat.rows ()); + m_chol_mat.resize (n+1, n+1); + F77_INT ldcm = to_f77_int (m_chol_mat.rows ()); - F77_XFCN (schinx, SCHINX, (n, chol_mat.fortran_vec (), ldcm, + F77_XFCN (schinx, SCHINX, (n, m_chol_mat.fortran_vec (), ldcm, j + 1, utmp.fortran_vec (), w, info)); return info; @@ -726,7 +726,7 @@ OCTAVE_API void chol<FloatMatrix>::delete_sym (octave_idx_type j_arg) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); F77_INT j = to_f77_int (j_arg); if (j < 0 || j > n-1) @@ -734,17 +734,17 @@ OCTAVE_LOCAL_BUFFER (float, w, n); - F77_XFCN (schdex, SCHDEX, (n, chol_mat.fortran_vec (), n, + F77_XFCN (schdex, SCHDEX, (n, m_chol_mat.fortran_vec (), n, j + 1, w)); - chol_mat.resize (n-1, n-1); + m_chol_mat.resize (n-1, n-1); } template <> OCTAVE_API void chol<FloatMatrix>::shift_sym (octave_idx_type i_arg, octave_idx_type j_arg) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); F77_INT i = to_f77_int (i_arg); F77_INT j = to_f77_int (j_arg); @@ -753,7 +753,7 @@ OCTAVE_LOCAL_BUFFER (float, w, 2*n); - F77_XFCN (schshx, SCHSHX, (n, chol_mat.fortran_vec (), n, + F77_XFCN (schshx, SCHSHX, (n, m_chol_mat.fortran_vec (), n, i + 1, j + 1, w)); } @@ -772,33 +772,33 @@ F77_INT n = to_f77_int (a_nc); F77_INT info; - is_upper = upper; + m_is_upper = upper; - chol_mat.clear (n, n); - if (is_upper) + m_chol_mat.clear (n, n); + if (m_is_upper) for (octave_idx_type j = 0; j < n; j++) { for (octave_idx_type i = 0; i <= j; i++) - chol_mat.xelem (i, j) = a(i, j); + m_chol_mat.xelem (i, j) = a(i, j); for (octave_idx_type i = j+1; i < n; i++) - chol_mat.xelem (i, j) = 0.0; + m_chol_mat.xelem (i, j) = 0.0; } else for (octave_idx_type j = 0; j < n; j++) { for (octave_idx_type i = 0; i < j; i++) - chol_mat.xelem (i, j) = 0.0; + m_chol_mat.xelem (i, j) = 0.0; for (octave_idx_type i = j; i < n; i++) - chol_mat.xelem (i, j) = a(i, j); + m_chol_mat.xelem (i, j) = a(i, j); } - Complex *h = chol_mat.fortran_vec (); + Complex *h = m_chol_mat.fortran_vec (); // Calculate the norm of the matrix, for later use. double anorm = 0; if (calc_cond) anorm = octave::xnorm (a, 1); - if (is_upper) + if (m_is_upper) F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), n, F77_DBLE_CMPLX_ARG (h), n, info F77_CHAR_ARG_LEN (1))); @@ -807,9 +807,9 @@ F77_DBLE_CMPLX_ARG (h), n, info F77_CHAR_ARG_LEN (1))); - xrcond = 0.0; + m_rcond = 0.0; if (info > 0) - chol_mat.resize (info - 1, info - 1); + m_chol_mat.resize (info - 1, info - 1); else if (calc_cond) { F77_INT zpocon_info = 0; @@ -820,7 +820,7 @@ Array<double> rz (dim_vector (n, 1)); double *prz = rz.fortran_vec (); F77_XFCN (zpocon, ZPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, - F77_DBLE_CMPLX_ARG (h), n, anorm, xrcond, + F77_DBLE_CMPLX_ARG (h), n, anorm, m_rcond, F77_DBLE_CMPLX_ARG (pz), prz, zpocon_info F77_CHAR_ARG_LEN (1))); @@ -837,7 +837,7 @@ OCTAVE_API void chol<ComplexMatrix>::update (const ComplexColumnVector& u) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); if (u.numel () != n) (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); @@ -847,7 +847,7 @@ OCTAVE_LOCAL_BUFFER (double, rw, n); F77_XFCN (zch1up, ZCH1UP, (n, - F77_DBLE_CMPLX_ARG (chol_mat.fortran_vec ()), + F77_DBLE_CMPLX_ARG (m_chol_mat.fortran_vec ()), n, F77_DBLE_CMPLX_ARG (utmp.fortran_vec ()), rw)); @@ -859,7 +859,7 @@ { F77_INT info = -1; - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); if (u.numel () != n) (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); @@ -869,7 +869,7 @@ OCTAVE_LOCAL_BUFFER (double, rw, n); F77_XFCN (zch1dn, ZCH1DN, (n, - F77_DBLE_CMPLX_ARG (chol_mat.fortran_vec ()), + F77_DBLE_CMPLX_ARG (m_chol_mat.fortran_vec ()), n, F77_DBLE_CMPLX_ARG (utmp.fortran_vec ()), rw, info)); @@ -884,7 +884,7 @@ { F77_INT info = -1; - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); F77_INT j = to_f77_int (j_arg); if (u.numel () != n + 1) @@ -896,11 +896,11 @@ OCTAVE_LOCAL_BUFFER (double, rw, n); - chol_mat.resize (n+1, n+1); - F77_INT ldcm = to_f77_int (chol_mat.rows ()); + m_chol_mat.resize (n+1, n+1); + F77_INT ldcm = to_f77_int (m_chol_mat.rows ()); F77_XFCN (zchinx, ZCHINX, (n, - F77_DBLE_CMPLX_ARG (chol_mat.fortran_vec ()), + F77_DBLE_CMPLX_ARG (m_chol_mat.fortran_vec ()), ldcm, j + 1, F77_DBLE_CMPLX_ARG (utmp.fortran_vec ()), rw, info)); @@ -912,7 +912,7 @@ OCTAVE_API void chol<ComplexMatrix>::delete_sym (octave_idx_type j_arg) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); F77_INT j = to_f77_int (j_arg); if (j < 0 || j > n-1) @@ -921,10 +921,10 @@ OCTAVE_LOCAL_BUFFER (double, rw, n); F77_XFCN (zchdex, ZCHDEX, (n, - F77_DBLE_CMPLX_ARG (chol_mat.fortran_vec ()), + F77_DBLE_CMPLX_ARG (m_chol_mat.fortran_vec ()), n, j + 1, rw)); - chol_mat.resize (n-1, n-1); + m_chol_mat.resize (n-1, n-1); } template <> @@ -932,7 +932,7 @@ chol<ComplexMatrix>::shift_sym (octave_idx_type i_arg, octave_idx_type j_arg) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); F77_INT i = to_f77_int (i_arg); F77_INT j = to_f77_int (j_arg); @@ -943,7 +943,7 @@ OCTAVE_LOCAL_BUFFER (double, rw, n); F77_XFCN (zchshx, ZCHSHX, (n, - F77_DBLE_CMPLX_ARG (chol_mat.fortran_vec ()), + F77_DBLE_CMPLX_ARG (m_chol_mat.fortran_vec ()), n, i + 1, j + 1, F77_DBLE_CMPLX_ARG (w), rw)); } @@ -964,33 +964,33 @@ F77_INT n = to_f77_int (a_nc); F77_INT info; - is_upper = upper; + m_is_upper = upper; - chol_mat.clear (n, n); - if (is_upper) + m_chol_mat.clear (n, n); + if (m_is_upper) for (octave_idx_type j = 0; j < n; j++) { for (octave_idx_type i = 0; i <= j; i++) - chol_mat.xelem (i, j) = a(i, j); + m_chol_mat.xelem (i, j) = a(i, j); for (octave_idx_type i = j+1; i < n; i++) - chol_mat.xelem (i, j) = 0.0f; + m_chol_mat.xelem (i, j) = 0.0f; } else for (octave_idx_type j = 0; j < n; j++) { for (octave_idx_type i = 0; i < j; i++) - chol_mat.xelem (i, j) = 0.0f; + m_chol_mat.xelem (i, j) = 0.0f; for (octave_idx_type i = j; i < n; i++) - chol_mat.xelem (i, j) = a(i, j); + m_chol_mat.xelem (i, j) = a(i, j); } - FloatComplex *h = chol_mat.fortran_vec (); + FloatComplex *h = m_chol_mat.fortran_vec (); // Calculate the norm of the matrix, for later use. float anorm = 0; if (calc_cond) anorm = octave::xnorm (a, 1); - if (is_upper) + if (m_is_upper) F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), n, F77_CMPLX_ARG (h), n, info F77_CHAR_ARG_LEN (1))); @@ -999,9 +999,9 @@ n, F77_CMPLX_ARG (h), n, info F77_CHAR_ARG_LEN (1))); - xrcond = 0.0; + m_rcond = 0.0; if (info > 0) - chol_mat.resize (info - 1, info - 1); + m_chol_mat.resize (info - 1, info - 1); else if (calc_cond) { F77_INT cpocon_info = 0; @@ -1012,7 +1012,7 @@ Array<float> rz (dim_vector (n, 1)); float *prz = rz.fortran_vec (); F77_XFCN (cpocon, CPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, - F77_CMPLX_ARG (h), n, anorm, xrcond, + F77_CMPLX_ARG (h), n, anorm, m_rcond, F77_CMPLX_ARG (pz), prz, cpocon_info F77_CHAR_ARG_LEN (1))); @@ -1029,7 +1029,7 @@ OCTAVE_API void chol<FloatComplexMatrix>::update (const FloatComplexColumnVector& u) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); if (u.numel () != n) (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); @@ -1038,7 +1038,7 @@ OCTAVE_LOCAL_BUFFER (float, rw, n); - F77_XFCN (cch1up, CCH1UP, (n, F77_CMPLX_ARG (chol_mat.fortran_vec ()), + F77_XFCN (cch1up, CCH1UP, (n, F77_CMPLX_ARG (m_chol_mat.fortran_vec ()), n, F77_CMPLX_ARG (utmp.fortran_vec ()), rw)); } @@ -1048,7 +1048,7 @@ { F77_INT info = -1; - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); if (u.numel () != n) (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); @@ -1057,7 +1057,7 @@ OCTAVE_LOCAL_BUFFER (float, rw, n); - F77_XFCN (cch1dn, CCH1DN, (n, F77_CMPLX_ARG (chol_mat.fortran_vec ()), + F77_XFCN (cch1dn, CCH1DN, (n, F77_CMPLX_ARG (m_chol_mat.fortran_vec ()), n, F77_CMPLX_ARG (utmp.fortran_vec ()), rw, info)); @@ -1072,7 +1072,7 @@ F77_INT info = -1; F77_INT j = to_f77_int (j_arg); - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); if (u.numel () != n + 1) (*current_liboctave_error_handler) ("cholinsert: dimension mismatch"); @@ -1083,10 +1083,10 @@ OCTAVE_LOCAL_BUFFER (float, rw, n); - chol_mat.resize (n+1, n+1); - F77_INT ldcm = to_f77_int (chol_mat.rows ()); + m_chol_mat.resize (n+1, n+1); + F77_INT ldcm = to_f77_int (m_chol_mat.rows ()); - F77_XFCN (cchinx, CCHINX, (n, F77_CMPLX_ARG (chol_mat.fortran_vec ()), + F77_XFCN (cchinx, CCHINX, (n, F77_CMPLX_ARG (m_chol_mat.fortran_vec ()), ldcm, j + 1, F77_CMPLX_ARG (utmp.fortran_vec ()), rw, info)); @@ -1098,7 +1098,7 @@ OCTAVE_API void chol<FloatComplexMatrix>::delete_sym (octave_idx_type j_arg) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); F77_INT j = to_f77_int (j_arg); if (j < 0 || j > n-1) @@ -1106,10 +1106,10 @@ OCTAVE_LOCAL_BUFFER (float, rw, n); - F77_XFCN (cchdex, CCHDEX, (n, F77_CMPLX_ARG (chol_mat.fortran_vec ()), + F77_XFCN (cchdex, CCHDEX, (n, F77_CMPLX_ARG (m_chol_mat.fortran_vec ()), n, j + 1, rw)); - chol_mat.resize (n-1, n-1); + m_chol_mat.resize (n-1, n-1); } template <> @@ -1117,7 +1117,7 @@ chol<FloatComplexMatrix>::shift_sym (octave_idx_type i_arg, octave_idx_type j_arg) { - F77_INT n = to_f77_int (chol_mat.rows ()); + F77_INT n = to_f77_int (m_chol_mat.rows ()); F77_INT i = to_f77_int (i_arg); F77_INT j = to_f77_int (j_arg); @@ -1127,7 +1127,7 @@ OCTAVE_LOCAL_BUFFER (FloatComplex, w, n); OCTAVE_LOCAL_BUFFER (float, rw, n); - F77_XFCN (cchshx, CCHSHX, (n, F77_CMPLX_ARG (chol_mat.fortran_vec ()), + F77_XFCN (cchshx, CCHSHX, (n, F77_CMPLX_ARG (m_chol_mat.fortran_vec ()), n, i + 1, j + 1, F77_CMPLX_ARG (w), rw)); }
--- a/liboctave/numeric/chol.h Tue Aug 24 12:16:12 2021 -0700 +++ b/liboctave/numeric/chol.h Tue Aug 24 15:58:29 2021 -0700 @@ -41,39 +41,39 @@ typedef typename T::column_vector_type VT; typedef typename T::real_elt_type COND_T; - chol (void) : chol_mat (), xrcond (0), is_upper (true) { } + chol (void) : m_chol_mat (), m_rcond (0), m_is_upper (true) { } chol (const T& a, bool upper = true, bool calc_cond = false) - : chol_mat (), xrcond (0) + : m_chol_mat (), m_rcond (0) { init (a, upper, calc_cond); } chol (const T& a, octave_idx_type& info, bool upper = true, bool calc_cond = false) - : chol_mat (), xrcond (0) + : m_chol_mat (), m_rcond (0) { info = init (a, upper, calc_cond); } chol (const chol& a) - : chol_mat (a.chol_mat), xrcond (a.xrcond), is_upper (a.is_upper) { } + : m_chol_mat (a.m_chol_mat), m_rcond (a.m_rcond), m_is_upper (a.m_is_upper) { } chol& operator = (const chol& a) { if (this != &a) { - chol_mat = a.chol_mat; - xrcond = a.xrcond; - is_upper = a.is_upper; + m_chol_mat = a.m_chol_mat; + m_rcond = a.m_rcond; + m_is_upper = a.m_is_upper; } return *this; } - T chol_matrix (void) const { return chol_mat; } + T chol_matrix (void) const { return m_chol_mat; } - COND_T rcond (void) const { return xrcond; } + COND_T rcond (void) const { return m_rcond; } // Compute the inverse of a matrix using the Cholesky factorization. OCTAVE_API T inverse (void) const; @@ -92,11 +92,11 @@ private: - T chol_mat; + T m_chol_mat; - COND_T xrcond; + COND_T m_rcond; - bool is_upper; + bool m_is_upper; OCTAVE_API octave_idx_type init (const T& a, bool upper, bool calc_cond); };