Mercurial > octave-nkf
changeset 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.
line wrap: on
line diff
--- a/liboctave/array/Array-C.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array-C.cc Sat Oct 26 18:57:05 2013 -0700 @@ -92,7 +92,8 @@ INSTANTIATE_ARRAY (Complex, OCTAVE_API); -template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<Complex>&); +template OCTAVE_API std::ostream& operator << (std::ostream&, + const Array<Complex>&); #include "DiagArray2.h" #include "DiagArray2.cc"
--- a/liboctave/array/Array-b.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array-b.cc Sat Oct 26 18:57:05 2013 -0700 @@ -107,7 +107,8 @@ INSTANTIATE_ARRAY (bool, OCTAVE_API); -template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<bool>&); +template OCTAVE_API std::ostream& operator << (std::ostream&, + const Array<bool>&); #include "DiagArray2.h" #include "DiagArray2.cc"
--- a/liboctave/array/Array-ch.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array-ch.cc Sat Oct 26 18:57:05 2013 -0700 @@ -36,7 +36,8 @@ INSTANTIATE_ARRAY (char, OCTAVE_API); -template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<char>&); +template OCTAVE_API std::ostream& operator << (std::ostream&, + const Array<char>&); #include "DiagArray2.h" #include "DiagArray2.cc"
--- a/liboctave/array/Array-d.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array-d.cc Sat Oct 26 18:57:05 2013 -0700 @@ -159,7 +159,8 @@ INSTANTIATE_ARRAY (double, OCTAVE_API); -template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<double>&); +template OCTAVE_API std::ostream& operator << (std::ostream&, + const Array<double>&); #include "DiagArray2.h" #include "DiagArray2.cc"
--- a/liboctave/array/Array-f.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array-f.cc Sat Oct 26 18:57:05 2013 -0700 @@ -159,7 +159,8 @@ INSTANTIATE_ARRAY (float, OCTAVE_API); -template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<float>&); +template OCTAVE_API std::ostream& operator << (std::ostream&, + const Array<float>&); #include "DiagArray2.h" #include "DiagArray2.cc"
--- a/liboctave/array/Array-fC.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array-fC.cc Sat Oct 26 18:57:05 2013 -0700 @@ -60,8 +60,7 @@ } Array<FloatComplex>::compare_fcn_type -safe_comparator (sortmode mode, const Array<FloatComplex>& a, - bool allow_chk) +safe_comparator (sortmode mode, const Array<FloatComplex>& a, bool allow_chk) { Array<FloatComplex>::compare_fcn_type result = 0; @@ -93,7 +92,8 @@ INSTANTIATE_ARRAY (FloatComplex, OCTAVE_API); -template OCTAVE_API std::ostream& operator << (std::ostream&, const Array<FloatComplex>&); +template OCTAVE_API std::ostream& operator << (std::ostream&, + const Array<FloatComplex>&); #include "DiagArray2.h" #include "DiagArray2.cc"
--- a/liboctave/array/Array-util.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array-util.cc Sat Oct 26 18:57:05 2013 -0700 @@ -247,7 +247,7 @@ Array<idx_vector> retval (dim_vector (len, 1)); for (octave_idx_type i = 0; i < len; i++) - retval(i) = tmp[i]; + retval(i) = tmp[i]; return retval; } @@ -403,8 +403,7 @@ for (octave_idx_type i = 0; i < idx; i++) increment_index (retval, dims); - // FIXME -- the solution using increment_index is not - // efficient. + // FIXME: the solution using increment_index is not efficient. #if 0 octave_idx_type var = 1; @@ -432,7 +431,7 @@ bool all_colons = true; for (int i = 0; i < ial; i++) { - // FIXME -- should we check for length() instead? + // FIXME: should we check for length() instead? scalar[i] = ia(i).is_scalar (); colon[i] = ia(i).is_colon (); if (! scalar[i]) nonsc++;
--- a/liboctave/array/Array-util.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array-util.h Sat Oct 26 18:57:05 2013 -0700 @@ -29,15 +29,17 @@ #include "lo-array-gripes.h" extern OCTAVE_API bool index_in_bounds (const Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions); + const dim_vector& dimensions); extern OCTAVE_API void increment_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions, - int start_dimension = 0); + const dim_vector& dimensions, + int start_dimension = 0); -extern OCTAVE_API octave_idx_type get_scalar_idx (Array<octave_idx_type>& idx, dim_vector& dims); +extern OCTAVE_API octave_idx_type get_scalar_idx (Array<octave_idx_type>& idx, + dim_vector& dims); -extern OCTAVE_API octave_idx_type num_ones (const Array<octave_idx_type>& ra_idx); +extern OCTAVE_API octave_idx_type num_ones (const Array<octave_idx_type>& + ra_idx); extern OCTAVE_API bool is_scalar (const dim_vector& dim); @@ -60,12 +62,15 @@ extern OCTAVE_API octave_idx_type compute_index (const Array<octave_idx_type>& ra_idx, const dim_vector& dims); -extern OCTAVE_API Array<octave_idx_type> conv_to_int_array (const Array<idx_vector>& a); +extern OCTAVE_API Array<octave_idx_type> +conv_to_int_array (const Array<idx_vector>& a); -extern OCTAVE_API Array<idx_vector> conv_to_array (const idx_vector *tmp, const octave_idx_type len); +extern OCTAVE_API Array<idx_vector> conv_to_array (const idx_vector *tmp, + const octave_idx_type len); extern OCTAVE_API dim_vector freeze (Array<idx_vector>& ra_idx, - const dim_vector& dimensions, int resize_ok); + const dim_vector& dimensions, + int resize_ok); extern OCTAVE_API bool vector_equivalent (const dim_vector& dv); @@ -74,24 +79,29 @@ extern OCTAVE_API bool any_orig_empty (const Array<idx_vector>& ra_idx); extern OCTAVE_API bool all_colon_equiv (const Array<idx_vector>& ra_idx, - const dim_vector& frozen_lengths); + const dim_vector& frozen_lengths); extern OCTAVE_API bool all_ones (const Array<octave_idx_type>& arr); -extern OCTAVE_API Array<octave_idx_type> get_elt_idx (const Array<idx_vector>& ra_idx, - const Array<octave_idx_type>& result_idx); +extern OCTAVE_API Array<octave_idx_type> +get_elt_idx (const Array<idx_vector>& ra_idx, + const Array<octave_idx_type>& result_idx); -extern OCTAVE_API Array<octave_idx_type> get_ra_idx (octave_idx_type idx, const dim_vector& dims); +extern OCTAVE_API Array<octave_idx_type> get_ra_idx (octave_idx_type idx, + const dim_vector& dims); extern OCTAVE_API dim_vector zero_dims_inquire (const Array<idx_vector>& ia, const dim_vector& rhdv); -extern OCTAVE_API dim_vector zero_dims_inquire (const idx_vector& i, const idx_vector& j, +extern OCTAVE_API dim_vector zero_dims_inquire (const idx_vector& i, + const idx_vector& j, const dim_vector& rhdv); -extern OCTAVE_API idx_vector sub2ind (const dim_vector& dv, const Array<idx_vector>& idxa); +extern OCTAVE_API idx_vector sub2ind (const dim_vector& dv, + const Array<idx_vector>& idxa); -extern OCTAVE_API Array<idx_vector> ind2sub (const dim_vector& dv, const idx_vector& idx); +extern OCTAVE_API Array<idx_vector> ind2sub (const dim_vector& dv, + const idx_vector& idx); struct permute_vector
--- a/liboctave/array/Array.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array.cc Sat Oct 26 18:57:05 2013 -0700 @@ -171,7 +171,8 @@ template <class T> octave_idx_type -Array<T>::compute_index (octave_idx_type i, octave_idx_type j, octave_idx_type k) const +Array<T>::compute_index (octave_idx_type i, octave_idx_type j, + octave_idx_type k) const { return ::compute_index (i, j, k, dimensions); } @@ -239,7 +240,8 @@ template <class T> typename Array<T>::crefT -Array<T>::checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const +Array<T>::checkelem (octave_idx_type i, octave_idx_type j, + octave_idx_type k) const { return elem (compute_index (i, j, k)); } @@ -308,39 +310,39 @@ : n (dv.length ()), top (0), dim (new octave_idx_type [2*n]), stride (dim + n), use_blk (false) - { - assert (n == perm.length ()); - - // Get cumulative dimensions. - OCTAVE_LOCAL_BUFFER (octave_idx_type, cdim, n+1); - cdim[0] = 1; - for (int i = 1; i < n+1; i++) cdim[i] = cdim[i-1] * dv(i-1); - - // Setup the permuted strides. - for (int k = 0; k < n; k++) - { - int kk = perm(k); - dim[k] = dv(kk); - stride[k] = cdim[kk]; - } - - // Reduce contiguous runs. - for (int k = 1; k < n; k++) - { - if (stride[k] == stride[top]*dim[top]) - dim[top] *= dim[k]; - else - { - top++; - dim[top] = dim[k]; - stride[top] = stride[k]; - } - } - - // Determine whether we can use block transposes. - use_blk = top >= 1 && stride[1] == 1 && stride[0] == dim[1]; - - } + { + assert (n == perm.length ()); + + // Get cumulative dimensions. + OCTAVE_LOCAL_BUFFER (octave_idx_type, cdim, n+1); + cdim[0] = 1; + for (int i = 1; i < n+1; i++) cdim[i] = cdim[i-1] * dv(i-1); + + // Setup the permuted strides. + for (int k = 0; k < n; k++) + { + int kk = perm(k); + dim[k] = dv(kk); + stride[k] = cdim[kk]; + } + + // Reduce contiguous runs. + for (int k = 1; k < n; k++) + { + if (stride[k] == stride[top]*dim[top]) + dim[top] *= dim[k]; + else + { + top++; + dim[top] = dim[k]; + stride[top] = stride[k]; + } + } + + // Determine whether we can use block transposes. + use_blk = top >= 1 && stride[1] == 1 && stride[0] == dim[1]; + + } ~rec_permute_helper (void) { delete [] dim; } @@ -348,74 +350,74 @@ template <class T> static T * blk_trans (const T *src, T *dest, octave_idx_type nr, octave_idx_type nc) - { - static const octave_idx_type m = 8; - OCTAVE_LOCAL_BUFFER (T, blk, m*m); - for (octave_idx_type kr = 0; kr < nr; kr += m) - for (octave_idx_type kc = 0; kc < nc; kc += m) - { - octave_idx_type lr = std::min (m, nr - kr); - octave_idx_type lc = std::min (m, nc - kc); - if (lr == m && lc == m) - { - const T *ss = src + kc * nr + kr; - for (octave_idx_type j = 0; j < m; j++) - for (octave_idx_type i = 0; i < m; i++) - blk[j*m+i] = ss[j*nr + i]; - T *dd = dest + kr * nc + kc; - for (octave_idx_type j = 0; j < m; j++) - for (octave_idx_type i = 0; i < m; i++) - dd[j*nc+i] = blk[i*m+j]; - } - else - { - const T *ss = src + kc * nr + kr; - for (octave_idx_type j = 0; j < lc; j++) - for (octave_idx_type i = 0; i < lr; i++) - blk[j*m+i] = ss[j*nr + i]; - T *dd = dest + kr * nc + kc; - for (octave_idx_type j = 0; j < lr; j++) - for (octave_idx_type i = 0; i < lc; i++) - dd[j*nc+i] = blk[i*m+j]; - } - } - - return dest + nr*nc; - } + { + static const octave_idx_type m = 8; + OCTAVE_LOCAL_BUFFER (T, blk, m*m); + for (octave_idx_type kr = 0; kr < nr; kr += m) + for (octave_idx_type kc = 0; kc < nc; kc += m) + { + octave_idx_type lr = std::min (m, nr - kr); + octave_idx_type lc = std::min (m, nc - kc); + if (lr == m && lc == m) + { + const T *ss = src + kc * nr + kr; + for (octave_idx_type j = 0; j < m; j++) + for (octave_idx_type i = 0; i < m; i++) + blk[j*m+i] = ss[j*nr + i]; + T *dd = dest + kr * nc + kc; + for (octave_idx_type j = 0; j < m; j++) + for (octave_idx_type i = 0; i < m; i++) + dd[j*nc+i] = blk[i*m+j]; + } + else + { + const T *ss = src + kc * nr + kr; + for (octave_idx_type j = 0; j < lc; j++) + for (octave_idx_type i = 0; i < lr; i++) + blk[j*m+i] = ss[j*nr + i]; + T *dd = dest + kr * nc + kc; + for (octave_idx_type j = 0; j < lr; j++) + for (octave_idx_type i = 0; i < lc; i++) + dd[j*nc+i] = blk[i*m+j]; + } + } + + return dest + nr*nc; + } private: // Recursive N-d generalized transpose template <class T> T *do_permute (const T *src, T *dest, int lev) const - { - if (lev == 0) - { - octave_idx_type step = stride[0], len = dim[0]; - if (step == 1) - { - copy_or_memcpy (len, src, dest); - dest += len; - } - else - { - for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) - dest[i] = src[j]; - - dest += len; - } - } - else if (use_blk && lev == 1) - dest = blk_trans (src, dest, dim[1], dim[0]); - else - { - octave_idx_type step = stride[lev], len = dim[lev]; - for (octave_idx_type i = 0, j = 0; i < len; i++, j+= step) - dest = do_permute (src + i * step, dest, lev-1); - } - - return dest; - } + { + if (lev == 0) + { + octave_idx_type step = stride[0], len = dim[0]; + if (step == 1) + { + copy_or_memcpy (len, src, dest); + dest += len; + } + else + { + for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) + dest[i] = src[j]; + + dest += len; + } + } + else if (use_blk && lev == 1) + dest = blk_trans (src, dest, dim[1], dim[0]); + else + { + octave_idx_type step = stride[lev], len = dim[lev]; + for (octave_idx_type i = 0, j = 0; i < len; i++, j+= step) + dest = do_permute (src + i * step, dest, lev-1); + } + + return dest; + } // No copying! @@ -528,31 +530,31 @@ rec_index_helper (const dim_vector& dv, const Array<idx_vector>& ia) : n (ia.length ()), top (0), dim (new octave_idx_type [2*n]), cdim (dim + n), idx (new idx_vector [n]) - { - assert (n > 0 && (dv.length () == std::max (n, 2))); - - dim[0] = dv(0); - cdim[0] = 1; - idx[0] = ia(0); - - for (int i = 1; i < n; i++) - { - // Try reduction... - if (idx[top].maybe_reduce (dim[top], ia(i), dv(i))) - { - // Reduction successful, fold dimensions. - dim[top] *= dv(i); - } - else - { - // Unsuccessful, store index & cumulative dim. - top++; - idx[top] = ia(i); - dim[top] = dv(i); - cdim[top] = cdim[top-1] * dim[top-1]; - } - } - } + { + assert (n > 0 && (dv.length () == std::max (n, 2))); + + dim[0] = dv(0); + cdim[0] = 1; + idx[0] = ia(0); + + for (int i = 1; i < n; i++) + { + // Try reduction... + if (idx[top].maybe_reduce (dim[top], ia(i), dv(i))) + { + // Reduction successful, fold dimensions. + dim[top] *= dv(i); + } + else + { + // Unsuccessful, store index & cumulative dim. + top++; + idx[top] = ia(i); + dim[top] = dv(i); + cdim[top] = cdim[top-1] * dim[top-1]; + } + } + } ~rec_index_helper (void) { delete [] idx; delete [] dim; } @@ -561,48 +563,48 @@ // Recursive N-d indexing template <class T> T *do_index (const T *src, T *dest, int lev) const - { - if (lev == 0) - dest += idx[0].index (src, dim[0], dest); - else - { - octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; - for (octave_idx_type i = 0; i < nn; i++) - dest = do_index (src + d*idx[lev].xelem (i), dest, lev-1); - } - - return dest; - } + { + if (lev == 0) + dest += idx[0].index (src, dim[0], dest); + else + { + octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; + for (octave_idx_type i = 0; i < nn; i++) + dest = do_index (src + d*idx[lev].xelem (i), dest, lev-1); + } + + return dest; + } // Recursive N-d indexed assignment template <class T> const T *do_assign (const T *src, T *dest, int lev) const - { - if (lev == 0) - src += idx[0].assign (src, dim[0], dest); - else - { - octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; - for (octave_idx_type i = 0; i < nn; i++) - src = do_assign (src, dest + d*idx[lev].xelem (i), lev-1); - } - - return src; - } + { + if (lev == 0) + src += idx[0].assign (src, dim[0], dest); + else + { + octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; + for (octave_idx_type i = 0; i < nn; i++) + src = do_assign (src, dest + d*idx[lev].xelem (i), lev-1); + } + + return src; + } // Recursive N-d indexed assignment template <class T> void do_fill (const T& val, T *dest, int lev) const - { - if (lev == 0) - idx[0].fill (val, dim[0], dest); - else - { - octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; - for (octave_idx_type i = 0; i < nn; i++) - do_fill (val, dest + d*idx[lev].xelem (i), lev-1); - } - } + { + if (lev == 0) + idx[0].fill (val, dim[0], dest); + else + { + octave_idx_type nn = idx[lev].length (dim[lev]), d = cdim[lev]; + for (octave_idx_type i = 0; i < nn; i++) + do_fill (val, dest + d*idx[lev].xelem (i), lev-1); + } + } // No copying! @@ -622,10 +624,10 @@ void fill (const T& val, T *dest) const { do_fill (val, dest, top); } bool is_cont_range (octave_idx_type& l, - octave_idx_type& u) const - { - return top == 0 && idx[0].is_cont_range (dim[0], l, u); - } + octave_idx_type& u) const + { + return top == 0 && idx[0].is_cont_range (dim[0], l, u); + } }; // Helper class for multi-d recursive resizing @@ -641,27 +643,27 @@ public: rec_resize_helper (const dim_vector& ndv, const dim_vector& odv) : cext (0), sext (0), dext (0), n (0) - { - int l = ndv.length (); - assert (odv.length () == l); - octave_idx_type ld = 1; - int i = 0; - for (; i < l-1 && ndv(i) == odv(i); i++) ld *= ndv(i); - n = l - i; - cext = new octave_idx_type [3*n]; - // Trick to avoid three allocations - sext = cext + n; - dext = sext + n; - - octave_idx_type sld = ld, dld = ld; - for (int j = 0; j < n; j++) - { - cext[j] = std::min (ndv(i+j), odv(i+j)); - sext[j] = sld *= odv(i+j); - dext[j] = dld *= ndv(i+j); - } - cext[0] *= ld; - } + { + int l = ndv.length (); + assert (odv.length () == l); + octave_idx_type ld = 1; + int i = 0; + for (; i < l-1 && ndv(i) == odv(i); i++) ld *= ndv(i); + n = l - i; + cext = new octave_idx_type [3*n]; + // Trick to avoid three allocations + sext = cext + n; + dext = sext + n; + + octave_idx_type sld = ld, dld = ld; + for (int j = 0; j < n; j++) + { + cext[j] = std::min (ndv(i+j), odv(i+j)); + sext[j] = sld *= odv(i+j); + dext[j] = dld *= ndv(i+j); + } + cext[0] *= ld; + } ~rec_resize_helper (void) { delete [] cext; } @@ -670,21 +672,21 @@ // recursive resizing template <class T> void do_resize_fill (const T* src, T *dest, const T& rfv, int lev) const - { - if (lev == 0) - { - copy_or_memcpy (cext[0], src, dest); - fill_or_memset (dext[0] - cext[0], rfv, dest + cext[0]); - } - else - { - octave_idx_type sd = sext[lev-1], dd = dext[lev-1], k; - for (k = 0; k < cext[lev]; k++) - do_resize_fill (src + k * sd, dest + k * dd, rfv, lev - 1); - - fill_or_memset (dext[lev] - k * dd, rfv, dest + k * dd); - } - } + { + if (lev == 0) + { + copy_or_memcpy (cext[0], src, dest); + fill_or_memset (dext[0] - cext[0], rfv, dest + cext[0]); + } + else + { + octave_idx_type sd = sext[lev-1], dd = dext[lev-1], k; + for (k = 0; k < cext[lev]; k++) + do_resize_fill (src + k * sd, dest + k * dd, rfv, lev - 1); + + fill_or_memset (dext[lev] - k * dd, rfv, dest + k * dd); + } + } // No copying! @@ -696,7 +698,7 @@ template <class T> void resize_fill (const T* src, T *dest, const T& rfv) const - { do_resize_fill (src, dest, rfv, n-1); } + { do_resize_fill (src, dest, rfv, n-1); } }; template <class T> @@ -716,11 +718,11 @@ if (i.extent (n) != n) gripe_index_out_of_range (1, 1, i.extent (n), n); // throws - // FIXME -- this is the only place where orig_dimensions are used. + // FIXME: this is the only place where orig_dimensions are used. dim_vector rd = i.orig_dimensions (); octave_idx_type il = i.length (n); - // FIXME -- this is for Matlab compatibility. Matlab 2007 given + // FIXME: this is for Matlab compatibility. Matlab 2007 given // // b = ones (3,1) // @@ -796,7 +798,7 @@ retval = Array<T> (*this, dim_vector (il, jl), l, u); else { - // Don't use resize here to avoid useless initialization for POD types. + // Don't use resize to avoid useless initialization for POD types. retval = Array<T> (dim_vector (il, jl)); ii.index (data (), n, retval.fortran_vec ()); @@ -804,7 +806,7 @@ } else { - // Don't use resize here to avoid useless initialization for POD types. + // Don't use resize to avoid useless initialization for POD types. retval = Array<T> (dim_vector (il, jl)); const T* src = data (); @@ -868,7 +870,7 @@ retval = Array<T> (*this, rdv, l, u); else { - // Don't use resize here to avoid useless initialization for POD types. + // Don't use resize to avoid useless initialization for POD types. retval = Array<T> (rdv); // Do it. @@ -913,7 +915,7 @@ else if (columns () == 1) dv = dim_vector (n, 1); else - invalid = true; + invalid = true; if (invalid) gripe_invalid_resize (); @@ -931,7 +933,8 @@ else if (n == nx + 1 && nx > 0) { // Stack "push" operation. - if (rep->count == 1 && slice_data + slice_len < rep->data + rep->len) + if (rep->count == 1 + && slice_data + slice_len < rep->data + rep->len) { slice_data[slice_len++] = rfv; dimensions = dv; @@ -2162,7 +2165,8 @@ lsort.set_compare (mode); - // This determines the split ratio between the O(M*log2(N)) and O(M+N) algorithms. + // This determines the split ratio between the O(M*log2(N)) and O(M+N) + // algorithms. static const double ratio = 1.0; sortmode vmode = UNSORTED; @@ -2232,7 +2236,7 @@ octave_idx_type k = 0, l = nel - 1; for (; k < n; k++) { - for (;l >= 0 && src[l] == zero; l--) ; + for (; l >= 0 && src[l] == zero; l--) ; if (l >= 0) retval(k) = l--; else @@ -2249,7 +2253,7 @@ octave_idx_type k = 0, l = 0; for (; k < n; k++) { - for (;l != nel && src[l] == zero; l++) ; + for (; l != nel && src[l] == zero; l++) ; if (l != nel) retval(k) = l++; else @@ -2401,7 +2405,7 @@ } if (ku == ns) - lsort.nth_element (buf, ns, lo, up); + lsort.nth_element (buf, ns, lo, up); else if (mode == ASCENDING) lsort.nth_element (buf, ku, lo, std::min (ku, up)); else @@ -2477,7 +2481,7 @@ \ template <> Array<T> \ Array<T>::nth_element (const idx_vector&, int) const { return Array<T> (); } \ - + template <class T> Array<T>
--- a/liboctave/array/Array.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array.h Sat Oct 26 18:57:05 2013 -0700 @@ -64,32 +64,33 @@ ArrayRep (T *d, octave_idx_type l) : data (no_ctor_new<T> (l)), len (l), count (1) - { - copy_or_memcpy (l, d, data); - } + { + copy_or_memcpy (l, d, data); + } template <class U> ArrayRep (U *d, octave_idx_type l) : data (no_ctor_new<T> (l)), len (l), count (1) - { - std::copy (d, d+l, data); - } + { + std::copy (d, d+l, data); + } ArrayRep (void) : data (0), len (0), count (1) { } - explicit ArrayRep (octave_idx_type n) : data (no_ctor_new<T> (n)), len (n), count (1) { } + explicit ArrayRep (octave_idx_type n) + : data (no_ctor_new<T> (n)), len (n), count (1) { } explicit ArrayRep (octave_idx_type n, const T& val) : data (no_ctor_new<T> (n)), len (n), count (1) - { - fill_or_memset (n, val, data); - } + { + fill_or_memset (n, val, data); + } ArrayRep (const ArrayRep& a) : data (no_ctor_new<T> (a.len)), len (a.len), count (1) - { - copy_or_memcpy (a.len, a.data, data); - } + { + copy_or_memcpy (a.len, a.data, data); + } ~ArrayRep (void) { no_ctor_delete<T> (data); } @@ -107,18 +108,18 @@ public: void make_unique (void) - { - if (rep->count > 1) - { - ArrayRep *r = new ArrayRep (slice_data, slice_len); + { + if (rep->count > 1) + { + ArrayRep *r = new ArrayRep (slice_data, slice_len); - if (--rep->count == 0) - delete rep; - - rep = r; - slice_data = rep->data; - } - } + if (--rep->count == 0) + delete rep; + + rep = r; + slice_data = rep->data; + } + } typedef T element_type; @@ -147,22 +148,22 @@ Array (const Array<T>& a, const dim_vector& dv, octave_idx_type l, octave_idx_type u) : dimensions (dv), rep(a.rep), slice_data (a.slice_data+l), slice_len (u-l) - { - rep->count++; - dimensions.chop_trailing_singletons (); - } + { + rep->count++; + dimensions.chop_trailing_singletons (); + } private: typename Array<T>::ArrayRep *nil_rep (void) const - { - // NR was originally allocated with new, but that does not seem - // to be necessary since it will never be deleted. So just use - // a static object instead. + { + // NR was originally allocated with new, but that does not seem + // to be necessary since it will never be deleted. So just use + // a static object instead. - static typename Array<T>::ArrayRep nr; - return &nr; - } + static typename Array<T>::ArrayRep nr; + return &nr; + } protected: @@ -170,7 +171,7 @@ Array (T *sdata, octave_idx_type slen, octave_idx_type *adims, void *arep) : dimensions (adims), rep (reinterpret_cast<typename Array<T>::ArrayRep *> (arep)), - slice_data (sdata), slice_len (slen) {} + slice_data (sdata), slice_len (slen) { } public: @@ -179,42 +180,42 @@ Array (void) : dimensions (), rep (nil_rep ()), slice_data (rep->data), slice_len (rep->len) - { - rep->count++; - } + { + rep->count++; + } // Obsolete 1D ctor (there are no 1D arrays). explicit Array (octave_idx_type n) GCC_ATTR_DEPRECATED : dimensions (n, 1), rep (new typename Array<T>::ArrayRep (n)), slice_data (rep->data), slice_len (rep->len) - { } + { } // Obsolete initialized 1D ctor (there are no 1D arrays). explicit Array (octave_idx_type n, const T& val) GCC_ATTR_DEPRECATED : dimensions (n, 1), rep (new typename Array<T>::ArrayRep (n)), slice_data (rep->data), slice_len (rep->len) - { - fill (val); - } + { + fill (val); + } // nD uninitialized ctor. explicit Array (const dim_vector& dv) : dimensions (dv), rep (new typename Array<T>::ArrayRep (dv.safe_numel ())), slice_data (rep->data), slice_len (rep->len) - { - dimensions.chop_trailing_singletons (); - } + { + dimensions.chop_trailing_singletons (); + } // nD initialized ctor. explicit Array (const dim_vector& dv, const T& val) : dimensions (dv), rep (new typename Array<T>::ArrayRep (dv.safe_numel ())), slice_data (rep->data), slice_len (rep->len) - { - fill (val); - dimensions.chop_trailing_singletons (); - } + { + fill (val); + dimensions.chop_trailing_singletons (); + } // Reshape constructor. Array (const Array<T>& a, const dim_vector& dv); @@ -225,41 +226,41 @@ : dimensions (a.dims ()), rep (new typename Array<T>::ArrayRep (a.data (), a.length ())), slice_data (rep->data), slice_len (rep->len) - { } + { } // No type conversion case. Array (const Array<T>& a) : dimensions (a.dimensions), rep (a.rep), slice_data (a.slice_data), slice_len (a.slice_len) - { - rep->count++; - } + { + rep->count++; + } public: virtual ~Array (void) - { - if (--rep->count == 0) - delete rep; - } + { + if (--rep->count == 0) + delete rep; + } Array<T>& operator = (const Array<T>& a) - { - if (this != &a) - { - if (--rep->count == 0) - delete rep; + { + if (this != &a) + { + if (--rep->count == 0) + delete rep; - rep = a.rep; - rep->count++; + rep = a.rep; + rep->count++; - dimensions = a.dimensions; - slice_data = a.slice_data; - slice_len = a.slice_len; - } + dimensions = a.dimensions; + slice_data = a.slice_data; + slice_len = a.slice_len; + } - return *this; - } + return *this; + } void fill (const T& val); @@ -267,7 +268,7 @@ void clear (const dim_vector& dv); void clear (octave_idx_type r, octave_idx_type c) - { clear (dim_vector (r, c)); } + { clear (dim_vector (r, c)); } octave_idx_type capacity (void) const { return slice_len; } octave_idx_type length (void) const { return capacity (); } @@ -280,40 +281,41 @@ // Return the array as a column vector. Array<T> as_column (void) const - { - Array<T> retval (*this); - if (dimensions.length () != 2 || dimensions(1) != 1) - retval.dimensions = dim_vector (numel (), 1); + { + Array<T> retval (*this); + if (dimensions.length () != 2 || dimensions(1) != 1) + retval.dimensions = dim_vector (numel (), 1); - return retval; - } + return retval; + } // Return the array as a row vector. Array<T> as_row (void) const - { - Array<T> retval (*this); - if (dimensions.length () != 2 || dimensions(0) != 1) - retval.dimensions = dim_vector (1, numel ()); + { + Array<T> retval (*this); + if (dimensions.length () != 2 || dimensions(0) != 1) + retval.dimensions = dim_vector (1, numel ()); - return retval; - } + return retval; + } // Return the array as a matrix. Array<T> as_matrix (void) const - { - Array<T> retval (*this); - if (dimensions.length () != 2) - retval.dimensions = dimensions.redim (2); + { + Array<T> retval (*this); + if (dimensions.length () != 2) + retval.dimensions = dimensions.redim (2); - return retval; - } + return retval; + } octave_idx_type rows (void) const { return dim1 (); } octave_idx_type cols (void) const { return dim2 (); } octave_idx_type columns (void) const { return dim2 (); } octave_idx_type pages (void) const { return dim3 (); } - size_t byte_size (void) const { return static_cast<size_t> (numel ()) * sizeof (T); } + size_t byte_size (void) const + { return static_cast<size_t> (numel ()) * sizeof (T); } // Return a const-reference so that dims ()(i) works efficiently. const dim_vector& dims (void) const { return dimensions; } @@ -324,34 +326,37 @@ { dimensions.chop_trailing_singletons (); } octave_idx_type compute_index (octave_idx_type i, octave_idx_type j) const; - octave_idx_type compute_index (octave_idx_type i, octave_idx_type j, octave_idx_type k) const; + octave_idx_type compute_index (octave_idx_type i, octave_idx_type j, + octave_idx_type k) const; octave_idx_type compute_index (const Array<octave_idx_type>& ra_idx) const; - octave_idx_type compute_index_unchecked (const Array<octave_idx_type>& ra_idx) const - { return dimensions.compute_index (ra_idx.data (), ra_idx.length ()); } + octave_idx_type compute_index_unchecked (const Array<octave_idx_type>& ra_idx) + const + { return dimensions.compute_index (ra_idx.data (), ra_idx.length ()); } // No checking, even for multiple references, ever. T& xelem (octave_idx_type n) { return slice_data[n]; } crefT xelem (octave_idx_type n) const { return slice_data[n]; } - T& xelem (octave_idx_type i, octave_idx_type j) { return xelem (dim1 ()*j+i); } - crefT xelem (octave_idx_type i, octave_idx_type j) const { return xelem (dim1 ()*j+i); } + T& xelem (octave_idx_type i, octave_idx_type j) + { return xelem (dim1 ()*j+i); } + crefT xelem (octave_idx_type i, octave_idx_type j) const + { return xelem (dim1 ()*j+i); } T& xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) - { return xelem (i, dim2 ()*k+j); } + { return xelem (i, dim2 ()*k+j); } crefT xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const - { return xelem (i, dim2 ()*k+j); } + { return xelem (i, dim2 ()*k+j); } T& xelem (const Array<octave_idx_type>& ra_idx) - { return xelem (compute_index_unchecked (ra_idx)); } + { return xelem (compute_index_unchecked (ra_idx)); } crefT xelem (const Array<octave_idx_type>& ra_idx) const - { return xelem (compute_index_unchecked (ra_idx)); } + { return xelem (compute_index_unchecked (ra_idx)); } - // FIXME -- would be nice to fix this so that we don't - // unnecessarily force a copy, but that is not so easy, and I see no - // clean way to do it. + // FIXME: would be nice to fix this so that we don't unnecessarily force + // a copy, but that is not so easy, and I see no clean way to do it. T& checkelem (octave_idx_type n); T& checkelem (octave_idx_type i, octave_idx_type j); @@ -359,54 +364,71 @@ T& checkelem (const Array<octave_idx_type>& ra_idx); T& elem (octave_idx_type n) - { - make_unique (); - return xelem (n); - } + { + make_unique (); + return xelem (n); + } T& elem (octave_idx_type i, octave_idx_type j) { return elem (dim1 ()*j+i); } - T& elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return elem (i, dim2 ()*k+j); } + T& elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) + { return elem (i, dim2 ()*k+j); } T& elem (const Array<octave_idx_type>& ra_idx) - { return Array<T>::elem (compute_index_unchecked (ra_idx)); } + { return Array<T>::elem (compute_index_unchecked (ra_idx)); } #if defined (BOUNDS_CHECKING) T& operator () (octave_idx_type n) { return checkelem (n); } - T& operator () (octave_idx_type i, octave_idx_type j) { return checkelem (i, j); } - T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return checkelem (i, j, k); } - T& operator () (const Array<octave_idx_type>& ra_idx) { return checkelem (ra_idx); } + T& operator () (octave_idx_type i, octave_idx_type j) + { return checkelem (i, j); } + T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) + { return checkelem (i, j, k); } + T& operator () (const Array<octave_idx_type>& ra_idx) + { return checkelem (ra_idx); } #else T& operator () (octave_idx_type n) { return elem (n); } T& operator () (octave_idx_type i, octave_idx_type j) { return elem (i, j); } - T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return elem (i, j, k); } - T& operator () (const Array<octave_idx_type>& ra_idx) { return elem (ra_idx); } + T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) + { return elem (i, j, k); } + T& operator () (const Array<octave_idx_type>& ra_idx) + { return elem (ra_idx); } #endif crefT checkelem (octave_idx_type n) const; crefT checkelem (octave_idx_type i, octave_idx_type j) const; - crefT checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const; + crefT checkelem (octave_idx_type i, octave_idx_type j, + octave_idx_type k) const; crefT checkelem (const Array<octave_idx_type>& ra_idx) const; crefT elem (octave_idx_type n) const { return xelem (n); } - crefT elem (octave_idx_type i, octave_idx_type j) const { return xelem (i, j); } + crefT elem (octave_idx_type i, octave_idx_type j) const + { return xelem (i, j); } - crefT elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { return xelem (i, j, k); } + crefT elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const + { return xelem (i, j, k); } crefT elem (const Array<octave_idx_type>& ra_idx) const - { return Array<T>::xelem (compute_index_unchecked (ra_idx)); } + { return Array<T>::xelem (compute_index_unchecked (ra_idx)); } #if defined (BOUNDS_CHECKING) crefT operator () (octave_idx_type n) const { return checkelem (n); } - crefT operator () (octave_idx_type i, octave_idx_type j) const { return checkelem (i, j); } - crefT operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { return checkelem (i, j, k); } - crefT operator () (const Array<octave_idx_type>& ra_idx) const { return checkelem (ra_idx); } + crefT operator () (octave_idx_type i, octave_idx_type j) const + { return checkelem (i, j); } + crefT operator () (octave_idx_type i, octave_idx_type j, + octave_idx_type k) const + { return checkelem (i, j, k); } + crefT operator () (const Array<octave_idx_type>& ra_idx) const + { return checkelem (ra_idx); } #else crefT operator () (octave_idx_type n) const { return elem (n); } - crefT operator () (octave_idx_type i, octave_idx_type j) const { return elem (i, j); } - crefT operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { return elem (i, j, k); } - crefT operator () (const Array<octave_idx_type>& ra_idx) const { return elem (ra_idx); } + crefT operator () (octave_idx_type i, octave_idx_type j) const + { return elem (i, j); } + crefT operator () (octave_idx_type i, octave_idx_type j, + octave_idx_type k) const + { return elem (i, j, k); } + crefT operator () (const Array<octave_idx_type>& ra_idx) const + { return elem (ra_idx); } #endif // Fast extractors. All of these produce shallow copies. @@ -422,14 +444,14 @@ Array<T> linear_slice (octave_idx_type lo, octave_idx_type up) const; Array<T> reshape (octave_idx_type nr, octave_idx_type nc) const - { return Array<T> (*this, dim_vector (nr, nc)); } + { return Array<T> (*this, dim_vector (nr, nc)); } Array<T> reshape (const dim_vector& new_dims) const - { return Array<T> (*this, new_dims); } + { return Array<T> (*this, new_dims); } Array<T> permute (const Array<octave_idx_type>& vec, bool inv = false) const; Array<T> ipermute (const Array<octave_idx_type>& vec) const - { return permute (vec, true); } + { return permute (vec, true); } bool is_square (void) const { return (dim1 () == dim2 ()); } @@ -467,7 +489,8 @@ void resize (octave_idx_type n) GCC_ATTR_DEPRECATED { resize1 (n); } - void resize (octave_idx_type nr, octave_idx_type nc, const T& rfv) GCC_ATTR_DEPRECATED + void resize (octave_idx_type nr, octave_idx_type nc, + const T& rfv) GCC_ATTR_DEPRECATED { resize2 (nr, nc, rfv); } @@ -481,7 +504,7 @@ void resize (const dim_vector& dv) { resize (dv, resize_fill_value ()); } // Indexing with possible resizing and fill - // FIXME -- this is really a corner case, that should better be + // FIXME: this is really a corner case, that should better be // handled directly in liboctinterp. Array<T> index (const idx_vector& i, bool resize_ok, const T& rfv) const; @@ -490,13 +513,16 @@ return index (i, resize_ok, resize_fill_value ()); } - Array<T> index (const idx_vector& i, const idx_vector& j, bool resize_ok, const T& rfv) const; - Array<T> index (const idx_vector& i, const idx_vector& j, bool resize_ok) const + Array<T> index (const idx_vector& i, const idx_vector& j, bool resize_ok, + const T& rfv) const; + Array<T> index (const idx_vector& i, const idx_vector& j, + bool resize_ok) const { return index (i, j, resize_ok, resize_fill_value ()); } - Array<T> index (const Array<idx_vector>& ia, bool resize_ok, const T& rfv) const; + Array<T> index (const Array<idx_vector>& ia, bool resize_ok, + const T& rfv) const; Array<T> index (const Array<idx_vector>& ia, bool resize_ok) const { return index (ia, resize_ok, resize_fill_value ()); @@ -510,7 +536,8 @@ assign (i, rhs, resize_fill_value ()); } - void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rhs, const T& rfv); + void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rhs, + const T& rfv); void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rhs) { assign (i, j, rhs, resize_fill_value ()); @@ -543,15 +570,15 @@ Array<T>& insert (const Array<T>& a, octave_idx_type r, octave_idx_type c); void maybe_economize (void) - { - if (rep->count == 1 && slice_len != rep->len) - { - ArrayRep *new_rep = new ArrayRep (slice_data, slice_len); - delete rep; - rep = new_rep; - slice_data = rep->data; - } - } + { + if (rep->count == 1 && slice_len != rep->len) + { + ArrayRep *new_rep = new ArrayRep (slice_data, slice_len); + delete rep; + rep = new_rep; + slice_data = rep->data; + } + } void print_info (std::ostream& os, const std::string& prefix) const; @@ -578,14 +605,16 @@ // Ditto, but for an array of values, specializing on the case when values // are sorted. NaNs get the value N. - Array<octave_idx_type> lookup (const Array<T>& values, sortmode mode = UNSORTED) const; + Array<octave_idx_type> lookup (const Array<T>& values, + sortmode mode = UNSORTED) const; // Count nonzero elements. octave_idx_type nnz (void) const; // Find indices of (at most n) nonzero elements. If n is specified, backward // specifies search from backward. - Array<octave_idx_type> find (octave_idx_type n = -1, bool backward = false) const; + Array<octave_idx_type> find (octave_idx_type n = -1, + bool backward = false) const; // Returns the n-th element in increasing order, using the same ordering as // used for sort. n can either be a scalar index or a contiguous range. @@ -691,7 +720,7 @@ private: void resize2 (octave_idx_type nr, octave_idx_type nc, const T& rfv); - void resize2 (octave_idx_type nr, octave_idx_type nc) + void resize2 (octave_idx_type nr, octave_idx_type nc) { resize2 (nr, nc, resize_fill_value ()); } @@ -723,13 +752,13 @@ explicit NoAlias (X x, Y y, Z z) : ArrayClass (x, y, z) { } T& operator () (octave_idx_type n) - { return ArrayClass::xelem (n); } + { return ArrayClass::xelem (n); } T& operator () (octave_idx_type i, octave_idx_type j) - { return ArrayClass::xelem (i, j); } + { return ArrayClass::xelem (i, j); } T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) - { return ArrayClass::xelem (i, j, k); } + { return ArrayClass::xelem (i, j, k); } T& operator () (const Array<octave_idx_type>& ra_idx) - { return ArrayClass::xelem (ra_idx); } + { return ArrayClass::xelem (ra_idx); } }; template <class T>
--- a/liboctave/array/Array3.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Array3.h Sat Oct 26 18:57:05 2013 -0700 @@ -42,7 +42,8 @@ Array3 (void) : Array<T> (dim_vector (0, 0, 0)) { } - Array3 (octave_idx_type r, octave_idx_type c, octave_idx_type p) : Array<T> (dim_vector (r, c, p)) { } + Array3 (octave_idx_type r, octave_idx_type c, + octave_idx_type p) : Array<T> (dim_vector (r, c, p)) { } Array3 (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val) : Array<T> (dim_vector (r, c, p), val) { } @@ -50,37 +51,39 @@ Array3 (const Array3<T>& a) : Array<T> (a, a.dims ()) { } - Array3 (const Array<T>& a, octave_idx_type r, octave_idx_type c, octave_idx_type p) + Array3 (const Array<T>& a, octave_idx_type r, octave_idx_type c, + octave_idx_type p) : Array<T> (a, dim_vector (r, c, p)) { } ~Array3 (void) { } Array3<T>& operator = (const Array3<T>& a) - { - if (this != &a) - Array<T>::operator = (a); + { + if (this != &a) + Array<T>::operator = (a); - return *this; - } + return *this; + } void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p) - { Array<T>::resize (dim_vector (r, c, p)); } + { Array<T>::resize (dim_vector (r, c, p)); } - void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val) - { Array<T>::resize (dim_vector (r, c, p), val); } + void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p, + const T& val) + { Array<T>::resize (dim_vector (r, c, p), val); } Array3<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const - { - Array<T> tmp = Array<T>::sort (dim, mode); - return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ()); - } + { + Array<T> tmp = Array<T>::sort (dim, mode); + return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ()); + } Array3<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, - sortmode mode = ASCENDING) const - { - Array<T> tmp = Array<T>::sort (sidx, dim, mode); - return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ()); - } + sortmode mode = ASCENDING) const + { + Array<T> tmp = Array<T>::sort (sidx, dim, mode); + return Array3<T> (tmp, tmp.rows (), tmp.columns (), tmp.pages ()); + } }; // If we're with GNU C++, issue a warning.
--- a/liboctave/array/CColVector.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CColVector.cc Sat Oct 26 18:57:05 2013 -0700 @@ -53,7 +53,7 @@ // Complex Column Vector class ComplexColumnVector::ComplexColumnVector (const ColumnVector& a) - : MArray<Complex> (a) + : MArray<Complex> (a) { } @@ -176,7 +176,8 @@ } ComplexColumnVector& -ComplexColumnVector::fill (const Complex& val, octave_idx_type r1, octave_idx_type r2) +ComplexColumnVector::fill (const Complex& val, + octave_idx_type r1, octave_idx_type r2) { octave_idx_type len = length ();
--- a/liboctave/array/CColVector.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CColVector.h Sat Oct 26 18:57:05 2013 -0700 @@ -32,8 +32,8 @@ OCTAVE_API ComplexColumnVector : public MArray<Complex> { -friend class ComplexMatrix; -friend class ComplexRowVector; + friend class ComplexMatrix; + friend class ComplexRowVector; public: @@ -59,10 +59,10 @@ explicit ComplexColumnVector (const ColumnVector& a); ComplexColumnVector& operator = (const ComplexColumnVector& a) - { - MArray<Complex>::operator = (a); - return *this; - } + { + MArray<Complex>::operator = (a); + return *this; + } bool operator == (const ComplexColumnVector& a) const; bool operator != (const ComplexColumnVector& a) const; @@ -74,8 +74,10 @@ ComplexColumnVector& fill (double val); ComplexColumnVector& fill (const Complex& val); - ComplexColumnVector& fill (double val, octave_idx_type r1, octave_idx_type r2); - ComplexColumnVector& fill (const Complex& val, octave_idx_type r1, octave_idx_type r2); + ComplexColumnVector& fill (double val, + octave_idx_type r1, octave_idx_type r2); + ComplexColumnVector& fill (const Complex& val, + octave_idx_type r1, octave_idx_type r2); ComplexColumnVector stack (const ColumnVector& a) const; ComplexColumnVector stack (const ComplexColumnVector& a) const; @@ -99,26 +101,26 @@ // matrix by column vector -> column vector operations friend OCTAVE_API ComplexColumnVector operator * (const ComplexMatrix& a, - const ColumnVector& b); + const ColumnVector& b); friend OCTAVE_API ComplexColumnVector operator * (const ComplexMatrix& a, - const ComplexColumnVector& b); + const ComplexColumnVector& b); // matrix by column vector -> column vector operations friend OCTAVE_API ComplexColumnVector operator * (const Matrix& a, - const ComplexColumnVector& b); + const ComplexColumnVector& b); // diagonal matrix by column vector -> column vector operations friend OCTAVE_API ComplexColumnVector operator * (const DiagMatrix& a, - const ComplexColumnVector& b); + const ComplexColumnVector& b); friend OCTAVE_API ComplexColumnVector operator * (const ComplexDiagMatrix& a, - const ColumnVector& b); + const ColumnVector& b); friend OCTAVE_API ComplexColumnVector operator * (const ComplexDiagMatrix& a, - const ComplexColumnVector& b); + const ComplexColumnVector& b); // other operations @@ -129,8 +131,10 @@ // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ComplexColumnVector& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexColumnVector& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const ComplexColumnVector& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + ComplexColumnVector& a); void resize (octave_idx_type n, const Complex& rfv = Complex (0)) { @@ -138,7 +142,7 @@ } void clear (octave_idx_type n) - { Array<Complex>::clear (n, 1); } + { Array<Complex>::clear (n, 1); } };
--- a/liboctave/array/CDiagMatrix.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CDiagMatrix.cc Sat Oct 26 18:57:05 2013 -0700 @@ -91,7 +91,8 @@ } ComplexDiagMatrix& -ComplexDiagMatrix::fill (const Complex& val, octave_idx_type beg, octave_idx_type end) +ComplexDiagMatrix::fill (const Complex& val, + octave_idx_type beg, octave_idx_type end) { if (beg < 0 || end >= length () || end < beg) { @@ -248,7 +249,8 @@ // resize is the destructive analog for this one ComplexMatrix -ComplexDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const +ComplexDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const { if (r1 > r2) { std::swap (r1, r2); } if (c1 > c2) { std::swap (c1, c2); }
--- a/liboctave/array/CDiagMatrix.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CDiagMatrix.h Sat Oct 26 18:57:05 2013 -0700 @@ -41,7 +41,8 @@ ComplexDiagMatrix (void) : MDiagArray2<Complex> () { } - ComplexDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<Complex> (r, c) { } + ComplexDiagMatrix (octave_idx_type r, octave_idx_type c) + : MDiagArray2<Complex> (r, c) { } ComplexDiagMatrix (octave_idx_type r, octave_idx_type c, const Complex& val) : MDiagArray2<Complex> (r, c, val) { } @@ -52,7 +53,8 @@ explicit ComplexDiagMatrix (const Array<double>& a) : MDiagArray2<Complex> (Array<Complex> (a)) { } - ComplexDiagMatrix (const Array<Complex>& a, octave_idx_type r, octave_idx_type c) + ComplexDiagMatrix (const Array<Complex>& a, octave_idx_type r, + octave_idx_type c) : MDiagArray2<Complex> (a, r, c) { } explicit ComplexDiagMatrix (const DiagMatrix& a); @@ -68,18 +70,20 @@ : MDiagArray2<Complex> (a) { } ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) - { - MDiagArray2<Complex>::operator = (a); - return *this; - } + { + MDiagArray2<Complex>::operator = (a); + return *this; + } bool operator == (const ComplexDiagMatrix& a) const; bool operator != (const ComplexDiagMatrix& a) const; ComplexDiagMatrix& fill (double val); ComplexDiagMatrix& fill (const Complex& val); - ComplexDiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); - ComplexDiagMatrix& fill (const Complex& val, octave_idx_type beg, octave_idx_type end); + ComplexDiagMatrix& fill (double val, + octave_idx_type beg, octave_idx_type end); + ComplexDiagMatrix& fill (const Complex& val, + octave_idx_type beg, octave_idx_type end); ComplexDiagMatrix& fill (const ColumnVector& a); ComplexDiagMatrix& fill (const ComplexColumnVector& a); ComplexDiagMatrix& fill (const RowVector& a); @@ -89,15 +93,18 @@ ComplexDiagMatrix& fill (const RowVector& a, octave_idx_type beg); ComplexDiagMatrix& fill (const ComplexRowVector& a, octave_idx_type beg); - ComplexDiagMatrix hermitian (void) const { return MDiagArray2<Complex>::hermitian (std::conj); } - ComplexDiagMatrix transpose (void) const { return MDiagArray2<Complex>::transpose (); } + ComplexDiagMatrix hermitian (void) const + { return MDiagArray2<Complex>::hermitian (std::conj); } + ComplexDiagMatrix transpose (void) const + { return MDiagArray2<Complex>::transpose (); } DiagMatrix abs (void) const; friend OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); // resize is the destructive analog for this one - ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; + ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const; // extract row or column i @@ -121,14 +128,15 @@ // other operations ComplexColumnVector extract_diag (octave_idx_type k = 0) const - { return MDiagArray2<Complex>::extract_diag (k); } + { return MDiagArray2<Complex>::extract_diag (k); } ComplexDET determinant (void) const; double rcond (void) const; // i/o - friend std::ostream& operator << (std::ostream& os, const ComplexDiagMatrix& a); + friend std::ostream& operator << (std::ostream& os, + const ComplexDiagMatrix& a); };
--- a/liboctave/array/CMatrix.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CMatrix.cc Sat Oct 26 18:57:05 2013 -0700 @@ -300,8 +300,7 @@ elem (i, i) = a.elem (i, i); } -// FIXME -- could we use a templated mixed-type copy function -// here? +// FIXME: could we use a templated mixed-type copy function here? ComplexMatrix::ComplexMatrix (const boolMatrix& a) : MArray<Complex> (a) @@ -410,7 +409,8 @@ } ComplexMatrix& -ComplexMatrix::insert (const ColumnVector& a, octave_idx_type r, octave_idx_type c) +ComplexMatrix::insert (const ColumnVector& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_len = a.length (); @@ -432,7 +432,8 @@ } ComplexMatrix& -ComplexMatrix::insert (const DiagMatrix& a, octave_idx_type r, octave_idx_type c) +ComplexMatrix::insert (const DiagMatrix& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols (); @@ -459,14 +460,16 @@ } ComplexMatrix& -ComplexMatrix::insert (const ComplexMatrix& a, octave_idx_type r, octave_idx_type c) +ComplexMatrix::insert (const ComplexMatrix& a, + octave_idx_type r, octave_idx_type c) { Array<Complex>::insert (a, r, c); return *this; } ComplexMatrix& -ComplexMatrix::insert (const ComplexRowVector& a, octave_idx_type r, octave_idx_type c) +ComplexMatrix::insert (const ComplexRowVector& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_len = a.length (); if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ()) @@ -482,7 +485,8 @@ } ComplexMatrix& -ComplexMatrix::insert (const ComplexColumnVector& a, octave_idx_type r, octave_idx_type c) +ComplexMatrix::insert (const ComplexColumnVector& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_len = a.length (); @@ -504,7 +508,8 @@ } ComplexMatrix& -ComplexMatrix::insert (const ComplexDiagMatrix& a, octave_idx_type r, octave_idx_type c) +ComplexMatrix::insert (const ComplexDiagMatrix& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols (); @@ -567,7 +572,8 @@ } ComplexMatrix& -ComplexMatrix::fill (double val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) +ComplexMatrix::fill (double val, octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) { octave_idx_type nr = rows (); octave_idx_type nc = cols (); @@ -595,7 +601,8 @@ } ComplexMatrix& -ComplexMatrix::fill (const Complex& val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) +ComplexMatrix::fill (const Complex& val, octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) { octave_idx_type nr = rows (); octave_idx_type nc = cols (); @@ -927,7 +934,8 @@ // resize is the destructive equivalent for this one ComplexMatrix -ComplexMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const +ComplexMatrix::extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const { if (r1 > r2) { std::swap (r1, r2); } if (c1 > c2) { std::swap (c1, c2); } @@ -936,7 +944,8 @@ } ComplexMatrix -ComplexMatrix::extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const +ComplexMatrix::extract_n (octave_idx_type r1, octave_idx_type c1, + octave_idx_type nr, octave_idx_type nc) const { return index (idx_vector (r1, r1 + nr), idx_vector (c1, c1 + nc)); } @@ -1089,7 +1098,8 @@ // Calculate the norm of the matrix, for later use. double anorm; if (calc_cond) - anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)).max (); + anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)) + .max (); F77_XFCN (zgetrf, ZGETRF, (nc, nc, tmp_data, nr, pipvt, info)); @@ -1558,7 +1568,8 @@ } ComplexDET -ComplexMatrix::determinant (octave_idx_type& info, double& rcon, int calc_cond) const +ComplexMatrix::determinant (octave_idx_type& info, double& rcon, + int calc_cond) const { MatrixType mattype (*this); return determinant (mattype, info, rcon, calc_cond); @@ -1796,7 +1807,7 @@ Complex *tmp_data = atmp.fortran_vec (); anorm = atmp.abs().sum(). - row(static_cast<octave_idx_type>(0)).max(); + row(static_cast<octave_idx_type>(0)).max(); F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -1839,7 +1850,7 @@ if (anorm < 0.) anorm = atmp.abs ().sum (). - row(static_cast<octave_idx_type>(0)).max (); + row(static_cast<octave_idx_type>(0)).max (); Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); @@ -2096,7 +2107,7 @@ { volatile int typ = mattype.type (); - // Calculate the norm of the matrix, for later use. + // Calculate the norm of the matrix, for later use. double anorm = -1.; if (typ == MatrixType::Hermitian) @@ -2191,7 +2202,8 @@ // Calculate the norm of the matrix, for later use. if (anorm < 0.) - anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max (); + anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)) + .max (); F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -2334,9 +2346,11 @@ else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) retval = ltsolve (mattype, b, info, rcon, sing_handler, false, transt); else if (transt == blas_trans) - return transpose ().solve (mattype, b, info, rcon, sing_handler, singular_fallback); + return transpose ().solve (mattype, b, info, rcon, sing_handler, + singular_fallback); else if (transt == blas_conj_trans) - retval = hermitian ().solve (mattype, b, info, rcon, sing_handler, singular_fallback); + retval = hermitian ().solve (mattype, b, info, rcon, sing_handler, + singular_fallback); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) retval = fsolve (mattype, b, info, rcon, sing_handler, true); else if (typ != MatrixType::Rectangular) @@ -2381,7 +2395,8 @@ ComplexColumnVector ComplexMatrix::solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + solve_singularity_handler sing_handler, + blas_trans_type transt) const { return solve (typ, ComplexColumnVector (b), info, rcon, sing_handler, transt); } @@ -2412,7 +2427,8 @@ ComplexColumnVector ComplexMatrix::solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + solve_singularity_handler sing_handler, + blas_trans_type transt) const { ComplexMatrix tmp (b); @@ -2436,14 +2452,16 @@ } ComplexMatrix -ComplexMatrix::solve (const Matrix& b, octave_idx_type& info, double& rcon) const +ComplexMatrix::solve (const Matrix& b, octave_idx_type& info, + double& rcon) const { return solve (b, info, rcon, 0); } ComplexMatrix ComplexMatrix::solve (const Matrix& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + solve_singularity_handler sing_handler, + blas_trans_type transt) const { ComplexMatrix tmp (b); return solve (tmp, info, rcon, sing_handler, transt); @@ -2465,14 +2483,17 @@ } ComplexMatrix -ComplexMatrix::solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon) const +ComplexMatrix::solve (const ComplexMatrix& b, octave_idx_type& info, + double& rcon) const { return solve (b, info, rcon, 0); } ComplexMatrix -ComplexMatrix::solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const +ComplexMatrix::solve (const ComplexMatrix& b, octave_idx_type& info, + double& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt) const { MatrixType mattype (*this); return solve (mattype, b, info, rcon, sing_handler, true, transt); @@ -2503,7 +2524,8 @@ ComplexColumnVector ComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + solve_singularity_handler sing_handler, + blas_trans_type transt) const { return solve (ComplexColumnVector (b), info, rcon, sing_handler, transt); } @@ -2533,7 +2555,8 @@ ComplexColumnVector ComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + solve_singularity_handler sing_handler, + blas_trans_type transt) const { MatrixType mattype (*this); return solve (mattype, b, info, rcon, sing_handler, transt); @@ -2670,8 +2693,9 @@ nlvl = 0; octave_idx_type lrwork = minmn*(10 + 2*smlsiz + 8*nlvl) - + 3*smlsiz*nrhs + std::max ((smlsiz+1)*(smlsiz+1), - n*(1+nrhs) + 2*nrhs); + + 3*smlsiz*nrhs + + std::max ((smlsiz+1)*(smlsiz+1), + n*(1+nrhs) + 2*nrhs); if (lrwork < 1) lrwork = 1; Array<double> rwork (dim_vector (lrwork, 1)); @@ -2778,7 +2802,8 @@ } ComplexColumnVector -ComplexMatrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info) const +ComplexMatrix::lssolve (const ComplexColumnVector& b, + octave_idx_type& info) const { octave_idx_type rank; double rcon; @@ -2860,7 +2885,7 @@ nlvl = 0; octave_idx_type lrwork = minmn*(10 + 2*smlsiz + 8*nlvl) - + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1); + + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1); if (lrwork < 1) lrwork = 1; Array<double> rwork (dim_vector (lrwork, 1)); @@ -3172,8 +3197,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? boolMatrix ComplexMatrix::all (int dim) const @@ -3319,7 +3343,8 @@ if (! xisnan (tmp_min)) { - abs_min = real_only ? std::real (tmp_min) : std::abs (tmp_min); + abs_min = real_only ? std::real (tmp_min) + : std::abs (tmp_min); break; } } @@ -3393,7 +3418,8 @@ if (! xisnan (tmp_max)) { - abs_max = real_only ? std::real (tmp_max) : std::abs (tmp_max); + abs_max = real_only ? std::real (tmp_max) + : std::abs (tmp_max); break; } } @@ -3467,7 +3493,8 @@ if (! xisnan (tmp_min)) { - abs_min = real_only ? std::real (tmp_min) : std::abs (tmp_min); + abs_min = real_only ? std::real (tmp_min) + : std::abs (tmp_min); break; } } @@ -3541,7 +3568,8 @@ if (! xisnan (tmp_max)) { - abs_max = real_only ? std::real (tmp_max) : std::abs (tmp_max); + abs_max = real_only ? std::real (tmp_max) + : std::abs (tmp_max); break; } } @@ -3645,8 +3673,7 @@ { ComplexMatrix retval; - // FIXME -- need to check that a, b, and c are all the same - // size. + // FIXME: need to check that a, b, and c are all the same size. // Compute Schur decompositions @@ -3663,8 +3690,7 @@ ComplexMatrix cx = ua.hermitian () * c * ub; - // Solve the sylvester equation, back-transform, and return the - // solution. + // Solve the sylvester equation, back-transform, and return the solution. octave_idx_type a_nr = a.rows (); octave_idx_type b_nr = b.rows (); @@ -3683,7 +3709,7 @@ F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - // FIXME -- check info? + // FIXME: check info? retval = -ua * cx * ub.hermitian (); @@ -3764,7 +3790,7 @@ { octave_idx_type lda = a.rows (); - // FIXME -- looking at the reference BLAS, it appears that it + // FIXME: looking at the reference BLAS, it appears that it // should not be necessary to initialize the output matrix if // BETA is 0 in the call to ZHERK, but ATLAS appears to // use the result matrix before zeroing the elements. @@ -3812,13 +3838,16 @@ { if (cja == cjb) { - F77_FUNC (xzdotu, XZDOTU) (a_nc, a.data (), 1, b.data (), 1, *c); + F77_FUNC (xzdotu, XZDOTU) (a_nc, a.data (), 1, b.data (), 1, + *c); if (cja) *c = std::conj (*c); } else if (cja) - F77_FUNC (xzdotc, XZDOTC) (a_nc, a.data (), 1, b.data (), 1, *c); + F77_FUNC (xzdotc, XZDOTC) (a_nc, a.data (), 1, b.data (), 1, + *c); else - F77_FUNC (xzdotc, XZDOTC) (a_nc, b.data (), 1, a.data (), 1, *c); + F77_FUNC (xzdotc, XZDOTC) (a_nc, b.data (), 1, a.data (), 1, + *c); } else if (b_nc == 1 && ! cjb) { @@ -3859,8 +3888,7 @@ return xgemm (a, b); } -// 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) \ @@ -4055,7 +4083,8 @@ octave_idx_type m = x1.length (); if (x2.length () != m) - (*current_liboctave_error_handler) ("linspace: vectors must be of equal length"); + (*current_liboctave_error_handler) + ("linspace: vectors must be of equal length"); NoAlias<ComplexMatrix> retval;
--- a/liboctave/array/CMatrix.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CMatrix.h Sat Oct 26 18:57:05 2013 -0700 @@ -85,10 +85,10 @@ explicit ComplexMatrix (const charMatrix& a); ComplexMatrix& operator = (const ComplexMatrix& a) - { - MArray<Complex>::operator = (a); - return *this; - } + { + MArray<Complex>::operator = (a); + return *this; + } bool operator == (const ComplexMatrix& a) const; bool operator != (const ComplexMatrix& a) const; @@ -98,19 +98,30 @@ // destructive insert/delete/reorder operations ComplexMatrix& insert (const Matrix& a, octave_idx_type r, octave_idx_type c); - ComplexMatrix& insert (const RowVector& a, octave_idx_type r, octave_idx_type c); - ComplexMatrix& insert (const ColumnVector& a, octave_idx_type r, octave_idx_type c); - ComplexMatrix& insert (const DiagMatrix& a, octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const RowVector& a, + octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const ColumnVector& a, + octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const DiagMatrix& a, + octave_idx_type r, octave_idx_type c); - ComplexMatrix& insert (const ComplexMatrix& a, octave_idx_type r, octave_idx_type c); - ComplexMatrix& insert (const ComplexRowVector& a, octave_idx_type r, octave_idx_type c); - ComplexMatrix& insert (const ComplexColumnVector& a, octave_idx_type r, octave_idx_type c); - ComplexMatrix& insert (const ComplexDiagMatrix& a, octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const ComplexMatrix& a, + octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const ComplexRowVector& a, + octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const ComplexColumnVector& a, + octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const ComplexDiagMatrix& a, + octave_idx_type r, octave_idx_type c); ComplexMatrix& fill (double val); ComplexMatrix& fill (const Complex& val); - ComplexMatrix& fill (double val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); - ComplexMatrix& fill (const Complex& val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); + ComplexMatrix& fill (double val, + octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2); + ComplexMatrix& fill (const Complex& val, + octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2); ComplexMatrix append (const Matrix& a) const; ComplexMatrix append (const RowVector& a) const; @@ -133,17 +144,19 @@ ComplexMatrix stack (const ComplexDiagMatrix& a) const; ComplexMatrix hermitian (void) const - { return MArray<Complex>::hermitian (std::conj); } + { return MArray<Complex>::hermitian (std::conj); } ComplexMatrix transpose (void) const - { return MArray<Complex>::transpose (); } + { return MArray<Complex>::transpose (); } friend OCTAVE_API ComplexMatrix conj (const ComplexMatrix& a); // resize is the destructive equivalent for this one - ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; + ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const; - ComplexMatrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const; + ComplexMatrix extract_n (octave_idx_type r1, octave_idx_type c1, + octave_idx_type nr, octave_idx_type nc) const; // extract row or column i. @@ -186,7 +199,8 @@ ComplexDET determinant (void) const; ComplexDET determinant (octave_idx_type& info) const; - ComplexDET determinant (octave_idx_type& info, double& rcon, int calc_cond = 1) const; + ComplexDET determinant (octave_idx_type& info, double& rcon, + int calc_cond = 1) const; ComplexDET determinant (MatrixType &mattype, octave_idx_type& info, double& rcon, int calc_cond = 1) const; @@ -196,22 +210,23 @@ private: // Upper triangular matrix solvers ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, - bool calc_cond = false, - blas_trans_type transt = blas_no_trans) const; + octave_idx_type& info, double& rcon, + solve_singularity_handler sing_handler, + bool calc_cond = false, + blas_trans_type transt = blas_no_trans) const; // Lower triangular matrix solvers ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, - bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; + octave_idx_type& info, double& rcon, + solve_singularity_handler sing_handler, + bool calc_cond = false, + blas_trans_type transt = blas_no_trans) const; // Full matrix solvers (umfpack/cholesky) ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcon, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; public: // Generic interface to solver with no probing of type @@ -260,15 +275,18 @@ // Generic interface to solver with probing of type ComplexMatrix solve (const Matrix& b) const; ComplexMatrix solve (const Matrix& b, octave_idx_type& info) const; - ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon) const; + ComplexMatrix solve (const Matrix& b, octave_idx_type& info, + double& rcon) const; ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ComplexMatrix solve (const ComplexMatrix& b) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; - ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon) const; - ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon, + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, + double& rcon) const; + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, + double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; @@ -276,16 +294,21 @@ ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon) const; - ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon, + ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, + double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ComplexColumnVector solve (const ComplexColumnVector& b) const; - ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; - ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, + ComplexColumnVector solve (const ComplexColumnVector& b, + octave_idx_type& info) const; + ComplexColumnVector solve (const ComplexColumnVector& b, + octave_idx_type& info, double& rcon) const; - ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, - double& rcon, solve_singularity_handler sing_handler, + ComplexColumnVector solve (const ComplexColumnVector& b, + octave_idx_type& info, + double& rcon, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ComplexMatrix lssolve (const Matrix& b) const; @@ -376,8 +399,10 @@ // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ComplexMatrix& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexMatrix& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const ComplexMatrix& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + ComplexMatrix& a); }; extern OCTAVE_API ComplexMatrix conj (const ComplexMatrix& a); @@ -404,17 +429,22 @@ blas_trans_type transa = blas_no_trans, blas_trans_type transb = blas_no_trans); -extern OCTAVE_API ComplexMatrix operator * (const Matrix&, const ComplexMatrix&); -extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, const Matrix&); -extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, const ComplexMatrix&); +extern OCTAVE_API ComplexMatrix operator * (const Matrix&, + const ComplexMatrix&); +extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, + const Matrix&); +extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, + const ComplexMatrix&); extern OCTAVE_API ComplexMatrix min (const Complex& c, const ComplexMatrix& m); extern OCTAVE_API ComplexMatrix min (const ComplexMatrix& m, const Complex& c); -extern OCTAVE_API ComplexMatrix min (const ComplexMatrix& a, const ComplexMatrix& b); +extern OCTAVE_API ComplexMatrix min (const ComplexMatrix& a, + const ComplexMatrix& b); extern OCTAVE_API ComplexMatrix max (const Complex& c, const ComplexMatrix& m); extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& m, const Complex& c); -extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& a, const ComplexMatrix& b); +extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& a, + const ComplexMatrix& b); extern OCTAVE_API ComplexMatrix linspace (const ComplexColumnVector& x1, const ComplexColumnVector& x2,
--- a/liboctave/array/CNDArray.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CNDArray.cc Sat Oct 26 18:57:05 2013 -0700 @@ -111,7 +111,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) octave_fftw::ifft (in + k * stride * n, out + k * stride * n, - n, howmany, stride, dist); + n, howmany, stride, dist); return retval; } @@ -293,7 +293,7 @@ for (octave_idx_type i = 0; i < npts; i++) retval((i + k*npts)*stride + j*dist) = tmp[i] / - static_cast<double> (npts); + static_cast<double> (npts); } } @@ -386,8 +386,8 @@ F77_FUNC (zfftb, ZFFTB) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval((l + k*npts)*stride + j*dist) = prow[l] / - static_cast<double> (npts); + retval((l + k*npts)*stride + j*dist) = + prow[l] / static_cast<double> (npts); } } @@ -481,8 +481,8 @@ F77_FUNC (zfftb, ZFFTB) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval((l + k*npts)*stride + j*dist) = prow[l] / - static_cast<double> (npts); + retval((l + k*npts)*stride + j*dist) = + prow[l] / static_cast<double> (npts); } } @@ -505,7 +505,7 @@ return do_mx_unary_op<bool, Complex> (*this, mx_inline_not); } -// FIXME -- this is not quite the right thing. +// FIXME: this is not quite the right thing. bool ComplexNDArray::any_element_is_nan (void) const @@ -642,7 +642,8 @@ } ComplexNDArray -ComplexNDArray::concat (const ComplexNDArray& rb, const Array<octave_idx_type>& ra_idx) +ComplexNDArray::concat (const ComplexNDArray& rb, + const Array<octave_idx_type>& ra_idx) { if (rb.numel () > 0) insert (rb, ra_idx); @@ -798,14 +799,16 @@ } ComplexNDArray& -ComplexNDArray::insert (const ComplexNDArray& a, octave_idx_type r, octave_idx_type c) +ComplexNDArray::insert (const ComplexNDArray& a, + octave_idx_type r, octave_idx_type c) { Array<Complex>::insert (a, r, c); return *this; } ComplexNDArray& -ComplexNDArray::insert (const ComplexNDArray& a, const Array<octave_idx_type>& ra_idx) +ComplexNDArray::insert (const ComplexNDArray& a, + const Array<octave_idx_type>& ra_idx) { Array<Complex>::insert (a, ra_idx); return *this; @@ -817,7 +820,7 @@ ComplexMatrix retval; if (ndims () == 2) - retval = ComplexMatrix (Array<Complex> (*this)); + retval = ComplexMatrix (Array<Complex> (*this)); else (*current_liboctave_error_handler) ("invalid conversion of ComplexNDArray to ComplexMatrix"); @@ -876,16 +879,16 @@ { Complex tmp; for (octave_idx_type i = 0; i < nel; i++) - { - tmp = octave_read_value<Complex> (is); - if (is) - a.elem (i) = tmp; - else - goto done; - } + { + tmp = octave_read_value<Complex> (is); + if (is) + a.elem (i) = tmp; + else + goto done; + } } - done: +done: return is; }
--- a/liboctave/array/CNDArray.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CNDArray.h Sat Oct 26 18:57:05 2013 -0700 @@ -58,16 +58,16 @@ ComplexNDArray (const charNDArray&); ComplexNDArray& operator = (const ComplexNDArray& a) - { - MArray<Complex>::operator = (a); - return *this; - } + { + MArray<Complex>::operator = (a); + return *this; + } // unary operations boolNDArray operator ! (void) const; - // FIXME -- this is not quite the right thing. + // FIXME: this is not quite the right thing. bool any_element_is_nan (void) const; bool any_element_is_inf_or_nan (void) const; @@ -84,8 +84,10 @@ ComplexNDArray sum (int dim = -1) const; ComplexNDArray xsum (int dim = -1) const; ComplexNDArray sumsq (int dim = -1) const; - ComplexNDArray concat (const ComplexNDArray& rb, const Array<octave_idx_type>& ra_idx); - ComplexNDArray concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx); + ComplexNDArray concat (const ComplexNDArray& rb, + const Array<octave_idx_type>& ra_idx); + ComplexNDArray concat (const NDArray& rb, + const Array<octave_idx_type>& ra_idx); ComplexNDArray max (int dim = -1) const; ComplexNDArray max (Array<octave_idx_type>& index, int dim = -1) const; @@ -99,9 +101,12 @@ ComplexNDArray diff (octave_idx_type order = 1, int dim = -1) const; - ComplexNDArray& insert (const NDArray& a, octave_idx_type r, octave_idx_type c); - ComplexNDArray& insert (const ComplexNDArray& a, octave_idx_type r, octave_idx_type c); - ComplexNDArray& insert (const ComplexNDArray& a, const Array<octave_idx_type>& ra_idx); + ComplexNDArray& insert (const NDArray& a, + octave_idx_type r, octave_idx_type c); + ComplexNDArray& insert (const ComplexNDArray& a, + octave_idx_type r, octave_idx_type c); + ComplexNDArray& insert (const ComplexNDArray& a, + const Array<octave_idx_type>& ra_idx); NDArray abs (void) const; boolNDArray isnan (void) const; @@ -128,12 +133,14 @@ int start_dimension = 0); static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions); + const dim_vector& dimensions); // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ComplexNDArray& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexNDArray& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const ComplexNDArray& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + ComplexNDArray& a); // bool all_elements_are_real (void) const; // bool all_integers (double& max_val, double& min_val) const; @@ -143,10 +150,10 @@ ComplexNDArray diag (octave_idx_type m, octave_idx_type n) const; ComplexNDArray& changesign (void) - { - MArray<Complex>::changesign (); - return *this; - } + { + MArray<Complex>::changesign (); + return *this; + } };
--- a/liboctave/array/CRowVector.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CRowVector.cc Sat Oct 26 18:57:05 2013 -0700 @@ -174,7 +174,8 @@ } ComplexRowVector& -ComplexRowVector::fill (const Complex& val, octave_idx_type c1, octave_idx_type c2) +ComplexRowVector::fill (const Complex& val, + octave_idx_type c1, octave_idx_type c2) { octave_idx_type len = length ();
--- a/liboctave/array/CRowVector.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CRowVector.h Sat Oct 26 18:57:05 2013 -0700 @@ -32,11 +32,11 @@ OCTAVE_API ComplexRowVector : public MArray<Complex> { -friend class ComplexColumnVector; + friend class ComplexColumnVector; public: - ComplexRowVector (void) : MArray<Complex> (dim_vector (1, 0)) { } + ComplexRowVector (void) : MArray<Complex> (dim_vector (1, 0)) { } explicit ComplexRowVector (octave_idx_type n) : MArray<Complex> (dim_vector (1, n)) { } @@ -57,10 +57,10 @@ explicit ComplexRowVector (const RowVector& a) : MArray<Complex> (a) { } ComplexRowVector& operator = (const ComplexRowVector& a) - { - MArray<Complex>::operator = (a); - return *this; - } + { + MArray<Complex>::operator = (a); + return *this; + } bool operator == (const ComplexRowVector& a) const; bool operator != (const ComplexRowVector& a) const; @@ -73,7 +73,8 @@ ComplexRowVector& fill (double val); ComplexRowVector& fill (const Complex& val); ComplexRowVector& fill (double val, octave_idx_type c1, octave_idx_type c2); - ComplexRowVector& fill (const Complex& val, octave_idx_type c1, octave_idx_type c2); + ComplexRowVector& fill (const Complex& val, + octave_idx_type c1, octave_idx_type c2); ComplexRowVector append (const RowVector& a) const; ComplexRowVector append (const ComplexRowVector& a) const; @@ -109,7 +110,8 @@ // i/o - friend std::ostream& operator << (std::ostream& os, const ComplexRowVector& a); + friend std::ostream& operator << (std::ostream& os, + const ComplexRowVector& a); friend std::istream& operator >> (std::istream& is, ComplexRowVector& a); void resize (octave_idx_type n, const Complex& rfv = Complex (0)) @@ -118,19 +120,22 @@ } void clear (octave_idx_type n) - { Array<Complex>::clear (1, n); } + { Array<Complex>::clear (1, n); } }; // row vector by column vector -> scalar -Complex OCTAVE_API operator * (const ComplexRowVector& a, const ColumnVector& b); +Complex OCTAVE_API operator * (const ComplexRowVector& a, + const ColumnVector& b); -Complex OCTAVE_API operator * (const ComplexRowVector& a, const ComplexColumnVector& b); +Complex OCTAVE_API operator * (const ComplexRowVector& a, + const ComplexColumnVector& b); // other operations -OCTAVE_API ComplexRowVector linspace (const Complex& x1, const Complex& x2, octave_idx_type n); +OCTAVE_API ComplexRowVector linspace (const Complex& x1, const Complex& x2, + octave_idx_type n); MARRAY_FORWARD_DEFS (MArray, ComplexRowVector, Complex)
--- a/liboctave/array/CSparse.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CSparse.cc Sat Oct 26 18:57:05 2013 -0700 @@ -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,
--- a/liboctave/array/CSparse.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/CSparse.h Sat Oct 26 18:57:05 2013 -0700 @@ -53,12 +53,14 @@ SparseComplexMatrix (void) : MSparse<Complex> () { } - SparseComplexMatrix (octave_idx_type r, octave_idx_type c) : MSparse<Complex> (r, c) { } + SparseComplexMatrix (octave_idx_type r, + octave_idx_type c) : MSparse<Complex> (r, c) { } - SparseComplexMatrix (const dim_vector& dv, octave_idx_type nz = 0) : - MSparse<Complex> (dv, nz) { } + SparseComplexMatrix (const dim_vector& dv, octave_idx_type nz = 0) + : MSparse<Complex> (dv, nz) { } - explicit SparseComplexMatrix (octave_idx_type r, octave_idx_type c, Complex val) + explicit SparseComplexMatrix (octave_idx_type r, octave_idx_type c, + Complex val) : MSparse<Complex> (r, c, val) { } SparseComplexMatrix (octave_idx_type r, octave_idx_type c, double val) @@ -92,14 +94,15 @@ explicit SparseComplexMatrix (const ComplexDiagMatrix& a); - SparseComplexMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) + SparseComplexMatrix (octave_idx_type r, octave_idx_type c, + octave_idx_type num_nz) : MSparse<Complex> (r, c, num_nz) { } SparseComplexMatrix& operator = (const SparseComplexMatrix& a) - { - MSparse<Complex>::operator = (a); - return *this; - } + { + MSparse<Complex>::operator = (a); + return *this; + } bool operator == (const SparseComplexMatrix& a) const; bool operator != (const SparseComplexMatrix& a) const; @@ -111,10 +114,14 @@ SparseComplexMatrix min (int dim = -1) const; SparseComplexMatrix min (Array<octave_idx_type>& index, int dim = -1) const; - SparseComplexMatrix& insert (const SparseComplexMatrix& a, octave_idx_type r, octave_idx_type c); - SparseComplexMatrix& insert (const SparseMatrix& a, octave_idx_type r, octave_idx_type c); - SparseComplexMatrix& insert (const SparseComplexMatrix& a, const Array<octave_idx_type>& indx); - SparseComplexMatrix& insert (const SparseMatrix& a, const Array<octave_idx_type>& indx); + SparseComplexMatrix& insert (const SparseComplexMatrix& a, + octave_idx_type r, octave_idx_type c); + SparseComplexMatrix& insert (const SparseMatrix& a, + octave_idx_type r, octave_idx_type c); + SparseComplexMatrix& insert (const SparseComplexMatrix& a, + const Array<octave_idx_type>& indx); + SparseComplexMatrix& insert (const SparseMatrix& a, + const Array<octave_idx_type>& indx); SparseComplexMatrix concat (const SparseComplexMatrix& rb, const Array<octave_idx_type>& ra_idx); @@ -125,7 +132,7 @@ SparseComplexMatrix hermitian (void) const; // complex conjugate transpose SparseComplexMatrix transpose (void) const - { return MSparse<Complex>::transpose (); } + { return MSparse<Complex>::transpose (); } friend SparseComplexMatrix conj (const SparseComplexMatrix& a); @@ -156,134 +163,137 @@ ComplexDET determinant (void) const; ComplexDET determinant (octave_idx_type& info) const; ComplexDET determinant (octave_idx_type& info, double& rcond, - int calc_cond = 1) const; + int calc_cond = 1) const; private: // Diagonal matrix solvers ComplexMatrix dsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, - double& rcond, solve_singularity_handler sing_handler, - bool calc_cond = false) const; + double& rcond, solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix dsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix dsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; // Upper triangular matrix solvers - ComplexMatrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, - double& rcond, solve_singularity_handler sing_handler, - bool calc_cond = false) const; + ComplexMatrix utsolve (MatrixType &typ, const Matrix& b, + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix utsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; // Lower triangular matrix solvers ComplexMatrix ltsolve (MatrixType &typ, const Matrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix ltsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; // Tridiagonal matrix solvers ComplexMatrix trisolve (MatrixType &typ, const Matrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix trisolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix trisolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix trisolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; // Banded matrix solvers (umfpack/cholesky) - ComplexMatrix bsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, - double& rcond, solve_singularity_handler sing_handler, - bool calc_cond = false) const; + ComplexMatrix bsolve (MatrixType &typ, const Matrix& b, + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix bsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix bsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; // Full matrix solvers (umfpack/cholesky) void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, - Matrix &Info, solve_singularity_handler sing_handler, - bool calc_cond) const; + Matrix &Info, solve_singularity_handler sing_handler, + bool calc_cond) const; - ComplexMatrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, - double& rcond, solve_singularity_handler sing_handler, - bool calc_cond = false) const; + ComplexMatrix fsolve (MatrixType &typ, const Matrix& b, + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix fsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix fsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; public: // Generic interface to solver with no probing of type @@ -359,10 +369,12 @@ ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, - double& rcond, solve_singularity_handler sing_handler) const; + double& rcond, + solve_singularity_handler sing_handler) const; SparseComplexMatrix solve (const SparseMatrix& b) const; - SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info) const; + SparseComplexMatrix solve (const SparseMatrix& b, + octave_idx_type& info) const; SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, double& rcond) const; SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, @@ -379,7 +391,8 @@ solve_singularity_handler sing_handler) const; ComplexColumnVector solve (const ColumnVector& b) const; - ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; + ComplexColumnVector solve (const ColumnVector& b, + octave_idx_type& info) const; ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const; ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, @@ -389,10 +402,10 @@ ComplexColumnVector solve (const ComplexColumnVector& b) const; ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; - ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, - double& rcond) const; - ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, - double& rcond, + ComplexColumnVector solve (const ComplexColumnVector& b, + octave_idx_type& info, double& rcond) const; + ComplexColumnVector solve (const ComplexColumnVector& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix squeeze (void) const; @@ -426,62 +439,80 @@ // i/o friend OCTAVE_API std::ostream& operator << (std::ostream& os, - const SparseComplexMatrix& a); + const SparseComplexMatrix& a); friend OCTAVE_API std::istream& operator >> (std::istream& is, - SparseComplexMatrix& a); + SparseComplexMatrix& a); }; extern OCTAVE_API SparseComplexMatrix operator * (const SparseMatrix&, - const SparseComplexMatrix&); + const SparseComplexMatrix&); extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, - const SparseMatrix&); + const SparseMatrix&); extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, - const SparseComplexMatrix&); + const SparseComplexMatrix&); extern OCTAVE_API ComplexMatrix operator * (const Matrix&, - const SparseComplexMatrix&); + const SparseComplexMatrix&); extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, - const SparseMatrix&); + const SparseMatrix&); extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, - const SparseComplexMatrix&); + const SparseComplexMatrix&); extern OCTAVE_API ComplexMatrix mul_trans (const ComplexMatrix&, - const SparseComplexMatrix&); + const SparseComplexMatrix&); extern OCTAVE_API ComplexMatrix mul_herm (const ComplexMatrix&, - const SparseComplexMatrix&); + const SparseComplexMatrix&); extern OCTAVE_API ComplexMatrix operator * (const SparseMatrix&, - const ComplexMatrix&); + const ComplexMatrix&); extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, - const Matrix&); + const Matrix&); extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, - const ComplexMatrix&); + const ComplexMatrix&); extern OCTAVE_API ComplexMatrix trans_mul (const SparseComplexMatrix&, - const ComplexMatrix&); + const ComplexMatrix&); extern OCTAVE_API ComplexMatrix herm_mul (const SparseComplexMatrix&, - const ComplexMatrix&); + const ComplexMatrix&); + +extern OCTAVE_API SparseComplexMatrix operator * (const DiagMatrix&, + const SparseComplexMatrix&); +extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, + const DiagMatrix&); -extern OCTAVE_API SparseComplexMatrix operator * (const DiagMatrix&, const SparseComplexMatrix&); -extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, const DiagMatrix&); +extern OCTAVE_API SparseComplexMatrix operator * (const ComplexDiagMatrix&, + const SparseMatrix&); +extern OCTAVE_API SparseComplexMatrix operator * (const SparseMatrix&, + const ComplexDiagMatrix&); -extern OCTAVE_API SparseComplexMatrix operator * (const ComplexDiagMatrix&, const SparseMatrix&); -extern OCTAVE_API SparseComplexMatrix operator * (const SparseMatrix&, const ComplexDiagMatrix&); +extern OCTAVE_API SparseComplexMatrix operator * (const ComplexDiagMatrix&, + const SparseComplexMatrix&); +extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, + const ComplexDiagMatrix&); -extern OCTAVE_API SparseComplexMatrix operator * (const ComplexDiagMatrix&, const SparseComplexMatrix&); -extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, const ComplexDiagMatrix&); +extern OCTAVE_API SparseComplexMatrix operator + (const ComplexDiagMatrix&, + const SparseMatrix&); +extern OCTAVE_API SparseComplexMatrix operator + (const DiagMatrix&, + const SparseComplexMatrix&); +extern OCTAVE_API SparseComplexMatrix operator + (const ComplexDiagMatrix&, + const SparseComplexMatrix&); +extern OCTAVE_API SparseComplexMatrix operator + (const SparseMatrix&, + const ComplexDiagMatrix&); +extern OCTAVE_API SparseComplexMatrix operator + (const SparseComplexMatrix&, + const DiagMatrix&); +extern OCTAVE_API SparseComplexMatrix operator + (const SparseComplexMatrix&, + const ComplexDiagMatrix&); -extern OCTAVE_API SparseComplexMatrix operator + (const ComplexDiagMatrix&, const SparseMatrix&); -extern OCTAVE_API SparseComplexMatrix operator + (const DiagMatrix&, const SparseComplexMatrix&); -extern OCTAVE_API SparseComplexMatrix operator + (const ComplexDiagMatrix&, const SparseComplexMatrix&); -extern OCTAVE_API SparseComplexMatrix operator + (const SparseMatrix&, const ComplexDiagMatrix&); -extern OCTAVE_API SparseComplexMatrix operator + (const SparseComplexMatrix&, const DiagMatrix&); -extern OCTAVE_API SparseComplexMatrix operator + (const SparseComplexMatrix&, const ComplexDiagMatrix&); - -extern OCTAVE_API SparseComplexMatrix operator - (const ComplexDiagMatrix&, const SparseMatrix&); -extern OCTAVE_API SparseComplexMatrix operator - (const DiagMatrix&, const SparseComplexMatrix&); -extern OCTAVE_API SparseComplexMatrix operator - (const ComplexDiagMatrix&, const SparseComplexMatrix&); -extern OCTAVE_API SparseComplexMatrix operator - (const SparseMatrix&, const ComplexDiagMatrix&); -extern OCTAVE_API SparseComplexMatrix operator - (const SparseComplexMatrix&, const DiagMatrix&); -extern OCTAVE_API SparseComplexMatrix operator - (const SparseComplexMatrix&, const ComplexDiagMatrix&); +extern OCTAVE_API SparseComplexMatrix operator - (const ComplexDiagMatrix&, + const SparseMatrix&); +extern OCTAVE_API SparseComplexMatrix operator - (const DiagMatrix&, + const SparseComplexMatrix&); +extern OCTAVE_API SparseComplexMatrix operator - (const ComplexDiagMatrix&, + const SparseComplexMatrix&); +extern OCTAVE_API SparseComplexMatrix operator - (const SparseMatrix&, + const ComplexDiagMatrix&); +extern OCTAVE_API SparseComplexMatrix operator - (const SparseComplexMatrix&, + const DiagMatrix&); +extern OCTAVE_API SparseComplexMatrix operator - (const SparseComplexMatrix&, + const ComplexDiagMatrix&); extern OCTAVE_API SparseComplexMatrix operator * (const PermMatrix&, const SparseComplexMatrix&); @@ -489,18 +520,18 @@ const PermMatrix&); extern OCTAVE_API SparseComplexMatrix min (const Complex& c, - const SparseComplexMatrix& m); + const SparseComplexMatrix& m); extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& m, - const Complex& c); + const Complex& c); extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& a, - const SparseComplexMatrix& b); + const SparseComplexMatrix& b); extern OCTAVE_API SparseComplexMatrix max (const Complex& c, - const SparseComplexMatrix& m); + const SparseComplexMatrix& m); extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& m, - const Complex& c); + const Complex& c); extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& a, - const SparseComplexMatrix& b); + const SparseComplexMatrix& b); SPARSE_SMS_CMP_OP_DECLS (SparseComplexMatrix, Complex, OCTAVE_API) SPARSE_SMS_BOOL_OP_DECLS (SparseComplexMatrix, Complex, OCTAVE_API)
--- a/liboctave/array/DiagArray2.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/DiagArray2.h Sat Oct 26 18:57:05 2013 -0700 @@ -69,16 +69,16 @@ ~DiagArray2 (void) { } DiagArray2<T>& operator = (const DiagArray2<T>& a) - { - if (this != &a) - { - Array<T>::operator = (a); - d1 = a.d1; - d2 = a.d2; - } + { + if (this != &a) + { + Array<T>::operator = (a); + d1 = a.d1; + d2 = a.d2; + } - return *this; - } + return *this; + } octave_idx_type dim1 (void) const { return d1; } octave_idx_type dim2 (void) const { return d2; } @@ -108,63 +108,63 @@ // to off-diagonal elements. T elem (octave_idx_type r, octave_idx_type c) const - { - return (r == c) ? Array<T>::elem (r) : T (0); - } + { + return (r == c) ? Array<T>::elem (r) : T (0); + } T& elem (octave_idx_type r, octave_idx_type c) - { - static T zero (0); - return (r == c) ? Array<T>::elem (r) : zero; - } + { + static T zero (0); + return (r == c) ? Array<T>::elem (r) : zero; + } T dgelem (octave_idx_type i) const - { return Array<T>::elem (i); } + { return Array<T>::elem (i); } T& dgelem (octave_idx_type i) - { return Array<T>::elem (i); } + { return Array<T>::elem (i); } T checkelem (octave_idx_type r, octave_idx_type c) const - { - return check_idx (r, c) ? elem (r, c) : T (0); - } + { + return check_idx (r, c) ? elem (r, c) : T (0); + } T operator () (octave_idx_type r, octave_idx_type c) const - { + { #if defined (BOUNDS_CHECKING) - return checkelem (r, c); + return checkelem (r, c); #else - return elem (r, c); + return elem (r, c); #endif - } + } T& checkelem (octave_idx_type r, octave_idx_type c) - { - static T zero (0); - return check_idx (r, c) ? elem (r, c) : zero; - } + { + static T zero (0); + return check_idx (r, c) ? elem (r, c) : zero; + } T& operator () (octave_idx_type r, octave_idx_type c) - { + { #if defined (BOUNDS_CHECKING) - return checkelem (r, c); + return checkelem (r, c); #else - return elem (r, c); + return elem (r, c); #endif - } + } // No checking. T xelem (octave_idx_type r, octave_idx_type c) const - { - return (r == c) ? Array<T>::xelem (r) : T (0); - } + { + return (r == c) ? Array<T>::xelem (r) : T (0); + } T& dgxelem (octave_idx_type i) - { return Array<T>::xelem (i); } + { return Array<T>::xelem (i); } T dgxelem (octave_idx_type i) const - { return Array<T>::xelem (i); } + { return Array<T>::xelem (i); } void resize (octave_idx_type n, octave_idx_type m, const T& rfv); void resize (octave_idx_type n, octave_idx_type m) @@ -184,7 +184,7 @@ T *fortran_vec (void) { return Array<T>::fortran_vec (); } void print_info (std::ostream& os, const std::string& prefix) const - { Array<T>::print_info (os, prefix); } + { Array<T>::print_info (os, prefix); } private:
--- a/liboctave/array/MArray.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/MArray.cc Sat Oct 26 18:57:05 2013 -0700 @@ -39,7 +39,7 @@ T val; _idxadds_helper (T *a, T v) : array (a), val (v) { } void operator () (octave_idx_type i) - { array[i] += val; } + { array[i] += val; } }; template <class T> @@ -49,7 +49,7 @@ const T *vals; _idxadda_helper (T *a, const T *v) : array (a), vals (v) { } void operator () (octave_idx_type i) - { array[i] += *vals++; } + { array[i] += *vals++; } }; template <class T> @@ -88,14 +88,15 @@ idx.loop (len, _idxadda_helper<T> (this->fortran_vec (), vals.data ())); } -template <class T, T op (typename ref_param<T>::type, typename ref_param<T>::type)> +template <class T, T op (typename ref_param<T>::type, + typename ref_param<T>::type)> struct _idxbinop_helper { T *array; const T *vals; _idxbinop_helper (T *a, const T *v) : array (a), vals (v) { } void operator () (octave_idx_type i) - { array[i] = op (array[i], *vals++); } + { array[i] = op (array[i], *vals++); } }; template <class T> @@ -113,7 +114,8 @@ octave_quit (); octave_idx_type len = std::min (idx.length (n), vals.length ()); - idx.loop (len, _idxbinop_helper<T, xmin> (this->fortran_vec (), vals.data ())); + idx.loop (len, _idxbinop_helper<T, xmin> (this->fortran_vec (), + vals.data ())); } template <class T> @@ -131,13 +133,15 @@ octave_quit (); octave_idx_type len = std::min (idx.length (n), vals.length ()); - idx.loop (len, _idxbinop_helper<T, xmax> (this->fortran_vec (), vals.data ())); + idx.loop (len, _idxbinop_helper<T, xmax> (this->fortran_vec (), + vals.data ())); } #include <iostream> template <class T> -void MArray<T>::idx_add_nd (const idx_vector& idx, const MArray<T>& vals, int dim) +void MArray<T>::idx_add_nd (const idx_vector& idx, const MArray<T>& vals, + int dim) { int nd = std::max (this->ndims (), vals.ndims ()); if (dim < 0)
--- a/liboctave/array/MArray.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/MArray.h Sat Oct 26 18:57:05 2013 -0700 @@ -47,7 +47,7 @@ public: - MArray (void) : Array<T> () {} + MArray (void) : Array<T> () { } explicit MArray (octave_idx_type n) GCC_ATTR_DEPRECATED : Array<T> (dim_vector (n, 1)) { } @@ -69,28 +69,28 @@ ~MArray (void) { } MArray<T>& operator = (const MArray<T>& a) - { - Array<T>::operator = (a); - return *this; - } + { + Array<T>::operator = (a); + return *this; + } MArray<T> reshape (const dim_vector& new_dims) const - { return Array<T>::reshape (new_dims); } + { return Array<T>::reshape (new_dims); } MArray<T> permute (const Array<octave_idx_type>& vec, - bool inv = false) const - { return Array<T>::permute (vec, inv); } + bool inv = false) const + { return Array<T>::permute (vec, inv); } MArray<T> ipermute (const Array<octave_idx_type>& vec) const - { return Array<T>::ipermute (vec); } + { return Array<T>::ipermute (vec); } MArray squeeze (void) const { return Array<T>::squeeze (); } MArray<T> transpose (void) const - { return Array<T>::transpose (); } + { return Array<T>::transpose (); } MArray<T> hermitian (T (*fcn) (const T&) = 0) const - { return Array<T>::hermitian (fcn); } + { return Array<T>::hermitian (fcn); } // Performs indexed accumulative addition.
--- a/liboctave/array/MDiagArray2.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/MDiagArray2.cc Sat Oct 26 18:57:05 2013 -0700 @@ -39,7 +39,7 @@ if (retval) { octave_idx_type len = this->length (), i = 0; - for (;i < len; i++) + for (; i < len; i++) if (DiagArray2<T>::elem (i, i) != val) break; retval = i == len; } @@ -70,7 +70,8 @@ MDiagArray2<T> operator * (const T& s, const MDiagArray2<T>& a) { - return MDiagArray2<T> (do_sm_binary_op<T, T, T> (s, a, mx_inline_mul), a.d1, a.d2); + return MDiagArray2<T> (do_sm_binary_op<T, T, T> (s, a, mx_inline_mul), + a.d1, a.d2); } // Element by element MDiagArray2 by MDiagArray2 ops. @@ -102,5 +103,6 @@ MDiagArray2<T> operator - (const MDiagArray2<T>& a) { - return MDiagArray2<T> (do_mx_unary_op<T, T> (a, mx_inline_uminus), a.d1, a.d2); + return MDiagArray2<T> (do_mx_unary_op<T, T> (a, mx_inline_uminus), + a.d1, a.d2); }
--- a/liboctave/array/MDiagArray2.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/MDiagArray2.h Sat Oct 26 18:57:05 2013 -0700 @@ -46,7 +46,8 @@ MDiagArray2 (octave_idx_type r, octave_idx_type c) : DiagArray2<T> (r, c) { } - MDiagArray2 (octave_idx_type r, octave_idx_type c, const T& val) : DiagArray2<T> (r, c, val) { } + MDiagArray2 (octave_idx_type r, octave_idx_type c, const T& val) + : DiagArray2<T> (r, c, val) { } MDiagArray2 (const MDiagArray2<T>& a) : DiagArray2<T> (a) { } @@ -63,38 +64,39 @@ ~MDiagArray2 (void) { } MDiagArray2<T>& operator = (const MDiagArray2<T>& a) - { - DiagArray2<T>::operator = (a); - return *this; - } + { + DiagArray2<T>::operator = (a); + return *this; + } MArray<T> array_value () const - { - return DiagArray2<T>::array_value (); - } + { + return DiagArray2<T>::array_value (); + } octave_idx_type nnz (void) const - { - octave_idx_type retval = 0; + { + octave_idx_type retval = 0; - const T *d = this->data (); + const T *d = this->data (); - octave_idx_type nel = this->length (); + octave_idx_type nel = this->length (); - for (octave_idx_type i = 0; i < nel; i++) - { - if (d[i] != T ()) - retval++; - } + for (octave_idx_type i = 0; i < nel; i++) + { + if (d[i] != T ()) + retval++; + } - return retval; - } + return retval; + } MArray<T> diag (octave_idx_type k = 0) const - { return DiagArray2<T>::extract_diag (k); } + { return DiagArray2<T>::extract_diag (k); } MDiagArray2<T> transpose (void) const { return DiagArray2<T>::transpose (); } - MDiagArray2<T> hermitian (T (*fcn) (const T&) = 0) const { return DiagArray2<T>::hermitian (fcn); } + MDiagArray2<T> hermitian (T (*fcn) (const T&) = 0) const + { return DiagArray2<T>::hermitian (fcn); } bool is_multiple_of_identity (T val) const;
--- a/liboctave/array/MSparse.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/MSparse.cc Sat Oct 26 18:57:05 2013 -0700 @@ -43,73 +43,73 @@ MSparse<T>& plus_or_minus (MSparse<T>& a, const MSparse<T>& b, OP op, const char* op_name) { - MSparse<T> r; + MSparse<T> r; - octave_idx_type a_nr = a.rows (); - octave_idx_type a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); - octave_idx_type b_nr = b.rows (); - octave_idx_type b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); - if (a_nr != b_nr || a_nc != b_nc) - gripe_nonconformant (op_name , a_nr, a_nc, b_nr, b_nc); - else - { - r = MSparse<T> (a_nr, a_nc, (a.nnz () + b.nnz ())); + if (a_nr != b_nr || a_nc != b_nc) + gripe_nonconformant (op_name , a_nr, a_nc, b_nr, b_nc); + else + { + r = MSparse<T> (a_nr, a_nc, (a.nnz () + b.nnz ())); - octave_idx_type jx = 0; - for (octave_idx_type i = 0 ; i < a_nc ; i++) - { - octave_idx_type ja = a.cidx (i); - octave_idx_type ja_max = a.cidx (i+1); - bool ja_lt_max= ja < ja_max; + octave_idx_type jx = 0; + for (octave_idx_type i = 0 ; i < a_nc ; i++) + { + octave_idx_type ja = a.cidx (i); + octave_idx_type ja_max = a.cidx (i+1); + bool ja_lt_max= ja < ja_max; - octave_idx_type jb = b.cidx (i); - octave_idx_type jb_max = b.cidx (i+1); - bool jb_lt_max = jb < jb_max; + octave_idx_type jb = b.cidx (i); + octave_idx_type jb_max = b.cidx (i+1); + bool jb_lt_max = jb < jb_max; - while (ja_lt_max || jb_lt_max ) - { - octave_quit (); - if ((! jb_lt_max) || - (ja_lt_max && (a.ridx (ja) < b.ridx (jb)))) - { - r.ridx (jx) = a.ridx (ja); - r.data (jx) = op (a.data (ja), 0.); - jx++; - ja++; - ja_lt_max= ja < ja_max; - } - else if (( !ja_lt_max ) || - (jb_lt_max && (b.ridx (jb) < a.ridx (ja)) ) ) - { - r.ridx (jx) = b.ridx (jb); - r.data (jx) = op (0., b.data (jb)); - jx++; - jb++; - jb_lt_max= jb < jb_max; - } - else - { - if (op (a.data (ja), b.data (jb)) != 0.) - { - r.data (jx) = op (a.data (ja), b.data (jb)); - r.ridx (jx) = a.ridx (ja); - jx++; - } - ja++; - ja_lt_max= ja < ja_max; - jb++; - jb_lt_max= jb < jb_max; - } - } - r.cidx (i+1) = jx; - } + while (ja_lt_max || jb_lt_max ) + { + octave_quit (); + if ((! jb_lt_max) || + (ja_lt_max && (a.ridx (ja) < b.ridx (jb)))) + { + r.ridx (jx) = a.ridx (ja); + r.data (jx) = op (a.data (ja), 0.); + jx++; + ja++; + ja_lt_max= ja < ja_max; + } + else if (( !ja_lt_max ) || + (jb_lt_max && (b.ridx (jb) < a.ridx (ja)) ) ) + { + r.ridx (jx) = b.ridx (jb); + r.data (jx) = op (0., b.data (jb)); + jx++; + jb++; + jb_lt_max= jb < jb_max; + } + else + { + if (op (a.data (ja), b.data (jb)) != 0.) + { + r.data (jx) = op (a.data (ja), b.data (jb)); + r.ridx (jx) = a.ridx (ja); + jx++; + } + ja++; + ja_lt_max= ja < ja_max; + jb++; + jb_lt_max= jb < jb_max; + } + } + r.cidx (i+1) = jx; + } - a = r.maybe_compress (); - } + a = r.maybe_compress (); + } - return a; + return a; } template <typename T>
--- a/liboctave/array/MSparse.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/MSparse.h Sat Oct 26 18:57:05 2013 -0700 @@ -46,8 +46,8 @@ MSparse (octave_idx_type n, octave_idx_type m) : Sparse<T> (n, m) { } - MSparse (const dim_vector& dv, octave_idx_type nz = 0) : - Sparse<T> (dv, nz) { } + MSparse (const dim_vector& dv, octave_idx_type nz = 0) + : Sparse<T> (dv, nz) { } MSparse (const MSparse<T>& a) : Sparse<T> (a) { } @@ -63,19 +63,21 @@ bool sum_terms = true, octave_idx_type nzm = -1) : Sparse<T> (a, r, c, nr, nc, sum_terms, nzm) { } - explicit MSparse (octave_idx_type r, octave_idx_type c, T val) : Sparse<T> (r, c, val) { } + explicit MSparse (octave_idx_type r, octave_idx_type c, T val) + : Sparse<T> (r, c, val) { } explicit MSparse (const PermMatrix& a) : Sparse<T>(a) { } - MSparse (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) : Sparse<T> (r, c, num_nz) { } + MSparse (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) + : Sparse<T> (r, c, num_nz) { } ~MSparse (void) { } MSparse<T>& operator = (const MSparse<T>& a) - { - Sparse<T>::operator = (a); - return *this; - } + { + Sparse<T>::operator = (a); + return *this; + } MSparse<T>& insert (const Sparse<T>& a, octave_idx_type r, octave_idx_type c) { @@ -94,14 +96,13 @@ MSparse<T> squeeze (void) const { return Sparse<T>::squeeze (); } MSparse<T> reshape (const dim_vector& new_dims) const - { return Sparse<T>::reshape (new_dims); } + { return Sparse<T>::reshape (new_dims); } MSparse<T> permute (const Array<octave_idx_type>& vec, bool inv = false) const - { return Sparse<T>::permute (vec, inv); } + { return Sparse<T>::permute (vec, inv); } MSparse<T> ipermute (const Array<octave_idx_type>& vec) const - { return Sparse<T>::ipermute (vec); } - + { return Sparse<T>::ipermute (vec); } MSparse<T> diag (octave_idx_type k = 0) const {
--- a/liboctave/array/MatrixType.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/MatrixType.cc Sat Oct 26 18:57:05 2013 -0700 @@ -36,7 +36,7 @@ #include "oct-spparms.h" #include "oct-locbuf.h" -// FIXME There is a large code duplication here +// FIXME: There is a large code duplication here MatrixType::MatrixType (void) : typ (MatrixType::Unknown), @@ -308,10 +308,10 @@ if (!singular) { bandden = double (nnz) / - (double (ncols) * (double (lower_band) + - double (upper_band)) - - 0.5 * double (upper_band + 1) * double (upper_band) - - 0.5 * double (lower_band + 1) * double (lower_band)); + (double (ncols) * (double (lower_band) + + double (upper_band)) - + 0.5 * double (upper_band + 1) * double (upper_band) - + 0.5 * double (lower_band + 1) * double (lower_band)); if (nrows == ncols && sp_bandden != 1. && bandden > sp_bandden) { @@ -343,8 +343,7 @@ // Search for a permuted triangular matrix, and test if // permutation is singular - // FIXME - // Perhaps this should be based on a dmperm algorithm + // FIXME: Perhaps this should be based on a dmperm algorithm? bool found = false; nperm = ncols; @@ -398,7 +397,7 @@ for (octave_idx_type j = 0; j < ncols; j++) for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) - perm[a.ridx (i)] = j; + perm[a.ridx (i)] = j; found = true; for (octave_idx_type i = 0; i < nm; i++) @@ -447,10 +446,9 @@ } } - // FIXME - // Disable lower under-determined and upper over-determined problems - // as being detected, and force to treat as singular. As this seems - // to cause issues + // FIXME: Disable lower under-determined and upper over-determined + // problems as being detected, and force to treat as singular + // as this seems to cause issues. if (((typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) && nrows > ncols) || ((typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper) @@ -629,10 +627,10 @@ if (!singular) { bandden = double (nnz) / - (double (ncols) * (double (lower_band) + - double (upper_band)) - - 0.5 * double (upper_band + 1) * double (upper_band) - - 0.5 * double (lower_band + 1) * double (lower_band)); + (double (ncols) * (double (lower_band) + + double (upper_band)) - + 0.5 * double (upper_band + 1) * double (upper_band) - + 0.5 * double (lower_band + 1) * double (lower_band)); if (nrows == ncols && sp_bandden != 1. && bandden > sp_bandden) { @@ -664,8 +662,7 @@ // Search for a permuted triangular matrix, and test if // permutation is singular - // FIXME - // Perhaps this should be based on a dmperm algorithm + // FIXME: Perhaps this should be based on a dmperm algorithm? bool found = false; nperm = ncols; @@ -719,7 +716,7 @@ for (octave_idx_type j = 0; j < ncols; j++) for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++) - perm[a.ridx (i)] = j; + perm[a.ridx (i)] = j; found = true; for (octave_idx_type i = 0; i < nm; i++) @@ -768,10 +765,9 @@ } } - // FIXME - // Disable lower under-determined and upper over-determined problems - // as being detected, and force to treat as singular. As this seems - // to cause issues + // FIXME: Disable lower under-determined and upper over-determined + // problems as being detected, and force to treat as singular + // as this seems to cause issues. if (((typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) && nrows > ncols) || ((typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper) @@ -943,8 +939,8 @@ int MatrixType::type (bool quiet) { - if (typ != MatrixType::Unknown && (full || - sp_bandden == octave_sparse_params::get_bandden ())) + if (typ != MatrixType::Unknown + && (full || sp_bandden == octave_sparse_params::get_bandden ())) { if (!quiet && octave_sparse_params::get_key ("spumoni") != 0.) @@ -967,8 +963,8 @@ int MatrixType::type (const SparseMatrix &a) { - if (typ != MatrixType::Unknown && (full || - sp_bandden == octave_sparse_params::get_bandden ())) + if (typ != MatrixType::Unknown + && (full || sp_bandden == octave_sparse_params::get_bandden ())) { if (octave_sparse_params::get_key ("spumoni") != 0.) (*current_liboctave_warning_handler) @@ -1000,8 +996,8 @@ int MatrixType::type (const SparseComplexMatrix &a) { - if (typ != MatrixType::Unknown && (full || - sp_bandden == octave_sparse_params::get_bandden ())) + if (typ != MatrixType::Unknown + && (full || sp_bandden == octave_sparse_params::get_bandden ())) { if (octave_sparse_params::get_key ("spumoni") != 0.) (*current_liboctave_warning_handler) @@ -1222,7 +1218,8 @@ } void -MatrixType::mark_as_permuted (const octave_idx_type np, const octave_idx_type *p) +MatrixType::mark_as_permuted (const octave_idx_type np, + const octave_idx_type *p) { nperm = np; perm = new octave_idx_type [nperm];
--- a/liboctave/array/MatrixType.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/MatrixType.h Sat Oct 26 18:57:05 2013 -0700 @@ -36,7 +36,8 @@ MatrixType { public: - enum matrix_type { + enum matrix_type + { Unknown = 0, Full, Diagonal, @@ -104,23 +105,25 @@ bool is_dense (void) const { return dense; } bool is_diagonal (void) const - { return (typ == Diagonal || typ == Permuted_Diagonal); } + { return (typ == Diagonal || typ == Permuted_Diagonal); } bool is_upper_triangular (void) const - { return (typ == Upper || typ == Permuted_Upper); } + { return (typ == Upper || typ == Permuted_Upper); } bool is_lower_triangular (void) const - { return (typ == Lower || typ == Permuted_Lower); } + { return (typ == Lower || typ == Permuted_Lower); } - bool is_banded (void) - { return (typ == Banded || typ == Banded_Hermitian); } + bool is_banded (void) + { return (typ == Banded || typ == Banded_Hermitian); } bool is_tridiagonal (void) const - { return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); } + { return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); } bool is_hermitian (void) const - { return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian || - typ == Hermitian); } + { + return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian || + typ == Hermitian); + } bool is_rectangular (void) const { return (typ == Rectangular); } @@ -145,7 +148,7 @@ void mark_as_tridiagonal (void) {typ = Tridiagonal; } void mark_as_banded (const octave_idx_type ku, const octave_idx_type kl) - { typ = Banded; upper_band = ku; lower_band = kl; } + { typ = Banded; upper_band = ku; lower_band = kl; } void mark_as_full (void) { typ = Full; }
--- a/liboctave/array/PermMatrix.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/PermMatrix.h Sat Oct 26 18:57:05 2013 -0700 @@ -47,50 +47,50 @@ PermMatrix (const idx_vector& idx, bool colp = false, octave_idx_type n = 0); octave_idx_type dim1 (void) const - { return Array<octave_idx_type>::length (); } + { return Array<octave_idx_type>::length (); } octave_idx_type dim2 (void) const - { return Array<octave_idx_type>::length (); } + { return Array<octave_idx_type>::length (); } octave_idx_type rows (void) const { return dim1 (); } octave_idx_type cols (void) const { return dim2 (); } octave_idx_type columns (void) const { return dim2 (); } octave_idx_type perm_length (void) const - { return Array<octave_idx_type>::length (); } + { return Array<octave_idx_type>::length (); } // FIXME: a dangerous ambiguity? octave_idx_type length (void) const - { return perm_length (); } + { return perm_length (); } octave_idx_type nelem (void) const { return dim1 () * dim2 (); } octave_idx_type numel (void) const { return nelem (); } size_t byte_size (void) const - { return Array<octave_idx_type>::byte_size (); } + { return Array<octave_idx_type>::byte_size (); } dim_vector dims (void) const { return dim_vector (dim1 (), dim2 ()); } Array<octave_idx_type> pvec (void) const - { return *this; } + { return *this; } octave_idx_type elem (octave_idx_type i, octave_idx_type j) const - { - return (_colp - ? ((Array<octave_idx_type>::elem (j) == i) ? 1 : 0) + { + return (_colp + ? ((Array<octave_idx_type>::elem (j) == i) ? 1 : 0) : ((Array<octave_idx_type>::elem (i) == j) ? 1 : 0)); - } + } octave_idx_type checkelem (octave_idx_type i, octave_idx_type j) const; octave_idx_type operator () (octave_idx_type i, octave_idx_type j) const - { + { #if defined (BOUNDS_CHECKING) - return checkelem (i, j); + return checkelem (i, j); #else - return elem (i, j); + return elem (i, j); #endif - } + } // These are, in fact, super-fast. PermMatrix transpose (void) const; @@ -105,19 +105,20 @@ bool is_col_perm (void) const { return _colp; } bool is_row_perm (void) const { return !_colp; } - friend OCTAVE_API PermMatrix operator *(const PermMatrix& a, const PermMatrix& b); + friend OCTAVE_API PermMatrix operator *(const PermMatrix& a, + const PermMatrix& b); const octave_idx_type *data (void) const - { return Array<octave_idx_type>::data (); } + { return Array<octave_idx_type>::data (); } const octave_idx_type *fortran_vec (void) const - { return Array<octave_idx_type>::fortran_vec (); } + { return Array<octave_idx_type>::fortran_vec (); } octave_idx_type *fortran_vec (void) - { return Array<octave_idx_type>::fortran_vec (); } + { return Array<octave_idx_type>::fortran_vec (); } void print_info (std::ostream& os, const std::string& prefix) const - { Array<octave_idx_type>::print_info (os, prefix); } + { Array<octave_idx_type>::print_info (os, prefix); } static PermMatrix eye (octave_idx_type n);
--- a/liboctave/array/Range.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Range.cc Sat Oct 26 18:57:05 2013 -0700 @@ -60,7 +60,7 @@ { // The first element must always be *exactly* the base. // E.g, -0 would otherwise become +0 in the loop (-0 + 0*increment). - cache(0) = b; + cache(0) = b; for (octave_idx_type i = 1; i < rng_nelem; i++) cache(i) = b + i * increment; } @@ -88,7 +88,7 @@ if (i == 0) return rng_base; - else if (i < rng_nelem - 1) + else if (i < rng_nelem - 1) return rng_base + i * rng_inc; else { @@ -109,7 +109,7 @@ #else if (i == 0) return rng_base; - else if (i < rng_nelem - 1) + else if (i < rng_nelem - 1) return rng_base + i * rng_inc; else { @@ -126,27 +126,27 @@ // Helper class used solely for idx_vector.loop () function call class __rangeidx_helper { - public: +public: __rangeidx_helper (double *a, double b, double i, double l, octave_idx_type n) : array (a), base (b), inc (i), limit (l), nmax (n-1) { } void operator () (octave_idx_type i) - { - if (i == 0) - *array++ = base; - else if (i < nmax) - *array++ = base + i * inc; - else - { - double end = base + i * inc; - if ((inc > 0 && end >= limit) || (inc < 0 && end <= limit)) - *array++ = limit; - else - *array++ = end; - } - } + { + if (i == 0) + *array++ = base; + else if (i < nmax) + *array++ = base + i * inc; + else + { + double end = base + i * inc; + if ((inc > 0 && end >= limit) || (inc < 0 && end <= limit)) + *array++ = limit; + else + *array++ = end; + } + } - private: +private: double *array, base, inc, limit; octave_idx_type nmax; @@ -514,7 +514,8 @@ } static inline bool -teq (double u, double v, double ct = 3.0 * std::numeric_limits<double>::epsilon ()) +teq (double u, double v, + double ct = 3.0 * std::numeric_limits<double>::epsilon ()) { double tu = fabs (u); double tv = fabs (v); @@ -539,7 +540,8 @@ double tmp = tfloor ((rng_limit - rng_base + rng_inc) / rng_inc, ct); - octave_idx_type n_elt = (tmp > 0.0 ? static_cast<octave_idx_type> (tmp) : 0); + octave_idx_type n_elt = (tmp > 0.0 ? static_cast<octave_idx_type> (tmp) + : 0); // If the final element that we would compute for the range is // equal to the limit of the range, or is an adjacent floating @@ -560,7 +562,8 @@ n_elt++; } - retval = (n_elt < std::numeric_limits<octave_idx_type>::max () - 1) ? n_elt : -1; + retval = (n_elt < std::numeric_limits<octave_idx_type>::max () - 1) + ? n_elt : -1; } return retval;
--- a/liboctave/array/Range.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Range.h Sat Oct 26 18:57:05 2013 -0700 @@ -32,7 +32,7 @@ OCTAVE_API Range { - public: +public: Range (void) : rng_base (0), rng_limit (0), rng_inc (0), rng_nelem (0), cache (1, 0) { } @@ -53,10 +53,10 @@ Range (double b, double i, octave_idx_type n) : rng_base (b), rng_limit (b + (n-1) * i), rng_inc (i), rng_nelem (n), cache () - { - if (! xfinite (b) || ! xfinite (i)) - rng_nelem = -2; - } + { + if (! xfinite (b) || ! xfinite (i)) + rng_nelem = -2; + } double base (void) const { return rng_base; } double limit (void) const { return rng_limit; } @@ -117,7 +117,8 @@ } } - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Range& r); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const Range& r); friend OCTAVE_API std::istream& operator >> (std::istream& is, Range& r); friend OCTAVE_API Range operator - (const Range& r); @@ -130,7 +131,7 @@ void print_range (void); - private: +private: double rng_base; double rng_limit;
--- a/liboctave/array/Sparse.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Sparse.cc Sat Oct 26 18:57:05 2013 -0700 @@ -245,9 +245,9 @@ // Work in unsigned long long to avoid overflow issues with numel unsigned long long a_nel = static_cast<unsigned long long>(a.rows ()) * - static_cast<unsigned long long>(a.cols ()); + static_cast<unsigned long long>(a.cols ()); unsigned long long dv_nel = static_cast<unsigned long long>(dv (0)) * - static_cast<unsigned long long>(dv (1)); + static_cast<unsigned long long>(dv (1)); if (a_nel != dv_nel) (*current_liboctave_error_handler) @@ -737,7 +737,8 @@ template <class T> T -Sparse<T>::range_error (const char *fcn, octave_idx_type i, octave_idx_type j) const +Sparse<T>::range_error (const char *fcn, octave_idx_type i, + octave_idx_type j) const { (*current_liboctave_error_handler) ("%s (%d, %d): range error", fcn, i, j); @@ -756,7 +757,8 @@ template <class T> T -Sparse<T>::range_error (const char *fcn, const Array<octave_idx_type>& ra_idx) const +Sparse<T>::range_error (const char *fcn, + const Array<octave_idx_type>& ra_idx) const { std::ostringstream buf; @@ -972,7 +974,8 @@ rep->c = new_cidx; if (c > rep->ncols) - fill_or_memset (c - rep->ncols, rep->c[rep->ncols], rep->c + rep->ncols + 1); + fill_or_memset (c - rep->ncols, rep->c[rep->ncols], + rep->c + rep->ncols + 1); } rep->ncols = dimensions(1) = c; @@ -1184,7 +1187,7 @@ for (octave_idx_type i = 0; i < nz; i++) { octave_idx_type r = tmp.ridx (i); - for (;j < sl && sj[j] < r; j++) ; + for (; j < sl && sj[j] < r; j++) ; if (j == sl || sj[j] > r) { data_new[nz_new] = tmp.data (i); @@ -1205,13 +1208,16 @@ if (idx.is_cont_range (nc, lb, ub)) { const Sparse<T> tmp = *this; - octave_idx_type lbi = tmp.cidx (lb), ubi = tmp.cidx (ub), new_nz = nz - (ubi - lbi); + octave_idx_type lbi = tmp.cidx (lb); + octave_idx_type ubi = tmp.cidx (ub); + octave_idx_type new_nz = nz - (ubi - lbi); *this = Sparse<T> (1, nc - (ub - lb), new_nz); copy_or_memcpy (lbi, tmp.data (), data ()); copy_or_memcpy (nz - ubi, tmp.data () + ubi, xdata () + lbi); fill_or_memset (new_nz, static_cast<octave_idx_type> (0), ridx ()); copy_or_memcpy (lb, tmp.cidx () + 1, cidx () + 1); - mx_inline_sub (nc - ub, xcidx () + 1, tmp.cidx () + ub + 1, ubi - lbi); + mx_inline_sub (nc - ub, xcidx () + 1, tmp.cidx () + ub + 1, + ubi - lbi); } else *this = index (idx.complement (nc)); @@ -1260,8 +1266,9 @@ else { const Sparse<T> tmp = *this; - octave_idx_type lbi = tmp.cidx(lb), ubi = tmp.cidx(ub), - new_nz = nz - (ubi - lbi); + octave_idx_type lbi = tmp.cidx(lb); + octave_idx_type ubi = tmp.cidx(ub); + octave_idx_type new_nz = nz - (ubi - lbi); *this = Sparse<T> (nr, nc - (ub - lb), new_nz); copy_or_memcpy (lbi, tmp.data (), data ()); @@ -1532,7 +1539,8 @@ octave_idx_type lbi = cidx (lb), ubi = cidx (ub), new_nz = ubi - lbi; retval = Sparse<T> (1, ub - lb, new_nz); copy_or_memcpy (new_nz, data () + lbi, retval.data ()); - fill_or_memset (new_nz, static_cast<octave_idx_type> (0), retval.ridx ()); + fill_or_memset (new_nz, static_cast<octave_idx_type> (0), + retval.ridx ()); mx_inline_sub (ub - lb + 1, retval.cidx (), cidx () + lb, lbi); } else @@ -1549,11 +1557,12 @@ else { // Indexing a non-vector sparse matrix by linear indexing. - // I suppose this is rare (and it may easily overflow), so let's take the easy way, - // and reshape first to column vector, which is already handled above. + // I suppose this is rare (and it may easily overflow), so let's take + // the easy way, and reshape first to column vector, which is already + // handled above. retval = index (idx_vector::colon).index (idx); - // In this case we're supposed to always inherit the shape, but column(row) doesn't do - // it, so we'll do it instead. + // In this case we're supposed to always inherit the shape, but + // column(row) doesn't do it, so we'll do it instead. if (idx_dims(0) == 1 && idx_dims(1) != 1) retval = retval.transpose (); } @@ -1564,7 +1573,8 @@ template <class T> Sparse<T> -Sparse<T>::index (const idx_vector& idx_i, const idx_vector& idx_j, bool resize_ok) const +Sparse<T>::index (const idx_vector& idx_i, const idx_vector& idx_j, + bool resize_ok) const { Sparse<T> retval; @@ -1596,8 +1606,8 @@ } else if (nr == 1 && nc == 1) { - // Scalars stored as sparse matrices occupy more memory than - // a scalar, so let's just convert the matrix to full, index, + // Scalars stored as sparse matrices occupy more memory than + // a scalar, so let's just convert the matrix to full, index, // and sparsify the result. retval = Sparse<T> (array_value ().index (idx_i, idx_j)); @@ -1633,7 +1643,9 @@ for (octave_idx_type j = 0; j < m; j++) { octave_idx_type ljj = cidx (idx_j(j)); - octave_idx_type lj = retval.xcidx (j), nzj = retval.xcidx (j+1) - lj; + octave_idx_type lj = retval.xcidx (j); + octave_idx_type nzj = retval.xcidx (j+1) - lj; + copy_or_memcpy (nzj, data () + ljj, retval.data () + lj); copy_or_memcpy (nzj, ridx () + ljj, retval.ridx () + lj); } @@ -1656,7 +1668,10 @@ for (octave_idx_type j = 0; j < m; j++) { octave_quit (); - octave_idx_type jj = idx_j(j), lj = cidx (jj), nzj = cidx (jj+1) - cidx (jj); + octave_idx_type jj = idx_j(j); + octave_idx_type lj = cidx (jj); + octave_idx_type nzj = cidx (jj+1) - cidx (jj); + // Scalar index - just a binary lookup. octave_idx_type i = lblookup (ridx () + lj, nzj, ii); if (i < nzj && ridx (i+lj) == ii) @@ -1689,8 +1704,11 @@ for (octave_idx_type j = 0; j < m; j++) { octave_quit (); - octave_idx_type jj = idx_j(j), lj = cidx (jj), nzj = cidx (jj+1) - cidx (jj); + octave_idx_type jj = idx_j(j); + octave_idx_type lj = cidx (jj); + octave_idx_type nzj = cidx (jj+1) - cidx (jj); octave_idx_type lij, uij; + // Lookup indices. li[j] = lij = lblookup (ridx () + lj, nzj, lb) + lj; ui[j] = uij = lblookup (ridx () + lj, nzj, ub) + lj; @@ -1712,7 +1730,7 @@ } else if (idx_i.is_permutation (nr)) { - // The columns preserve their length, we just need to renumber and sort them. + // The columns preserve their length, just need to renumber and sort them. // Count new nonzero elements. retval = Sparse<T> (nr, m); for (octave_idx_type j = 0; j < m; j++) @@ -1731,7 +1749,9 @@ for (octave_idx_type j = 0; j < m; j++) { octave_quit (); - octave_idx_type jj = idx_j(j), lj = cidx (jj), nzj = cidx (jj+1) - cidx (jj); + octave_idx_type jj = idx_j(j); + octave_idx_type lj = cidx (jj); + octave_idx_type nzj = cidx (jj+1) - cidx (jj); octave_idx_type li = retval.xcidx (j), uj = lj + nzj - 1; for (octave_idx_type i = 0; i < nzj; i++) { @@ -1753,7 +1773,9 @@ for (octave_idx_type j = 0; j < m; j++) { octave_quit (); - octave_idx_type jj = idx_j(j), lj = cidx (jj), nzj = cidx (jj+1) - cidx (jj); + octave_idx_type jj = idx_j(j); + octave_idx_type lj = cidx (jj); + octave_idx_type nzj = cidx (jj+1) - cidx (jj); octave_idx_type li = retval.xcidx (j); // Scatter the column, transform indices. for (octave_idx_type i = 0; i < nzj; i++) @@ -1846,8 +1868,10 @@ if (new_nz > nz) { // Make room first. - std::copy_backward (data () + ui, data () + nz, data () + nz + rnz); - std::copy_backward (ridx () + ui, ridx () + nz, ridx () + nz + rnz); + std::copy_backward (data () + ui, data () + nz, + data () + nz + rnz); + std::copy_backward (ridx () + ui, ridx () + nz, + ridx () + nz + rnz); } // Copy data and adjust indices from rhs. @@ -1870,8 +1894,10 @@ mx_inline_add (rnz, ridx () + li, rhs.ridx (), lb); // ...tail - copy_or_memcpy (nz - ui, tmp.data () + ui, data () + li + rnz); - copy_or_memcpy (nz - ui, tmp.ridx () + ui, ridx () + li + rnz); + copy_or_memcpy (nz - ui, tmp.data () + ui, + data () + li + rnz); + copy_or_memcpy (nz - ui, tmp.ridx () + ui, + ridx () + li + rnz); } cidx (1) = new_nz; @@ -1953,7 +1979,7 @@ octave_idx_type n = rhs.rows (); octave_idx_type m = rhs.columns (); - // FIXME -- this should probably be written more like the + // FIXME: this should probably be written more like the // Array<T>::assign function... bool orig_zero_by_zero = (nr == 0 && nc == 0); @@ -2033,7 +2059,8 @@ // Copy data and indices from rhs. copy_or_memcpy (rnz, rhs.data (), data () + li); copy_or_memcpy (rnz, rhs.ridx (), ridx () + li); - mx_inline_add (ub - lb, cidx () + lb + 1, rhs.cidx () + 1, li); + mx_inline_add (ub - lb, cidx () + lb + 1, rhs.cidx () + 1, + li); assert (nnz () == new_nz); } @@ -2052,12 +2079,16 @@ // new stuff... copy_or_memcpy (rnz, rhs.data (), data () + li); copy_or_memcpy (rnz, rhs.ridx (), ridx () + li); - mx_inline_add (ub - lb, cidx () + lb + 1, rhs.cidx () + 1, li); + mx_inline_add (ub - lb, cidx () + lb + 1, rhs.cidx () + 1, + li); // ...tail. - copy_or_memcpy (nz - ui, tmp.data () + ui, data () + li + rnz); - copy_or_memcpy (nz - ui, tmp.ridx () + ui, ridx () + li + rnz); - mx_inline_add (nc - ub, cidx () + ub + 1, tmp.cidx () + ub + 1, new_nz - nz); + copy_or_memcpy (nz - ui, tmp.data () + ui, + data () + li + rnz); + copy_or_memcpy (nz - ui, tmp.ridx () + ui, + ridx () + li + rnz); + mx_inline_add (nc - ub, cidx () + ub + 1, + tmp.cidx () + ub + 1, new_nz - nz); assert (nnz () == new_nz); } @@ -2065,7 +2096,8 @@ else if (idx_j.is_range () && idx_j.increment () == -1) { // It's s(:,u:-1:l) = r. Reverse the assignment. - assign (idx_i, idx_j.sorted (), rhs.index (idx_i, idx_vector (m - 1, 0, -1))); + assign (idx_i, idx_j.sorted (), + rhs.index (idx_i, idx_vector (m - 1, 0, -1))); } else if (idx_j.is_permutation (nc)) { @@ -2118,7 +2150,7 @@ } else if (nc == 1 && idx_j.is_colon_equiv (nc) && idx_i.is_vector ()) { - // It's actually vector indexing. The 1D assign is specialized for that. + // It's just vector indexing. The 1D assign is specialized for that. assign (idx_i, rhs); } else if (idx_j.is_colon ()) @@ -2237,7 +2269,7 @@ } if (dim > 0) - m = m.transpose (); + m = m.transpose (); return m; } @@ -2558,8 +2590,8 @@ { case 0: { - // sparse vertcat. This is not efficiently handled by assignment, so - // we'll do it directly. + // sparse vertcat. This is not efficiently handled by assignment, + // so we'll do it directly. octave_idx_type l = 0; for (octave_idx_type j = 0; j < dv(1); j++) { @@ -2600,7 +2632,8 @@ continue; octave_idx_type u = l + sparse_list[i].columns (); - retval.assign (idx_vector::colon, idx_vector (l, u), sparse_list[i]); + retval.assign (idx_vector::colon, idx_vector (l, u), + sparse_list[i]); l = u; }
--- a/liboctave/array/Sparse.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/Sparse.h Sat Oct 26 18:57:05 2013 -0700 @@ -73,39 +73,39 @@ SparseRep (void) : d (0), r (0), c (new octave_idx_type [1]), nzmx (0), nrows (0), - ncols (0), count (1) - { - c[0] = 0; - } + ncols (0), count (1) + { + c[0] = 0; + } SparseRep (octave_idx_type n) : d (0), r (0), c (new octave_idx_type [n+1]), nzmx (0), nrows (n), - ncols (n), count (1) - { - for (octave_idx_type i = 0; i < n + 1; i++) - c[i] = 0; - } + ncols (n), count (1) + { + for (octave_idx_type i = 0; i < n + 1; i++) + c[i] = 0; + } SparseRep (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz = 0) : d (nz > 0 ? new T [nz] : 0), - r (nz > 0 ? new octave_idx_type [nz] : 0), - c (new octave_idx_type [nc+1]), nzmx (nz), nrows (nr), - ncols (nc), count (1) - { - for (octave_idx_type i = 0; i < nc + 1; i++) - c[i] = 0; - } + r (nz > 0 ? new octave_idx_type [nz] : 0), + c (new octave_idx_type [nc+1]), nzmx (nz), nrows (nr), + ncols (nc), count (1) + { + for (octave_idx_type i = 0; i < nc + 1; i++) + c[i] = 0; + } SparseRep (const SparseRep& a) : d (new T [a.nzmx]), r (new octave_idx_type [a.nzmx]), - c (new octave_idx_type [a.ncols + 1]), - nzmx (a.nzmx), nrows (a.nrows), ncols (a.ncols), count (1) - { - octave_idx_type nz = a.nnz (); - copy_or_memcpy (nz, a.d, d); - copy_or_memcpy (nz, a.r, r); - copy_or_memcpy (ncols + 1, a.c, c); - } + c (new octave_idx_type [a.ncols + 1]), + nzmx (a.nzmx), nrows (a.nrows), ncols (a.ncols), count (1) + { + octave_idx_type nz = a.nnz (); + copy_or_memcpy (nz, a.d, d); + copy_or_memcpy (nz, a.r, r); + copy_or_memcpy (ncols + 1, a.c, c); + } ~SparseRep (void) { delete [] d; delete [] r; delete [] c; } @@ -207,8 +207,9 @@ // Type conversion case. Preserves capacity (). template <class U> Sparse (const Sparse<U>& a) - : rep (new typename Sparse<T>::SparseRep (a.rep->nrows, a.rep->ncols, a.rep->nzmx)), - dimensions (a.dimensions) + : rep (new typename Sparse<T>::SparseRep (a.rep->nrows, a.rep->ncols, + a.rep->nzmx)), + dimensions (a.dimensions) { octave_idx_type nz = a.nnz (); std::copy (a.rep->d, a.rep->d + nz, rep->d); @@ -321,7 +322,7 @@ T xelem (const Array<octave_idx_type>& ra_idx) const { return xelem (compute_index (ra_idx)); } - // FIXME -- would be nice to fix this so that we don't + // FIXME: would be nice to fix this so that we don't // unnecessarily force a copy, but that is not so easy, and I see no // clean way to do it. @@ -510,7 +511,7 @@ T& xdata (octave_idx_type i) { return rep->data (i); } T data (octave_idx_type i) const { return rep->data (i); } - // FIXME -- shouldn't this be returning const T*? + // FIXME: shouldn't this be returning const T*? T* data (void) const { return rep->d; } octave_idx_type* ridx (void) { make_unique (); return rep->r; } @@ -523,7 +524,7 @@ octave_idx_type& xridx (octave_idx_type i) { return rep->ridx (i); } octave_idx_type ridx (octave_idx_type i) const { return rep->cridx (i); } - // FIXME -- shouldn't this be returning const octave_idx_type*? + // FIXME: shouldn't this be returning const octave_idx_type*? octave_idx_type* ridx (void) const { return rep->r; } octave_idx_type* cidx (void) { make_unique (); return rep->c; } @@ -536,7 +537,7 @@ octave_idx_type& xcidx (octave_idx_type i) { return rep->cidx (i); } octave_idx_type cidx (octave_idx_type i) const { return rep->ccidx (i); } - // FIXME -- shouldn't this be returning const octave_idx_type*? + // FIXME: shouldn't this be returning const octave_idx_type*? octave_idx_type* cidx (void) const { return rep->c; } octave_idx_type ndims (void) const { return dimensions.length (); } @@ -631,7 +632,7 @@ for (octave_idx_type i = cidx (j); i < cidx (j+1); i++) { octave_quit (); - /* Use data instead of elem for better performance. */ + /* Use data instead of elem for better performance. */ result.data (ridx (i) + j * nr) = fcn (data (i)); } @@ -766,7 +767,7 @@ a.cidx (j+1) = ii; } - done: +done: return is; }
--- a/liboctave/array/boolMatrix.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/boolMatrix.cc Sat Oct 26 18:57:05 2013 -0700 @@ -84,8 +84,7 @@ return Array<bool>::diag (k); } -// 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? boolMatrix boolMatrix::all (int dim) const
--- a/liboctave/array/boolMatrix.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/boolMatrix.h Sat Oct 26 18:57:05 2013 -0700 @@ -52,10 +52,10 @@ boolMatrix (const boolMatrix& a) : Array<bool> (a) { } boolMatrix& operator = (const boolMatrix& a) - { - Array<bool>::operator = (a); - return *this; - } + { + Array<bool>::operator = (a); + return *this; + } bool operator == (const boolMatrix& a) const; bool operator != (const boolMatrix& a) const; @@ -64,7 +64,8 @@ // destructive insert/delete/reorder operations - boolMatrix& insert (const boolMatrix& a, octave_idx_type r, octave_idx_type c); + boolMatrix& insert (const boolMatrix& a, + octave_idx_type r, octave_idx_type c); // unary operations
--- a/liboctave/array/boolNDArray.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/boolNDArray.cc Sat Oct 26 18:57:05 2013 -0700 @@ -54,7 +54,7 @@ return *this; } -// FIXME -- this is not quite the right thing. +// FIXME: this is not quite the right thing. boolNDArray boolNDArray::all (int dim) const @@ -84,7 +84,8 @@ } boolNDArray -boolNDArray::concat (const boolNDArray& rb, const Array<octave_idx_type>& ra_idx) +boolNDArray::concat (const boolNDArray& rb, + const Array<octave_idx_type>& ra_idx) { if (rb.numel () > 0) insert (rb, ra_idx);
--- a/liboctave/array/boolNDArray.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/boolNDArray.h Sat Oct 26 18:57:05 2013 -0700 @@ -54,10 +54,10 @@ boolNDArray (const Array<bool>& a) : Array<bool> (a) { } boolNDArray& operator = (const boolNDArray& a) - { - Array<bool>::operator = (a); - return *this; - } + { + Array<bool>::operator = (a); + return *this; + } // unary operations @@ -67,7 +67,7 @@ bool any_element_is_nan (void) const { return false; } - // FIXME -- this is not quite the right thing. + // FIXME: this is not quite the right thing. boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; @@ -75,10 +75,13 @@ NDArray sum (int dim = -1) const; NDArray cumsum (int dim = -1) const; - boolNDArray concat (const boolNDArray& rb, const Array<octave_idx_type>& ra_idx); + boolNDArray concat (const boolNDArray& rb, + const Array<octave_idx_type>& ra_idx); - boolNDArray& insert (const boolNDArray& a, octave_idx_type r, octave_idx_type c); - boolNDArray& insert (const boolNDArray& a, const Array<octave_idx_type>& ra_idx); + boolNDArray& insert (const boolNDArray& a, octave_idx_type r, + octave_idx_type c); + boolNDArray& insert (const boolNDArray& a, + const Array<octave_idx_type>& ra_idx); boolMatrix matrix_value (void) const; @@ -89,7 +92,7 @@ int start_dimension = 0); static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions); + const dim_vector& dimensions); // i/o
--- a/liboctave/array/boolSparse.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/boolSparse.cc Sat Oct 26 18:57:05 2013 -0700 @@ -55,7 +55,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)) @@ -71,21 +71,24 @@ } SparseBoolMatrix& -SparseBoolMatrix::insert (const SparseBoolMatrix& a, octave_idx_type r, octave_idx_type c) +SparseBoolMatrix::insert (const SparseBoolMatrix& a, + octave_idx_type r, octave_idx_type c) { Sparse<bool>::insert (a, r, c); return *this; } SparseBoolMatrix& -SparseBoolMatrix::insert (const SparseBoolMatrix& a, const Array<octave_idx_type>& indx) +SparseBoolMatrix::insert (const SparseBoolMatrix& a, + const Array<octave_idx_type>& indx) { Sparse<bool>::insert (a, indx); return *this; } SparseBoolMatrix -SparseBoolMatrix::concat (const SparseBoolMatrix& rb, const Array<octave_idx_type>& ra_idx) +SparseBoolMatrix::concat (const SparseBoolMatrix& 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) @@ -128,8 +131,7 @@ // other operations -// 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 SparseBoolMatrix::all (int dim) const @@ -256,14 +258,14 @@ { 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 << " " << a.data (i) << "\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 << " " << a.data (i) << "\n"; + } return os; } @@ -289,7 +291,8 @@ } SparseBoolMatrix -SparseBoolMatrix::index (const idx_vector& i, const idx_vector& j, bool resize_ok) const +SparseBoolMatrix::index (const idx_vector& i, const idx_vector& j, + bool resize_ok) const { return Sparse<bool>::index (i, j, resize_ok); }
--- a/liboctave/array/boolSparse.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/boolSparse.h Sat Oct 26 18:57:05 2013 -0700 @@ -38,13 +38,14 @@ SparseBoolMatrix (void) : Sparse<bool> () { } - SparseBoolMatrix (octave_idx_type r, octave_idx_type c) : Sparse<bool> (r, c) { } + SparseBoolMatrix (octave_idx_type r, octave_idx_type c) + : Sparse<bool> (r, c) { } explicit SparseBoolMatrix (octave_idx_type r, octave_idx_type c, bool val) : Sparse<bool> (r, c, val) { } - SparseBoolMatrix (const dim_vector& dv, octave_idx_type nz = 0) : - Sparse<bool> (dv, nz) { } + SparseBoolMatrix (const dim_vector& dv, octave_idx_type nz = 0) + : Sparse<bool> (dv, nz) { } SparseBoolMatrix (const Sparse<bool>& a) : Sparse<bool> (a) { } @@ -65,25 +66,28 @@ octave_idx_type nzm = -1) : Sparse<bool> (a, r, c, nr, nc, sum_terms, nzm) { } - SparseBoolMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) : Sparse<bool> (r, c, num_nz) { } + SparseBoolMatrix (octave_idx_type r, octave_idx_type c, + octave_idx_type num_nz) : Sparse<bool> (r, c, num_nz) { } SparseBoolMatrix& operator = (const SparseBoolMatrix& a) - { - Sparse<bool>::operator = (a); - return *this; - } + { + Sparse<bool>::operator = (a); + return *this; + } bool operator == (const SparseBoolMatrix& a) const; bool operator != (const SparseBoolMatrix& a) const; SparseBoolMatrix transpose (void) const - { return Sparse<bool>::transpose (); } + { return Sparse<bool>::transpose (); } // destructive insert/delete/reorder operations - SparseBoolMatrix& insert (const SparseBoolMatrix& a, octave_idx_type r, octave_idx_type c); + SparseBoolMatrix& insert (const SparseBoolMatrix& a, + octave_idx_type r, octave_idx_type c); - SparseBoolMatrix& insert (const SparseBoolMatrix& a, const Array<octave_idx_type>& indx); + SparseBoolMatrix& insert (const SparseBoolMatrix& a, + const Array<octave_idx_type>& indx); SparseBoolMatrix concat (const SparseBoolMatrix& rb, const Array<octave_idx_type>& ra_idx); @@ -96,11 +100,13 @@ SparseBoolMatrix index (const idx_vector& i, bool resize_ok) const; - SparseBoolMatrix index (const idx_vector& i, const idx_vector& j, bool resize_ok) const; + SparseBoolMatrix index (const idx_vector& i, const idx_vector& j, + bool resize_ok) const; SparseBoolMatrix reshape (const dim_vector& new_dims) const; - SparseBoolMatrix permute (const Array<octave_idx_type>& vec, bool inv = false) const; + SparseBoolMatrix permute (const Array<octave_idx_type>& vec, + bool inv = false) const; SparseBoolMatrix ipermute (const Array<octave_idx_type>& vec) const; @@ -116,8 +122,10 @@ // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const SparseBoolMatrix& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, SparseBoolMatrix& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const SparseBoolMatrix& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + SparseBoolMatrix& a); }; SPARSE_SMS_EQNE_OP_DECLS (SparseBoolMatrix, bool, OCTAVE_API)
--- a/liboctave/array/chMatrix.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/chMatrix.cc Sat Oct 26 18:57:05 2013 -0700 @@ -167,7 +167,8 @@ } charMatrix -charMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const +charMatrix::extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const { if (r1 > r2) { std::swap (r1, r2); } if (c1 > c2) { std::swap (c1, c2); } @@ -190,8 +191,7 @@ return Array<char>::diag (k); } -// 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? boolMatrix charMatrix::all (int dim) const
--- a/liboctave/array/chMatrix.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/chMatrix.h Sat Oct 26 18:57:05 2013 -0700 @@ -36,7 +36,7 @@ OCTAVE_API charMatrix : public Array<char> { -friend class ComplexMatrix; + friend class ComplexMatrix; public: @@ -65,10 +65,10 @@ charMatrix (const string_vector& s, char fill_value = '\0'); charMatrix& operator = (const charMatrix& a) - { - Array<char>::operator = (a); - return *this; - } + { + Array<char>::operator = (a); + return *this; + } bool operator == (const charMatrix& a) const; bool operator != (const charMatrix& a) const; @@ -78,13 +78,15 @@ // destructive insert/delete/reorder operations charMatrix& insert (const char *s, octave_idx_type r, octave_idx_type c); - charMatrix& insert (const charMatrix& a, octave_idx_type r, octave_idx_type c); + charMatrix& insert (const charMatrix& a, + octave_idx_type r, octave_idx_type c); std::string row_as_string (octave_idx_type, bool strip_ws = false) const; // resize is the destructive equivalent for this one - charMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; + charMatrix extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const; void resize (octave_idx_type nr, octave_idx_type nc, char rfv = 0) {
--- a/liboctave/array/chNDArray.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/chNDArray.cc Sat Oct 26 18:57:05 2013 -0700 @@ -34,7 +34,7 @@ #include "bsxfun-defs.cc" -// FIXME -- this is not quite the right thing. +// FIXME: this is not quite the right thing. boolNDArray charNDArray::all (int dim) const @@ -49,7 +49,8 @@ } charNDArray -charNDArray::concat (const charNDArray& rb, const Array<octave_idx_type>& ra_idx) +charNDArray::concat (const charNDArray& rb, + const Array<octave_idx_type>& ra_idx) { if (rb.numel () > 0) insert (rb, ra_idx); @@ -80,8 +81,7 @@ octave_idx_type ival = NINTbig (d); if (ival < 0 || ival > std::numeric_limits<unsigned char>::max ()) - // FIXME -- is there something - // better we could do? Should we warn the user? + // FIXME: is there something better to do? Should we warn the user? ival = 0; tmp.elem (i) = static_cast<char>(ival); @@ -166,43 +166,47 @@ charNDArray min (char d, const charNDArray& m) { - return do_sm_binary_op<charNDArray::element_type, char, charNDArray::element_type> - (d, m, mx_inline_xmin); + return do_sm_binary_op<charNDArray::element_type, char, + charNDArray::element_type> (d, m, mx_inline_xmin); } charNDArray min (const charNDArray& m, char d) { - return do_ms_binary_op<charNDArray::element_type, charNDArray::element_type, char> - (m, d, mx_inline_xmin); + return do_ms_binary_op<charNDArray::element_type, charNDArray::element_type, + char> (m, d, mx_inline_xmin); } charNDArray min (const charNDArray& a, const charNDArray& b) { - return do_mm_binary_op<charNDArray::element_type, charNDArray::element_type, charNDArray::element_type> - (a, b, mx_inline_xmin, mx_inline_xmin, mx_inline_xmin, "min"); + return do_mm_binary_op<charNDArray::element_type, charNDArray::element_type, + charNDArray::element_type> (a, b, mx_inline_xmin, + mx_inline_xmin, + mx_inline_xmin, "min"); } charNDArray max (char d, const charNDArray& m) { - return do_sm_binary_op<charNDArray::element_type, char, charNDArray::element_type> - (d, m, mx_inline_xmax); + return do_sm_binary_op<charNDArray::element_type, char, + charNDArray::element_type> (d, m, mx_inline_xmax); } charNDArray max (const charNDArray& m, char d) { - return do_ms_binary_op<charNDArray::element_type, charNDArray::element_type, char> - (m, d, mx_inline_xmax); + return do_ms_binary_op<charNDArray::element_type, charNDArray::element_type, + char> (m, d, mx_inline_xmax); } charNDArray max (const charNDArray& a, const charNDArray& b) { - return do_mm_binary_op<charNDArray::element_type, charNDArray::element_type, charNDArray::element_type> - (a, b, mx_inline_xmax, mx_inline_xmax, mx_inline_xmax, "max"); + return do_mm_binary_op<charNDArray::element_type, charNDArray::element_type, + charNDArray::element_type> (a, b, mx_inline_xmax, + mx_inline_xmax, + mx_inline_xmax, "max"); } NDS_CMP_OPS (charNDArray, char)
--- a/liboctave/array/chNDArray.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/chNDArray.h Sat Oct 26 18:57:05 2013 -0700 @@ -59,18 +59,19 @@ charNDArray (const Array<char>& a) : Array<char> (a) { } charNDArray& operator = (const charNDArray& a) - { - Array<char>::operator = (a); - return *this; - } + { + Array<char>::operator = (a); + return *this; + } bool any_element_is_nan (void) const { return false; } - // FIXME -- this is not quite the right thing. + // FIXME: this is not quite the right thing. boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; - charNDArray concat (const charNDArray& rb, const Array<octave_idx_type>& ra_idx); + charNDArray concat (const charNDArray& rb, + const Array<octave_idx_type>& ra_idx); charNDArray concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx); charNDArray max (int dim = -1) const; @@ -78,8 +79,10 @@ charNDArray min (int dim = -1) const; charNDArray min (Array<octave_idx_type>& index, int dim = -1) const; - charNDArray& insert (const charNDArray& a, octave_idx_type r, octave_idx_type c); - charNDArray& insert (const charNDArray& a, const Array<octave_idx_type>& ra_idx); + charNDArray& insert (const charNDArray& a, + octave_idx_type r, octave_idx_type c); + charNDArray& insert (const charNDArray& a, + const Array<octave_idx_type>& ra_idx); charMatrix matrix_value (void) const; @@ -90,7 +93,7 @@ int start_dimension = 0); static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions); + const dim_vector& dimensions); // i/o
--- a/liboctave/array/dColVector.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dColVector.h Sat Oct 26 18:57:05 2013 -0700 @@ -51,10 +51,10 @@ ColumnVector (const Array<double>& a) : MArray<double> (a.as_column ()) { } ColumnVector& operator = (const ColumnVector& a) - { - MArray<double>::operator = (a); - return *this; - } + { + MArray<double>::operator = (a); + return *this; + } bool operator == (const ColumnVector& a) const; bool operator != (const ColumnVector& a) const; @@ -81,11 +81,13 @@ // matrix by column vector -> column vector operations - friend OCTAVE_API ColumnVector operator * (const Matrix& a, const ColumnVector& b); + friend OCTAVE_API ColumnVector operator * (const Matrix& a, + const ColumnVector& b); // diagonal matrix by column vector -> column vector operations - friend OCTAVE_API ColumnVector operator * (const DiagMatrix& a, const ColumnVector& b); + friend OCTAVE_API ColumnVector operator * (const DiagMatrix& a, + const ColumnVector& b); // other operations @@ -96,8 +98,10 @@ // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ColumnVector& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, ColumnVector& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const ColumnVector& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + ColumnVector& a); void resize (octave_idx_type n, const double& rfv = 0) { @@ -105,7 +109,7 @@ } void clear (octave_idx_type n) - { Array<double>::clear (n, 1); } + { Array<double>::clear (n, 1); } };
--- a/liboctave/array/dDiagMatrix.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dDiagMatrix.cc Sat Oct 26 18:57:05 2013 -0700 @@ -157,7 +157,8 @@ } Matrix -DiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const +DiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const { if (r1 > r2) { std::swap (r1, r2); } if (c1 > c2) { std::swap (c1, c2); }
--- a/liboctave/array/dDiagMatrix.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dDiagMatrix.h Sat Oct 26 18:57:05 2013 -0700 @@ -35,16 +35,18 @@ OCTAVE_API DiagMatrix : public MDiagArray2<double> { -friend class SVD; -friend class ComplexSVD; + friend class SVD; + friend class ComplexSVD; public: DiagMatrix (void) : MDiagArray2<double> () { } - DiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<double> (r, c) { } + DiagMatrix (octave_idx_type r, octave_idx_type c) + : MDiagArray2<double> (r, c) { } - DiagMatrix (octave_idx_type r, octave_idx_type c, double val) : MDiagArray2<double> (r, c, val) { } + DiagMatrix (octave_idx_type r, octave_idx_type c, double val) + : MDiagArray2<double> (r, c, val) { } DiagMatrix (const DiagMatrix& a) : MDiagArray2<double> (a) { } @@ -59,10 +61,10 @@ : MDiagArray2<double> (a, r, c) { } DiagMatrix& operator = (const DiagMatrix& a) - { - MDiagArray2<double>::operator = (a); - return *this; - } + { + MDiagArray2<double>::operator = (a); + return *this; + } bool operator == (const DiagMatrix& a) const; bool operator != (const DiagMatrix& a) const; @@ -74,7 +76,8 @@ DiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); DiagMatrix& fill (const RowVector& a, octave_idx_type beg); - DiagMatrix transpose (void) const { return MDiagArray2<double>::transpose (); } + DiagMatrix transpose (void) const + { return MDiagArray2<double>::transpose (); } DiagMatrix abs (void) const; friend OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a); @@ -82,7 +85,8 @@ // resize is the destructive analog for this one - Matrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; + Matrix extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const; // extract row or column i. @@ -99,14 +103,15 @@ // other operations ColumnVector extract_diag (octave_idx_type k = 0) const - { return MDiagArray2<double>::extract_diag (k); } + { return MDiagArray2<double>::extract_diag (k); } DET determinant (void) const; double rcond (void) const; // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const DiagMatrix& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const DiagMatrix& a); };
--- a/liboctave/array/dMatrix.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dMatrix.cc Sat Oct 26 18:57:05 2013 -0700 @@ -269,8 +269,7 @@ elem (i, ia(i)) = 1.0; } -// FIXME -- could we use a templated mixed-type copy function -// here? +// FIXME: could we use a templated mixed-type copy function here? Matrix::Matrix (const boolMatrix& a) : MArray<double> (a) @@ -413,7 +412,8 @@ } Matrix& -Matrix::fill (double val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) +Matrix::fill (double val, octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) { octave_idx_type nr = rows (); octave_idx_type nc = cols (); @@ -601,7 +601,8 @@ } Matrix -Matrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const +Matrix::extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const { if (r1 > r2) { std::swap (r1, r2); } if (c1 > c2) { std::swap (c1, c2); } @@ -610,7 +611,8 @@ } Matrix -Matrix::extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const +Matrix::extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, + octave_idx_type nc) const { return index (idx_vector (r1, r1 + nr), idx_vector (c1, c1 + nc)); } @@ -763,7 +765,8 @@ // Calculate the norm of the matrix, for later use. double anorm = 0; if (calc_cond) - anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)).max (); + anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)) + .max (); F77_XFCN (dgetrf, DGETRF, (nc, nc, tmp_data, nr, pipvt, info)); @@ -1464,7 +1467,7 @@ double *tmp_data = atmp.fortran_vec (); anorm = atmp.abs().sum(). - row(static_cast<octave_idx_type>(0)).max(); + row(static_cast<octave_idx_type>(0)).max(); F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -1505,7 +1508,7 @@ if (anorm < 0.) anorm = atmp.abs ().sum (). - row(static_cast<octave_idx_type>(0)).max (); + row(static_cast<octave_idx_type>(0)).max (); Array<double> z (dim_vector (4 * nc, 1)); double *pz = z.fortran_vec (); @@ -1541,8 +1544,8 @@ Matrix Matrix::utsolve (MatrixType &mattype, const Matrix& b, octave_idx_type& info, - double& rcon, solve_singularity_handler sing_handler, - bool calc_cond, blas_trans_type transt) const + double& rcon, solve_singularity_handler sing_handler, + bool calc_cond, blas_trans_type transt) const { Matrix retval; @@ -1641,8 +1644,8 @@ Matrix Matrix::ltsolve (MatrixType &mattype, const Matrix& b, octave_idx_type& info, - double& rcon, solve_singularity_handler sing_handler, - bool calc_cond, blas_trans_type transt) const + double& rcon, solve_singularity_handler sing_handler, + bool calc_cond, blas_trans_type transt) const { Matrix retval; @@ -1758,7 +1761,7 @@ { volatile int typ = mattype.type (); - // Calculate the norm of the matrix, for later use. + // Calculate the norm of the matrix, for later use. double anorm = -1.; if (typ == MatrixType::Hermitian) @@ -1846,7 +1849,7 @@ Matrix atmp = *this; double *tmp_data = atmp.fortran_vec (); - if(anorm < 0.) + if (anorm < 0.) anorm = atmp.abs().sum().row(static_cast<octave_idx_type>(0)).max(); Array<double> z (dim_vector (4 * nc, 1)); @@ -1963,7 +1966,8 @@ else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) retval = ltsolve (mattype, b, info, rcon, sing_handler, false, transt); else if (transt == blas_trans || transt == blas_conj_trans) - return transpose ().solve (mattype, b, info, rcon, sing_handler, singular_fallback); + return transpose ().solve (mattype, b, info, rcon, sing_handler, + singular_fallback); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) retval = fsolve (mattype, b, info, rcon, sing_handler, true); else if (typ != MatrixType::Rectangular) @@ -1992,7 +1996,7 @@ ComplexMatrix Matrix::solve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info) const + octave_idx_type& info) const { double rcon; return solve (typ, b, info, rcon, 0); @@ -2066,7 +2070,8 @@ ColumnVector Matrix::solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info, - double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const + double& rcon, solve_singularity_handler sing_handler, + blas_trans_type transt) const { Matrix tmp (b); tmp = solve (typ, tmp, info, rcon, sing_handler, true, transt); @@ -2099,7 +2104,8 @@ ComplexColumnVector Matrix::solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + solve_singularity_handler sing_handler, + blas_trans_type transt) const { ComplexMatrix tmp (*this); return tmp.solve (typ, b, info, rcon, sing_handler, transt); @@ -2128,7 +2134,8 @@ Matrix Matrix::solve (const Matrix& b, octave_idx_type& info, - double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const + double& rcon, solve_singularity_handler sing_handler, + blas_trans_type transt) const { MatrixType mattype (*this); return solve (mattype, b, info, rcon, sing_handler, true, transt); @@ -2149,7 +2156,8 @@ } ComplexMatrix -Matrix::solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon) const +Matrix::solve (const ComplexMatrix& b, octave_idx_type& info, + double& rcon) const { ComplexMatrix tmp (*this); return tmp.solve (b, info, rcon); @@ -2157,7 +2165,8 @@ ComplexMatrix Matrix::solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + solve_singularity_handler sing_handler, + blas_trans_type transt) const { ComplexMatrix tmp (*this); return tmp.solve (b, info, rcon, sing_handler, transt); @@ -2185,7 +2194,8 @@ ColumnVector Matrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + solve_singularity_handler sing_handler, + blas_trans_type transt) const { MatrixType mattype (*this); return solve (mattype, b, info, rcon, sing_handler, transt); @@ -2206,15 +2216,18 @@ } ComplexColumnVector -Matrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcon) const +Matrix::solve (const ComplexColumnVector& b, octave_idx_type& info, + double& rcon) const { ComplexMatrix tmp (*this); return tmp.solve (b, info, rcon); } ComplexColumnVector -Matrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const +Matrix::solve (const ComplexColumnVector& b, octave_idx_type& info, + double& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt) const { ComplexMatrix tmp (*this); return tmp.solve (b, info, rcon, sing_handler, transt); @@ -2734,8 +2747,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? boolMatrix Matrix::all (int dim) const @@ -3063,7 +3075,7 @@ } } - done: +done: return is; } @@ -3090,8 +3102,7 @@ { Matrix retval; - // FIXME -- need to check that a, b, and c are all the same - // size. + // FIXME: need to check that a, b, and c are all the same size. // Compute Schur decompositions. @@ -3108,8 +3119,7 @@ Matrix cx = ua.transpose () * c * ub; - // Solve the sylvester equation, back-transform, and return the - // solution. + // Solve the sylvester equation, back-transform, and return the solution. octave_idx_type a_nr = a.rows (); octave_idx_type b_nr = b.rows (); @@ -3129,7 +3139,7 @@ F77_CHAR_ARG_LEN (1))); - // FIXME -- check info? + // FIXME: check info? retval = -ua*cx*ub.transpose (); @@ -3261,8 +3271,7 @@ return xgemm (a, b); } -// 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) \ @@ -3412,7 +3421,8 @@ octave_idx_type m = x1.length (); if (x2.length () != m) - (*current_liboctave_error_handler) ("linspace: vectors must be of equal length"); + (*current_liboctave_error_handler) + ("linspace: vectors must be of equal length"); NoAlias<Matrix> retval;
--- a/liboctave/array/dMatrix.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dMatrix.h Sat Oct 26 18:57:05 2013 -0700 @@ -76,10 +76,10 @@ explicit Matrix (const charMatrix& a); Matrix& operator = (const Matrix& a) - { - MArray<double>::operator = (a); - return *this; - } + { + MArray<double>::operator = (a); + return *this; + } bool operator == (const Matrix& a) const; bool operator != (const Matrix& a) const; @@ -94,7 +94,8 @@ Matrix& insert (const DiagMatrix& a, octave_idx_type r, octave_idx_type c); Matrix& fill (double val); - Matrix& fill (double val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); + Matrix& fill (double val, octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2); Matrix append (const Matrix& a) const; Matrix append (const RowVector& a) const; @@ -115,9 +116,11 @@ // resize is the destructive equivalent for this one - Matrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; + Matrix extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const; - Matrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const; + Matrix extract_n (octave_idx_type r1, octave_idx_type c1, + octave_idx_type nr, octave_idx_type nc) const; // extract row or column i. @@ -158,7 +161,8 @@ DET determinant (void) const; DET determinant (octave_idx_type& info) const; - DET determinant (octave_idx_type& info, double& rcon, int calc_cond = 1) const; + DET determinant (octave_idx_type& info, double& rcon, + int calc_cond = 1) const; DET determinant (MatrixType &mattype, octave_idx_type& info, double& rcon, int calc_cond = 1) const; @@ -169,12 +173,14 @@ // Upper triangular matrix solvers Matrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, - bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; + bool calc_cond = false, + blas_trans_type transt = blas_no_trans) const; // Lower triangular matrix solvers Matrix ltsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, - bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; + bool calc_cond = false, + blas_trans_type transt = blas_no_trans) const; // Full matrix solvers (lu/cholesky) Matrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, @@ -189,7 +195,8 @@ double& rcon) const; Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, - bool singular_fallback = true, blas_trans_type transt = blas_no_trans) const; + bool singular_fallback = true, + blas_trans_type transt = blas_no_trans) const; ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, @@ -233,24 +240,30 @@ ComplexMatrix solve (const ComplexMatrix& b) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; - ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon) const; - ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon, + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, + double& rcon) const; + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, + double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ColumnVector solve (const ColumnVector& b) const; ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; - ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon) const; - ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon, + ColumnVector solve (const ColumnVector& b, octave_idx_type& info, + double& rcon) const; + ColumnVector solve (const ColumnVector& b, octave_idx_type& info, + double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ComplexColumnVector solve (const ComplexColumnVector& b) const; - ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; - ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, - double& rcon) const; - ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, - double& rcon, solve_singularity_handler sing_handler, + ComplexColumnVector solve (const ComplexColumnVector& b, + octave_idx_type& info) const; + ComplexColumnVector solve (const ComplexColumnVector& b, + octave_idx_type& info, double& rcon) const; + ComplexColumnVector solve (const ComplexColumnVector& b, + octave_idx_type& info, double& rcon, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; // Singular solvers @@ -331,7 +344,8 @@ // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Matrix& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const Matrix& a); friend OCTAVE_API std::istream& operator >> (std::istream& is, Matrix& a); }; @@ -342,13 +356,15 @@ // column vector by row vector -> matrix operations -extern OCTAVE_API Matrix operator * (const ColumnVector& a, const RowVector& b); +extern OCTAVE_API Matrix operator * (const ColumnVector& a, + const RowVector& b); // Other functions. extern OCTAVE_API Matrix Givens (double, double); -extern OCTAVE_API Matrix Sylvester (const Matrix&, const Matrix&, const Matrix&); +extern OCTAVE_API Matrix Sylvester (const Matrix&, const Matrix&, + const Matrix&); extern OCTAVE_API Matrix xgemm (const Matrix& a, const Matrix& b, blas_trans_type transa = blas_no_trans,
--- a/liboctave/array/dNDArray.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dNDArray.cc Sat Oct 26 18:57:05 2013 -0700 @@ -58,7 +58,7 @@ for (octave_idx_type i = 0; i < a.numel (); i++) { double val = static_cast<double> - (pa[i] + static_cast<octave_idx_type> (1)); + (pa[i] + static_cast<octave_idx_type> (1)); if (val <= 0) ptmp[i] = nan_val; else @@ -79,7 +79,7 @@ if (zero_based) for (octave_idx_type i = 0; i < a.numel (); i++) ptmp[i] = static_cast<double> - (pa[i] + static_cast<octave_idx_type> (1)); + (pa[i] + static_cast<octave_idx_type> (1)); else for (octave_idx_type i = 0; i < a.numel (); i++) ptmp[i] = static_cast<double> (pa[i]); @@ -152,7 +152,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) octave_fftw::ifft (out + k * stride * n, out + k * stride * n, - n, howmany, stride, dist); + n, howmany, stride, dist); return retval; } @@ -334,7 +334,7 @@ for (octave_idx_type i = 0; i < npts; i++) retval((i + k*npts)*stride + j*dist) = tmp[i] / - static_cast<double> (npts); + static_cast<double> (npts); } } @@ -427,8 +427,8 @@ F77_FUNC (zfftb, ZFFTB) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval((l + k*npts)*stride + j*dist) = prow[l] / - static_cast<double> (npts); + retval((l + k*npts)*stride + j*dist) = + prow[l] / static_cast<double> (npts); } } @@ -522,8 +522,8 @@ F77_FUNC (zfftb, ZFFTB) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval((l + k*npts)*stride + j*dist) = prow[l] / - static_cast<double> (npts); + retval((l + k*npts)*stride + j*dist) = + prow[l] / static_cast<double> (npts); } } @@ -635,7 +635,7 @@ return test_any (xtoo_large_for_float); } -// FIXME -- this is not quite the right thing. +// FIXME: this is not quite the right thing. boolNDArray NDArray::all (int dim) const @@ -777,8 +777,7 @@ octave_idx_type ival = NINTbig (d); if (ival < 0 || ival > std::numeric_limits<unsigned char>::max ()) - // FIXME -- is there something - // better we could do? Should we warn the user? + // FIXME: is there something better to do? Should we warn the user? ival = 0; retval.elem (i) = static_cast<char>(ival); @@ -848,7 +847,7 @@ Matrix retval; if (ndims () == 2) - retval = Matrix (Array<double> (*this)); + retval = Matrix (Array<double> (*this)); else (*current_liboctave_error_handler) ("invalid conversion of NDArray to Matrix"); @@ -907,16 +906,16 @@ { double tmp; for (octave_idx_type i = 0; i < nel; i++) - { - tmp = octave_read_value<double> (is); - if (is) - a.elem (i) = tmp; - else - goto done; - } + { + tmp = octave_read_value<double> (is); + if (is) + a.elem (i) = tmp; + else + goto done; + } } - done: +done: return is; }
--- a/liboctave/array/dNDArray.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dNDArray.h Sat Oct 26 18:57:05 2013 -0700 @@ -65,14 +65,15 @@ NDArray (const charNDArray&); // For jit support only - NDArray (double *sdata, octave_idx_type slen, octave_idx_type *adims, void *arep) + NDArray (double *sdata, octave_idx_type slen, octave_idx_type *adims, + void *arep) : MArray<double> (sdata, slen, adims, arep) { } NDArray& operator = (const NDArray& a) - { - MArray<double>::operator = (a); - return *this; - } + { + MArray<double>::operator = (a); + return *this; + } // unary operations @@ -89,7 +90,7 @@ bool all_integers (void) const; bool too_large_for_float (void) const; - // FIXME -- this is not quite the right thing. + // FIXME: this is not quite the right thing. boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; @@ -101,8 +102,10 @@ NDArray xsum (int dim = -1) const; NDArray sumsq (int dim = -1) const; NDArray concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx); - ComplexNDArray concat (const ComplexNDArray& rb, const Array<octave_idx_type>& ra_idx); - charNDArray concat (const charNDArray& rb, const Array<octave_idx_type>& ra_idx); + ComplexNDArray concat (const ComplexNDArray& rb, + const Array<octave_idx_type>& ra_idx); + charNDArray concat (const charNDArray& rb, + const Array<octave_idx_type>& ra_idx); NDArray max (int dim = -1) const; NDArray max (Array<octave_idx_type>& index, int dim = -1) const; @@ -147,11 +150,12 @@ int start_dimension = 0); static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions); + const dim_vector& dimensions); // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const NDArray& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const NDArray& a); friend OCTAVE_API std::istream& operator >> (std::istream& is, NDArray& a); NDArray diag (octave_idx_type k = 0) const; @@ -159,10 +163,10 @@ NDArray diag (octave_idx_type m, octave_idx_type n) const; NDArray& changesign (void) - { - MArray<double>::changesign (); - return *this; - } + { + MArray<double>::changesign (); + return *this; + } };
--- a/liboctave/array/dRowVector.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dRowVector.h Sat Oct 26 18:57:05 2013 -0700 @@ -50,10 +50,10 @@ RowVector (const Array<double>& a) : MArray<double> (a.as_row ()) { } RowVector& operator = (const RowVector& a) - { - MArray<double>::operator = (a); - return *this; - } + { + MArray<double>::operator = (a); + return *this; + } bool operator == (const RowVector& a) const; bool operator != (const RowVector& a) const; @@ -89,7 +89,8 @@ // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const RowVector& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const RowVector& a); friend OCTAVE_API std::istream& operator >> (std::istream& is, RowVector& a); void resize (octave_idx_type n, const double& rfv = 0) @@ -98,7 +99,7 @@ } void clear (octave_idx_type n) - { Array<double>::clear (1, n); } + { Array<double>::clear (1, n); } }; @@ -106,7 +107,8 @@ double OCTAVE_API operator * (const RowVector& a, const ColumnVector& b); -Complex OCTAVE_API operator * (const RowVector& a, const ComplexColumnVector& b); +Complex OCTAVE_API operator * (const RowVector& a, + const ComplexColumnVector& b); // other operations
--- a/liboctave/array/dSparse.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dSparse.cc Sat Oct 26 18:57:05 2013 -0700 @@ -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) \
--- a/liboctave/array/dSparse.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dSparse.h Sat Oct 26 18:57:05 2013 -0700 @@ -45,13 +45,14 @@ OCTAVE_API SparseMatrix : public MSparse<double> { - public: +public: typedef void (*solve_singularity_handler) (double rcond); SparseMatrix (void) : MSparse<double> () { } - SparseMatrix (octave_idx_type r, octave_idx_type c) : MSparse<double> (r, c) { } + SparseMatrix (octave_idx_type r, octave_idx_type c) + : MSparse<double> (r, c) { } SparseMatrix (const dim_vector& dv, octave_idx_type nz = 0) : MSparse<double> (dv, nz) { } @@ -84,13 +85,14 @@ explicit SparseMatrix (const PermMatrix& a) : MSparse<double>(a) { } - SparseMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) : MSparse<double> (r, c, num_nz) { } + SparseMatrix (octave_idx_type r, octave_idx_type c, + octave_idx_type num_nz) : MSparse<double> (r, c, num_nz) { } SparseMatrix& operator = (const SparseMatrix& a) - { - MSparse<double>::operator = (a); - return *this; - } + { + MSparse<double>::operator = (a); + return *this; + } bool operator == (const SparseMatrix& a) const; bool operator != (const SparseMatrix& a) const; @@ -104,11 +106,14 @@ // destructive insert/delete/reorder operations - 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); - SparseMatrix& insert (const SparseMatrix& a, const Array<octave_idx_type>& indx); + SparseMatrix& insert (const SparseMatrix& a, + const Array<octave_idx_type>& indx); - SparseMatrix concat (const SparseMatrix& rb, const Array<octave_idx_type>& ra_idx); + SparseMatrix concat (const SparseMatrix& rb, + const Array<octave_idx_type>& ra_idx); SparseComplexMatrix concat (const SparseComplexMatrix& rb, const Array<octave_idx_type>& ra_idx); @@ -117,12 +122,13 @@ friend OCTAVE_API SparseMatrix atan2 (const double& x, const SparseMatrix& y); friend OCTAVE_API SparseMatrix atan2 (const SparseMatrix& x, const double& y); - friend OCTAVE_API SparseMatrix atan2 (const SparseMatrix& x, const SparseMatrix& y); + friend OCTAVE_API SparseMatrix atan2 (const SparseMatrix& x, + const SparseMatrix& y); SparseMatrix transpose (void) const - { - return MSparse<double>::transpose (); - } + { + return MSparse<double>::transpose (); + } SparseMatrix hermitian (void) const { return transpose (); } // extract row or column i. @@ -149,108 +155,109 @@ DET determinant (void) const; DET determinant (octave_idx_type& info) const; - DET determinant (octave_idx_type& info, double& rcond, int calc_cond = 1) const; + DET determinant (octave_idx_type& info, double& rcond, + int calc_cond = 1) const; private: // Diagonal matrix solvers Matrix dsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, - double& rcond, solve_singularity_handler sing_handler, - bool calc_cond = false) const; + double& rcond, solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseMatrix dsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix dsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; // Upper triangular matrix solvers Matrix utsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, - double& rcond, solve_singularity_handler sing_handler, - bool calc_cond = false) const; + double& rcond, solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseMatrix utsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; // Lower triangular matrix solvers Matrix ltsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, - double& rcond, solve_singularity_handler sing_handler, - bool calc_cond = false) const; + double& rcond, solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseMatrix ltsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; // Tridiagonal matrix solvers Matrix trisolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, - double& rcond, solve_singularity_handler sing_handler, - bool calc_cond = false) const; + double& rcond, solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix trisolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseMatrix trisolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix trisolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; // Banded matrix solvers (umfpack/cholesky) Matrix bsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, - double& rcond, solve_singularity_handler sing_handler, - bool calc_cond = false) const; + double& rcond, solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseMatrix bsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix bsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; // Full matrix solvers (umfpack/cholesky) void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, @@ -258,23 +265,23 @@ bool calc_cond = false) const; Matrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, - double& rcond, solve_singularity_handler sing_handler, - bool calc_cond = false) const; + double& rcond, solve_singularity_handler sing_handler, + bool calc_cond = false) const; ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseMatrix fsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; SparseComplexMatrix fsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; public: // Generic interface to solver with no probing of type @@ -347,36 +354,42 @@ ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; - ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond, + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, + double& rcond, solve_singularity_handler sing_handler) const; SparseMatrix solve (const SparseMatrix& b) const; SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info) const; SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, double& rcond) const; - SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler) const; + SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, + double& rcond, + solve_singularity_handler sing_handler) const; SparseComplexMatrix solve (const SparseComplexMatrix& b) const; - SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info) const; - SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, - double& rcond) const; - SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, - double& rcond, + SparseComplexMatrix solve (const SparseComplexMatrix& b, + octave_idx_type& info) const; + SparseComplexMatrix solve (const SparseComplexMatrix& b, + octave_idx_type& info, double& rcond) const; + SparseComplexMatrix solve (const SparseComplexMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ColumnVector solve (const ColumnVector& b) const; ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; - ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const; - ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcond, + ColumnVector solve (const ColumnVector& b, octave_idx_type& info, + double& rcond) const; + ColumnVector solve (const ColumnVector& b, octave_idx_type& info, + double& rcond, solve_singularity_handler sing_handler) const; ComplexColumnVector solve (const ComplexColumnVector& b) const; - ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; - ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, - double& rcond) const; - ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, - double& rcond, + ComplexColumnVector solve (const ComplexColumnVector& b, + octave_idx_type& info) const; + ComplexColumnVector solve (const ComplexColumnVector& b, + octave_idx_type& info, double& rcond) const; + ComplexColumnVector solve (const ComplexColumnVector& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // other operations @@ -410,14 +423,17 @@ SparseMatrix reshape (const dim_vector& new_dims) const; - SparseMatrix permute (const Array<octave_idx_type>& vec, bool inv = false) const; + SparseMatrix permute (const Array<octave_idx_type>& vec, + bool inv = false) const; SparseMatrix ipermute (const Array<octave_idx_type>& vec) const; // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const SparseMatrix& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, SparseMatrix& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const SparseMatrix& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + SparseMatrix& a); }; @@ -429,34 +445,44 @@ // Other operators. extern OCTAVE_API SparseMatrix operator * (const SparseMatrix& a, - const SparseMatrix& b); + const SparseMatrix& b); extern OCTAVE_API Matrix operator * (const Matrix& a, - const SparseMatrix& b); + const SparseMatrix& b); extern OCTAVE_API Matrix mul_trans (const Matrix& a, - const SparseMatrix& b); + const SparseMatrix& b); extern OCTAVE_API Matrix operator * (const SparseMatrix& a, - const Matrix& b); + const Matrix& b); extern OCTAVE_API Matrix trans_mul (const SparseMatrix& a, - const Matrix& b); + const Matrix& b); -extern OCTAVE_API SparseMatrix operator * (const DiagMatrix&, const SparseMatrix&); -extern OCTAVE_API SparseMatrix operator * (const SparseMatrix&, const DiagMatrix&); +extern OCTAVE_API SparseMatrix operator * (const DiagMatrix&, + const SparseMatrix&); +extern OCTAVE_API SparseMatrix operator * (const SparseMatrix&, + const DiagMatrix&); -extern OCTAVE_API SparseMatrix operator + (const DiagMatrix&, const SparseMatrix&); -extern OCTAVE_API SparseMatrix operator + (const SparseMatrix&, const DiagMatrix&); -extern OCTAVE_API SparseMatrix operator - (const DiagMatrix&, const SparseMatrix&); -extern OCTAVE_API SparseMatrix operator - (const SparseMatrix&, const DiagMatrix&); +extern OCTAVE_API SparseMatrix operator + (const DiagMatrix&, + const SparseMatrix&); +extern OCTAVE_API SparseMatrix operator + (const SparseMatrix&, + const DiagMatrix&); +extern OCTAVE_API SparseMatrix operator - (const DiagMatrix&, + const SparseMatrix&); +extern OCTAVE_API SparseMatrix operator - (const SparseMatrix&, + const DiagMatrix&); -extern OCTAVE_API SparseMatrix operator * (const PermMatrix&, const SparseMatrix&); -extern OCTAVE_API SparseMatrix operator * (const SparseMatrix&, const PermMatrix&); +extern OCTAVE_API SparseMatrix operator * (const PermMatrix&, + const SparseMatrix&); +extern OCTAVE_API SparseMatrix operator * (const SparseMatrix&, + const PermMatrix&); extern OCTAVE_API SparseMatrix min (double d, const SparseMatrix& m); extern OCTAVE_API SparseMatrix min (const SparseMatrix& m, double d); -extern OCTAVE_API SparseMatrix min (const SparseMatrix& a, const SparseMatrix& b); +extern OCTAVE_API SparseMatrix min (const SparseMatrix& a, + const SparseMatrix& b); extern OCTAVE_API SparseMatrix max (double d, const SparseMatrix& m); extern OCTAVE_API SparseMatrix max (const SparseMatrix& m, double d); -extern OCTAVE_API SparseMatrix max (const SparseMatrix& a, const SparseMatrix& b); +extern OCTAVE_API SparseMatrix max (const SparseMatrix& a, + const SparseMatrix& b); SPARSE_SMS_CMP_OP_DECLS (SparseMatrix, double, OCTAVE_API) SPARSE_SMS_BOOL_OP_DECLS (SparseMatrix, double, OCTAVE_API)
--- a/liboctave/array/dim-vector.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dim-vector.cc Sat Oct 26 18:57:05 2013 -0700 @@ -29,10 +29,10 @@ #include "dim-vector.h" -// The maximum allowed value for a dimension extent. This will normally be a tiny bit -// off the maximum value of octave_idx_type. -// Currently 1 is subtracted to allow safe conversion of any 2D Array into Sparse, -// but this offset may change in the future. +// The maximum allowed value for a dimension extent. This will normally be a +// tiny bit off the maximum value of octave_idx_type. +// Currently 1 is subtracted to allow safe conversion of any 2D Array into +// Sparse, but this offset may change in the future. octave_idx_type dim_vector::dim_max (void) {
--- a/liboctave/array/dim-vector.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/dim-vector.h Sat Oct 26 18:57:05 2013 -0700 @@ -221,10 +221,10 @@ private: static octave_idx_type *nil_rep (void) - { - static dim_vector zv (0, 0); - return zv.rep; - } + { + static dim_vector zv (0, 0); + return zv.rep; + } public: @@ -237,8 +237,7 @@ { OCTREFCOUNT_ATOMIC_INCREMENT (&(count())); } // FIXME: Should be private, but required by array constructor for jit - explicit dim_vector (octave_idx_type *r) - : rep (r) { } + explicit dim_vector (octave_idx_type *r) : rep (r) { } static dim_vector alloc (int n) { @@ -393,102 +392,102 @@ dim_vector redim (int n) const; dim_vector as_column (void) const - { - if (length () == 2 && elem (1) == 1) - return *this; - else - return dim_vector (numel (), 1); - } + { + if (length () == 2 && elem (1) == 1) + return *this; + else + return dim_vector (numel (), 1); + } dim_vector as_row (void) const - { - if (length () == 2 && elem (0) == 1) - return *this; - else - return dim_vector (1, numel ()); - } + { + if (length () == 2 && elem (0) == 1) + return *this; + else + return dim_vector (1, numel ()); + } bool is_vector (void) const - { - return (length () == 2 && (elem (0) == 1 || elem (1) == 1)); - } + { + return (length () == 2 && (elem (0) == 1 || elem (1) == 1)); + } int first_non_singleton (int def = 0) const - { - for (int i = 0; i < length (); i++) - { - if (elem (i) != 1) - return i; - } + { + for (int i = 0; i < length (); i++) + { + if (elem (i) != 1) + return i; + } - return def; - } + return def; + } // Compute a linear index from an index tuple. octave_idx_type compute_index (const octave_idx_type *idx) const - { - octave_idx_type k = 0; - for (int i = length () - 1; i >= 0; i--) - k = k * rep[i] + idx[i]; + { + octave_idx_type k = 0; + for (int i = length () - 1; i >= 0; i--) + k = k * rep[i] + idx[i]; - return k; - } + return k; + } // Ditto, but the tuple may be incomplete (nidx < length ()). octave_idx_type compute_index (const octave_idx_type *idx, int nidx) const - { - octave_idx_type k = 0; - for (int i = nidx - 1; i >= 0; i--) - k = k * rep[i] + idx[i]; + { + octave_idx_type k = 0; + for (int i = nidx - 1; i >= 0; i--) + k = k * rep[i] + idx[i]; - return k; - } + return k; + } // Increment a multi-dimensional index tuple, optionally starting // from an offset position and return the index of the last index // position that was changed, or length () if just cycled over. int increment_index (octave_idx_type *idx, int start = 0) const - { - int i; - for (i = start; i < length (); i++) - { - if (++(*idx) == rep[i]) - *idx++ = 0; - else - break; - } - return i; - } + { + int i; + for (i = start; i < length (); i++) + { + if (++(*idx) == rep[i]) + *idx++ = 0; + else + break; + } + return i; + } // Return cumulative dimensions. dim_vector cumulative (void) const - { - int nd = length (); - dim_vector retval = alloc (nd); + { + int nd = length (); + dim_vector retval = alloc (nd); - octave_idx_type k = 1; - for (int i = 0; i < nd; i++) - retval.rep[i] = k *= rep[i]; + octave_idx_type k = 1; + for (int i = 0; i < nd; i++) + retval.rep[i] = k *= rep[i]; - return retval; - } + return retval; + } // Compute a linear index from an index tuple. Dimensions are // required to be cumulative. octave_idx_type cum_compute_index (const octave_idx_type *idx) const - { - octave_idx_type k = idx[0]; + { + octave_idx_type k = idx[0]; - for (int i = 1; i < length (); i++) - k += rep[i-1] * idx[i]; + for (int i = 1; i < length (); i++) + k += rep[i-1] * idx[i]; - return k; - } + return k; + } friend bool operator == (const dim_vector& a, const dim_vector& b);
--- a/liboctave/array/fCColVector.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fCColVector.cc Sat Oct 26 18:57:05 2013 -0700 @@ -53,7 +53,7 @@ // FloatComplex Column Vector class FloatComplexColumnVector::FloatComplexColumnVector (const FloatColumnVector& a) - : MArray<FloatComplex> (a) + : MArray<FloatComplex> (a) { } @@ -97,7 +97,8 @@ } FloatComplexColumnVector& -FloatComplexColumnVector::insert (const FloatComplexColumnVector& a, octave_idx_type r) +FloatComplexColumnVector::insert (const FloatComplexColumnVector& a, + octave_idx_type r) { octave_idx_type a_len = a.length (); @@ -152,7 +153,8 @@ } FloatComplexColumnVector& -FloatComplexColumnVector::fill (float val, octave_idx_type r1, octave_idx_type r2) +FloatComplexColumnVector::fill (float val, + octave_idx_type r1, octave_idx_type r2) { octave_idx_type len = length (); @@ -176,7 +178,8 @@ } FloatComplexColumnVector& -FloatComplexColumnVector::fill (const FloatComplex& val, octave_idx_type r1, octave_idx_type r2) +FloatComplexColumnVector::fill (const FloatComplex& val, + octave_idx_type r1, octave_idx_type r2) { octave_idx_type len = length (); @@ -263,7 +266,8 @@ } FloatComplexColumnVector -FloatComplexColumnVector::extract_n (octave_idx_type r1, octave_idx_type n) const +FloatComplexColumnVector::extract_n (octave_idx_type r1, + octave_idx_type n) const { FloatComplexColumnVector result (n); @@ -291,7 +295,7 @@ if (len == 0) return *this; - FloatComplex *d = fortran_vec (); // Ensures only one reference to my privates! + FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates! mx_inline_add2 (len, d, a.data ()); return *this; @@ -313,7 +317,7 @@ if (len == 0) return *this; - FloatComplex *d = fortran_vec (); // Ensures only one reference to my privates! + FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates! mx_inline_sub2 (len, d, a.data ()); return *this;
--- a/liboctave/array/fCColVector.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fCColVector.h Sat Oct 26 18:57:05 2013 -0700 @@ -32,13 +32,13 @@ OCTAVE_API FloatComplexColumnVector : public MArray<FloatComplex> { -friend class FloatComplexMatrix; -friend class FloatComplexRowVector; + friend class FloatComplexMatrix; + friend class FloatComplexRowVector; public: - FloatComplexColumnVector (void) - : MArray<FloatComplex> (dim_vector (0, 1)) { } + FloatComplexColumnVector (void) + : MArray<FloatComplex> (dim_vector (0, 1)) { } explicit FloatComplexColumnVector (octave_idx_type n) : MArray<FloatComplex> (dim_vector (n, 1)) { } @@ -61,23 +61,27 @@ explicit FloatComplexColumnVector (const FloatColumnVector& a); FloatComplexColumnVector& operator = (const FloatComplexColumnVector& a) - { - MArray<FloatComplex>::operator = (a); - return *this; - } + { + MArray<FloatComplex>::operator = (a); + return *this; + } bool operator == (const FloatComplexColumnVector& a) const; bool operator != (const FloatComplexColumnVector& a) const; // destructive insert/delete/reorder operations - FloatComplexColumnVector& insert (const FloatColumnVector& a, octave_idx_type r); - FloatComplexColumnVector& insert (const FloatComplexColumnVector& a, octave_idx_type r); + FloatComplexColumnVector& insert (const FloatColumnVector& a, + octave_idx_type r); + FloatComplexColumnVector& insert (const FloatComplexColumnVector& a, + octave_idx_type r); FloatComplexColumnVector& fill (float val); FloatComplexColumnVector& fill (const FloatComplex& val); - FloatComplexColumnVector& fill (float val, octave_idx_type r1, octave_idx_type r2); - FloatComplexColumnVector& fill (const FloatComplex& val, octave_idx_type r1, octave_idx_type r2); + FloatComplexColumnVector& fill (float val, + octave_idx_type r1, octave_idx_type r2); + FloatComplexColumnVector& fill (const FloatComplex& val, + octave_idx_type r1, octave_idx_type r2); FloatComplexColumnVector stack (const FloatColumnVector& a) const; FloatComplexColumnVector stack (const FloatComplexColumnVector& a) const; @@ -85,13 +89,16 @@ FloatComplexRowVector hermitian (void) const; FloatComplexRowVector transpose (void) const; - friend OCTAVE_API FloatComplexColumnVector conj (const FloatComplexColumnVector& a); + friend OCTAVE_API FloatComplexColumnVector + conj (const FloatComplexColumnVector& a); // resize is the destructive equivalent for this one - FloatComplexColumnVector extract (octave_idx_type r1, octave_idx_type r2) const; + FloatComplexColumnVector extract (octave_idx_type r1, + octave_idx_type r2) const; - FloatComplexColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const; + FloatComplexColumnVector extract_n (octave_idx_type r1, + octave_idx_type n) const; // column vector by column vector -> column vector operations @@ -100,27 +107,27 @@ // matrix by column vector -> column vector operations - friend OCTAVE_API FloatComplexColumnVector operator * (const FloatComplexMatrix& a, - const FloatColumnVector& b); + friend OCTAVE_API FloatComplexColumnVector + operator * (const FloatComplexMatrix& a, const FloatColumnVector& b); - friend OCTAVE_API FloatComplexColumnVector operator * (const FloatComplexMatrix& a, - const FloatComplexColumnVector& b); + friend OCTAVE_API FloatComplexColumnVector + operator * (const FloatComplexMatrix& a, const FloatComplexColumnVector& b); // matrix by column vector -> column vector operations - friend OCTAVE_API FloatComplexColumnVector operator * (const FloatMatrix& a, - const FloatComplexColumnVector& b); + friend OCTAVE_API FloatComplexColumnVector + operator * (const FloatMatrix& a, const FloatComplexColumnVector& b); // diagonal matrix by column vector -> column vector operations - friend OCTAVE_API FloatComplexColumnVector operator * (const FloatDiagMatrix& a, - const FloatComplexColumnVector& b); + friend OCTAVE_API FloatComplexColumnVector + operator * (const FloatDiagMatrix& a, const FloatComplexColumnVector& b); - friend OCTAVE_API FloatComplexColumnVector operator * (const FloatComplexDiagMatrix& a, - const ColumnVector& b); + friend OCTAVE_API FloatComplexColumnVector + operator * (const FloatComplexDiagMatrix& a, const ColumnVector& b); - friend OCTAVE_API FloatComplexColumnVector operator * (const FloatComplexDiagMatrix& a, - const FloatComplexColumnVector& b); + friend OCTAVE_API FloatComplexColumnVector + operator * (const FloatComplexDiagMatrix& a, const FloatComplexColumnVector& b); // other operations @@ -131,8 +138,10 @@ // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatComplexColumnVector& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatComplexColumnVector& a); + friend OCTAVE_API std::ostream& + operator << (std::ostream& os, const FloatComplexColumnVector& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + FloatComplexColumnVector& a); void resize (octave_idx_type n, const FloatComplex& rfv = FloatComplex (0)) { @@ -140,7 +149,7 @@ } void clear (octave_idx_type n) - { Array<FloatComplex>::clear (n, 1); } + { Array<FloatComplex>::clear (n, 1); } };
--- a/liboctave/array/fCDiagMatrix.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fCDiagMatrix.cc Sat Oct 26 18:57:05 2013 -0700 @@ -76,7 +76,8 @@ } FloatComplexDiagMatrix& -FloatComplexDiagMatrix::fill (float val, octave_idx_type beg, octave_idx_type end) +FloatComplexDiagMatrix::fill (float val, + octave_idx_type beg, octave_idx_type end) { if (beg < 0 || end >= length () || end < beg) { @@ -91,7 +92,8 @@ } FloatComplexDiagMatrix& -FloatComplexDiagMatrix::fill (const FloatComplex& val, octave_idx_type beg, octave_idx_type end) +FloatComplexDiagMatrix::fill (const FloatComplex& val, + octave_idx_type beg, octave_idx_type end) { if (beg < 0 || end >= length () || end < beg) { @@ -186,7 +188,8 @@ } FloatComplexDiagMatrix& -FloatComplexDiagMatrix::fill (const FloatComplexColumnVector& a, octave_idx_type beg) +FloatComplexDiagMatrix::fill (const FloatComplexColumnVector& a, + octave_idx_type beg) { octave_idx_type a_len = a.length (); if (beg < 0 || beg + a_len >= length ()) @@ -218,7 +221,8 @@ } FloatComplexDiagMatrix& -FloatComplexDiagMatrix::fill (const FloatComplexRowVector& a, octave_idx_type beg) +FloatComplexDiagMatrix::fill (const FloatComplexRowVector& a, + octave_idx_type beg) { octave_idx_type a_len = a.length (); if (beg < 0 || beg + a_len >= length ()) @@ -242,13 +246,15 @@ FloatComplexDiagMatrix conj (const FloatComplexDiagMatrix& a) { - return FloatComplexDiagMatrix (conj (a.extract_diag ()), a.rows (), a.columns ()); + return FloatComplexDiagMatrix (conj (a.extract_diag ()), a.rows (), + a.columns ()); } // resize is the destructive analog for this one FloatComplexMatrix -FloatComplexDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const +FloatComplexDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const { if (r1 > r2) { std::swap (r1, r2); } if (c1 > c2) { std::swap (c1, c2); } @@ -426,7 +432,7 @@ if (r == 0 || c == 0) return *this; - FloatComplex *d = fortran_vec (); // Ensures only one reference to my privates! + FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates! mx_inline_add2 (length (), d, a.data ()); return *this;
--- a/liboctave/array/fCDiagMatrix.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fCDiagMatrix.h Sat Oct 26 18:57:05 2013 -0700 @@ -41,15 +41,19 @@ FloatComplexDiagMatrix (void) : MDiagArray2<FloatComplex> () { } - FloatComplexDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<FloatComplex> (r, c) { } + FloatComplexDiagMatrix (octave_idx_type r, + octave_idx_type c) + : MDiagArray2<FloatComplex> (r, c) { } - FloatComplexDiagMatrix (octave_idx_type r, octave_idx_type c, const FloatComplex& val) + FloatComplexDiagMatrix (octave_idx_type r, octave_idx_type c, + const FloatComplex& val) : MDiagArray2<FloatComplex> (r, c, val) { } explicit FloatComplexDiagMatrix (const Array<FloatComplex>& a) : MDiagArray2<FloatComplex> (a) { } - FloatComplexDiagMatrix (const Array<FloatComplex>& a, octave_idx_type r, octave_idx_type c) + FloatComplexDiagMatrix (const Array<FloatComplex>& a, octave_idx_type r, + octave_idx_type c) : MDiagArray2<FloatComplex> (a, r, c) { } explicit FloatComplexDiagMatrix (const Array<float>& a) @@ -68,36 +72,45 @@ : MDiagArray2<FloatComplex> (a) { } FloatComplexDiagMatrix& operator = (const FloatComplexDiagMatrix& a) - { - MDiagArray2<FloatComplex>::operator = (a); - return *this; - } + { + MDiagArray2<FloatComplex>::operator = (a); + return *this; + } bool operator == (const FloatComplexDiagMatrix& a) const; bool operator != (const FloatComplexDiagMatrix& a) const; FloatComplexDiagMatrix& fill (float val); FloatComplexDiagMatrix& fill (const FloatComplex& val); - FloatComplexDiagMatrix& fill (float val, octave_idx_type beg, octave_idx_type end); - FloatComplexDiagMatrix& fill (const FloatComplex& val, octave_idx_type beg, octave_idx_type end); + FloatComplexDiagMatrix& fill (float val, + octave_idx_type beg, octave_idx_type end); + FloatComplexDiagMatrix& fill (const FloatComplex& val, + octave_idx_type beg, octave_idx_type end); FloatComplexDiagMatrix& fill (const FloatColumnVector& a); FloatComplexDiagMatrix& fill (const FloatComplexColumnVector& a); FloatComplexDiagMatrix& fill (const FloatRowVector& a); FloatComplexDiagMatrix& fill (const FloatComplexRowVector& a); - FloatComplexDiagMatrix& fill (const FloatColumnVector& a, octave_idx_type beg); - FloatComplexDiagMatrix& fill (const FloatComplexColumnVector& a, octave_idx_type beg); + FloatComplexDiagMatrix& fill (const FloatColumnVector& a, + octave_idx_type beg); + FloatComplexDiagMatrix& fill (const FloatComplexColumnVector& a, + octave_idx_type beg); FloatComplexDiagMatrix& fill (const FloatRowVector& a, octave_idx_type beg); - FloatComplexDiagMatrix& fill (const FloatComplexRowVector& a, octave_idx_type beg); + FloatComplexDiagMatrix& fill (const FloatComplexRowVector& a, + octave_idx_type beg); - FloatComplexDiagMatrix hermitian (void) const { return MDiagArray2<FloatComplex>::hermitian (std::conj); } - FloatComplexDiagMatrix transpose (void) const { return MDiagArray2<FloatComplex>::transpose (); } + FloatComplexDiagMatrix hermitian (void) const + { return MDiagArray2<FloatComplex>::hermitian (std::conj); } + FloatComplexDiagMatrix transpose (void) const + { return MDiagArray2<FloatComplex>::transpose (); } FloatDiagMatrix abs (void) const; - friend OCTAVE_API FloatComplexDiagMatrix conj (const FloatComplexDiagMatrix& a); + friend OCTAVE_API FloatComplexDiagMatrix + conj (const FloatComplexDiagMatrix& a); // resize is the destructive analog for this one - FloatComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; + FloatComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const; // extract row or column i @@ -121,14 +134,15 @@ // other operations FloatComplexColumnVector extract_diag (octave_idx_type k = 0) const - { return MDiagArray2<FloatComplex>::extract_diag (k); } + { return MDiagArray2<FloatComplex>::extract_diag (k); } FloatComplexDET determinant (void) const; float rcond (void) const; // i/o - friend std::ostream& operator << (std::ostream& os, const FloatComplexDiagMatrix& a); + friend std::ostream& operator << (std::ostream& os, + const FloatComplexDiagMatrix& a); };
--- a/liboctave/array/fCMatrix.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fCMatrix.cc Sat Oct 26 18:57:05 2013 -0700 @@ -258,7 +258,8 @@ F77_CHAR_ARG_LEN_DECL); } -static const FloatComplex FloatComplex_NaN_result (octave_Float_NaN, octave_Float_NaN); +static const FloatComplex FloatComplex_NaN_result (octave_Float_NaN, + octave_Float_NaN); // FloatComplex Matrix class @@ -301,7 +302,7 @@ elem (i, i) = a.elem (i, i); } -// FIXME -- could we use a templated mixed-type copy function +// FIXME: could we use a templated mixed-type copy function // here? FloatComplexMatrix::FloatComplexMatrix (const boolMatrix& a) @@ -366,7 +367,8 @@ // destructive insert/delete/reorder operations FloatComplexMatrix& -FloatComplexMatrix::insert (const FloatMatrix& a, octave_idx_type r, octave_idx_type c) +FloatComplexMatrix::insert (const FloatMatrix& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols (); @@ -390,7 +392,8 @@ } FloatComplexMatrix& -FloatComplexMatrix::insert (const FloatRowVector& a, octave_idx_type r, octave_idx_type c) +FloatComplexMatrix::insert (const FloatRowVector& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_len = a.length (); @@ -412,7 +415,8 @@ } FloatComplexMatrix& -FloatComplexMatrix::insert (const FloatColumnVector& a, octave_idx_type r, octave_idx_type c) +FloatComplexMatrix::insert (const FloatColumnVector& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_len = a.length (); @@ -434,7 +438,8 @@ } FloatComplexMatrix& -FloatComplexMatrix::insert (const FloatDiagMatrix& a, octave_idx_type r, octave_idx_type c) +FloatComplexMatrix::insert (const FloatDiagMatrix& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols (); @@ -461,14 +466,16 @@ } FloatComplexMatrix& -FloatComplexMatrix::insert (const FloatComplexMatrix& a, octave_idx_type r, octave_idx_type c) +FloatComplexMatrix::insert (const FloatComplexMatrix& a, + octave_idx_type r, octave_idx_type c) { Array<FloatComplex>::insert (a, r, c); return *this; } FloatComplexMatrix& -FloatComplexMatrix::insert (const FloatComplexRowVector& a, octave_idx_type r, octave_idx_type c) +FloatComplexMatrix::insert (const FloatComplexRowVector& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_len = a.length (); if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ()) @@ -484,7 +491,8 @@ } FloatComplexMatrix& -FloatComplexMatrix::insert (const FloatComplexColumnVector& a, octave_idx_type r, octave_idx_type c) +FloatComplexMatrix::insert (const FloatComplexColumnVector& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_len = a.length (); @@ -506,7 +514,8 @@ } FloatComplexMatrix& -FloatComplexMatrix::insert (const FloatComplexDiagMatrix& a, octave_idx_type r, octave_idx_type c) +FloatComplexMatrix::insert (const FloatComplexDiagMatrix& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols (); @@ -569,7 +578,8 @@ } FloatComplexMatrix& -FloatComplexMatrix::fill (float val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) +FloatComplexMatrix::fill (float val, octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) { octave_idx_type nr = rows (); octave_idx_type nc = cols (); @@ -597,7 +607,9 @@ } FloatComplexMatrix& -FloatComplexMatrix::fill (const FloatComplex& val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) +FloatComplexMatrix::fill (const FloatComplex& val, + octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) { octave_idx_type nr = rows (); octave_idx_type nc = cols (); @@ -929,7 +941,8 @@ // resize is the destructive equivalent for this one FloatComplexMatrix -FloatComplexMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const +FloatComplexMatrix::extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const { if (r1 > r2) { std::swap (r1, r2); } if (c1 > c2) { std::swap (c1, c2); } @@ -938,7 +951,8 @@ } FloatComplexMatrix -FloatComplexMatrix::extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const +FloatComplexMatrix::extract_n (octave_idx_type r1, octave_idx_type c1, + octave_idx_type nr, octave_idx_type nc) const { return index (idx_vector (r1, r1 + nr), idx_vector (c1, c1 + nc)); } @@ -976,7 +990,7 @@ FloatComplexMatrix FloatComplexMatrix::inverse (octave_idx_type& info, float& rcon, int force, - int calc_cond) const + int calc_cond) const { MatrixType mattype (*this); return inverse (mattype, info, rcon, force, calc_cond); @@ -999,7 +1013,7 @@ FloatComplexMatrix FloatComplexMatrix::tinverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const + float& rcon, int force, int calc_cond) const { FloatComplexMatrix retval; @@ -1056,7 +1070,7 @@ FloatComplexMatrix FloatComplexMatrix::finverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const + float& rcon, int force, int calc_cond) const { FloatComplexMatrix retval; @@ -1091,7 +1105,8 @@ // Calculate the norm of the matrix, for later use. float anorm; if (calc_cond) - anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)).max (); + anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)) + .max (); F77_XFCN (cgetrf, CGETRF, (nc, nc, tmp_data, nr, pipvt, info)); @@ -1137,7 +1152,7 @@ FloatComplexMatrix FloatComplexMatrix::inverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const + float& rcon, int force, int calc_cond) const { int typ = mattype.type (false); FloatComplexMatrix ret; @@ -1168,7 +1183,8 @@ ret = finverse (mattype, info, rcon, force, calc_cond); if ((mattype.is_hermitian () || calc_cond) && rcon == 0.) - ret = FloatComplexMatrix (rows (), columns (), FloatComplex (octave_Float_Inf, 0.)); + ret = FloatComplexMatrix (rows (), columns (), + FloatComplex (octave_Float_Inf, 0.)); } return ret; @@ -1311,10 +1327,12 @@ F77_FUNC (cffti, CFFTI) (const octave_idx_type&, FloatComplex*); F77_RET_T - F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, FloatComplex*, FloatComplex*); + F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, FloatComplex*, + FloatComplex*); F77_RET_T - F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, FloatComplex*, FloatComplex*); + F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, FloatComplex*, + FloatComplex*); } FloatComplexMatrix @@ -1555,7 +1573,8 @@ } FloatComplexDET -FloatComplexMatrix::determinant (octave_idx_type& info, float& rcon, int calc_cond) const +FloatComplexMatrix::determinant (octave_idx_type& info, float& rcon, + int calc_cond) const { MatrixType mattype (*this); return determinant (mattype, info, rcon, calc_cond); @@ -1563,7 +1582,8 @@ FloatComplexDET FloatComplexMatrix::determinant (MatrixType& mattype, - octave_idx_type& info, float& rcon, int calc_cond) const + octave_idx_type& info, float& rcon, + int calc_cond) const { FloatComplexDET retval (1.0); @@ -1792,7 +1812,7 @@ FloatComplex *tmp_data = atmp.fortran_vec (); anorm = atmp.abs().sum(). - row(static_cast<octave_idx_type>(0)).max(); + row(static_cast<octave_idx_type>(0)).max(); F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -1835,7 +1855,7 @@ if (anorm < 0.) anorm = atmp.abs ().sum (). - row(static_cast<octave_idx_type>(0)).max (); + row(static_cast<octave_idx_type>(0)).max (); Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); @@ -1871,9 +1891,9 @@ FloatComplexMatrix FloatComplexMatrix::utsolve (MatrixType &mattype, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - bool calc_cond, blas_trans_type transt) const + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + bool calc_cond, blas_trans_type transt) const { FloatComplexMatrix retval; @@ -1972,9 +1992,9 @@ FloatComplexMatrix FloatComplexMatrix::ltsolve (MatrixType &mattype, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - bool calc_cond, blas_trans_type transt) const + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + bool calc_cond, blas_trans_type transt) const { FloatComplexMatrix retval; @@ -2073,9 +2093,9 @@ FloatComplexMatrix FloatComplexMatrix::fsolve (MatrixType &mattype, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - bool calc_cond) const + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + bool calc_cond) const { FloatComplexMatrix retval; @@ -2092,7 +2112,7 @@ { volatile int typ = mattype.type (); - // Calculate the norm of the matrix, for later use. + // Calculate the norm of the matrix, for later use. float anorm = -1.; if (typ == MatrixType::Hermitian) @@ -2187,7 +2207,8 @@ // Calculate the norm of the matrix, for later use. if (anorm < 0.) - anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)).max (); + anorm = atmp.abs ().sum ().row (static_cast<octave_idx_type>(0)) + .max (); F77_XFCN (cgetrf, CGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -2267,23 +2288,25 @@ FloatComplexMatrix FloatComplexMatrix::solve (MatrixType &typ, const FloatMatrix& b, - octave_idx_type& info) const + octave_idx_type& info) const { float rcon; return solve (typ, b, info, rcon, 0); } FloatComplexMatrix -FloatComplexMatrix::solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, - float& rcon) const +FloatComplexMatrix::solve (MatrixType &typ, const FloatMatrix& b, + octave_idx_type& info, + float& rcon) const { return solve (typ, b, info, rcon, 0); } FloatComplexMatrix -FloatComplexMatrix::solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, - bool singular_fallback, blas_trans_type transt) const +FloatComplexMatrix::solve (MatrixType &typ, const FloatMatrix& b, + octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + bool singular_fallback, blas_trans_type transt) const { FloatComplexMatrix tmp (b); return solve (typ, tmp, info, rcon, sing_handler, singular_fallback, transt); @@ -2299,7 +2322,7 @@ FloatComplexMatrix FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info) const + octave_idx_type& info) const { float rcon; return solve (typ, b, info, rcon, 0); @@ -2307,16 +2330,16 @@ FloatComplexMatrix FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon) const + octave_idx_type& info, float& rcon) const { return solve (typ, b, info, rcon, 0); } FloatComplexMatrix FloatComplexMatrix::solve (MatrixType &mattype, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - bool singular_fallback, blas_trans_type transt) const + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + bool singular_fallback, blas_trans_type transt) const { FloatComplexMatrix retval; int typ = mattype.type (); @@ -2330,9 +2353,11 @@ else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) retval = ltsolve (mattype, b, info, rcon, sing_handler, false, transt); else if (transt == blas_trans) - return transpose ().solve (mattype, b, info, rcon, sing_handler, singular_fallback); + return transpose ().solve (mattype, b, info, rcon, sing_handler, + singular_fallback); else if (transt == blas_conj_trans) - retval = hermitian ().solve (mattype, b, info, rcon, sing_handler, singular_fallback); + retval = hermitian ().solve (mattype, b, info, rcon, sing_handler, + singular_fallback); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) retval = fsolve (mattype, b, info, rcon, sing_handler, true); else if (typ != MatrixType::Rectangular) @@ -2361,7 +2386,7 @@ FloatComplexColumnVector FloatComplexMatrix::solve (MatrixType &typ, const FloatColumnVector& b, - octave_idx_type& info) const + octave_idx_type& info) const { float rcon; return solve (typ, FloatComplexColumnVector (b), info, rcon, 0); @@ -2369,21 +2394,24 @@ FloatComplexColumnVector FloatComplexMatrix::solve (MatrixType &typ, const FloatColumnVector& b, - octave_idx_type& info, float& rcon) const + octave_idx_type& info, float& rcon) const { return solve (typ, FloatComplexColumnVector (b), info, rcon, 0); } FloatComplexColumnVector FloatComplexMatrix::solve (MatrixType &typ, const FloatColumnVector& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt) const { - return solve (typ, FloatComplexColumnVector (b), info, rcon, sing_handler, transt); + return solve (typ, FloatComplexColumnVector (b), info, rcon, sing_handler, + transt); } FloatComplexColumnVector -FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b) const +FloatComplexMatrix::solve (MatrixType &typ, + const FloatComplexColumnVector& b) const { octave_idx_type info; float rcon; @@ -2392,7 +2420,7 @@ FloatComplexColumnVector FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info) const + octave_idx_type& info) const { float rcon; return solve (typ, b, info, rcon, 0); @@ -2400,15 +2428,16 @@ FloatComplexColumnVector FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info, float& rcon) const + octave_idx_type& info, float& rcon) const { return solve (typ, b, info, rcon, 0); } FloatComplexColumnVector FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt) const { FloatComplexMatrix tmp (b); @@ -2432,14 +2461,17 @@ } FloatComplexMatrix -FloatComplexMatrix::solve (const FloatMatrix& b, octave_idx_type& info, float& rcon) const +FloatComplexMatrix::solve (const FloatMatrix& b, octave_idx_type& info, + float& rcon) const { return solve (b, info, rcon, 0); } FloatComplexMatrix -FloatComplexMatrix::solve (const FloatMatrix& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const +FloatComplexMatrix::solve (const FloatMatrix& b, octave_idx_type& info, + float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt) const { FloatComplexMatrix tmp (b); return solve (tmp, info, rcon, sing_handler, transt); @@ -2454,21 +2486,25 @@ } FloatComplexMatrix -FloatComplexMatrix::solve (const FloatComplexMatrix& b, octave_idx_type& info) const +FloatComplexMatrix::solve (const FloatComplexMatrix& b, + octave_idx_type& info) const { float rcon; return solve (b, info, rcon, 0); } FloatComplexMatrix -FloatComplexMatrix::solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon) const +FloatComplexMatrix::solve (const FloatComplexMatrix& b, octave_idx_type& info, + float& rcon) const { return solve (b, info, rcon, 0); } FloatComplexMatrix -FloatComplexMatrix::solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const +FloatComplexMatrix::solve (const FloatComplexMatrix& b, octave_idx_type& info, + float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt) const { MatrixType mattype (*this); return solve (mattype, b, info, rcon, sing_handler, true, transt); @@ -2483,7 +2519,8 @@ } FloatComplexColumnVector -FloatComplexMatrix::solve (const FloatColumnVector& b, octave_idx_type& info) const +FloatComplexMatrix::solve (const FloatColumnVector& b, + octave_idx_type& info) const { float rcon; return solve (FloatComplexColumnVector (b), info, rcon, 0); @@ -2491,15 +2528,16 @@ FloatComplexColumnVector FloatComplexMatrix::solve (const FloatColumnVector& b, octave_idx_type& info, - float& rcon) const + float& rcon) const { return solve (FloatComplexColumnVector (b), info, rcon, 0); } FloatComplexColumnVector FloatComplexMatrix::solve (const FloatColumnVector& b, octave_idx_type& info, - float& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt) const { return solve (FloatComplexColumnVector (b), info, rcon, sing_handler, transt); } @@ -2513,23 +2551,27 @@ } FloatComplexColumnVector -FloatComplexMatrix::solve (const FloatComplexColumnVector& b, octave_idx_type& info) const +FloatComplexMatrix::solve (const FloatComplexColumnVector& b, + octave_idx_type& info) const { float rcon; return solve (b, info, rcon, 0); } FloatComplexColumnVector -FloatComplexMatrix::solve (const FloatComplexColumnVector& b, octave_idx_type& info, - float& rcon) const +FloatComplexMatrix::solve (const FloatComplexColumnVector& b, + octave_idx_type& info, + float& rcon) const { return solve (b, info, rcon, 0); } FloatComplexColumnVector -FloatComplexMatrix::solve (const FloatComplexColumnVector& b, octave_idx_type& info, - float& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const +FloatComplexMatrix::solve (const FloatComplexColumnVector& b, + octave_idx_type& info, + float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt) const { MatrixType mattype (*this); return solve (mattype, b, info, rcon, sing_handler, transt); @@ -2554,7 +2596,7 @@ FloatComplexMatrix FloatComplexMatrix::lssolve (const FloatMatrix& b, octave_idx_type& info, - octave_idx_type& rank) const + octave_idx_type& rank) const { float rcon; return lssolve (FloatComplexMatrix (b), info, rank, rcon); @@ -2562,7 +2604,7 @@ FloatComplexMatrix FloatComplexMatrix::lssolve (const FloatMatrix& b, octave_idx_type& info, - octave_idx_type& rank, float& rcon) const + octave_idx_type& rank, float& rcon) const { return lssolve (FloatComplexMatrix (b), info, rank, rcon); } @@ -2577,7 +2619,8 @@ } FloatComplexMatrix -FloatComplexMatrix::lssolve (const FloatComplexMatrix& b, octave_idx_type& info) const +FloatComplexMatrix::lssolve (const FloatComplexMatrix& b, + octave_idx_type& info) const { octave_idx_type rank; float rcon; @@ -2586,7 +2629,7 @@ FloatComplexMatrix FloatComplexMatrix::lssolve (const FloatComplexMatrix& b, octave_idx_type& info, - octave_idx_type& rank) const + octave_idx_type& rank) const { float rcon; return lssolve (b, info, rank, rcon); @@ -2594,7 +2637,7 @@ FloatComplexMatrix FloatComplexMatrix::lssolve (const FloatComplexMatrix& b, octave_idx_type& info, - octave_idx_type& rank, float& rcon) const + octave_idx_type& rank, float& rcon) const { FloatComplexMatrix retval; @@ -2666,8 +2709,9 @@ nlvl = 0; octave_idx_type lrwork = minmn*(10 + 2*smlsiz + 8*nlvl) - + 3*smlsiz*nrhs + std::max ((smlsiz+1)*(smlsiz+1), - n*(1+nrhs) + 2*nrhs); + + 3*smlsiz*nrhs + + std::max ((smlsiz+1)*(smlsiz+1), + n*(1+nrhs) + 2*nrhs); if (lrwork < 1) lrwork = 1; Array<float> rwork (dim_vector (lrwork, 1)); @@ -2742,7 +2786,8 @@ } FloatComplexColumnVector -FloatComplexMatrix::lssolve (const FloatColumnVector& b, octave_idx_type& info) const +FloatComplexMatrix::lssolve (const FloatColumnVector& b, + octave_idx_type& info) const { octave_idx_type rank; float rcon; @@ -2751,7 +2796,7 @@ FloatComplexColumnVector FloatComplexMatrix::lssolve (const FloatColumnVector& b, octave_idx_type& info, - octave_idx_type& rank) const + octave_idx_type& rank) const { float rcon; return lssolve (FloatComplexColumnVector (b), info, rank, rcon); @@ -2759,7 +2804,7 @@ FloatComplexColumnVector FloatComplexMatrix::lssolve (const FloatColumnVector& b, octave_idx_type& info, - octave_idx_type& rank, float& rcon) const + octave_idx_type& rank, float& rcon) const { return lssolve (FloatComplexColumnVector (b), info, rank, rcon); } @@ -2774,7 +2819,8 @@ } FloatComplexColumnVector -FloatComplexMatrix::lssolve (const FloatComplexColumnVector& b, octave_idx_type& info) const +FloatComplexMatrix::lssolve (const FloatComplexColumnVector& b, + octave_idx_type& info) const { octave_idx_type rank; float rcon; @@ -2782,8 +2828,9 @@ } FloatComplexColumnVector -FloatComplexMatrix::lssolve (const FloatComplexColumnVector& b, octave_idx_type& info, - octave_idx_type& rank) const +FloatComplexMatrix::lssolve (const FloatComplexColumnVector& b, + octave_idx_type& info, + octave_idx_type& rank) const { float rcon; return lssolve (b, info, rank, rcon); @@ -2791,8 +2838,9 @@ } FloatComplexColumnVector -FloatComplexMatrix::lssolve (const FloatComplexColumnVector& b, octave_idx_type& info, - octave_idx_type& rank, float& rcon) const +FloatComplexMatrix::lssolve (const FloatComplexColumnVector& b, + octave_idx_type& info, + octave_idx_type& rank, float& rcon) const { FloatComplexColumnVector retval; @@ -2856,7 +2904,7 @@ nlvl = 0; octave_idx_type lrwork = minmn*(10 + 2*smlsiz + 8*nlvl) - + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1); + + 3*smlsiz*nrhs + (smlsiz+1)*(smlsiz+1); if (lrwork < 1) lrwork = 1; Array<float> rwork (dim_vector (lrwork, 1)); @@ -3043,7 +3091,7 @@ if (nr == 0 || nc == 0) return *this; - FloatComplex *d = fortran_vec (); // Ensures only one reference to my privates! + FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates! mx_inline_add2 (length (), d, a.data ()); return *this; @@ -3067,7 +3115,7 @@ if (nr == 0 || nc == 0) return *this; - FloatComplex *d = fortran_vec (); // Ensures only one reference to my privates! + FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates! mx_inline_sub2 (length (), d, a.data ()); return *this; @@ -3168,7 +3216,7 @@ return false; } -// FIXME Do these really belong here? Maybe they should be +// FIXME: Do these really belong here? Maybe they should be // in a base class? boolMatrix @@ -3186,13 +3234,15 @@ FloatComplexMatrix FloatComplexMatrix::cumprod (int dim) const { - return do_mx_cum_op<FloatComplex, FloatComplex> (*this, dim, mx_inline_cumprod); + return do_mx_cum_op<FloatComplex, FloatComplex> (*this, dim, + mx_inline_cumprod); } FloatComplexMatrix FloatComplexMatrix::cumsum (int dim) const { - return do_mx_cum_op<FloatComplex, FloatComplex> (*this, dim, mx_inline_cumsum); + return do_mx_cum_op<FloatComplex, FloatComplex> (*this, dim, + mx_inline_cumsum); } FloatComplexMatrix @@ -3315,7 +3365,8 @@ if (! xisnan (tmp_min)) { - abs_min = real_only ? std::real (tmp_min) : std::abs (tmp_min); + abs_min = real_only ? std::real (tmp_min) + : std::abs (tmp_min); break; } } @@ -3389,7 +3440,8 @@ if (! xisnan (tmp_max)) { - abs_max = real_only ? std::real (tmp_max) : std::abs (tmp_max); + abs_max = real_only ? std::real (tmp_max) + : std::abs (tmp_max); break; } } @@ -3463,7 +3515,8 @@ if (! xisnan (tmp_min)) { - abs_min = real_only ? std::real (tmp_min) : std::abs (tmp_min); + abs_min = real_only ? std::real (tmp_min) + : std::abs (tmp_min); break; } } @@ -3537,7 +3590,8 @@ if (! xisnan (tmp_max)) { - abs_max = real_only ? std::real (tmp_max) : std::abs (tmp_max); + abs_max = real_only ? std::real (tmp_max) + : std::abs (tmp_max); break; } } @@ -3641,7 +3695,7 @@ { FloatComplexMatrix retval; - // FIXME -- need to check that a, b, and c are all the same + // FIXME: need to check that a, b, and c are all the same // size. // Compute Schur decompositions @@ -3679,7 +3733,7 @@ F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - // FIXME -- check info? + // FIXME: check info? retval = -ua * cx * ub.hermitian (); @@ -3760,7 +3814,7 @@ { octave_idx_type lda = a.rows (); - // FIXME -- looking at the reference BLAS, it appears that it + // FIXME: looking at the reference BLAS, it appears that it // should not be necessary to initialize the output matrix if // BETA is 0 in the call to CHERK, but ATLAS appears to // use the result matrix before zeroing the elements. @@ -3808,13 +3862,16 @@ { if (cja == cjb) { - F77_FUNC (xcdotu, XCDOTU) (a_nc, a.data (), 1, b.data (), 1, *c); + F77_FUNC (xcdotu, XCDOTU) (a_nc, a.data (), 1, b.data (), 1, + *c); if (cja) *c = std::conj (*c); } else if (cja) - F77_FUNC (xcdotc, XCDOTC) (a_nc, a.data (), 1, b.data (), 1, *c); + F77_FUNC (xcdotc, XCDOTC) (a_nc, a.data (), 1, b.data (), 1, + *c); else - F77_FUNC (xcdotc, XCDOTC) (a_nc, b.data (), 1, a.data (), 1, *c); + F77_FUNC (xcdotc, XCDOTC) (a_nc, b.data (), 1, a.data (), 1, + *c); } else if (b_nc == 1 && ! cjb) { @@ -3855,7 +3912,7 @@ return xgemm (a, b); } -// FIXME -- it would be nice to share code among the min/max +// FIXME: it would be nice to share code among the min/max // functions below. #define EMPTY_RETURN_CHECK(T) \ @@ -4051,7 +4108,8 @@ octave_idx_type m = x1.length (); if (x2.length () != m) - (*current_liboctave_error_handler) ("linspace: vectors must be of equal length"); + (*current_liboctave_error_handler) + ("linspace: vectors must be of equal length"); NoAlias<FloatComplexMatrix> retval;
--- a/liboctave/array/fCMatrix.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fCMatrix.h Sat Oct 26 18:57:05 2013 -0700 @@ -90,10 +90,10 @@ FloatComplexMatrix (const FloatMatrix& re, const FloatMatrix& im); FloatComplexMatrix& operator = (const FloatComplexMatrix& a) - { - MArray<FloatComplex>::operator = (a); - return *this; - } + { + MArray<FloatComplex>::operator = (a); + return *this; + } bool operator == (const FloatComplexMatrix& a) const; bool operator != (const FloatComplexMatrix& a) const; @@ -102,20 +102,31 @@ // destructive insert/delete/reorder operations - FloatComplexMatrix& insert (const FloatMatrix& a, octave_idx_type r, octave_idx_type c); - FloatComplexMatrix& insert (const FloatRowVector& a, octave_idx_type r, octave_idx_type c); - FloatComplexMatrix& insert (const FloatColumnVector& a, octave_idx_type r, octave_idx_type c); - FloatComplexMatrix& insert (const FloatDiagMatrix& a, octave_idx_type r, octave_idx_type c); + FloatComplexMatrix& insert (const FloatMatrix& a, + octave_idx_type r, octave_idx_type c); + FloatComplexMatrix& insert (const FloatRowVector& a, + octave_idx_type r, octave_idx_type c); + FloatComplexMatrix& insert (const FloatColumnVector& a, + octave_idx_type r, octave_idx_type c); + FloatComplexMatrix& insert (const FloatDiagMatrix& a, + octave_idx_type r, octave_idx_type c); - FloatComplexMatrix& insert (const FloatComplexMatrix& a, octave_idx_type r, octave_idx_type c); - FloatComplexMatrix& insert (const FloatComplexRowVector& a, octave_idx_type r, octave_idx_type c); - FloatComplexMatrix& insert (const FloatComplexColumnVector& a, octave_idx_type r, octave_idx_type c); - FloatComplexMatrix& insert (const FloatComplexDiagMatrix& a, octave_idx_type r, octave_idx_type c); + FloatComplexMatrix& insert (const FloatComplexMatrix& a, + octave_idx_type r, octave_idx_type c); + FloatComplexMatrix& insert (const FloatComplexRowVector& a, + octave_idx_type r, octave_idx_type c); + FloatComplexMatrix& insert (const FloatComplexColumnVector& a, + octave_idx_type r, octave_idx_type c); + FloatComplexMatrix& insert (const FloatComplexDiagMatrix& a, + octave_idx_type r, octave_idx_type c); FloatComplexMatrix& fill (float val); FloatComplexMatrix& fill (const FloatComplex& val); - FloatComplexMatrix& fill (float val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); - FloatComplexMatrix& fill (const FloatComplex& val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); + FloatComplexMatrix& fill (float val, octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2); + FloatComplexMatrix& fill (const FloatComplex& val, + octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2); FloatComplexMatrix append (const FloatMatrix& a) const; FloatComplexMatrix append (const FloatRowVector& a) const; @@ -138,17 +149,19 @@ FloatComplexMatrix stack (const FloatComplexDiagMatrix& a) const; FloatComplexMatrix hermitian (void) const - { return MArray<FloatComplex>::hermitian (std::conj); } + { return MArray<FloatComplex>::hermitian (std::conj); } FloatComplexMatrix transpose (void) const - { return MArray<FloatComplex>::transpose (); } + { return MArray<FloatComplex>::transpose (); } friend OCTAVE_API FloatComplexMatrix conj (const FloatComplexMatrix& a); // resize is the destructive equivalent for this one - FloatComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; + FloatComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const; - FloatComplexMatrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const; + FloatComplexMatrix extract_n (octave_idx_type r1, octave_idx_type c1, + octave_idx_type nr, octave_idx_type nc) const; // extract row or column i. @@ -164,22 +177,22 @@ private: FloatComplexMatrix tinverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const; + float& rcon, int force, int calc_cond) const; FloatComplexMatrix finverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force, int calc_cond) const; + float& rcon, int force, int calc_cond) const; public: FloatComplexMatrix inverse (void) const; FloatComplexMatrix inverse (octave_idx_type& info) const; - FloatComplexMatrix inverse (octave_idx_type& info, float& rcon, int force = 0, - int calc_cond = 1) const; + FloatComplexMatrix inverse (octave_idx_type& info, float& rcon, + int force = 0, int calc_cond = 1) const; FloatComplexMatrix inverse (MatrixType &mattype) const; FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info) const; FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force = 0, - int calc_cond = 1) const; + float& rcon, int force = 0, + int calc_cond = 1) const; FloatComplexMatrix pseudo_inverse (float tol = 0.0) const; @@ -191,7 +204,8 @@ FloatComplexDET determinant (void) const; FloatComplexDET determinant (octave_idx_type& info) const; - FloatComplexDET determinant (octave_idx_type& info, float& rcon, int calc_cond = 1) const; + FloatComplexDET determinant (octave_idx_type& info, float& rcon, + int calc_cond = 1) const; FloatComplexDET determinant (MatrixType &mattype, octave_idx_type& info, float& rcon, int calc_cond = 1) const; @@ -201,129 +215,151 @@ private: // Upper triangular matrix solvers FloatComplexMatrix utsolve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + bool calc_cond = false, + blas_trans_type transt = blas_no_trans) const; // Lower triangular matrix solvers FloatComplexMatrix ltsolve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + bool calc_cond = false, + blas_trans_type transt = blas_no_trans) const; // Full matrix solvers (umfpack/cholesky) FloatComplexMatrix fsolve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - bool calc_cond = false) const; + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + bool calc_cond = false) const; public: // Generic interface to solver with no probing of type FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b) const; FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, - octave_idx_type& info) const; + octave_idx_type& info) const; + FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, + octave_idx_type& info, float& rcon) const; FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, - octave_idx_type& info, float& rcon) const; - FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, - bool singular_fallback = true, - blas_trans_type transt = blas_no_trans) const; + octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + bool singular_fallback = true, + blas_trans_type transt = blas_no_trans) const; FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b) const; FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info) const; + octave_idx_type& info) const; FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon) const; + octave_idx_type& info, float& rcon) const; FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - bool singular_fallback = true, - blas_trans_type transt = blas_no_trans) const; - - FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, - octave_idx_type& info) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, - octave_idx_type& info, float& rcon) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - blas_trans_type transt = blas_no_trans) const; + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + bool singular_fallback = true, + blas_trans_type transt = blas_no_trans) const; FloatComplexColumnVector solve (MatrixType &typ, - const FloatComplexColumnVector& b) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info, float& rcon) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - blas_trans_type transt = blas_no_trans) const; + const FloatColumnVector& b) const; + FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, + octave_idx_type& info) const; + FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, + octave_idx_type& info, float& rcon) const; + FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt = blas_no_trans) const; + + FloatComplexColumnVector solve (MatrixType &typ, + const FloatComplexColumnVector& b) const; + FloatComplexColumnVector solve (MatrixType &typ, + const FloatComplexColumnVector& b, + octave_idx_type& info) const; + FloatComplexColumnVector solve (MatrixType &typ, + const FloatComplexColumnVector& b, + octave_idx_type& info, float& rcon) const; + FloatComplexColumnVector solve (MatrixType &typ, + const FloatComplexColumnVector& b, + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt = blas_no_trans) const; // Generic interface to solver with probing of type FloatComplexMatrix solve (const FloatMatrix& b) const; FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info) const; - FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rcon) const; - FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - blas_trans_type transt = blas_no_trans) const; + FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, + float& rcon) const; + FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, + float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt = blas_no_trans) const; FloatComplexMatrix solve (const FloatComplexMatrix& b) const; - FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info) const; - FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon) const; - FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - blas_trans_type transt = blas_no_trans) const; + FloatComplexMatrix solve (const FloatComplexMatrix& b, + octave_idx_type& info) const; + FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, + float& rcon) const; + FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, + float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt = blas_no_trans) const; FloatComplexColumnVector solve (const FloatColumnVector& b) const; - FloatComplexColumnVector solve (const FloatColumnVector& b, octave_idx_type& info) const; - FloatComplexColumnVector solve (const FloatColumnVector& b, octave_idx_type& info, - float& rcon) const; - FloatComplexColumnVector solve (const FloatColumnVector& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - blas_trans_type transt = blas_no_trans) const; + FloatComplexColumnVector solve (const FloatColumnVector& b, + octave_idx_type& info) const; + FloatComplexColumnVector solve (const FloatColumnVector& b, + octave_idx_type& info, + float& rcon) const; + FloatComplexColumnVector solve (const FloatColumnVector& b, + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt = blas_no_trans) const; FloatComplexColumnVector solve (const FloatComplexColumnVector& b) const; - FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info) const; - FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info, - float& rcon) const; - FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info, - float& rcon, - solve_singularity_handler sing_handler, - blas_trans_type transt = blas_no_trans) const; + FloatComplexColumnVector solve (const FloatComplexColumnVector& b, + octave_idx_type& info) const; + FloatComplexColumnVector solve (const FloatComplexColumnVector& b, + octave_idx_type& info, + float& rcon) const; + FloatComplexColumnVector solve (const FloatComplexColumnVector& b, + octave_idx_type& info, + float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt = blas_no_trans) const; FloatComplexMatrix lssolve (const FloatMatrix& b) const; - FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info) const; + FloatComplexMatrix lssolve (const FloatMatrix& b, + octave_idx_type& info) const; FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, - octave_idx_type& rank) const; + octave_idx_type& rank) const; FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, - octave_idx_type& rank, float& rcon) const; + octave_idx_type& rank, float& rcon) const; FloatComplexMatrix lssolve (const FloatComplexMatrix& b) const; - FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& info) const; - FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& info, - octave_idx_type& rank) const; - FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& info, - octave_idx_type& rank, float& rcon) const; + FloatComplexMatrix lssolve (const FloatComplexMatrix& b, + octave_idx_type& info) const; + FloatComplexMatrix lssolve (const FloatComplexMatrix& b, + octave_idx_type& info, octave_idx_type& rank) const; + FloatComplexMatrix lssolve (const FloatComplexMatrix& b, + octave_idx_type& info, octave_idx_type& rank, float& rcon) const; FloatComplexColumnVector lssolve (const FloatColumnVector& b) const; FloatComplexColumnVector lssolve (const FloatColumnVector& b, - octave_idx_type& info) const; - FloatComplexColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& info, - octave_idx_type& rank) const; - FloatComplexColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& info, - octave_idx_type& rank, float& rcon) const; + octave_idx_type& info) const; + FloatComplexColumnVector lssolve (const FloatColumnVector& b, + octave_idx_type& info, + octave_idx_type& rank) const; + FloatComplexColumnVector lssolve (const FloatColumnVector& b, + octave_idx_type& info, + octave_idx_type& rank, float& rcon) const; FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b) const; FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, - octave_idx_type& info) const; + octave_idx_type& info) const; FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, - octave_idx_type& info, - octave_idx_type& rank) const; + octave_idx_type& info, + octave_idx_type& rank) const; FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, - octave_idx_type& info, - octave_idx_type& rank, float& rcon) const; + octave_idx_type& info, + octave_idx_type& rank, float& rcon) const; // matrix by diagonal matrix -> matrix operations @@ -381,8 +417,10 @@ // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatComplexMatrix& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatComplexMatrix& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const FloatComplexMatrix& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + FloatComplexMatrix& a); }; extern OCTAVE_API FloatComplexMatrix conj (const FloatComplexMatrix& a); @@ -402,28 +440,39 @@ Givens (const FloatComplex&, const FloatComplex&); extern OCTAVE_API FloatComplexMatrix -Sylvester (const FloatComplexMatrix&, const FloatComplexMatrix&, const FloatComplexMatrix&); +Sylvester (const FloatComplexMatrix&, const FloatComplexMatrix&, + const FloatComplexMatrix&); extern OCTAVE_API FloatComplexMatrix xgemm (const FloatComplexMatrix& a, const FloatComplexMatrix& b, blas_trans_type transa = blas_no_trans, blas_trans_type transb = blas_no_trans); -extern OCTAVE_API FloatComplexMatrix operator * (const FloatMatrix&, const FloatComplexMatrix&); -extern OCTAVE_API FloatComplexMatrix operator * (const FloatComplexMatrix&, const FloatMatrix&); -extern OCTAVE_API FloatComplexMatrix operator * (const FloatComplexMatrix&, const FloatComplexMatrix&); - -extern OCTAVE_API FloatComplexMatrix min (const FloatComplex& c, const FloatComplexMatrix& m); -extern OCTAVE_API FloatComplexMatrix min (const FloatComplexMatrix& m, const FloatComplex& c); -extern OCTAVE_API FloatComplexMatrix min (const FloatComplexMatrix& a, const FloatComplexMatrix& b); +extern OCTAVE_API FloatComplexMatrix operator * (const FloatMatrix&, + const FloatComplexMatrix&); +extern OCTAVE_API FloatComplexMatrix operator * (const FloatComplexMatrix&, + const FloatMatrix&); +extern OCTAVE_API FloatComplexMatrix operator * (const FloatComplexMatrix&, + const FloatComplexMatrix&); -extern OCTAVE_API FloatComplexMatrix max (const FloatComplex& c, const FloatComplexMatrix& m); -extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& m, const FloatComplex& c); -extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& a, const FloatComplexMatrix& b); +extern OCTAVE_API FloatComplexMatrix min (const FloatComplex& c, + const FloatComplexMatrix& m); +extern OCTAVE_API FloatComplexMatrix min (const FloatComplexMatrix& m, + const FloatComplex& c); +extern OCTAVE_API FloatComplexMatrix min (const FloatComplexMatrix& a, + const FloatComplexMatrix& b); -extern OCTAVE_API FloatComplexMatrix linspace (const FloatComplexColumnVector& x1, - const FloatComplexColumnVector& x2, - octave_idx_type n); +extern OCTAVE_API FloatComplexMatrix max (const FloatComplex& c, + const FloatComplexMatrix& m); +extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& m, + const FloatComplex& c); +extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& a, + const FloatComplexMatrix& b); + +extern OCTAVE_API FloatComplexMatrix +linspace (const FloatComplexColumnVector& x1, + const FloatComplexColumnVector& x2, + octave_idx_type n); MS_CMP_OP_DECLS (FloatComplexMatrix, FloatComplex, OCTAVE_API) MS_BOOL_OP_DECLS (FloatComplexMatrix, FloatComplex, OCTAVE_API)
--- a/liboctave/array/fCNDArray.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fCNDArray.cc Sat Oct 26 18:57:05 2013 -0700 @@ -111,7 +111,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) octave_fftw::ifft (in + k * stride * n, out + k * stride * n, - n, howmany, stride, dist); + n, howmany, stride, dist); return retval; } @@ -290,7 +290,7 @@ for (octave_idx_type i = 0; i < npts; i++) retval((i + k*npts)*stride + j*dist) = tmp[i] / - static_cast<float> (npts); + static_cast<float> (npts); } } @@ -383,8 +383,8 @@ F77_FUNC (cfftb, CFFTB) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval((l + k*npts)*stride + j*dist) = prow[l] / - static_cast<float> (npts); + retval((l + k*npts)*stride + j*dist) = + prow[l] / static_cast<float> (npts); } } @@ -478,8 +478,8 @@ F77_FUNC (cfftb, CFFTB) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval((l + k*npts)*stride + j*dist) = prow[l] / - static_cast<float> (npts); + retval((l + k*npts)*stride + j*dist) = + prow[l] / static_cast<float> (npts); } } @@ -502,7 +502,7 @@ return do_mx_unary_op<bool, FloatComplex> (*this, mx_inline_not); } -// FIXME -- this is not quite the right thing. +// FIXME: this is not quite the right thing. bool FloatComplexNDArray::any_element_is_nan (void) const @@ -599,13 +599,15 @@ FloatComplexNDArray FloatComplexNDArray::cumprod (int dim) const { - return do_mx_cum_op<FloatComplex, FloatComplex> (*this, dim, mx_inline_cumprod); + return do_mx_cum_op<FloatComplex, FloatComplex> (*this, dim, + mx_inline_cumprod); } FloatComplexNDArray FloatComplexNDArray::cumsum (int dim) const { - return do_mx_cum_op<FloatComplex, FloatComplex> (*this, dim, mx_inline_cumsum); + return do_mx_cum_op<FloatComplex, FloatComplex> (*this, dim, + mx_inline_cumsum); } FloatComplexNDArray @@ -639,7 +641,8 @@ } FloatComplexNDArray -FloatComplexNDArray::concat (const FloatComplexNDArray& rb, const Array<octave_idx_type>& ra_idx) +FloatComplexNDArray::concat (const FloatComplexNDArray& rb, + const Array<octave_idx_type>& ra_idx) { if (rb.numel () > 0) insert (rb, ra_idx); @@ -647,7 +650,8 @@ } FloatComplexNDArray -FloatComplexNDArray::concat (const FloatNDArray& rb, const Array<octave_idx_type>& ra_idx) +FloatComplexNDArray::concat (const FloatNDArray& rb, + const Array<octave_idx_type>& ra_idx) { FloatComplexNDArray tmp (rb); if (rb.numel () > 0) @@ -656,7 +660,8 @@ } FloatComplexNDArray -concat (NDArray& ra, FloatComplexNDArray& rb, const Array<octave_idx_type>& ra_idx) +concat (NDArray& ra, FloatComplexNDArray& rb, + const Array<octave_idx_type>& ra_idx) { FloatComplexNDArray retval (ra); if (rb.numel () > 0) @@ -664,7 +669,8 @@ return retval; } -static const FloatComplex FloatComplex_NaN_result (octave_Float_NaN, octave_Float_NaN); +static const FloatComplex FloatComplex_NaN_result (octave_Float_NaN, + octave_Float_NaN); FloatComplexNDArray FloatComplexNDArray::max (int dim) const @@ -699,7 +705,8 @@ FloatComplexNDArray FloatComplexNDArray::cummax (Array<octave_idx_type>& idx_arg, int dim) const { - return do_mx_cumminmax_op<FloatComplex> (*this, idx_arg, dim, mx_inline_cummax); + return do_mx_cumminmax_op<FloatComplex> (*this, idx_arg, dim, + mx_inline_cummax); } FloatComplexNDArray @@ -711,7 +718,8 @@ FloatComplexNDArray FloatComplexNDArray::cummin (Array<octave_idx_type>& idx_arg, int dim) const { - return do_mx_cumminmax_op<FloatComplex> (*this, idx_arg, dim, mx_inline_cummin); + return do_mx_cumminmax_op<FloatComplex> (*this, idx_arg, dim, + mx_inline_cummin); } FloatNDArray @@ -745,7 +753,8 @@ } FloatComplexNDArray& -FloatComplexNDArray::insert (const NDArray& a, octave_idx_type r, octave_idx_type c) +FloatComplexNDArray::insert (const NDArray& a, + octave_idx_type r, octave_idx_type c) { dim_vector a_dv = a.dims (); @@ -795,14 +804,16 @@ } FloatComplexNDArray& -FloatComplexNDArray::insert (const FloatComplexNDArray& a, octave_idx_type r, octave_idx_type c) +FloatComplexNDArray::insert (const FloatComplexNDArray& a, + octave_idx_type r, octave_idx_type c) { Array<FloatComplex>::insert (a, r, c); return *this; } FloatComplexNDArray& -FloatComplexNDArray::insert (const FloatComplexNDArray& a, const Array<octave_idx_type>& ra_idx) +FloatComplexNDArray::insert (const FloatComplexNDArray& a, + const Array<octave_idx_type>& ra_idx) { Array<FloatComplex>::insert (a, ra_idx); return *this; @@ -814,7 +825,7 @@ FloatComplexMatrix retval; if (ndims () == 2) - retval = FloatComplexMatrix (Array<FloatComplex> (*this)); + retval = FloatComplexMatrix (Array<FloatComplex> (*this)); else (*current_liboctave_error_handler) ("invalid conversion of FloatComplexNDArray to FloatComplexMatrix"); @@ -824,15 +835,15 @@ void FloatComplexNDArray::increment_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions, - int start_dimension) + const dim_vector& dimensions, + int start_dimension) { ::increment_index (ra_idx, dimensions, start_dimension); } octave_idx_type FloatComplexNDArray::compute_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions) + const dim_vector& dimensions) { return ::compute_index (ra_idx, dimensions); } @@ -873,16 +884,16 @@ { FloatComplex tmp; for (octave_idx_type i = 0; i < nel; i++) - { - tmp = octave_read_value<FloatComplex> (is); - if (is) - a.elem (i) = tmp; - else - goto done; - } + { + tmp = octave_read_value<FloatComplex> (is); + if (is) + a.elem (i) = tmp; + else + goto done; + } } - done: +done: return is; }
--- a/liboctave/array/fCNDArray.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fCNDArray.h Sat Oct 26 18:57:05 2013 -0700 @@ -45,9 +45,11 @@ FloatComplexNDArray (const dim_vector& dv, const FloatComplex& val) : MArray<FloatComplex> (dv, val) { } - FloatComplexNDArray (const FloatComplexNDArray& a) : MArray<FloatComplex> (a) { } + FloatComplexNDArray (const FloatComplexNDArray& a) + : MArray<FloatComplex> (a) { } - FloatComplexNDArray (const FloatComplexMatrix& a) : MArray<FloatComplex> (a) { } + FloatComplexNDArray (const FloatComplexMatrix& a) + : MArray<FloatComplex> (a) { } template <class U> FloatComplexNDArray (const MArray<U>& a) : MArray<FloatComplex> (a) { } @@ -58,16 +60,16 @@ FloatComplexNDArray (const charNDArray&); FloatComplexNDArray& operator = (const FloatComplexNDArray& a) - { - MArray<FloatComplex>::operator = (a); - return *this; - } + { + MArray<FloatComplex>::operator = (a); + return *this; + } // unary operations boolNDArray operator ! (void) const; - // FIXME -- this is not quite the right thing. + // FIXME: this is not quite the right thing. bool any_element_is_nan (void) const; bool any_element_is_inf_or_nan (void) const; @@ -82,10 +84,12 @@ FloatComplexNDArray cumsum (int dim = -1) const; FloatComplexNDArray prod (int dim = -1) const; FloatComplexNDArray sum (int dim = -1) const; - ComplexNDArray dsum (int dim = -1) const; + ComplexNDArray dsum (int dim = -1) const; FloatComplexNDArray sumsq (int dim = -1) const; - FloatComplexNDArray concat (const FloatComplexNDArray& rb, const Array<octave_idx_type>& ra_idx); - FloatComplexNDArray concat (const FloatNDArray& rb, const Array<octave_idx_type>& ra_idx); + FloatComplexNDArray concat (const FloatComplexNDArray& rb, + const Array<octave_idx_type>& ra_idx); + FloatComplexNDArray concat (const FloatNDArray& rb, + const Array<octave_idx_type>& ra_idx); FloatComplexNDArray max (int dim = -1) const; FloatComplexNDArray max (Array<octave_idx_type>& index, int dim = -1) const; @@ -93,15 +97,20 @@ FloatComplexNDArray min (Array<octave_idx_type>& index, int dim = -1) const; FloatComplexNDArray cummax (int dim = -1) const; - FloatComplexNDArray cummax (Array<octave_idx_type>& index, int dim = -1) const; + FloatComplexNDArray cummax (Array<octave_idx_type>& index, + int dim = -1) const; FloatComplexNDArray cummin (int dim = -1) const; - FloatComplexNDArray cummin (Array<octave_idx_type>& index, int dim = -1) const; + FloatComplexNDArray cummin (Array<octave_idx_type>& index, + int dim = -1) const; FloatComplexNDArray diff (octave_idx_type order = 1, int dim = -1) const; - FloatComplexNDArray& insert (const NDArray& a, octave_idx_type r, octave_idx_type c); - FloatComplexNDArray& insert (const FloatComplexNDArray& a, octave_idx_type r, octave_idx_type c); - FloatComplexNDArray& insert (const FloatComplexNDArray& a, const Array<octave_idx_type>& ra_idx); + FloatComplexNDArray& insert (const NDArray& a, + octave_idx_type r, octave_idx_type c); + FloatComplexNDArray& insert (const FloatComplexNDArray& a, + octave_idx_type r, octave_idx_type c); + FloatComplexNDArray& insert (const FloatComplexNDArray& a, + const Array<octave_idx_type>& ra_idx); FloatNDArray abs (void) const; boolNDArray isnan (void) const; @@ -121,19 +130,22 @@ FloatComplexMatrix matrix_value (void) const; - FloatComplexNDArray squeeze (void) const { return MArray<FloatComplex>::squeeze (); } + FloatComplexNDArray squeeze (void) const + { return MArray<FloatComplex>::squeeze (); } static void increment_index (Array<octave_idx_type>& ra_idx, const dim_vector& dimensions, int start_dimension = 0); static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions); + const dim_vector& dimensions); // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatComplexNDArray& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatComplexNDArray& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const FloatComplexNDArray& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + FloatComplexNDArray& a); // bool all_elements_are_real (void) const; // bool all_integers (float& max_val, float& min_val) const; @@ -143,10 +155,10 @@ FloatComplexNDArray diag (octave_idx_type m, octave_idx_type n) const; FloatComplexNDArray& changesign (void) - { - MArray<FloatComplex>::changesign (); - return *this; - } + { + MArray<FloatComplex>::changesign (); + return *this; + } }; @@ -165,8 +177,10 @@ MARRAY_FORWARD_DEFS (MArray, FloatComplexNDArray, FloatComplex) -extern OCTAVE_API FloatComplexNDArray& operator *= (FloatComplexNDArray& a, float s); -extern OCTAVE_API FloatComplexNDArray& operator /= (FloatComplexNDArray& a, float s); +extern OCTAVE_API FloatComplexNDArray& operator *= (FloatComplexNDArray& a, + float s); +extern OCTAVE_API FloatComplexNDArray& operator /= (FloatComplexNDArray& a, + float s); BSXFUN_STDOP_DECLS (FloatComplexNDArray, OCTAVE_API) BSXFUN_STDREL_DECLS (FloatComplexNDArray, OCTAVE_API)
--- a/liboctave/array/fCRowVector.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fCRowVector.cc Sat Oct 26 18:57:05 2013 -0700 @@ -96,7 +96,8 @@ } FloatComplexRowVector& -FloatComplexRowVector::insert (const FloatComplexRowVector& a, octave_idx_type c) +FloatComplexRowVector::insert (const FloatComplexRowVector& a, + octave_idx_type c) { octave_idx_type a_len = a.length (); @@ -174,7 +175,8 @@ } FloatComplexRowVector& -FloatComplexRowVector::fill (const FloatComplex& val, octave_idx_type c1, octave_idx_type c2) +FloatComplexRowVector::fill (const FloatComplex& val, + octave_idx_type c1, octave_idx_type c2) { octave_idx_type len = length (); @@ -283,7 +285,7 @@ if (len == 0) return *this; - FloatComplex *d = fortran_vec (); // Ensures only one reference to my privates! + FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates! mx_inline_add2 (len, d, a.data ()); return *this; @@ -305,7 +307,7 @@ if (len == 0) return *this; - FloatComplex *d = fortran_vec (); // Ensures only one reference to my privates! + FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates! mx_inline_sub2 (len, d, a.data ()); return *this;
--- a/liboctave/array/fCRowVector.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fCRowVector.h Sat Oct 26 18:57:05 2013 -0700 @@ -32,7 +32,7 @@ OCTAVE_API FloatComplexRowVector : public MArray<FloatComplex> { -friend class FloatComplexColumnVector; + friend class FloatComplexColumnVector; public: @@ -61,10 +61,10 @@ : MArray<FloatComplex> (a) { } FloatComplexRowVector& operator = (const FloatComplexRowVector& a) - { - MArray<FloatComplex>::operator = (a); - return *this; - } + { + MArray<FloatComplex>::operator = (a); + return *this; + } bool operator == (const FloatComplexRowVector& a) const; bool operator != (const FloatComplexRowVector& a) const; @@ -72,12 +72,15 @@ // destructive insert/delete/reorder operations FloatComplexRowVector& insert (const FloatRowVector& a, octave_idx_type c); - FloatComplexRowVector& insert (const FloatComplexRowVector& a, octave_idx_type c); + FloatComplexRowVector& insert (const FloatComplexRowVector& a, + octave_idx_type c); FloatComplexRowVector& fill (float val); FloatComplexRowVector& fill (const FloatComplex& val); - FloatComplexRowVector& fill (float val, octave_idx_type c1, octave_idx_type c2); - FloatComplexRowVector& fill (const FloatComplex& val, octave_idx_type c1, octave_idx_type c2); + FloatComplexRowVector& fill (float val, + octave_idx_type c1, octave_idx_type c2); + FloatComplexRowVector& fill (const FloatComplex& val, + octave_idx_type c1, octave_idx_type c2); FloatComplexRowVector append (const FloatRowVector& a) const; FloatComplexRowVector append (const FloatComplexRowVector& a) const; @@ -101,10 +104,10 @@ // row vector by matrix -> row vector friend FloatComplexRowVector operator * (const FloatComplexRowVector& a, - const FloatComplexMatrix& b); + const FloatComplexMatrix& b); friend FloatComplexRowVector operator * (const FloatRowVector& a, - const FloatComplexMatrix& b); + const FloatComplexMatrix& b); // other operations @@ -113,8 +116,10 @@ // i/o - friend std::ostream& operator << (std::ostream& os, const FloatComplexRowVector& a); - friend std::istream& operator >> (std::istream& is, FloatComplexRowVector& a); + friend std::ostream& operator << (std::ostream& os, + const FloatComplexRowVector& a); + friend std::istream& operator >> (std::istream& is, + FloatComplexRowVector& a); void resize (octave_idx_type n, const FloatComplex& rfv = FloatComplex (0)) { @@ -122,19 +127,22 @@ } void clear (octave_idx_type n) - { Array<FloatComplex>::clear (1, n); } + { Array<FloatComplex>::clear (1, n); } }; // row vector by column vector -> scalar -FloatComplex OCTAVE_API operator * (const FloatComplexRowVector& a, const ColumnVector& b); +FloatComplex OCTAVE_API operator * (const FloatComplexRowVector& a, + const ColumnVector& b); -FloatComplex OCTAVE_API operator * (const FloatComplexRowVector& a, const FloatComplexColumnVector& b); +FloatComplex OCTAVE_API operator * (const FloatComplexRowVector& a, + const FloatComplexColumnVector& b); // other operations -OCTAVE_API FloatComplexRowVector linspace (const FloatComplex& x1, const FloatComplex& x2, octave_idx_type n); +OCTAVE_API FloatComplexRowVector linspace (const FloatComplex& x1, + const FloatComplex& x2, octave_idx_type n); MARRAY_FORWARD_DEFS (MArray, FloatComplexRowVector, FloatComplex)
--- a/liboctave/array/fColVector.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fColVector.h Sat Oct 26 18:57:05 2013 -0700 @@ -54,10 +54,10 @@ : MArray<float> (a.as_column ()) { } FloatColumnVector& operator = (const FloatColumnVector& a) - { - MArray<float>::operator = (a); - return *this; - } + { + MArray<float>::operator = (a); + return *this; + } bool operator == (const FloatColumnVector& a) const; bool operator != (const FloatColumnVector& a) const; @@ -84,11 +84,13 @@ // matrix by column vector -> column vector operations - friend OCTAVE_API FloatColumnVector operator * (const FloatMatrix& a, const FloatColumnVector& b); + friend OCTAVE_API FloatColumnVector operator * (const FloatMatrix& a, + const FloatColumnVector& b); // diagonal matrix by column vector -> column vector operations - friend OCTAVE_API FloatColumnVector operator * (const FloatDiagMatrix& a, const FloatColumnVector& b); + friend OCTAVE_API FloatColumnVector operator * (const FloatDiagMatrix& a, + const FloatColumnVector& b); // other operations @@ -99,8 +101,10 @@ // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatColumnVector& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatColumnVector& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const FloatColumnVector& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + FloatColumnVector& a); void resize (octave_idx_type n, const float& rfv = 0) { @@ -108,7 +112,7 @@ } void clear (octave_idx_type n) - { Array<float>::clear (n, 1); } + { Array<float>::clear (n, 1); } };
--- a/liboctave/array/fDiagMatrix.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fDiagMatrix.cc Sat Oct 26 18:57:05 2013 -0700 @@ -157,7 +157,8 @@ } FloatMatrix -FloatDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const +FloatDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const { if (r1 > r2) { std::swap (r1, r2); } if (c1 > c2) { std::swap (c1, c2); }
--- a/liboctave/array/fDiagMatrix.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fDiagMatrix.h Sat Oct 26 18:57:05 2013 -0700 @@ -35,16 +35,18 @@ OCTAVE_API FloatDiagMatrix : public MDiagArray2<float> { -friend class FloatSVD; -friend class FloatComplexSVD; + friend class FloatSVD; + friend class FloatComplexSVD; public: FloatDiagMatrix (void) : MDiagArray2<float> () { } - FloatDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<float> (r, c) { } + FloatDiagMatrix (octave_idx_type r, octave_idx_type c) + : MDiagArray2<float> (r, c) { } - FloatDiagMatrix (octave_idx_type r, octave_idx_type c, float val) : MDiagArray2<float> (r, c, val) { } + FloatDiagMatrix (octave_idx_type r, octave_idx_type c, float val) + : MDiagArray2<float> (r, c, val) { } FloatDiagMatrix (const FloatDiagMatrix& a) : MDiagArray2<float> (a) { } @@ -59,10 +61,10 @@ : MDiagArray2<float> (a, r, c) { } FloatDiagMatrix& operator = (const FloatDiagMatrix& a) - { - MDiagArray2<float>::operator = (a); - return *this; - } + { + MDiagArray2<float>::operator = (a); + return *this; + } bool operator == (const FloatDiagMatrix& a) const; bool operator != (const FloatDiagMatrix& a) const; @@ -74,7 +76,9 @@ FloatDiagMatrix& fill (const FloatColumnVector& a, octave_idx_type beg); FloatDiagMatrix& fill (const FloatRowVector& a, octave_idx_type beg); - FloatDiagMatrix transpose (void) const { return MDiagArray2<float>::transpose (); } + FloatDiagMatrix transpose (void) const + { return MDiagArray2<float>::transpose (); } + FloatDiagMatrix abs (void) const; friend OCTAVE_API FloatDiagMatrix real (const FloatComplexDiagMatrix& a); @@ -82,7 +86,8 @@ // resize is the destructive analog for this one - FloatMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; + FloatMatrix extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const; // extract row or column i. @@ -99,14 +104,15 @@ // other operations FloatColumnVector extract_diag (octave_idx_type k = 0) const - { return MDiagArray2<float>::extract_diag (k); } + { return MDiagArray2<float>::extract_diag (k); } FloatDET determinant (void) const; float rcond (void) const; // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatDiagMatrix& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const FloatDiagMatrix& a); }; @@ -115,8 +121,8 @@ // diagonal matrix by diagonal matrix -> diagonal matrix operations -OCTAVE_API FloatDiagMatrix -operator * (const FloatDiagMatrix& a, const FloatDiagMatrix& b); +OCTAVE_API FloatDiagMatrix operator * (const FloatDiagMatrix& a, + const FloatDiagMatrix& b); MDIAGARRAY2_FORWARD_DEFS (MDiagArray2, FloatDiagMatrix, float)
--- a/liboctave/array/fMatrix.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fMatrix.cc Sat Oct 26 18:57:05 2013 -0700 @@ -269,8 +269,7 @@ elem (i, ia(i)) = 1.0; } -// FIXME -- could we use a templated mixed-type copy function -// here? +// FIXME: could we use a templated mixed-type copy function here? FloatMatrix::FloatMatrix (const boolMatrix& a) : MArray<float> (a) @@ -317,14 +316,16 @@ } FloatMatrix& -FloatMatrix::insert (const FloatMatrix& a, octave_idx_type r, octave_idx_type c) +FloatMatrix::insert (const FloatMatrix& a, + octave_idx_type r, octave_idx_type c) { Array<float>::insert (a, r, c); return *this; } FloatMatrix& -FloatMatrix::insert (const FloatRowVector& a, octave_idx_type r, octave_idx_type c) +FloatMatrix::insert (const FloatRowVector& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_len = a.length (); @@ -346,7 +347,8 @@ } FloatMatrix& -FloatMatrix::insert (const FloatColumnVector& a, octave_idx_type r, octave_idx_type c) +FloatMatrix::insert (const FloatColumnVector& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_len = a.length (); @@ -368,7 +370,8 @@ } FloatMatrix& -FloatMatrix::insert (const FloatDiagMatrix& a, octave_idx_type r, octave_idx_type c) +FloatMatrix::insert (const FloatDiagMatrix& a, + octave_idx_type r, octave_idx_type c) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols (); @@ -413,7 +416,8 @@ } FloatMatrix& -FloatMatrix::fill (float val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) +FloatMatrix::fill (float val, octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) { octave_idx_type nr = rows (); octave_idx_type nc = cols (); @@ -601,7 +605,8 @@ } FloatMatrix -FloatMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const +FloatMatrix::extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const { if (r1 > r2) { std::swap (r1, r2); } if (c1 > c2) { std::swap (c1, c2); } @@ -610,7 +615,8 @@ } FloatMatrix -FloatMatrix::extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const +FloatMatrix::extract_n (octave_idx_type r1, octave_idx_type c1, + octave_idx_type nr, octave_idx_type nc) const { return index (idx_vector (r1, r1 + nr), idx_vector (c1, c1 + nc)); } @@ -648,7 +654,7 @@ FloatMatrix FloatMatrix::inverse (octave_idx_type& info, float& rcon, int force, - int calc_cond) const + int calc_cond) const { MatrixType mattype (*this); return inverse (mattype, info, rcon, force, calc_cond); @@ -671,7 +677,7 @@ FloatMatrix FloatMatrix::tinverse (MatrixType &mattype, octave_idx_type& info, float& rcon, - int force, int calc_cond) const + int force, int calc_cond) const { FloatMatrix retval; @@ -729,7 +735,7 @@ FloatMatrix FloatMatrix::finverse (MatrixType &mattype, octave_idx_type& info, float& rcon, - int force, int calc_cond) const + int force, int calc_cond) const { FloatMatrix retval; @@ -763,7 +769,8 @@ // Calculate the norm of the matrix, for later use. float anorm = 0; if (calc_cond) - anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)).max (); + anorm = retval.abs ().sum ().row (static_cast<octave_idx_type>(0)) + .max (); F77_XFCN (sgetrf, SGETRF, (nc, nc, tmp_data, nr, pipvt, info)); @@ -810,7 +817,7 @@ FloatMatrix FloatMatrix::inverse (MatrixType &mattype, octave_idx_type& info, float& rcon, - int force, int calc_cond) const + int force, int calc_cond) const { int typ = mattype.type (false); FloatMatrix ret; @@ -983,10 +990,12 @@ F77_FUNC (cffti, CFFTI) (const octave_idx_type&, FloatComplex*); F77_RET_T - F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, FloatComplex*, FloatComplex*); + F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, FloatComplex*, + FloatComplex*); F77_RET_T - F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, FloatComplex*, FloatComplex*); + F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, FloatComplex*, + FloatComplex*); } FloatComplexMatrix @@ -1227,7 +1236,8 @@ } FloatDET -FloatMatrix::determinant (octave_idx_type& info, float& rcon, int calc_cond) const +FloatMatrix::determinant (octave_idx_type& info, float& rcon, + int calc_cond) const { MatrixType mattype (*this); return determinant (mattype, info, rcon, calc_cond); @@ -1235,7 +1245,8 @@ FloatDET FloatMatrix::determinant (MatrixType& mattype, - octave_idx_type& info, float& rcon, int calc_cond) const + octave_idx_type& info, float& rcon, + int calc_cond) const { FloatDET retval (1.0); @@ -1464,7 +1475,7 @@ float *tmp_data = atmp.fortran_vec (); anorm = atmp.abs().sum(). - row(static_cast<octave_idx_type>(0)).max(); + row(static_cast<octave_idx_type>(0)).max(); F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -1505,7 +1516,7 @@ if (anorm < 0.) anorm = atmp.abs ().sum (). - row(static_cast<octave_idx_type>(0)).max (); + row(static_cast<octave_idx_type>(0)).max (); Array<float> z (dim_vector (4 * nc, 1)); float *pz = z.fortran_vec (); @@ -1540,9 +1551,10 @@ } FloatMatrix -FloatMatrix::utsolve (MatrixType &mattype, const FloatMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, - bool calc_cond, blas_trans_type transt) const +FloatMatrix::utsolve (MatrixType &mattype, const FloatMatrix& b, + octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + bool calc_cond, blas_trans_type transt) const { FloatMatrix retval; @@ -1640,9 +1652,10 @@ } FloatMatrix -FloatMatrix::ltsolve (MatrixType &mattype, const FloatMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, - bool calc_cond, blas_trans_type transt) const +FloatMatrix::ltsolve (MatrixType &mattype, const FloatMatrix& b, + octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + bool calc_cond, blas_trans_type transt) const { FloatMatrix retval; @@ -1740,9 +1753,10 @@ } FloatMatrix -FloatMatrix::fsolve (MatrixType &mattype, const FloatMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, - bool calc_cond) const +FloatMatrix::fsolve (MatrixType &mattype, const FloatMatrix& b, + octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + bool calc_cond) const { FloatMatrix retval; @@ -1758,7 +1772,7 @@ { volatile int typ = mattype.type (); - // Calculate the norm of the matrix, for later use. + // Calculate the norm of the matrix, for later use. float anorm = -1.; if (typ == MatrixType::Hermitian) @@ -1846,7 +1860,7 @@ FloatMatrix atmp = *this; float *tmp_data = atmp.fortran_vec (); - if(anorm < 0.) + if (anorm < 0.) anorm = atmp.abs().sum().row(static_cast<octave_idx_type>(0)).max(); Array<float> z (dim_vector (4 * nc, 1)); @@ -1933,23 +1947,25 @@ } FloatMatrix -FloatMatrix::solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info) const +FloatMatrix::solve (MatrixType &typ, const FloatMatrix& b, + octave_idx_type& info) const { float rcon; return solve (typ, b, info, rcon, 0); } FloatMatrix -FloatMatrix::solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, - float& rcon) const +FloatMatrix::solve (MatrixType &typ, const FloatMatrix& b, + octave_idx_type& info, float& rcon) const { return solve (typ, b, info, rcon, 0); } FloatMatrix -FloatMatrix::solve (MatrixType &mattype, const FloatMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, - bool singular_fallback, blas_trans_type transt) const +FloatMatrix::solve (MatrixType &mattype, const FloatMatrix& b, + octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + bool singular_fallback, blas_trans_type transt) const { FloatMatrix retval; int typ = mattype.type (); @@ -1963,7 +1979,8 @@ else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) retval = ltsolve (mattype, b, info, rcon, sing_handler, false, transt); else if (transt == blas_trans || transt == blas_conj_trans) - return transpose ().solve (mattype, b, info, rcon, sing_handler, singular_fallback); + return transpose ().solve (mattype, b, info, rcon, sing_handler, + singular_fallback); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) retval = fsolve (mattype, b, info, rcon, sing_handler, true); else if (typ != MatrixType::Rectangular) @@ -1992,15 +2009,16 @@ FloatComplexMatrix FloatMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info) const + octave_idx_type& info) const { float rcon; return solve (typ, b, info, rcon, 0); } FloatComplexMatrix -FloatMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, octave_idx_type& info, - float& rcon) const +FloatMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, + octave_idx_type& info, + float& rcon) const { return solve (typ, b, info, rcon, 0); } @@ -2033,9 +2051,10 @@ } FloatComplexMatrix -FloatMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, - bool singular_fallback, blas_trans_type transt) const +FloatMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, + octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + bool singular_fallback, blas_trans_type transt) const { FloatMatrix tmp = stack_complex_matrix (b); tmp = solve (typ, tmp, info, rcon, sing_handler, singular_fallback, transt); @@ -2051,22 +2070,25 @@ FloatColumnVector FloatMatrix::solve (MatrixType &typ, const FloatColumnVector& b, - octave_idx_type& info) const + octave_idx_type& info) const { float rcon; return solve (typ, b, info, rcon); } FloatColumnVector -FloatMatrix::solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info, - float& rcon) const +FloatMatrix::solve (MatrixType &typ, const FloatColumnVector& b, + octave_idx_type& info, + float& rcon) const { return solve (typ, b, info, rcon, 0); } FloatColumnVector -FloatMatrix::solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const +FloatMatrix::solve (MatrixType &typ, const FloatColumnVector& b, + octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + blas_trans_type transt) const { FloatMatrix tmp (b); tmp = solve (typ, tmp, info, rcon, sing_handler, true, transt); @@ -2082,7 +2104,7 @@ FloatComplexColumnVector FloatMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info) const + octave_idx_type& info) const { FloatComplexMatrix tmp (*this); return tmp.solve (typ, b, info); @@ -2090,7 +2112,7 @@ FloatComplexColumnVector FloatMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info, float& rcon) const + octave_idx_type& info, float& rcon) const { FloatComplexMatrix tmp (*this); return tmp.solve (typ, b, info, rcon); @@ -2098,8 +2120,9 @@ FloatComplexColumnVector FloatMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt) const { FloatComplexMatrix tmp (*this); return tmp.solve (typ, b, info, rcon, sing_handler, transt); @@ -2121,14 +2144,16 @@ } FloatMatrix -FloatMatrix::solve (const FloatMatrix& b, octave_idx_type& info, float& rcon) const +FloatMatrix::solve (const FloatMatrix& b, octave_idx_type& info, + float& rcon) const { return solve (b, info, rcon, 0); } FloatMatrix FloatMatrix::solve (const FloatMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const + float& rcon, solve_singularity_handler sing_handler, + blas_trans_type transt) const { MatrixType mattype (*this); return solve (mattype, b, info, rcon, sing_handler, true, transt); @@ -2149,15 +2174,18 @@ } FloatComplexMatrix -FloatMatrix::solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon) const +FloatMatrix::solve (const FloatComplexMatrix& b, octave_idx_type& info, + float& rcon) const { FloatComplexMatrix tmp (*this); return tmp.solve (b, info, rcon); } FloatComplexMatrix -FloatMatrix::solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const +FloatMatrix::solve (const FloatComplexMatrix& b, octave_idx_type& info, + float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt) const { FloatComplexMatrix tmp (*this); return tmp.solve (b, info, rcon, sing_handler, transt); @@ -2178,14 +2206,16 @@ } FloatColumnVector -FloatMatrix::solve (const FloatColumnVector& b, octave_idx_type& info, float& rcon) const +FloatMatrix::solve (const FloatColumnVector& b, octave_idx_type& info, + float& rcon) const { return solve (b, info, rcon, 0); } FloatColumnVector -FloatMatrix::solve (const FloatColumnVector& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const +FloatMatrix::solve (const FloatColumnVector& b, octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + blas_trans_type transt) const { MatrixType mattype (*this); return solve (mattype, b, info, rcon, sing_handler, transt); @@ -2199,22 +2229,25 @@ } FloatComplexColumnVector -FloatMatrix::solve (const FloatComplexColumnVector& b, octave_idx_type& info) const +FloatMatrix::solve (const FloatComplexColumnVector& b, + octave_idx_type& info) const { FloatComplexMatrix tmp (*this); return tmp.solve (b, info); } FloatComplexColumnVector -FloatMatrix::solve (const FloatComplexColumnVector& b, octave_idx_type& info, float& rcon) const +FloatMatrix::solve (const FloatComplexColumnVector& b, octave_idx_type& info, + float& rcon) const { FloatComplexMatrix tmp (*this); return tmp.solve (b, info, rcon); } FloatComplexColumnVector -FloatMatrix::solve (const FloatComplexColumnVector& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt) const +FloatMatrix::solve (const FloatComplexColumnVector& b, octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + blas_trans_type transt) const { FloatComplexMatrix tmp (*this); return tmp.solve (b, info, rcon, sing_handler, transt); @@ -2239,7 +2272,7 @@ FloatMatrix FloatMatrix::lssolve (const FloatMatrix& b, octave_idx_type& info, - octave_idx_type& rank) const + octave_idx_type& rank) const { float rcon; return lssolve (b, info, rank, rcon); @@ -2247,7 +2280,7 @@ FloatMatrix FloatMatrix::lssolve (const FloatMatrix& b, octave_idx_type& info, - octave_idx_type& rank, float &rcon) const + octave_idx_type& rank, float &rcon) const { FloatMatrix retval; @@ -2403,7 +2436,7 @@ FloatComplexMatrix FloatMatrix::lssolve (const FloatComplexMatrix& b, octave_idx_type& info, - octave_idx_type& rank) const + octave_idx_type& rank) const { FloatComplexMatrix tmp (*this); float rcon; @@ -2412,7 +2445,7 @@ FloatComplexMatrix FloatMatrix::lssolve (const FloatComplexMatrix& b, octave_idx_type& info, - octave_idx_type& rank, float& rcon) const + octave_idx_type& rank, float& rcon) const { FloatComplexMatrix tmp (*this); return tmp.lssolve (b, info, rank, rcon); @@ -2437,7 +2470,7 @@ FloatColumnVector FloatMatrix::lssolve (const FloatColumnVector& b, octave_idx_type& info, - octave_idx_type& rank) const + octave_idx_type& rank) const { float rcon; return lssolve (b, info, rank, rcon); @@ -2445,7 +2478,7 @@ FloatColumnVector FloatMatrix::lssolve (const FloatColumnVector& b, octave_idx_type& info, - octave_idx_type& rank, float &rcon) const + octave_idx_type& rank, float &rcon) const { FloatColumnVector retval; @@ -2550,7 +2583,8 @@ } FloatComplexColumnVector -FloatMatrix::lssolve (const FloatComplexColumnVector& b, octave_idx_type& info) const +FloatMatrix::lssolve (const FloatComplexColumnVector& b, + octave_idx_type& info) const { FloatComplexMatrix tmp (*this); octave_idx_type rank; @@ -2560,7 +2594,7 @@ FloatComplexColumnVector FloatMatrix::lssolve (const FloatComplexColumnVector& b, octave_idx_type& info, - octave_idx_type& rank) const + octave_idx_type& rank) const { FloatComplexMatrix tmp (*this); float rcon; @@ -2569,7 +2603,7 @@ FloatComplexColumnVector FloatMatrix::lssolve (const FloatComplexColumnVector& b, octave_idx_type& info, - octave_idx_type& rank, float &rcon) const + octave_idx_type& rank, float &rcon) const { FloatComplexMatrix tmp (*this); return tmp.lssolve (b, info, rank, rcon); @@ -2734,8 +2768,7 @@ return false; } -// 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? boolMatrix FloatMatrix::all (int dim) const @@ -3063,7 +3096,7 @@ } } - done: +done: return is; } @@ -3090,8 +3123,7 @@ { FloatMatrix retval; - // FIXME -- need to check that a, b, and c are all the same - // size. + // FIXME: need to check that a, b, and c are all the same size. // Compute Schur decompositions. @@ -3129,7 +3161,7 @@ F77_CHAR_ARG_LEN (1))); - // FIXME -- check info? + // FIXME: check info? retval = -ua*cx*ub.transpose (); @@ -3256,8 +3288,7 @@ return xgemm (a, b); } -// 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) \ @@ -3407,7 +3438,8 @@ octave_idx_type m = x1.length (); if (x2.length () != m) - (*current_liboctave_error_handler) ("linspace: vectors must be of equal length"); + (*current_liboctave_error_handler) + ("linspace: vectors must be of equal length"); NoAlias<FloatMatrix> retval;
--- a/liboctave/array/fMatrix.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fMatrix.h Sat Oct 26 18:57:05 2013 -0700 @@ -77,10 +77,10 @@ FloatMatrix& operator = (const FloatMatrix& a) - { - MArray<float>::operator = (a); - return *this; - } + { + MArray<float>::operator = (a); + return *this; + } bool operator == (const FloatMatrix& a) const; bool operator != (const FloatMatrix& a) const; @@ -89,13 +89,18 @@ // destructive insert/delete/reorder operations - FloatMatrix& insert (const FloatMatrix& a, octave_idx_type r, octave_idx_type c); - FloatMatrix& insert (const FloatRowVector& a, octave_idx_type r, octave_idx_type c); - FloatMatrix& insert (const FloatColumnVector& a, octave_idx_type r, octave_idx_type c); - FloatMatrix& insert (const FloatDiagMatrix& a, octave_idx_type r, octave_idx_type c); + FloatMatrix& insert (const FloatMatrix& a, + octave_idx_type r, octave_idx_type c); + FloatMatrix& insert (const FloatRowVector& a, + octave_idx_type r, octave_idx_type c); + FloatMatrix& insert (const FloatColumnVector& a, + octave_idx_type r, octave_idx_type c); + FloatMatrix& insert (const FloatDiagMatrix& a, + octave_idx_type r, octave_idx_type c); FloatMatrix& fill (float val); - FloatMatrix& fill (float val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); + FloatMatrix& fill (float val, octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2); FloatMatrix append (const FloatMatrix& a) const; FloatMatrix append (const FloatRowVector& a) const; @@ -116,9 +121,11 @@ // resize is the destructive equivalent for this one - FloatMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; + FloatMatrix extract (octave_idx_type r1, octave_idx_type c1, + octave_idx_type r2, octave_idx_type c2) const; - FloatMatrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const; + FloatMatrix extract_n (octave_idx_type r1, octave_idx_type c1, + octave_idx_type nr, octave_idx_type nc) const; // extract row or column i. @@ -132,22 +139,22 @@ } private: - FloatMatrix tinverse (MatrixType &mattype, octave_idx_type& info, float& rcon, - int force, int calc_cond) const; + FloatMatrix tinverse (MatrixType &mattype, octave_idx_type& info, + float& rcon, int force, int calc_cond) const; - FloatMatrix finverse (MatrixType &mattype, octave_idx_type& info, float& rcon, - int force, int calc_cond) const; + FloatMatrix finverse (MatrixType &mattype, octave_idx_type& info, + float& rcon, int force, int calc_cond) const; public: FloatMatrix inverse (void) const; FloatMatrix inverse (octave_idx_type& info) const; FloatMatrix inverse (octave_idx_type& info, float& rcon, int force = 0, - int calc_cond = 1) const; + int calc_cond = 1) const; FloatMatrix inverse (MatrixType &mattype) const; FloatMatrix inverse (MatrixType &mattype, octave_idx_type& info) const; FloatMatrix inverse (MatrixType &mattype, octave_idx_type& info, float& rcon, - int force = 0, int calc_cond = 1) const; + int force = 0, int calc_cond = 1) const; FloatMatrix pseudo_inverse (float tol = 0.0) const; @@ -159,7 +166,8 @@ FloatDET determinant (void) const; FloatDET determinant (octave_idx_type& info) const; - FloatDET determinant (octave_idx_type& info, float& rcon, int calc_cond = 1) const; + FloatDET determinant (octave_idx_type& info, float& rcon, + int calc_cond = 1) const; FloatDET determinant (MatrixType &mattype, octave_idx_type& info, float& rcon, int calc_cond = 1) const; @@ -168,122 +176,149 @@ private: // Upper triangular matrix solvers - FloatMatrix utsolve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, - bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; + FloatMatrix utsolve (MatrixType &typ, const FloatMatrix& b, + octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + bool calc_cond = false, + blas_trans_type transt = blas_no_trans) const; // Lower triangular matrix solvers - FloatMatrix ltsolve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, - bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; + FloatMatrix ltsolve (MatrixType &typ, const FloatMatrix& b, + octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + bool calc_cond = false, + blas_trans_type transt = blas_no_trans) const; // Full matrix solvers (lu/cholesky) - FloatMatrix fsolve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, - bool calc_cond = false) const; + FloatMatrix fsolve (MatrixType &typ, const FloatMatrix& b, + octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, + bool calc_cond = false) const; public: // Generic interface to solver with no probing of type FloatMatrix solve (MatrixType &typ, const FloatMatrix& b) const; - FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info) const; - FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, - float& rcon) const; - FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, - bool singular_fallback = true, blas_trans_type transt = blas_no_trans) const; + FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, + octave_idx_type& info) const; + FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, + octave_idx_type& info, float& rcon) const; + FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + bool singular_fallback = true, + blas_trans_type transt = blas_no_trans) const; FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b) const; FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info) const; + octave_idx_type& info) const; FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon) const; + octave_idx_type& info, float& rcon) const; FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - bool singular_fallback = true, - blas_trans_type transt = blas_no_trans) const; + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + bool singular_fallback = true, + blas_trans_type transt = blas_no_trans) const; FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b) const; FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, - octave_idx_type& info) const; + octave_idx_type& info) const; FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, - octave_idx_type& info, float& rcon) const; + octave_idx_type& info, float& rcon) const; FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, - blas_trans_type transt = blas_no_trans) const; + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt = blas_no_trans) const; FloatComplexColumnVector solve (MatrixType &typ, - const FloatComplexColumnVector& b) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info, float& rcon) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, - octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; + const FloatComplexColumnVector& b) const; + FloatComplexColumnVector solve (MatrixType &typ, + const FloatComplexColumnVector& b, + octave_idx_type& info) const; + FloatComplexColumnVector solve (MatrixType &typ, + const FloatComplexColumnVector& b, + octave_idx_type& info, float& rcon) const; + FloatComplexColumnVector solve (MatrixType &typ, + const FloatComplexColumnVector& b, + octave_idx_type& info, float& rcon, + solve_singularity_handler sing_handler, + blas_trans_type transt = blas_no_trans) const; // Generic interface to solver with probing of type FloatMatrix solve (const FloatMatrix& b) const; FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info) const; - FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rcon) const; + FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info, + float& rcon) const; FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; FloatComplexMatrix solve (const FloatComplexMatrix& b) const; - FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info) const; - FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon) const; - FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon, + FloatComplexMatrix solve (const FloatComplexMatrix& b, + octave_idx_type& info) const; + FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, + float& rcon) const; + FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; FloatColumnVector solve (const FloatColumnVector& b) const; - FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& info) const; - FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& info, float& rcon) const; - FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& info, float& rcon, + FloatColumnVector solve (const FloatColumnVector& b, + octave_idx_type& info) const; + FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& info, + float& rcon) const; + FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; FloatComplexColumnVector solve (const FloatComplexColumnVector& b) const; - FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info) const; - FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info, + FloatComplexColumnVector solve (const FloatComplexColumnVector& b, + octave_idx_type& info) const; + FloatComplexColumnVector solve (const FloatComplexColumnVector& b, + octave_idx_type& info, float& rcon) const; - FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, + FloatComplexColumnVector solve (const FloatComplexColumnVector& b, + octave_idx_type& info, + float& rcon, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; // Singular solvers FloatMatrix lssolve (const FloatMatrix& b) const; FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info) const; FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, - octave_idx_type& rank) const; + octave_idx_type& rank) const; FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, - octave_idx_type& rank, float& rcon) const; + octave_idx_type& rank, float& rcon) const; FloatComplexMatrix lssolve (const FloatComplexMatrix& b) const; - FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& info) const; - FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& info, - octave_idx_type& rank) const; - FloatComplexMatrix lssolve (const FloatComplexMatrix& b, octave_idx_type& info, - octave_idx_type& rank, float &rcon) const; + FloatComplexMatrix lssolve (const FloatComplexMatrix& b, + octave_idx_type& info) const; + FloatComplexMatrix lssolve (const FloatComplexMatrix& b, + octave_idx_type& info, + octave_idx_type& rank) const; + FloatComplexMatrix lssolve (const FloatComplexMatrix& b, + octave_idx_type& info, octave_idx_type& rank, + float &rcon) const; FloatColumnVector lssolve (const FloatColumnVector& b) const; - FloatColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& info) const; + FloatColumnVector lssolve (const FloatColumnVector& b, + octave_idx_type& info) const; FloatColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& info, - octave_idx_type& rank) const; + octave_idx_type& rank) const; FloatColumnVector lssolve (const FloatColumnVector& b, octave_idx_type& info, - octave_idx_type& rank, float& rcon) const; + octave_idx_type& rank, float& rcon) const; FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b) const; FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, - octave_idx_type& info) const; + octave_idx_type& info) const; FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, - octave_idx_type& info, - octave_idx_type& rank) const; + octave_idx_type& info, + octave_idx_type& rank) const; FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, - octave_idx_type& info, - octave_idx_type& rank, float& rcon) const; + octave_idx_type& info, + octave_idx_type& rank, float& rcon) const; FloatMatrix& operator += (const FloatDiagMatrix& a); FloatMatrix& operator -= (const FloatDiagMatrix& a); @@ -331,8 +366,10 @@ // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatMatrix& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatMatrix& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const FloatMatrix& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + FloatMatrix& a); }; // Publish externally used friend functions. @@ -342,19 +379,22 @@ // column vector by row vector -> matrix operations -extern OCTAVE_API FloatMatrix operator * (const FloatColumnVector& a, const FloatRowVector& b); +extern OCTAVE_API FloatMatrix operator * (const FloatColumnVector& a, + const FloatRowVector& b); // Other functions. extern OCTAVE_API FloatMatrix Givens (float, float); -extern OCTAVE_API FloatMatrix Sylvester (const FloatMatrix&, const FloatMatrix&, const FloatMatrix&); +extern OCTAVE_API FloatMatrix Sylvester (const FloatMatrix&, const FloatMatrix&, + const FloatMatrix&); extern OCTAVE_API FloatMatrix xgemm (const FloatMatrix& a, const FloatMatrix& b, blas_trans_type transa = blas_no_trans, blas_trans_type transb = blas_no_trans); -extern OCTAVE_API FloatMatrix operator * (const FloatMatrix& a, const FloatMatrix& b); +extern OCTAVE_API FloatMatrix operator * (const FloatMatrix& a, + const FloatMatrix& b); extern OCTAVE_API FloatMatrix min (float d, const FloatMatrix& m); extern OCTAVE_API FloatMatrix min (const FloatMatrix& m, float d);
--- a/liboctave/array/fNDArray.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fNDArray.cc Sat Oct 26 18:57:05 2013 -0700 @@ -110,7 +110,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) octave_fftw::ifft (out + k * stride * n, out + k * stride * n, - n, howmany, stride, dist); + n, howmany, stride, dist); return retval; } @@ -294,7 +294,7 @@ for (octave_idx_type i = 0; i < npts; i++) retval((i + k*npts)*stride + j*dist) = tmp[i] / - static_cast<float> (npts); + static_cast<float> (npts); } } @@ -387,8 +387,8 @@ F77_FUNC (cfftb, CFFTB) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval((l + k*npts)*stride + j*dist) = prow[l] / - static_cast<float> (npts); + retval((l + k*npts)*stride + j*dist) = + prow[l] / static_cast<float> (npts); } } @@ -482,8 +482,8 @@ F77_FUNC (cfftb, CFFTB) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval((l + k*npts)*stride + j*dist) = prow[l] / - static_cast<float> (npts); + retval((l + k*npts)*stride + j*dist) = + prow[l] / static_cast<float> (npts); } } @@ -595,7 +595,7 @@ return false; } -// FIXME -- this is not quite the right thing. +// FIXME: this is not quite the right thing. boolNDArray FloatNDArray::all (int dim) const @@ -700,7 +700,8 @@ } FloatNDArray -FloatNDArray::concat (const FloatNDArray& rb, const Array<octave_idx_type>& ra_idx) +FloatNDArray::concat (const FloatNDArray& rb, + const Array<octave_idx_type>& ra_idx) { if (rb.numel () > 0) insert (rb, ra_idx); @@ -708,7 +709,8 @@ } FloatComplexNDArray -FloatNDArray::concat (const FloatComplexNDArray& rb, const Array<octave_idx_type>& ra_idx) +FloatNDArray::concat (const FloatComplexNDArray& rb, + const Array<octave_idx_type>& ra_idx) { FloatComplexNDArray retval (*this); if (rb.numel () > 0) @@ -717,7 +719,8 @@ } charNDArray -FloatNDArray::concat (const charNDArray& rb, const Array<octave_idx_type>& ra_idx) +FloatNDArray::concat (const charNDArray& rb, + const Array<octave_idx_type>& ra_idx) { charNDArray retval (dims ()); octave_idx_type nel = numel (); @@ -737,8 +740,7 @@ octave_idx_type ival = NINTbig (d); if (ival < 0 || ival > std::numeric_limits<unsigned char>::max ()) - // FIXME -- is there something - // better we could do? Should we warn the user? + // FIXME: is there something better to do? Should we warn the user? ival = 0; retval.elem (i) = static_cast<char>(ival); @@ -765,14 +767,16 @@ } FloatNDArray& -FloatNDArray::insert (const FloatNDArray& a, octave_idx_type r, octave_idx_type c) +FloatNDArray::insert (const FloatNDArray& a, + octave_idx_type r, octave_idx_type c) { Array<float>::insert (a, r, c); return *this; } FloatNDArray& -FloatNDArray::insert (const FloatNDArray& a, const Array<octave_idx_type>& ra_idx) +FloatNDArray::insert (const FloatNDArray& a, + const Array<octave_idx_type>& ra_idx) { Array<float>::insert (a, ra_idx); return *this; @@ -808,7 +812,7 @@ FloatMatrix retval; if (ndims () == 2) - retval = FloatMatrix (Array<float> (*this)); + retval = FloatMatrix (Array<float> (*this)); else (*current_liboctave_error_handler) ("invalid conversion of FloatNDArray to FloatMatrix"); @@ -818,15 +822,15 @@ void FloatNDArray::increment_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions, - int start_dimension) + const dim_vector& dimensions, + int start_dimension) { ::increment_index (ra_idx, dimensions, start_dimension); } octave_idx_type FloatNDArray::compute_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions) + const dim_vector& dimensions) { return ::compute_index (ra_idx, dimensions); } @@ -867,16 +871,16 @@ { float tmp; for (octave_idx_type i = 0; i < nel; i++) - { - tmp = octave_read_value<float> (is); - if (is) - a.elem (i) = tmp; - else - goto done; - } + { + tmp = octave_read_value<float> (is); + if (is) + a.elem (i) = tmp; + else + goto done; + } } - done: +done: return is; }
--- a/liboctave/array/fNDArray.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fNDArray.h Sat Oct 26 18:57:05 2013 -0700 @@ -62,10 +62,10 @@ FloatNDArray (const charNDArray&); FloatNDArray& operator = (const FloatNDArray& a) - { - MArray<float>::operator = (a); - return *this; - } + { + MArray<float>::operator = (a); + return *this; + } // unary operations @@ -82,7 +82,7 @@ bool all_integers (void) const; bool too_large_for_float (void) const; - // FIXME -- this is not quite the right thing. + // FIXME: this is not quite the right thing. boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; @@ -91,11 +91,14 @@ FloatNDArray cumsum (int dim = -1) const; FloatNDArray prod (int dim = -1) const; FloatNDArray sum (int dim = -1) const; - NDArray dsum (int dim = -1) const; + NDArray dsum (int dim = -1) const; FloatNDArray sumsq (int dim = -1) const; - FloatNDArray concat (const FloatNDArray& rb, const Array<octave_idx_type>& ra_idx); - FloatComplexNDArray concat (const FloatComplexNDArray& rb, const Array<octave_idx_type>& ra_idx); - charNDArray concat (const charNDArray& rb, const Array<octave_idx_type>& ra_idx); + FloatNDArray concat (const FloatNDArray& rb, + const Array<octave_idx_type>& ra_idx); + FloatComplexNDArray concat (const FloatComplexNDArray& rb, + const Array<octave_idx_type>& ra_idx); + charNDArray concat (const charNDArray& rb, + const Array<octave_idx_type>& ra_idx); FloatNDArray max (int dim = -1) const; FloatNDArray max (Array<octave_idx_type>& index, int dim = -1) const; @@ -109,8 +112,10 @@ FloatNDArray diff (octave_idx_type order = 1, int dim = -1) const; - FloatNDArray& insert (const FloatNDArray& a, octave_idx_type r, octave_idx_type c); - FloatNDArray& insert (const FloatNDArray& a, const Array<octave_idx_type>& ra_idx); + FloatNDArray& insert (const FloatNDArray& a, + octave_idx_type r, octave_idx_type c); + FloatNDArray& insert (const FloatNDArray& a, + const Array<octave_idx_type>& ra_idx); FloatNDArray abs (void) const; boolNDArray isnan (void) const; @@ -140,11 +145,12 @@ int start_dimension = 0); static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions); + const dim_vector& dimensions); // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatNDArray& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const FloatNDArray& a); friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatNDArray& a); FloatNDArray diag (octave_idx_type k = 0) const; @@ -152,10 +158,10 @@ FloatNDArray diag (octave_idx_type m, octave_idx_type n) const; FloatNDArray& changesign (void) - { - MArray<float>::changesign (); - return *this; - } + { + MArray<float>::changesign (); + return *this; + } };
--- a/liboctave/array/fRowVector.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/fRowVector.h Sat Oct 26 18:57:05 2013 -0700 @@ -51,10 +51,10 @@ FloatRowVector (const Array<float>& a) : MArray<float> (a.as_row ()) { } FloatRowVector& operator = (const FloatRowVector& a) - { - MArray<float>::operator = (a); - return *this; - } + { + MArray<float>::operator = (a); + return *this; + } bool operator == (const FloatRowVector& a) const; bool operator != (const FloatRowVector& a) const; @@ -81,7 +81,8 @@ // row vector by matrix -> row vector - friend OCTAVE_API FloatRowVector operator * (const FloatRowVector& a, const FloatMatrix& b); + friend OCTAVE_API FloatRowVector operator * (const FloatRowVector& a, + const FloatMatrix& b); // other operations @@ -90,8 +91,10 @@ // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatRowVector& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatRowVector& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const FloatRowVector& a); + friend OCTAVE_API std::istream& operator >> (std::istream& is, + FloatRowVector& a); void resize (octave_idx_type n, const float& rfv = 0) { @@ -99,15 +102,17 @@ } void clear (octave_idx_type n) - { Array<float>::clear (1, n); } + { Array<float>::clear (1, n); } }; // row vector by column vector -> scalar -float OCTAVE_API operator * (const FloatRowVector& a, const FloatColumnVector& b); +float OCTAVE_API operator * (const FloatRowVector& a, + const FloatColumnVector& b); -Complex OCTAVE_API operator * (const FloatRowVector& a, const ComplexColumnVector& b); +Complex OCTAVE_API operator * (const FloatRowVector& a, + const ComplexColumnVector& b); // other operations
--- a/liboctave/array/idx-vector.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/idx-vector.cc Sat Oct 26 18:57:05 2013 -0700 @@ -331,10 +331,10 @@ data = d; if (err) - { - delete [] data; - gripe_invalid_index (); - } + { + delete [] data; + gripe_invalid_index (); + } } } @@ -443,7 +443,7 @@ for (octave_idx_type i = bnda.cidx(j); i < bnda.cidx(j+1); i++) if (bnda.data (i)) d[k++] = j * nr + bnda.ridx (i); - + data = d; ext = d[k-1] + 1; @@ -496,7 +496,8 @@ if (uniq) { - octave_idx_type new_len = std::unique (new_data, new_data + len) - new_data; + octave_idx_type new_len = std::unique (new_data, new_data + len) + - new_data; new_rep->len = new_len; if (new_rep->orig_dims.length () == 2 && new_rep->orig_dims(0) == 1) new_rep->orig_dims = dim_vector (1, new_len); @@ -1096,7 +1097,7 @@ if (mask[i]) data[j++] = i; } - break; + break; default: assert (false); @@ -1152,7 +1153,7 @@ { octave_idx_type k = xelem (i); if (left[k]) - left[k] = false; + left[k] = false; else { retval = false;
--- a/liboctave/array/idx-vector.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/idx-vector.h Sat Oct 26 18:57:05 2013 -0700 @@ -55,14 +55,14 @@ public: enum idx_class_type - { - class_invalid = -1, - class_colon = 0, - class_range, - class_scalar, - class_vector, - class_mask - }; + { + class_invalid = -1, + class_colon = 0, + class_range, + class_scalar, + class_vector, + class_mask + }; template<class T> friend class std::auto_ptr; @@ -98,7 +98,7 @@ // Checks whether the index is colon or a range equivalent to colon. virtual bool is_colon_equiv (octave_idx_type) const { return false; } - // The original dimensions of this object (used when subscribing by matrices). + // The original dimensions of object (used when subscribing by matrices). virtual dim_vector orig_dimensions (void) const { return dim_vector (); } // i/o @@ -136,7 +136,7 @@ idx_class_type idx_class (void) const { return class_colon; } idx_base_rep *sort_uniq_clone (bool = false) - { count++; return this; } + { count++; return this; } idx_base_rep *sort_idx (Array<octave_idx_type>&); @@ -174,14 +174,15 @@ idx_range_rep (const Range&); octave_idx_type xelem (octave_idx_type i) const - { return start + i * step; } + { return start + i * step; } octave_idx_type checkelem (octave_idx_type i) const; octave_idx_type length (octave_idx_type) const { return len; } octave_idx_type extent (octave_idx_type n) const - { return len ? std::max (n, (start + 1 + (step < 0 ? 0 : step * (len - 1)))) : n; } + { return len ? std::max (n, (start + 1 + (step < 0 ? 0 : step * (len - 1)))) + : n; } idx_class_type idx_class (void) const { return class_range; } @@ -190,10 +191,10 @@ idx_base_rep *sort_idx (Array<octave_idx_type>&); bool is_colon_equiv (octave_idx_type n) const - { return start == 0 && step == 1 && len == n; } + { return start == 0 && step == 1 && len == n; } dim_vector orig_dimensions (void) const - { return dim_vector (1, len); } + { return dim_vector (1, len); } octave_idx_type get_start (void) const { return start; } @@ -240,17 +241,17 @@ octave_idx_type length (octave_idx_type) const { return 1; } octave_idx_type extent (octave_idx_type n) const - { return std::max (n, data + 1); } + { return std::max (n, data + 1); } idx_class_type idx_class (void) const { return class_scalar; } idx_base_rep *sort_uniq_clone (bool = false) - { count++; return this; } + { count++; return this; } idx_base_rep *sort_idx (Array<octave_idx_type>&); bool is_colon_equiv (octave_idx_type n) const - { return n == 1 && data == 0; } + { return n == 1 && data == 0; } dim_vector orig_dimensions (void) const { return dim_vector (1, 1); } @@ -285,7 +286,7 @@ idx_vector_rep (void) : data (0), len (0), ext (0), aowner (0), orig_dims () - { } + { } // Zero-based constructor. idx_vector_rep (const Array<octave_idx_type>& inda); @@ -311,7 +312,7 @@ octave_idx_type length (octave_idx_type) const { return len; } octave_idx_type extent (octave_idx_type n) const - { return std::max (n, ext); } + { return std::max (n, ext); } idx_class_type idx_class (void) const { return class_vector; } @@ -366,7 +367,7 @@ idx_mask_rep (void) : data (0), len (0), ext (0), lsti (-1), lste (-1), aowner (0), orig_dims () - { } + { } idx_mask_rep (bool); @@ -381,19 +382,19 @@ octave_idx_type length (octave_idx_type) const { return len; } octave_idx_type extent (octave_idx_type n) const - { return std::max (n, ext); } + { return std::max (n, ext); } idx_class_type idx_class (void) const { return class_mask; } idx_base_rep *sort_uniq_clone (bool = false) - { count++; return this; } + { count++; return this; } idx_base_rep *sort_idx (Array<octave_idx_type>&); dim_vector orig_dimensions (void) const { return orig_dims; } bool is_colon_equiv (octave_idx_type n) const - { return len == n && ext == n; } + { return len == n && ext == n; } const bool *get_data (void) const { return data; } @@ -437,31 +438,31 @@ // The shared empty vector representation (for fast default // constructor). static idx_vector_rep *nil_rep (void) - { - static idx_vector_rep ivr; - return &ivr; - } + { + static idx_vector_rep ivr; + return &ivr; + } // The shared empty vector representation with the error flag set. static idx_vector_rep *err_rep (void) - { - static idx_vector_rep ivr; - ivr.err = true; - return &ivr; - } + { + static idx_vector_rep ivr; + ivr.err = true; + return &ivr; + } // If there was an error in constructing the rep, replace it with // empty vector for safety. void chkerr (void) - { - if (rep->err) - { - if (--rep->count == 0) - delete rep; - rep = err_rep (); - rep->count++; - } - } + { + if (rep->err) + { + if (--rep->count == 0) + delete rep; + rep = err_rep (); + rep->count++; + } + } public: @@ -470,28 +471,28 @@ // Zero-based constructors (for use from C++). idx_vector (octave_idx_type i) : rep (new idx_scalar_rep (i)) - { chkerr (); } + { chkerr (); } idx_vector (octave_idx_type start, octave_idx_type limit, octave_idx_type step = 1) : rep (new idx_range_rep (start, limit, step)) - { chkerr (); } + { chkerr (); } static idx_vector - make_range (octave_idx_type start, octave_idx_type step, - octave_idx_type len) - { - return idx_vector (new idx_range_rep (start, len, step, DIRECT)); - } + make_range (octave_idx_type start, octave_idx_type step, + octave_idx_type len) + { + return idx_vector (new idx_range_rep (start, len, step, DIRECT)); + } idx_vector (const Array<octave_idx_type>& inda) : rep (new idx_vector_rep (inda)) - { chkerr (); } + { chkerr (); } // Directly pass extent, no checking. idx_vector (const Array<octave_idx_type>& inda, octave_idx_type ext) : rep (new idx_vector_rep (inda, ext, DIRECT)) - { } + { } // Colon is best constructed by simply copying (or referencing) this member. static const idx_vector colon; @@ -513,105 +514,105 @@ template <class T> idx_vector (const Array<octave_int<T> >& nda) : rep (new idx_vector_rep (nda)) - { chkerr (); } + { chkerr (); } idx_vector (const Array<double>& nda) : rep (new idx_vector_rep (nda)) - { chkerr (); } + { chkerr (); } idx_vector (const Array<float>& nda) : rep (new idx_vector_rep (nda)) - { chkerr (); } + { chkerr (); } idx_vector (const Array<bool>& nda); idx_vector (const Range& r) : rep (new idx_range_rep (r)) - { chkerr (); } + { chkerr (); } idx_vector (const Sparse<bool>& nda) : rep (new idx_vector_rep (nda)) - { chkerr (); } + { chkerr (); } idx_vector (const idx_vector& a) : rep (a.rep) { rep->count++; } ~idx_vector (void) - { - if (--rep->count == 0) - delete rep; - } + { + if (--rep->count == 0) + delete rep; + } idx_vector& operator = (const idx_vector& a) - { - if (this != &a) - { - if (--rep->count == 0) - delete rep; + { + if (this != &a) + { + if (--rep->count == 0) + delete rep; - rep = a.rep; - rep->count++; - } - return *this; - } + rep = a.rep; + rep->count++; + } + return *this; + } idx_class_type idx_class (void) const { return rep->idx_class (); } octave_idx_type length (octave_idx_type n = 0) const - { return rep->length (n); } + { return rep->length (n); } octave_idx_type extent (octave_idx_type n) const - { return rep->extent (n); } + { return rep->extent (n); } octave_idx_type xelem (octave_idx_type n) const - { return rep->xelem (n); } + { return rep->xelem (n); } octave_idx_type checkelem (octave_idx_type n) const - { return rep->checkelem (n); } + { return rep->checkelem (n); } octave_idx_type operator () (octave_idx_type n) const - { + { #if defined (BOUNDS_CHECKING) - return rep->checkelem (n); + return rep->checkelem (n); #else - return rep->xelem (n); + return rep->xelem (n); #endif - } + } operator bool (void) const - { return ! rep->err; } + { return ! rep->err; } bool is_colon (void) const - { return rep->idx_class () == class_colon; } + { return rep->idx_class () == class_colon; } bool is_scalar (void) const - { return rep->idx_class () == class_scalar; } + { return rep->idx_class () == class_scalar; } bool is_range (void) const - { return rep->idx_class () == class_range; } + { return rep->idx_class () == class_range; } bool is_colon_equiv (octave_idx_type n) const - { return rep->is_colon_equiv (n); } + { return rep->is_colon_equiv (n); } idx_vector sorted (bool uniq = false) const - { return idx_vector (rep->sort_uniq_clone (uniq)); } + { return idx_vector (rep->sort_uniq_clone (uniq)); } idx_vector sorted (Array<octave_idx_type>& sidx) const - { return idx_vector (rep->sort_idx (sidx)); } + { return idx_vector (rep->sort_idx (sidx)); } dim_vector orig_dimensions (void) const { return rep->orig_dimensions (); } octave_idx_type orig_rows (void) const - { return orig_dimensions () (0); } + { return orig_dimensions () (0); } octave_idx_type orig_columns (void) const - { return orig_dimensions () (1); } + { return orig_dimensions () (1); } int orig_empty (void) const - { return (! is_colon () && orig_dimensions ().any_zero ()); } + { return (! is_colon () && orig_dimensions ().any_zero ()); } // i/o std::ostream& print (std::ostream& os) const { return rep->print (os); } friend std::ostream& operator << (std::ostream& os, const idx_vector& a) - { return a.print (os); } + { return a.print (os); } // Slice with specializations. No checking of bounds! // @@ -624,67 +625,67 @@ template <class T> octave_idx_type index (const T *src, octave_idx_type n, T *dest) const - { - octave_idx_type len = rep->length (n); + { + octave_idx_type len = rep->length (n); - switch (rep->idx_class ()) - { - case class_colon: - copy_or_memcpy (len, src, dest); - break; + switch (rep->idx_class ()) + { + case class_colon: + copy_or_memcpy (len, src, dest); + break; - case class_range: - { - idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); - octave_idx_type start = r->get_start (), step = r->get_step (); - const T *ssrc = src + start; - if (step == 1) - copy_or_memcpy (len, ssrc, dest); - else if (step == -1) - std::reverse_copy (ssrc - len + 1, ssrc + 1, dest); - else if (step == 0) - std::fill_n (dest, len, *ssrc); - else - { - for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) - dest[i] = ssrc[j]; - } - } - break; + case class_range: + { + idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); + octave_idx_type start = r->get_start (), step = r->get_step (); + const T *ssrc = src + start; + if (step == 1) + copy_or_memcpy (len, ssrc, dest); + else if (step == -1) + std::reverse_copy (ssrc - len + 1, ssrc + 1, dest); + else if (step == 0) + std::fill_n (dest, len, *ssrc); + else + { + for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) + dest[i] = ssrc[j]; + } + } + break; - case class_scalar: - { - idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); - dest[0] = src[r->get_data ()]; - } - break; + case class_scalar: + { + idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); + dest[0] = src[r->get_data ()]; + } + break; - case class_vector: - { - idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); - const octave_idx_type *data = r->get_data (); - for (octave_idx_type i = 0; i < len; i++) - dest[i] = src[data[i]]; - } - break; + case class_vector: + { + idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); + const octave_idx_type *data = r->get_data (); + for (octave_idx_type i = 0; i < len; i++) + dest[i] = src[data[i]]; + } + break; - case class_mask: - { - idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); - const bool *data = r->get_data (); - octave_idx_type ext = r->extent (0); - for (octave_idx_type i = 0; i < ext; i++) - if (data[i]) *dest++ = src[i]; - } - break; + case class_mask: + { + idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); + const bool *data = r->get_data (); + octave_idx_type ext = r->extent (0); + for (octave_idx_type i = 0; i < ext; i++) + if (data[i]) *dest++ = src[i]; + } + break; - default: - assert (false); - break; - } + default: + assert (false); + break; + } - return len; - } + return len; + } // Slice assignment with specializations. No checking of bounds! // @@ -697,65 +698,65 @@ template <class T> octave_idx_type assign (const T *src, octave_idx_type n, T *dest) const - { - octave_idx_type len = rep->length (n); + { + octave_idx_type len = rep->length (n); - switch (rep->idx_class ()) - { - case class_colon: - copy_or_memcpy (len, src, dest); - break; + switch (rep->idx_class ()) + { + case class_colon: + copy_or_memcpy (len, src, dest); + break; - case class_range: - { - idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); - octave_idx_type start = r->get_start (), step = r->get_step (); - T *sdest = dest + start; - if (step == 1) - copy_or_memcpy (len, src, sdest); - else if (step == -1) - std::reverse_copy (src, src + len, sdest - len + 1); - else - { - for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) - sdest[j] = src[i]; - } - } - break; + case class_range: + { + idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); + octave_idx_type start = r->get_start (), step = r->get_step (); + T *sdest = dest + start; + if (step == 1) + copy_or_memcpy (len, src, sdest); + else if (step == -1) + std::reverse_copy (src, src + len, sdest - len + 1); + else + { + for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) + sdest[j] = src[i]; + } + } + break; - case class_scalar: - { - idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); - dest[r->get_data ()] = src[0]; - } - break; + case class_scalar: + { + idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); + dest[r->get_data ()] = src[0]; + } + break; - case class_vector: - { - idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); - const octave_idx_type *data = r->get_data (); - for (octave_idx_type i = 0; i < len; i++) - dest[data[i]] = src[i]; - } - break; + case class_vector: + { + idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); + const octave_idx_type *data = r->get_data (); + for (octave_idx_type i = 0; i < len; i++) + dest[data[i]] = src[i]; + } + break; - case class_mask: - { - idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); - const bool *data = r->get_data (); - octave_idx_type ext = r->extent (0); - for (octave_idx_type i = 0; i < ext; i++) - if (data[i]) dest[i] = *src++; - } - break; + case class_mask: + { + idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); + const bool *data = r->get_data (); + octave_idx_type ext = r->extent (0); + for (octave_idx_type i = 0; i < ext; i++) + if (data[i]) dest[i] = *src++; + } + break; - default: - assert (false); - break; - } + default: + assert (false); + break; + } - return len; - } + return len; + } // Slice fill with specializations. No checking of bounds! // @@ -768,65 +769,65 @@ template <class T> octave_idx_type fill (const T& val, octave_idx_type n, T *dest) const - { - octave_idx_type len = rep->length (n); + { + octave_idx_type len = rep->length (n); - switch (rep->idx_class ()) - { - case class_colon: - std::fill (dest, dest + len, val); - break; + switch (rep->idx_class ()) + { + case class_colon: + std::fill (dest, dest + len, val); + break; - case class_range: - { - idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); - octave_idx_type start = r->get_start (), step = r->get_step (); - T *sdest = dest + start; - if (step == 1) - std::fill (sdest, sdest + len, val); - else if (step == -1) - std::fill (sdest - len + 1, sdest + 1, val); - else - { - for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) - sdest[j] = val; - } - } - break; + case class_range: + { + idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); + octave_idx_type start = r->get_start (), step = r->get_step (); + T *sdest = dest + start; + if (step == 1) + std::fill (sdest, sdest + len, val); + else if (step == -1) + std::fill (sdest - len + 1, sdest + 1, val); + else + { + for (octave_idx_type i = 0, j = 0; i < len; i++, j += step) + sdest[j] = val; + } + } + break; - case class_scalar: - { - idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); - dest[r->get_data ()] = val; - } - break; + case class_scalar: + { + idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); + dest[r->get_data ()] = val; + } + break; - case class_vector: - { - idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); - const octave_idx_type *data = r->get_data (); - for (octave_idx_type i = 0; i < len; i++) - dest[data[i]] = val; - } - break; + case class_vector: + { + idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); + const octave_idx_type *data = r->get_data (); + for (octave_idx_type i = 0; i < len; i++) + dest[data[i]] = val; + } + break; - case class_mask: - { - idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); - const bool *data = r->get_data (); - octave_idx_type ext = r->extent (0); - for (octave_idx_type i = 0; i < ext; i++) - if (data[i]) dest[i] = val; - } - break; + case class_mask: + { + idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); + const bool *data = r->get_data (); + octave_idx_type ext = r->extent (0); + for (octave_idx_type i = 0; i < ext; i++) + if (data[i]) dest[i] = val; + } + break; - default: - assert (false); - break; - } + default: + assert (false); + break; + } - return len; - } + return len; + } // Generic non-breakable indexed loop. The loop body should be // encapsulated in a single functor body. This is equivalent to the @@ -837,60 +838,60 @@ template <class Functor> void loop (octave_idx_type n, Functor body) const - { - octave_idx_type len = rep->length (n); + { + octave_idx_type len = rep->length (n); - switch (rep->idx_class ()) - { - case class_colon: - for (octave_idx_type i = 0; i < len; i++) body (i); - break; + switch (rep->idx_class ()) + { + case class_colon: + for (octave_idx_type i = 0; i < len; i++) body (i); + break; - case class_range: - { - idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); - octave_idx_type start = r->get_start (), step = r->get_step (); - octave_idx_type i, j; - if (step == 1) - for (i = start, j = start + len; i < j; i++) body (i); - else if (step == -1) - for (i = start, j = start - len; i > j; i--) body (i); - else - for (i = 0, j = start; i < len; i++, j += step) body (j); - } - break; + case class_range: + { + idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); + octave_idx_type start = r->get_start (), step = r->get_step (); + octave_idx_type i, j; + if (step == 1) + for (i = start, j = start + len; i < j; i++) body (i); + else if (step == -1) + for (i = start, j = start - len; i > j; i--) body (i); + else + for (i = 0, j = start; i < len; i++, j += step) body (j); + } + break; - case class_scalar: - { - idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); - body (r->get_data ()); - } - break; + case class_scalar: + { + idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); + body (r->get_data ()); + } + break; - case class_vector: - { - idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); - const octave_idx_type *data = r->get_data (); - for (octave_idx_type i = 0; i < len; i++) body (data[i]); - } - break; + case class_vector: + { + idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); + const octave_idx_type *data = r->get_data (); + for (octave_idx_type i = 0; i < len; i++) body (data[i]); + } + break; - case class_mask: - { - idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); - const bool *data = r->get_data (); - octave_idx_type ext = r->extent (0); - for (octave_idx_type i = 0; i < ext; i++) - if (data[i]) body (i); - } - break; + case class_mask: + { + idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); + const bool *data = r->get_data (); + octave_idx_type ext = r->extent (0); + for (octave_idx_type i = 0; i < ext; i++) + if (data[i]) body (i); + } + break; - default: - assert (false); - break; - } + default: + assert (false); + break; + } - } + } // Generic breakable indexed loop. The loop body should be // encapsulated in a single functor body. This is equivalent to the @@ -904,78 +905,78 @@ template <class Functor> octave_idx_type bloop (octave_idx_type n, Functor body) const - { - octave_idx_type len = rep->length (n), ret; + { + octave_idx_type len = rep->length (n), ret; - switch (rep->idx_class ()) + switch (rep->idx_class ()) + { + case class_colon: { - case class_colon: - { - octave_idx_type i; - for (i = 0; i < len && body (i); i++) ; - ret = i; - } - break; + octave_idx_type i; + for (i = 0; i < len && body (i); i++) ; + ret = i; + } + break; - case class_range: - { - idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); - octave_idx_type start = r->get_start (), step = r->get_step (); - octave_idx_type i, j; - if (step == 1) - for (i = start, j = start + len; i < j && body (i); i++) ; - else if (step == -1) - for (i = start, j = start - len; i > j && body (i); i--) ; - else - for (i = 0, j = start; i < len && body (j); i++, j += step) ; - ret = i; - } - break; + case class_range: + { + idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep); + octave_idx_type start = r->get_start (), step = r->get_step (); + octave_idx_type i, j; + if (step == 1) + for (i = start, j = start + len; i < j && body (i); i++) ; + else if (step == -1) + for (i = start, j = start - len; i > j && body (i); i--) ; + else + for (i = 0, j = start; i < len && body (j); i++, j += step) ; + ret = i; + } + break; - case class_scalar: - { - idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); - ret = body (r->get_data ()) ? 1 : 0; - } - break; + case class_scalar: + { + idx_scalar_rep * r = dynamic_cast<idx_scalar_rep *> (rep); + ret = body (r->get_data ()) ? 1 : 0; + } + break; - case class_vector: - { - idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); - const octave_idx_type *data = r->get_data (); - octave_idx_type i; - for (i = 0; i < len && body (data[i]); i++) ; - ret = i; - } - break; + case class_vector: + { + idx_vector_rep * r = dynamic_cast<idx_vector_rep *> (rep); + const octave_idx_type *data = r->get_data (); + octave_idx_type i; + for (i = 0; i < len && body (data[i]); i++) ; + ret = i; + } + break; - case class_mask: - { - idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); - const bool *data = r->get_data (); - octave_idx_type ext = r->extent (0), j = 0; - for (octave_idx_type i = 0; i < ext; i++) - { - if (data[i]) - { - if (body (i)) - break; - else - j++; - } - } + case class_mask: + { + idx_mask_rep * r = dynamic_cast<idx_mask_rep *> (rep); + const bool *data = r->get_data (); + octave_idx_type ext = r->extent (0), j = 0; + for (octave_idx_type i = 0; i < ext; i++) + { + if (data[i]) + { + if (body (i)) + break; + else + j++; + } + } - ret = j; - } - break; + ret = j; + } + break; - default: - assert (false); - break; - } + default: + assert (false); + break; + } - return ret; - } + return ret; + } // Rationale: // This method is the key to "smart indexing". When indexing cartesian @@ -1022,20 +1023,20 @@ bool is_vector (void) const; - // FIXME -- these are here for compatibility. They should be removed + // FIXME: these are here for compatibility. They should be removed // when no longer in use. octave_idx_type elem (octave_idx_type n) const - { return (*this) (n); } + { return (*this) (n); } bool is_colon_equiv (octave_idx_type n, int) const - { return is_colon_equiv (n); } + { return is_colon_equiv (n); } octave_idx_type freeze (octave_idx_type z_len, const char *tag, bool resize_ok = false); void sort (bool uniq = false) - { *this = sorted (uniq); } + { *this = sorted (uniq); } octave_idx_type ones_count (void) const;
--- a/liboctave/array/intNDArray.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/intNDArray.cc Sat Oct 26 18:57:05 2013 -0700 @@ -76,7 +76,7 @@ return MArray<T>::diag (m, n); } -// FIXME -- this is not quite the right thing. +// FIXME: this is not quite the right thing. template <class T> boolNDArray @@ -95,8 +95,8 @@ template <class T> void intNDArray<T>::increment_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions, - int start_dimension) + const dim_vector& dimensions, + int start_dimension) { ::increment_index (ra_idx, dimensions, start_dimension); } @@ -111,7 +111,8 @@ template <class T> intNDArray<T> -intNDArray<T>::concat (const intNDArray<T>& rb, const Array<octave_idx_type>& ra_idx) +intNDArray<T>::concat (const intNDArray<T>& rb, + const Array<octave_idx_type>& ra_idx) { if (rb.numel () > 0) insert (rb, ra_idx); @@ -120,7 +121,8 @@ template <class T> intNDArray<T>& -intNDArray<T>::insert (const intNDArray<T>& a, octave_idx_type r, octave_idx_type c) +intNDArray<T>::insert (const intNDArray<T>& a, octave_idx_type r, + octave_idx_type c) { Array<T>::insert (a, r, c); return *this; @@ -128,7 +130,8 @@ template <class T> intNDArray<T>& -intNDArray<T>::insert (const intNDArray<T>& a, const Array<octave_idx_type>& ra_idx) +intNDArray<T>::insert (const intNDArray<T>& a, + const Array<octave_idx_type>& ra_idx) { Array<T>::insert (a, ra_idx); return *this; @@ -169,12 +172,12 @@ } } - done: +done: return is; } -// FIXME -- should abs and signum just be mapper functions? +// FIXME: should abs and signum just be mapper functions? template <class T> intNDArray<T>
--- a/liboctave/array/intNDArray.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/array/intNDArray.h Sat Oct 26 18:57:05 2013 -0700 @@ -54,10 +54,10 @@ intNDArray (const intNDArray<U>& a) : MArray<T> (a) { } intNDArray& operator = (const intNDArray<T>& a) - { - MArray<T>::operator = (a); - return *this; - } + { + MArray<T>::operator = (a); + return *this; + } boolNDArray operator ! (void) const; @@ -69,12 +69,12 @@ intNDArray diag (octave_idx_type m, octave_idx_type n) const; intNDArray& changesign (void) - { - MArray<T>::changesign (); - return *this; - } + { + MArray<T>::changesign (); + return *this; + } - // FIXME -- this is not quite the right thing. + // FIXME: this is not quite the right thing. boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; @@ -99,22 +99,25 @@ intNDArray signum (void) const; intNDArray squeeze (void) const - { return intNDArray<T> (MArray<T>::squeeze ()); } + { return intNDArray<T> (MArray<T>::squeeze ()); } intNDArray transpose (void) const - { return intNDArray<T> (MArray<T>::transpose ()); } + { return intNDArray<T> (MArray<T>::transpose ()); } + + intNDArray concat (const intNDArray<T>& rb, + const Array<octave_idx_type>& ra_idx); - intNDArray concat (const intNDArray<T>& rb, const Array<octave_idx_type>& ra_idx); - - intNDArray& insert (const intNDArray<T>& a, octave_idx_type r, octave_idx_type c); - intNDArray& insert (const intNDArray<T>& a, const Array<octave_idx_type>& ra_idx); + intNDArray& insert (const intNDArray<T>& a, + octave_idx_type r, octave_idx_type c); + intNDArray& insert (const intNDArray<T>& a, + const Array<octave_idx_type>& ra_idx); static void increment_index (Array<octave_idx_type>& ra_idx, const dim_vector& dimensions, int start_dimension = 0); static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx, - const dim_vector& dimensions); + const dim_vector& dimensions); }; // i/o
--- a/liboctave/cruft/misc/blaswrap.c Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/cruft/misc/blaswrap.c Sat Oct 26 18:57:05 2013 -0700 @@ -35,8 +35,8 @@ libBLAS and libLAPACK to the native gfortran calling convention, so that the libraries can be used with software built for x86_64 architecture. - - */ + +*/ #ifdef HAVE_CONFIG_H #include <config.h> /* USE_BLASWRAP ? */ @@ -48,7 +48,7 @@ * vecLib is an Apple framework (collection of libraries) containing * libBLAS and libLAPACK. The fortran stubs in these libraries are * (mostly, but not completely) in the F2C calling convention. - * We access the libraries via the vecLib framework to make sure we + * We access the libraries via the vecLib framework to make sure we * get the Apple versions, rather than some other blas/lapack with the * same name. */ @@ -57,7 +57,8 @@ #endif /* - * Since this is a wrapper for fortran functions, we do not have prototypes for them. + * Since this is a wrapper for fortran functions, + * we do not have prototypes for them. */ #pragma GCC diagnostic ignored "-Wmissing-prototypes" @@ -69,22 +70,25 @@ * Convert to normal gfortran calling convention */ -static void (*f2c_blas_func[])(void); /* forward declaration for the wrapper */ -static void (*f2c_lapack_func[])(void); /* forward declaration for the wrapper */ +static void (*f2c_blas_func[]) (void); /* forward declaration for wrapper */ +static void (*f2c_lapack_func[]) (void); /* forward declaration for wrapper */ /* * LAPACK Wrappers, only need to convert the return value from double to float */ -typedef double (*F2C_CALL_0)(void); -typedef double (*F2C_CALL_1)(void *a1); -typedef double (*F2C_CALL_2)(void *a1, void *a2); -typedef double (*F2C_CALL_3)(void *a1, void *a2, void *a3); -typedef double (*F2C_CALL_4)(void *a1, void *a2, void *a3, void *a4); -typedef double (*F2C_CALL_5)(void *a1, void *a2, void *a3, void *a4, void *a5); -typedef double (*F2C_CALL_6)(void *a1, void *a2, void *a3, void *a4, void *a5, void *a6); -typedef double (*F2C_CALL_7)(void *a1, void *a2, void *a3, void *a4, void *a5, void *a6, void *a7); -typedef double (*F2C_CALL_8)(void *a1, void *a2, void *a3, void *a4, void *a5, void *a6, void *a7, void *a8); +typedef double (*F2C_CALL_0) (void); +typedef double (*F2C_CALL_1) (void *a1); +typedef double (*F2C_CALL_2) (void *a1, void *a2); +typedef double (*F2C_CALL_3) (void *a1, void *a2, void *a3); +typedef double (*F2C_CALL_4) (void *a1, void *a2, void *a3, void *a4); +typedef double (*F2C_CALL_5) (void *a1, void *a2, void *a3, void *a4, void *a5); +typedef double (*F2C_CALL_6) (void *a1, void *a2, void *a3, void *a4, void *a5, + void *a6); +typedef double (*F2C_CALL_7) (void *a1, void *a2, void *a3, void *a4, void *a5, + void *a6, void *a7); +typedef double (*F2C_CALL_8) (void *a1, void *a2, void *a3, void *a4, void *a5, + void *a6, void *a7, void *a8); #define F2C_LAPACK_CALL_8(name) \ float name (void *a1, void *a2, void *a3, void *a4, void *a5, void *a6, void *a7, void *a8) \ @@ -234,7 +238,8 @@ typedef struct { float r, i; } complex; typedef struct { double r, i; } doublecomplex; -typedef void (*F2C_BLAS_CALL_6)(void *c, void *a1, void *a2, void *a3, void *a4, void *a5); +typedef void (*F2C_BLAS_CALL_6) (void *c, void *a1, void *a2, void *a3, + void *a4, void *a5); #define F2C_BLAS_CALL(type, name) \ type name (void *a1, void *a2, void *a3, void *a4, void *a5) \ @@ -253,8 +258,8 @@ /* * Function pointer arrays, indexed by the enums */ -static void (*f2c_blas_func[f2c_BLAS_COUNT])(void) = { 0 }; -static void (*f2c_lapack_func[f2c_LAPACK_COUNT])(void) = { 0 }; +static void (*f2c_blas_func[f2c_BLAS_COUNT]) (void) = { 0 }; +static void (*f2c_lapack_func[f2c_LAPACK_COUNT]) (void) = { 0 }; /* * Initialization: This is called before main (). @@ -272,11 +277,11 @@ int i; for (i = 0; i < f2c_LAPACK_COUNT; i++) - if (0 == (f2c_lapack_func[i] = dlsym(apple_vecLib, f2c_lapack_name(i)))) - abort (); + if (0 == (f2c_lapack_func[i] = dlsym (apple_vecLib, f2c_lapack_name(i)))) + abort (); for (i = 0; i < f2c_BLAS_COUNT; i++) - if (0 == (f2c_blas_func[i] = dlsym(apple_vecLib, f2c_blas_name(i)))) - abort (); + if (0 == (f2c_blas_func[i] = dlsym (apple_vecLib, f2c_blas_name(i)))) + abort (); } __attribute__((destructor))
--- a/liboctave/cruft/misc/quit.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/cruft/misc/quit.cc Sat Oct 26 18:57:05 2013 -0700 @@ -60,7 +60,7 @@ void octave_throw_execution_exception (void) { - // FIXME -- would a hook function be useful here? + // FIXME: would a hook function be useful here? octave_exception_state = octave_exec_exception;
--- a/liboctave/numeric/CmplxCHOL.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxCHOL.cc Sat Oct 26 18:57:05 2013 -0700 @@ -338,7 +338,8 @@ else { info = init (chol_mat.hermitian () * chol_mat - - ComplexMatrix (u) * ComplexMatrix (u).hermitian (), false); + - ComplexMatrix (u) * ComplexMatrix (u).hermitian (), + false); if (info) info = 1; } }
--- a/liboctave/numeric/CmplxCHOL.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxCHOL.h Sat Oct 26 18:57:05 2013 -0700 @@ -39,30 +39,30 @@ ComplexCHOL (const ComplexMatrix& a, bool calc_cond = false) : chol_mat (), xrcond (0) - { - init (a, calc_cond); - } + { + init (a, calc_cond); + } ComplexCHOL (const ComplexMatrix& a, octave_idx_type& info, bool calc_cond = false) : chol_mat (), xrcond (0) - { - info = init (a, calc_cond); - } + { + info = init (a, calc_cond); + } ComplexCHOL (const ComplexCHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { } ComplexCHOL& operator = (const ComplexCHOL& a) - { - if (this != &a) - { - chol_mat = a.chol_mat; - xrcond = a.xrcond; - } + { + if (this != &a) + { + chol_mat = a.chol_mat; + xrcond = a.xrcond; + } - return *this; - } + return *this; + } ComplexMatrix chol_matrix (void) const { return chol_mat; } @@ -82,7 +82,8 @@ void shift_sym (octave_idx_type i, octave_idx_type j); - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ComplexCHOL& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const ComplexCHOL& a); private:
--- a/liboctave/numeric/CmplxGEPBAL.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxGEPBAL.cc Sat Oct 26 18:57:05 2013 -0700 @@ -60,13 +60,14 @@ octave_idx_type ComplexGEPBALANCE::init (const ComplexMatrix& a, const ComplexMatrix& b, - const std::string& balance_job) + const std::string& balance_job) { octave_idx_type n = a.cols (); if (a.rows () != n) { - (*current_liboctave_error_handler) ("ComplexGEPBALANCE requires square matrix"); + (*current_liboctave_error_handler) + ("ComplexGEPBALANCE requires square matrix"); return -1; }
--- a/liboctave/numeric/CmplxGEPBAL.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxGEPBAL.h Sat Oct 26 18:57:05 2013 -0700 @@ -37,30 +37,30 @@ ComplexGEPBALANCE (void) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () - { } + { } ComplexGEPBALANCE (const ComplexMatrix& a, const ComplexMatrix& b, const std::string& balance_job) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () - { - init (a, b, balance_job); - } + { + init (a, b, balance_job); + } ComplexGEPBALANCE (const ComplexGEPBALANCE& a) : balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) { } ComplexGEPBALANCE& operator = (const ComplexGEPBALANCE& a) - { - if (this != &a) - { - balanced_mat = a.balanced_mat; - balanced_mat2 = a.balanced_mat2; - balancing_mat = a.balancing_mat; - balancing_mat2 = a.balancing_mat2; - } - return *this; - } + { + if (this != &a) + { + balanced_mat = a.balanced_mat; + balanced_mat2 = a.balanced_mat2; + balancing_mat = a.balancing_mat; + balancing_mat2 = a.balancing_mat2; + } + return *this; + } ~ComplexGEPBALANCE (void) { } @@ -72,7 +72,8 @@ Matrix balancing_matrix2 (void) const { return balancing_mat2; } - friend std::ostream& operator << (std::ostream& os, const ComplexGEPBALANCE& a); + friend std::ostream& operator << (std::ostream& os, + const ComplexGEPBALANCE& a); private:
--- a/liboctave/numeric/CmplxHESS.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxHESS.h Sat Oct 26 18:57:05 2013 -0700 @@ -37,37 +37,37 @@ ComplexHESS (const ComplexMatrix& a) : hess_mat (), unitary_hess_mat () - { - init (a); - } + { + init (a); + } ComplexHESS (const ComplexMatrix& a, octave_idx_type& info) : hess_mat (), unitary_hess_mat () - { - info = init (a); - } + { + info = init (a); + } ComplexHESS (const ComplexHESS& a) : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } ComplexHESS& operator = (const ComplexHESS& a) - { - if (this != &a) - { - hess_mat = a.hess_mat; - unitary_hess_mat = a.unitary_hess_mat; - } - return *this; - } + { + if (this != &a) + { + hess_mat = a.hess_mat; + unitary_hess_mat = a.unitary_hess_mat; + } + return *this; + } ~ComplexHESS (void) { } ComplexMatrix hess_matrix (void) const { return hess_mat; } ComplexMatrix unitary_hess_matrix (void) const - { - return unitary_hess_mat; - } + { + return unitary_hess_mat; + } friend std::ostream& operator << (std::ostream& os, const ComplexHESS& a);
--- a/liboctave/numeric/CmplxLU.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxLU.cc Sat Oct 26 18:57:05 2013 -0700 @@ -85,7 +85,8 @@ #ifdef HAVE_QRUPDATE_LUU -void ComplexLU::update (const ComplexColumnVector& u, const ComplexColumnVector& v) +void ComplexLU::update (const ComplexColumnVector& u, + const ComplexColumnVector& v) { if (packed ()) unpack (); @@ -124,7 +125,8 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { ComplexColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (zlu1up, ZLU1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, + F77_XFCN (zlu1up, ZLU1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, utmp.fortran_vec (), vtmp.fortran_vec ())); } } @@ -132,7 +134,8 @@ (*current_liboctave_error_handler) ("luupdate: dimensions mismatch"); } -void ComplexLU::update_piv (const ComplexColumnVector& u, const ComplexColumnVector& v) +void ComplexLU::update_piv (const ComplexColumnVector& u, + const ComplexColumnVector& v) { if (packed ()) unpack (); @@ -149,8 +152,10 @@ ComplexColumnVector utmp = u, vtmp = v; OCTAVE_LOCAL_BUFFER (Complex, w, m); for (octave_idx_type i = 0; i < m; i++) ipvt(i) += 1; // increment - F77_XFCN (zlup1up, ZLUP1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, - ipvt.fortran_vec (), utmp.data (), vtmp.data (), w)); + F77_XFCN (zlup1up, ZLUP1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, + ipvt.fortran_vec (), + utmp.data (), vtmp.data (), w)); for (octave_idx_type i = 0; i < m; i++) ipvt(i) -= 1; // decrement } else @@ -176,8 +181,10 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { ComplexColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (zlup1up, ZLUP1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, - ipvt.fortran_vec (), utmp.data (), vtmp.data (), w)); + F77_XFCN (zlup1up, ZLUP1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, + ipvt.fortran_vec (), + utmp.data (), vtmp.data (), w)); } for (octave_idx_type i = 0; i < m; i++) ipvt(i) -= 1; // decrement } @@ -189,22 +196,27 @@ void ComplexLU::update (const ComplexColumnVector&, const ComplexColumnVector&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } void ComplexLU::update (const ComplexMatrix&, const ComplexMatrix&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } -void ComplexLU::update_piv (const ComplexColumnVector&, const ComplexColumnVector&) +void ComplexLU::update_piv (const ComplexColumnVector&, + const ComplexColumnVector&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } void ComplexLU::update_piv (const ComplexMatrix&, const ComplexMatrix&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } #endif
--- a/liboctave/numeric/CmplxLU.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxLU.h Sat Oct 26 18:57:05 2013 -0700 @@ -46,12 +46,12 @@ : base_lu <ComplexMatrix> (l, u, p) { } ComplexLU& operator = (const ComplexLU& a) - { - if (this != &a) - base_lu <ComplexMatrix> :: operator = (a); + { + if (this != &a) + base_lu <ComplexMatrix> :: operator = (a); - return *this; - } + return *this; + } ~ComplexLU (void) { }
--- a/liboctave/numeric/CmplxQR.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxQR.cc Sat Oct 26 18:57:05 2013 -0700 @@ -120,13 +120,15 @@ { // workspace query. Complex clwork; - F77_XFCN (zgeqrf, ZGEQRF, (m, n, afact.fortran_vec (), m, tau, &clwork, -1, info)); + F77_XFCN (zgeqrf, ZGEQRF, (m, n, afact.fortran_vec (), m, tau, + &clwork, -1, info)); // allocate buffer and do the job. octave_idx_type lwork = clwork.real (); lwork = std::max (lwork, static_cast<octave_idx_type> (1)); OCTAVE_LOCAL_BUFFER (Complex, work, lwork); - F77_XFCN (zgeqrf, ZGEQRF, (m, n, afact.fortran_vec (), m, tau, work, lwork, info)); + F77_XFCN (zgeqrf, ZGEQRF, (m, n, afact.fortran_vec (), m, tau, + work, lwork, info)); } form (n, afact, tau, qr_type); @@ -163,7 +165,7 @@ octave_idx_type i = 0; for (; i <= j; i++) r.xelem (i, j) = afact.xelem (i, j); - for (;i < k; i++) + for (; i < k; i++) r.xelem (i, j) = 0; } afact = ComplexMatrix (); // optimize memory @@ -214,8 +216,10 @@ ComplexColumnVector utmp = u, vtmp = v; OCTAVE_LOCAL_BUFFER (Complex, w, k); OCTAVE_LOCAL_BUFFER (double, rw, k); - F77_XFCN (zqr1up, ZQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k, - utmp.fortran_vec (), vtmp.fortran_vec (), w, rw)); + F77_XFCN (zqr1up, ZQR1UP, (m, n, k, q.fortran_vec (), + m, r.fortran_vec (), k, + utmp.fortran_vec (), vtmp.fortran_vec (), + w, rw)); } else (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); @@ -235,8 +239,10 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { ComplexColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (zqr1up, ZQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k, - utmp.fortran_vec (), vtmp.fortran_vec (), w, rw)); + F77_XFCN (zqr1up, ZQR1UP, (m, n, k, q.fortran_vec (), + m, r.fortran_vec (), k, + utmp.fortran_vec (), vtmp.fortran_vec (), + w, rw)); } } else @@ -373,7 +379,8 @@ octave_idx_type ii = i; F77_XFCN (zqrdec, ZQRDEC, (m, n - ii, k == m ? k : k - ii, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), js(ii) + 1, rw)); + r.fortran_vec (), r.rows (), + js(ii) + 1, rw)); } if (k < m) { @@ -469,7 +476,8 @@ if (u.length () == m && v.length () == n) { - init (q*r + ComplexMatrix (u) * ComplexMatrix (v).hermitian (), get_type ()); + init (q*r + ComplexMatrix (u) * ComplexMatrix (v).hermitian (), + get_type ()); } else (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
--- a/liboctave/numeric/CmplxQRP.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxQRP.cc Sat Oct 26 18:57:05 2013 -0700 @@ -75,15 +75,17 @@ // workspace query. Complex clwork; - F77_XFCN (zgeqp3, ZGEQP3, (m, n, afact.fortran_vec (), m, jpvt.fortran_vec (), - tau, &clwork, -1, rwork, info)); + F77_XFCN (zgeqp3, ZGEQP3, (m, n, afact.fortran_vec (), + m, jpvt.fortran_vec (), tau, + &clwork, -1, rwork, info)); // allocate buffer and do the job. octave_idx_type lwork = clwork.real (); lwork = std::max (lwork, static_cast<octave_idx_type> (1)); OCTAVE_LOCAL_BUFFER (Complex, work, lwork); - F77_XFCN (zgeqp3, ZGEQP3, (m, n, afact.fortran_vec (), m, jpvt.fortran_vec (), - tau, work, lwork, rwork, info)); + F77_XFCN (zgeqp3, ZGEQP3, (m, n, afact.fortran_vec (), + m, jpvt.fortran_vec (), tau, + work, lwork, rwork, info)); } else for (octave_idx_type i = 0; i < n; i++) jpvt(i) = i+1;
--- a/liboctave/numeric/CmplxQRP.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxQRP.h Sat Oct 26 18:57:05 2013 -0700 @@ -42,14 +42,14 @@ ComplexQRP (const ComplexQRP& a) : ComplexQR (a), p (a.p) { } ComplexQRP& operator = (const ComplexQRP& a) - { - if (this != &a) - { - ComplexQR::operator = (a); - p = a.p; - } - return *this; - } + { + if (this != &a) + { + ComplexQR::operator = (a); + p = a.p; + } + return *this; + } ~ComplexQRP (void) { }
--- a/liboctave/numeric/CmplxSCHUR.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxSCHUR.h Sat Oct 26 18:57:05 2013 -0700 @@ -40,35 +40,35 @@ ComplexSCHUR (const ComplexMatrix& a, const std::string& ord, bool calc_unitary = true) : schur_mat (), unitary_mat (), selector (0) - { - init (a, ord, calc_unitary); - } + { + init (a, ord, calc_unitary); + } ComplexSCHUR (const ComplexMatrix& a, const std::string& ord, octave_idx_type& info, bool calc_unitary = true) : schur_mat (), unitary_mat (), selector (0) - { - info = init (a, ord, calc_unitary); - } + { + info = init (a, ord, calc_unitary); + } ComplexSCHUR (const ComplexSCHUR& a) : schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) - { } + { } ComplexSCHUR (const ComplexMatrix& s, const ComplexMatrix& u); ComplexSCHUR (const SCHUR& s); ComplexSCHUR& operator = (const ComplexSCHUR& a) - { - if (this != &a) - { - schur_mat = a.schur_mat; - unitary_mat = a.unitary_mat; - } - return *this; - } + { + if (this != &a) + { + schur_mat = a.schur_mat; + unitary_mat = a.unitary_mat; + } + return *this; + } ~ComplexSCHUR (void) { } @@ -87,7 +87,8 @@ select_function selector; - octave_idx_type init (const ComplexMatrix& a, const std::string& ord, bool calc_unitary); + octave_idx_type init (const ComplexMatrix& a, const std::string& ord, + bool calc_unitary); }; #endif
--- a/liboctave/numeric/CmplxSVD.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxSVD.cc Sat Oct 26 18:57:05 2013 -0700 @@ -80,7 +80,8 @@ } octave_idx_type -ComplexSVD::init (const ComplexMatrix& a, SVD::type svd_type, SVD::driver svd_driver) +ComplexSVD::init (const ComplexMatrix& a, SVD::type svd_type, + SVD::driver svd_driver) { octave_idx_type info;
--- a/liboctave/numeric/CmplxSVD.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CmplxSVD.h Sat Oct 26 18:57:05 2013 -0700 @@ -37,39 +37,39 @@ ComplexSVD (void) : type_computed (), sigma (), left_sm (), right_sm () - { } + { } ComplexSVD (const ComplexMatrix& a, SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () - { - init (a, svd_type, svd_driver); - } + { + init (a, svd_type, svd_driver); + } ComplexSVD (const ComplexMatrix& a, octave_idx_type& info, SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () - { - info = init (a, svd_type, svd_driver); - } + { + info = init (a, svd_type, svd_driver); + } ComplexSVD (const ComplexSVD& a) : type_computed (a.type_computed), sigma (a.sigma), left_sm (a.left_sm), right_sm (a.right_sm) - { } + { } ComplexSVD& operator = (const ComplexSVD& a) - { - if (this != &a) - { - type_computed = a.type_computed; - sigma = a.sigma; - left_sm = a.left_sm; - right_sm = a.right_sm; - } - return *this; - } + { + if (this != &a) + { + type_computed = a.type_computed; + sigma = a.sigma; + left_sm = a.left_sm; + right_sm = a.right_sm; + } + return *this; + } ~ComplexSVD (void) { }
--- a/liboctave/numeric/CollocWt.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/CollocWt.h Sat Oct 26 18:57:05 2013 -0700 @@ -54,7 +54,7 @@ CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il, octave_idx_type ir, - double ll, double rr) + double ll, double rr) : n (nc), inc_left (il), inc_right (ir), lb (ll), rb (rr), Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { } @@ -65,77 +65,77 @@ initialized (a.initialized) { } CollocWt& operator = (const CollocWt& a) - { - if (this != &a) - { - n = a.n; - inc_left = a.inc_left; - inc_right = a.inc_right; - lb = a.lb; - rb = a.rb; - r = a.r; - q = a.q; - A = a.A; - B = a.B; - initialized = a.initialized; - } - return *this; - } + { + if (this != &a) + { + n = a.n; + inc_left = a.inc_left; + inc_right = a.inc_right; + lb = a.lb; + rb = a.rb; + r = a.r; + q = a.q; + A = a.A; + B = a.B; + initialized = a.initialized; + } + return *this; + } ~CollocWt (void) { } CollocWt& resize (octave_idx_type nc) - { - n = nc; - initialized = false; - return *this; - } + { + n = nc; + initialized = false; + return *this; + } CollocWt& add_left (void) - { - inc_left = 1; - initialized = false; - return *this; - } + { + inc_left = 1; + initialized = false; + return *this; + } CollocWt& delete_left (void) - { - inc_left = 0; - initialized = false; - return *this; - } + { + inc_left = 0; + initialized = false; + return *this; + } CollocWt& set_left (double val); CollocWt& add_right (void) - { - inc_right = 1; - initialized = false; - return *this; - } + { + inc_right = 1; + initialized = false; + return *this; + } CollocWt& delete_right (void) - { - inc_right = 0; - initialized = false; - return *this; - } + { + inc_right = 0; + initialized = false; + return *this; + } CollocWt& set_right (double val); CollocWt& set_alpha (double val) - { - Alpha = val; - initialized = false; - return *this; - } + { + Alpha = val; + initialized = false; + return *this; + } CollocWt& set_beta (double val) - { - Beta = val; - initialized = false; - return *this; - } + { + Beta = val; + initialized = false; + return *this; + } octave_idx_type ncol (void) const { return n; }
--- a/liboctave/numeric/DAE.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/DAE.h Sat Oct 26 18:57:05 2013 -0700 @@ -43,17 +43,17 @@ : base_diff_alg_eqn (xx, xxdot, tt), DAEFunc (f) { } DAE (const DAE& a) - : base_diff_alg_eqn (a), DAEFunc (a){ } + : base_diff_alg_eqn (a), DAEFunc (a) { } DAE& operator = (const DAE& a) - { - if (this != &a) - { - base_diff_alg_eqn::operator = (a); - DAEFunc::operator = (a); - } - return *this; - } + { + if (this != &a) + { + base_diff_alg_eqn::operator = (a); + DAEFunc::operator = (a); + } + return *this; + } virtual ~DAE (void) { } };
--- a/liboctave/numeric/DAEFunc.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/DAEFunc.h Sat Oct 26 18:57:05 2013 -0700 @@ -56,35 +56,35 @@ : fun (a.fun), jac (a.jac), reset (a.reset) { } DAEFunc& operator = (const DAEFunc& a) - { - if (this != &a) - { - fun = a.fun; - jac = a.jac; - reset = a.reset; - } - return *this; - } + { + if (this != &a) + { + fun = a.fun; + jac = a.jac; + reset = a.reset; + } + return *this; + } virtual ~DAEFunc (void) { } DAERHSFunc function (void) const { return fun; } DAEFunc& set_function (DAERHSFunc f) - { - fun = f; - reset = true; - return *this; - } + { + fun = f; + reset = true; + return *this; + } DAEJacFunc jacobian_function (void) const { return jac; } DAEFunc& set_jacobian_function (DAEJacFunc j) - { - jac = j; - reset = true; - return *this; - } + { + jac = j; + reset = true; + return *this; + } protected:
--- a/liboctave/numeric/DAERT.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/DAERT.h Sat Oct 26 18:57:05 2013 -0700 @@ -39,30 +39,30 @@ : base_diff_alg_eqn (xx, tt), DAERTFunc (f) { } DAERT (const ColumnVector& xx, const ColumnVector& xxdot, double tt, - DAERTFunc& f) + DAERTFunc& f) : base_diff_alg_eqn (xx, xxdot, tt), DAERTFunc (f) { } DAERT (const DAERT& a) : base_diff_alg_eqn (a), DAERTFunc (a) { } DAERT& operator = (const DAERT& a) - { - if (this != &a) - { - base_diff_alg_eqn::operator = (a); - DAERTFunc::operator = (a); + { + if (this != &a) + { + base_diff_alg_eqn::operator = (a); + DAERTFunc::operator = (a); - } - return *this; - } + } + return *this; + } virtual ~DAERT (void) { } void initialize (const ColumnVector& xx, const ColumnVector& xxdot, double tt) - { - base_diff_alg_eqn::initialize (xx, xxdot, tt); - } + { + base_diff_alg_eqn::initialize (xx, xxdot, tt); + } }; #endif
--- a/liboctave/numeric/DAERTFunc.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/DAERTFunc.h Sat Oct 26 18:57:05 2013 -0700 @@ -51,26 +51,26 @@ : DAEFunc (a), constr (a.constr), reset (a.reset) { } DAERTFunc& operator = (const DAERTFunc& a) - { - if (this != &a) - { - DAEFunc::operator = (a); - constr = a.constr; - reset = a.reset; - } - return *this; - } + { + if (this != &a) + { + DAEFunc::operator = (a); + constr = a.constr; + reset = a.reset; + } + return *this; + } virtual ~DAERTFunc (void) { } DAERTConstrFunc constraint_function (void) const { return constr; } DAERTFunc& set_constraint_function (DAERTConstrFunc cf) - { - constr = cf; - reset = true; - return *this; - } + { + constr = cf; + reset = true; + return *this; + } protected:
--- a/liboctave/numeric/DASPK.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/DASPK.cc Sat Oct 26 18:57:05 2013 -0700 @@ -130,7 +130,7 @@ { BEGIN_INTERRUPT_WITH_EXCEPTIONS; - // FIXME -- would be nice to avoid copying the data. + // FIXME: would be nice to avoid copying the data. ColumnVector tmp_state (nn); ColumnVector tmp_deriv (nn); @@ -155,7 +155,7 @@ ColumnVector DASPK::do_integrate (double tout) { - // FIXME -- should handle all this option stuff just once + // FIXME: should handle all this option stuff just once // for each new problem. ColumnVector retval; @@ -343,7 +343,7 @@ { if (ccic == 1) { - // FIXME -- this code is duplicated below. + // FIXME: this code is duplicated below. Array<octave_idx_type> av = algebraic_variables (); @@ -383,7 +383,7 @@ { info(15) = 1; - // FIXME -- this code is duplicated above. + // FIXME: this code is duplicated above. Array<octave_idx_type> av = algebraic_variables (); @@ -710,7 +710,7 @@ case -1: retval = std::string ("a large amount of work has been expended (t =") - + t_curr + ")"; + + t_curr + ")"; break; case -2: @@ -719,38 +719,38 @@ case -3: retval = std::string ("error weight became zero during problem. (t = ") - + t_curr - + "; solution component i vanished, and atol or atol(i) == 0)"; + + t_curr + + "; solution component i vanished, and atol or atol(i) == 0)"; break; case -6: retval = std::string ("repeated error test failures on the last attempted step (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -7: retval = std::string ("the corrector could not converge (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -8: retval = std::string ("the matrix of partial derivatives is singular (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -9: retval = std::string ("the corrector could not converge (t = ") - + t_curr + "; repeated test failures)"; + + t_curr + "; repeated test failures)"; break; case -10: retval = std::string ("corrector could not converge because IRES was -1 (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -11: retval = std::string ("return requested in user-supplied function (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -12: @@ -759,12 +759,12 @@ case -13: retval = std::string ("unrecoverable error encountered inside user's PSOL function (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -14: retval = std::string ("the Krylov linear system solver failed to converge (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -33:
--- a/liboctave/numeric/DASRT.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/DASRT.cc Sat Oct 26 18:57:05 2013 -0700 @@ -106,7 +106,7 @@ { BEGIN_INTERRUPT_WITH_EXCEPTIONS; - // FIXME -- would be nice to avoid copying the data. + // FIXME: would be nice to avoid copying the data. ColumnVector tmp_state (nn); ColumnVector tmp_deriv (nn); @@ -591,7 +591,7 @@ case -1: retval = std::string ("a large amount of work has been expended (t =") - + t_curr + ")"; + + t_curr + ")"; break; case -2: @@ -600,38 +600,38 @@ case -3: retval = std::string ("error weight became zero during problem. (t = ") - + t_curr - + "; solution component i vanished, and atol or atol(i) == 0)"; + + t_curr + + "; solution component i vanished, and atol or atol(i) == 0)"; break; case -6: retval = std::string ("repeated error test failures on the last attempted step (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -7: retval = std::string ("the corrector could not converge (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -8: retval = std::string ("the matrix of partial derivatives is singular (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -9: retval = std::string ("the corrector could not converge (t = ") - + t_curr + "; repeated test failures)"; + + t_curr + "; repeated test failures)"; break; case -10: retval = std::string ("corrector could not converge because IRES was -1 (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -11: retval = std::string ("return requested in user-supplied function (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -12:
--- a/liboctave/numeric/DASRT.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/DASRT.h Sat Oct 26 18:57:05 2013 -0700 @@ -43,15 +43,15 @@ : x (r.x), xdot (r.xdot), t (r.t) { } DASRT_result& operator = (const DASRT_result& r) - { - if (this != &r) - { - x = r.x; - xdot = r.xdot; - t = r.t; - } - return *this; - } + { + if (this != &r) + { + x = r.x; + xdot = r.xdot; + t = r.t; + } + return *this; + } ~DASRT_result (void) { } @@ -76,20 +76,20 @@ : DAERT (), DASRT_options (), initialized (false), liw (0), lrw (0), ng (0), info (), iwork (), jroot (), rwork (), abs_tol (), rel_tol () - { } + { } DASRT (const ColumnVector& s, double tm, DAERTFunc& f) : DAERT (s, tm, f), DASRT_options (), initialized (false), liw (0), lrw (0), ng (0), info (), iwork (), jroot (), rwork (), abs_tol (), rel_tol () - { } + { } DASRT (const ColumnVector& s, const ColumnVector& deriv, double tm, DAERTFunc& f) : DAERT (s, deriv, tm, f), DASRT_options (), initialized (false), liw (0), lrw (0), ng (0), info (), iwork (), jroot (), rwork (), abs_tol (), rel_tol () - { } + { } ~DASRT (void) { }
--- a/liboctave/numeric/DASSL.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/DASSL.cc Sat Oct 26 18:57:05 2013 -0700 @@ -68,7 +68,7 @@ { BEGIN_INTERRUPT_WITH_EXCEPTIONS; - // FIXME -- would be nice to avoid copying the data. + // FIXME: would be nice to avoid copying the data. ColumnVector tmp_deriv (nn); ColumnVector tmp_state (nn); @@ -104,7 +104,7 @@ { BEGIN_INTERRUPT_WITH_EXCEPTIONS; - // FIXME -- would be nice to avoid copying the data. + // FIXME: would be nice to avoid copying the data. ColumnVector tmp_state (nn); ColumnVector tmp_deriv (nn); @@ -521,7 +521,7 @@ case -1: retval = std::string ("a large amount of work has been expended (t =") - + t_curr + ")"; + + t_curr + ")"; break; case -2: @@ -530,38 +530,38 @@ case -3: retval = std::string ("error weight became zero during problem. (t = ") - + t_curr - + "; solution component i vanished, and atol or atol(i) == 0)"; + + t_curr + + "; solution component i vanished, and atol or atol(i) == 0)"; break; case -6: retval = std::string ("repeated error test failures on the last attempted step (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -7: retval = std::string ("the corrector could not converge (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -8: retval = std::string ("the matrix of partial derivatives is singular (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -9: retval = std::string ("the corrector could not converge (t = ") - + t_curr + "; repeated test failures)"; + + t_curr + "; repeated test failures)"; break; case -10: retval = std::string ("corrector could not converge because IRES was -1 (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -11: retval = std::string ("return requested in user-supplied function (t = ") - + t_curr + ")"; + + t_curr + ")"; break; case -12:
--- a/liboctave/numeric/DET.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/DET.h Sat Oct 26 18:57:05 2013 -0700 @@ -35,30 +35,30 @@ base_det (T c = 1, int e = 0) : c2 (), e2 () - { - c2 = xlog2 (c, e2); - e2 += e; - } + { + c2 = xlog2 (c, e2); + e2 += e; + } base_det (T c, double e, double b) : c2 (), e2 () - { - e *= xlog2 (b); - e2 = e; - c *= xexp2 (e - e2); - int f; - c2 = xlog2 (c, f); - e2 += f; - } + { + e *= xlog2 (b); + e2 = e; + c *= xexp2 (e - e2); + int f; + c2 = xlog2 (c, f); + e2 += f; + } base_det (const base_det& a) : c2 (a.c2), e2 (a.e2) { } base_det& operator = (const base_det& a) - { - c2 = a.c2; - e2 = a.e2; - return *this; - } + { + c2 = a.c2; + e2 = a.e2; + return *this; + } T coef (void) const { return c2; } int exp (void) const { return e2; } @@ -69,11 +69,11 @@ base_det square () const { return base_det (c2*c2, e2+e2); } void operator *= (T t) - { - int e; - c2 *= xlog2 (t, e); - e2 += e; - } + { + int e; + c2 *= xlog2 (t, e); + e2 += e; + } private:
--- a/liboctave/numeric/EIG.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/EIG.cc Sat Oct 26 18:57:05 2013 -0700 @@ -791,7 +791,8 @@ } octave_idx_type -EIG::hermitian_init (const ComplexMatrix& a, const ComplexMatrix& b, bool calc_ev) +EIG::hermitian_init (const ComplexMatrix& a, const ComplexMatrix& b, + bool calc_ev) { octave_idx_type n = a.rows (); octave_idx_type nb = b.rows ();
--- a/liboctave/numeric/EIG.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/EIG.h Sat Oct 26 18:57:05 2013 -0700 @@ -33,8 +33,8 @@ OCTAVE_API EIG { -friend class Matrix; -friend class ComplexMatrix; + friend class Matrix; + friend class ComplexMatrix; public: @@ -96,14 +96,14 @@ : lambda (a.lambda), v (a.v) { } EIG& operator = (const EIG& a) - { - if (this != &a) - { - lambda = a.lambda; - v = a.v; - } - return *this; - } + { + if (this != &a) + { + lambda = a.lambda; + v = a.v; + } + return *this; + } ~EIG (void) { }
--- a/liboctave/numeric/LSODE.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/LSODE.cc Sat Oct 26 18:57:05 2013 -0700 @@ -89,7 +89,8 @@ static octave_idx_type lsode_j (const octave_idx_type& neq, const double& time, double *, - const octave_idx_type&, const octave_idx_type&, double *pd, const octave_idx_type& nrowpd) + const octave_idx_type&, const octave_idx_type&, double *pd, + const octave_idx_type& nrowpd) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -336,7 +337,7 @@ case -1: retval = std::string ("excess work on this call (t = ") - + t_curr + "; perhaps wrong integration method)"; + + t_curr + "; perhaps wrong integration method)"; break; case -2: @@ -349,24 +350,24 @@ case -4: retval = std::string ("repeated error test failures (t = ") - + t_curr + "; check all inputs)"; + + t_curr + "; check all inputs)"; break; case -5: retval = std::string ("repeated convergence failures (t = ") - + t_curr - + "; perhaps bad Jacobian supplied or wrong choice of integration method or tolerances)"; + + t_curr + + "; perhaps bad Jacobian supplied or wrong choice of integration method or tolerances)"; break; case -6: retval = std::string ("error weight became zero during problem. (t = ") - + t_curr - + "; solution component i vanished, and atol or atol(i) == 0)"; + + t_curr + + "; solution component i vanished, and atol or atol(i) == 0)"; break; case -13: retval = "return requested in user-supplied function (t = " - + t_curr + ")"; + + t_curr + ")"; break; default:
--- a/liboctave/numeric/ODE.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/ODE.h Sat Oct 26 18:57:05 2013 -0700 @@ -41,14 +41,14 @@ : base_diff_eqn (a), ODEFunc (a) { } ODE& operator = (const ODE& a) - { - if (this != &a) - { - base_diff_eqn::operator = (a); - ODEFunc::operator = (a); - } - return *this; - } + { + if (this != &a) + { + base_diff_eqn::operator = (a); + ODEFunc::operator = (a); + } + return *this; + } virtual ~ODE (void) { } @@ -71,44 +71,44 @@ // Integrate to t from current point. virtual ColumnVector integrate (double tt) - { return do_integrate (tt); } + { return do_integrate (tt); } // Set new x0, t0 and integrate to t. virtual ColumnVector integrate (const ColumnVector& x0, double t0, double tt) - { - initialize (x0, t0); - return do_integrate (tt); - } + { + initialize (x0, t0); + return do_integrate (tt); + } // Integrate from current point and return output at all points // specified by t. virtual Matrix integrate (const ColumnVector& tt) - { return do_integrate (tt); } + { return do_integrate (tt); } // Set new x0, t0 and integrate to return output at all points // specified by t. virtual Matrix integrate (const ColumnVector& x0, double t0, const ColumnVector& tt) - { - initialize (x0, t0); - return do_integrate (tt); - } + { + initialize (x0, t0); + return do_integrate (tt); + } // Integrate from current point and return output at all points // specified by t. virtual Matrix integrate (const ColumnVector& tt, const ColumnVector& ttcrit) - { return do_integrate (tt, ttcrit); } + { return do_integrate (tt, ttcrit); } // Set new x0, t0 and integrate to return output at all points // specified by t. virtual Matrix integrate (const ColumnVector& x0, double t0, const ColumnVector& tt, const ColumnVector& ttcrit) - { - initialize (x0, t0); - return do_integrate (tt, ttcrit); - } + { + initialize (x0, t0); + return do_integrate (tt, ttcrit); + } }; #endif
--- a/liboctave/numeric/ODEFunc.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/ODEFunc.h Sat Oct 26 18:57:05 2013 -0700 @@ -47,35 +47,35 @@ : fun (a.fun), jac (a.jac), reset (true) { } ODEFunc& operator = (const ODEFunc& a) - { - if (this != &a) - { - fun = a.fun; - jac = a.jac; - reset = a.reset; - } - return *this; - } + { + if (this != &a) + { + fun = a.fun; + jac = a.jac; + reset = a.reset; + } + return *this; + } virtual ~ODEFunc (void) { } ODERHSFunc function (void) const { return fun; } ODEFunc& set_function (ODERHSFunc f) - { - fun = f; - reset = true; - return *this; - } + { + fun = f; + reset = true; + return *this; + } ODEJacFunc jacobian_function (void) const { return jac; } ODEFunc& set_jacobian_function (ODEJacFunc j) - { - jac = j; - reset = true; - return *this; - } + { + jac = j; + reset = true; + return *this; + } protected:
--- a/liboctave/numeric/ODES.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/ODES.h Sat Oct 26 18:57:05 2013 -0700 @@ -46,17 +46,17 @@ : base_diff_eqn (a), ODESFunc (a), xdot (a.xdot), theta (a.theta) { } ODES& operator = (const ODES& a) - { - if (this != &a) - { - base_diff_eqn::operator = (a); - ODESFunc::operator = (a); + { + if (this != &a) + { + base_diff_eqn::operator = (a); + ODESFunc::operator = (a); - xdot = a.xdot; - theta = a.theta; - } - return *this; - } + xdot = a.xdot; + theta = a.theta; + } + return *this; + } ~ODES (void) { }
--- a/liboctave/numeric/ODESFunc.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/ODESFunc.h Sat Oct 26 18:57:05 2013 -0700 @@ -31,10 +31,10 @@ public: struct DAEJac - { - Matrix *dfdxdot; - Matrix *dfdx; - }; + { + Matrix *dfdxdot; + Matrix *dfdx; + }; typedef ColumnVector (*ODES_fsub) (const ColumnVector& x, double, const ColumnVector& theta); @@ -61,41 +61,41 @@ : fsub (a.fsub), bsub (a.bsub), jsub (a.jsub) { } ODESFunc& operator = (const ODESFunc& a) - { - if (this != &a) - { - fsub = a.fsub; - bsub = a.bsub; - jsub = a.jsub; - } - return *this; - } + { + if (this != &a) + { + fsub = a.fsub; + bsub = a.bsub; + jsub = a.jsub; + } + return *this; + } virtual ~ODESFunc (void) { } ODES_fsub fsub_function (void) const { return fsub; } ODESFunc& set_fsub_function (ODES_fsub f) - { - fsub = f; - return *this; - } + { + fsub = f; + return *this; + } ODES_bsub bsub_function (void) const { return bsub; } ODESFunc& set_bsub_function (ODES_bsub b) - { - bsub = b; - return *this; - } + { + bsub = b; + return *this; + } ODES_jsub jsub_function (void) const { return jsub; } ODESFunc& set_jsub_function (ODES_jsub j) - { - jsub = j; - return *this; - } + { + jsub = j; + return *this; + } protected:
--- a/liboctave/numeric/Quad.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/Quad.cc Sat Oct 26 18:57:05 2013 -0700 @@ -33,8 +33,7 @@ static integrand_fcn user_fcn; static float_integrand_fcn float_user_fcn; -// FIXME -- would be nice to not have to have this global -// variable. +// FIXME: would be nice to not have to have this global variable. // Nonzero means an error occurred in the calculation of the integrand // function, and the user wants us to quit. int quad_integration_error = 0; @@ -124,7 +123,8 @@ } double -DefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr) +DefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval, + double& abserr) { octave_idx_type npts = singularities.capacity () + 2; double *points = singularities.fortran_vec (); @@ -160,7 +160,8 @@ } double -IndefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr) +IndefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval, + double& abserr) { double result = 0.0; @@ -220,7 +221,8 @@ } float -FloatDefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval, float& abserr) +FloatDefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval, + float& abserr) { octave_idx_type npts = singularities.capacity () + 2; float *points = singularities.fortran_vec (); @@ -256,7 +258,8 @@ } float -FloatIndefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval, float& abserr) +FloatIndefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval, + float& abserr) { float result = 0.0;
--- a/liboctave/numeric/Quad.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/Quad.h Sat Oct 26 18:57:05 2013 -0700 @@ -37,8 +37,7 @@ #endif -// FIXME -- would be nice to not have to have this global -// variable. +// FIXME: would be nice to not have to have this global variable. // Nonzero means an error occurred in the calculation of the integrand // function, and the user wants us to quit. extern OCTAVE_API int quad_integration_error; @@ -49,7 +48,7 @@ OCTAVE_API Quad : public Quad_options { - public: +public: Quad (integrand_fcn fcn) : Quad_options (), f (fcn), ff () { } @@ -60,60 +59,64 @@ virtual ~Quad (void) { } virtual double integrate (void) - { - octave_idx_type ier, neval; - double abserr; - return do_integrate (ier, neval, abserr); - } + { + octave_idx_type ier, neval; + double abserr; + return do_integrate (ier, neval, abserr); + } virtual float float_integrate (void) - { - octave_idx_type ier, neval; - float abserr; - return do_integrate (ier, neval, abserr); - } + { + octave_idx_type ier, neval; + float abserr; + return do_integrate (ier, neval, abserr); + } virtual double integrate (octave_idx_type& ier) - { - octave_idx_type neval; - double abserr; - return do_integrate (ier, neval, abserr); - } + { + octave_idx_type neval; + double abserr; + return do_integrate (ier, neval, abserr); + } virtual float float_integrate (octave_idx_type& ier) - { - octave_idx_type neval; - float abserr; - return do_integrate (ier, neval, abserr); - } + { + octave_idx_type neval; + float abserr; + return do_integrate (ier, neval, abserr); + } virtual double integrate (octave_idx_type& ier, octave_idx_type& neval) - { - double abserr; - return do_integrate (ier, neval, abserr); - } + { + double abserr; + return do_integrate (ier, neval, abserr); + } virtual float float_integrate (octave_idx_type& ier, octave_idx_type& neval) - { - float abserr; - return do_integrate (ier, neval, abserr); - } + { + float abserr; + return do_integrate (ier, neval, abserr); + } - virtual double integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr) - { - return do_integrate (ier, neval, abserr); - } + virtual double integrate (octave_idx_type& ier, octave_idx_type& neval, + double& abserr) + { + return do_integrate (ier, neval, abserr); + } - virtual float float_integrate (octave_idx_type& ier, octave_idx_type& neval, float& abserr) - { - return do_integrate (ier, neval, abserr); - } + virtual float float_integrate (octave_idx_type& ier, octave_idx_type& neval, + float& abserr) + { + return do_integrate (ier, neval, abserr); + } - virtual double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr) = 0; + virtual double do_integrate (octave_idx_type& ier, octave_idx_type& neval, + double& abserr) = 0; - virtual float do_integrate (octave_idx_type& ier, octave_idx_type& neval, float& abserr) = 0; + virtual float do_integrate (octave_idx_type& ier, octave_idx_type& neval, + float& abserr) = 0; - protected: +protected: integrand_fcn f; float_integrand_fcn ff; @@ -123,7 +126,7 @@ OCTAVE_API DefQuad : public Quad { - public: +public: DefQuad (integrand_fcn fcn) : Quad (fcn), lower_limit (0.0), upper_limit (1.0), singularities () { } @@ -142,11 +145,13 @@ ~DefQuad (void) { } - double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr); + double do_integrate (octave_idx_type& ier, octave_idx_type& neval, + double& abserr); - float do_integrate (octave_idx_type& ier, octave_idx_type& neval, float& abserr); + float do_integrate (octave_idx_type& ier, octave_idx_type& neval, + float& abserr); - private: +private: double lower_limit; double upper_limit; @@ -158,7 +163,7 @@ OCTAVE_API IndefQuad : public Quad { - public: +public: enum IntegralType { bound_to_inf, neg_inf_to_bound, doubly_infinite }; @@ -170,11 +175,13 @@ ~IndefQuad (void) { } - double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr); + double do_integrate (octave_idx_type& ier, octave_idx_type& neval, + double& abserr); - float do_integrate (octave_idx_type& ier, octave_idx_type& neval, float& abserr); + float do_integrate (octave_idx_type& ier, octave_idx_type& neval, + float& abserr); - private: +private: double bound; IntegralType type; @@ -185,7 +192,7 @@ OCTAVE_API FloatDefQuad : public Quad { - public: +public: FloatDefQuad (float_integrand_fcn fcn) : Quad (fcn), lower_limit (0.0), upper_limit (1.0), singularities () { } @@ -194,7 +201,7 @@ : Quad (fcn), lower_limit (ll), upper_limit (ul), singularities () { } FloatDefQuad (float_integrand_fcn fcn, float ll, float ul, - const FloatColumnVector& sing) + const FloatColumnVector& sing) : Quad (fcn), lower_limit (ll), upper_limit (ul), singularities (sing) { } @@ -204,11 +211,13 @@ ~FloatDefQuad (void) { } - double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr); + double do_integrate (octave_idx_type& ier, octave_idx_type& neval, + double& abserr); - float do_integrate (octave_idx_type& ier, octave_idx_type& neval, float& abserr); + float do_integrate (octave_idx_type& ier, octave_idx_type& neval, + float& abserr); - private: +private: float lower_limit; float upper_limit; @@ -220,7 +229,7 @@ OCTAVE_API FloatIndefQuad : public Quad { - public: +public: enum IntegralType { bound_to_inf, neg_inf_to_bound, doubly_infinite }; @@ -232,11 +241,13 @@ ~FloatIndefQuad (void) { } - double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr); + double do_integrate (octave_idx_type& ier, octave_idx_type& neval, + double& abserr); - float do_integrate (octave_idx_type& ier, octave_idx_type& neval, float& abserr); + float do_integrate (octave_idx_type& ier, octave_idx_type& neval, + float& abserr); - private: +private: float bound; IntegralType type;
--- a/liboctave/numeric/SparseCmplxCHOL.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/SparseCmplxCHOL.h Sat Oct 26 18:57:05 2013 -0700 @@ -30,66 +30,78 @@ class OCTAVE_API -SparseComplexCHOL : - public sparse_base_chol <SparseComplexMatrix, Complex, SparseMatrix> +SparseComplexCHOL + : public sparse_base_chol <SparseComplexMatrix, Complex, SparseMatrix> { public: - SparseComplexCHOL (void) : - sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> () { } + SparseComplexCHOL (void) + : sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> () { } SparseComplexCHOL (const SparseComplexMatrix& a, bool natural = true, - bool force = false) : - sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> (a, natural, force) { } + bool force = false) + : sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> + (a, natural, force) { } SparseComplexCHOL (const SparseComplexMatrix& a, octave_idx_type& info, - bool natural = true, bool force = false) : - sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> (a, info, natural, force) { } + bool natural = true, bool force = false) + : sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> + (a, info, natural, force) { } - SparseComplexCHOL (const SparseComplexCHOL& a) : - sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> (a) { } + SparseComplexCHOL (const SparseComplexCHOL& a) + : sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix> (a) { } ~SparseComplexCHOL (void) { } SparseComplexCHOL& operator = (const SparseComplexCHOL& a) - { - if (this != &a) - sparse_base_chol <SparseComplexMatrix, Complex, SparseMatrix> :: - operator = (a); + { + if (this != &a) + sparse_base_chol <SparseComplexMatrix, Complex, SparseMatrix> :: + operator = (a); - return *this; - } + return *this; + } SparseComplexMatrix chol_matrix (void) const { return R (); } SparseComplexMatrix L (void) const - { return sparse_base_chol<SparseComplexMatrix, Complex, - SparseMatrix>:: L (); } + { + return sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix>:: L (); + } SparseComplexMatrix R (void) const - { return sparse_base_chol<SparseComplexMatrix, Complex, - SparseMatrix>:: R (); } + { + return sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix>:: R (); + } octave_idx_type P (void) const - { return sparse_base_chol<SparseComplexMatrix, Complex, - SparseMatrix>:: P (); } + { + return sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix>:: P (); + } ColumnVector perm (void) const - { return sparse_base_chol<SparseComplexMatrix, Complex, - SparseMatrix>:: perm (); } + { + return sparse_base_chol<SparseComplexMatrix, Complex, + SparseMatrix>:: perm (); + } SparseMatrix Q (void) const - { return sparse_base_chol<SparseComplexMatrix, Complex, - SparseMatrix>:: Q (); } + { + return sparse_base_chol<SparseComplexMatrix, Complex, SparseMatrix>:: Q (); + } double rcond (void) const - { return sparse_base_chol<SparseComplexMatrix, Complex, - SparseMatrix>:: rcond (); } + { + return sparse_base_chol<SparseComplexMatrix, Complex, + SparseMatrix>:: rcond (); + } // Compute the inverse of a matrix using the Cholesky factorization. SparseComplexMatrix inverse (void) const - { return sparse_base_chol<SparseComplexMatrix, Complex, - SparseMatrix>:: inverse (); } + { + return sparse_base_chol<SparseComplexMatrix, Complex, + SparseMatrix>:: inverse (); + } }; SparseComplexMatrix OCTAVE_API chol2inv (const SparseComplexMatrix& r);
--- a/liboctave/numeric/SparseCmplxLU.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/SparseCmplxLU.cc Sat Oct 26 18:57:05 2013 -0700 @@ -38,7 +38,8 @@ #include "sparse-base-lu.h" #include "sparse-base-lu.cc" -template class sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, double>; +template class sparse_base_lu <SparseComplexMatrix, Complex, + SparseMatrix, double>; #include "oct-sparse.h" @@ -74,7 +75,7 @@ tmp = octave_sparse_params::get_key ("sym_tol"); if (!xisnan (tmp)) - Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp; + Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp; } // Set whether we are allowed to modify Q or not @@ -109,12 +110,12 @@ if (status < 0) { (*current_liboctave_error_handler) - ("SparseComplexLU::SparseComplexLU symbolic factorization failed"); + ("SparseComplexLU::SparseComplexLU symbolic factorization failed"); UMFPACK_ZNAME (report_status) (control, status); UMFPACK_ZNAME (report_info) (control, info); - UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; + UMFPACK_ZNAME (free_symbolic) (&Symbolic); } else { @@ -125,7 +126,7 @@ reinterpret_cast<const double *> (Ax), 0, Symbolic, &Numeric, control, info); - UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; + UMFPACK_ZNAME (free_symbolic) (&Symbolic); cond = Info (UMFPACK_RCOND); @@ -145,7 +146,7 @@ octave_idx_type lnz, unz, ignore1, ignore2, ignore3; status = UMFPACK_ZNAME (get_lunz) (&lnz, &unz, &ignore1, - &ignore2, &ignore3, Numeric) ; + &ignore2, &ignore3, Numeric); if (status < 0) { @@ -204,7 +205,7 @@ 0, p, q, 0, 0, &do_recip, Rx, Numeric); - UMFPACK_ZNAME (free_numeric) (&Numeric) ; + UMFPACK_ZNAME (free_numeric) (&Numeric); if (status < 0) { @@ -222,14 +223,14 @@ Rx[i] = 1.0 / Rx[i]; UMFPACK_ZNAME (report_matrix) (nr, n_inner, - Lfact.cidx (), Lfact.ridx (), - reinterpret_cast<double *> (Lfact.data ()), - 0, 1, control); + Lfact.cidx (), Lfact.ridx (), + reinterpret_cast<double *> (Lfact.data ()), + 0, 1, control); UMFPACK_ZNAME (report_matrix) (n_inner, nc, - Ufact.cidx (), Ufact.ridx (), - reinterpret_cast<double *> (Ufact.data ()), - 0, 1, control); + Ufact.cidx (), Ufact.ridx (), + reinterpret_cast<double *> (Ufact.data ()), + 0, 1, control); UMFPACK_ZNAME (report_perm) (nr, p, control); UMFPACK_ZNAME (report_perm) (nc, q, control); } @@ -312,8 +313,8 @@ const Complex *Ax = a.data (); UMFPACK_ZNAME (report_matrix) (nr, nc, Ap, Ai, - reinterpret_cast<const double *> (Ax), 0, - 1, control); + reinterpret_cast<const double *> (Ax), 0, + 1, control); void *Symbolic; Matrix Info (1, UMFPACK_INFO); @@ -322,17 +323,19 @@ // Null loop so that qinit is imediately deallocated when not // needed - do { - OCTAVE_LOCAL_BUFFER (octave_idx_type, qinit, nc); + do + { + OCTAVE_LOCAL_BUFFER (octave_idx_type, qinit, nc); - for (octave_idx_type i = 0; i < nc; i++) - qinit[i] = static_cast<octave_idx_type> (Qinit (i)); + for (octave_idx_type i = 0; i < nc; i++) + qinit[i] = static_cast<octave_idx_type> (Qinit (i)); - status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, - reinterpret_cast<const double *> (Ax), - 0, qinit, &Symbolic, control, - info); - } while (0); + status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, + reinterpret_cast<const double *> (Ax), + 0, qinit, &Symbolic, control, + info); + } + while (0); if (status < 0) { @@ -342,7 +345,7 @@ UMFPACK_ZNAME (report_status) (control, status); UMFPACK_ZNAME (report_info) (control, info); - UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; + UMFPACK_ZNAME (free_symbolic) (&Symbolic); } else { @@ -350,9 +353,9 @@ void *Numeric; 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); cond = Info (UMFPACK_RCOND); @@ -372,7 +375,8 @@ octave_idx_type lnz, unz, ignore1, ignore2, ignore3; status = UMFPACK_ZNAME (get_lunz) (&lnz, &unz, - &ignore1, &ignore2, &ignore3, Numeric); + &ignore1, &ignore2, &ignore3, + Numeric); if (status < 0) { @@ -390,7 +394,7 @@ if (lnz < 1) Lfact = SparseComplexMatrix (n_inner, nr, - static_cast<octave_idx_type> (1)); + static_cast<octave_idx_type> (1)); else Lfact = SparseComplexMatrix (n_inner, nr, lnz); @@ -400,7 +404,7 @@ if (unz < 1) Ufact = SparseComplexMatrix (n_inner, nc, - static_cast<octave_idx_type> (1)); + static_cast<octave_idx_type> (1)); else Ufact = SparseComplexMatrix (n_inner, nc, unz); @@ -426,13 +430,13 @@ octave_idx_type do_recip; status = UMFPACK_ZNAME (get_numeric) (Ltp, Ltj, - reinterpret_cast<double *> (Ltx), - 0, Up, Uj, - reinterpret_cast<double *> (Ux), - 0, p, q, 0, 0, - &do_recip, Rx, Numeric) ; + reinterpret_cast<double *> (Ltx), + 0, Up, Uj, + reinterpret_cast<double *> (Ux), + 0, p, q, 0, 0, + &do_recip, Rx, Numeric); - UMFPACK_ZNAME (free_numeric) (&Numeric) ; + UMFPACK_ZNAME (free_numeric) (&Numeric); if (status < 0) { @@ -450,16 +454,16 @@ Rx[i] = 1.0 / Rx[i]; UMFPACK_ZNAME (report_matrix) (nr, n_inner, - Lfact.cidx (), - Lfact.ridx (), - reinterpret_cast<double *> (Lfact.data ()), - 0, 1, control); + Lfact.cidx (), + Lfact.ridx (), + reinterpret_cast<double *> (Lfact.data ()), + 0, 1, control); UMFPACK_ZNAME (report_matrix) (n_inner, nc, - Ufact.cidx (), - Ufact.ridx (), - reinterpret_cast<double *> (Ufact.data ()), - 0, 1, control); + Ufact.cidx (), + Ufact.ridx (), + reinterpret_cast<double *> (Ufact.data ()), + 0, 1, control); UMFPACK_ZNAME (report_perm) (nr, p, control); UMFPACK_ZNAME (report_perm) (nc, q, control); }
--- a/liboctave/numeric/SparseCmplxLU.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/SparseCmplxLU.h Sat Oct 26 18:57:05 2013 -0700 @@ -49,16 +49,17 @@ bool udiag = false); SparseComplexLU (const SparseComplexLU& a) - : sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, double> (a) { } + : sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, double> (a) + { } SparseComplexLU& operator = (const SparseComplexLU& a) - { - if (this != &a) - sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, double> - :: operator = (a); + { + if (this != &a) + sparse_base_lu <SparseComplexMatrix, Complex, SparseMatrix, double> + :: operator = (a); - return *this; - } + return *this; + } ~SparseComplexLU (void) { } };
--- a/liboctave/numeric/SparseCmplxQR.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/SparseCmplxQR.cc Sat Oct 26 18:57:05 2013 -0700 @@ -66,7 +66,7 @@ A.p = const_cast<octave_idx_type *>(a.cidx ()); A.i = const_cast<octave_idx_type *>(a.ridx ()); A.x = const_cast<cs_complex_t *>(reinterpret_cast<const cs_complex_t *> - (a.data ())); + (a.data ())); A.nz = -1; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined (CS_VER) && (CS_VER >= 2) @@ -311,8 +311,7 @@ if (! q.ok ()) return ComplexMatrix (); x.resize (nc, b_nc); - cs_complex_t *vec = reinterpret_cast<cs_complex_t *> - (x.fortran_vec ()); + cs_complex_t *vec = reinterpret_cast<cs_complex_t *> (x.fortran_vec ()); OCTAVE_C99_COMPLEX (buf, q.S ()->m2); OCTAVE_LOCAL_BUFFER (Complex, Xx, b_nr); for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc) @@ -356,8 +355,7 @@ if (! q.ok ()) return ComplexMatrix (); x.resize (nc, b_nc); - cs_complex_t *vec = reinterpret_cast<cs_complex_t *> - (x.fortran_vec ()); + cs_complex_t *vec = reinterpret_cast<cs_complex_t *> (x.fortran_vec ()); volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2); OCTAVE_C99_COMPLEX (buf, nbuf); OCTAVE_LOCAL_BUFFER (Complex, Xx, b_nr); @@ -418,7 +416,8 @@ } SparseComplexMatrix -qrsolve (const SparseComplexMatrix&a, const SparseMatrix &b, octave_idx_type &info) +qrsolve (const SparseComplexMatrix&a, const SparseMatrix &b, + octave_idx_type &info) { info = -1; #ifdef HAVE_CXSPARSE @@ -592,7 +591,8 @@ } ComplexMatrix -qrsolve (const SparseComplexMatrix&a, const ComplexMatrix &b, octave_idx_type &info) +qrsolve (const SparseComplexMatrix&a, const ComplexMatrix &b, + octave_idx_type &info) { info = -1; #ifdef HAVE_CXSPARSE @@ -616,7 +616,7 @@ return ComplexMatrix (); x.resize (nc, b_nc); cs_complex_t *vec = reinterpret_cast<cs_complex_t *> - (x.fortran_vec ()); + (x.fortran_vec ()); OCTAVE_C99_COMPLEX (buf, q.S ()->m2); for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc; i++, idx+=nc, bidx+=b_nr) @@ -656,8 +656,7 @@ if (! q.ok ()) return ComplexMatrix (); x.resize (nc, b_nc); - cs_complex_t *vec = reinterpret_cast<cs_complex_t *> - (x.fortran_vec ()); + cs_complex_t *vec = reinterpret_cast<cs_complex_t *> (x.fortran_vec ()); volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2); OCTAVE_C99_COMPLEX (buf, nbuf); #if defined (CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) @@ -713,7 +712,8 @@ } SparseComplexMatrix -qrsolve (const SparseComplexMatrix&a, const SparseComplexMatrix &b, octave_idx_type &info) +qrsolve (const SparseComplexMatrix&a, const SparseComplexMatrix &b, + octave_idx_type &info) { info = -1; #ifdef HAVE_CXSPARSE
--- a/liboctave/numeric/SparseCmplxQR.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/SparseCmplxQR.h Sat Oct 26 18:57:05 2013 -0700 @@ -95,23 +95,23 @@ SparseComplexQR (const SparseComplexQR& a) : rep (a.rep) { rep->count++; } ~SparseComplexQR (void) - { - if (--rep->count == 0) - delete rep; - } + { + if (--rep->count == 0) + delete rep; + } SparseComplexQR& operator = (const SparseComplexQR& a) - { - if (this != &a) - { - if (--rep->count == 0) - delete rep; + { + if (this != &a) + { + if (--rep->count == 0) + delete rep; - rep = a.rep; - rep->count++; - } - return *this; - } + rep = a.rep; + rep->count++; + } + return *this; + } bool ok (void) const { return rep->ok (); } @@ -122,7 +122,7 @@ ColumnVector P (void) const { return rep->P (); } SparseComplexMatrix R (const bool econ = false) const - { return rep->R(econ); } + { return rep->R(econ); } ComplexMatrix C (const ComplexMatrix &b) const { return rep->C(b); }
--- a/liboctave/numeric/SparseQR.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/SparseQR.cc Sat Oct 26 18:57:05 2013 -0700 @@ -693,7 +693,8 @@ } SparseComplexMatrix -qrsolve (const SparseMatrix&a, const SparseComplexMatrix &b, octave_idx_type &info) +qrsolve (const SparseMatrix&a, const SparseComplexMatrix &b, + octave_idx_type &info) { info = -1; #ifdef HAVE_CXSPARSE
--- a/liboctave/numeric/SparseQR.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/SparseQR.h Sat Oct 26 18:57:05 2013 -0700 @@ -97,23 +97,23 @@ SparseQR (const SparseQR& a) : rep (a.rep) { rep->count++; } ~SparseQR (void) - { - if (--rep->count == 0) - delete rep; - } + { + if (--rep->count == 0) + delete rep; + } SparseQR& operator = (const SparseQR& a) - { - if (this != &a) - { - if (--rep->count == 0) - delete rep; + { + if (this != &a) + { + if (--rep->count == 0) + delete rep; - rep = a.rep; - rep->count++; - } - return *this; - } + rep = a.rep; + rep->count++; + } + return *this; + } bool ok (void) const { return rep->ok (); } @@ -133,7 +133,7 @@ octave_idx_type &info); friend SparseMatrix qrsolve (const SparseMatrix &a, const SparseMatrix &b, - octave_idx_type &info); + octave_idx_type &info); friend ComplexMatrix qrsolve (const SparseMatrix &a, const ComplexMatrix &b, octave_idx_type &info);
--- a/liboctave/numeric/SparsedbleCHOL.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/SparsedbleCHOL.h Sat Oct 26 18:57:05 2013 -0700 @@ -33,14 +33,18 @@ { public: - SparseCHOL (void) : sparse_base_chol<SparseMatrix, double, SparseMatrix> () { } + SparseCHOL (void) : sparse_base_chol<SparseMatrix, double, SparseMatrix> () + { } - SparseCHOL (const SparseMatrix& a, bool natural = true, bool force = false) : - sparse_base_chol<SparseMatrix, double, SparseMatrix> (a, natural, force) { } + SparseCHOL (const SparseMatrix& a, bool natural = true, bool force = false) + : sparse_base_chol<SparseMatrix, double, SparseMatrix> (a, natural, force) + { } SparseCHOL (const SparseMatrix& a, octave_idx_type& info, - bool natural = false, bool force = false) : - sparse_base_chol<SparseMatrix, double, SparseMatrix> (a, info, natural, force) { } + bool natural = false, bool force = false) + : sparse_base_chol<SparseMatrix, double, SparseMatrix> (a, info, natural, + force) + { } SparseCHOL (const SparseCHOL& a) : sparse_base_chol<SparseMatrix, double, SparseMatrix> (a) { } @@ -48,12 +52,12 @@ ~SparseCHOL (void) { } SparseCHOL& operator = (const SparseCHOL& a) - { - if (this != &a) - sparse_base_chol <SparseMatrix, double, SparseMatrix> :: operator = (a); + { + if (this != &a) + sparse_base_chol <SparseMatrix, double, SparseMatrix> :: operator = (a); - return *this; - } + return *this; + } SparseMatrix chol_matrix (void) const { return R (); } @@ -61,24 +65,25 @@ { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: L (); } SparseMatrix R (void) const - { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: R (); } + { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: R (); } octave_idx_type P (void) const - { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: P (); } + { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: P (); } ColumnVector perm (void) const - { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: perm (); } + { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: perm (); } SparseMatrix Q (void) const - { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: Q (); } + { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: Q (); } double rcond (void) const - { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: rcond (); } + { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: rcond (); } // Compute the inverse of a matrix using the Cholesky factorization. SparseMatrix inverse (void) const - { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: - inverse (); } + { + return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: inverse (); + } }; SparseMatrix OCTAVE_API chol2inv (const SparseMatrix& r);
--- a/liboctave/numeric/SparsedbleLU.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/SparsedbleLU.cc Sat Oct 26 18:57:05 2013 -0700 @@ -74,7 +74,7 @@ tmp = octave_sparse_params::get_key ("sym_tol"); if (!xisnan (tmp)) - Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp; + Control (UMFPACK_SYM_PIVOT_TOLERANCE) = tmp; } // Set whether we are allowed to modify Q or not @@ -99,12 +99,12 @@ Matrix Info (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) { (*current_liboctave_error_handler) - ("SparseLU::SparseLU symbolic factorization failed"); + ("SparseLU::SparseLU symbolic factorization failed"); UMFPACK_DNAME (report_status) (control, status); UMFPACK_DNAME (report_info) (control, info); @@ -117,7 +117,7 @@ void *Numeric; status = UMFPACK_DNAME (numeric) (Ap, Ai, Ax, Symbolic, - &Numeric, control, info) ; + &Numeric, control, info) ; UMFPACK_DNAME (free_symbolic) (&Symbolic) ; cond = Info (UMFPACK_RCOND); @@ -138,7 +138,7 @@ octave_idx_type lnz, unz, ignore1, ignore2, ignore3; status = UMFPACK_DNAME (get_lunz) (&lnz, &unz, &ignore1, - &ignore2, &ignore3, Numeric) ; + &ignore2, &ignore3, Numeric) ; if (status < 0) { @@ -191,9 +191,9 @@ octave_idx_type do_recip; status = UMFPACK_DNAME (get_numeric) (Ltp, Ltj, Ltx, - Up, Uj, Ux, p, q, 0, - &do_recip, Rx, - Numeric) ; + Up, Uj, Ux, p, q, 0, + &do_recip, Rx, + Numeric) ; UMFPACK_DNAME (free_numeric) (&Numeric) ; @@ -213,11 +213,11 @@ Rx[i] = 1.0 / Rx[i]; UMFPACK_DNAME (report_matrix) (nr, n_inner, - Lfact.cidx (), Lfact.ridx (), - Lfact.data (), 1, control); + Lfact.cidx (), Lfact.ridx (), + Lfact.data (), 1, control); UMFPACK_DNAME (report_matrix) (n_inner, nc, - Ufact.cidx (), Ufact.ridx (), - Ufact.data (), 1, control); + Ufact.cidx (), Ufact.ridx (), + Ufact.data (), 1, control); UMFPACK_DNAME (report_perm) (nr, p, control); UMFPACK_DNAME (report_perm) (nc, q, control); } @@ -299,7 +299,7 @@ const double *Ax = a.data (); UMFPACK_DNAME (report_matrix) (nr, nc, Ap, Ai, Ax, 1, - control); + control); void *Symbolic; Matrix Info (1, UMFPACK_INFO); @@ -307,15 +307,17 @@ int status; // Null loop so that qinit is imediately deallocated when not needed - do { - OCTAVE_LOCAL_BUFFER (octave_idx_type, qinit, nc); + do + { + OCTAVE_LOCAL_BUFFER (octave_idx_type, qinit, nc); - for (octave_idx_type i = 0; i < nc; i++) - qinit[i] = static_cast<octave_idx_type> (Qinit (i)); + for (octave_idx_type i = 0; i < nc; i++) + qinit[i] = static_cast<octave_idx_type> (Qinit (i)); - status = UMFPACK_DNAME (qsymbolic) (nr, nc, Ap, Ai, Ax, - qinit, &Symbolic, control, info); - } while (0); + status = UMFPACK_DNAME (qsymbolic) (nr, nc, Ap, Ai, Ax, + qinit, &Symbolic, control, info); + } + while (0); if (status < 0) { @@ -333,7 +335,7 @@ void *Numeric; status = UMFPACK_DNAME (numeric) (Ap, Ai, Ax, Symbolic, - &Numeric, control, info) ; + &Numeric, control, info) ; UMFPACK_DNAME (free_symbolic) (&Symbolic) ; cond = Info (UMFPACK_RCOND); @@ -353,8 +355,9 @@ UMFPACK_DNAME (report_numeric) (Numeric, control); octave_idx_type lnz, unz, ignore1, ignore2, ignore3; - status = UMFPACK_DNAME (get_lunz) (&lnz, &unz, &ignore1, &ignore2, - &ignore3, Numeric) ; + status = UMFPACK_DNAME (get_lunz) (&lnz, &unz, + &ignore1, &ignore2, &ignore3, + Numeric) ; if (status < 0) { @@ -407,9 +410,9 @@ octave_idx_type do_recip; status = UMFPACK_DNAME (get_numeric) (Ltp, Ltj, - Ltx, Up, Uj, Ux, p, q, - 0, &do_recip, - Rx, Numeric) ; + Ltx, Up, Uj, Ux, p, q, + 0, &do_recip, + Rx, Numeric) ; UMFPACK_DNAME (free_numeric) (&Numeric) ; @@ -429,15 +432,15 @@ Rx[i] = 1.0 / Rx[i]; UMFPACK_DNAME (report_matrix) (nr, n_inner, - Lfact.cidx (), - Lfact.ridx (), - Lfact.data (), - 1, control); + Lfact.cidx (), + Lfact.ridx (), + Lfact.data (), + 1, control); UMFPACK_DNAME (report_matrix) (n_inner, nc, - Ufact.cidx (), - Ufact.ridx (), - Ufact.data (), - 1, control); + Ufact.cidx (), + Ufact.ridx (), + Ufact.data (), + 1, control); UMFPACK_DNAME (report_perm) (nr, p, control); UMFPACK_DNAME (report_perm) (nc, q, control); }
--- a/liboctave/numeric/SparsedbleLU.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/SparsedbleLU.h Sat Oct 26 18:57:05 2013 -0700 @@ -48,13 +48,13 @@ : sparse_base_lu <SparseMatrix, double, SparseMatrix, double> (a) { } SparseLU& operator = (const SparseLU& a) - { - if (this != &a) - sparse_base_lu <SparseMatrix, double, SparseMatrix, double> - :: operator = (a); + { + if (this != &a) + sparse_base_lu <SparseMatrix, double, SparseMatrix, double> + :: operator = (a); - return *this; - } + return *this; + } ~SparseLU (void) { } };
--- a/liboctave/numeric/base-aepbal.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/base-aepbal.h Sat Oct 26 18:57:05 2013 -0700 @@ -43,52 +43,52 @@ } base_aepbal& operator = (const base_aepbal& a) - { - balanced_mat = a.balanced_mat; - scale = a.scale; - ilo = a.ilo; - ihi = a.ihi; - job = a.job; - return *this; - } + { + balanced_mat = a.balanced_mat; + scale = a.scale; + ilo = a.ilo; + ihi = a.ihi; + job = a.job; + return *this; + } virtual ~base_aepbal (void) { } MatrixT balanced_matrix (void) const { return balanced_mat; } VectorT permuting_vector (void) const - { - octave_idx_type n = balanced_mat.rows (); - VectorT pv (n); - for (octave_idx_type i = 0; i < n; i++) - pv(i) = i+1; - for (octave_idx_type i = n-1; i >= ihi; i--) - { - octave_idx_type j = scale(i) - 1; - std::swap (pv(i), pv(j)); - } - for (octave_idx_type i = 0; i < ilo-1; i++) - { - octave_idx_type j = scale(i) - 1; - std::swap (pv(i), pv(j)); - } + { + octave_idx_type n = balanced_mat.rows (); + VectorT pv (n); + for (octave_idx_type i = 0; i < n; i++) + pv(i) = i+1; + for (octave_idx_type i = n-1; i >= ihi; i--) + { + octave_idx_type j = scale(i) - 1; + std::swap (pv(i), pv(j)); + } + for (octave_idx_type i = 0; i < ilo-1; i++) + { + octave_idx_type j = scale(i) - 1; + std::swap (pv(i), pv(j)); + } - return pv; - } + return pv; + } VectorT scaling_vector (void) const - { - octave_idx_type n = balanced_mat.rows (); - VectorT scv (n); - for (octave_idx_type i = 0; i < ilo-1; i++) - scv(i) = 1; - for (octave_idx_type i = ilo-1; i < ihi; i++) - scv(i) = scale(i); - for (octave_idx_type i = ihi; i < n; i++) - scv(i) = 1; + { + octave_idx_type n = balanced_mat.rows (); + VectorT scv (n); + for (octave_idx_type i = 0; i < ilo-1; i++) + scv(i) = 1; + for (octave_idx_type i = ilo-1; i < ihi; i++) + scv(i) = scale(i); + for (octave_idx_type i = ihi; i < n; i++) + scv(i) = 1; - return scv; - } + return scv; + } }; #endif
--- a/liboctave/numeric/base-dae.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/base-dae.h Sat Oct 26 18:57:05 2013 -0700 @@ -46,27 +46,27 @@ virtual ~base_diff_alg_eqn (void) { } base_diff_alg_eqn& operator = (const base_diff_alg_eqn& a) - { - if (this != &a) - { - base_diff_eqn::operator = (a); - xdot = a.xdot; - } - return *this; - } + { + if (this != &a) + { + base_diff_eqn::operator = (a); + xdot = a.xdot; + } + return *this; + } void initialize (const ColumnVector& x0, double t0) - { - base_diff_eqn::initialize (x0, t0); - xdot = ColumnVector (x0.length (), 0.0); - } + { + base_diff_eqn::initialize (x0, t0); + xdot = ColumnVector (x0.length (), 0.0); + } void initialize (const ColumnVector& x0, const ColumnVector& xdot0, double t0) - { - base_diff_eqn::initialize (x0, t0); - xdot = xdot0; - } + { + base_diff_eqn::initialize (x0, t0); + xdot = xdot0; + } ColumnVector state_derivative (void) { return xdot; }
--- a/liboctave/numeric/base-de.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/base-de.h Sat Oct 26 18:57:05 2013 -0700 @@ -48,29 +48,29 @@ virtual ~base_diff_eqn (void) { } base_diff_eqn& operator = (const base_diff_eqn& a) - { - if (this != &a) - { - x = a.x; - t = a.t; - stop_time = a.stop_time; - stop_time_set = a.stop_time_set; - restart = a.restart; - integration_error = a.integration_error; - istate = a.istate; - } + { + if (this != &a) + { + x = a.x; + t = a.t; + stop_time = a.stop_time; + stop_time_set = a.stop_time_set; + restart = a.restart; + integration_error = a.integration_error; + istate = a.istate; + } - return *this; - } + return *this; + } void initialize (const ColumnVector& x0, double t0) - { - x = x0; - t = t0; - integration_error = false; - istate = 0; - force_restart (); - } + { + x = x0; + t = t0; + integration_error = false; + istate = 0; + force_restart (); + } octave_idx_type size (void) const { return x.capacity (); } @@ -79,17 +79,17 @@ double time (void) const { return t; } void set_stop_time (double tt) - { - stop_time_set = true; - stop_time = tt; - force_restart (); - } + { + stop_time_set = true; + stop_time = tt; + force_restart (); + } void clear_stop_time (void) - { - stop_time_set = false; - force_restart (); - } + { + stop_time_set = false; + force_restart (); + } virtual void force_restart (void) { restart = true; }
--- a/liboctave/numeric/base-lu.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/base-lu.cc Sat Oct 26 18:57:05 2013 -0700 @@ -111,7 +111,8 @@ base_lu <lu_type> :: Y (void) const { if (! packed ()) - (*current_liboctave_error_handler) ("lu: Y () not implemented for unpacked form"); + (*current_liboctave_error_handler) + ("lu: Y () not implemented for unpacked form"); return a_fact; }
--- a/liboctave/numeric/base-lu.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/base-lu.h Sat Oct 26 18:57:05 2013 -0700 @@ -46,15 +46,15 @@ const PermMatrix& p); base_lu& operator = (const base_lu& a) - { - if (this != &a) - { - a_fact = a.a_fact; - l_fact = a.l_fact; - ipvt = a.ipvt; - } - return *this; - } + { + if (this != &a) + { + a_fact = a.a_fact; + l_fact = a.l_fact; + ipvt = a.ipvt; + } + return *this; + } virtual ~base_lu (void) { }
--- a/liboctave/numeric/base-min.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/base-min.h Sat Oct 26 18:57:05 2013 -0700 @@ -39,12 +39,12 @@ virtual ~base_minimizer (void) { } base_minimizer& operator = (const base_minimizer& a) - { - if (this != &a) - x = a.x; + { + if (this != &a) + x = a.x; - return *this; - } + return *this; + } // Derived classes must provide a function to actually do the // minimization. @@ -56,63 +56,63 @@ // get additional information. virtual ColumnVector minimize (void) - { - double objf; - octave_idx_type inform; - ColumnVector lambda; - return do_minimize (objf, inform, lambda); - } + { + double objf; + octave_idx_type inform; + ColumnVector lambda; + return do_minimize (objf, inform, lambda); + } virtual ColumnVector minimize (double& objf) - { - octave_idx_type inform; - ColumnVector lambda; - return do_minimize (objf, inform, lambda); - } + { + octave_idx_type inform; + ColumnVector lambda; + return do_minimize (objf, inform, lambda); + } virtual ColumnVector minimize (double& objf, octave_idx_type& inform) - { - ColumnVector lambda; - return do_minimize (objf, inform, lambda); - } + { + ColumnVector lambda; + return do_minimize (objf, inform, lambda); + } virtual ColumnVector minimize (double& objf, octave_idx_type& inform, ColumnVector& lambda) - { - return do_minimize (objf, inform, lambda); - } + { + return do_minimize (objf, inform, lambda); + } virtual ColumnVector minimize (const ColumnVector& x0) - { - x = x0; - double objf; - octave_idx_type inform; - ColumnVector lambda; - return do_minimize (objf, inform, lambda); - } + { + x = x0; + double objf; + octave_idx_type inform; + ColumnVector lambda; + return do_minimize (objf, inform, lambda); + } virtual ColumnVector minimize (const ColumnVector& x0, double& objf) - { - x = x0; - octave_idx_type inform; - ColumnVector lambda; - return do_minimize (objf, inform, lambda); - } + { + x = x0; + octave_idx_type inform; + ColumnVector lambda; + return do_minimize (objf, inform, lambda); + } virtual ColumnVector minimize (const ColumnVector& x0, double& objf, octave_idx_type& inform) - { - x = x0; - ColumnVector lambda; - return do_minimize (objf, inform, lambda); - } + { + x = x0; + ColumnVector lambda; + return do_minimize (objf, inform, lambda); + } virtual ColumnVector minimize (const ColumnVector& x0, double& objf, octave_idx_type& inform, ColumnVector& lambda) - { - x = x0; - return do_minimize (objf, inform, lambda); - } + { + x = x0; + return do_minimize (objf, inform, lambda); + } octave_idx_type size (void) const { return x.capacity (); }
--- a/liboctave/numeric/base-qr.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/base-qr.h Sat Oct 26 18:57:05 2013 -0700 @@ -49,14 +49,14 @@ base_qr (const base_qr& a) : q (a.q), r (a.r) { } base_qr& operator = (const base_qr& a) - { - if (this != &a) - { - q = a.q; - r = a.r; - } - return *this; - } + { + if (this != &a) + { + q = a.q; + r = a.r; + } + return *this; + } virtual ~base_qr (void) { }
--- a/liboctave/numeric/bsxfun.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/bsxfun.h Sat Oct 26 18:57:05 2013 -0700 @@ -45,7 +45,8 @@ } (*current_liboctave_warning_with_id_handler) - ("Octave:broadcast", "%s: automatic broadcasting operation applied", name.c_str ()); + ("Octave:broadcast", "%s: automatic broadcasting operation applied", + name.c_str ()); return true; } @@ -72,7 +73,8 @@ } (*current_liboctave_warning_with_id_handler) - ("Octave:broadcast", "%s: automatic broadcasting operation applied", name.c_str ()); + ("Octave:broadcast", "%s: automatic broadcasting operation applied", + name.c_str ()); return true; }
--- a/liboctave/numeric/dbleCHOL.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleCHOL.cc Sat Oct 26 18:57:05 2013 -0700 @@ -342,7 +342,7 @@ else { info = init (chol_mat.transpose () * chol_mat - - Matrix (u) * Matrix (u).transpose (), false); + - Matrix (u) * Matrix (u).transpose (), false); if (info) info = 1; } }
--- a/liboctave/numeric/dbleCHOL.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleCHOL.h Sat Oct 26 18:57:05 2013 -0700 @@ -39,27 +39,27 @@ CHOL (const Matrix& a, bool calc_cond = false) : chol_mat (), xrcond (0) - { - init (a, calc_cond); - } + { + init (a, calc_cond); + } CHOL (const Matrix& a, octave_idx_type& info, bool calc_cond = false) : chol_mat (), xrcond (0) - { - info = init (a, calc_cond); - } + { + info = init (a, calc_cond); + } CHOL (const CHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { } CHOL& operator = (const CHOL& a) - { - if (this != &a) - { - chol_mat = a.chol_mat; - xrcond = a.xrcond; - } - return *this; - } + { + if (this != &a) + { + chol_mat = a.chol_mat; + xrcond = a.xrcond; + } + return *this; + } Matrix chol_matrix (void) const { return chol_mat; }
--- a/liboctave/numeric/dbleGEPBAL.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleGEPBAL.h Sat Oct 26 18:57:05 2013 -0700 @@ -36,30 +36,30 @@ GEPBALANCE (void) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () - { } + { } GEPBALANCE (const Matrix& a, const Matrix& b, const std::string& balance_job) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () - { - init (a, b, balance_job); - } + { + init (a, b, balance_job); + } GEPBALANCE (const GEPBALANCE& a) : balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) - { } + { } GEPBALANCE& operator = (const GEPBALANCE& a) - { - if (this != &a) - { - balanced_mat = a.balanced_mat; - balanced_mat2 = a.balanced_mat2; - balancing_mat = a.balancing_mat; - balancing_mat2 = a.balancing_mat2; - } - return *this; - } + { + if (this != &a) + { + balanced_mat = a.balanced_mat; + balanced_mat2 = a.balanced_mat2; + balancing_mat = a.balancing_mat; + balancing_mat2 = a.balancing_mat2; + } + return *this; + } ~GEPBALANCE (void) { }
--- a/liboctave/numeric/dbleHESS.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleHESS.h Sat Oct 26 18:57:05 2013 -0700 @@ -39,22 +39,22 @@ HESS (const Matrix& a, octave_idx_type& info) : hess_mat (), unitary_hess_mat () - { - info = init (a); - } + { + info = init (a); + } HESS (const HESS& a) : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } HESS& operator = (const HESS& a) - { - if (this != &a) - { - hess_mat = a.hess_mat; - unitary_hess_mat = a.unitary_hess_mat; - } - return *this; - } + { + if (this != &a) + { + hess_mat = a.hess_mat; + unitary_hess_mat = a.unitary_hess_mat; + } + return *this; + } ~HESS (void) { }
--- a/liboctave/numeric/dbleLU.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleLU.cc Sat Oct 26 18:57:05 2013 -0700 @@ -124,7 +124,8 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { ColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (dlu1up, DLU1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, + F77_XFCN (dlu1up, DLU1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, utmp.fortran_vec (), vtmp.fortran_vec ())); } } @@ -149,8 +150,10 @@ ColumnVector utmp = u, vtmp = v; OCTAVE_LOCAL_BUFFER (double, w, m); for (octave_idx_type i = 0; i < m; i++) ipvt(i) += 1; // increment - F77_XFCN (dlup1up, DLUP1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, - ipvt.fortran_vec (), utmp.data (), vtmp.data (), w)); + F77_XFCN (dlup1up, DLUP1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, + ipvt.fortran_vec (), + utmp.data (), vtmp.data (), w)); for (octave_idx_type i = 0; i < m; i++) ipvt(i) -= 1; // decrement } else @@ -176,8 +179,10 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { ColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (dlup1up, DLUP1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, - ipvt.fortran_vec (), utmp.data (), vtmp.data (), w)); + F77_XFCN (dlup1up, DLUP1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, + ipvt.fortran_vec (), + utmp.data (), vtmp.data (), w)); } for (octave_idx_type i = 0; i < m; i++) ipvt(i) -= 1; // decrement } @@ -189,22 +194,26 @@ void LU::update (const ColumnVector&, const ColumnVector&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } void LU::update (const Matrix&, const Matrix&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } void LU::update_piv (const ColumnVector&, const ColumnVector&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } void LU::update_piv (const Matrix&, const Matrix&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } #endif
--- a/liboctave/numeric/dbleLU.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleLU.h Sat Oct 26 18:57:05 2013 -0700 @@ -42,12 +42,12 @@ : base_lu <Matrix> (l, u, p) { } LU& operator = (const LU& a) - { - if (this != &a) - base_lu <Matrix> :: operator = (a); + { + if (this != &a) + base_lu <Matrix> :: operator = (a); - return *this; - } + return *this; + } ~LU (void) { }
--- a/liboctave/numeric/dbleQR.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleQR.cc Sat Oct 26 18:57:05 2013 -0700 @@ -121,13 +121,15 @@ { // workspace query. double rlwork; - F77_XFCN (dgeqrf, DGEQRF, (m, n, afact.fortran_vec (), m, tau, &rlwork, -1, info)); + F77_XFCN (dgeqrf, DGEQRF, (m, n, afact.fortran_vec (), m, tau, + &rlwork, -1, info)); // allocate buffer and do the job. octave_idx_type lwork = rlwork; lwork = std::max (lwork, static_cast<octave_idx_type> (1)); OCTAVE_LOCAL_BUFFER (double, work, lwork); - F77_XFCN (dgeqrf, DGEQRF, (m, n, afact.fortran_vec (), m, tau, work, lwork, info)); + F77_XFCN (dgeqrf, DGEQRF, (m, n, afact.fortran_vec (), m, tau, + work, lwork, info)); } form (n, afact, tau, qr_type); @@ -164,7 +166,7 @@ octave_idx_type i = 0; for (; i <= j; i++) r.xelem (i, j) = afact.xelem (i, j); - for (;i < k; i++) + for (; i < k; i++) r.xelem (i, j) = 0; } afact = Matrix (); // optimize memory @@ -214,7 +216,8 @@ { ColumnVector utmp = u, vtmp = v; OCTAVE_LOCAL_BUFFER (double, w, 2*k); - F77_XFCN (dqr1up, DQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k, + F77_XFCN (dqr1up, DQR1UP, (m, n, k, q.fortran_vec (), + m, r.fortran_vec (), k, utmp.fortran_vec (), vtmp.fortran_vec (), w)); } else @@ -234,8 +237,10 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { ColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (dqr1up, DQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k, - utmp.fortran_vec (), vtmp.fortran_vec (), w)); + F77_XFCN (dqr1up, DQR1UP, (m, n, k, q.fortran_vec (), + m, r.fortran_vec (), k, + utmp.fortran_vec (), vtmp.fortran_vec (), + w)); } } else @@ -372,7 +377,8 @@ octave_idx_type ii = i; F77_XFCN (dqrdec, DQRDEC, (m, n - ii, k == m ? k : k - ii, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), js(ii) + 1, w)); + r.fortran_vec (), r.rows (), + js(ii) + 1, w)); } if (k < m) { @@ -490,7 +496,7 @@ static Matrix insert_col (const Matrix& a, octave_idx_type i, - const ColumnVector& x) + const ColumnVector& x) { Matrix retval (a.rows (), a.columns () + 1); retval.assign (idx_vector::colon, idx_vector (0, i), @@ -503,7 +509,7 @@ static Matrix insert_row (const Matrix& a, octave_idx_type i, - const RowVector& x) + const RowVector& x) { Matrix retval (a.rows () + 1, a.columns ()); retval.assign (idx_vector (0, i), idx_vector::colon, @@ -532,7 +538,7 @@ static Matrix shift_cols (const Matrix& a, - octave_idx_type i, octave_idx_type j) + octave_idx_type i, octave_idx_type j) { octave_idx_type n = a.columns (); Array<octave_idx_type> p (n);
--- a/liboctave/numeric/dbleQRP.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleQRP.cc Sat Oct 26 18:57:05 2013 -0700 @@ -72,15 +72,17 @@ { // workspace query. double rlwork; - F77_XFCN (dgeqp3, DGEQP3, (m, n, afact.fortran_vec (), m, jpvt.fortran_vec (), - tau, &rlwork, -1, info)); + F77_XFCN (dgeqp3, DGEQP3, (m, n, afact.fortran_vec (), + m, jpvt.fortran_vec (), tau, + &rlwork, -1, info)); // allocate buffer and do the job. octave_idx_type lwork = rlwork; lwork = std::max (lwork, static_cast<octave_idx_type> (1)); OCTAVE_LOCAL_BUFFER (double, work, lwork); - F77_XFCN (dgeqp3, DGEQP3, (m, n, afact.fortran_vec (), m, jpvt.fortran_vec (), - tau, work, lwork, info)); + F77_XFCN (dgeqp3, DGEQP3, (m, n, afact.fortran_vec (), + m, jpvt.fortran_vec (), tau, + work, lwork, info)); } else for (octave_idx_type i = 0; i < n; i++) jpvt(i) = i+1;
--- a/liboctave/numeric/dbleQRP.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleQRP.h Sat Oct 26 18:57:05 2013 -0700 @@ -42,15 +42,15 @@ QRP (const QRP& a) : QR (a), p (a.p) { } QRP& operator = (const QRP& a) - { - if (this != &a) - { - QR::operator = (a); - p = a.p; - } + { + if (this != &a) + { + QR::operator = (a); + p = a.p; + } - return *this; - } + return *this; + } ~QRP (void) { }
--- a/liboctave/numeric/dbleSCHUR.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleSCHUR.cc Sat Oct 26 18:57:05 2013 -0700 @@ -51,7 +51,7 @@ static octave_idx_type select_ana (const double& a, const double&) { - return (a < 0.0); + return (a < 0.0); } static octave_idx_type
--- a/liboctave/numeric/dbleSCHUR.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleSCHUR.h Sat Oct 26 18:57:05 2013 -0700 @@ -38,32 +38,32 @@ SCHUR (const Matrix& a, const std::string& ord, bool calc_unitary = true) : schur_mat (), unitary_mat (), selector (0) - { - init (a, ord, calc_unitary); - } + { + init (a, ord, calc_unitary); + } SCHUR (const Matrix& a, const std::string& ord, int& info, bool calc_unitary = true) : schur_mat (), unitary_mat (), selector (0) - { - info = init (a, ord, calc_unitary); - } + { + info = init (a, ord, calc_unitary); + } SCHUR (const SCHUR& a) : schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) - { } + { } SCHUR (const Matrix& s, const Matrix& u); SCHUR& operator = (const SCHUR& a) - { - if (this != &a) - { - schur_mat = a.schur_mat; - unitary_mat = a.unitary_mat; - } - return *this; - } + { + if (this != &a) + { + schur_mat = a.schur_mat; + unitary_mat = a.unitary_mat; + } + return *this; + } ~SCHUR (void) { } @@ -82,7 +82,8 @@ select_function selector; - octave_idx_type init (const Matrix& a, const std::string& ord, bool calc_unitary); + octave_idx_type init (const Matrix& a, const std::string& ord, + bool calc_unitary); }; #endif
--- a/liboctave/numeric/dbleSVD.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleSVD.cc Sat Oct 26 18:57:05 2013 -0700 @@ -178,16 +178,16 @@ OCTAVE_LOCAL_BUFFER (octave_idx_type, iwork, 8*min_mn); F77_XFCN (dgesdd, DGESDD, (F77_CONST_CHAR_ARG2 (&jobz, 1), - m, n, tmp_data, m1, s_vec, u, m1, vt, - nrow_vt1, work.fortran_vec (), lwork, iwork, info + m, n, tmp_data, m1, s_vec, u, m1, vt, nrow_vt1, + work.fortran_vec (), lwork, iwork, info F77_CHAR_ARG_LEN (1))); lwork = static_cast<octave_idx_type> (work(0)); work.resize (dim_vector (lwork, 1)); F77_XFCN (dgesdd, DGESDD, (F77_CONST_CHAR_ARG2 (&jobz, 1), - m, n, tmp_data, m1, s_vec, u, m1, vt, - nrow_vt1, work.fortran_vec (), lwork, iwork, info + m, n, tmp_data, m1, s_vec, u, m1, vt, nrow_vt1, + work.fortran_vec (), lwork, iwork, info F77_CHAR_ARG_LEN (1))); }
--- a/liboctave/numeric/dbleSVD.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/dbleSVD.h Sat Oct 26 18:57:05 2013 -0700 @@ -35,51 +35,51 @@ public: enum type - { - std, - economy, - sigma_only - }; + { + std, + economy, + sigma_only + }; enum driver - { - GESVD, - GESDD - }; + { + GESVD, + GESDD + }; SVD (void) : type_computed (), sigma (), left_sm (), right_sm () { } SVD (const Matrix& a, type svd_type = SVD::std, driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () - { - init (a, svd_type, svd_driver); - } + { + init (a, svd_type, svd_driver); + } SVD (const Matrix& a, octave_idx_type& info, type svd_type = SVD::std, driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () - { - info = init (a, svd_type, svd_driver); - } + { + info = init (a, svd_type, svd_driver); + } SVD (const SVD& a) : type_computed (a.type_computed), sigma (a.sigma), left_sm (a.left_sm), right_sm (a.right_sm) - { } + { } SVD& operator = (const SVD& a) - { - if (this != &a) - { - type_computed = a.type_computed; - sigma = a.sigma; - left_sm = a.left_sm; - right_sm = a.right_sm; - } + { + if (this != &a) + { + type_computed = a.type_computed; + sigma = a.sigma; + left_sm = a.left_sm; + right_sm = a.right_sm; + } - return *this; - } + return *this; + } ~SVD (void) { }
--- a/liboctave/numeric/eigs-base.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/eigs-base.cc Sat Oct 26 18:57:05 2013 -0700 @@ -155,9 +155,11 @@ F77_RET_T F77_FUNC (zgemv, ZGEMV) (F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, const octave_idx_type&, const Complex&, - const Complex*, const octave_idx_type&, const Complex*, - const octave_idx_type&, const Complex&, Complex*, const octave_idx_type& + const octave_idx_type&, const octave_idx_type&, + const Complex&, const Complex*, + const octave_idx_type&, const Complex*, + const octave_idx_type&, const Complex&, Complex*, + const octave_idx_type& F77_CHAR_ARG_LEN_DECL); } @@ -179,7 +181,7 @@ static ComplexMatrix ltsolve (const SparseComplexMatrix&, const ColumnVector&, - const ComplexMatrix&); + const ComplexMatrix&); static Matrix ltsolve (const SparseMatrix&, const ColumnVector&, const Matrix&,); @@ -307,7 +309,7 @@ static bool vector_product (const SparseComplexMatrix& m, const Complex* x, - Complex* y) + Complex* y) { octave_idx_type nc = m.cols (); @@ -446,11 +448,11 @@ tmp.xcidx (n) = n; AminusSigmaB = AminusSigmaB - sigma * tmp * - b.transpose () * b * tmp.transpose (); + b.transpose () * b * tmp.transpose (); } else AminusSigmaB = AminusSigmaB - sigma * - b.transpose () * b; + b.transpose () * b; } else AminusSigmaB = AminusSigmaB - sigma * b; @@ -459,18 +461,18 @@ { SparseMatrix sigmat (n, n, n); - // Create sigma * speye (n,n) - sigmat.xcidx (0) = 0; - for (octave_idx_type i = 0; i < n; i++) - { - sigmat.xdata (i) = sigma; - sigmat.xridx (i) = i; - sigmat.xcidx (i+1) = i + 1; - } - - AminusSigmaB = AminusSigmaB - sigmat; + // Create sigma * speye (n,n) + sigmat.xcidx (0) = 0; + for (octave_idx_type i = 0; i < n; i++) + { + sigmat.xdata (i) = sigma; + sigmat.xridx (i) = i; + sigmat.xcidx (i+1) = i + 1; } + AminusSigmaB = AminusSigmaB - sigmat; + } + SparseLU fact (AminusSigmaB); L = fact.L (); @@ -621,7 +623,7 @@ tmp.xcidx (n) = n; AminusSigmaB = AminusSigmaB - tmp * b.hermitian () * b * - tmp.transpose () * sigma; + tmp.transpose () * sigma; } else AminusSigmaB = AminusSigmaB - sigma * b.hermitian () * b; @@ -956,8 +958,8 @@ if (iter++) { os << "Iteration " << iter - 1 << - ": a few Ritz values of the " << p << "-by-" << - p << " matrix\n"; + ": a few Ritz values of the " << p << "-by-" << + p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; } @@ -1140,7 +1142,7 @@ { (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1-1).\n" - " Use 'eig (full (A))' instead"); + " Use 'eig (full (A))' instead"); return -1; } @@ -1249,8 +1251,8 @@ if (iter++) { os << "Iteration " << iter - 1 << - ": a few Ritz values of the " << p << "-by-" << - p << " matrix\n"; + ": a few Ritz values of the " << p << "-by-" << + p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; } @@ -1460,7 +1462,7 @@ { (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n" - " Use 'eig (full (A))' instead"); + " Use 'eig (full (A))' instead"); return -1; } @@ -1550,8 +1552,8 @@ if (iter++) { os << "Iteration " << iter - 1 << - ": a few Ritz values of the " << p << "-by-" << - p << " matrix\n"; + ": a few Ritz values of the " << p << "-by-" << + p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; } @@ -1870,8 +1872,8 @@ if (iter++) { os << "Iteration " << iter - 1 << - ": a few Ritz values of the " << p << "-by-" << - p << " matrix\n"; + ": a few Ritz values of the " << p << "-by-" << + p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; } @@ -1927,7 +1929,7 @@ Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); - // FIXME -- initialize eig_vec2 to zero; apparently dneupd can skip + // FIXME: initialize eig_vec2 to zero; apparently dneupd can skip // the assignment to elements of Z that represent imaginary parts. // Found with valgrind and // @@ -2114,7 +2116,7 @@ { (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n" - " Use 'eig (full (A))' instead"); + " Use 'eig (full (A))' instead"); return -1; } @@ -2212,8 +2214,8 @@ if (iter++) { os << "Iteration " << iter - 1 << - ": a few Ritz values of the " << p << "-by-" << - p << " matrix\n"; + ": a few Ritz values of the " << p << "-by-" << + p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; } @@ -2313,7 +2315,7 @@ Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); - // FIXME -- initialize eig_vec2 to zero; apparently dneupd can skip + // FIXME: initialize eig_vec2 to zero; apparently dneupd can skip // the assignment to elements of Z that represent imaginary parts. // Found with valgrind and // @@ -2477,7 +2479,7 @@ { (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n" - " Use 'eig (full (A))' instead"); + " Use 'eig (full (A))' instead"); return -1; } @@ -2568,8 +2570,8 @@ if (iter++) { os << "Iteration " << iter - 1 << - ": a few Ritz values of the " << p << "-by-" << - p << " matrix\n"; + ": a few Ritz values of the " << p << "-by-" << + p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; } @@ -2625,7 +2627,7 @@ Array<octave_idx_type> s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); - // FIXME -- initialize eig_vec2 to zero; apparently dneupd can skip + // FIXME: initialize eig_vec2 to zero; apparently dneupd can skip // the assignment to elements of Z that represent imaginary parts. // Found with valgrind and // @@ -2939,8 +2941,8 @@ if (iter++) { os << "Iteration " << iter - 1 << - ": a few Ritz values of the " << p << "-by-" << - p << " matrix\n"; + ": a few Ritz values of the " << p << "-by-" << + p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; } @@ -3134,7 +3136,7 @@ { (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n" - " Use 'eig (full (A))' instead"); + " Use 'eig (full (A))' instead"); return -1; } @@ -3233,8 +3235,8 @@ if (iter++) { os << "Iteration " << iter - 1 << - ": a few Ritz values of the " << p << "-by-" << - p << " matrix\n"; + ": a few Ritz values of the " << p << "-by-" << + p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; } @@ -3451,7 +3453,7 @@ { (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n" - " Use 'eig (full (A))' instead"); + " Use 'eig (full (A))' instead"); return -1; } @@ -3542,8 +3544,8 @@ if (iter++) { os << "Iteration " << iter - 1 << - ": a few Ritz values of the " << p << "-by-" << - p << " matrix\n"; + ": a few Ritz values of the " << p << "-by-" << + p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; }
--- a/liboctave/numeric/fCmplxAEPBAL.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxAEPBAL.cc Sat Oct 26 18:57:05 2013 -0700 @@ -53,7 +53,7 @@ FloatComplexAEPBALANCE::FloatComplexAEPBALANCE (const FloatComplexMatrix& a, bool noperm, bool noscal) - : base_aepbal<FloatComplexMatrix, FloatColumnVector> () + : base_aepbal<FloatComplexMatrix, FloatColumnVector> () { octave_idx_type n = a.cols ();
--- a/liboctave/numeric/fCmplxAEPBAL.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxAEPBAL.h Sat Oct 26 18:57:05 2013 -0700 @@ -33,11 +33,13 @@ class OCTAVE_API -FloatComplexAEPBALANCE : public base_aepbal<FloatComplexMatrix, FloatColumnVector> +FloatComplexAEPBALANCE + : public base_aepbal<FloatComplexMatrix, FloatColumnVector> { public: - FloatComplexAEPBALANCE (void) : base_aepbal<FloatComplexMatrix, FloatColumnVector> () { } + FloatComplexAEPBALANCE (void) + : base_aepbal<FloatComplexMatrix, FloatColumnVector> () { } FloatComplexAEPBALANCE (const FloatComplexMatrix& a, bool noperm = false, bool noscal = false);
--- a/liboctave/numeric/fCmplxCHOL.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxCHOL.cc Sat Oct 26 18:57:05 2013 -0700 @@ -236,7 +236,8 @@ } octave_idx_type -FloatComplexCHOL::insert_sym (const FloatComplexColumnVector& u, octave_idx_type j) +FloatComplexCHOL::insert_sym (const FloatComplexColumnVector& u, + octave_idx_type j) { octave_idx_type info = -1; @@ -308,7 +309,8 @@ if (u.length () == n) { init (chol_mat.hermitian () * chol_mat - + FloatComplexMatrix (u) * FloatComplexMatrix (u).hermitian (), false); + + FloatComplexMatrix (u) * FloatComplexMatrix (u).hermitian (), + false); } else (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); @@ -338,7 +340,9 @@ else { info = init (chol_mat.hermitian () * chol_mat - - FloatComplexMatrix (u) * FloatComplexMatrix (u).hermitian (), false); + - FloatComplexMatrix (u) + * FloatComplexMatrix (u).hermitian (), + false); if (info) info = 1; } } @@ -349,7 +353,8 @@ } octave_idx_type -FloatComplexCHOL::insert_sym (const FloatComplexColumnVector& u, octave_idx_type j) +FloatComplexCHOL::insert_sym (const FloatComplexColumnVector& u, + octave_idx_type j) { warn_qrupdate_once ();
--- a/liboctave/numeric/fCmplxCHOL.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxCHOL.h Sat Oct 26 18:57:05 2013 -0700 @@ -39,30 +39,30 @@ FloatComplexCHOL (const FloatComplexMatrix& a, bool calc_cond = false) : chol_mat (), xrcond (0) - { - init (a, calc_cond); - } + { + init (a, calc_cond); + } FloatComplexCHOL (const FloatComplexMatrix& a, octave_idx_type& info, bool calc_cond = false) : chol_mat (), xrcond (0) - { - info = init (a, calc_cond); - } + { + info = init (a, calc_cond); + } FloatComplexCHOL (const FloatComplexCHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { } FloatComplexCHOL& operator = (const FloatComplexCHOL& a) - { - if (this != &a) - { - chol_mat = a.chol_mat; - xrcond = a.xrcond; - } + { + if (this != &a) + { + chol_mat = a.chol_mat; + xrcond = a.xrcond; + } - return *this; - } + return *this; + } FloatComplexMatrix chol_matrix (void) const { return chol_mat; }
--- a/liboctave/numeric/fCmplxGEPBAL.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxGEPBAL.cc Sat Oct 26 18:57:05 2013 -0700 @@ -58,14 +58,16 @@ } octave_idx_type -FloatComplexGEPBALANCE::init (const FloatComplexMatrix& a, const FloatComplexMatrix& b, - const std::string& balance_job) +FloatComplexGEPBALANCE::init (const FloatComplexMatrix& a, + const FloatComplexMatrix& b, + const std::string& balance_job) { octave_idx_type n = a.cols (); if (a.rows () != n) { - (*current_liboctave_error_handler) ("FloatComplexGEPBALANCE requires square matrix"); + (*current_liboctave_error_handler) + ("FloatComplexGEPBALANCE requires square matrix"); return -1; }
--- a/liboctave/numeric/fCmplxGEPBAL.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxGEPBAL.h Sat Oct 26 18:57:05 2013 -0700 @@ -37,32 +37,32 @@ FloatComplexGEPBALANCE (void) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () - { } + { } FloatComplexGEPBALANCE (const FloatComplexMatrix& a, const FloatComplexMatrix& b, const std::string& balance_job) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () - { - init (a, b, balance_job); - } + { + init (a, b, balance_job); + } FloatComplexGEPBALANCE (const FloatComplexGEPBALANCE& a) : balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) - { } + { } FloatComplexGEPBALANCE& operator = (const FloatComplexGEPBALANCE& a) - { - if (this != &a) - { - balanced_mat = a.balanced_mat; - balanced_mat2 = a.balanced_mat2; - balancing_mat = a.balancing_mat; - balancing_mat2 = a.balancing_mat2; - } - return *this; - } + { + if (this != &a) + { + balanced_mat = a.balanced_mat; + balanced_mat2 = a.balanced_mat2; + balancing_mat = a.balancing_mat; + balancing_mat2 = a.balancing_mat2; + } + return *this; + } ~FloatComplexGEPBALANCE (void) { } @@ -74,7 +74,8 @@ FloatMatrix balancing_matrix2 (void) const { return balancing_mat2; } - friend std::ostream& operator << (std::ostream& os, const FloatComplexGEPBALANCE& a); + friend std::ostream& operator << (std::ostream& os, + const FloatComplexGEPBALANCE& a); private: @@ -83,7 +84,8 @@ FloatMatrix balancing_mat; FloatMatrix balancing_mat2; - octave_idx_type init (const FloatComplexMatrix& a, const FloatComplexMatrix& b, + octave_idx_type init (const FloatComplexMatrix& a, + const FloatComplexMatrix& b, const std::string& balance_job); };
--- a/liboctave/numeric/fCmplxHESS.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxHESS.h Sat Oct 26 18:57:05 2013 -0700 @@ -37,39 +37,40 @@ FloatComplexHESS (const FloatComplexMatrix& a) : hess_mat (), unitary_hess_mat () - { - init (a); - } + { + init (a); + } FloatComplexHESS (const FloatComplexMatrix& a, octave_idx_type& info) : hess_mat (), unitary_hess_mat () - { - info = init (a); - } + { + info = init (a); + } FloatComplexHESS (const FloatComplexHESS& a) : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } FloatComplexHESS& operator = (const FloatComplexHESS& a) - { - if (this != &a) - { - hess_mat = a.hess_mat; - unitary_hess_mat = a.unitary_hess_mat; - } - return *this; - } + { + if (this != &a) + { + hess_mat = a.hess_mat; + unitary_hess_mat = a.unitary_hess_mat; + } + return *this; + } ~FloatComplexHESS (void) { } FloatComplexMatrix hess_matrix (void) const { return hess_mat; } FloatComplexMatrix unitary_hess_matrix (void) const - { - return unitary_hess_mat; - } + { + return unitary_hess_mat; + } - friend std::ostream& operator << (std::ostream& os, const FloatComplexHESS& a); + friend std::ostream& operator << (std::ostream& os, + const FloatComplexHESS& a); private:
--- a/liboctave/numeric/fCmplxLU.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxLU.cc Sat Oct 26 18:57:05 2013 -0700 @@ -85,7 +85,8 @@ #ifdef HAVE_QRUPDATE_LUU -void FloatComplexLU::update (const FloatComplexColumnVector& u, const FloatComplexColumnVector& v) +void FloatComplexLU::update (const FloatComplexColumnVector& u, + const FloatComplexColumnVector& v) { if (packed ()) unpack (); @@ -107,7 +108,8 @@ (*current_liboctave_error_handler) ("luupdate: dimensions mismatch"); } -void FloatComplexLU::update (const FloatComplexMatrix& u, const FloatComplexMatrix& v) +void FloatComplexLU::update (const FloatComplexMatrix& u, + const FloatComplexMatrix& v) { if (packed ()) unpack (); @@ -124,7 +126,8 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { FloatComplexColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (clu1up, CLU1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, + F77_XFCN (clu1up, CLU1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, utmp.fortran_vec (), vtmp.fortran_vec ())); } } @@ -132,7 +135,8 @@ (*current_liboctave_error_handler) ("luupdate: dimensions mismatch"); } -void FloatComplexLU::update_piv (const FloatComplexColumnVector& u, const FloatComplexColumnVector& v) +void FloatComplexLU::update_piv (const FloatComplexColumnVector& u, + const FloatComplexColumnVector& v) { if (packed ()) unpack (); @@ -149,15 +153,18 @@ FloatComplexColumnVector utmp = u, vtmp = v; OCTAVE_LOCAL_BUFFER (FloatComplex, w, m); for (octave_idx_type i = 0; i < m; i++) ipvt(i) += 1; // increment - F77_XFCN (clup1up, CLUP1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, - ipvt.fortran_vec (), utmp.data (), vtmp.data (), w)); + F77_XFCN (clup1up, CLUP1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, + ipvt.fortran_vec (), + utmp.data (), vtmp.data (), w)); for (octave_idx_type i = 0; i < m; i++) ipvt(i) -= 1; // decrement } else (*current_liboctave_error_handler) ("luupdate: dimensions mismatch"); } -void FloatComplexLU::update_piv (const FloatComplexMatrix& u, const FloatComplexMatrix& v) +void FloatComplexLU::update_piv (const FloatComplexMatrix& u, + const FloatComplexMatrix& v) { if (packed ()) unpack (); @@ -176,8 +183,10 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { FloatComplexColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (clup1up, CLUP1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, - ipvt.fortran_vec (), utmp.data (), vtmp.data (), w)); + F77_XFCN (clup1up, CLUP1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, + ipvt.fortran_vec (), + utmp.data (), vtmp.data (), w)); } for (octave_idx_type i = 0; i < m; i++) ipvt(i) -= 1; // decrement } @@ -187,24 +196,32 @@ #else -void FloatComplexLU::update (const FloatComplexColumnVector&, const FloatComplexColumnVector&) +void FloatComplexLU::update (const FloatComplexColumnVector&, + const FloatComplexColumnVector&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } -void FloatComplexLU::update (const FloatComplexMatrix&, const FloatComplexMatrix&) +void FloatComplexLU::update (const FloatComplexMatrix&, + const FloatComplexMatrix&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } -void FloatComplexLU::update_piv (const FloatComplexColumnVector&, const FloatComplexColumnVector&) +void FloatComplexLU::update_piv (const FloatComplexColumnVector&, + const FloatComplexColumnVector&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } -void FloatComplexLU::update_piv (const FloatComplexMatrix&, const FloatComplexMatrix&) +void FloatComplexLU::update_piv (const FloatComplexMatrix&, + const FloatComplexMatrix&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } #endif
--- a/liboctave/numeric/fCmplxLU.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxLU.h Sat Oct 26 18:57:05 2013 -0700 @@ -46,20 +46,22 @@ : base_lu <FloatComplexMatrix> (l, u, p) { } FloatComplexLU& operator = (const FloatComplexLU& a) - { - if (this != &a) - base_lu <FloatComplexMatrix> :: operator = (a); + { + if (this != &a) + base_lu <FloatComplexMatrix> :: operator = (a); - return *this; - } + return *this; + } ~FloatComplexLU (void) { } - void update (const FloatComplexColumnVector& u, const FloatComplexColumnVector& v); + void update (const FloatComplexColumnVector& u, + const FloatComplexColumnVector& v); void update (const FloatComplexMatrix& u, const FloatComplexMatrix& v); - void update_piv (const FloatComplexColumnVector& u, const FloatComplexColumnVector& v); + void update_piv (const FloatComplexColumnVector& u, + const FloatComplexColumnVector& v); void update_piv (const FloatComplexMatrix& u, const FloatComplexMatrix& v); };
--- a/liboctave/numeric/fCmplxQR.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxQR.cc Sat Oct 26 18:57:05 2013 -0700 @@ -123,13 +123,15 @@ { // workspace query. FloatComplex clwork; - F77_XFCN (cgeqrf, CGEQRF, (m, n, afact.fortran_vec (), m, tau, &clwork, -1, info)); + F77_XFCN (cgeqrf, CGEQRF, (m, n, afact.fortran_vec (), m, tau, + &clwork, -1, info)); // allocate buffer and do the job. octave_idx_type lwork = clwork.real (); lwork = std::max (lwork, static_cast<octave_idx_type> (1)); OCTAVE_LOCAL_BUFFER (FloatComplex, work, lwork); - F77_XFCN (cgeqrf, CGEQRF, (m, n, afact.fortran_vec (), m, tau, work, lwork, info)); + F77_XFCN (cgeqrf, CGEQRF, (m, n, afact.fortran_vec (), m, tau, + work, lwork, info)); } form (n, afact, tau, qr_type); @@ -166,7 +168,7 @@ octave_idx_type i = 0; for (; i <= j; i++) r.xelem (i, j) = afact.xelem (i, j); - for (;i < k; i++) + for (; i < k; i++) r.xelem (i, j) = 0; } afact = FloatComplexMatrix (); // optimize memory @@ -206,7 +208,8 @@ #ifdef HAVE_QRUPDATE void -FloatComplexQR::update (const FloatComplexColumnVector& u, const FloatComplexColumnVector& v) +FloatComplexQR::update (const FloatComplexColumnVector& u, + const FloatComplexColumnVector& v) { octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); @@ -217,15 +220,18 @@ FloatComplexColumnVector utmp = u, vtmp = v; OCTAVE_LOCAL_BUFFER (FloatComplex, w, k); OCTAVE_LOCAL_BUFFER (float, rw, k); - F77_XFCN (cqr1up, CQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k, - utmp.fortran_vec (), vtmp.fortran_vec (), w, rw)); + F77_XFCN (cqr1up, CQR1UP, (m, n, k, q.fortran_vec (), + m, r.fortran_vec (), k, + utmp.fortran_vec (), vtmp.fortran_vec (), + w, rw)); } else (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); } void -FloatComplexQR::update (const FloatComplexMatrix& u, const FloatComplexMatrix& v) +FloatComplexQR::update (const FloatComplexMatrix& u, + const FloatComplexMatrix& v) { octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); @@ -238,8 +244,10 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { FloatComplexColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (cqr1up, CQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k, - utmp.fortran_vec (), vtmp.fortran_vec (), w, rw)); + F77_XFCN (cqr1up, CQR1UP, (m, n, k, q.fortran_vec (), + m, r.fortran_vec (), k, + utmp.fortran_vec (), vtmp.fortran_vec (), + w, rw)); } } else @@ -247,7 +255,8 @@ } void -FloatComplexQR::insert_col (const FloatComplexColumnVector& u, octave_idx_type j) +FloatComplexQR::insert_col (const FloatComplexColumnVector& u, + octave_idx_type j) { octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); @@ -278,7 +287,8 @@ } void -FloatComplexQR::insert_col (const FloatComplexMatrix& u, const Array<octave_idx_type>& j) +FloatComplexQR::insert_col (const FloatComplexMatrix& u, + const Array<octave_idx_type>& j) { octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); @@ -375,7 +385,8 @@ octave_idx_type ii = i; F77_XFCN (cqrdec, CQRDEC, (m, n - ii, k == m ? k : k - ii, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), js(ii) + 1, rw)); + r.fortran_vec (), r.rows (), + js(ii) + 1, rw)); } if (k < m) { @@ -462,7 +473,8 @@ // Replacement update methods. void -FloatComplexQR::update (const FloatComplexColumnVector& u, const FloatComplexColumnVector& v) +FloatComplexQR::update (const FloatComplexColumnVector& u, + const FloatComplexColumnVector& v) { warn_qrupdate_once (); @@ -471,14 +483,16 @@ if (u.length () == m && v.length () == n) { - init (q*r + FloatComplexMatrix (u) * FloatComplexMatrix (v).hermitian (), get_type ()); + init (q*r + FloatComplexMatrix (u) * FloatComplexMatrix (v).hermitian (), + get_type ()); } else (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); } void -FloatComplexQR::update (const FloatComplexMatrix& u, const FloatComplexMatrix& v) +FloatComplexQR::update (const FloatComplexMatrix& u, + const FloatComplexMatrix& v) { warn_qrupdate_once (); @@ -557,7 +571,8 @@ } void -FloatComplexQR::insert_col (const FloatComplexColumnVector& u, octave_idx_type j) +FloatComplexQR::insert_col (const FloatComplexColumnVector& u, + octave_idx_type j) { warn_qrupdate_once (); @@ -575,7 +590,8 @@ } void -FloatComplexQR::insert_col (const FloatComplexMatrix& u, const Array<octave_idx_type>& j) +FloatComplexQR::insert_col (const FloatComplexMatrix& u, + const Array<octave_idx_type>& j) { warn_qrupdate_once ();
--- a/liboctave/numeric/fCmplxQR.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxQR.h Sat Oct 26 18:57:05 2013 -0700 @@ -50,13 +50,15 @@ void init (const FloatComplexMatrix&, qr_type_t = qr_type_std); - void update (const FloatComplexColumnVector& u, const FloatComplexColumnVector& v); + void update (const FloatComplexColumnVector& u, + const FloatComplexColumnVector& v); void update (const FloatComplexMatrix& u, const FloatComplexMatrix& v); void insert_col (const FloatComplexColumnVector& u, octave_idx_type j); - void insert_col (const FloatComplexMatrix& u, const Array<octave_idx_type>& j); + void insert_col (const FloatComplexMatrix& u, + const Array<octave_idx_type>& j); void delete_col (octave_idx_type j);
--- a/liboctave/numeric/fCmplxQRP.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxQRP.cc Sat Oct 26 18:57:05 2013 -0700 @@ -43,7 +43,8 @@ // It would be best to share some of this code with FloatComplexQR class... -FloatComplexQRP::FloatComplexQRP (const FloatComplexMatrix& a, qr_type_t qr_type) +FloatComplexQRP::FloatComplexQRP (const FloatComplexMatrix& a, + qr_type_t qr_type) : FloatComplexQR (), p () { init (a, qr_type); @@ -74,15 +75,17 @@ // workspace query. FloatComplex clwork; - F77_XFCN (cgeqp3, CGEQP3, (m, n, afact.fortran_vec (), m, jpvt.fortran_vec (), - tau, &clwork, -1, rwork, info)); + F77_XFCN (cgeqp3, CGEQP3, (m, n, afact.fortran_vec (), + m, jpvt.fortran_vec (), tau, + &clwork, -1, rwork, info)); // allocate buffer and do the job. octave_idx_type lwork = clwork.real (); lwork = std::max (lwork, static_cast<octave_idx_type> (1)); OCTAVE_LOCAL_BUFFER (FloatComplex, work, lwork); - F77_XFCN (cgeqp3, CGEQP3, (m, n, afact.fortran_vec (), m, jpvt.fortran_vec (), - tau, work, lwork, rwork, info)); + F77_XFCN (cgeqp3, CGEQP3, (m, n, afact.fortran_vec (), + m, jpvt.fortran_vec (), tau, + work, lwork, rwork, info)); } else for (octave_idx_type i = 0; i < n; i++) jpvt(i) = i+1;
--- a/liboctave/numeric/fCmplxQRP.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxQRP.h Sat Oct 26 18:57:05 2013 -0700 @@ -42,14 +42,14 @@ FloatComplexQRP (const FloatComplexQRP& a) : FloatComplexQR (a), p (a.p) { } FloatComplexQRP& operator = (const FloatComplexQRP& a) - { - if (this != &a) - { - FloatComplexQR::operator = (a); - p = a.p; - } - return *this; - } + { + if (this != &a) + { + FloatComplexQR::operator = (a); + p = a.p; + } + return *this; + } ~FloatComplexQRP (void) { }
--- a/liboctave/numeric/fCmplxSCHUR.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxSCHUR.cc Sat Oct 26 18:57:05 2013 -0700 @@ -64,7 +64,7 @@ octave_idx_type FloatComplexSCHUR::init (const FloatComplexMatrix& a, const std::string& ord, - bool calc_unitary) + bool calc_unitary) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols ();
--- a/liboctave/numeric/fCmplxSCHUR.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxSCHUR.h Sat Oct 26 18:57:05 2013 -0700 @@ -38,36 +38,36 @@ FloatComplexSCHUR (void) : schur_mat (), unitary_mat (), selector (0) { } FloatComplexSCHUR (const FloatComplexMatrix& a, const std::string& ord, - bool calc_unitary = true) + bool calc_unitary = true) : schur_mat (), unitary_mat (), selector (0) - { - init (a, ord, calc_unitary); - } + { + init (a, ord, calc_unitary); + } FloatComplexSCHUR (const FloatComplexMatrix& a, const std::string& ord, octave_idx_type& info, bool calc_unitary = true) : schur_mat (), unitary_mat (), selector (0) - { - info = init (a, ord, calc_unitary); - } + { + info = init (a, ord, calc_unitary); + } FloatComplexSCHUR (const FloatComplexSCHUR& a) : schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) - { } + { } FloatComplexSCHUR (const FloatComplexMatrix& s, const FloatComplexMatrix& u); FloatComplexSCHUR (const FloatSCHUR& s); FloatComplexSCHUR& operator = (const FloatComplexSCHUR& a) - { - if (this != &a) - { - schur_mat = a.schur_mat; - unitary_mat = a.unitary_mat; - } - return *this; - } + { + if (this != &a) + { + schur_mat = a.schur_mat; + unitary_mat = a.unitary_mat; + } + return *this; + } ~FloatComplexSCHUR (void) { } @@ -75,7 +75,8 @@ FloatComplexMatrix unitary_matrix (void) const { return unitary_mat; } - friend std::ostream& operator << (std::ostream& os, const FloatComplexSCHUR& a); + friend std::ostream& operator << (std::ostream& os, + const FloatComplexSCHUR& a); typedef octave_idx_type (*select_function) (const FloatComplex&); @@ -86,7 +87,8 @@ select_function selector; - octave_idx_type init (const FloatComplexMatrix& a, const std::string& ord, bool calc_unitary); + octave_idx_type init (const FloatComplexMatrix& a, const std::string& ord, + bool calc_unitary); }; #endif
--- a/liboctave/numeric/fCmplxSVD.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fCmplxSVD.h Sat Oct 26 18:57:05 2013 -0700 @@ -37,40 +37,40 @@ FloatComplexSVD (void) : type_computed (), sigma (), left_sm (), right_sm () - { } + { } FloatComplexSVD (const FloatComplexMatrix& a, SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () - { - init (a, svd_type, svd_driver); - } + { + init (a, svd_type, svd_driver); + } FloatComplexSVD (const FloatComplexMatrix& a, octave_idx_type& info, SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () - { - info = init (a, svd_type, svd_driver); - } + { + info = init (a, svd_type, svd_driver); + } FloatComplexSVD (const FloatComplexSVD& a) : type_computed (a.type_computed), sigma (a.sigma), left_sm (a.left_sm), right_sm (a.right_sm) - { } + { } FloatComplexSVD& operator = (const FloatComplexSVD& a) - { - if (this != &a) - { - type_computed = a.type_computed; - sigma = a.sigma; - left_sm = a.left_sm; - right_sm = a.right_sm; - } - return *this; - } + { + if (this != &a) + { + type_computed = a.type_computed; + sigma = a.sigma; + left_sm = a.left_sm; + right_sm = a.right_sm; + } + return *this; + } ~FloatComplexSVD (void) { } @@ -80,7 +80,8 @@ FloatComplexMatrix right_singular_matrix (void) const; - friend std::ostream& operator << (std::ostream& os, const FloatComplexSVD& a); + friend std::ostream& operator << (std::ostream& os, + const FloatComplexSVD& a); private:
--- a/liboctave/numeric/fEIG.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fEIG.cc Sat Oct 26 18:57:05 2013 -0700 @@ -599,7 +599,8 @@ } octave_idx_type -FloatEIG::symmetric_init (const FloatMatrix& a, const FloatMatrix& b, bool calc_ev) +FloatEIG::symmetric_init (const FloatMatrix& a, const FloatMatrix& b, + bool calc_ev) { octave_idx_type n = a.rows (); octave_idx_type nb = b.rows (); @@ -674,7 +675,8 @@ } octave_idx_type -FloatEIG::init (const FloatComplexMatrix& a, const FloatComplexMatrix& b, bool calc_ev) +FloatEIG::init (const FloatComplexMatrix& a, const FloatComplexMatrix& b, + bool calc_ev) { if (a.any_element_is_inf_or_nan () || b.any_element_is_inf_or_nan ()) { @@ -786,7 +788,8 @@ } octave_idx_type -FloatEIG::hermitian_init (const FloatComplexMatrix& a, const FloatComplexMatrix& b, bool calc_ev) +FloatEIG::hermitian_init (const FloatComplexMatrix& a, + const FloatComplexMatrix& b, bool calc_ev) { octave_idx_type n = a.rows (); octave_idx_type nb = b.rows ();
--- a/liboctave/numeric/fEIG.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/fEIG.h Sat Oct 26 18:57:05 2013 -0700 @@ -33,8 +33,8 @@ OCTAVE_API FloatEIG { -friend class FloatMatrix; -friend class FloatComplexMatrix; + friend class FloatMatrix; + friend class FloatComplexMatrix; public: @@ -98,14 +98,14 @@ FloatEIG (const FloatEIG& a) : lambda (a.lambda), v (a.v) { } FloatEIG& operator = (const FloatEIG& a) - { - if (this != &a) - { - lambda = a.lambda; - v = a.v; - } - return *this; - } + { + if (this != &a) + { + lambda = a.lambda; + v = a.v; + } + return *this; + } ~FloatEIG (void) { } @@ -121,14 +121,20 @@ FloatComplexMatrix v; octave_idx_type init (const FloatMatrix& a, bool calc_eigenvectors); - octave_idx_type init (const FloatMatrix& a, const FloatMatrix& b, bool calc_eigenvectors); + octave_idx_type init (const FloatMatrix& a, const FloatMatrix& b, + bool calc_eigenvectors); octave_idx_type init (const FloatComplexMatrix& a, bool calc_eigenvectors); - octave_idx_type init (const FloatComplexMatrix& a, const FloatComplexMatrix& b, bool calc_eigenvectors); + octave_idx_type init (const FloatComplexMatrix& a, + const FloatComplexMatrix& b, bool calc_eigenvectors); octave_idx_type symmetric_init (const FloatMatrix& a, bool calc_eigenvectors); - octave_idx_type symmetric_init (const FloatMatrix& a, const FloatMatrix& b, bool calc_eigenvectors); - octave_idx_type hermitian_init (const FloatComplexMatrix& a, bool calc_eigenvectors); - octave_idx_type hermitian_init (const FloatComplexMatrix& a, const FloatComplexMatrix& b, bool calc_eigenvectors); + octave_idx_type symmetric_init (const FloatMatrix& a, const FloatMatrix& b, + bool calc_eigenvectors); + octave_idx_type hermitian_init (const FloatComplexMatrix& a, + bool calc_eigenvectors); + octave_idx_type hermitian_init (const FloatComplexMatrix& a, + const FloatComplexMatrix& b, + bool calc_eigenvectors); }; #endif
--- a/liboctave/numeric/floatCHOL.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatCHOL.cc Sat Oct 26 18:57:05 2013 -0700 @@ -342,7 +342,7 @@ else { info = init (chol_mat.transpose () * chol_mat - - FloatMatrix (u) * FloatMatrix (u).transpose (), false); + - FloatMatrix (u) * FloatMatrix (u).transpose (), false); if (info) info = 1; } }
--- a/liboctave/numeric/floatCHOL.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatCHOL.h Sat Oct 26 18:57:05 2013 -0700 @@ -39,28 +39,28 @@ FloatCHOL (const FloatMatrix& a, bool calc_cond = false) : chol_mat (), xrcond (0) - { - init (a, calc_cond); - } + { + init (a, calc_cond); + } FloatCHOL (const FloatMatrix& a, octave_idx_type& info, bool calc_cond = false) : chol_mat (), xrcond (0) - { - info = init (a, calc_cond); - } + { + info = init (a, calc_cond); + } FloatCHOL (const FloatCHOL& a) : chol_mat (a.chol_mat), xrcond (a.xrcond) { } FloatCHOL& operator = (const FloatCHOL& a) - { - if (this != &a) - { - chol_mat = a.chol_mat; - xrcond = a.xrcond; - } - return *this; - } + { + if (this != &a) + { + chol_mat = a.chol_mat; + xrcond = a.xrcond; + } + return *this; + } FloatMatrix chol_matrix (void) const { return chol_mat; } @@ -81,7 +81,8 @@ void shift_sym (octave_idx_type i, octave_idx_type j); - friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatCHOL& a); + friend OCTAVE_API std::ostream& operator << (std::ostream& os, + const FloatCHOL& a); private:
--- a/liboctave/numeric/floatGEPBAL.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatGEPBAL.cc Sat Oct 26 18:57:05 2013 -0700 @@ -60,13 +60,14 @@ octave_idx_type FloatGEPBALANCE::init (const FloatMatrix& a, const FloatMatrix& b, - const std::string& balance_job) + const std::string& balance_job) { octave_idx_type n = a.cols (); if (a.rows () != n) { - (*current_liboctave_error_handler) ("FloatGEPBALANCE requires square matrix"); + (*current_liboctave_error_handler) + ("FloatGEPBALANCE requires square matrix"); return -1; }
--- a/liboctave/numeric/floatGEPBAL.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatGEPBAL.h Sat Oct 26 18:57:05 2013 -0700 @@ -36,29 +36,29 @@ FloatGEPBALANCE (void) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () - { } + { } FloatGEPBALANCE (const FloatMatrix& a, const FloatMatrix& b, const std::string& balance_job) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () - { - init (a, b, balance_job); - } + { + init (a, b, balance_job); + } FloatGEPBALANCE (const FloatGEPBALANCE& a) : balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2), balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2) { } FloatGEPBALANCE& operator = (const FloatGEPBALANCE& a) - { - if (this != &a) - { - balanced_mat = a.balanced_mat; - balanced_mat2 = a.balanced_mat2; - balancing_mat = a.balancing_mat; - balancing_mat2 = a.balancing_mat2; - } - return *this; - } + { + if (this != &a) + { + balanced_mat = a.balanced_mat; + balanced_mat2 = a.balanced_mat2; + balancing_mat = a.balancing_mat; + balancing_mat2 = a.balancing_mat2; + } + return *this; + } ~FloatGEPBALANCE (void) { }
--- a/liboctave/numeric/floatHESS.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatHESS.h Sat Oct 26 18:57:05 2013 -0700 @@ -36,29 +36,29 @@ FloatHESS (void) : hess_mat (), unitary_hess_mat () { } FloatHESS (const FloatMatrix& a) - : hess_mat (), unitary_hess_mat () - { - init (a); - } + : hess_mat (), unitary_hess_mat () + { + init (a); + } FloatHESS (const FloatMatrix& a, octave_idx_type& info) : hess_mat (), unitary_hess_mat () - { - info = init (a); - } + { + info = init (a); + } FloatHESS (const FloatHESS& a) : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } FloatHESS& operator = (const FloatHESS& a) - { - if (this != &a) - { - hess_mat = a.hess_mat; - unitary_hess_mat = a.unitary_hess_mat; - } - return *this; - } + { + if (this != &a) + { + hess_mat = a.hess_mat; + unitary_hess_mat = a.unitary_hess_mat; + } + return *this; + } ~FloatHESS (void) { }
--- a/liboctave/numeric/floatLU.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatLU.cc Sat Oct 26 18:57:05 2013 -0700 @@ -100,7 +100,8 @@ if (u.length () == m && v.length () == n) { FloatColumnVector utmp = u, vtmp = v; - F77_XFCN (slu1up, SLU1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, + F77_XFCN (slu1up, SLU1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, utmp.fortran_vec (), vtmp.fortran_vec ())); } else @@ -124,7 +125,8 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { FloatColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (slu1up, SLU1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, + F77_XFCN (slu1up, SLU1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, utmp.fortran_vec (), vtmp.fortran_vec ())); } } @@ -132,7 +134,8 @@ (*current_liboctave_error_handler) ("luupdate: dimensions mismatch"); } -void FloatLU::update_piv (const FloatColumnVector& u, const FloatColumnVector& v) +void FloatLU::update_piv (const FloatColumnVector& u, + const FloatColumnVector& v) { if (packed ()) unpack (); @@ -149,8 +152,10 @@ FloatColumnVector utmp = u, vtmp = v; OCTAVE_LOCAL_BUFFER (float, w, m); for (octave_idx_type i = 0; i < m; i++) ipvt(i) += 1; // increment - F77_XFCN (slup1up, SLUP1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, - ipvt.fortran_vec (), utmp.data (), vtmp.data (), w)); + F77_XFCN (slup1up, SLUP1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, + ipvt.fortran_vec (), + utmp.data (), vtmp.data (), w)); for (octave_idx_type i = 0; i < m; i++) ipvt(i) -= 1; // decrement } else @@ -176,8 +181,10 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { FloatColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (slup1up, SLUP1UP, (m, n, l.fortran_vec (), m, r.fortran_vec (), k, - ipvt.fortran_vec (), utmp.data (), vtmp.data (), w)); + F77_XFCN (slup1up, SLUP1UP, (m, n, l.fortran_vec (), + m, r.fortran_vec (), k, + ipvt.fortran_vec (), + utmp.data (), vtmp.data (), w)); } for (octave_idx_type i = 0; i < m; i++) ipvt(i) -= 1; // decrement } @@ -189,22 +196,26 @@ void FloatLU::update (const FloatColumnVector&, const FloatColumnVector&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } void FloatLU::update (const FloatMatrix&, const FloatMatrix&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } void FloatLU::update_piv (const FloatColumnVector&, const FloatColumnVector&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } void FloatLU::update_piv (const FloatMatrix&, const FloatMatrix&) { - (*current_liboctave_error_handler) ("luupdate: not available in this version"); + (*current_liboctave_error_handler) + ("luupdate: not available in this version"); } #endif
--- a/liboctave/numeric/floatLU.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatLU.h Sat Oct 26 18:57:05 2013 -0700 @@ -44,12 +44,12 @@ : base_lu <FloatMatrix> (l, u, p) { } FloatLU& operator = (const FloatLU& a) - { - if (this != &a) - base_lu <FloatMatrix> :: operator = (a); + { + if (this != &a) + base_lu <FloatMatrix> :: operator = (a); - return *this; - } + return *this; + } ~FloatLU (void) { }
--- a/liboctave/numeric/floatQR.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatQR.cc Sat Oct 26 18:57:05 2013 -0700 @@ -119,13 +119,15 @@ { // workspace query. float rlwork; - F77_XFCN (sgeqrf, SGEQRF, (m, n, afact.fortran_vec (), m, tau, &rlwork, -1, info)); + F77_XFCN (sgeqrf, SGEQRF, (m, n, afact.fortran_vec (), m, tau, + &rlwork, -1, info)); // allocate buffer and do the job. octave_idx_type lwork = rlwork; lwork = std::max (lwork, static_cast<octave_idx_type> (1)); OCTAVE_LOCAL_BUFFER (float, work, lwork); - F77_XFCN (sgeqrf, SGEQRF, (m, n, afact.fortran_vec (), m, tau, work, lwork, info)); + F77_XFCN (sgeqrf, SGEQRF, (m, n, afact.fortran_vec (), m, tau, + work, lwork, info)); } form (n, afact, tau, qr_type); @@ -162,7 +164,7 @@ octave_idx_type i = 0; for (; i <= j; i++) r.xelem (i, j) = afact.xelem (i, j); - for (;i < k; i++) + for (; i < k; i++) r.xelem (i, j) = 0; } afact = FloatMatrix (); // optimize memory @@ -212,7 +214,8 @@ { FloatColumnVector utmp = u, vtmp = v; OCTAVE_LOCAL_BUFFER (float, w, 2*k); - F77_XFCN (sqr1up, SQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k, + F77_XFCN (sqr1up, SQR1UP, (m, n, k, q.fortran_vec (), + m, r.fortran_vec (), k, utmp.fortran_vec (), vtmp.fortran_vec (), w)); } else @@ -232,8 +235,10 @@ for (volatile octave_idx_type i = 0; i < u.cols (); i++) { FloatColumnVector utmp = u.column (i), vtmp = v.column (i); - F77_XFCN (sqr1up, SQR1UP, (m, n, k, q.fortran_vec (), m, r.fortran_vec (), k, - utmp.fortran_vec (), vtmp.fortran_vec (), w)); + F77_XFCN (sqr1up, SQR1UP, (m, n, k, q.fortran_vec (), + m, r.fortran_vec (), k, + utmp.fortran_vec (), vtmp.fortran_vec (), + w)); } } else @@ -370,7 +375,8 @@ octave_idx_type ii = i; F77_XFCN (sqrdec, SQRDEC, (m, n - ii, k == m ? k : k - ii, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), js(ii) + 1, w)); + r.fortran_vec (), r.rows (), + js(ii) + 1, w)); } if (k < m) {
--- a/liboctave/numeric/floatQRP.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatQRP.cc Sat Oct 26 18:57:05 2013 -0700 @@ -72,15 +72,17 @@ { // workspace query. float rlwork; - F77_XFCN (sgeqp3, SGEQP3, (m, n, afact.fortran_vec (), m, jpvt.fortran_vec (), - tau, &rlwork, -1, info)); + F77_XFCN (sgeqp3, SGEQP3, (m, n, afact.fortran_vec (), + m, jpvt.fortran_vec (), tau, + &rlwork, -1, info)); // allocate buffer and do the job. octave_idx_type lwork = rlwork; lwork = std::max (lwork, static_cast<octave_idx_type> (1)); OCTAVE_LOCAL_BUFFER (float, work, lwork); - F77_XFCN (sgeqp3, SGEQP3, (m, n, afact.fortran_vec (), m, jpvt.fortran_vec (), - tau, work, lwork, info)); + F77_XFCN (sgeqp3, SGEQP3, (m, n, afact.fortran_vec (), + m, jpvt.fortran_vec (), tau, + work, lwork, info)); } else for (octave_idx_type i = 0; i < n; i++) jpvt(i) = i+1;
--- a/liboctave/numeric/floatQRP.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatQRP.h Sat Oct 26 18:57:05 2013 -0700 @@ -42,15 +42,15 @@ FloatQRP (const FloatQRP& a) : FloatQR (a), p (a.p) { } FloatQRP& operator = (const FloatQRP& a) - { - if (this != &a) - { - FloatQR::operator = (a); - p = a.p; - } + { + if (this != &a) + { + FloatQR::operator = (a); + p = a.p; + } - return *this; - } + return *this; + } ~FloatQRP (void) { }
--- a/liboctave/numeric/floatSCHUR.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatSCHUR.cc Sat Oct 26 18:57:05 2013 -0700 @@ -51,7 +51,7 @@ static octave_idx_type select_ana (const float& a, const float&) { - return (a < 0.0); + return (a < 0.0); } static octave_idx_type @@ -61,7 +61,8 @@ } octave_idx_type -FloatSCHUR::init (const FloatMatrix& a, const std::string& ord, bool calc_unitary) +FloatSCHUR::init (const FloatMatrix& a, const std::string& ord, + bool calc_unitary) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols ();
--- a/liboctave/numeric/floatSCHUR.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatSCHUR.h Sat Oct 26 18:57:05 2013 -0700 @@ -39,32 +39,32 @@ FloatSCHUR (const FloatMatrix& a, const std::string& ord, bool calc_unitary = true) : schur_mat (), unitary_mat (), selector (0) - { - init (a, ord, calc_unitary); - } + { + init (a, ord, calc_unitary); + } FloatSCHUR (const FloatMatrix& a, const std::string& ord, int& info, bool calc_unitary = true) : schur_mat (), unitary_mat (), selector (0) - { - info = init (a, ord, calc_unitary); - } + { + info = init (a, ord, calc_unitary); + } FloatSCHUR (const FloatSCHUR& a) : schur_mat (a.schur_mat), unitary_mat (a.unitary_mat), selector (0) - { } + { } FloatSCHUR (const FloatMatrix& s, const FloatMatrix& u); FloatSCHUR& operator = (const FloatSCHUR& a) - { - if (this != &a) - { - schur_mat = a.schur_mat; - unitary_mat = a.unitary_mat; - } - return *this; - } + { + if (this != &a) + { + schur_mat = a.schur_mat; + unitary_mat = a.unitary_mat; + } + return *this; + } ~FloatSCHUR (void) { } @@ -83,7 +83,8 @@ select_function selector; - octave_idx_type init (const FloatMatrix& a, const std::string& ord, bool calc_unitary); + octave_idx_type init (const FloatMatrix& a, const std::string& ord, + bool calc_unitary); }; #endif
--- a/liboctave/numeric/floatSVD.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatSVD.cc Sat Oct 26 18:57:05 2013 -0700 @@ -81,7 +81,8 @@ } octave_idx_type -FloatSVD::init (const FloatMatrix& a, SVD::type svd_type, SVD::driver svd_driver) +FloatSVD::init (const FloatMatrix& a, SVD::type svd_type, + SVD::driver svd_driver) { octave_idx_type info; @@ -178,16 +179,16 @@ OCTAVE_LOCAL_BUFFER (octave_idx_type, iwork, 8*min_mn); F77_XFCN (sgesdd, SGESDD, (F77_CONST_CHAR_ARG2 (&jobz, 1), - m, n, tmp_data, m1, s_vec, u, m1, vt, - nrow_vt1, work.fortran_vec (), lwork, iwork, info + m, n, tmp_data, m1, s_vec, u, m1, vt, nrow_vt1, + work.fortran_vec (), lwork, iwork, info F77_CHAR_ARG_LEN (1))); lwork = static_cast<octave_idx_type> (work(0)); work.resize (dim_vector (lwork, 1)); F77_XFCN (sgesdd, SGESDD, (F77_CONST_CHAR_ARG2 (&jobz, 1), - m, n, tmp_data, m1, s_vec, u, m1, vt, - nrow_vt1, work.fortran_vec (), lwork, iwork, info + m, n, tmp_data, m1, s_vec, u, m1, vt, nrow_vt1, + work.fortran_vec (), lwork, iwork, info F77_CHAR_ARG_LEN (1))); }
--- a/liboctave/numeric/floatSVD.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/floatSVD.h Sat Oct 26 18:57:05 2013 -0700 @@ -40,35 +40,35 @@ FloatSVD (const FloatMatrix& a, SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () - { - init (a, svd_type, svd_driver); - } + { + init (a, svd_type, svd_driver); + } FloatSVD (const FloatMatrix& a, octave_idx_type& info, SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () - { - info = init (a, svd_type, svd_driver); - } + { + info = init (a, svd_type, svd_driver); + } FloatSVD (const FloatSVD& a) : type_computed (a.type_computed), sigma (a.sigma), left_sm (a.left_sm), right_sm (a.right_sm) - { } + { } FloatSVD& operator = (const FloatSVD& a) - { - if (this != &a) - { - type_computed = a.type_computed; - sigma = a.sigma; - left_sm = a.left_sm; - right_sm = a.right_sm; - } + { + if (this != &a) + { + type_computed = a.type_computed; + sigma = a.sigma; + left_sm = a.left_sm; + right_sm = a.right_sm; + } - return *this; - } + return *this; + } ~FloatSVD (void) { }
--- a/liboctave/numeric/lo-mappers.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/lo-mappers.cc Sat Oct 26 18:57:05 2013 -0700 @@ -247,7 +247,7 @@ // (complex, complex) -> complex mappers. -// FIXME -- need to handle NA too? +// FIXME: need to handle NA too? Complex xmin (const Complex& x, const Complex& y) @@ -457,7 +457,8 @@ FloatComplex atanh (const FloatComplex& x) { - return log ((static_cast<float>(1.0) + x) / (static_cast<float>(1.0) - x)) / static_cast<float>(2.0); + return log ((static_cast<float>(1.0) + x) / (static_cast<float> + (1.0) - x)) / static_cast<float>(2.0); } // complex -> bool mappers. @@ -476,7 +477,7 @@ // (complex, complex) -> complex mappers. -// FIXME -- need to handle NA too? +// FIXME: need to handle NA too? FloatComplex xmin (const FloatComplex& x, const FloatComplex& y) @@ -535,7 +536,8 @@ FloatComplex rc_atanh (float x) { - return fabsf (x) > 1.0f ? atanh (FloatComplex (x)) : FloatComplex (atanhf (x)); + return fabsf (x) > 1.0f ? atanh (FloatComplex (x)) + : FloatComplex (atanhf (x)); } Complex @@ -577,7 +579,8 @@ rc_log10 (float x) { const float pil10 = 1.36437635384184134748f; // = pi / log(10) - return x < 0.0f ? FloatComplex (log10 (-x), pil10) : FloatComplex (log10f (x)); + return x < 0.0f ? FloatComplex (log10 (-x), pil10) + : FloatComplex (log10f (x)); } Complex
--- a/liboctave/numeric/lo-mappers.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/lo-mappers.h Sat Oct 26 18:57:05 2013 -0700 @@ -178,8 +178,10 @@ extern OCTAVE_API bool octave_is_NA (const FloatComplex& x); extern OCTAVE_API bool octave_is_NaN_or_NA (const FloatComplex& x); -extern OCTAVE_API FloatComplex xmin (const FloatComplex& x, const FloatComplex& y); -extern OCTAVE_API FloatComplex xmax (const FloatComplex& x, const FloatComplex& y); +extern OCTAVE_API FloatComplex xmin (const FloatComplex& x, + const FloatComplex& y); +extern OCTAVE_API FloatComplex xmax (const FloatComplex& x, + const FloatComplex& y); // These map reals to Complex.
--- a/liboctave/numeric/lo-specfun.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/lo-specfun.cc Sat Oct 26 18:57:05 2013 -0700 @@ -623,7 +623,7 @@ if (ax < 0.2) { - // use approximation log (1+x) ~ 2*sum ((x/(2+x)).^ii ./ ii), ii = 1:2:2n+1 + // approximation log (1+x) ~ 2*sum ((x/(2+x)).^ii ./ ii), ii = 1:2:2n+1 double u = x / (2 + x), t = 1, s = 0; for (int i = 2; i < 12; i += 2) s += (t *= u*u) / (i+1); @@ -682,7 +682,7 @@ if (ax < 0.2) { - // use approximation log (1+x) ~ 2*sum ((x/(2+x)).^ii ./ ii), ii = 1:2:2n+1 + // approximation log (1+x) ~ 2*sum ((x/(2+x)).^ii ./ ii), ii = 1:2:2n+1 float u = x / (2 + x), t = 1, s = 0; for (int i = 2; i < 12; i += 2) s += (t *= u*u) / (i+1); @@ -707,7 +707,7 @@ { float u = 2*r + r*r + i*i; retval = FloatComplex (log1p (u / (1+sqrt (u+1))), - atan2 (1 + r, i)); + atan2 (1 + r, i)); } else retval = std::log (FloatComplex (1) + x); @@ -954,7 +954,7 @@ if (ierr == 0 || ierr == 3) { Complex tmp2 = (2.0 / M_PI) * sin (M_PI * alpha) - * zbesk (z, alpha, kode, ierr); + * zbesk (z, alpha, kode, ierr); if (kode == 2) { @@ -1212,7 +1212,7 @@ ierr.resize (dv); for (octave_idx_type i = 0; i < nel; i++) - retval(i) = f (x(i), alpha, (scaled ? 2 : 1), ierr(i)); + retval(i) = f (x(i), alpha, (scaled ? 2 : 1), ierr(i)); return retval; } @@ -1259,7 +1259,8 @@ static inline ComplexMatrix do_bessel (dptr f, const char *, const RowVector& alpha, - const ComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) + const ComplexColumnVector& x, bool scaled, + Array<octave_idx_type>& ierr) { octave_idx_type nr = x.length (); octave_idx_type nc = alpha.length (); @@ -1386,8 +1387,10 @@ static inline FloatComplex bessel_return_value (const FloatComplex& val, octave_idx_type ierr) { - static const FloatComplex inf_val = FloatComplex (octave_Float_Inf, octave_Float_Inf); - static const FloatComplex nan_val = FloatComplex (octave_Float_NaN, octave_Float_NaN); + static const FloatComplex inf_val = FloatComplex (octave_Float_Inf, + octave_Float_Inf); + static const FloatComplex nan_val = FloatComplex (octave_Float_NaN, + octave_Float_NaN); FloatComplex retval; @@ -1453,11 +1456,13 @@ { alpha = -alpha; - FloatComplex tmp = cosf (static_cast<float> (M_PI) * alpha) * cbesj (z, alpha, kode, ierr); + FloatComplex tmp = cosf (static_cast<float> (M_PI) * alpha) + * cbesj (z, alpha, kode, ierr); if (ierr == 0 || ierr == 3) { - tmp -= sinf (static_cast<float> (M_PI) * alpha) * cbesy (z, alpha, kode, ierr); + tmp -= sinf (static_cast<float> (M_PI) * alpha) + * cbesy (z, alpha, kode, ierr); retval = bessel_return_value (tmp, ierr); } @@ -1516,11 +1521,13 @@ { alpha = -alpha; - FloatComplex tmp = cosf (static_cast<float> (M_PI) * alpha) * cbesy (z, alpha, kode, ierr); + FloatComplex tmp = cosf (static_cast<float> (M_PI) * alpha) + * cbesy (z, alpha, kode, ierr); if (ierr == 0 || ierr == 3) { - tmp += sinf (static_cast<float> (M_PI) * alpha) * cbesj (z, alpha, kode, ierr); + tmp += sinf (static_cast<float> (M_PI) * alpha) + * cbesj (z, alpha, kode, ierr); retval = bessel_return_value (tmp, ierr); } @@ -1563,8 +1570,9 @@ if (ierr == 0 || ierr == 3) { - FloatComplex tmp2 = static_cast<float> (2.0 / M_PI) * sinf (static_cast<float> (M_PI) * alpha) - * cbesk (z, alpha, kode, ierr); + FloatComplex tmp2 = static_cast<float> (2.0 / M_PI) + * sinf (static_cast<float> (M_PI) * alpha) + * cbesk (z, alpha, kode, ierr); if (kode == 2) { @@ -1667,7 +1675,8 @@ static const FloatComplex eye = FloatComplex (0.0, 1.0); - FloatComplex tmp = exp (static_cast<float> (M_PI) * alpha * eye) * cbesh1 (z, alpha, kode, ierr); + FloatComplex tmp = exp (static_cast<float> (M_PI) * alpha * eye) + * cbesh1 (z, alpha, kode, ierr); retval = bessel_return_value (tmp, ierr); } @@ -1709,7 +1718,8 @@ static const FloatComplex eye = FloatComplex (0.0, 1.0); - FloatComplex tmp = exp (-static_cast<float> (M_PI) * alpha * eye) * cbesh2 (z, alpha, kode, ierr); + FloatComplex tmp = exp (-static_cast<float> (M_PI) * alpha * eye) + * cbesh2 (z, alpha, kode, ierr); retval = bessel_return_value (tmp, ierr); } @@ -1717,7 +1727,8 @@ return retval; } -typedef FloatComplex (*fptr) (const FloatComplex&, float, int, octave_idx_type&); +typedef FloatComplex (*fptr) (const FloatComplex&, float, int, + octave_idx_type&); static inline FloatComplex do_bessel (fptr f, const char *, float alpha, const FloatComplex& x, @@ -1749,7 +1760,8 @@ } static inline FloatComplexMatrix -do_bessel (fptr f, const char *, const FloatMatrix& alpha, const FloatComplex& x, +do_bessel (fptr f, const char *, const FloatMatrix& alpha, + const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { octave_idx_type nr = alpha.rows (); @@ -1768,7 +1780,8 @@ static inline FloatComplexMatrix do_bessel (fptr f, const char *fn, const FloatMatrix& alpha, - const FloatComplexMatrix& x, bool scaled, Array<octave_idx_type>& ierr) + const FloatComplexMatrix& x, bool scaled, + Array<octave_idx_type>& ierr) { FloatComplexMatrix retval; @@ -1809,14 +1822,14 @@ ierr.resize (dv); for (octave_idx_type i = 0; i < nel; i++) - retval(i) = f (x(i), alpha, (scaled ? 2 : 1), ierr(i)); + retval(i) = f (x(i), alpha, (scaled ? 2 : 1), ierr(i)); return retval; } static inline FloatComplexNDArray -do_bessel (fptr f, const char *, const FloatNDArray& alpha, const FloatComplex& x, - bool scaled, Array<octave_idx_type>& ierr) +do_bessel (fptr f, const char *, const FloatNDArray& alpha, + const FloatComplex& x, bool scaled, Array<octave_idx_type>& ierr) { dim_vector dv = alpha.dims (); octave_idx_type nel = dv.numel (); @@ -1832,7 +1845,8 @@ static inline FloatComplexNDArray do_bessel (fptr f, const char *fn, const FloatNDArray& alpha, - const FloatComplexNDArray& x, bool scaled, Array<octave_idx_type>& ierr) + const FloatComplexNDArray& x, bool scaled, + Array<octave_idx_type>& ierr) { dim_vector dv = x.dims (); FloatComplexNDArray retval; @@ -1856,7 +1870,8 @@ static inline FloatComplexMatrix do_bessel (fptr f, const char *, const FloatRowVector& alpha, - const FloatComplexColumnVector& x, bool scaled, Array<octave_idx_type>& ierr) + const FloatComplexColumnVector& x, bool scaled, + Array<octave_idx_type>& ierr) { octave_idx_type nr = x.length (); octave_idx_type nc = alpha.length (); @@ -2029,7 +2044,8 @@ } ComplexMatrix -airy (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) +airy (const ComplexMatrix& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr) { octave_idx_type nr = z.rows (); octave_idx_type nc = z.cols (); @@ -2046,7 +2062,8 @@ } ComplexMatrix -biry (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) +biry (const ComplexMatrix& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr) { octave_idx_type nr = z.rows (); octave_idx_type nc = z.cols (); @@ -2063,7 +2080,8 @@ } ComplexNDArray -airy (const ComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) +airy (const ComplexNDArray& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr) { dim_vector dv = z.dims (); octave_idx_type nel = dv.numel (); @@ -2078,7 +2096,8 @@ } ComplexNDArray -biry (const ComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) +biry (const ComplexNDArray& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr) { dim_vector dv = z.dims (); octave_idx_type nel = dv.numel (); @@ -2141,7 +2160,8 @@ if (! scaled) { - FloatComplex expz = exp (std::abs (real (static_cast<float> (2.0 / 3.0) * z * sqrt (z)))); + FloatComplex expz = exp (std::abs (real (static_cast<float> (2.0 / 3.0) + * z * sqrt (z)))); float rexpz = real (expz); float iexpz = imag (expz); @@ -2159,7 +2179,8 @@ } FloatComplexMatrix -airy (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) +airy (const FloatComplexMatrix& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr) { octave_idx_type nr = z.rows (); octave_idx_type nc = z.cols (); @@ -2176,7 +2197,8 @@ } FloatComplexMatrix -biry (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) +biry (const FloatComplexMatrix& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr) { octave_idx_type nr = z.rows (); octave_idx_type nc = z.cols (); @@ -2193,7 +2215,8 @@ } FloatComplexNDArray -airy (const FloatComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) +airy (const FloatComplexNDArray& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr) { dim_vector dv = z.dims (); octave_idx_type nel = dv.numel (); @@ -2208,7 +2231,8 @@ } FloatComplexNDArray -biry (const FloatComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr) +biry (const FloatComplexNDArray& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr) { dim_vector dv = z.dims (); octave_idx_type nel = dv.numel (); @@ -2231,8 +2255,8 @@ std::string d3_str = d3.str (); (*current_liboctave_error_handler) - ("betainc: nonconformant arguments (x is %s, a is %s, b is %s)", - d1_str.c_str (), d2_str.c_str (), d3_str.c_str ()); + ("betainc: nonconformant arguments (x is %s, a is %s, b is %s)", + d1_str.c_str (), d2_str.c_str (), d3_str.c_str ()); } static void @@ -2244,8 +2268,8 @@ std::string d3_str = d3.str (); (*current_liboctave_error_handler) - ("betaincinv: nonconformant arguments (x is %s, a is %s, b is %s)", - d1_str.c_str (), d2_str.c_str (), d3_str.c_str ()); + ("betaincinv: nonconformant arguments (x is %s, a is %s, b is %s)", + d1_str.c_str (), d2_str.c_str (), d3_str.c_str ()); } double @@ -2544,7 +2568,7 @@ return retval; } -// FIXME -- there is still room for improvement here... +// FIXME: there is still room for improvement here... double gammainc (double x, double a, bool& err) @@ -2588,7 +2612,7 @@ retval = result; - done: +done: return retval; } @@ -2615,7 +2639,7 @@ retval = result; - done: +done: return retval; } @@ -2654,7 +2678,7 @@ ("gammainc: nonconformant arguments (arg 1 is %dx%d, arg 2 is %dx%d)", nr, nc, a_nr, a_nc); - done: +done: return retval; } @@ -2680,7 +2704,7 @@ retval = result; - done: +done: return retval; } @@ -2706,7 +2730,7 @@ retval = result; - done: +done: return retval; } @@ -2746,7 +2770,7 @@ x_str.c_str (), a_str. c_str ()); } - done: +done: return retval; } @@ -2793,7 +2817,7 @@ retval = result; - done: +done: return retval; } @@ -2820,7 +2844,7 @@ retval = result; - done: +done: return retval; } @@ -2859,7 +2883,7 @@ ("gammainc: nonconformant arguments (arg 1 is %dx%d, arg 2 is %dx%d)", nr, nc, a_nr, a_nc); - done: +done: return retval; } @@ -2885,7 +2909,7 @@ retval = result; - done: +done: return retval; } @@ -2911,7 +2935,7 @@ retval = result; - done: +done: return retval; } @@ -2951,7 +2975,7 @@ x_str.c_str (), a_str.c_str ()); } - done: +done: return retval; } @@ -2966,7 +2990,8 @@ FloatComplex rc_log1p (float x) { const float pi = 3.14159265358979323846f; - return x < -1.0f ? FloatComplex (logf (-(1.0f + x)), pi) : FloatComplex (log1pf (x)); + return x < -1.0f ? FloatComplex (logf (-(1.0f + x)), pi) + : FloatComplex (log1pf (x)); } // This algorithm is due to P. J. Acklam. @@ -2980,20 +3005,28 @@ { // Coefficients of rational approximation. static const double a[] = - { -2.806989788730439e+01, 1.562324844726888e+02, - -1.951109208597547e+02, 9.783370457507161e+01, - -2.168328665628878e+01, 1.772453852905383e+00 }; + { + -2.806989788730439e+01, 1.562324844726888e+02, + -1.951109208597547e+02, 9.783370457507161e+01, + -2.168328665628878e+01, 1.772453852905383e+00 + }; static const double b[] = - { -5.447609879822406e+01, 1.615858368580409e+02, - -1.556989798598866e+02, 6.680131188771972e+01, - -1.328068155288572e+01 }; + { + -5.447609879822406e+01, 1.615858368580409e+02, + -1.556989798598866e+02, 6.680131188771972e+01, + -1.328068155288572e+01 + }; static const double c[] = - { -5.504751339936943e-03, -2.279687217114118e-01, - -1.697592457770869e+00, -1.802933168781950e+00, - 3.093354679843505e+00, 2.077595676404383e+00 }; + { + -5.504751339936943e-03, -2.279687217114118e-01, + -1.697592457770869e+00, -1.802933168781950e+00, + 3.093354679843505e+00, 2.077595676404383e+00 + }; static const double d[] = - { 7.784695709041462e-03, 3.224671290700398e-01, - 2.445134137142996e+00, 3.754408661907416e+00 }; + { + 7.784695709041462e-03, 3.224671290700398e-01, + 2.445134137142996e+00, 3.754408661907416e+00 + }; static const double spi2 = 8.862269254527579e-01; // sqrt(pi)/2. static const double pbreak = 0.95150; @@ -3049,20 +3082,28 @@ { // Coefficients of rational approximation. static const double a[] = - { -2.806989788730439e+01, 1.562324844726888e+02, - -1.951109208597547e+02, 9.783370457507161e+01, - -2.168328665628878e+01, 1.772453852905383e+00 }; + { + -2.806989788730439e+01, 1.562324844726888e+02, + -1.951109208597547e+02, 9.783370457507161e+01, + -2.168328665628878e+01, 1.772453852905383e+00 + }; static const double b[] = - { -5.447609879822406e+01, 1.615858368580409e+02, - -1.556989798598866e+02, 6.680131188771972e+01, - -1.328068155288572e+01 }; + { + -5.447609879822406e+01, 1.615858368580409e+02, + -1.556989798598866e+02, 6.680131188771972e+01, + -1.328068155288572e+01 + }; static const double c[] = - { -5.504751339936943e-03, -2.279687217114118e-01, - -1.697592457770869e+00, -1.802933168781950e+00, - 3.093354679843505e+00, 2.077595676404383e+00 }; + { + -5.504751339936943e-03, -2.279687217114118e-01, + -1.697592457770869e+00, -1.802933168781950e+00, + 3.093354679843505e+00, 2.077595676404383e+00 + }; static const double d[] = - { 7.784695709041462e-03, 3.224671290700398e-01, - 2.445134137142996e+00, 3.754408661907416e+00 }; + { + 7.784695709041462e-03, 3.224671290700398e-01, + 2.445134137142996e+00, 3.754408661907416e+00 + }; static const double spi2 = 8.862269254527579e-01; // sqrt(pi)/2. static const double pbreak_lo = 0.04850; // 1-pbreak @@ -3201,7 +3242,7 @@ if (temp <= acu && temp <= acu * value) { value = value * exp (pp * log (xx) - + (qq - 1.0) * log (cx) - beta) / pp; + + (qq - 1.0) * log (cx) - beta) / pp; if (indx) { @@ -3559,7 +3600,8 @@ } Array<double> -betaincinv (const Array<double>& x, const Array<double>& a, const Array<double>& b) +betaincinv (const Array<double>& x, const Array<double>& a, + const Array<double>& b) { Array<double> retval; dim_vector dv = x.dims (); @@ -3653,7 +3695,8 @@ } void -ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn, double& err) +ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn, + double& err) { double m1 = 1 - m, ss1, cc1, dd1;
--- a/liboctave/numeric/lo-specfun.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/lo-specfun.h Sat Oct 26 18:57:05 2013 -0700 @@ -308,22 +308,28 @@ Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplex -besselj (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& ierr); +besselj (float alpha, const FloatComplex& x, bool scaled, + octave_idx_type& ierr); extern OCTAVE_API FloatComplex -bessely (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& ierr); +bessely (float alpha, const FloatComplex& x, bool scaled, + octave_idx_type& ierr); extern OCTAVE_API FloatComplex -besseli (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& ierr); +besseli (float alpha, const FloatComplex& x, bool scaled, + octave_idx_type& ierr); extern OCTAVE_API FloatComplex -besselk (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& ierr); +besselk (float alpha, const FloatComplex& x, bool scaled, + octave_idx_type& ierr); extern OCTAVE_API FloatComplex -besselh1 (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& ierr); +besselh1 (float alpha, const FloatComplex& x, bool scaled, + octave_idx_type& ierr); extern OCTAVE_API FloatComplex -besselh2 (float alpha, const FloatComplex& x, bool scaled, octave_idx_type& ierr); +besselh2 (float alpha, const FloatComplex& x, bool scaled, + octave_idx_type& ierr); extern OCTAVE_API FloatComplexMatrix besselj (float alpha, const FloatComplexMatrix& x, bool scaled, @@ -470,78 +476,111 @@ Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix -besselj (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array<octave_idx_type>& ierr); +besselj (const FloatRowVector& alpha, const FloatComplexColumnVector& x, + bool scaled, Array<octave_idx_type>& ierr); + +extern OCTAVE_API FloatComplexMatrix +bessely (const FloatRowVector& alpha, const FloatComplexColumnVector& x, + bool scaled, Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix -bessely (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array<octave_idx_type>& ierr); +besseli (const FloatRowVector& alpha, const FloatComplexColumnVector& x, + bool scaled, Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix -besseli (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array<octave_idx_type>& ierr); +besselk (const FloatRowVector& alpha, const FloatComplexColumnVector& x, + bool scaled, Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix -besselk (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array<octave_idx_type>& ierr); +besselh1 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, + bool scaled, Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix -besselh1 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array<octave_idx_type>& ierr); +besselh2 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, + bool scaled, Array<octave_idx_type>& ierr); -extern OCTAVE_API FloatComplexMatrix -besselh2 (const FloatRowVector& alpha, const FloatComplexColumnVector& x, bool scaled, - Array<octave_idx_type>& ierr); +extern OCTAVE_API Complex +airy (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr); -extern OCTAVE_API Complex airy (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr); -extern OCTAVE_API Complex biry (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr); +extern OCTAVE_API Complex +biry (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr); extern OCTAVE_API ComplexMatrix -airy (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); +airy (const ComplexMatrix& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexMatrix -biry (const ComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); +biry (const ComplexMatrix& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexNDArray -airy (const ComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); +airy (const ComplexNDArray& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr); extern OCTAVE_API ComplexNDArray -biry (const ComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); +biry (const ComplexNDArray& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr); -extern OCTAVE_API FloatComplex airy (const FloatComplex& z, bool deriv, bool scaled, octave_idx_type& ierr); -extern OCTAVE_API FloatComplex biry (const FloatComplex& z, bool deriv, bool scaled, octave_idx_type& ierr); +extern OCTAVE_API FloatComplex +airy (const FloatComplex& z, bool deriv, bool scaled, octave_idx_type& ierr); + +extern OCTAVE_API FloatComplex +biry (const FloatComplex& z, bool deriv, bool scaled, octave_idx_type& ierr); extern OCTAVE_API FloatComplexMatrix -airy (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); +airy (const FloatComplexMatrix& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexMatrix -biry (const FloatComplexMatrix& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); +biry (const FloatComplexMatrix& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexNDArray -airy (const FloatComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); +airy (const FloatComplexNDArray& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr); extern OCTAVE_API FloatComplexNDArray -biry (const FloatComplexNDArray& z, bool deriv, bool scaled, Array<octave_idx_type>& ierr); +biry (const FloatComplexNDArray& z, bool deriv, bool scaled, + Array<octave_idx_type>& ierr); -extern OCTAVE_API double betainc (double x, double a, double b); -extern OCTAVE_API Array<double> betainc (double x, double a, const Array<double>& b); -extern OCTAVE_API Array<double> betainc (double x, const Array<double>& a, double b); -extern OCTAVE_API Array<double> betainc (double x, const Array<double>& a, const Array<double>& b); -extern OCTAVE_API Array<double> betainc (const Array<double>& x, double a, double b); -extern OCTAVE_API Array<double> betainc (const Array<double>& x, double a, double b); -extern OCTAVE_API Array<double> betainc (const Array<double>& x, double a, const Array<double>& b); -extern OCTAVE_API Array<double> betainc (const Array<double>& x, const Array<double>& a, double b); -extern OCTAVE_API Array<double> betainc (const Array<double>& x, const Array<double>& a, const Array<double>& b); +extern OCTAVE_API double +betainc (double x, double a, double b); +extern OCTAVE_API Array<double> +betainc (double x, double a, const Array<double>& b); +extern OCTAVE_API Array<double> +betainc (double x, const Array<double>& a, double b); +extern OCTAVE_API Array<double> +betainc (double x, const Array<double>& a, const Array<double>& b); +extern OCTAVE_API Array<double> +betainc (const Array<double>& x, double a, double b); +extern OCTAVE_API Array<double> +betainc (const Array<double>& x, double a, double b); +extern OCTAVE_API Array<double> +betainc (const Array<double>& x, double a, const Array<double>& b); +extern OCTAVE_API Array<double> +betainc (const Array<double>& x, const Array<double>& a, double b); +extern OCTAVE_API Array<double> +betainc (const Array<double>& x, const Array<double>& a, + const Array<double>& b); -extern OCTAVE_API float betainc (float x, float a, float b); -extern OCTAVE_API Array<float> betainc (float x, float a, const Array<float>& b); -extern OCTAVE_API Array<float> betainc (float x, const Array<float>& a, float b); -extern OCTAVE_API Array<float> betainc (float x, const Array<float>& a, const Array<float>& b); -extern OCTAVE_API Array<float> betainc (const Array<float>& x, float a, float b); -extern OCTAVE_API Array<float> betainc (const Array<float>& x, float a, float b); -extern OCTAVE_API Array<float> betainc (const Array<float>& x, float a, const Array<float>& b); -extern OCTAVE_API Array<float> betainc (const Array<float>& x, const Array<float>& a, float b); -extern OCTAVE_API Array<float> betainc (const Array<float>& x, const Array<float>& a, const Array<float>& b); +extern OCTAVE_API float +betainc (float x, float a, float b); +extern OCTAVE_API Array<float> +betainc (float x, float a, const Array<float>& b); +extern OCTAVE_API Array<float> +betainc (float x, const Array<float>& a, float b); +extern OCTAVE_API Array<float> +betainc (float x, const Array<float>& a, const Array<float>& b); +extern OCTAVE_API Array<float> +betainc (const Array<float>& x, float a, float b); +extern OCTAVE_API Array<float> +betainc (const Array<float>& x, float a, float b); +extern OCTAVE_API Array<float> +betainc (const Array<float>& x, float a, const Array<float>& b); +extern OCTAVE_API Array<float> +betainc (const Array<float>& x, const Array<float>& a, float b); +extern OCTAVE_API Array<float> +betainc (const Array<float>& x, const Array<float>& a, const Array<float>& b); extern OCTAVE_API double gammainc (double x, double a, bool& err); extern OCTAVE_API Matrix gammainc (double x, const Matrix& a); @@ -561,11 +600,13 @@ extern OCTAVE_API float gammainc (float x, float a, bool& err); extern OCTAVE_API FloatMatrix gammainc (float x, const FloatMatrix& a); extern OCTAVE_API FloatMatrix gammainc (const FloatMatrix& x, float a); -extern OCTAVE_API FloatMatrix gammainc (const FloatMatrix& x, const FloatMatrix& a); +extern OCTAVE_API FloatMatrix +gammainc (const FloatMatrix& x, const FloatMatrix& a); extern OCTAVE_API FloatNDArray gammainc (float x, const FloatNDArray& a); extern OCTAVE_API FloatNDArray gammainc (const FloatNDArray& x, float a); -extern OCTAVE_API FloatNDArray gammainc (const FloatNDArray& x, const FloatNDArray& a); +extern OCTAVE_API FloatNDArray +gammainc (const FloatNDArray& x, const FloatNDArray& a); inline float gammainc (float x, float a) { @@ -598,16 +639,28 @@ extern OCTAVE_API FloatComplex dawson (const FloatComplex& x); extern OCTAVE_API double betaincinv (double x, double a, double b); -extern OCTAVE_API Array<double> betaincinv (double x, double a, const Array<double>& b); -extern OCTAVE_API Array<double> betaincinv (double x, const Array<double>& a, double b); -extern OCTAVE_API Array<double> betaincinv (double x, const Array<double>& a, const Array<double>& b); -extern OCTAVE_API Array<double> betaincinv (const Array<double>& x, double a, double b); -extern OCTAVE_API Array<double> betaincinv (const Array<double>& x, double a, double b); -extern OCTAVE_API Array<double> betaincinv (const Array<double>& x, double a, const Array<double>& b); -extern OCTAVE_API Array<double> betaincinv (const Array<double>& x, const Array<double>& a, double b); -extern OCTAVE_API Array<double> betaincinv (const Array<double>& x, const Array<double>& a, const Array<double>& b); +extern OCTAVE_API Array<double> +betaincinv (double x, double a, const Array<double>& b); +extern OCTAVE_API Array<double> +betaincinv (double x, const Array<double>& a, double b); +extern OCTAVE_API Array<double> +betaincinv (double x, const Array<double>& a, const Array<double>& b); +extern OCTAVE_API Array<double> +betaincinv (const Array<double>& x, double a, double b); +extern OCTAVE_API Array<double> +betaincinv (const Array<double>& x, double a, double b); +extern OCTAVE_API Array<double> +betaincinv (const Array<double>& x, double a, const Array<double>& b); +extern OCTAVE_API Array<double> +betaincinv (const Array<double>& x, const Array<double>& a, double b); +extern OCTAVE_API Array<double> +betaincinv (const Array<double>& x, const Array<double>& a, + const Array<double>& b); -extern OCTAVE_API void ellipj (double u, double m, double& sn, double& cn, double& dn, double& err); -extern OCTAVE_API void ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn, double& err); +extern OCTAVE_API void +ellipj (double u, double m, double& sn, double& cn, double& dn, double& err); +extern OCTAVE_API void +ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn, + double& err); #endif
--- a/liboctave/numeric/oct-convn.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/oct-convn.cc Sat Oct 26 18:57:05 2013 -0700 @@ -82,13 +82,17 @@ convolve_2d<T, R> (a, ad(0), ad(1), b, bd(0), bd(1), c, inner); else { - octave_idx_type ma = acd(nd-2), na = ad(nd-1), mb = bcd(nd-2), nb = bd(nd-1); + octave_idx_type ma = acd(nd-2); + octave_idx_type na = ad(nd-1); + octave_idx_type mb = bcd(nd-2); + octave_idx_type nb = bd(nd-1); octave_idx_type ldc = ccd(nd-2); if (inner) { for (octave_idx_type ja = 0; ja < na - nb + 1; ja++) for (octave_idx_type jb = 0; jb < nb; jb++) - convolve_nd<T, R> (a + ma*(ja+jb), ad, acd, b + mb*(nb-jb-1), bd, bcd, + convolve_nd<T, R> (a + ma*(ja+jb), ad, acd, + b + mb*(nb-jb-1), bd, bcd, c + ldc*ja, ccd, nd-1, inner); } else @@ -129,7 +133,8 @@ convolve_nd<T, R> (a.fortran_vec (), adims, adims.cumulative (), b.fortran_vec (), bdims, bdims.cumulative (), - c.fortran_vec (), cdims.cumulative (), nd, ct == convn_valid); + c.fortran_vec (), cdims.cumulative (), + nd, ct == convn_valid); if (ct == convn_same) {
--- a/liboctave/numeric/oct-fftw.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/oct-fftw.cc Sat Oct 26 18:57:05 2013 -0700 @@ -53,7 +53,7 @@ // Note that we also use any wisdom that is available, either in a // FFTW3 system wide file or as supplied by the user. -// FIXME -- if we can ensure 16 byte alignment in Array<T> +// FIXME: if we can ensure 16 byte alignment in Array<T> // (<T> *data) the FFTW3 can use SIMD instructions for further // acceleration. @@ -225,22 +225,24 @@ // Create matrix with the same size and 16-byte alignment as input OCTAVE_LOCAL_BUFFER (Complex, itmp, nn * howmany + 32); itmp = reinterpret_cast<Complex *> - (((reinterpret_cast<ptrdiff_t>(itmp) + 15) & ~ 0xF) + - ((reinterpret_cast<ptrdiff_t> (in)) & 0xF)); + (((reinterpret_cast<ptrdiff_t>(itmp) + 15) & ~ 0xF) + + ((reinterpret_cast<ptrdiff_t> (in)) & 0xF)); *cur_plan_p = fftw_plan_many_dft (rank, tmp, howmany, - reinterpret_cast<fftw_complex *> (itmp), - 0, stride, dist, reinterpret_cast<fftw_complex *> (out), - 0, stride, dist, dir, plan_flags); + reinterpret_cast<fftw_complex *> (itmp), + 0, stride, dist, + reinterpret_cast<fftw_complex *> (out), + 0, stride, dist, dir, plan_flags); } else { *cur_plan_p = fftw_plan_many_dft (rank, tmp, howmany, - reinterpret_cast<fftw_complex *> (const_cast<Complex *> (in)), - 0, stride, dist, reinterpret_cast<fftw_complex *> (out), - 0, stride, dist, dir, plan_flags); + reinterpret_cast<fftw_complex *> (const_cast<Complex *> (in)), + 0, stride, dist, + reinterpret_cast<fftw_complex *> (out), + 0, stride, dist, dir, plan_flags); } if (*cur_plan_p == 0) @@ -342,21 +344,23 @@ // Create matrix with the same size and 16-byte alignment as input OCTAVE_LOCAL_BUFFER (double, itmp, nn + 32); itmp = reinterpret_cast<double *> - (((reinterpret_cast<ptrdiff_t>(itmp) + 15) & ~ 0xF) + - ((reinterpret_cast<ptrdiff_t> (in)) & 0xF)); + (((reinterpret_cast<ptrdiff_t>(itmp) + 15) & ~ 0xF) + + ((reinterpret_cast<ptrdiff_t> (in)) & 0xF)); *cur_plan_p = fftw_plan_many_dft_r2c (rank, tmp, howmany, itmp, - 0, stride, dist, reinterpret_cast<fftw_complex *> (out), - 0, stride, dist, plan_flags); + 0, stride, dist, + reinterpret_cast<fftw_complex *> (out), + 0, stride, dist, plan_flags); } else { *cur_plan_p = fftw_plan_many_dft_r2c (rank, tmp, howmany, - (const_cast<double *> (in)), - 0, stride, dist, reinterpret_cast<fftw_complex *> (out), - 0, stride, dist, plan_flags); + (const_cast<double *> (in)), + 0, stride, dist, + reinterpret_cast<fftw_complex *> (out), + 0, stride, dist, plan_flags); } if (*cur_plan_p == 0) @@ -563,22 +567,24 @@ // Create matrix with the same size and 16-byte alignment as input OCTAVE_LOCAL_BUFFER (FloatComplex, itmp, nn * howmany + 32); itmp = reinterpret_cast<FloatComplex *> - (((reinterpret_cast<ptrdiff_t>(itmp) + 15) & ~ 0xF) + - ((reinterpret_cast<ptrdiff_t> (in)) & 0xF)); + (((reinterpret_cast<ptrdiff_t>(itmp) + 15) & ~ 0xF) + + ((reinterpret_cast<ptrdiff_t> (in)) & 0xF)); *cur_plan_p = fftwf_plan_many_dft (rank, tmp, howmany, - reinterpret_cast<fftwf_complex *> (itmp), - 0, stride, dist, reinterpret_cast<fftwf_complex *> (out), - 0, stride, dist, dir, plan_flags); + reinterpret_cast<fftwf_complex *> (itmp), + 0, stride, dist, + reinterpret_cast<fftwf_complex *> (out), + 0, stride, dist, dir, plan_flags); } else { *cur_plan_p = fftwf_plan_many_dft (rank, tmp, howmany, - reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *> (in)), - 0, stride, dist, reinterpret_cast<fftwf_complex *> (out), - 0, stride, dist, dir, plan_flags); + reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *> (in)), + 0, stride, dist, + reinterpret_cast<fftwf_complex *> (out), + 0, stride, dist, dir, plan_flags); } if (*cur_plan_p == 0) @@ -681,21 +687,23 @@ // Create matrix with the same size and 16-byte alignment as input OCTAVE_LOCAL_BUFFER (float, itmp, nn + 32); itmp = reinterpret_cast<float *> - (((reinterpret_cast<ptrdiff_t>(itmp) + 15) & ~ 0xF) + - ((reinterpret_cast<ptrdiff_t> (in)) & 0xF)); + (((reinterpret_cast<ptrdiff_t>(itmp) + 15) & ~ 0xF) + + ((reinterpret_cast<ptrdiff_t> (in)) & 0xF)); *cur_plan_p = fftwf_plan_many_dft_r2c (rank, tmp, howmany, itmp, - 0, stride, dist, reinterpret_cast<fftwf_complex *> (out), - 0, stride, dist, plan_flags); + 0, stride, dist, + reinterpret_cast<fftwf_complex *> (out), + 0, stride, dist, plan_flags); } else { *cur_plan_p = fftwf_plan_many_dft_r2c (rank, tmp, howmany, - (const_cast<float *> (in)), - 0, stride, dist, reinterpret_cast<fftwf_complex *> (out), - 0, stride, dist, plan_flags); + (const_cast<float *> (in)), + 0, stride, dist, + reinterpret_cast<fftwf_complex *> (out), + 0, stride, dist, plan_flags); } if (*cur_plan_p == 0) @@ -826,7 +834,7 @@ stride, dist, in, out); fftw_execute_dft_r2c (plan, (const_cast<double *>(in)), - reinterpret_cast<fftw_complex *> (out)); + reinterpret_cast<fftw_complex *> (out)); // Need to create other half of the transform. @@ -847,15 +855,16 @@ dist, in, out); fftw_execute_dft (plan, - reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), - reinterpret_cast<fftw_complex *> (out)); + reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), + reinterpret_cast<fftw_complex *> (out)); return 0; } int octave_fftw::ifft (const Complex *in, Complex *out, size_t npts, - size_t nsamples, octave_idx_type stride, octave_idx_type dist) + size_t nsamples, octave_idx_type stride, + octave_idx_type dist) { dist = (dist < 0 ? npts : dist); @@ -865,8 +874,8 @@ dist, in, out); fftw_execute_dft (plan, - reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), - reinterpret_cast<fftw_complex *> (out)); + reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), + reinterpret_cast<fftw_complex *> (out)); const Complex scale = npts; for (size_t j = 0; j < nsamples; j++) @@ -914,8 +923,8 @@ dv, 1, 1, dist, in, out); fftw_execute_dft (plan, - reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), - reinterpret_cast<fftw_complex *> (out)); + reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), + reinterpret_cast<fftw_complex *> (out)); return 0; } @@ -932,8 +941,8 @@ dv, 1, 1, dist, in, out); fftw_execute_dft (plan, - reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), - reinterpret_cast<fftw_complex *> (out)); + reinterpret_cast<fftw_complex *> (const_cast<Complex *>(in)), + reinterpret_cast<fftw_complex *> (out)); const size_t npts = dv.numel (); const Complex scale = npts; @@ -955,7 +964,7 @@ in, out); fftwf_execute_dft_r2c (plan, (const_cast<float *>(in)), - reinterpret_cast<fftwf_complex *> (out)); + reinterpret_cast<fftwf_complex *> (out)); // Need to create other half of the transform. @@ -977,15 +986,16 @@ in, out); fftwf_execute_dft (plan, - reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), - reinterpret_cast<fftwf_complex *> (out)); + reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), + reinterpret_cast<fftwf_complex *> (out)); return 0; } int octave_fftw::ifft (const FloatComplex *in, FloatComplex *out, size_t npts, - size_t nsamples, octave_idx_type stride, octave_idx_type dist) + size_t nsamples, octave_idx_type stride, + octave_idx_type dist) { dist = (dist < 0 ? npts : dist); @@ -996,8 +1006,8 @@ in, out); fftwf_execute_dft (plan, - reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), - reinterpret_cast<fftwf_complex *> (out)); + reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), + reinterpret_cast<fftwf_complex *> (out)); const FloatComplex scale = npts; for (size_t j = 0; j < nsamples; j++) @@ -1025,7 +1035,7 @@ out + offset); fftwf_execute_dft_r2c (plan, (const_cast<float *>(in)), - reinterpret_cast<fftwf_complex *> (out+ offset)); + reinterpret_cast<fftwf_complex *> (out+ offset)); // Need to create other half of the transform. @@ -1047,8 +1057,8 @@ dist, in, out); fftwf_execute_dft (plan, - reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), - reinterpret_cast<fftwf_complex *> (out)); + reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), + reinterpret_cast<fftwf_complex *> (out)); return 0; } @@ -1066,8 +1076,8 @@ dist, in, out); fftwf_execute_dft (plan, - reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), - reinterpret_cast<fftwf_complex *> (out)); + reinterpret_cast<fftwf_complex *> (const_cast<FloatComplex *>(in)), + reinterpret_cast<fftwf_complex *> (out)); const size_t npts = dv.numel (); const FloatComplex scale = npts;
--- a/liboctave/numeric/oct-fftw.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/oct-fftw.h Sat Oct 26 18:57:05 2013 -0700 @@ -67,9 +67,9 @@ static fftw_plan dummy; return instance_ok () - ? instance->do_create_plan (dir, rank, dims, howmany, stride, - dist, in, out) - : dummy; + ? instance->do_create_plan (dir, rank, dims, howmany, stride, + dist, in, out) + : dummy; } static fftw_plan @@ -80,8 +80,9 @@ static fftw_plan dummy; return instance_ok () - ? instance->do_create_plan (rank, dims, howmany, stride, dist, in, out) - : dummy; + ? instance->do_create_plan (rank, dims, howmany, stride, dist, + in, out) + : dummy; } static FftwMethod method (void) @@ -145,7 +146,7 @@ FftwMethod meth; - // FIXME -- perhaps this should be split into two classes? + // FIXME: perhaps this should be split into two classes? // Plan for fft and ifft of complex values fftw_plan plan[2]; @@ -227,9 +228,9 @@ static fftwf_plan dummy; return instance_ok () - ? instance->do_create_plan (dir, rank, dims, howmany, stride, - dist, in, out) - : dummy; + ? instance->do_create_plan (dir, rank, dims, howmany, stride, + dist, in, out) + : dummy; } static fftwf_plan @@ -240,8 +241,9 @@ static fftwf_plan dummy; return instance_ok () - ? instance->do_create_plan (rank, dims, howmany, stride, dist, in, out) - : dummy; + ? instance->do_create_plan (rank, dims, howmany, stride, dist, + in, out) + : dummy; } static FftwMethod method (void) @@ -305,7 +307,7 @@ FftwMethod meth; - // FIXME -- perhaps this should be split into two classes? + // FIXME: perhaps this should be split into two classes? // Plan for fft and ifft of complex values fftwf_plan plan[2]; @@ -361,11 +363,14 @@ public: static int fft (const double *in, Complex *out, size_t npts, - size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); + size_t nsamples = 1, octave_idx_type stride = 1, + octave_idx_type dist = -1); static int fft (const Complex *in, Complex *out, size_t npts, - size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); + size_t nsamples = 1, octave_idx_type stride = 1, + octave_idx_type dist = -1); static int ifft (const Complex *in, Complex *out, size_t npts, - size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); + size_t nsamples = 1, octave_idx_type stride = 1, + octave_idx_type dist = -1); static int fftNd (const double*, Complex*, const int, const dim_vector &); static int fftNd (const Complex*, Complex*, const int, @@ -374,11 +379,14 @@ const dim_vector &); static int fft (const float *in, FloatComplex *out, size_t npts, - size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); + size_t nsamples = 1, octave_idx_type stride = 1, + octave_idx_type dist = -1); static int fft (const FloatComplex *in, FloatComplex *out, size_t npts, - size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); + size_t nsamples = 1, octave_idx_type stride = 1, + octave_idx_type dist = -1); static int ifft (const FloatComplex *in, FloatComplex *out, size_t npts, - size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); + size_t nsamples = 1, octave_idx_type stride = 1, + octave_idx_type dist = -1); static int fftNd (const float*, FloatComplex*, const int, const dim_vector &); static int fftNd (const FloatComplex*, FloatComplex*, const int,
--- a/liboctave/numeric/oct-norm.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/oct-norm.cc Sat Oct 26 18:57:05 2013 -0700 @@ -341,9 +341,9 @@ } } -// Complex version. Higham's paper does not deal with complex case, so we use a simple -// extension. First, guess the magnitudes as in real version, then try to rotate lambda -// to improve further. +// Complex version. Higham's paper does not deal with complex case, so we use a +// simple extension. First, guess the magnitudes as in real version, then try +// to rotate lambda to improve further. template <class ColVectorT, class R> static void higham_subp (const ColVectorT& y, const ColVectorT& col, @@ -460,8 +460,9 @@ static const char *p_less1_gripe = "xnorm: p must be at least 1"; -// Static constant to control the maximum number of iterations. 100 seems to be a good value. -// Eventually, we can provide a means to change this constant from Octave. +// Static constant to control the maximum number of iterations. 100 seems to +// be a good value. Eventually, we can provide a means to change this +// constant from Octave. static int max_norm_iter = 100; // version with SVD for dense matrices
--- a/liboctave/numeric/oct-rand.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/oct-rand.cc Sat Oct 26 18:57:05 2013 -0700 @@ -782,7 +782,7 @@ double tmp; F77_FUNC (dignpoi, DIGNPOI) (a + 1, tmp); #define RAND_FUNC(x) F77_FUNC (dignpoi, DIGNPOI) (a, x) - MAKE_RAND (len); + MAKE_RAND (len); #undef RAND_FUNC } } @@ -872,7 +872,7 @@ double tmp; F77_FUNC (dignpoi, DIGNPOI) (da + 1, tmp); #define RAND_FUNC(x) F77_FUNC (dignpoi, DIGNPOI) (da, x) - MAKE_RAND (len); + MAKE_RAND (len); #undef RAND_FUNC } }
--- a/liboctave/numeric/oct-rand.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/oct-rand.h Sat Oct 26 18:57:05 2013 -0700 @@ -144,15 +144,15 @@ // Return an array of numbers from the sequence. static Array<double> vector (octave_idx_type n, double a = 1.0) - { - return instance_ok () ? instance->do_vector (n, a) : Array<double> (); - } + { + return instance_ok () ? instance->do_vector (n, a) : Array<double> (); + } // Return an array of numbers from the sequence. static Array<float> float_vector (octave_idx_type n, float a = 1.0) - { - return instance_ok () ? instance->do_float_vector (n, a) : Array<float> (); - } + { + return instance_ok () ? instance->do_float_vector (n, a) : Array<float> (); + } // Return an N-dimensional array of numbers from the sequence, // filled in column major order. @@ -166,7 +166,8 @@ // filled in column major order. static FloatNDArray float_nd_array (const dim_vector& dims, float a = 1.0) { - return instance_ok () ? instance->do_float_nd_array (dims, a) : FloatNDArray (); + return instance_ok () ? instance->do_float_nd_array (dims, a) + : FloatNDArray (); } private:
--- a/liboctave/numeric/randgamma.c Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/randgamma.c Sat Oct 26 18:57:05 2013 -0700 @@ -127,7 +127,8 @@ r[i] = d*v; } if (a < 1) - { /* Use gamma(a) = gamma(1+a)*U^(1/a) */ + { + /* Use gamma(a) = gamma(1+a)*U^(1/a) */ /* Given REXP = -log(U) then U^(1/a) = exp(-REXP/a) */ for (i = 0; i < n; i++) r[i] *= exp (-REXP/a); @@ -183,7 +184,8 @@ r[i] = d*v; } if (a < 1) - { /* Use gamma(a) = gamma(1+a)*U^(1/a) */ + { + /* Use gamma(a) = gamma(1+a)*U^(1/a) */ /* Given REXP = -log(U) then U^(1/a) = exp(-REXP/a) */ for (i = 0; i < n; i++) r[i] *= exp (-REXP/a);
--- a/liboctave/numeric/randgamma.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/randgamma.h Sat Oct 26 18:57:05 2013 -0700 @@ -33,7 +33,8 @@ extern OCTAVE_API void oct_fill_randg (double a, octave_idx_type n, double *p); extern OCTAVE_API float oct_float_randg (float a); -extern OCTAVE_API void oct_fill_float_randg (float a, octave_idx_type n, float *p); +extern OCTAVE_API void oct_fill_float_randg (float a, octave_idx_type n, + float *p); #ifdef __cplusplus }
--- a/liboctave/numeric/randmtzig.c Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/randmtzig.c Sat Oct 26 18:57:05 2013 -0700 @@ -195,18 +195,19 @@ void oct_init_by_int (uint32_t s) { - int j; - state[0] = s & 0xffffffffUL; - for (j = 1; j < MT_N; j++) { - state[j] = (1812433253UL * (state[j-1] ^ (state[j-1] >> 30)) + j); - /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ - /* In the previous versions, MSBs of the seed affect */ - /* only MSBs of the array state[]. */ - /* 2002/01/09 modified by Makoto Matsumoto */ - state[j] &= 0xffffffffUL; /* for >32 bit machines */ + int j; + state[0] = s & 0xffffffffUL; + for (j = 1; j < MT_N; j++) + { + state[j] = (1812433253UL * (state[j-1] ^ (state[j-1] >> 30)) + j); + /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ + /* In the previous versions, MSBs of the seed affect */ + /* only MSBs of the array state[]. */ + /* 2002/01/09 modified by Makoto Matsumoto */ + state[j] &= 0xffffffffUL; /* for >32 bit machines */ } - left = 1; - initf = 1; + left = 1; + initf = 1; } /* initialize by an array with array-length */ @@ -223,7 +224,7 @@ for (; k; k--) { state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1664525UL)) - + init_key[j] + j; /* non linear */ + + init_key[j] + j; /* non linear */ state[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ i++; j++; @@ -238,7 +239,7 @@ for (k = MT_N - 1; k; k--) { state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL)) - - i; /* non linear */ + - i; /* non linear */ state[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ i++; if (i >= MT_N) @@ -256,38 +257,38 @@ void oct_init_by_entropy (void) { - uint32_t entropy[MT_N]; - int n = 0; + uint32_t entropy[MT_N]; + int n = 0; - /* Look for entropy in /dev/urandom */ - FILE* urandom = fopen ("/dev/urandom", "rb"); - if (urandom) - { - while (n < MT_N) - { - unsigned char word[4]; - if (fread (word, 4, 1, urandom) != 1) - break; - entropy[n++] = word[0]+(word[1]<<8)+(word[2]<<16)+((uint32_t)word[3]<<24); - } - fclose (urandom); - } + /* Look for entropy in /dev/urandom */ + FILE* urandom = fopen ("/dev/urandom", "rb"); + if (urandom) + { + while (n < MT_N) + { + unsigned char word[4]; + if (fread (word, 4, 1, urandom) != 1) + break; + entropy[n++] = word[0]+(word[1]<<8)+(word[2]<<16)+((uint32_t)word[3]<<24); + } + fclose (urandom); + } - /* If there isn't enough entropy, gather some from various sources */ - if (n < MT_N) - entropy[n++] = time (NULL); /* Current time in seconds */ - if (n < MT_N) - entropy[n++] = clock (); /* CPU time used (usec) */ + /* If there isn't enough entropy, gather some from various sources */ + if (n < MT_N) + entropy[n++] = time (NULL); /* Current time in seconds */ + if (n < MT_N) + entropy[n++] = clock (); /* CPU time used (usec) */ #ifdef HAVE_GETTIMEOFDAY - if (n < MT_N) - { - struct timeval tv; - if (gettimeofday (&tv, NULL) != -1) - entropy[n++] = tv.tv_usec; /* Fractional part of current time */ - } + if (n < MT_N) + { + struct timeval tv; + if (gettimeofday (&tv, NULL) != -1) + entropy[n++] = tv.tv_usec; /* Fractional part of current time */ + } #endif - /* Send all the entropy into the initial state vector */ - oct_init_by_array (entropy,n); + /* Send all the entropy into the initial state vector */ + oct_init_by_array (entropy,n); } void
--- a/liboctave/numeric/randpoisson.c Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/randpoisson.c Sat Oct 26 18:57:05 2013 -0700 @@ -80,13 +80,14 @@ static double flogfak (double k) { -#define C0 9.18938533204672742e-01 -#define C1 8.33333333333333333e-02 -#define C3 -2.77777777777777778e-03 -#define C5 7.93650793650793651e-04 -#define C7 -5.95238095238095238e-04 +#define C0 9.18938533204672742e-01 +#define C1 8.33333333333333333e-02 +#define C3 -2.77777777777777778e-03 +#define C5 7.93650793650793651e-04 +#define C7 -5.95238095238095238e-04 - static double logfak[30L] = { + static double logfak[30L] = + { 0.00000000000000000, 0.00000000000000000, 0.69314718055994531, 1.79175946922805500, 3.17805383034794562, 4.78749174278204599, 6.57925121201010100, 8.52516136106541430, 10.60460290274525023, @@ -152,12 +153,12 @@ static double pprsc (double my) { - static double my_last = -1.0; - static double m, k2, k4, k1, k5; - static double dl, dr, r1, r2, r4, r5, ll, lr, l_my, c_pm, - f1, f2, f4, f5, p1, p2, p3, p4, p5, p6; - double Dk, X, Y; - double Ds, U, V, W; + static double my_last = -1.0; + static double m, k2, k4, k1, k5; + static double dl, dr, r1, r2, r4, r5, ll, lr, l_my, c_pm, + f1, f2, f4, f5, p1, p2, p3, p4, p5, p6; + double Dk, X, Y; + double Ds, U, V, W; if (my != my_last) { /* set-up */ @@ -322,50 +323,53 @@ size_t i = n; t[0] = P = exp (-lambda); - for (tableidx = 1; tableidx <= intlambda; tableidx++) { - P = P*lambda/(double)tableidx; - t[tableidx] = t[tableidx-1] + P; - } - - while (i-- > 0) { - double u = RUNI; - - /* If u > 0.458 we know we can jump to floor(lambda) before - * comparing (this observation is based on Stadlober's winrand - * code). For lambda >= 1, this will be a win. Lambda < 1 - * is already fast, so adding an extra comparison is not a - * problem. */ - int k = (u > 0.458 ? intlambda : 0); - - /* We aren't using a for loop here because when we find the - * right k we want to jump to the next iteration of the - * outer loop, and the continue statement will only work for - * the inner loop. */ - nextk: - if ( u <= t[k] ) { - p[i] = (double) k; - continue; - } - if (++k < tableidx) goto nextk; - - /* We only need high values of the table very rarely so we - * don't automatically compute the entire table. */ - while (tableidx < TABLESIZE) { + for (tableidx = 1; tableidx <= intlambda; tableidx++) + { P = P*lambda/(double)tableidx; t[tableidx] = t[tableidx-1] + P; - /* Make sure we converge to 1.0 just in case u is uniform - * on [0,1] rather than [0,1). */ - if (t[tableidx] == t[tableidx-1]) t[tableidx] = 1.0; - tableidx++; - if (u <= t[tableidx-1]) break; } - /* We are assuming that the table size is big enough here. - * This should be true even if RUNI is returning values in - * the range [0,1] rather than [0,1). - */ - p[i] = (double)(tableidx-1); - } + while (i-- > 0) + { + double u = RUNI; + + /* If u > 0.458 we know we can jump to floor(lambda) before + * comparing (this observation is based on Stadlober's winrand + * code). For lambda >= 1, this will be a win. Lambda < 1 + * is already fast, so adding an extra comparison is not a + * problem. */ + int k = (u > 0.458 ? intlambda : 0); + + /* We aren't using a for loop here because when we find the + * right k we want to jump to the next iteration of the + * outer loop, and the continue statement will only work for + * the inner loop. */ + nextk: + if (u <= t[k]) + { + p[i] = (double) k; + continue; + } + if (++k < tableidx) goto nextk; + + /* We only need high values of the table very rarely so we + * don't automatically compute the entire table. */ + while (tableidx < TABLESIZE) + { + P = P*lambda/(double)tableidx; + t[tableidx] = t[tableidx-1] + P; + /* Make sure we converge to 1.0 just in case u is uniform + * on [0,1] rather than [0,1). */ + if (t[tableidx] == t[tableidx-1]) t[tableidx] = 1.0; + tableidx++; + if (u <= t[tableidx-1]) break; + } + + /* We are assuming that the table size is big enough here. + * This should be true even if RUNI is returning values in + * the range [0,1] rather than [0,1). */ + p[i] = (double)(tableidx-1); + } } static void @@ -381,31 +385,35 @@ size_t i = n; t[0] = P = exp (-lambda); - for (tableidx = 1; tableidx <= intlambda; tableidx++) { - P = P*lambda/(double)tableidx; - t[tableidx] = t[tableidx-1] + P; - } - - while (i-- > 0) { - double u = RUNI; - int k = (u > 0.458 ? intlambda : 0); - nextk: - if ( u <= t[k] ) { - p[i] = (float) k; - continue; - } - if (++k < tableidx) goto nextk; - - while (tableidx < TABLESIZE) { + for (tableidx = 1; tableidx <= intlambda; tableidx++) + { P = P*lambda/(double)tableidx; t[tableidx] = t[tableidx-1] + P; - if (t[tableidx] == t[tableidx-1]) t[tableidx] = 1.0; - tableidx++; - if (u <= t[tableidx-1]) break; } - p[i] = (float)(tableidx-1); - } + while (i-- > 0) + { + double u = RUNI; + int k = (u > 0.458 ? intlambda : 0); + nextk: + if (u <= t[k]) + { + p[i] = (float) k; + continue; + } + if (++k < tableidx) goto nextk; + + while (tableidx < TABLESIZE) + { + P = P*lambda/(double)tableidx; + t[tableidx] = t[tableidx-1] + P; + if (t[tableidx] == t[tableidx-1]) t[tableidx] = 1.0; + tableidx++; + if (u <= t[tableidx-1]) break; + } + + p[i] = (float)(tableidx-1); + } } /* From Press, et al., Numerical Recipes */ @@ -420,14 +428,16 @@ for (i = 0; i < n; i++) { double y, em, t; - do { - do { - y = tan (M_PI*RUNI); - em = sq * y + lambda; - } while (em < 0.0); - em = floor (em); - t = 0.9*(1.0+y*y)*exp (em*alxm-flogfak (em)-g); - } while (RUNI > t); + do + { + do + { + y = tan (M_PI*RUNI); + em = sq * y + lambda; + } while (em < 0.0); + em = floor (em); + t = 0.9*(1.0+y*y)*exp (em*alxm-flogfak (em)-g); + } while (RUNI > t); p[i] = em; } } @@ -444,14 +454,16 @@ for (i = 0; i < n; i++) { double y, em, t; - do { - do { - y = tan (M_PI*RUNI); - em = sq * y + lambda; - } while (em < 0.0); - em = floor (em); - t = 0.9*(1.0+y*y)*exp (em*alxm-flogfak (em)-g); - } while (RUNI > t); + do + { + do + { + y = tan (M_PI*RUNI); + em = sq * y + lambda; + } while (em < 0.0); + em = floor (em); + t = 0.9*(1.0+y*y)*exp (em*alxm-flogfak (em)-g); + } while (RUNI > t); p[i] = em; } } @@ -503,28 +515,36 @@ { double ret; if (L < 0.0) ret = NAN; - else if (L <= 12.0) { - /* From Press, et al. Numerical recipes */ - double g = exp (-L); - int em = -1; - double t = 1.0; - do { - ++em; - t *= RUNI; - } while (t > g); - ret = em; - } else if (L <= 1e8) { - /* numerical recipes */ - poisson_rejection (L, &ret, 1); - } else if (INFINITE(L)) { - /* FIXME R uses NaN, but the normal approx. suggests that as - * limit should be inf. Which is correct? */ - ret = NAN; - } else { - /* normal approximation: from Phys. Rev. D (1994) v50 p1284 */ - ret = floor (RNOR*sqrt (L) + L + 0.5); - if (ret < 0.0) ret = 0.0; /* will probably never happen */ - } + else if (L <= 12.0) + { + /* From Press, et al. Numerical recipes */ + double g = exp (-L); + int em = -1; + double t = 1.0; + do + { + ++em; + t *= RUNI; + } while (t > g); + ret = em; + } + else if (L <= 1e8) + { + /* numerical recipes */ + poisson_rejection (L, &ret, 1); + } + else if (INFINITE(L)) + { + /* FIXME R uses NaN, but the normal approx. suggests that as + * limit should be inf. Which is correct? */ + ret = NAN; + } + else + { + /* normal approximation: from Phys. Rev. D (1994) v50 p1284 */ + ret = floor (RNOR*sqrt (L) + L + 0.5); + if (ret < 0.0) ret = 0.0; /* will probably never happen */ + } return ret; } @@ -568,27 +588,35 @@ double L = FL; float ret; if (L < 0.0) ret = NAN; - else if (L <= 12.0) { - /* From Press, et al. Numerical recipes */ - double g = exp (-L); - int em = -1; - double t = 1.0; - do { - ++em; - t *= RUNI; - } while (t > g); - ret = em; - } else if (L <= 1e8) { - /* numerical recipes */ - poisson_rejection_float (L, &ret, 1); - } else if (INFINITE(L)) { - /* FIXME R uses NaN, but the normal approx. suggests that as - * limit should be inf. Which is correct? */ - ret = NAN; - } else { - /* normal approximation: from Phys. Rev. D (1994) v50 p1284 */ - ret = floor (RNOR*sqrt (L) + L + 0.5); - if (ret < 0.0) ret = 0.0; /* will probably never happen */ - } + else if (L <= 12.0) + { + /* From Press, et al. Numerical recipes */ + double g = exp (-L); + int em = -1; + double t = 1.0; + do + { + ++em; + t *= RUNI; + } while (t > g); + ret = em; + } + else if (L <= 1e8) + { + /* numerical recipes */ + poisson_rejection_float (L, &ret, 1); + } + else if (INFINITE(L)) + { + /* FIXME R uses NaN, but the normal approx. suggests that as + * limit should be inf. Which is correct? */ + ret = NAN; + } + else + { + /* normal approximation: from Phys. Rev. D (1994) v50 p1284 */ + ret = floor (RNOR*sqrt (L) + L + 0.5); + if (ret < 0.0) ret = 0.0; /* will probably never happen */ + } return ret; }
--- a/liboctave/numeric/randpoisson.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/randpoisson.h Sat Oct 26 18:57:05 2013 -0700 @@ -33,7 +33,8 @@ extern OCTAVE_API void oct_fill_randp (double L, octave_idx_type n, double *p); extern OCTAVE_API float oct_float_randp (float L); -extern OCTAVE_API void oct_fill_float_randp (float L, octave_idx_type n, float *p); +extern OCTAVE_API void oct_fill_float_randp (float L, octave_idx_type n, + float *p); #ifdef __cplusplus }
--- a/liboctave/numeric/sparse-base-chol.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/sparse-base-chol.h Sat Oct 26 18:57:05 2013 -0700 @@ -39,36 +39,36 @@ sparse_base_chol_rep (void) : count (1), Lsparse (0), Common (), is_pd (false), minor_p (0), perms (), cond (0) - { } + { } sparse_base_chol_rep (const chol_type& a, bool natural, bool force) : count (1), Lsparse (0), Common (), is_pd (false), minor_p (0), perms (), cond (0) - { - init (a, natural, force); - } + { + init (a, natural, force); + } sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, bool natural, bool force) : count (1), Lsparse (0), Common (), is_pd (false), minor_p (0), perms (), cond (0) - { - info = init (a, natural, force); - } + { + info = init (a, natural, force); + } ~sparse_base_chol_rep (void) - { - if (is_pd) - CHOLMOD_NAME (free_sparse) (&Lsparse, &Common); - } + { + if (is_pd) + CHOLMOD_NAME (free_sparse) (&Lsparse, &Common); + } cholmod_sparse * L (void) const { return Lsparse; } octave_idx_type P (void) const - { - return (minor_p == static_cast<octave_idx_type>(Lsparse->ncol) ? - 0 : minor_p + 1); - } + { + return (minor_p == static_cast<octave_idx_type>(Lsparse->ncol) ? + 0 : minor_p + 1); + } ColumnVector perm (void) const { return perms + 1; } @@ -112,16 +112,16 @@ sparse_base_chol_rep (const chol_type& a, bool natural, bool force) : count (1), is_pd (false), minor_p (0), perms (), cond (0) - { - init (a, natural, force); - } + { + init (a, natural, force); + } sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, bool natural, bool force) : count (1), is_pd (false), minor_p (0), perms (), cond (0) - { - info = init (a, natural, force); - } + { + info = init (a, natural, force); + } ~sparse_base_chol_rep (void) { } @@ -156,49 +156,53 @@ }; #endif - private: +private: sparse_base_chol_rep *rep; public: sparse_base_chol (void) : rep (new typename - sparse_base_chol<chol_type, chol_elt, p_type>::sparse_base_chol_rep ()) - { } + sparse_base_chol<chol_type, chol_elt, p_type> + ::sparse_base_chol_rep ()) + { } sparse_base_chol (const chol_type& a, bool natural, bool force) : rep (new typename - sparse_base_chol<chol_type, chol_elt, p_type>::sparse_base_chol_rep (a, natural, force)) - { } + sparse_base_chol<chol_type, chol_elt, p_type> + ::sparse_base_chol_rep (a, natural, force)) + { } sparse_base_chol (const chol_type& a, octave_idx_type& info, bool natural, bool force) - : rep (new typename sparse_base_chol<chol_type, chol_elt, p_type>::sparse_base_chol_rep (a, info, natural, force)) - { } + : rep (new typename + sparse_base_chol<chol_type, chol_elt, p_type> + ::sparse_base_chol_rep (a, info, natural, force)) + { } sparse_base_chol (const sparse_base_chol<chol_type, chol_elt, p_type>& a) : rep (a.rep) - { rep->count++; } + { rep->count++; } virtual ~sparse_base_chol (void) - { - if (--rep->count == 0) - delete rep; - } + { + if (--rep->count == 0) + delete rep; + } sparse_base_chol& operator = (const sparse_base_chol& a) - { - if (this != &a) - { - if (--rep->count == 0) - delete rep; + { + if (this != &a) + { + if (--rep->count == 0) + delete rep; - rep = a.rep; - rep->count++; - } + rep = a.rep; + rep->count++; + } - return *this; - } + return *this; + } chol_type L (void) const; @@ -211,7 +215,7 @@ p_type Q (void) const { return rep->Q (); } bool is_positive_definite (void) const - { return rep->is_positive_definite (); } + { return rep->is_positive_definite (); } double rcond (void) const { return rep->rcond (); }
--- a/liboctave/numeric/sparse-base-lu.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/sparse-base-lu.h Sat Oct 26 18:57:05 2013 -0700 @@ -39,21 +39,21 @@ sparse_base_lu (const sparse_base_lu& a) : Lfact (a.Lfact), Ufact (a.Ufact), Rfact (), cond (a.cond), - P (a.P), Q (a.Q) - { } + P (a.P), Q (a.Q) + { } sparse_base_lu& operator = (const sparse_base_lu& a) - { - if (this != &a) - { - Lfact = a.Lfact; - Ufact = a.Ufact; - cond = a.cond; - P = a.P; - Q = a.Q; - } - return *this; - } + { + if (this != &a) + { + Lfact = a.Lfact; + Ufact = a.Ufact; + cond = a.cond; + P = a.P; + Q = a.Q; + } + return *this; + } virtual ~sparse_base_lu (void) { }
--- a/liboctave/numeric/sparse-dmsolve.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/numeric/sparse-dmsolve.cc Sat Oct 26 18:57:05 2013 -0700 @@ -38,10 +38,10 @@ template <class T> static MSparse<T> dmsolve_extract (const MSparse<T> &A, const octave_idx_type *Pinv, - const octave_idx_type *Q, octave_idx_type rst, - octave_idx_type rend, octave_idx_type cst, - octave_idx_type cend, octave_idx_type maxnz = -1, - bool lazy = false) + const octave_idx_type *Q, octave_idx_type rst, + octave_idx_type rend, octave_idx_type cst, + octave_idx_type cend, octave_idx_type maxnz = -1, + bool lazy = false) { octave_idx_type nr = rend - rst, nc = cend - cst; maxnz = (maxnz < 0 ? A.nnz () : maxnz); @@ -111,17 +111,17 @@ #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) static MSparse<double> dmsolve_extract (const MSparse<double> &A, const octave_idx_type *Pinv, - const octave_idx_type *Q, octave_idx_type rst, - octave_idx_type rend, octave_idx_type cst, - octave_idx_type cend, octave_idx_type maxnz, - bool lazy); + const octave_idx_type *Q, octave_idx_type rst, + octave_idx_type rend, octave_idx_type cst, + octave_idx_type cend, octave_idx_type maxnz, + bool lazy); static MSparse<Complex> dmsolve_extract (const MSparse<Complex> &A, const octave_idx_type *Pinv, - const octave_idx_type *Q, octave_idx_type rst, - octave_idx_type rend, octave_idx_type cst, - octave_idx_type cend, octave_idx_type maxnz, - bool lazy); + const octave_idx_type *Q, octave_idx_type rst, + octave_idx_type rend, octave_idx_type cst, + octave_idx_type cend, octave_idx_type maxnz, + bool lazy); #endif template <class T> @@ -165,7 +165,7 @@ template <class T> static void dmsolve_insert (MArray<T> &a, const MArray<T> &b, const octave_idx_type *Q, - octave_idx_type r, octave_idx_type c) + octave_idx_type r, octave_idx_type c) { T *ax = a.fortran_vec (); const T *bx = b.fortran_vec (); @@ -187,17 +187,17 @@ #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) static void dmsolve_insert (MArray<double> &a, const MArray<double> &b, - const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); + const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); static void dmsolve_insert (MArray<Complex> &a, const MArray<Complex> &b, - const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); + const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); #endif template <class T> static void dmsolve_insert (MSparse<T> &a, const MSparse<T> &b, const octave_idx_type *Q, - octave_idx_type r, octave_idx_type c) + octave_idx_type r, octave_idx_type c) { octave_idx_type b_rows = b.rows (); octave_idx_type b_cols = b.cols (); @@ -274,11 +274,11 @@ #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) static void dmsolve_insert (MSparse<double> &a, const SparseMatrix &b, - const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); + const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); static void dmsolve_insert (MSparse<Complex> &a, const MSparse<Complex> &b, - const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); + const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); #endif template <class T, class RT>
--- a/liboctave/operators/Sparse-diag-op-defs.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/operators/Sparse-diag-op-defs.h Sat Oct 26 18:57:05 2013 -0700 @@ -40,30 +40,30 @@ return RT (); } else - { - RT r (nr, a_nc, a.nnz ()); + { + RT r (nr, a_nc, a.nnz ()); - octave_idx_type l = 0; + octave_idx_type l = 0; - for (octave_idx_type j = 0; j < a_nc; j++) - { - r.xcidx (j) = l; - const octave_idx_type colend = a.cidx (j+1); - for (octave_idx_type k = a.cidx (j); k < colend; k++) - { - const octave_idx_type i = a.ridx (k); - if (i >= nr) break; - r.xdata (l) = d.dgelem (i) * a.data (k); - r.xridx (l) = i; - l++; - } - } + for (octave_idx_type j = 0; j < a_nc; j++) + { + r.xcidx (j) = l; + const octave_idx_type colend = a.cidx (j+1); + for (octave_idx_type k = a.cidx (j); k < colend; k++) + { + const octave_idx_type i = a.ridx (k); + if (i >= nr) break; + r.xdata (l) = d.dgelem (i) * a.data (k); + r.xridx (l) = i; + l++; + } + } - r.xcidx (a_nc) = l; + r.xcidx (a_nc) = l; - r.maybe_compress (true); - return r; - } + r.maybe_compress (true); + return r; + } } template <typename RT, typename SM, typename DM> @@ -81,28 +81,28 @@ return RT (); } else - { + { - const octave_idx_type mnc = nc < a_nc ? nc: a_nc; - RT r (a_nr, nc, a.cidx (mnc)); + const octave_idx_type mnc = nc < a_nc ? nc: a_nc; + RT r (a_nr, nc, a.cidx (mnc)); - for (octave_idx_type j = 0; j < mnc; ++j) - { - const typename DM::element_type s = d.dgelem (j); - const octave_idx_type colend = a.cidx (j+1); - r.xcidx (j) = a.cidx (j); - for (octave_idx_type k = a.cidx (j); k < colend; ++k) - { - r.xdata (k) = s * a.data (k); - r.xridx (k) = a.ridx (k); - } - } - for (octave_idx_type j = mnc; j <= nc; ++j) - r.xcidx (j) = a.cidx (mnc); + for (octave_idx_type j = 0; j < mnc; ++j) + { + const typename DM::element_type s = d.dgelem (j); + const octave_idx_type colend = a.cidx (j+1); + r.xcidx (j) = a.cidx (j); + for (octave_idx_type k = a.cidx (j); k < colend; ++k) + { + r.xdata (k) = s * a.data (k); + r.xridx (k) = a.ridx (k); + } + } + for (octave_idx_type j = mnc; j <= nc; ++j) + r.xcidx (j) = a.cidx (mnc); - r.maybe_compress (true); - return r; - } + r.maybe_compress (true); + return r; + } } // FIXME: functors such as this should be gathered somewhere
--- a/liboctave/operators/Sparse-op-defs.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/operators/Sparse-op-defs.h Sat Oct 26 18:57:05 2013 -0700 @@ -667,7 +667,7 @@ else \ { \ \ - /* FIXME Kludge... Always double/Complex, so Complex () */ \ + /* FIXME: Kludge... Always double/Complex, so Complex () */ \ r = R (m1_nr, m1_nc, (Complex () OP Complex ())); \ \ for (octave_idx_type i = 0 ; i < m1_nc ; i++) \ @@ -717,8 +717,7 @@ // Note that SM ./ SM needs to take into account the NaN and Inf values // implied by the division by zero. -// FIXME Are the NaNs double(NaN) or Complex(NaN,Nan) in the complex -// case? +// FIXME: Are the NaNs double(NaN) or Complex(NaN,Nan) in the complex case? #define SPARSE_SMSM_BIN_OPS(R1, R2, M1, M2) \ SPARSE_SMSM_BIN_OP_1 (R1, operator +, +, M1, M2) \ SPARSE_SMSM_BIN_OP_1 (R1, operator -, -, M1, M2) \ @@ -737,9 +736,8 @@ SPARSE_CMP_OP_DECL (mx_el_eq, M1, M2, API); \ SPARSE_CMP_OP_DECL (mx_el_ne, M1, M2, API); -// FIXME -- this macro duplicatest the bodies of the template -// functions defined in the SPARSE_SSM_CMP_OP and SPARSE_SMS_CMP_OP -// macros. +// FIXME: this macro duplicates the bodies of the template functions +// defined in the SPARSE_SSM_CMP_OP and SPARSE_SMS_CMP_OP macros. #define SPARSE_SMSM_CMP_OP(F, OP, M1, Z1, C1, M2, Z2, C2) \ SparseBoolMatrix \ @@ -921,9 +919,8 @@ SPARSE_BOOL_OP_DECL (mx_el_and, M1, M2, API); \ SPARSE_BOOL_OP_DECL (mx_el_or, M1, M2, API); -// FIXME -- this macro duplicatest the bodies of the template -// functions defined in the SPARSE_SSM_BOOL_OP and SPARSE_SMS_BOOL_OP -// macros. +// FIXME: this macro duplicates the bodies of the template functions +// defined in the SPARSE_SSM_BOOL_OP and SPARSE_SMS_BOOL_OP macros. #define SPARSE_SMSM_BOOL_OP(F, OP, M1, M2, LHS_ZERO, RHS_ZERO) \ SparseBoolMatrix \ @@ -1150,7 +1147,7 @@ return r; \ } -// FIXME Pass a specific ZERO value +// FIXME: Pass a specific ZERO value #define SPARSE_MSM_BIN_OPS(R1, R2, M1, M2) \ SPARSE_MSM_BIN_OP_1 (R1, operator +, +, M1, M2) \ SPARSE_MSM_BIN_OP_1 (R1, operator -, -, M1, M2) \ @@ -1810,8 +1807,7 @@ // Don't break from this loop if the test succeeds because -// we are looping over the rows and not the columns in the inner -// loop. +// we are looping over the rows and not the columns in the inner loop. #define SPARSE_ANY_ALL_OP_ROW_CODE(TEST_OP, TEST_TRUE_VAL) \ if (data (i) TEST_OP 0.0) \ tmp[ridx (i)] = TEST_TRUE_VAL; \
--- a/liboctave/operators/mx-inlines.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/operators/mx-inlines.cc Sat Oct 26 18:57:05 2013 -0700 @@ -1053,21 +1053,21 @@ } break; default: - { - OCTAVE_LOCAL_BUFFER (T, buf, n-1); + { + OCTAVE_LOCAL_BUFFER (T, buf, n-1); - for (octave_idx_type i = 0; i < n-1; i++) - buf[i] = v[i+1] - v[i]; + for (octave_idx_type i = 0; i < n-1; i++) + buf[i] = v[i+1] - v[i]; - for (octave_idx_type o = 2; o <= order; o++) - { - for (octave_idx_type i = 0; i < n-o; i++) - buf[i] = buf[i+1] - buf[i]; - } + for (octave_idx_type o = 2; o <= order; o++) + { + for (octave_idx_type i = 0; i < n-o; i++) + buf[i] = buf[i+1] - buf[i]; + } - for (octave_idx_type i = 0; i < n-order; i++) - r[i] = buf[i]; - } + for (octave_idx_type i = 0; i < n-order; i++) + r[i] = buf[i]; + } } } @@ -1090,24 +1090,24 @@ } break; default: - { - OCTAVE_LOCAL_BUFFER (T, buf, n-1); + { + OCTAVE_LOCAL_BUFFER (T, buf, n-1); - for (octave_idx_type j = 0; j < m; j++) - { - for (octave_idx_type i = 0; i < n-1; i++) - buf[i] = v[i*m+j+m] - v[i*m+j]; + for (octave_idx_type j = 0; j < m; j++) + { + for (octave_idx_type i = 0; i < n-1; i++) + buf[i] = v[i*m+j+m] - v[i*m+j]; - for (octave_idx_type o = 2; o <= order; o++) - { - for (octave_idx_type i = 0; i < n-o; i++) - buf[i] = buf[i+1] - buf[i]; - } + for (octave_idx_type o = 2; o <= order; o++) + { + for (octave_idx_type i = 0; i < n-o; i++) + buf[i] = buf[i+1] - buf[i]; + } - for (octave_idx_type i = 0; i < n-order; i++) - r[i*m+j] = buf[i]; - } - } + for (octave_idx_type i = 0; i < n-order; i++) + r[i*m+j] = buf[i]; + } + } } }
--- a/liboctave/system/dir-ops.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/dir-ops.h Sat Oct 26 18:57:05 2013 -0700 @@ -35,26 +35,26 @@ dir_entry (const std::string& n = std::string ()) : name (n), dir (0), fail (false), errmsg () - { - if (! name.empty ()) - open (); - } + { + if (! name.empty ()) + open (); + } dir_entry (const dir_entry& d) : name (d.name), dir (d.dir), fail (d.fail), errmsg (d.errmsg) { } dir_entry& operator = (const dir_entry& d) - { - if (this != &d) - { - name = d.name; - dir = d.dir; - fail = d.fail; - errmsg = d.errmsg; - } + { + if (this != &d) + { + name = d.name; + dir = d.dir; + fail = d.fail; + errmsg = d.errmsg; + } - return *this; - } + return *this; + } ~dir_entry (void) { close (); }
--- a/liboctave/system/file-ops.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/file-ops.cc Sat Oct 26 18:57:05 2013 -0700 @@ -356,10 +356,10 @@ file_ops::concat (const std::string& dir, const std::string& file) { return dir.empty () - ? file - : (is_dir_sep (dir[dir.length ()-1]) - ? dir + file - : dir + dir_sep_char () + file); + ? file + : (is_dir_sep (dir[dir.length ()-1]) + ? dir + file + : dir + dir_sep_char () + file); } @@ -420,7 +420,7 @@ int octave_link (const std::string& old_name, - const std::string& new_name, std::string& msg) + const std::string& new_name, std::string& msg) { msg = std::string (); @@ -443,7 +443,7 @@ int octave_symlink (const std::string& old_name, - const std::string& new_name, std::string& msg) + const std::string& new_name, std::string& msg) { msg = std::string (); @@ -466,7 +466,7 @@ int octave_readlink (const std::string& path, std::string& result, - std::string& msg) + std::string& msg) { int status = -1; @@ -497,7 +497,7 @@ int octave_rename (const std::string& from, const std::string& to, - std::string& msg) + std::string& msg) { int status = -1; @@ -786,7 +786,7 @@ #else - // FIXME -- provide replacement here... + // FIXME: provide replacement here... retval = name; #endif
--- a/liboctave/system/file-stat.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/file-stat.cc Sat Oct 26 18:57:05 2013 -0700 @@ -36,7 +36,7 @@ #include "file-stat.h" #include "statdefs.h" -// FIXME -- the is_* and mode_as_string functions are only valid +// FIXME: the is_* and mode_as_string functions are only valid // for initialized objects. If called for an object that is not // initialized, they should throw an exception. @@ -198,7 +198,7 @@ struct stat buf; int status = follow_links - ? stat (cname, &buf) : gnulib::lstat (cname, &buf); + ? stat (cname, &buf) : gnulib::lstat (cname, &buf); if (status < 0) {
--- a/liboctave/system/file-stat.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/file-stat.h Sat Oct 26 18:57:05 2013 -0700 @@ -75,8 +75,8 @@ } // The minimum difference in file time stamp values. - // FIXME -- this value should come from the filesystem itself. How - // can we get that info? + // FIXME: This value should come from the filesystem itself. + // How can we get that info? octave_time time_resolution (void) const { static octave_time resolution (1.0);
--- a/liboctave/system/lo-sysdep.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/lo-sysdep.cc Sat Oct 26 18:57:05 2013 -0700 @@ -83,14 +83,16 @@ #if defined (__WIN32__) && ! defined (__CYGWIN__) pid_t -octave_popen2 (const std::string& cmd, const string_vector& args, bool sync_mode, - int *fildes, std::string& msg) +octave_popen2 (const std::string& cmd, const string_vector& args, + bool sync_mode, + int *fildes, std::string& msg) { pid_t pid; PROCESS_INFORMATION pi; STARTUPINFO si; std::string command = "\"" + cmd + "\""; - HANDLE hProcess = GetCurrentProcess (), childRead, childWrite, parentRead, parentWrite; + HANDLE hProcess = GetCurrentProcess (); + HANDLE childRead, childWrite, parentRead, parentWrite; DWORD pipeMode; ZeroMemory (&pi, sizeof (pi)); @@ -98,13 +100,15 @@ si.cb = sizeof (si); if (! CreatePipe (&childRead, &parentWrite, 0, 0) || - ! DuplicateHandle (hProcess, childRead, hProcess, &childRead, 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) + ! DuplicateHandle (hProcess, childRead, hProcess, &childRead, 0, TRUE, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) { msg = "popen2: pipe creation failed"; return -1; } if (! CreatePipe (&parentRead, &childWrite, 0, 0) || - ! DuplicateHandle (hProcess, childWrite, hProcess, &childWrite, 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) + ! DuplicateHandle (hProcess, childWrite, hProcess, &childWrite, 0, TRUE, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) { msg = "popen2: pipe creation failed"; return -1; @@ -114,8 +118,10 @@ pipeMode = PIPE_NOWAIT; SetNamedPipeHandleState (parentRead, &pipeMode, 0, 0); } - fildes[1] = _open_osfhandle (reinterpret_cast<intptr_t> (parentRead), _O_RDONLY | _O_BINARY); - fildes[0] = _open_osfhandle (reinterpret_cast<intptr_t> (parentWrite), _O_WRONLY | _O_BINARY); + fildes[1] = _open_osfhandle (reinterpret_cast<intptr_t> (parentRead), + _O_RDONLY | _O_BINARY); + fildes[0] = _open_osfhandle (reinterpret_cast<intptr_t> (parentWrite), + _O_WRONLY | _O_BINARY); si.dwFlags |= STARTF_USESTDHANDLES; si.hStdInput = childRead; si.hStdOutput = childWrite;
--- a/liboctave/system/lo-sysdep.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/lo-sysdep.h Sat Oct 26 18:57:05 2013 -0700 @@ -34,7 +34,7 @@ #if defined (__WIN32__) && ! defined (__CYGWIN__) extern pid_t octave_popen2 (const std::string&, const string_vector&, - bool, int *, std::string&); + bool, int *, std::string&); #endif #endif
--- a/liboctave/system/mach-info.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/mach-info.cc Sat Oct 26 18:57:05 2013 -0700 @@ -164,21 +164,21 @@ oct_mach_info::native_float_format (void) { return (instance_ok ()) - ? instance->native_float_fmt : oct_mach_info::flt_fmt_unknown; + ? instance->native_float_fmt : oct_mach_info::flt_fmt_unknown; } bool oct_mach_info::words_big_endian (void) { return (instance_ok ()) - ? instance->big_chief : false; + ? instance->big_chief : false; } bool oct_mach_info::words_little_endian (void) { return (instance_ok ()) - ? (! instance->big_chief) : false; + ? (! instance->big_chief) : false; } oct_mach_info::float_format
--- a/liboctave/system/mach-info.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/mach-info.h Sat Oct 26 18:57:05 2013 -0700 @@ -36,11 +36,11 @@ public: enum float_format - { - flt_fmt_unknown, - flt_fmt_ieee_little_endian, - flt_fmt_ieee_big_endian, - }; + { + flt_fmt_unknown, + flt_fmt_ieee_little_endian, + flt_fmt_ieee_big_endian, + }; static bool instance_ok (void);
--- a/liboctave/system/oct-env.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/oct-env.cc Sat Oct 26 18:57:05 2013 -0700 @@ -104,63 +104,63 @@ octave_env::polite_directory_format (const std::string& name) { return (instance_ok ()) - ? instance->do_polite_directory_format (name) : std::string (); + ? instance->do_polite_directory_format (name) : std::string (); } bool octave_env::absolute_pathname (const std::string& s) { return (instance_ok ()) - ? instance->do_absolute_pathname (s) : false; + ? instance->do_absolute_pathname (s) : false; } bool octave_env::rooted_relative_pathname (const std::string& s) { return (instance_ok ()) - ? instance->do_rooted_relative_pathname (s) : false; + ? instance->do_rooted_relative_pathname (s) : false; } std::string octave_env::base_pathname (const std::string& s) { return (instance_ok ()) - ? instance->do_base_pathname (s) : std::string (); + ? instance->do_base_pathname (s) : std::string (); } std::string octave_env::make_absolute (const std::string& s, const std::string& dot_path) { return (instance_ok ()) - ? instance->do_make_absolute (s, dot_path) : std::string (); + ? instance->do_make_absolute (s, dot_path) : std::string (); } std::string octave_env::get_current_directory () { return (instance_ok ()) - ? instance->do_getcwd () : std::string (); + ? instance->do_getcwd () : std::string (); } std::string octave_env::get_home_directory () { return (instance_ok ()) - ? instance->do_get_home_directory () : std::string (); + ? instance->do_get_home_directory () : std::string (); } std::string octave_env::get_program_name (void) { return (instance_ok ()) - ? instance->prog_name : std::string (); + ? instance->prog_name : std::string (); } std::string octave_env::get_program_invocation_name (void) { return (instance_ok ()) - ? instance->prog_invocation_name : std::string (); + ? instance->prog_invocation_name : std::string (); } void @@ -174,17 +174,17 @@ octave_env::get_user_name (void) { return (instance_ok ()) - ? instance->do_get_user_name () : std::string (); + ? instance->do_get_user_name () : std::string (); } std::string octave_env::get_host_name (void) { return (instance_ok ()) - ? instance->do_get_host_name () : std::string (); + ? instance->do_get_host_name () : std::string (); } -// FIXME -- this leaves no way to distinguish between a +// FIXME: this leaves no way to distinguish between a // variable that is not set and one that is set to the empty string. // Is this a problem? @@ -192,7 +192,7 @@ octave_env::getenv (const std::string& name) { return (instance_ok ()) - ? instance->do_getenv (name) : std::string (); + ? instance->do_getenv (name) : std::string (); } void @@ -213,7 +213,7 @@ octave_env::chdir (const std::string& newdir) { return (instance_ok ()) - ? instance->do_chdir (newdir) : false; + ? instance->do_chdir (newdir) : false; } void @@ -230,7 +230,7 @@ // Also keep a shortened version of the program name. prog_name = (pos == std::string::npos) - ? prog_invocation_name : prog_invocation_name.substr (pos+1); + ? prog_invocation_name : prog_invocation_name.substr (pos+1); } // Return a pretty pathname. If the first part of the pathname is the @@ -339,7 +339,7 @@ if (! file_ops::is_dir_sep (current_dir[pos])) current_dir.append (file_ops::dir_sep_str ()); - // FIXME -- this is probably not correct for all systems. + // FIXME: this is probably not correct for all systems. size_t i = 0; size_t slen = s.length ();
--- a/liboctave/system/oct-group.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/oct-group.cc Sat Oct 26 18:57:05 2013 -0700 @@ -188,9 +188,8 @@ gr_gid = gr->gr_gid; - // FIXME -- maybe there should be a string_vector - // constructor that takes a NUL terminated list of C - // strings. + // FIXME: Maybe there should be a string_vector constructor + // that takes a NUL terminated list of C strings? const char * const *tmp = gr->gr_mem;
--- a/liboctave/system/oct-syscalls.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/oct-syscalls.cc Sat Oct 26 18:57:05 2013 -0700 @@ -299,7 +299,7 @@ pid_t octave_syscalls::popen2 (const std::string& cmd, const string_vector& args, - bool sync_mode, int *fildes) + bool sync_mode, int *fildes) { std::string msg; bool interactive = false; @@ -308,7 +308,7 @@ pid_t octave_syscalls::popen2 (const std::string& cmd, const string_vector& args, - bool sync_mode, int *fildes, std::string& msg) + bool sync_mode, int *fildes, std::string& msg) { bool interactive = false; return popen2 (cmd, args, sync_mode, fildes, msg, interactive); @@ -316,7 +316,8 @@ pid_t octave_syscalls::popen2 (const std::string& cmd, const string_vector& args, - bool sync_mode, int *fildes, std::string& msg, bool &interactive) + bool sync_mode, int *fildes, std::string& msg, + bool &interactive) { #if defined (__WIN32__) && ! defined (__CYGWIN__) return ::octave_popen2 (cmd, args, sync_mode, fildes, msg); @@ -367,7 +368,8 @@ gnulib::close (child_stdout[1]); #if defined (F_SETFL) && defined (O_NONBLOCK) - if (! sync_mode && octave_fcntl (child_stdout[0], F_SETFL, O_NONBLOCK, msg) < 0) + if (! sync_mode && octave_fcntl (child_stdout[0], F_SETFL, + O_NONBLOCK, msg) < 0) msg = "popen2: error setting file mode -- " + msg; else #endif
--- a/liboctave/system/oct-syscalls.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/oct-syscalls.h Sat Oct 26 18:57:05 2013 -0700 @@ -63,8 +63,10 @@ static int kill (pid_t, int, std::string&); static pid_t popen2 (const std::string&, const string_vector&, bool, int *); - static pid_t popen2 (const std::string&, const string_vector&, bool, int *, std::string&); - static pid_t popen2 (const std::string&, const string_vector&, bool, int *, std::string&, bool &interactive); + static pid_t popen2 (const std::string&, const string_vector&, bool, int *, + std::string&); + static pid_t popen2 (const std::string&, const string_vector&, bool, int *, + std::string&, bool &interactive); }; #endif
--- a/liboctave/system/oct-time.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/oct-time.h Sat Oct 26 18:57:05 2013 -0700 @@ -236,7 +236,7 @@ std::string strftime (const std::string& fmt) const; std::string asctime (void) const - { return strftime ("%a %b %d %H:%M:%S %Y\n"); } + { return strftime ("%a %b %d %H:%M:%S %Y\n"); } protected:
--- a/liboctave/system/tempname.c Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/system/tempname.c Sat Oct 26 18:57:05 2013 -0700 @@ -179,7 +179,7 @@ letters[(*idx / ((sizeof (letters) - 1) * (sizeof (letters) - 1))) % (sizeof (letters) - 1)] - ); + ); if (! buf || strlen (buf) != (int) len) return NULL;
--- a/liboctave/util/action-container.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/action-container.h Sat Oct 26 18:57:05 2013 -0700 @@ -28,7 +28,7 @@ // execution, either explicitly or when the container goes out of // scope. -// FIXME -- is there a better name for this class? +// FIXME: is there a better name for this class? class action_container
--- a/liboctave/util/base-list.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/base-list.h Sat Oct 26 18:57:05 2013 -0700 @@ -82,10 +82,12 @@ const_iterator end (void) const { return const_iterator (lst.end ()); } reverse_iterator rbegin (void) { return reverse_iterator (lst.rbegin ()); } - const_reverse_iterator rbegin (void) const { return const_reverse_iterator (lst.rbegin ()); } + const_reverse_iterator rbegin (void) const + { return const_reverse_iterator (lst.rbegin ()); } reverse_iterator rend (void) { return reverse_iterator (lst.rend ()); } - const_reverse_iterator rend (void) const { return const_reverse_iterator (lst.rend ()); } + const_reverse_iterator rend (void) const + { return const_reverse_iterator (lst.rend ()); } elt_type& front (void) { return lst.front (); } elt_type& back (void) { return lst.back (); } @@ -111,13 +113,13 @@ octave_base_list (const octave_base_list& bl) : lst (bl.lst) { } octave_base_list& operator = (const octave_base_list& bl) - { - if (this != &bl) - { - lst = bl.lst; - } - return *this; - } + { + if (this != &bl) + { + lst = bl.lst; + } + return *this; + } ~octave_base_list (void) { }
--- a/liboctave/util/cmd-edit.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/cmd-edit.cc Sat Oct 26 18:57:05 2013 -0700 @@ -224,7 +224,7 @@ quoting_function (0), dequoting_function (0), char_is_quoted_function (0), user_accept_line_function (0) { - // FIXME -- need interface to rl_add_defun, rl_initialize, and + // FIXME: need interface to rl_add_defun, rl_initialize, and // a function to set rl_terminal_name std::string term = octave_env::getenv ("TERM"); @@ -1060,7 +1060,7 @@ command_editor::get_input_stream (void) { return (instance_ok ()) - ? instance->do_get_input_stream () : 0; + ? instance->do_get_input_stream () : 0; } void @@ -1074,7 +1074,7 @@ command_editor::get_output_stream (void) { return (instance_ok ()) - ? instance->do_get_output_stream () : 0; + ? instance->do_get_output_stream () : 0; } void @@ -1088,14 +1088,14 @@ command_editor::terminal_rows (void) { return (instance_ok ()) - ? instance->do_terminal_rows () : -1; + ? instance->do_terminal_rows () : -1; } int command_editor::terminal_cols (void) { return (instance_ok ()) - ? instance->do_terminal_cols () : -1; + ? instance->do_terminal_cols () : -1; } void @@ -1116,14 +1116,14 @@ command_editor::decode_prompt_string (const std::string& s) { return (instance_ok ()) - ? instance->do_decode_prompt_string (s) : std::string (); + ? instance->do_decode_prompt_string (s) : std::string (); } int command_editor::current_command_number (void) { return (instance_ok ()) - ? instance->command_number : 0; + ? instance->command_number : 0; } void @@ -1235,42 +1235,42 @@ command_editor::get_completion_function (void) { return (instance_ok ()) - ? instance->do_get_completion_function () : 0; + ? instance->do_get_completion_function () : 0; } command_editor::quoting_fcn command_editor::get_quoting_function (void) { return (instance_ok ()) - ? instance->do_get_quoting_function () : 0; + ? instance->do_get_quoting_function () : 0; } command_editor::dequoting_fcn command_editor::get_dequoting_function (void) { return (instance_ok ()) - ? instance->do_get_dequoting_function () : 0; + ? instance->do_get_dequoting_function () : 0; } command_editor::char_is_quoted_fcn command_editor::get_char_is_quoted_function (void) { return (instance_ok ()) - ? instance->do_get_char_is_quoted_function () : 0; + ? instance->do_get_char_is_quoted_function () : 0; } command_editor::user_accept_line_fcn command_editor::get_user_accept_line_function (void) { return (instance_ok ()) - ? instance->do_get_user_accept_line_function () : 0; + ? instance->do_get_user_accept_line_function () : 0; } string_vector command_editor::generate_filename_completions (const std::string& text) { return (instance_ok ()) - ? instance->do_generate_filename_completions (text) : string_vector (); + ? instance->do_generate_filename_completions (text) : string_vector (); } std::string @@ -1436,14 +1436,14 @@ command_editor::filename_completion_desired (bool arg) { return (instance_ok ()) - ? instance->do_filename_completion_desired (arg) : false; + ? instance->do_filename_completion_desired (arg) : false; } bool command_editor::filename_quoting_desired (bool arg) { return (instance_ok ()) - ? instance->do_filename_quoting_desired (arg) : false; + ? instance->do_filename_quoting_desired (arg) : false; } bool
--- a/liboctave/util/cmd-edit.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/cmd-edit.h Sat Oct 26 18:57:05 2013 -0700 @@ -222,11 +222,11 @@ virtual void do_set_name (const std::string&) { } std::string do_readline (const std::string& prompt) - { - bool eof; + { + bool eof; - return do_readline (prompt, eof); - } + return do_readline (prompt, eof); + } virtual std::string do_readline (const std::string&, bool&) = 0; @@ -284,11 +284,14 @@ virtual dequoting_fcn do_get_dequoting_function (void) const { return 0; } - virtual char_is_quoted_fcn do_get_char_is_quoted_function (void) const { return 0; } + virtual char_is_quoted_fcn do_get_char_is_quoted_function (void) const + { return 0; } - virtual user_accept_line_fcn do_get_user_accept_line_function (void) const { return 0; } + virtual user_accept_line_fcn do_get_user_accept_line_function (void) const + { return 0; } - virtual string_vector do_generate_filename_completions (const std::string& text) = 0; + virtual string_vector + do_generate_filename_completions (const std::string& text) = 0; virtual std::string do_get_line_buffer (void) const = 0;
--- a/liboctave/util/cmd-hist.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/cmd-hist.cc Sat Oct 26 18:57:05 2013 -0700 @@ -156,9 +156,8 @@ std::string gnu_history::do_histcontrol (void) const { - // FIXME -- instead of reconstructing this value, should we just save - // the string we were given when constructing the command_history - // object? + // FIXME: instead of reconstructing this value, should we just save + // the string we were given when constructing the command_history object? std::string retval; @@ -192,7 +191,7 @@ if (s.empty () || (s.length () == 1 && (s[0] == '\r' || s[0] == '\n'))) return false; - + // Strip newline before adding to list std::string stmp = s; int stmp_len = stmp.length (); @@ -289,7 +288,7 @@ mark = 0; - // FIXME -- for operate_and_get_next. + // FIXME: for operate_and_get_next. command_editor::remove_startup_hook (command_history::goto_mark); return 0; @@ -545,7 +544,7 @@ command_history::file (void) { return (instance_ok ()) - ? instance->do_file () : std::string (); + ? instance->do_file () : std::string (); } void @@ -559,7 +558,7 @@ command_history::histcontrol (void) { return (instance_ok ()) - ? instance->do_histcontrol () : std::string (); + ? instance->do_histcontrol () : std::string (); } void @@ -573,7 +572,7 @@ command_history::size (void) { return (instance_ok ()) - ? instance->do_size () : 0; + ? instance->do_size () : 0; } void @@ -587,7 +586,7 @@ command_history::ignoring_entries (void) { return (instance_ok ()) - ? instance->do_ignoring_entries () : false; + ? instance->do_ignoring_entries () : false; } bool @@ -616,35 +615,35 @@ command_history::where (void) { return (instance_ok ()) - ? instance->do_where () : 0; + ? instance->do_where () : 0; } int command_history::length (void) { return (instance_ok ()) - ? instance->do_length () : 0; + ? instance->do_length () : 0; } int command_history::max_input_history (void) { return (instance_ok ()) - ? instance->do_max_input_history () : 0; + ? instance->do_max_input_history () : 0; } int command_history::base (void) { return (instance_ok ()) - ? instance->do_base () : 0; + ? instance->do_base () : 0; } int command_history::current_number (void) { return (instance_ok ()) - ? instance->do_current_number () : 0; + ? instance->do_current_number () : 0; } void @@ -658,14 +657,14 @@ command_history::unstifle (void) { return (instance_ok ()) - ? instance->do_unstifle () : 0; + ? instance->do_unstifle () : 0; } int command_history::is_stifled (void) { return (instance_ok ()) - ? instance->do_is_stifled () : 0; + ? instance->do_is_stifled () : 0; } void @@ -679,7 +678,7 @@ command_history::goto_mark (void) { return (instance_ok ()) - ? instance->do_goto_mark () : 0; + ? instance->do_goto_mark () : 0; } void @@ -734,14 +733,14 @@ command_history::list (int limit, bool number_lines) { return (instance_ok ()) - ? instance->do_list (limit, number_lines) : string_vector (); + ? instance->do_list (limit, number_lines) : string_vector (); } std::string command_history::get_entry (int n) { return (instance_ok ()) - ? instance->do_get_entry (n) : std::string (); + ? instance->do_get_entry (n) : std::string (); } void
--- a/liboctave/util/cmd-hist.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/cmd-hist.h Sat Oct 26 18:57:05 2013 -0700 @@ -144,7 +144,8 @@ virtual std::string do_histcontrol (void) const { return std::string (); } - virtual void do_initialize (bool, const std::string&, int, const std::string&); + virtual void do_initialize (bool, const std::string&, int, + const std::string&); virtual bool do_is_initialized (void) const;
--- a/liboctave/util/data-conv.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/data-conv.cc Sat Oct 26 18:57:05 2013 -0700 @@ -359,10 +359,9 @@ } void -oct_data_conv::string_to_data_type - (const std::string& str, int& block_size, - oct_data_conv::data_type& input_type, - oct_data_conv::data_type& output_type) +oct_data_conv::string_to_data_type (const std::string& str, int& block_size, + oct_data_conv::data_type& input_type, + oct_data_conv::data_type& output_type) { block_size = 1; input_type = dt_uchar; @@ -440,9 +439,8 @@ } void -oct_data_conv::string_to_data_type - (const std::string& str, int& block_size, - oct_data_conv::data_type& output_type) +oct_data_conv::string_to_data_type (const std::string& str, int& block_size, + oct_data_conv::data_type& output_type) { block_size = 1; output_type = dt_double; @@ -632,9 +630,9 @@ // Currently, we only handle conversions for the IEEE types. To fix // that, make more of the following routines work. -// FIXME -- assumes sizeof (Complex) == 8 -// FIXME -- assumes sizeof (double) == 8 -// FIXME -- assumes sizeof (float) == 4 +// FIXME: assumes sizeof (Complex) == 8 +// FIXME: assumes sizeof (double) == 8 +// FIXME: assumes sizeof (float) == 4 static void IEEE_big_double_to_IEEE_little_double (void *d, octave_idx_type len)
--- a/liboctave/util/data-conv.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/data-conv.h Sat Oct 26 18:57:05 2013 -0700 @@ -35,32 +35,32 @@ public: enum data_type - { - dt_int8 = 0, - dt_uint8 = 1, - dt_int16 = 2, - dt_uint16 = 3, - dt_int32 = 4, - dt_uint32 = 5, - dt_int64 = 6, - dt_uint64 = 7, - dt_single = 8, - dt_double = 9, - dt_char = 10, - dt_schar = 11, - dt_uchar = 12, - dt_logical = 13, - dt_short = 14, - dt_ushort = 15, - dt_int = 16, - dt_uint = 17, - dt_long = 18, - dt_ulong = 19, - dt_longlong = 20, - dt_ulonglong = 21, - dt_float = 22, - dt_unknown = 23 // Must be last, have largest value! - }; + { + dt_int8 = 0, + dt_uint8 = 1, + dt_int16 = 2, + dt_uint16 = 3, + dt_int32 = 4, + dt_uint32 = 5, + dt_int64 = 6, + dt_uint64 = 7, + dt_single = 8, + dt_double = 9, + dt_char = 10, + dt_schar = 11, + dt_uchar = 12, + dt_logical = 13, + dt_short = 14, + dt_ushort = 15, + dt_int = 16, + dt_uint = 17, + dt_long = 18, + dt_ulong = 19, + dt_longlong = 20, + dt_ulonglong = 21, + dt_float = 22, + dt_unknown = 23 // Must be last, have largest value! + }; static size_t data_type_size (data_type dt); @@ -81,36 +81,36 @@ // format that were created with previous versions of Octave. enum save_type - { - LS_U_CHAR = 0, - LS_U_SHORT = 1, - LS_U_INT = 2, - LS_CHAR = 3, - LS_SHORT = 4, - LS_INT = 5, - LS_FLOAT = 6, - LS_DOUBLE = 7, - LS_U_LONG = 8, - LS_LONG = 9 - }; +{ + LS_U_CHAR = 0, + LS_U_SHORT = 1, + LS_U_INT = 2, + LS_CHAR = 3, + LS_SHORT = 4, + LS_INT = 5, + LS_FLOAT = 6, + LS_DOUBLE = 7, + LS_U_LONG = 8, + LS_LONG = 9 +}; extern OCTAVE_API void do_double_format_conversion (void *data, octave_idx_type len, oct_mach_info::float_format from_fmt, oct_mach_info::float_format to_fmt - = oct_mach_info::native_float_format ()); + = oct_mach_info::native_float_format ()); extern OCTAVE_API void do_float_format_conversion (void *data, octave_idx_type len, oct_mach_info::float_format from_fmt, oct_mach_info::float_format to_fmt - = oct_mach_info::native_float_format ()); + = oct_mach_info::native_float_format ()); extern OCTAVE_API void do_float_format_conversion (void *data, size_t sz, octave_idx_type len, oct_mach_info::float_format from_fmt, oct_mach_info::float_format to_fmt - = oct_mach_info::native_float_format ()); + = oct_mach_info::native_float_format ()); extern OCTAVE_API void read_doubles (std::istream& is, double *data, save_type type,
--- a/liboctave/util/kpse.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/kpse.cc Sat Oct 26 18:57:05 2013 -0700 @@ -456,11 +456,11 @@ : path (pi.path), b (pi.b), e (pi.e), len (pi.len) { } kpse_path_iterator operator ++ (int) - { - kpse_path_iterator retval (*this); - next (); - return retval; - } + { + kpse_path_iterator retval (*this); + next (); + return retval; + } std::string operator * (void) { return path.substr (b, e-b); } @@ -474,37 +474,37 @@ size_t len; void set_end (void) - { - e = b + 1; - - if (e == len) - ; /* OK, we have found the last element. */ - else if (e > len) - b = e = std::string::npos; - else - { - /* Find the next colon not enclosed by braces (or the end of - the path). */ - - int brace_level = 0; - while (e < len && ! (brace_level == 0 && kpse_is_env_sep (path[e]))) - e++; - } - } + { + e = b + 1; + + if (e == len) + ; /* OK, we have found the last element. */ + else if (e > len) + b = e = std::string::npos; + else + { + /* Find the next colon not enclosed by braces (or the end of + the path). */ + + int brace_level = 0; + while (e < len && ! (brace_level == 0 && kpse_is_env_sep (path[e]))) + e++; + } + } void next (void) - { - b = e + 1; - - /* Skip any consecutive colons. */ - while (b < len && kpse_is_env_sep (path[b])) - b++; - - if (b >= len) - b = e = std::string::npos; - else - set_end (); - } + { + b = e + 1; + + /* Skip any consecutive colons. */ + while (b < len && kpse_is_env_sep (path[b])) + b++; + + if (b >= len) + b = e = std::string::npos; + else + set_end (); + } // No assignment. kpse_path_iterator& operator = (const kpse_path_iterator&); @@ -648,14 +648,14 @@ int absolute = (len > 0 && IS_DIR_SEP (filename[0])) #ifdef DOSISH - /* Novell allows non-alphanumeric drive letters. */ - || (len > 0 && IS_DEVICE_SEP (filename[1])) + /* Novell allows non-alphanumeric drive letters. */ + || (len > 0 && IS_DEVICE_SEP (filename[1])) #endif /* DOSISH */ #ifdef WIN32 - /* UNC names */ - || (len > 1 && filename[0] == '\\' && filename[1] == '\\') + /* UNC names */ + || (len > 1 && filename[0] == '\\' && filename[1] == '\\') #endif - ; + ; int explicit_relative = relative_ok @@ -711,8 +711,8 @@ /* Only record absolute filenames, for privacy. */ if (log_file && kpse_absolute_p (filename.c_str (), false)) gnulib::fprintf (log_file, "%lu %s\n", - static_cast<unsigned long> (time (0)), - filename.c_str ()); + static_cast<unsigned long> (time (0)), + filename.c_str ()); /* And show them online, if debugging. We've already started the debugging line in 'search', where this is called, so @@ -826,8 +826,7 @@ /* Try ls-R, unless we're searching for texmf.cnf. Our caller (search), also tests first_search, and does the resetting. */ - found = first_search - ? string_vector () : kpse_db_search (name, elt, all); + found = first_search ? string_vector () : kpse_db_search (name, elt, all); /* Search the filesystem if (1) the path spec allows it, and either (2a) we are searching for texmf.cnf ; or @@ -1019,8 +1018,8 @@ /* Try ls-R, unless we're searching for texmf.cnf. Our caller (find_first_of), also tests first_search, and does the resetting. */ - found = first_search - ? string_vector () : kpse_db_search (name, dir.c_str (), all); + found = first_search ? string_vector () + : kpse_db_search (name, dir.c_str (), all); /* Search the filesystem if (1) the path spec allows it, and either @@ -1661,7 +1660,7 @@ (brace_whitespace (text[i+1]) || text[i+1] == '}')))) continue; /* If this is being compiled as part of bash, ignore the '{' - in a '${}' construct */ + in a '${ }' construct */ if ((c != '{') || i == 0 || (text[i-1] != '$')) break; } @@ -1829,8 +1828,8 @@ if (i == db_dir_len) found = true; - /* If we've reached the end of PATH_ELT, but not the end of the db - directory, it's no good. */ + /* If we've reached the end of PATH_ELT, but not the end of the db + directory, it's no good. */ else if (i == path_elt_len) break; } @@ -1921,7 +1920,8 @@ #ifdef KPSE_DEBUG if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH)) - DEBUGF3 ("db:match (%s,%s) = %d\n", db_file.c_str (), path_elt.c_str (), matched); + DEBUGF3 ("db:match (%s,%s) = %d\n", + db_file.c_str (), path_elt.c_str (), matched); #endif /* We got a hit in the database. Now see if the file actually @@ -2169,7 +2169,7 @@ struct stat stats; ret = stat (fn.c_str (), &stats) == 0 && S_ISDIR (stats.st_mode) - ? stats.st_nlink : static_cast<unsigned> (-1); + ? stats.st_nlink : static_cast<unsigned> (-1); link_table[fn] = ret; @@ -2482,7 +2482,8 @@ /* If we are the first unmoved element, nothing to relink. */ if (unmoved != mover) - { /* Remember 'mover's current successor, so we can relink 'mover's + { + /* Remember 'mover's current successor, so we can relink 'mover's predecessor to it. */ str_llist_elt_type *before_mover; str_llist_elt_type *after_mover = STR_LLIST_NEXT (*mover); @@ -2529,8 +2530,7 @@ static bool expanding_p (const std::string& var) { - return (expansions.find (var) != expansions.end ()) - ? expansions[var] : false; + return (expansions.find (var) != expansions.end ()) ? expansions[var] : false; } /* Append the result of value of 'var' to EXPANSION, where 'var' begins
--- a/liboctave/util/lo-array-gripes.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/lo-array-gripes.cc Sat Oct 26 18:57:05 2013 -0700 @@ -137,7 +137,7 @@ #endif } -// FIXME -- the following is a common error message to resize, +// FIXME: the following is a common error message to resize, // regardless of whether it's called from assign or elsewhere. It // seems OK to me, but eventually the gripe can be specialized. // Anyway, propagating various error messages into procedure is, IMHO,
--- a/liboctave/util/lo-cieee.c Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/lo-cieee.c Sat Oct 26 18:57:05 2013 -0700 @@ -167,9 +167,9 @@ int __lo_ieee_signbit (double x) { -/* In the following definitions, only check x < 0 explicitly to avoid - a function call when it looks like signbit or copysign are actually - functions. */ + /* In the following definitions, only check x < 0 explicitly to avoid + a function call when it looks like signbit or copysign are actually + functions. */ #if defined (signbit) return signbit (x); @@ -261,9 +261,9 @@ int __lo_ieee_float_signbit (float x) { -/* In the following definitions, only check x < 0 explicitly to avoid - a function call when it looks like signbit or copysign are actually - functions. */ + /* In the following definitions, only check x < 0 explicitly to avoid + a function call when it looks like signbit or copysign are actually + functions. */ #if defined (signbit) return signbit (x);
--- a/liboctave/util/lo-regexp.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/lo-regexp.cc Sat Oct 26 18:57:05 2013 -0700 @@ -45,17 +45,17 @@ #include "lo-regexp.h" #include "str-vec.h" -// Define the maximum number of retries for a pattern that possibly -// results in an infinite recursion. +// Define the maximum number of retries for a pattern +// that possibly results in an infinite recursion. #define PCRE_MATCHLIMIT_MAX 10 -// FIXME -- should this be configurable? +// FIXME: should this be configurable? #define MAXLOOKBEHIND 10 static bool lookbehind_warned = false; -// FIXME -- don't bother collecting and composing return values the user -// doesn't want. +// FIXME: don't bother collecting and composing return values +// the user doesn't want. void regexp::free (void) @@ -181,7 +181,7 @@ lookbehind_warned = true; (*current_liboctave_warning_handler) ("%s: arbitrary length lookbehind patterns are only supported up to length %d", - who.c_str (), MAXLOOKBEHIND); + who.c_str (), MAXLOOKBEHIND); } buf << pattern.substr (pos, new_pos - pos) << "("; @@ -266,7 +266,7 @@ // Index of subpattern in first two bytes MSB first of name. // Extract index. nidx[i] = (static_cast<int> (nametable[i*nameentrysize])) << 8 - | static_cast<int> (nametable[i*nameentrysize+1]); + | static_cast<int> (nametable[i*nameentrysize+1]); } while (true) @@ -372,13 +372,13 @@ if (namecount > 0) { // FIXME: Should probably do this with a map() - // rather than a linear search. However, - // the number of captured, named expressions - // is usually pretty small (< 4) + // rather than a linear search. However, + // the number of captured, named expressions + // is usually pretty small (< 4) for (int j = 0; j < namecount; j++) { if (nidx[j] == i) - { + { named_tokens(named_idx(j)) = std::string (*(listptr+i-pos_offset)); break; @@ -402,13 +402,13 @@ lst.push_back (new_elem); if (ovector[1] <= ovector[0]) - { - // Zero length match. Skip to next char. - idx = ovector[0] + 1; - if (idx <= buffer.length ()) - continue; - } - else + { + // Zero length match. Skip to next char. + idx = ovector[0] + 1; + if (idx <= buffer.length ()) + continue; + } + else idx = ovector[1]; if (options.once () || idx >= buffer.length ()) @@ -444,10 +444,10 @@ // Declare rep_token_t used in processing replacement string typedef struct - { - size_t pos; - int num; - } rep_token_t; +{ + size_t pos; + int num; +} rep_token_t; std::string
--- a/liboctave/util/lo-utils.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/lo-utils.cc Sat Oct 26 18:57:05 2013 -0700 @@ -248,7 +248,7 @@ { T val = 0.0; - // FIXME -- resetting stream position is likely to fail unless we are + // FIXME: resetting stream position is likely to fail unless we are // reading from a file. std::ios::streampos pos = is.tellg ();
--- a/liboctave/util/oct-alloc.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-alloc.cc Sat Oct 26 18:57:05 2013 -0700 @@ -45,7 +45,7 @@ return tmp; } -// FIXME -- if we free the last item on the list, shouldn't we +// FIXME: if we free the last item on the list, shouldn't we // also free the underlying character array used for storage? void
--- a/liboctave/util/oct-base64.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-base64.cc Sat Oct 26 18:57:05 2013 -0700 @@ -33,11 +33,11 @@ bool octave_base64_encode (const char *inc, const size_t inlen, char **out) -{ +{ bool ret = false; size_t outlen = base64_encode_alloc (inc, inlen, out); - + if (! out) { if (outlen == 0 && inlen != 0)
--- a/liboctave/util/oct-binmap.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-binmap.h Sat Oct 26 18:57:05 2013 -0700 @@ -340,7 +340,8 @@ template <class U, class T, class R> inline Array<U> -binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (T, R), const char *name) +binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (T, R), + const char *name) { return binmap<U, T, R, U (*) (T, R)> (xa, ya, fcn, name); } template <class U, class T, class R> @@ -355,7 +356,8 @@ template <class U, class T, class R> inline Sparse<U> -binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (T, R), const char *name) +binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (T, R), + const char *name) { return binmap<U, T, R, U (*) (T, R)> (xa, ya, fcn, name); } template <class U, class T, class R> @@ -372,7 +374,8 @@ template <class U, class T, class R> inline Array<U> -binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (const T&, const R&), const char *name) +binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (const T&, const R&), + const char *name) { return binmap<U, T, R, U (*) (const T&, const R&)> (xa, ya, fcn, name); } template <class U, class T, class R> @@ -387,7 +390,8 @@ template <class U, class T, class R> inline Sparse<U> -binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (const T&, const R&), const char *name) +binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (const T&, const R&), + const char *name) { return binmap<U, T, R, U (*) (const T&, const R&)> (xa, ya, fcn, name); } template <class U, class T, class R> @@ -404,7 +408,8 @@ template <class U, class T, class R> inline Array<U> -binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (const T&, R), const char *name) +binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (const T&, R), + const char *name) { return binmap<U, T, R, U (*) (const T&, R)> (xa, ya, fcn, name); } template <class U, class T, class R> @@ -419,7 +424,8 @@ template <class U, class T, class R> inline Sparse<U> -binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (const T&, R), const char *name) +binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (const T&, R), + const char *name) { return binmap<U, T, R, U (*) (const T&, R)> (xa, ya, fcn, name); } template <class U, class T, class R> @@ -436,7 +442,8 @@ template <class U, class T, class R> inline Array<U> -binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (T, const R&), const char *name) +binmap (const Array<T>& xa, const Array<R>& ya, U (*fcn) (T, const R&), + const char *name) { return binmap<U, T, R, U (*) (T, const R&)> (xa, ya, fcn, name); } template <class U, class T, class R> @@ -451,7 +458,8 @@ template <class U, class T, class R> inline Sparse<U> -binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (T, const R&), const char *name) +binmap (const Sparse<T>& xa, const Sparse<R>& ya, U (*fcn) (T, const R&), + const char *name) { return binmap<U, T, R, U (*) (T, const R&)> (xa, ya, fcn, name); } template <class U, class T, class R>
--- a/liboctave/util/oct-cmplx.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-cmplx.h Sat Oct 26 18:57:05 2013 -0700 @@ -29,12 +29,12 @@ typedef std::complex<double> Complex; typedef std::complex<float> FloatComplex; -// For complex-complex and complex-real comparisons, we use the following ordering: -// compare absolute values first; if they match, compare phase angles. +// For complex-complex and complex-real comparisons, we use the following +// ordering: compare absolute values first; if they match, compare phase angles. // This is partially inconsistent with M*b, which compares complex numbers only // by their real parts; OTOH, it uses the same definition for max/min and sort. -// The abs/arg comparison is definitely more useful (the other one is emulated rather -// trivially), so let's be consistent and use that all over. +// The abs/arg comparison is definitely more useful (the other one is emulated +// rather trivially), so let's be consistent and use that all over. #define DEF_COMPLEXR_COMP(OP, OPS) \ template <class T> \
--- a/liboctave/util/oct-glob.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-glob.cc Sat Oct 26 18:57:05 2013 -0700 @@ -81,9 +81,9 @@ #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \ && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) - std::replace_if (xpat.begin (), xpat.end (), - std::bind2nd (std::equal_to<char> (), '\\'), - '/'); + std::replace_if (xpat.begin (), xpat.end (), + std::bind2nd (std::equal_to<char> (), '\\'), + '/'); #endif int err = gnulib::glob (xpat.c_str (), GLOB_NOSORT, 0, &glob_info); @@ -94,7 +94,7 @@ const char * const *matches = glob_info.gl_pathv; - // FIXME -- we shouldn't have to check to see if + // FIXME: we shouldn't have to check to see if // a single match exists, but it seems that glob() won't // check for us unless the pattern contains globbing // characters. Hmm. @@ -111,10 +111,10 @@ #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \ && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) - std::replace_if (tmp.begin (), tmp.end (), - std::bind2nd (std::equal_to<char> (), - '/'), - '\\'); + std::replace_if (tmp.begin (), tmp.end (), + std::bind2nd (std::equal_to<char> (), + '/'), + '\\'); #endif retval[k++] = tmp;
--- a/liboctave/util/oct-inttypes.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-inttypes.cc Sat Oct 26 18:57:05 2013 -0700 @@ -193,7 +193,7 @@ // Essentially, what we do is compute sign, multiply absolute values // (as above) and impose the sign. - // FIXME -- can we do something faster if we HAVE_FAST_INT_OPS? + // FIXME: can we do something faster if we HAVE_FAST_INT_OPS? uint64_t usx = octave_int_abs (x), usy = octave_int_abs (y); bool positive = (x < 0) == (y < 0); @@ -349,11 +349,12 @@ // NOTE: // Emulated mixed multiplications are tricky due to possible precision loss. // Here, after sorting out common cases for speed, we follow the strategy -// of converting the double number into the form sign * 64-bit integer* 2**exponent, -// multiply the 64-bit integers to get a 128-bit number, split that number into 32-bit words -// and form 4 double-valued summands (none of which loases precision), then convert these -// into integers and sum them. Though it is not immediately obvious, this should work -// even w.r.t. rounding (none of the summands lose precision). +// of converting the double number into the form sign * 64-bit integer * +// 2**exponent, multiply the 64-bit integers to get a 128-bit number, split that +// number into 32-bit words and form 4 double-valued summands (none of which +// loses precision), then convert these into integers and sum them. Though it is +// not immediately obvious, this should work even w.r.t. rounding (none of the +// summands lose precision). // Multiplies two unsigned 64-bit ints to get a 128-bit number represented // as four 32-bit words. @@ -384,7 +385,8 @@ mtis = static_cast<uint64_t> (ldexp (x, 52)); } -// Gets a double number from a 32-bit unsigned integer mantissa, exponent and sign. +// Gets a double number from a +// 32-bit unsigned integer mantissa, exponent, and sign. static double dbleget (bool sign, uint32_t mtis, int exp) { @@ -392,7 +394,6 @@ return sign ? -x : x; } - INT_DOUBLE_BINOP_DECL (*, uint64) { if (y >= 0 && y < octave_uint64::max () && y == xround (y))
--- a/liboctave/util/oct-inttypes.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-inttypes.h Sat Oct 26 18:57:05 2013 -0700 @@ -35,10 +35,11 @@ #ifdef OCTAVE_INT_USE_LONG_DOUBLE inline long double xround (long double x) { return roundl (x); } -inline long double xisnan (long double x) { return xisnan (static_cast<double> (x)); } +inline long double xisnan (long double x) +{ return xisnan (static_cast<double> (x)); } #endif -// FIXME -- we define this by our own because some compilers, such as +// FIXME: we define this by our own because some compilers, such as // MSVC, do not provide std::abs (int64_t) and std::abs (uint64_t). In // the future, it should go away in favor of std::abs. template <class T> @@ -106,38 +107,38 @@ // size. template <class T1, class T2> class prom - { - // Promote to int? - static const bool pint = (sizeof (T1) < sizeof (int) - && sizeof (T2) < sizeof (int)); - static const bool t1sig = std::numeric_limits<T1>::is_signed; - static const bool t2sig = std::numeric_limits<T2>::is_signed; - static const bool psig = - (pint || (sizeof (T2) > sizeof (T1) && t2sig) || t1sig); - static const int psize = - (pint ? sizeof (int) : (sizeof (T2) > sizeof (T1) - ? sizeof (T2) : sizeof (T1))); - public: - typedef typename query_integer_type<psize, psig>::type type; - }; + { + // Promote to int? + static const bool pint = (sizeof (T1) < sizeof (int) + && sizeof (T2) < sizeof (int)); + static const bool t1sig = std::numeric_limits<T1>::is_signed; + static const bool t2sig = std::numeric_limits<T2>::is_signed; + static const bool psig = + (pint || (sizeof (T2) > sizeof (T1) && t2sig) || t1sig); + static const int psize = + (pint ? sizeof (int) : (sizeof (T2) > sizeof (T1) + ? sizeof (T2) : sizeof (T1))); + public: + typedef typename query_integer_type<psize, psig>::type type; + }; // Implements comparisons between two types of equal size but // possibly different signedness. template<class xop, int size> class uiop - { - typedef typename query_integer_type<size, false>::type utype; - typedef typename query_integer_type<size, true>::type stype; - public: - static bool op (utype x, utype y) - { return xop::op (x, y); } - static bool op (stype x, stype y) - { return xop::op (x, y); } - static bool op (stype x, utype y) - { return (x < 0) ? xop::ltval : xop::op (static_cast<utype> (x), y); } - static bool op (utype x, stype y) - { return (y < 0) ? xop::gtval : xop::op (x, static_cast<utype> (y)); } - }; + { + typedef typename query_integer_type<size, false>::type utype; + typedef typename query_integer_type<size, true>::type stype; + public: + static bool op (utype x, utype y) + { return xop::op (x, y); } + static bool op (stype x, stype y) + { return xop::op (x, y); } + static bool op (stype x, utype y) + { return (x < 0) ? xop::ltval : xop::op (static_cast<utype> (x), y); } + static bool op (utype x, stype y) + { return (y < 0) ? xop::gtval : xop::op (x, static_cast<utype> (y)); } + }; public: REGISTER_OCTAVE_CMP_OP (lt, <); @@ -153,12 +154,12 @@ template<class xop, class T1, class T2> static bool op (T1 x, T2 y) - { - typedef typename prom<T1, T2>::type PT1; - typedef typename prom<T2, T1>::type PT2; - return uiop<xop, sizeof (PT1)>::op (static_cast<PT1> (x), - static_cast<PT2> (y)); - } + { + typedef typename prom<T1, T2>::type PT1; + typedef typename prom<T2, T1>::type PT2; + return uiop<xop, sizeof (PT1)>::op (static_cast<PT1> (x), + static_cast<PT2> (y)); + } public: @@ -166,14 +167,15 @@ template <class xop, class T> static bool mop (T x, double y) - { return xop::op (static_cast<double> (x), y); } + { return xop::op (static_cast<double> (x), y); } template <class xop, class T> static bool mop (double x, T y) - { return xop::op (x, static_cast<double> (y)); } + { return xop::op (x, static_cast<double> (y)); } - // Typecasting to doubles won't work properly for 64-bit integers - they lose precision. + // Typecasting to doubles won't work properly for 64-bit integers -- + // they lose precision. // If we have long doubles, use them... #ifdef OCTAVE_INT_USE_LONG_DOUBLE #define DEFINE_LONG_DOUBLE_CMP_OP(T1, T2) \ @@ -224,36 +226,36 @@ template <class S> static T truncate_int (const S& value) - { - // An exhaustive test whether the max and/or min check can be omitted. - static const bool t_is_signed = std::numeric_limits<T>::is_signed; - static const bool s_is_signed = std::numeric_limits<S>::is_signed; - static const int t_size = sizeof (T), s_size = sizeof (S); - static const bool omit_chk_min = - (! s_is_signed || (t_is_signed && t_size >= s_size)); - static const bool omit_chk_max = - (t_size > s_size || (t_size == s_size - && (! t_is_signed || s_is_signed))); - // If the check can be omitted, substitute constant false relation. - typedef octave_int_cmp_op::cf cf; - typedef octave_int_cmp_op::lt lt; - typedef octave_int_cmp_op::gt gt; - typedef typename if_then_else<omit_chk_min, cf, lt>::result chk_min; - typedef typename if_then_else<omit_chk_max, cf, gt>::result chk_max; + { + // An exhaustive test whether the max and/or min check can be omitted. + static const bool t_is_signed = std::numeric_limits<T>::is_signed; + static const bool s_is_signed = std::numeric_limits<S>::is_signed; + static const int t_size = sizeof (T), s_size = sizeof (S); + static const bool omit_chk_min = + (! s_is_signed || (t_is_signed && t_size >= s_size)); + static const bool omit_chk_max = + (t_size > s_size || (t_size == s_size + && (! t_is_signed || s_is_signed))); + // If the check can be omitted, substitute constant false relation. + typedef octave_int_cmp_op::cf cf; + typedef octave_int_cmp_op::lt lt; + typedef octave_int_cmp_op::gt gt; + typedef typename if_then_else<omit_chk_min, cf, lt>::result chk_min; + typedef typename if_then_else<omit_chk_max, cf, gt>::result chk_max; - // Efficiency of the following depends on inlining and dead code - // elimination, but that should be a piece of cake for most compilers. - if (chk_min::op (value, static_cast<S> (min_val ()))) - { - return min_val (); - } - else if (chk_max::op (value, static_cast<S> (max_val ()))) - { - return max_val (); - } - else - return static_cast<T> (value); - } + // Efficiency of the following depends on inlining and dead code + // elimination, but that should be a piece of cake for most compilers. + if (chk_min::op (value, static_cast<S> (min_val ()))) + { + return min_val (); + } + else if (chk_max::op (value, static_cast<S> (max_val ()))) + { + return max_val (); + } + else + return static_cast<T> (value); + } private: @@ -261,42 +263,44 @@ template <class S> static S compute_threshold (S val, T orig_val) - { - val = xround (val); // Fool optimizations (maybe redundant) - // If val is even, but orig_val is odd, we're one unit off. - if (orig_val % 2 && val / 2 == xround (val / 2)) - // FIXME -- is this always correct? - val *= (static_cast<S>(1) - (std::numeric_limits<S>::epsilon () / 2)); - return val; - } + { + val = xround (val); // Fool optimizations (maybe redundant) + // If val is even, but orig_val is odd, we're one unit off. + if (orig_val % 2 && val / 2 == xround (val / 2)) + // FIXME: is this always correct? + val *= (static_cast<S>(1) - (std::numeric_limits<S>::epsilon () / 2)); + return val; + } public: // Convert a real number (check NaN and non-int). template <class S> static T convert_real (const S& value) - { - // Compute proper thresholds. - static const S thmin = compute_threshold (static_cast<S> (min_val ()), min_val ()); - static const S thmax = compute_threshold (static_cast<S> (max_val ()), max_val ()); - if (xisnan (value)) - { - return static_cast<T> (0); - } - else if (value < thmin) - { - return min_val (); - } - else if (value > thmax) - { - return max_val (); - } - else - { - S rvalue = xround (value); - return static_cast<T> (rvalue); - } - } + { + // Compute proper thresholds. + static const S thmin = compute_threshold (static_cast<S> (min_val ()), + min_val ()); + static const S thmax = compute_threshold (static_cast<S> (max_val ()), + max_val ()); + if (xisnan (value)) + { + return static_cast<T> (0); + } + else if (value < thmin) + { + return min_val (); + } + else if (value > thmax) + { + return max_val (); + } + else + { + S rvalue = xround (value); + return static_cast<T> (rvalue); + } + } }; // Saturated (homogeneous) integer arithmetics. The signed and unsigned @@ -330,75 +334,75 @@ static T minus (T) - { - return static_cast<T> (0); - } + { + return static_cast<T> (0); + } // the overflow behaviour for unsigned integers is guaranteed by C/C++, // so the following should always work. static T add (T x, T y) - { - T u = x + y; - if (u < x) - { - u = octave_int_base<T>::max_val (); - } - return u; - } + { + T u = x + y; + if (u < x) + { + u = octave_int_base<T>::max_val (); + } + return u; + } static T sub (T x, T y) - { - T u = x - y; - if (u > x) - { - u = 0; - } - return u; - } + { + T u = x - y; + if (u > x) + { + u = 0; + } + return u; + } // Multiplication is done using promotion to wider integer type. If there is // no suitable promotion type, this operation *MUST* be specialized. static T mul (T x, T y) - { - // Promotion type for multiplication (if exists). - typedef typename query_integer_type<2*sizeof (T), false>::type mptype; - return octave_int_base<T>::truncate_int (static_cast<mptype> (x) - * static_cast<mptype> (y)); - } + { + // Promotion type for multiplication (if exists). + typedef typename query_integer_type<2*sizeof (T), false>::type mptype; + return octave_int_base<T>::truncate_int (static_cast<mptype> (x) + * static_cast<mptype> (y)); + } // Division with rounding to nearest. Note that / and % are probably // computed by a single instruction. static T div (T x, T y) - { - if (y != 0) - { - T z = x / y, w = x % y; - if (w >= y-w) z += 1; - return z; - } - else - { - return x ? octave_int_base<T>::max_val () : 0; - } - } + { + if (y != 0) + { + T z = x / y, w = x % y; + if (w >= y-w) z += 1; + return z; + } + else + { + return x ? octave_int_base<T>::max_val () : 0; + } + } // Remainder. static T rem (T x, T y) - { - return y != 0 ? x % y : 0; - } + { + return y != 0 ? x % y : 0; + } // Modulus. Note the weird y = 0 case for Matlab compatibility. static T mod (T x, T y) - { - return y != 0 ? x % y : x; - } + { + return y != 0 ? x % y : x; + } }; #ifdef OCTAVE_INT_USE_LONG_DOUBLE @@ -437,8 +441,8 @@ // // The above conditions are satisfied by most modern platforms. If // HAVE_FAST_INT_OPS is defined, bit tricks and wraparound arithmetics are used -// to avoid conditional jumps as much as possible, thus being friendly to modern -// pipeline processor architectures. +// to avoid conditional jumps as much as possible, thus being friendly to +// modern pipeline processor architectures. // Otherwise, we fall back to a bullet-proof code that only uses assumptions // guaranteed by the standard. @@ -452,53 +456,53 @@ // Returns 1 for negative number, 0 otherwise. static T __signbit (T x) - { + { #ifdef HAVE_FAST_INT_OPS - return static_cast<UT> (x) >> std::numeric_limits<T>::digits; + return static_cast<UT> (x) >> std::numeric_limits<T>::digits; #else - return (x < 0) ? 1 : 0; + return (x < 0) ? 1 : 0; #endif - } + } static T abs (T x) - { + { #ifdef HAVE_FAST_INT_OPS - // This is close to how GCC does std::abs, but we can't just use std::abs, - // because its behaviour for INT_MIN is undefined and the compiler could - // discard the following test. - T m = x >> std::numeric_limits<T>::digits; - T y = (x ^ m) - m; - if (y < 0) - { - y = octave_int_base<T>::max_val (); - } - return y; + // This is close to how GCC does std::abs, but we can't just use std::abs, + // because its behaviour for INT_MIN is undefined and the compiler could + // discard the following test. + T m = x >> std::numeric_limits<T>::digits; + T y = (x ^ m) - m; + if (y < 0) + { + y = octave_int_base<T>::max_val (); + } + return y; #else - // -INT_MAX is safe because C++ actually allows only three implementations - // of integers: sign & magnitude, ones complement and twos complement. - // The first test will, with modest optimizations, evaluate at compile - // time, and maybe eliminate the branch completely. - T y; - if (octave_int_base<T>::min_val () < -octave_int_base<T>::max_val () - && x == octave_int_base<T>::min_val ()) - { - y = octave_int_base<T>::max_val (); - } - else - y = (x < 0) ? -x : x; - return y; + // -INT_MAX is safe because C++ actually allows only three implementations + // of integers: sign & magnitude, ones complement and twos complement. + // The first test will, with modest optimizations, evaluate at compile + // time, and maybe eliminate the branch completely. + T y; + if (octave_int_base<T>::min_val () < -octave_int_base<T>::max_val () + && x == octave_int_base<T>::min_val ()) + { + y = octave_int_base<T>::max_val (); + } + else + y = (x < 0) ? -x : x; + return y; #endif - } + } static T signum (T x) - { - // With modest optimizations, this will compile without a jump. - return ((x > 0) ? 1 : 0) - __signbit (x); - } + { + // With modest optimizations, this will compile without a jump. + return ((x > 0) ? 1 : 0) - __signbit (x); + } - // FIXME -- we do not have an authority what signed shifts should + // FIXME: we do not have an authority what signed shifts should // exactly do, so we define them the easy way. Note that Matlab does // not define signed shifts. @@ -511,181 +515,182 @@ // Minus has problems similar to abs. static T minus (T x) - { + { #ifdef HAVE_FAST_INT_OPS - T y = -x; - if (y == octave_int_base<T>::min_val ()) - { - --y; - } - return y; + T y = -x; + if (y == octave_int_base<T>::min_val ()) + { + --y; + } + return y; #else - T y; - if (octave_int_base<T>::min_val () < -octave_int_base<T>::max_val () - && x == octave_int_base<T>::min_val ()) - { - y = octave_int_base<T>::max_val (); - } - else - y = -x; - return y; + T y; + if (octave_int_base<T>::min_val () < -octave_int_base<T>::max_val () + && x == octave_int_base<T>::min_val ()) + { + y = octave_int_base<T>::max_val (); + } + else + y = -x; + return y; #endif - } + } static T add (T x, T y) - { + { #ifdef HAVE_FAST_INT_OPS // The typecasts do nothing, but they are here to prevent an optimizing // compiler from interfering. Also, the signed operations on small types // actually return int. - T u = static_cast<UT> (x) + static_cast<UT> (y); - T ux = u ^ x, uy = u ^ y; - if ((ux & uy) < 0) - { - u = octave_int_base<T>::max_val () + __signbit (~u); - } - return u; + T u = static_cast<UT> (x) + static_cast<UT> (y); + T ux = u ^ x, uy = u ^ y; + if ((ux & uy) < 0) + { + u = octave_int_base<T>::max_val () + __signbit (~u); + } + return u; #else - // We shall carefully avoid anything that may overflow. - T u; - if (y < 0) - { - if (x < octave_int_base<T>::min_val () - y) - { - u = octave_int_base<T>::min_val (); - } - else - u = x + y; - } - else - { - if (x > octave_int_base<T>::max_val () - y) - { - u = octave_int_base<T>::max_val (); - } - else - u = x + y; - } + // We shall carefully avoid anything that may overflow. + T u; + if (y < 0) + { + if (x < octave_int_base<T>::min_val () - y) + { + u = octave_int_base<T>::min_val (); + } + else + u = x + y; + } + else + { + if (x > octave_int_base<T>::max_val () - y) + { + u = octave_int_base<T>::max_val (); + } + else + u = x + y; + } - return u; + return u; #endif - } + } // This is very similar to addition. static T sub (T x, T y) - { + { #ifdef HAVE_FAST_INT_OPS // The typecasts do nothing, but they are here to prevent an optimizing // compiler from interfering. Also, the signed operations on small types // actually return int. - T u = static_cast<UT> (x) - static_cast<UT> (y); - T ux = u ^ x, uy = u ^ ~y; - if ((ux & uy) < 0) - { - u = octave_int_base<T>::max_val () + __signbit (~u); - } - return u; + T u = static_cast<UT> (x) - static_cast<UT> (y); + T ux = u ^ x, uy = u ^ ~y; + if ((ux & uy) < 0) + { + u = octave_int_base<T>::max_val () + __signbit (~u); + } + return u; #else - // We shall carefully avoid anything that may overflow. - T u; - if (y < 0) - { - if (x > octave_int_base<T>::max_val () + y) - { - u = octave_int_base<T>::max_val (); - } - else - u = x - y; - } - else - { - if (x < octave_int_base<T>::min_val () + y) - { - u = octave_int_base<T>::min_val (); - } - else - u = x - y; - } + // We shall carefully avoid anything that may overflow. + T u; + if (y < 0) + { + if (x > octave_int_base<T>::max_val () + y) + { + u = octave_int_base<T>::max_val (); + } + else + u = x - y; + } + else + { + if (x < octave_int_base<T>::min_val () + y) + { + u = octave_int_base<T>::min_val (); + } + else + u = x - y; + } - return u; + return u; #endif - } + } // Multiplication is done using promotion to wider integer type. If there is // no suitable promotion type, this operation *MUST* be specialized. static T mul (T x, T y) - { - // Promotion type for multiplication (if exists). - typedef typename query_integer_type<2*sizeof (T), true>::type mptype; - return octave_int_base<T>::truncate_int (static_cast<mptype> (x) - * static_cast<mptype> (y)); - } + { + // Promotion type for multiplication (if exists). + typedef typename query_integer_type<2*sizeof (T), true>::type mptype; + return octave_int_base<T>::truncate_int (static_cast<mptype> (x) + * static_cast<mptype> (y)); + } // Division. static T div (T x, T y) - { - T z; - if (y == 0) - { - if (x < 0) - z = octave_int_base<T>::min_val (); - else if (x != 0) + { + T z; + if (y == 0) + { + if (x < 0) + z = octave_int_base<T>::min_val (); + else if (x != 0) + z = octave_int_base<T>::max_val (); + else + z = 0; + } + else if (y < 0) + { + // This is a special case that overflows as well. + if (y == -1 && x == octave_int_base<T>::min_val ()) + { z = octave_int_base<T>::max_val (); - else - z = 0; - } - else if (y < 0) - { - // This is a special case that overflows as well. - if (y == -1 && x == octave_int_base<T>::min_val ()) - { - z = octave_int_base<T>::max_val (); - } - else - { - z = x / y; - T w = -octave_int_abs (x % y); // Can't overflow, but std::abs (x) can! - if (w <= y - w) - z -= 1 - (__signbit (x) << 1); - } - } - else - { - z = x / y; - // FIXME -- this is a workaround due to MSVC's absence of - // std::abs (int64_t). The call to octave_int_abs can't - // overflow, but std::abs (x) can! - T w = octave_int_abs (x % y); + } + else + { + z = x / y; + // Can't overflow, but std::abs (x) can! + T w = -octave_int_abs (x % y); + if (w <= y - w) + z -= 1 - (__signbit (x) << 1); + } + } + else + { + z = x / y; + // FIXME: this is a workaround due to MSVC's absence of + // std::abs (int64_t). The call to octave_int_abs can't + // overflow, but std::abs (x) can! + T w = octave_int_abs (x % y); - if (w >= y - w) - z += 1 - (__signbit (x) << 1); - } - return z; - } + if (w >= y - w) + z += 1 - (__signbit (x) << 1); + } + return z; + } // Remainder. static T rem (T x, T y) - { - return y != 0 ? x % y : 0; - } + { + return y != 0 ? x % y : 0; + } // Modulus. Note the weird y = 0 case for Matlab compatibility. static T mod (T x, T y) - { - if (y != 0) - { - T r = x % y; - return ((r < 0) != (y < 0)) ? r + y : r; - } - else - return x; - } + { + if (y != 0) + { + T r = x % y; + return ((r < 0) != (y < 0)) ? r + y : r; + } + else + return x; + } }; #ifdef OCTAVE_INT_USE_LONG_DOUBLE @@ -695,9 +700,9 @@ octave_int_arith_base<int64_t, true>:: mul (int64_t x, int64_t y) { long double p = static_cast<long double> (x) * static_cast<long double> (y); - // NOTE: We could maybe do it with a single branch if HAVE_FAST_INT_OPS, but it - // would require one more runtime conversion, so the question is whether it would - // really be faster. + // NOTE: We could maybe do it with a single branch if HAVE_FAST_INT_OPS, + // but it would require one more runtime conversion, so the question is + // whether it would really be faster. if (p > static_cast<long double> (octave_int_base<int64_t>::max_val ())) { return octave_int_base<int64_t>::max_val (); @@ -720,7 +725,7 @@ template<class T> class octave_int_arith : public octave_int_arith_base<T, std::numeric_limits<T>::is_signed> -{}; +{ }; template <class T> class @@ -783,7 +788,7 @@ octave_int<T> operator + () const - { return *this; } + { return *this; } // unary operators & mappers #define OCTAVE_INT_UN_OP(OPNAME,NAME) \ @@ -857,7 +862,7 @@ xisnan (const octave_int<T>&) { return false; } -// FIXME -- can/should any of these be inline? +// FIXME: can/should any of these be inline? template <class T> extern OCTAVE_API octave_int<T>
--- a/liboctave/util/oct-locbuf.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-locbuf.cc Sat Oct 26 18:57:05 2013 -0700 @@ -29,7 +29,7 @@ #include "lo-error.h" #include "oct-locbuf.h" -// FIXME -- Maybe we should querying for available physical memory? +// FIXME: Maybe we should querying for available physical memory? #ifndef OCTAVE_LOCBUF_CHUNKSIZE_MB #define OCTAVE_LOCBUF_CHUNKSIZE_MB 32 @@ -112,8 +112,8 @@ chunk = cnk; top = dat; - // FIXME -- the following calcuation of remaining data will - // only work if each chunk has the same chunk_size. + // FIXME: the following calcuation of remaining data will + // only work if each chunk has the same chunk_size. left = chunk_size - (dat - cnk); }
--- a/liboctave/util/oct-locbuf.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-locbuf.h Sat Oct 26 18:57:05 2013 -0700 @@ -36,10 +36,10 @@ public: octave_local_buffer (size_t size) : data (0) - { - if (size) - data = new T [size]; - } + { + if (size) + data = new T [size]; + } ~octave_local_buffer (void) { delete [] data; } operator T *() const { return data; } @@ -143,7 +143,7 @@ public: octave_local_buffer (size_t size) : octave_chunk_buffer (size * sizeof (T *)) - { } + { } operator T **() const { return reinterpret_cast<T **> (this->data ()); } }; @@ -154,7 +154,7 @@ public: octave_local_buffer (size_t size) : octave_chunk_buffer (size * sizeof (const T *)) - { } + { } operator const T **() const {
--- a/liboctave/util/oct-mem.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-mem.h Sat Oct 26 18:57:05 2013 -0700 @@ -43,7 +43,8 @@ return n * size; } -// Unaliased copy. This boils down to memcpy, even for octave_int and complex types. +// Unaliased copy. This boils down to memcpy, even for octave_int and +// complex types. template <class T> inline void copy_or_memcpy (size_t n, const T *src, T *dest) @@ -79,7 +80,8 @@ template <class T> inline bool helper_is_zero_mem (const T& value) { - typedef typename query_integer_type<sizeof (T), false>::type IT; // get integer type of the same size. + // get integer type of the same size. + typedef typename query_integer_type<sizeof (T), false>::type IT; return *(reinterpret_cast<const IT *>(&value)) == 0; } @@ -120,13 +122,14 @@ template <class T> DEFINE_POD_FILL (octave_int<T>) -// Uninitialized allocation. Will not initialize memory for complex and octave_int. +// Uninitialized allocation. +// Will not initialize memory for complex and octave_int. // Memory allocated by octave_new should be freed by octave_delete. template <class T> inline T *no_ctor_new (size_t n) { - // Some systems let us allocate > 2GB memory even though size_t, which is either - // buggy or completely cuckoo, so let's check here to stay safe. + // Some systems let us allocate > 2GB memory even though size_t, which is + // either buggy or completely cuckoo, so let's check here to stay safe. safe_size_comp (n, sizeof (T)); return new T [n]; }
--- a/liboctave/util/oct-mutex.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-mutex.cc Sat Oct 26 18:57:05 2013 -0700 @@ -89,7 +89,7 @@ CRITICAL_SECTION cs; }; -static DWORD octave_thread_id = 0; +static DWORD octave_thread_id = 0; void octave_thread::init (void)
--- a/liboctave/util/oct-refcount.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-refcount.h Sat Oct 26 18:57:05 2013 -0700 @@ -54,38 +54,38 @@ public: typedef T count_type; - octave_refcount(count_type initial_count) : count(initial_count) {} + octave_refcount(count_type initial_count) : count(initial_count) { } // Increment/Decrement. int is postfix. count_type operator++(void) - { - return OCTREFCOUNT_ATOMIC_INCREMENT (&count); - } + { + return OCTREFCOUNT_ATOMIC_INCREMENT (&count); + } count_type operator++(int) - { - return OCTREFCOUNT_ATOMIC_INCREMENT_POST (&count); - } + { + return OCTREFCOUNT_ATOMIC_INCREMENT_POST (&count); + } count_type operator--(void) - { - return OCTREFCOUNT_ATOMIC_DECREMENT (&count); - } + { + return OCTREFCOUNT_ATOMIC_DECREMENT (&count); + } count_type operator--(int) - { - return OCTREFCOUNT_ATOMIC_DECREMENT_POST (&count); - } + { + return OCTREFCOUNT_ATOMIC_DECREMENT_POST (&count); + } operator count_type (void) const - { - return static_cast<count_type const volatile&> (count); - } + { + return static_cast<count_type const volatile&> (count); + } count_type *get (void) - { - return &count; - } + { + return &count; + } private: count_type count;
--- a/liboctave/util/oct-shlib.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-shlib.cc Sat Oct 26 18:57:05 2013 -0700 @@ -161,7 +161,8 @@ ~octave_dlopen_shlib (void); - void *search (const std::string& name, octave_shlib::name_mangler mangler = 0); + void *search (const std::string& name, + octave_shlib::name_mangler mangler = 0); // FIXME: this is possibly redundant because failure to open a library will // normally throw an exception, avoiding the construction of an invalid @@ -247,7 +248,8 @@ ~octave_shl_load_shlib (void); - void *search (const std::string& name, octave_shlib::name_mangler mangler = 0); + void *search (const std::string& name, + octave_shlib::name_mangler mangler = 0); bool is_open (void) const { return (library != 0); } @@ -316,7 +318,8 @@ ~octave_w32_shlib (void); - void *search (const std::string& name, octave_shlib::name_mangler mangler = 0); + void *search (const std::string& name, + octave_shlib::name_mangler mangler = 0); bool is_open (void) const { return (handle != 0); } @@ -410,7 +413,8 @@ void open (const std::string& f); - void *search (const std::string& name, octave_shlib::name_mangler mangler = 0); + void *search (const std::string& name, + octave_shlib::name_mangler mangler = 0); void close (octave_shlib::close_hook cl_hook = 0); @@ -459,7 +463,7 @@ (*current_liboctave_error_handler) ("got NSObjectFileImageReturnCode %d", returnCode); - // FIXME -- should use NSLinkEditError () to get + // FIXME: should use NSLinkEditError () to get // more info on what went wrong. } }
--- a/liboctave/util/oct-shlib.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-shlib.h Sat Oct 26 18:57:05 2013 -0700 @@ -53,15 +53,15 @@ public: virtual ~shlib_rep (void) - { - instances.erase (file); - } + { + instances.erase (file); + } virtual bool is_open (void) const - { return false; } + { return false; } virtual void *search (const std::string&, name_mangler = 0) - { return 0; } + { return 0; } bool is_out_of_date (void) const; @@ -71,10 +71,10 @@ static shlib_rep *get_instance (const std::string& f, bool fake); octave_time time_loaded (void) const - { return tm_loaded; } + { return tm_loaded; } std::string file_name (void) const - { return file; } + { return file; } size_t num_fcn_names (void) const { return fcn_names.size (); } @@ -116,73 +116,73 @@ : rep (shlib_rep::get_instance (f, fake)) { } ~octave_shlib (void) - { - if (--rep->count == 0) - delete rep; - } + { + if (--rep->count == 0) + delete rep; + } octave_shlib (const octave_shlib& sl) : rep (sl.rep) - { - rep->count++; - } + { + rep->count++; + } octave_shlib& operator = (const octave_shlib& sl) - { - if (rep != sl.rep) - { - if (--rep->count == 0) - delete rep; + { + if (rep != sl.rep) + { + if (--rep->count == 0) + delete rep; - rep = sl.rep; - rep->count++; - } + rep = sl.rep; + rep->count++; + } - return *this; - } + return *this; + } bool operator == (const octave_shlib& sl) const - { return (rep == sl.rep); } + { return (rep == sl.rep); } operator bool () const { return rep->is_open (); } void open (const std::string& f) - { *this = octave_shlib (f); } + { *this = octave_shlib (f); } void close (close_hook cl_hook = 0) - { - if (cl_hook) - rep->do_close_hook (cl_hook); + { + if (cl_hook) + rep->do_close_hook (cl_hook); - *this = octave_shlib (); - } + *this = octave_shlib (); + } void *search (const std::string& nm, name_mangler mangler = 0) const - { - void *f = rep->search (nm, mangler); - if (f) - rep->add_fcn_name (nm); + { + void *f = rep->search (nm, mangler); + if (f) + rep->add_fcn_name (nm); - return f; - } + return f; + } void add (const std::string& name) - { rep->add_fcn_name (name); } + { rep->add_fcn_name (name); } bool remove (const std::string& name) - { return rep->remove_fcn_name (name); } + { return rep->remove_fcn_name (name); } size_t number_of_functions_loaded (void) const - { return rep->num_fcn_names (); } + { return rep->num_fcn_names (); } bool is_out_of_date (void) const - { return rep->is_out_of_date (); } + { return rep->is_out_of_date (); } std::string file_name (void) const - { return rep->file_name (); } + { return rep->file_name (); } octave_time time_loaded (void) const - { return rep->time_loaded (); } + { return rep->time_loaded (); } private:
--- a/liboctave/util/oct-sort.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-sort.cc Sat Oct 26 18:57:05 2013 -0700 @@ -259,7 +259,8 @@ template <class T> template <class Comp> octave_idx_type -octave_sort<T>::count_run (T *lo, octave_idx_type nel, bool& descending, Comp comp) +octave_sort<T>::count_run (T *lo, octave_idx_type nel, bool& descending, + Comp comp) { octave_idx_type n; T *hi = lo + nel; @@ -318,7 +319,8 @@ template <class T> template <class Comp> octave_idx_type -octave_sort<T>::gallop_left (T key, T *a, octave_idx_type n, octave_idx_type hint, +octave_sort<T>::gallop_left (T key, T *a, octave_idx_type n, + octave_idx_type hint, Comp comp) { octave_idx_type ofs; @@ -412,7 +414,8 @@ template <class T> template <class Comp> octave_idx_type -octave_sort<T>::gallop_right (T key, T *a, octave_idx_type n, octave_idx_type hint, +octave_sort<T>::gallop_right (T key, T *a, octave_idx_type n, + octave_idx_type hint, Comp comp) { octave_idx_type ofs; @@ -691,15 +694,15 @@ ms->min_gallop = min_gallop; } - Succeed: +Succeed: result = 0; - Fail: +Fail: if (na) std::copy (pa, pa + na, dest); return result; - CopyB: +CopyB: /* The last element of pa belongs at the end of the merge. */ std::copy (pb, pb + nb, dest); dest[nb] = *pa; @@ -827,10 +830,10 @@ ms->min_gallop = min_gallop; } - Succeed: +Succeed: result = 0; - Fail: +Fail: if (na) { std::copy (pa, pa + na, dest); @@ -838,7 +841,7 @@ } return result; - CopyB: +CopyB: /* The last element of pa belongs at the end of the merge. */ std::copy (pb, pb + nb, dest); std::copy (ipb, ipb + nb, idest); @@ -1416,7 +1419,8 @@ /* If short, extend to min (minrun, nremaining). */ if (n < minrun) { - const octave_idx_type force = nremaining <= minrun ? nremaining : minrun; + const octave_idx_type force = nremaining <= minrun ? nremaining + : minrun; binarysort (data + lo, force, n, comp); n = force; } @@ -1478,7 +1482,8 @@ /* If short, extend to min (minrun, nremaining). */ if (n < minrun) { - const octave_idx_type force = nremaining <= minrun ? nremaining : minrun; + const octave_idx_type force = nremaining <= minrun ? nremaining + : minrun; binarysort (data + lo, idx + lo, force, n, comp); n = force; } @@ -1514,10 +1519,10 @@ #ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) sort (data, nel, std::greater<T> ()); - else + else #endif - if (compare) - sort (data, nel, compare); + if (compare) + sort (data, nel, compare); } template <class T> @@ -1532,10 +1537,10 @@ #ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) sort (data, idx, nel, std::greater<T> ()); - else + else #endif - if (compare) - sort (data, idx, nel, compare); + if (compare) + sort (data, idx, nel, compare); } template <class T> template <class Comp> @@ -1571,10 +1576,10 @@ #ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) retval = is_sorted (data, nel, std::greater<T> ()); - else + else #endif - if (compare) - retval = is_sorted (data, nel, compare); + if (compare) + retval = is_sorted (data, nel, compare); return retval; } @@ -1659,10 +1664,10 @@ #ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) sort_rows (data, idx, rows, cols, std::greater<T> ()); - else + else #endif - if (compare) - sort_rows (data, idx, rows, cols, compare); + if (compare) + sort_rows (data, idx, rows, cols, compare); } template <class T> template <class Comp> @@ -1695,7 +1700,7 @@ if (comp (*lst, *lo)) { if (lo > lst + 1) - runs.push (run_t (lst + rows, lo - lst)); + runs.push (run_t (lst + rows, lo - lst)); lst = lo; } else if (comp (*lo, *lst)) @@ -1736,10 +1741,10 @@ #ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) retval = is_sorted_rows (data, rows, cols, std::greater<T> ()); - else + else #endif - if (compare) - retval = is_sorted_rows (data, rows, cols, compare); + if (compare) + retval = is_sorted_rows (data, rows, cols, compare); return retval; } @@ -1780,10 +1785,10 @@ #ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) retval = lookup (data, nel, value, std::greater<T> ()); - else + else #endif - if (compare) - retval = lookup (data, nel, value, std::ptr_fun (compare)); + if (compare) + retval = lookup (data, nel, value, std::ptr_fun (compare)); return retval; } @@ -1815,10 +1820,10 @@ #ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) lookup (data, nel, values, nvalues, idx, std::greater<T> ()); - else + else #endif - if (compare) - lookup (data, nel, values, nvalues, idx, std::ptr_fun (compare)); + if (compare) + lookup (data, nel, values, nvalues, idx, std::ptr_fun (compare)); } template <class T> template <class Comp> @@ -1887,10 +1892,11 @@ #ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) lookup_sorted (data, nel, values, nvalues, idx, rev, std::greater<T> ()); - else + else #endif - if (compare) - lookup_sorted (data, nel, values, nvalues, idx, rev, std::ptr_fun (compare)); + if (compare) + lookup_sorted (data, nel, values, nvalues, idx, rev, + std::ptr_fun (compare)); } template <class T> template <class Comp> @@ -1934,10 +1940,10 @@ #ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) nth_element (data, nel, lo, up, std::greater<T> ()); - else + else #endif - if (compare) - nth_element (data, nel, lo, up, std::ptr_fun (compare)); + if (compare) + nth_element (data, nel, lo, up, std::ptr_fun (compare)); } template <class T>
--- a/liboctave/util/oct-sort.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/oct-sort.h Sat Oct 26 18:57:05 2013 -0700 @@ -184,13 +184,13 @@ { MergeState (void) : min_gallop (), a (0), ia (0), alloced (0), n (0) - { reset (); } + { reset (); } ~MergeState (void) - { delete [] a; delete [] ia; } + { delete [] a; delete [] ia; } void reset (void) - { min_gallop = MIN_GALLOP; n = 0; } + { min_gallop = MIN_GALLOP; n = 0; } void getmem (octave_idx_type need); @@ -233,22 +233,23 @@ template <class Comp> void binarysort (T *data, octave_idx_type nel, - octave_idx_type start, Comp comp); + octave_idx_type start, Comp comp); template <class Comp> void binarysort (T *data, octave_idx_type *idx, octave_idx_type nel, - octave_idx_type start, Comp comp); + octave_idx_type start, Comp comp); template <class Comp> - octave_idx_type count_run (T *lo, octave_idx_type n, bool& descending, Comp comp); + octave_idx_type count_run (T *lo, octave_idx_type n, bool& descending, + Comp comp); template <class Comp> - octave_idx_type gallop_left (T key, T *a, octave_idx_type n, octave_idx_type hint, - Comp comp); + octave_idx_type gallop_left (T key, T *a, octave_idx_type n, + octave_idx_type hint, Comp comp); template <class Comp> - octave_idx_type gallop_right (T key, T *a, octave_idx_type n, octave_idx_type hint, - Comp comp); + octave_idx_type gallop_right (T key, T *a, octave_idx_type n, + octave_idx_type hint, Comp comp); template <class Comp> int merge_lo (T *pa, octave_idx_type na, @@ -271,12 +272,10 @@ Comp comp); template <class Comp> - int merge_at (octave_idx_type i, T *data, - Comp comp); + int merge_at (octave_idx_type i, T *data, Comp comp); template <class Comp> - int merge_at (octave_idx_type i, T *data, octave_idx_type *idx, - Comp comp); + int merge_at (octave_idx_type i, T *data, octave_idx_type *idx, Comp comp); template <class Comp> int merge_collapse (T *data, Comp comp);
--- a/liboctave/util/pathsearch.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/pathsearch.cc Sat Oct 26 18:57:05 2013 -0700 @@ -132,14 +132,14 @@ dir_path::find_first_of (const string_vector& names) { return initialized - ? kpse_path_find_first_of (p, names, true) : std::string (); + ? kpse_path_find_first_of (p, names, true) : std::string (); } string_vector dir_path::find_all_first_of (const string_vector& names) { return initialized - ? kpse_all_path_find_first_of (p, names) : string_vector (); + ? kpse_all_path_find_first_of (p, names) : string_vector (); } void
--- a/liboctave/util/pathsearch.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/pathsearch.h Sat Oct 26 18:57:05 2013 -0700 @@ -36,10 +36,10 @@ dir_path (const std::string& s = std::string (), const std::string& d = std::string ()) : p_orig (s), p_default (d), initialized (false), p (), pv () - { - if (! p_orig.empty ()) - init (); - } + { + if (! p_orig.empty ()) + init (); + } dir_path (const dir_path& dp) : p_orig (dp.p_orig), p_default (dp.p_default), @@ -47,23 +47,23 @@ { } dir_path& operator = (const dir_path& dp) - { - p_orig = dp.p_orig; - p_default = dp.p_default; - initialized = dp.initialized; - p = dp.p; - pv = dp.pv; - return *this; - } + { + p_orig = dp.p_orig; + p_default = dp.p_default; + initialized = dp.initialized; + p = dp.p; + pv = dp.pv; + return *this; + } ~dir_path (void) { } void set (const std::string& s) - { - initialized = false; - p_orig = s; - init (); - } + { + initialized = false; + p_orig = s; + init (); + } string_vector elements (void); string_vector all_directories (void); @@ -77,10 +77,10 @@ string_vector find_all_first_of (const string_vector& names); void rehash (void) - { - initialized = false; - init (); - } + { + initialized = false; + init (); + } static char path_sep_char (void) {
--- a/liboctave/util/sparse-util.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/sparse-util.cc Sat Oct 26 18:57:05 2013 -0700 @@ -97,7 +97,8 @@ if (c[j] > nnz) { (*current_liboctave_error_handler) - ("invalid sparse matrix: cidx[%d] = %d exceeds number of nonzero elements", j, c[j]+1); + ("invalid sparse matrix: cidx[%d] = %d exceeds number of nonzero elements", + j, c[j]+1); return false; }
--- a/liboctave/util/str-vec.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/str-vec.cc Sat Oct 26 18:57:05 2013 -0700 @@ -39,7 +39,7 @@ #include "lo-utils.h" #include "str-vec.h" -// FIXME -- isn't there some STL trick that could be used to make this +// FIXME: isn't there some STL trick that could be used to make this // work for all STL containers of std::string objects? string_vector::string_vector (const std::list<std::string>& lst)
--- a/liboctave/util/str-vec.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/str-vec.h Sat Oct 26 18:57:05 2013 -0700 @@ -93,9 +93,11 @@ Array<std::string>::resize (dim_vector (n, 1), rfv); } - std::string& operator[] (octave_idx_type i) { return Array<std::string>::elem (i); } + std::string& operator[] (octave_idx_type i) + { return Array<std::string>::elem (i); } - std::string operator[] (octave_idx_type i) const { return Array<std::string>::elem (i); } + std::string operator[] (octave_idx_type i) const + { return Array<std::string>::elem (i); } string_vector& sort (bool make_uniq = false);
--- a/liboctave/util/unwind-prot.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/unwind-prot.h Sat Oct 26 18:57:05 2013 -0700 @@ -119,19 +119,19 @@ unwind_protect_safe (void) : unwind_protect () { } ~unwind_protect_safe (void) - { - while (! empty ()) - { - try - { - run_first (); - } - catch (...) // Yes, the black hole. Remember we're in a dtor. - { - gripe_exception (); - } - } - } + { + while (! empty ()) + { + try + { + run_first (); + } + catch (...) // Yes, the black hole. Remember we're in a dtor. + { + gripe_exception (); + } + } + } private:
--- a/liboctave/util/url-transfer.cc Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/url-transfer.cc Sat Oct 26 18:57:05 2013 -0700 @@ -67,7 +67,7 @@ { ok = false; errmsg = "__ftp_mget__: can not create directory '" - + target + sep + directory + "': " + msg; + + target + sep + directory + "': " + msg; return; } } @@ -167,7 +167,7 @@ { ok = false; errmsg = "__ftp__mput: file '" + realfile - + "' does not exist"; + + "' does not exist"; break; } @@ -188,7 +188,7 @@ { ok = false; errmsg = "__ftp_mput__: unable to open file '" - + realfile + "'"; + + realfile + "'"; break; } @@ -207,7 +207,7 @@ { ok = false; errmsg = "__ftp_mput__: can not read the directory '" - + realdir + "'"; + + realdir + "'"; } }
--- a/liboctave/util/url-transfer.h Sat Oct 26 23:20:30 2013 +0200 +++ b/liboctave/util/url-transfer.h Sat Oct 26 18:57:05 2013 -0700 @@ -93,7 +93,7 @@ bool is_binary (void) const { return !ascii_mode; } - virtual void cwd (const std::string& /* path */) { } + virtual void cwd (const std::string& /* path */) { } virtual void del (const std::string& /* file */) { }