Mercurial > hg > octave-nkf
diff liboctave/array/CSparse.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/CSparse.cc +++ b/liboctave/array/CSparse.cc @@ -189,7 +189,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)) @@ -351,7 +351,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]; @@ -508,7 +508,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]; @@ -563,16 +563,16 @@ /* -%!assert (max (max (speye (65536) * 1i)), sparse (1i)) -%!assert (min (min (speye (65536) * 1i)), 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) * 1i)), sparse (1i)) +%!assert (min (min (speye (65536) * 1i)), 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]) */ @@ -610,28 +610,32 @@ // destructive insert/delete/reorder operations SparseComplexMatrix& -SparseComplexMatrix::insert (const SparseMatrix& a, octave_idx_type r, octave_idx_type c) +SparseComplexMatrix::insert (const SparseMatrix& a, + octave_idx_type r, octave_idx_type c) { SparseComplexMatrix tmp (a); return insert (tmp /*a*/, r, c); } SparseComplexMatrix& -SparseComplexMatrix::insert (const SparseComplexMatrix& a, octave_idx_type r, octave_idx_type c) +SparseComplexMatrix::insert (const SparseComplexMatrix& a, + octave_idx_type r, octave_idx_type c) { MSparse<Complex>::insert (a, r, c); return *this; } SparseComplexMatrix& -SparseComplexMatrix::insert (const SparseMatrix& a, const Array<octave_idx_type>& indx) +SparseComplexMatrix::insert (const SparseMatrix& a, + const Array<octave_idx_type>& indx) { SparseComplexMatrix tmp (a); return insert (tmp /*a*/, indx); } SparseComplexMatrix& -SparseComplexMatrix::insert (const SparseComplexMatrix& a, const Array<octave_idx_type>& indx) +SparseComplexMatrix::insert (const SparseComplexMatrix& a, + const Array<octave_idx_type>& indx) { MSparse<Complex>::insert (a, indx); return *this; @@ -648,7 +652,8 @@ } SparseComplexMatrix -SparseComplexMatrix::concat (const SparseMatrix& rb, const Array<octave_idx_type>& ra_idx) +SparseComplexMatrix::concat (const SparseMatrix& rb, + const Array<octave_idx_type>& ra_idx) { SparseComplexMatrix tmp (rb); if (rb.rows () > 0 && rb.cols () > 0) @@ -742,8 +747,8 @@ SparseComplexMatrix SparseComplexMatrix::dinverse (MatrixType &mattyp, octave_idx_type& info, - double& rcond, const bool, - const bool calccond) const + double& rcond, const bool, + const bool calccond) const { SparseComplexMatrix retval; @@ -1068,7 +1073,7 @@ return retval; - inverse_singular: +inverse_singular: return SparseComplexMatrix (); } @@ -1103,7 +1108,8 @@ double rcond2; SparseMatrix Q = fact.Q (); SparseComplexMatrix InvL = fact.L ().transpose (). - tinverse (tmp_typ, info, rcond2, true, false); + tinverse (tmp_typ, info, rcond2, + true, false); ret = Q * InvL.hermitian () * InvL * Q.transpose (); } else @@ -1126,9 +1132,11 @@ rcond = fact.rcond (); double rcond2; SparseComplexMatrix InvL = fact.L ().transpose (). - tinverse (tmp_typ, info, rcond2, true, false); + tinverse (tmp_typ, info, rcond2, + true, false); SparseComplexMatrix InvU = fact.U (). - tinverse (tmp_typ, info, rcond2, true, false).transpose (); + tinverse (tmp_typ, info, rcond2, + true, false).transpose (); ret = fact.Pc ().transpose () * InvU * InvL * fact.Pr (); } } @@ -1152,7 +1160,8 @@ } ComplexDET -SparseComplexMatrix::determinant (octave_idx_type& err, double& rcond, int) const +SparseComplexMatrix::determinant (octave_idx_type& err, double& rcond, + int) const { ComplexDET retval; #ifdef HAVE_UMFPACK @@ -1206,8 +1215,8 @@ Matrix Info (1, UMFPACK_INFO); double *info = Info.fortran_vec (); int status = UMFPACK_ZNAME (qsymbolic) - (nr, nc, Ap, Ai, reinterpret_cast<const double *> (Ax), 0, - 0, &Symbolic, control, info); + (nr, nc, Ap, Ai, reinterpret_cast<const double *> (Ax), 0, + 0, &Symbolic, control, info); if (status < 0) { @@ -1217,7 +1226,7 @@ UMFPACK_ZNAME (report_status) (control, status); UMFPACK_ZNAME (report_info) (control, info); - UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; + UMFPACK_ZNAME (free_symbolic) (&Symbolic); } else { @@ -1227,8 +1236,8 @@ status = UMFPACK_ZNAME (numeric) (Ap, Ai, reinterpret_cast<const double *> (Ax), - 0, Symbolic, &Numeric, control, info) ; - UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; + 0, Symbolic, &Numeric, control, info); + UMFPACK_ZNAME (free_symbolic) (&Symbolic); rcond = Info (UMFPACK_RCOND); @@ -1302,8 +1311,8 @@ retval.resize (nc, b.cols (), Complex (0.,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++) @@ -3899,7 +3908,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; @@ -4439,10 +4448,10 @@ double *piz = iz.fortran_vec (); F77_XFCN (zpbcon, ZPBCON, - (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; @@ -4560,12 +4569,12 @@ double *piz = iz.fortran_vec (); F77_XFCN (zgbcon, ZGBCON, - (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; @@ -4686,10 +4695,10 @@ double *piz = iz.fortran_vec (); F77_XFCN (zpbcon, ZPBCON, - (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; @@ -4755,7 +4764,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; @@ -4822,8 +4831,8 @@ if (sing_handler) { - sing_handler (rcond); - mattype.mark_as_rectangular (); + sing_handler (rcond); + mattype.mark_as_rectangular (); } else (*current_liboctave_error_handler) @@ -4841,12 +4850,12 @@ double *piz = iz.fortran_vec (); F77_XFCN (zgbcon, ZGBCON, - (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; @@ -5006,10 +5015,10 @@ double *piz = iz.fortran_vec (); F77_XFCN (zpbcon, ZPBCON, - (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; @@ -5125,12 +5134,12 @@ double *piz = iz.fortran_vec (); F77_XFCN (zgbcon, ZGBCON, - (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; @@ -5253,10 +5262,10 @@ double *piz = iz.fortran_vec (); F77_XFCN (zpbcon, ZPBCON, - (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; @@ -5413,12 +5422,12 @@ double *piz = iz.fortran_vec (); F77_XFCN (zgbcon, ZGBCON, - (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; @@ -5549,8 +5558,8 @@ Info = Matrix (1, UMFPACK_INFO); double *info = Info.fortran_vec (); int status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, - reinterpret_cast<const double *> (Ax), - 0, 0, &Symbolic, control, info); + reinterpret_cast<const double *> (Ax), + 0, 0, &Symbolic, control, info); if (status < 0) { @@ -5561,16 +5570,16 @@ UMFPACK_ZNAME (report_status) (control, status); UMFPACK_ZNAME (report_info) (control, info); - UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; + UMFPACK_ZNAME (free_symbolic) (&Symbolic); } else { UMFPACK_ZNAME (report_symbolic) (Symbolic, control); status = UMFPACK_ZNAME (numeric) (Ap, Ai, - reinterpret_cast<const double *> (Ax), 0, - Symbolic, &Numeric, control, info) ; - UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; + reinterpret_cast<const double *> (Ax), + 0, Symbolic, &Numeric, control, info); + UMFPACK_ZNAME (free_symbolic) (&Symbolic); if (calc_cond) rcond = Info (UMFPACK_RCOND); @@ -5594,19 +5603,19 @@ } else if (status < 0) - { - (*current_liboctave_error_handler) - ("SparseComplexMatrix::solve numeric factorization failed"); - - UMFPACK_ZNAME (report_status) (control, status); - UMFPACK_ZNAME (report_info) (control, info); - - err = -1; - } - else - { - UMFPACK_ZNAME (report_numeric) (Numeric, control); - } + { + (*current_liboctave_error_handler) + ("SparseComplexMatrix::solve numeric factorization failed"); + + UMFPACK_ZNAME (report_status) (control, status); + UMFPACK_ZNAME (report_info) (control, info); + + err = -1; + } + else + { + UMFPACK_ZNAME (report_numeric) (Numeric, control); + } } if (err != 0) @@ -5808,26 +5817,26 @@ { #ifdef UMFPACK_SEPARATE_SPLIT status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, - Ai, - reinterpret_cast<const double *> (Ax), - 0, - reinterpret_cast<double *> (&Xx[iidx]), - 0, - &Bx[iidx], Bz, Numeric, - control, info); + Ai, + reinterpret_cast<const double *> (Ax), + 0, + reinterpret_cast<double *> (&Xx[iidx]), + 0, + &Bx[iidx], Bz, Numeric, + control, info); #else for (octave_idx_type i = 0; i < b_nr; i++) Bz[i] = b.elem (i, j); status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, - Ai, - reinterpret_cast<const double *> (Ax), - 0, - reinterpret_cast<double *> (&Xx[iidx]), - 0, - reinterpret_cast<const double *> (Bz), - 0, Numeric, - control, info); + Ai, + reinterpret_cast<const double *> (Ax), + 0, + reinterpret_cast<double *> (&Xx[iidx]), + 0, + reinterpret_cast<const double *> (Bz), + 0, Numeric, + control, info); #endif if (status < 0) @@ -6005,9 +6014,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]; @@ -6079,26 +6088,26 @@ Bx[i] = b.elem (i, j); status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, - Ai, - reinterpret_cast<const double *> (Ax), - 0, - reinterpret_cast<double *> (Xx), - 0, - Bx, Bz, Numeric, control, - info); + Ai, + reinterpret_cast<const double *> (Ax), + 0, + reinterpret_cast<double *> (Xx), + 0, + Bx, Bz, Numeric, control, + info); #else for (octave_idx_type i = 0; i < b_nr; i++) Bz[i] = b.elem (i, j); status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, - reinterpret_cast<const double *> (Ax), - 0, - reinterpret_cast<double *> (Xx), - 0, - reinterpret_cast<double *> (Bz), - 0, - Numeric, control, - info); + reinterpret_cast<const double *> (Ax), + 0, + reinterpret_cast<double *> (Xx), + 0, + reinterpret_cast<double *> (Bz), + 0, + Numeric, control, + info); #endif if (status < 0) { @@ -6336,12 +6345,12 @@ { status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, - reinterpret_cast<const double *> (Ax), - 0, - reinterpret_cast<double *> (&Xx[iidx]), - 0, - reinterpret_cast<const double *> (&Bx[iidx]), - 0, Numeric, control, info); + reinterpret_cast<const double *> (Ax), + 0, + reinterpret_cast<double *> (&Xx[iidx]), + 0, + reinterpret_cast<const double *> (&Bx[iidx]), + 0, Numeric, control, info); if (status < 0) { @@ -6518,9 +6527,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]; @@ -6583,13 +6592,13 @@ Bx[i] = b (i,j); status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, - Ai, - reinterpret_cast<const double *> (Ax), - 0, - reinterpret_cast<double *> (Xx), - 0, - reinterpret_cast<double *> (Bx), - 0, Numeric, control, info); + Ai, + reinterpret_cast<const double *> (Ax), + 0, + reinterpret_cast<double *> (Xx), + 0, + reinterpret_cast<double *> (Bx), + 0, Numeric, control, info); if (status < 0) { @@ -6720,8 +6729,8 @@ #ifdef USE_QRSOLVE retval = qrsolve (*this, b, err); #else - retval = dmsolve<ComplexMatrix, SparseComplexMatrix, - Matrix> (*this, b, err); + retval = dmsolve<ComplexMatrix, SparseComplexMatrix, Matrix> + (*this, b, err); #endif } @@ -6738,7 +6747,7 @@ SparseComplexMatrix SparseComplexMatrix::solve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& info) const + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); @@ -6746,7 +6755,7 @@ SparseComplexMatrix SparseComplexMatrix::solve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } @@ -6788,8 +6797,8 @@ #ifdef USE_QRSOLVE retval = qrsolve (*this, b, err); #else - retval = dmsolve<SparseComplexMatrix, SparseComplexMatrix, - SparseMatrix> (*this, b, err); + retval = dmsolve<SparseComplexMatrix, SparseComplexMatrix, SparseMatrix> + (*this, b, err); #endif } @@ -6856,8 +6865,8 @@ #ifdef USE_QRSOLVE retval = qrsolve (*this, b, err); #else - retval = dmsolve<ComplexMatrix, SparseComplexMatrix, - ComplexMatrix> (*this, b, err); + retval = dmsolve<ComplexMatrix, SparseComplexMatrix, ComplexMatrix> + (*this, b, err); #endif } @@ -6926,7 +6935,7 @@ retval = qrsolve (*this, b, err); #else retval = dmsolve<SparseComplexMatrix, SparseComplexMatrix, - SparseComplexMatrix> (*this, b, err); + SparseComplexMatrix> (*this, b, err); #endif } @@ -6961,7 +6970,8 @@ 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 @@ -6994,7 +7004,8 @@ 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)); } ComplexMatrix @@ -7014,7 +7025,7 @@ ComplexMatrix SparseComplexMatrix::solve (const Matrix& b, octave_idx_type& info, - double& rcond) const + double& rcond) const { return solve (b, info, rcond, 0); } @@ -7038,7 +7049,7 @@ SparseComplexMatrix SparseComplexMatrix::solve (const SparseMatrix& b, - octave_idx_type& info) const + octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); @@ -7046,15 +7057,15 @@ SparseComplexMatrix SparseComplexMatrix::solve (const SparseMatrix& b, - octave_idx_type& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } SparseComplexMatrix SparseComplexMatrix::solve (const SparseMatrix& b, - octave_idx_type& err, double& rcond, - solve_singularity_handler sing_handler) const + octave_idx_type& err, double& rcond, + solve_singularity_handler sing_handler) const { MatrixType mattype (*this); return solve (mattype, b, err, rcond, sing_handler); @@ -7070,15 +7081,15 @@ ComplexMatrix SparseComplexMatrix::solve (const ComplexMatrix& b, - octave_idx_type& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ComplexMatrix SparseComplexMatrix::solve (const ComplexMatrix& b, - octave_idx_type& err, double& rcond, - solve_singularity_handler sing_handler) const + octave_idx_type& err, double& rcond, + solve_singularity_handler sing_handler) const { MatrixType mattype (*this); return solve (mattype, b, err, rcond, sing_handler); @@ -7094,7 +7105,7 @@ SparseComplexMatrix SparseComplexMatrix::solve (const SparseComplexMatrix& b, - octave_idx_type& info) const + octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); @@ -7102,15 +7113,15 @@ SparseComplexMatrix SparseComplexMatrix::solve (const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } SparseComplexMatrix SparseComplexMatrix::solve (const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, - solve_singularity_handler sing_handler) const + octave_idx_type& err, double& rcond, + solve_singularity_handler sing_handler) const { MatrixType mattype (*this); return solve (mattype, b, err, rcond, sing_handler); @@ -7138,11 +7149,13 @@ } ComplexColumnVector -SparseComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond, +SparseComplexMatrix::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 @@ -7154,7 +7167,8 @@ } ComplexColumnVector -SparseComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info) const +SparseComplexMatrix::solve (const ComplexColumnVector& b, + octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); @@ -7162,7 +7176,7 @@ ComplexColumnVector SparseComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, - double& rcond) const + double& rcond) const { return solve (b, info, rcond, 0); } @@ -7173,7 +7187,8 @@ solve_singularity_handler sing_handler) const { ComplexMatrix 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)); } // unary operations @@ -7292,25 +7307,25 @@ for (octave_idx_type i = 0; i < nel; i++) { - Complex val = data (i); - - double r_val = std::real (val); - double i_val = std::imag (val); - - if (r_val > max_val) - max_val = r_val; - - if (i_val > max_val) - max_val = i_val; - - if (r_val < min_val) - min_val = r_val; - - if (i_val < min_val) - min_val = i_val; - - if (D_NINT (r_val) != r_val || D_NINT (i_val) != i_val) - return false; + Complex val = data (i); + + double r_val = std::real (val); + double i_val = std::imag (val); + + if (r_val > max_val) + max_val = r_val; + + if (i_val > max_val) + max_val = i_val; + + if (r_val < min_val) + min_val = r_val; + + if (i_val < min_val) + min_val = i_val; + + if (D_NINT (r_val) != r_val || D_NINT (i_val) != i_val) + return false; } return true; @@ -7322,8 +7337,7 @@ return test_any (xtoo_large_for_float); } -// 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 SparseComplexMatrix::all (int dim) const @@ -7415,18 +7429,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_complex (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_complex (os, a.data (i)); + os << "\n"; + } + } return os; } @@ -7627,8 +7641,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) \ @@ -7879,11 +7892,11 @@ } SPARSE_SMS_CMP_OPS (SparseComplexMatrix, 0.0, real, Complex, - 0.0, real) + 0.0, real) SPARSE_SMS_BOOL_OPS (SparseComplexMatrix, Complex, 0.0) SPARSE_SSM_CMP_OPS (Complex, 0.0, real, SparseComplexMatrix, - 0.0, real) + 0.0, real) SPARSE_SSM_BOOL_OPS (Complex, SparseComplexMatrix, 0.0) SPARSE_SMSM_CMP_OPS (SparseComplexMatrix, 0.0, real, SparseComplexMatrix,