Mercurial > hg > octave-nkf
diff liboctave/array/dSparse.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 | fffd0c0ca2dc |
line wrap: on
line diff
--- a/liboctave/array/dSparse.cc +++ b/liboctave/array/dSparse.cc @@ -195,7 +195,7 @@ for (octave_idx_type i = 0; i < nc + 1; i++) if (cidx (i) != a.cidx (i)) - return false; + return false; for (octave_idx_type i = 0; i < nz; i++) if (data (i) != a.data (i) || ridx (i) != a.ridx (i)) @@ -251,7 +251,8 @@ } SparseMatrix& -SparseMatrix::insert (const SparseMatrix& a, octave_idx_type r, octave_idx_type c) +SparseMatrix::insert (const SparseMatrix& a, + octave_idx_type r, octave_idx_type c) { MSparse<double>::insert (a, r, c); return *this; @@ -362,7 +363,7 @@ for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) if (found [ridx (i)] == -j) found [ridx (i)] = -j - 1; - + for (octave_idx_type i = 0; i < nr; i++) if (found [i] > -nc && found [i] < 0) idx_arg.elem (i) = -found [i]; @@ -513,7 +514,7 @@ for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) if (found [ridx (i)] == -j) found [ridx (i)] = -j - 1; - + for (octave_idx_type i = 0; i < nr; i++) if (found [i] > -nc && found [i] < 0) idx_arg.elem (i) = -found [i]; @@ -568,16 +569,16 @@ /* -%!assert (max (max (speye (65536))), sparse (1)) -%!assert (min (min (speye (65536))), sparse (0)) -%!assert (size (max (sparse (8, 0), [], 1)), [1, 0]) -%!assert (size (max (sparse (8, 0), [], 2)), [8, 0]) -%!assert (size (max (sparse (0, 8), [], 1)), [0, 8]) -%!assert (size (max (sparse (0, 8), [], 2)), [0, 1]) -%!assert (size (min (sparse (8, 0), [], 1)), [1, 0]) -%!assert (size (min (sparse (8, 0), [], 2)), [8, 0]) -%!assert (size (min (sparse (0, 8), [], 1)), [0, 8]) -%!assert (size (min (sparse (0, 8), [], 2)), [0, 1]) +%!assert (max (max (speye (65536))), sparse (1)) +%!assert (min (min (speye (65536))), sparse (0)) +%!assert (size (max (sparse (8, 0), [], 1)), [1, 0]) +%!assert (size (max (sparse (8, 0), [], 2)), [8, 0]) +%!assert (size (max (sparse (0, 8), [], 1)), [0, 8]) +%!assert (size (max (sparse (0, 8), [], 2)), [0, 1]) +%!assert (size (min (sparse (8, 0), [], 1)), [1, 0]) +%!assert (size (min (sparse (8, 0), [], 2)), [8, 0]) +%!assert (size (min (sparse (0, 8), [], 1)), [0, 8]) +%!assert (size (min (sparse (0, 8), [], 2)), [0, 1]) */ @@ -613,7 +614,8 @@ } SparseMatrix -SparseMatrix::concat (const SparseMatrix& rb, const Array<octave_idx_type>& ra_idx) +SparseMatrix::concat (const SparseMatrix& rb, + const Array<octave_idx_type>& ra_idx) { // Don't use numel to avoid all possiblity of an overflow if (rb.rows () > 0 && rb.cols () > 0) @@ -622,7 +624,8 @@ } SparseComplexMatrix -SparseMatrix::concat (const SparseComplexMatrix& rb, const Array<octave_idx_type>& ra_idx) +SparseMatrix::concat (const SparseComplexMatrix& rb, + const Array<octave_idx_type>& ra_idx) { SparseComplexMatrix retval (*this); if (rb.rows () > 0 && rb.cols () > 0) @@ -1169,7 +1172,7 @@ return retval; - inverse_singular: +inverse_singular: return SparseMatrix (); } @@ -1204,7 +1207,7 @@ double rcond2; SparseMatrix Q = fact.Q (); SparseMatrix InvL = fact.L ().transpose ().tinverse (tmp_typ, - info, rcond2, true, false); + info, rcond2, true, false); ret = Q * InvL.transpose () * InvL * Q.transpose (); } else @@ -1227,9 +1230,9 @@ rcond = fact.rcond (); double rcond2; SparseMatrix InvL = fact.L ().transpose ().tinverse (tmp_typ, - info, rcond2, true, false); + info, rcond2, true, false); SparseMatrix InvU = fact.U ().tinverse (tmp_typ, info, rcond2, - true, false).transpose (); + true, false).transpose (); ret = fact.Pc ().transpose () * InvU * InvL * fact.Pr (); } } @@ -1305,7 +1308,7 @@ Matrix Info (1, UMFPACK_INFO); double *info = Info.fortran_vec (); int status = UMFPACK_DNAME (qsymbolic) (nr, nc, Ap, Ai, - Ax, 0, &Symbolic, control, info); + Ax, 0, &Symbolic, control, info); if (status < 0) { @@ -1315,7 +1318,7 @@ UMFPACK_DNAME (report_status) (control, status); UMFPACK_DNAME (report_info) (control, info); - UMFPACK_DNAME (free_symbolic) (&Symbolic) ; + UMFPACK_DNAME (free_symbolic) (&Symbolic); } else { @@ -1323,8 +1326,8 @@ void *Numeric; status = UMFPACK_DNAME (numeric) (Ap, Ai, Ax, Symbolic, - &Numeric, control, info) ; - UMFPACK_DNAME (free_symbolic) (&Symbolic) ; + &Numeric, control, info); + UMFPACK_DNAME (free_symbolic) (&Symbolic); rcond = Info (UMFPACK_RCOND); @@ -1344,7 +1347,8 @@ double c10, e10; - status = UMFPACK_DNAME (get_determinant) (&c10, &e10, Numeric, info); + status = UMFPACK_DNAME (get_determinant) (&c10, &e10, Numeric, + info); if (status < 0) { @@ -1369,7 +1373,8 @@ } Matrix -SparseMatrix::dsolve (MatrixType &mattype, const Matrix& b, octave_idx_type& err, +SparseMatrix::dsolve (MatrixType &mattype, const Matrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler, bool calc_cond) const { @@ -1547,8 +1552,8 @@ retval.resize (nc, b.cols (), 0); if (typ == MatrixType::Diagonal) for (octave_idx_type j = 0; j < b.cols (); j++) - for (octave_idx_type i = 0; i < nm; i++) - retval(i,j) = b(i,j) / data (i); + for (octave_idx_type i = 0; i < nm; i++) + retval(i,j) = b(i,j) / data (i); else for (octave_idx_type j = 0; j < b.cols (); j++) for (octave_idx_type k = 0; k < nc; k++) @@ -1580,8 +1585,8 @@ SparseComplexMatrix SparseMatrix::dsolve (MatrixType &mattype, const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, - solve_singularity_handler, bool calc_cond) const + octave_idx_type& err, double& rcond, + solve_singularity_handler, bool calc_cond) const { SparseComplexMatrix retval; @@ -4000,7 +4005,7 @@ rcond = 1.; } else if (typ != MatrixType::Tridiagonal_Hermitian) - (*current_liboctave_error_handler) ("incorrect matrix type"); + (*current_liboctave_error_handler) ("incorrect matrix type"); } return retval; @@ -4560,10 +4565,10 @@ octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DPBCON, - (F77_CONST_CHAR_ARG2 (&job, 1), - nr, n_lower, tmp_data, ldm, - anorm, rcond, pz, piz, err - F77_CHAR_ARG_LEN (1))); + (F77_CONST_CHAR_ARG2 (&job, 1), + nr, n_lower, tmp_data, ldm, + anorm, rcond, pz, piz, err + F77_CHAR_ARG_LEN (1))); if (err != 0) err = -2; @@ -4682,12 +4687,12 @@ octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgbcon, DGBCON, - (F77_CONST_CHAR_ARG2 (&job, 1), - nc, n_lower, n_upper, tmp_data, ldm, pipvt, - anorm, rcond, pz, piz, err - F77_CHAR_ARG_LEN (1))); - - if (err != 0) + (F77_CONST_CHAR_ARG2 (&job, 1), + nc, n_lower, n_upper, tmp_data, ldm, pipvt, + anorm, rcond, pz, piz, err + F77_CHAR_ARG_LEN (1))); + + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -4808,10 +4813,10 @@ octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DPBCON, - (F77_CONST_CHAR_ARG2 (&job, 1), - nr, n_lower, tmp_data, ldm, - anorm, rcond, pz, piz, err - F77_CHAR_ARG_LEN (1))); + (F77_CONST_CHAR_ARG2 (&job, 1), + nr, n_lower, tmp_data, ldm, + anorm, rcond, pz, piz, err + F77_CHAR_ARG_LEN (1))); if (err != 0) err = -2; @@ -4877,7 +4882,7 @@ { // Resize the sparse matrix octave_idx_type sz = x_nz * - (b_nc - j) / b_nc; + (b_nc - j) / b_nc; sz = (sz > 10 ? sz : 10) + x_nz; retval.change_capacity (sz); x_nz = sz; @@ -4963,12 +4968,12 @@ octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgbcon, DGBCON, - (F77_CONST_CHAR_ARG2 (&job, 1), - nc, n_lower, n_upper, tmp_data, ldm, pipvt, - anorm, rcond, pz, piz, err - F77_CHAR_ARG_LEN (1))); - - if (err != 0) + (F77_CONST_CHAR_ARG2 (&job, 1), + nc, n_lower, n_upper, tmp_data, ldm, pipvt, + anorm, rcond, pz, piz, err + F77_CHAR_ARG_LEN (1))); + + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -5128,10 +5133,10 @@ octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DPBCON, - (F77_CONST_CHAR_ARG2 (&job, 1), - nr, n_lower, tmp_data, ldm, - anorm, rcond, pz, piz, err - F77_CHAR_ARG_LEN (1))); + (F77_CONST_CHAR_ARG2 (&job, 1), + nr, n_lower, tmp_data, ldm, + anorm, rcond, pz, piz, err + F77_CHAR_ARG_LEN (1))); if (err != 0) err = -2; @@ -5260,8 +5265,8 @@ if (sing_handler) { - sing_handler (rcond); - mattype.mark_as_rectangular (); + sing_handler (rcond); + mattype.mark_as_rectangular (); } else (*current_liboctave_error_handler) @@ -5279,10 +5284,10 @@ octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DPBCON, - (F77_CONST_CHAR_ARG2 (&job, 1), - nr, n_lower, tmp_data, ldm, - anorm, rcond, pz, piz, err - F77_CHAR_ARG_LEN (1))); + (F77_CONST_CHAR_ARG2 (&job, 1), + nr, n_lower, tmp_data, ldm, + anorm, rcond, pz, piz, err + F77_CHAR_ARG_LEN (1))); if (err != 0) err = -2; @@ -5295,8 +5300,8 @@ if (sing_handler) { - sing_handler (rcond); - mattype.mark_as_rectangular (); + sing_handler (rcond); + mattype.mark_as_rectangular (); } else (*current_liboctave_error_handler) @@ -5428,10 +5433,10 @@ octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dpbcon, DPBCON, - (F77_CONST_CHAR_ARG2 (&job, 1), - nr, n_lower, tmp_data, ldm, - anorm, rcond, pz, piz, err - F77_CHAR_ARG_LEN (1))); + (F77_CONST_CHAR_ARG2 (&job, 1), + nr, n_lower, tmp_data, ldm, + anorm, rcond, pz, piz, err + F77_CHAR_ARG_LEN (1))); if (err != 0) err = -2; @@ -5609,12 +5614,12 @@ octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgbcon, DGBCON, - (F77_CONST_CHAR_ARG2 (&job, 1), - nc, n_lower, n_upper, tmp_data, ldm, pipvt, - anorm, rcond, pz, piz, err - F77_CHAR_ARG_LEN (1))); - - if (err != 0) + (F77_CONST_CHAR_ARG2 (&job, 1), + nc, n_lower, n_upper, tmp_data, ldm, pipvt, + anorm, rcond, pz, piz, err + F77_CHAR_ARG_LEN (1))); + + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -5756,7 +5761,7 @@ Info = Matrix (1, UMFPACK_INFO); double *info = Info.fortran_vec (); int status = UMFPACK_DNAME (qsymbolic) (nr, nc, Ap, Ai, Ax, 0, - &Symbolic, control, info); + &Symbolic, control, info); if (status < 0) { @@ -5767,15 +5772,15 @@ UMFPACK_DNAME (report_status) (control, status); UMFPACK_DNAME (report_info) (control, info); - UMFPACK_DNAME (free_symbolic) (&Symbolic) ; + UMFPACK_DNAME (free_symbolic) (&Symbolic); } else { UMFPACK_DNAME (report_symbolic) (Symbolic, control); status = UMFPACK_DNAME (numeric) (Ap, Ai, Ax, Symbolic, - &Numeric, control, info) ; - UMFPACK_DNAME (free_symbolic) (&Symbolic) ; + &Numeric, control, info); + UMFPACK_DNAME (free_symbolic) (&Symbolic); if (calc_cond) rcond = Info (UMFPACK_RCOND); @@ -5799,19 +5804,19 @@ } else if (status < 0) - { - (*current_liboctave_error_handler) - ("SparseMatrix::solve numeric factorization failed"); - - UMFPACK_DNAME (report_status) (control, status); - UMFPACK_DNAME (report_info) (control, info); - - err = -1; - } - else - { - UMFPACK_DNAME (report_numeric) (Numeric, control); - } + { + (*current_liboctave_error_handler) + ("SparseMatrix::solve numeric factorization failed"); + + UMFPACK_DNAME (report_status) (control, status); + UMFPACK_DNAME (report_info) (control, info); + + err = -1; + } + else + { + UMFPACK_DNAME (report_numeric) (Numeric, control); + } } if (err != 0) @@ -6007,8 +6012,9 @@ for (octave_idx_type j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) { status = UMFPACK_DNAME (solve) (UMFPACK_A, Ap, - Ai, Ax, &result[iidx], &Bx[iidx], - Numeric, control, info); + Ai, Ax, &result[iidx], + &Bx[iidx], Numeric, control, + info); if (status < 0) { (*current_liboctave_error_handler) @@ -6248,8 +6254,8 @@ Bx[i] = b.elem (i, j); status = UMFPACK_DNAME (solve) (UMFPACK_A, Ap, - Ai, Ax, Xx, Bx, Numeric, control, - info); + Ai, Ax, Xx, Bx, Numeric, + control, info); if (status < 0) { (*current_liboctave_error_handler) @@ -6496,11 +6502,11 @@ } status = UMFPACK_DNAME (solve) (UMFPACK_A, Ap, - Ai, Ax, Xx, Bx, Numeric, control, - info); + Ai, Ax, Xx, Bx, Numeric, + control, info); int status2 = UMFPACK_DNAME (solve) (UMFPACK_A, - Ap, Ai, Ax, Xz, Bz, Numeric, - control, info) ; + Ap, Ai, Ax, Xz, Bz, + Numeric, control, info); if (status < 0 || status2 < 0) { @@ -6680,9 +6686,9 @@ END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; retval = SparseComplexMatrix - (static_cast<octave_idx_type>(X->nrow), - static_cast<octave_idx_type>(X->ncol), - static_cast<octave_idx_type>(X->nzmax)); + (static_cast<octave_idx_type>(X->nrow), + static_cast<octave_idx_type>(X->ncol), + static_cast<octave_idx_type>(X->nzmax)); for (octave_idx_type j = 0; j <= static_cast<octave_idx_type>(X->ncol); j++) retval.xcidx (j) = static_cast<octave_idx_type *>(X->p)[j]; @@ -6751,11 +6757,11 @@ } status = UMFPACK_DNAME (solve) (UMFPACK_A, Ap, - Ai, Ax, Xx, Bx, Numeric, control, - info); + Ai, Ax, Xx, Bx, Numeric, + control, info); int status2 = UMFPACK_DNAME (solve) (UMFPACK_A, - Ap, Ai, Ax, Xz, Bz, Numeric, - control, info) ; + Ap, Ai, Ax, Xz, Bz, + Numeric, control, info); if (status < 0 || status2 < 0) { @@ -6825,8 +6831,8 @@ } Matrix -SparseMatrix::solve (MatrixType &mattype, const Matrix& b, octave_idx_type& info, - double& rcond) const +SparseMatrix::solve (MatrixType &mattype, const Matrix& b, + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } @@ -6936,8 +6942,8 @@ #ifdef USE_QRSOLVE retval = qrsolve (*this, b, err); #else - retval = dmsolve<SparseMatrix, SparseMatrix, - SparseMatrix> (*this, b, err); + retval = dmsolve<SparseMatrix, SparseMatrix, SparseMatrix> + (*this, b, err); #endif } @@ -6954,7 +6960,7 @@ ComplexMatrix SparseMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& info) const + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); @@ -7004,8 +7010,8 @@ #ifdef USE_QRSOLVE retval = qrsolve (*this, b, err); #else - retval = dmsolve<ComplexMatrix, SparseMatrix, - ComplexMatrix> (*this, b, err); + retval = dmsolve<ComplexMatrix, SparseMatrix, ComplexMatrix> + (*this, b, err); #endif } @@ -7072,8 +7078,8 @@ #ifdef USE_QRSOLVE retval = qrsolve (*this, b, err); #else - retval = dmsolve<SparseComplexMatrix, SparseMatrix, - SparseComplexMatrix> (*this, b, err); + retval = dmsolve<SparseComplexMatrix, SparseMatrix, SparseComplexMatrix> + (*this, b, err); #endif } @@ -7088,24 +7094,28 @@ } ColumnVector -SparseMatrix::solve (MatrixType &mattype, const ColumnVector& b, octave_idx_type& info) const +SparseMatrix::solve (MatrixType &mattype, const ColumnVector& b, + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond); } ColumnVector -SparseMatrix::solve (MatrixType &mattype, const ColumnVector& b, octave_idx_type& info, double& rcond) const +SparseMatrix::solve (MatrixType &mattype, const ColumnVector& b, + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ColumnVector -SparseMatrix::solve (MatrixType &mattype, const ColumnVector& b, octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler) const +SparseMatrix::solve (MatrixType &mattype, const ColumnVector& b, + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler) const { Matrix tmp (b); - return solve (mattype, tmp, info, rcond, sing_handler).column (static_cast<octave_idx_type> (0)); + return solve (mattype, tmp, info, rcond, + sing_handler).column (static_cast<octave_idx_type> (0)); } ComplexColumnVector @@ -7117,25 +7127,29 @@ } ComplexColumnVector -SparseMatrix::solve (MatrixType &mattype, const ComplexColumnVector& b, octave_idx_type& info) const +SparseMatrix::solve (MatrixType &mattype, const ComplexColumnVector& b, + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); } ComplexColumnVector -SparseMatrix::solve (MatrixType &mattype, const ComplexColumnVector& b, octave_idx_type& info, +SparseMatrix::solve (MatrixType &mattype, const ComplexColumnVector& b, + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ComplexColumnVector -SparseMatrix::solve (MatrixType &mattype, const ComplexColumnVector& b, octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler) const +SparseMatrix::solve (MatrixType &mattype, const ComplexColumnVector& b, + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler) const { ComplexMatrix tmp (b); - return solve (mattype, tmp, info, rcond, sing_handler).column (static_cast<octave_idx_type> (0)); + return solve (mattype, tmp, info, rcond, + sing_handler).column (static_cast<octave_idx_type> (0)); } Matrix @@ -7161,8 +7175,7 @@ } Matrix -SparseMatrix::solve (const Matrix& b, octave_idx_type& err, - double& rcond, +SparseMatrix::solve (const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { MatrixType mattype (*this); @@ -7193,8 +7206,7 @@ } SparseMatrix -SparseMatrix::solve (const SparseMatrix& b, - octave_idx_type& err, double& rcond, +SparseMatrix::solve (const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { MatrixType mattype (*this); @@ -7202,23 +7214,22 @@ } ComplexMatrix -SparseMatrix::solve (const ComplexMatrix& b, - octave_idx_type& info) const +SparseMatrix::solve (const ComplexMatrix& b, octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); } ComplexMatrix -SparseMatrix::solve (const ComplexMatrix& b, - octave_idx_type& info, double& rcond) const +SparseMatrix::solve (const ComplexMatrix& b, octave_idx_type& info, + double& rcond) const { return solve (b, info, rcond, 0); } ComplexMatrix -SparseMatrix::solve (const ComplexMatrix& b, - octave_idx_type& err, double& rcond, +SparseMatrix::solve (const ComplexMatrix& b, octave_idx_type& err, + double& rcond, solve_singularity_handler sing_handler) const { MatrixType mattype (*this); @@ -7234,16 +7245,15 @@ } SparseComplexMatrix -SparseMatrix::solve (const SparseComplexMatrix& b, - octave_idx_type& info) const +SparseMatrix::solve (const SparseComplexMatrix& b, octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); } SparseComplexMatrix -SparseMatrix::solve (const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond) const +SparseMatrix::solve (const SparseComplexMatrix& b, octave_idx_type& info, + double& rcond) const { return solve (b, info, rcond, 0); } @@ -7272,17 +7282,20 @@ } ColumnVector -SparseMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const +SparseMatrix::solve (const ColumnVector& b, octave_idx_type& info, + double& rcond) const { return solve (b, info, rcond, 0); } ColumnVector -SparseMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler) const +SparseMatrix::solve (const ColumnVector& b, octave_idx_type& info, + double& rcond, + solve_singularity_handler sing_handler) const { Matrix tmp (b); - return solve (tmp, info, rcond, sing_handler).column (static_cast<octave_idx_type> (0)); + return solve (tmp, info, rcond, + sing_handler).column (static_cast<octave_idx_type> (0)); } ComplexColumnVector @@ -7308,8 +7321,9 @@ } ComplexColumnVector -SparseMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler) const +SparseMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, + double& rcond, + solve_singularity_handler sing_handler) const { ComplexMatrix tmp (b); return solve (tmp, info, rcond, sing_handler).column (static_cast<octave_idx_type> (0)); @@ -7483,8 +7497,7 @@ return r; } -// FIXME Do these really belong here? Maybe they should be -// in a base class? +// FIXME: Do these really belong here? Maybe they should be in a base class? SparseBoolMatrix SparseMatrix::all (int dim) const @@ -7576,18 +7589,18 @@ { octave_idx_type nc = a.cols (); - // add one to the printed indices to go from - // zero-based to one-based arrays - for (octave_idx_type j = 0; j < nc; j++) - { - octave_quit (); - for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) - { - os << a.ridx (i) + 1 << " " << j + 1 << " "; - octave_write_double (os, a.data (i)); - os << "\n"; - } - } + // add one to the printed indices to go from + // zero-based to one-based arrays + for (octave_idx_type j = 0; j < nc; j++) + { + octave_quit (); + for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) + { + os << a.ridx (i) + 1 << " " << j + 1 << " "; + octave_write_double (os, a.data (i)); + os << "\n"; + } + } return os; } @@ -7708,8 +7721,7 @@ return octinternal_do_mul_sm_pm (a, p); } -// FIXME -- it would be nice to share code among the min/max -// functions below. +// FIXME: it would be nice to share code among the min/max functions below. #define EMPTY_RETURN_CHECK(T) \ if (nr == 0 || nc == 0) \