Mercurial > hg > octave-lyh
changeset 14981:50e9e02d7c0e
maint: periodic merge of default to jit
author | Max Brister <max@2bass.com> |
---|---|
date | Mon, 09 Jul 2012 09:55:35 -0500 |
parents | bb1f3a9bb122 (current diff) cfb64ea5c6a3 (diff) |
children | d27fa4f03706 |
files | liboctave/Array.h src/pt-id.cc src/pt-id.h src/symtab.h src/toplev.cc |
diffstat | 279 files changed, 1885 insertions(+), 1754 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/dynamic.txi +++ b/doc/interpreter/dynamic.txi @@ -1279,7 +1279,7 @@ @example @group -firstmexdemo() +firstmexdemo () @result{} 1.2346 @end group @end example @@ -1324,10 +1324,10 @@ @example @group -myfunc() +myfunc () @result{} You called function: myfunc This is the principal function -myfunc2() +myfunc2 () @result{} You called function: myfunc2 @end group @end example
--- a/doc/interpreter/func.txi +++ b/doc/interpreter/func.txi @@ -917,7 +917,7 @@ @example @group -function count_calls() +function count_calls () persistent calls = 0; printf ("'count_calls' has been called %d times\n", ++calls);
--- a/doc/interpreter/oop.txi +++ b/doc/interpreter/oop.txi @@ -796,7 +796,7 @@ @example @group -octave:6> f=FIRfilter(); +octave:6> f=FIRfilter (); octave:7> f.polynomial = polynomial([1 2 3]); f.polynomial = 1 + 2 * X + 3 * X ^ 2 @end group
--- a/doc/interpreter/var.txi +++ b/doc/interpreter/var.txi @@ -272,21 +272,21 @@ clear for i = 1:2 - count_calls(); + count_calls (); endfor @print{} 'count_calls' has been called 3 times @print{} 'count_calls' has been called 4 times clear all for i = 1:2 - count_calls(); + count_calls (); endfor @print{} 'count_calls' has been called 1 times @print{} 'count_calls' has been called 2 times clear count_calls for i = 1:2 - count_calls(); + count_calls (); endfor @print{} 'count_calls' has been called 1 times @print{} 'count_calls' has been called 2 times
--- a/examples/embedded.cc +++ b/examples/embedded.cc @@ -10,7 +10,7 @@ argv(0) = "embedded"; argv(1) = "-q"; - octave_main (2, argv.c_str_vec(), 1); + octave_main (2, argv.c_str_vec (), 1); octave_idx_type n = 2; octave_value_list in;
--- a/examples/fortdemo.cc +++ b/examples/fortdemo.cc @@ -12,7 +12,7 @@ DEFUN_DLD (fortdemo , args , , "Fortran Demo.") { octave_value_list retval; - int nargin = args.length(); + int nargin = args.length (); if (nargin != 1) print_usage (); else
--- a/examples/funcdemo.cc +++ b/examples/funcdemo.cc @@ -3,7 +3,7 @@ DEFUN_DLD (funcdemo, args, nargout, "Function Demo") { - int nargin = args.length(); + int nargin = args.length (); octave_value_list retval; if (nargin < 2)
--- a/examples/hello.cc +++ b/examples/hello.cc @@ -89,9 +89,9 @@ for (int i = 0; i < nargin; i++) { - octave_value tmp = args (i); + octave_value tmp = args(i); tmp.print (octave_stdout); - retval (nargin-i-1) = tmp; + retval(nargin-i-1) = tmp; } return retval;
--- a/examples/paramdemo.cc +++ b/examples/paramdemo.cc @@ -7,23 +7,23 @@ octave_value retval; if (nargin != 1) - print_usage(); + print_usage (); else if (nargout != 0) error ("paramdemo: function has no output arguments"); else { - NDArray m = args(0).array_value(); + NDArray m = args(0).array_value (); double min_val = -10.0; double max_val = 10.0; octave_stdout << "Properties of input array:\n"; if (m.any_element_is_negative ()) octave_stdout << " includes negative values\n"; - if (m.any_element_is_inf_or_nan()) + if (m.any_element_is_inf_or_nan ()) octave_stdout << " includes Inf or NaN values\n"; - if (m.any_element_not_one_or_zero()) + if (m.any_element_not_one_or_zero ()) octave_stdout << " includes other values than 1 and 0\n"; - if (m.all_elements_are_int_or_inf_or_nan()) + if (m.all_elements_are_int_or_inf_or_nan ()) octave_stdout << " includes only int, Inf or NaN values\n"; if (m.all_integers (min_val, max_val))
--- a/examples/stringdemo.cc +++ b/examples/stringdemo.cc @@ -2,7 +2,7 @@ DEFUN_DLD (stringdemo, args, , "String Demo") { - int nargin = args.length(); + int nargin = args.length (); octave_value_list retval; if (nargin != 1) @@ -18,13 +18,13 @@ else retval(1) = octave_value (ch, true, '\''); - octave_idx_type nr = ch.rows(); + octave_idx_type nr = ch.rows (); for (octave_idx_type i = 0; i < nr / 2; i++) { std::string tmp = ch.row_as_string (i); - ch.insert (ch.row_as_string(nr-i-1).c_str(), + ch.insert (ch.row_as_string(nr-i-1).c_str (), i, 0); - ch.insert (tmp.c_str(), nr-i-1, 0); + ch.insert (tmp.c_str (), nr-i-1, 0); } retval(0) = octave_value (ch, true); }
--- a/examples/unwinddemo.cc +++ b/examples/unwinddemo.cc @@ -9,7 +9,7 @@ DEFUN_DLD (unwinddemo, args, nargout, "Unwind Demo") { - int nargin = args.length(); + int nargin = args.length (); octave_value retval; if (nargin < 2) print_usage ();
--- a/liboctave/Array-util.cc +++ b/liboctave/Array-util.cc @@ -236,7 +236,7 @@ Array<octave_idx_type> retval (a.dims ()); for (octave_idx_type i = 0; i < a.length (); i++) - retval (i) = a(i).elem (0); + retval(i) = a(i).elem (0); return retval; } @@ -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; }
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -2688,7 +2688,7 @@ { // This guards against accidental implicit instantiations. // Array<T> instances should always be explicit and use INSTANTIATE_ARRAY. - T::__xXxXx__(); + T::__xXxXx__ (); } #define INSTANTIATE_ARRAY(T, API) \
--- a/liboctave/Array.h +++ b/liboctave/Array.h @@ -335,13 +335,13 @@ 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)); } @@ -364,9 +364,9 @@ 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) { 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)); }
--- a/liboctave/CColVector.cc +++ b/liboctave/CColVector.cc @@ -515,7 +515,7 @@ std::istream& operator >> (std::istream& is, ComplexColumnVector& a) { - octave_idx_type len = a.length(); + octave_idx_type len = a.length (); if (len > 0) {
--- a/liboctave/CDiagMatrix.h +++ b/liboctave/CDiagMatrix.h @@ -90,7 +90,7 @@ 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 transpose (void) const { return MDiagArray2<Complex>::transpose (); } DiagMatrix abs (void) const; friend OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a);
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -1089,7 +1089,7 @@ // 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)); @@ -1127,7 +1127,7 @@ } if (info != 0) - mattype.mark_as_rectangular(); + mattype.mark_as_rectangular (); } return retval; @@ -1153,7 +1153,7 @@ if (info == 0) { if (calc_cond) - rcon = chol.rcond(); + rcon = chol.rcond (); else rcon = 1.0; ret = chol.inverse (); @@ -1793,8 +1793,8 @@ { octave_idx_type info = 0; char job = 'L'; - 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 (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -1833,8 +1833,8 @@ octave_idx_type *pipvt = ipvt.fortran_vec (); 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 (); Array<Complex> z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); @@ -2100,7 +2100,7 @@ char job = 'L'; ComplexMatrix atmp = *this; Complex *tmp_data = atmp.fortran_vec (); - 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 (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -2156,7 +2156,7 @@ F77_XFCN (zpotrs, ZPOTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, - result, b.rows(), info + result, b.rows (), info F77_CHAR_ARG_LEN (1))); } else @@ -2184,7 +2184,7 @@ // 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)); @@ -2242,7 +2242,7 @@ char job = 'N'; F77_XFCN (zgetrs, ZGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, - pipvt, result, b.rows(), info + pipvt, result, b.rows (), info F77_CHAR_ARG_LEN (1))); } else
--- a/liboctave/CNDArray.cc +++ b/liboctave/CNDArray.cc @@ -119,7 +119,7 @@ ComplexNDArray ComplexNDArray::fourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); if (dv.length () < 2) return ComplexNDArray (); @@ -127,7 +127,7 @@ const Complex *in = fortran_vec (); ComplexNDArray retval (dv); Complex *out = retval.fortran_vec (); - octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type howmany = numel () / dv(0) / dv(1); octave_idx_type dist = dv(0) * dv(1); for (octave_idx_type i=0; i < howmany; i++) @@ -139,7 +139,7 @@ ComplexNDArray ComplexNDArray::ifourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); if (dv.length () < 2) return ComplexNDArray (); @@ -147,7 +147,7 @@ const Complex *in = fortran_vec (); ComplexNDArray retval (dv); Complex *out = retval.fortran_vec (); - octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type howmany = numel () / dv(0) / dv(1); octave_idx_type dist = dv(0) * dv(1); for (octave_idx_type i=0; i < howmany; i++) @@ -245,7 +245,7 @@ F77_FUNC (zfftf, ZFFTF) (npts, tmp, pwsave); for (octave_idx_type i = 0; i < npts; i++) - retval ((i + k*npts)*stride + j*dist) = tmp[i]; + retval((i + k*npts)*stride + j*dist) = tmp[i]; } } @@ -292,7 +292,7 @@ F77_FUNC (zfftb, ZFFTB) (npts, tmp, pwsave); for (octave_idx_type i = 0; i < npts; i++) - retval ((i + k*npts)*stride + j*dist) = tmp[i] / + retval((i + k*npts)*stride + j*dist) = tmp[i] / static_cast<double> (npts); } } @@ -333,12 +333,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); F77_FUNC (zfftf, ZFFTF) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval ((l + k*npts)*stride + j*dist) = prow[l]; + retval((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -351,7 +351,7 @@ ComplexNDArray ComplexNDArray::ifourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); dim_vector dv2 (dv(0), dv(1)); int rank = 2; ComplexNDArray retval (*this); @@ -381,12 +381,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); 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] / + retval((l + k*npts)*stride + j*dist) = prow[l] / static_cast<double> (npts); } } @@ -429,12 +429,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); F77_FUNC (zfftf, ZFFTF) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval ((l + k*npts)*stride + j*dist) = prow[l]; + retval((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -476,12 +476,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); 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] / + retval((l + k*npts)*stride + j*dist) = prow[l] / static_cast<double> (npts); } }
--- a/liboctave/CRowVector.cc +++ b/liboctave/CRowVector.cc @@ -411,7 +411,7 @@ std::istream& operator >> (std::istream& is, ComplexRowVector& a) { - octave_idx_type len = a.length(); + octave_idx_type len = a.length (); if (len > 0) {
--- a/liboctave/CSparse.cc +++ b/liboctave/CSparse.cc @@ -743,12 +743,12 @@ typ == MatrixType::Permuted_Diagonal) { if (typ == MatrixType::Permuted_Diagonal) - retval = transpose(); + retval = transpose (); else retval = *this; // Force make_unique to be called - Complex *v = retval.data(); + Complex *v = retval.data (); if (calccond) { @@ -929,7 +929,7 @@ OCTAVE_LOCAL_BUFFER (Complex, work, nr); OCTAVE_LOCAL_BUFFER (octave_idx_type, rperm, nr); - octave_idx_type *perm = mattyp.triangular_perm(); + octave_idx_type *perm = mattyp.triangular_perm (); if (typ == MatrixType::Permuted_Upper) { for (octave_idx_type i = 0; i < nr; i++) @@ -1049,7 +1049,7 @@ return retval; inverse_singular: - return SparseComplexMatrix(); + return SparseComplexMatrix (); } SparseComplexMatrix @@ -1065,26 +1065,26 @@ if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) ret = dinverse (mattype, info, rcond, true, calc_cond); else if (typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper) - ret = tinverse (mattype, info, rcond, true, calc_cond).transpose(); + ret = tinverse (mattype, info, rcond, true, calc_cond).transpose (); else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) { - MatrixType newtype = mattype.transpose(); - ret = transpose().tinverse (newtype, info, rcond, true, calc_cond); + MatrixType newtype = mattype.transpose (); + ret = transpose ().tinverse (newtype, info, rcond, true, calc_cond); } else { - if (mattype.is_hermitian()) + if (mattype.is_hermitian ()) { MatrixType tmp_typ (MatrixType::Upper); SparseComplexCHOL fact (*this, info, false); - rcond = fact.rcond(); + rcond = fact.rcond (); if (info == 0) { double rcond2; - SparseMatrix Q = fact.Q(); - SparseComplexMatrix InvL = fact.L().transpose(). + SparseMatrix Q = fact.Q (); + SparseComplexMatrix InvL = fact.L ().transpose (). tinverse(tmp_typ, info, rcond2, true, false); - ret = Q * InvL.hermitian() * InvL * Q.transpose(); + ret = Q * InvL.hermitian () * InvL * Q.transpose (); } else { @@ -1094,22 +1094,22 @@ } } - if (!mattype.is_hermitian()) + if (!mattype.is_hermitian ()) { - octave_idx_type n = rows(); + octave_idx_type n = rows (); ColumnVector Qinit(n); for (octave_idx_type i = 0; i < n; i++) Qinit(i) = i; MatrixType tmp_typ (MatrixType::Upper); SparseComplexLU fact (*this, Qinit, Matrix (), false, false); - rcond = fact.rcond(); + rcond = fact.rcond (); double rcond2; - SparseComplexMatrix InvL = fact.L().transpose(). + SparseComplexMatrix InvL = fact.L ().transpose (). tinverse(tmp_typ, info, rcond2, true, false); - SparseComplexMatrix InvU = fact.U(). - tinverse(tmp_typ, info, rcond2, true, false).transpose(); - ret = fact.Pc().transpose() * InvU * InvL * fact.Pr(); + SparseComplexMatrix InvU = fact.U (). + tinverse(tmp_typ, info, rcond2, true, false).transpose (); + ret = fact.Pc ().transpose () * InvU * InvL * fact.Pr (); } } @@ -1279,13 +1279,13 @@ if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) { - retval.resize (nc, b.cols(), Complex(0.,0.)); + 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 j = 0; j < b.cols (); j++) 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 j = 0; j < b.cols (); j++) for (octave_idx_type k = 0; k < nc; k++) for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) retval(k,j) = b(ridx(i),j) / data (i); @@ -1347,7 +1347,7 @@ retval.xcidx(0) = 0; octave_idx_type ii = 0; if (typ == MatrixType::Diagonal) - for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols (); j++) { for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { @@ -1359,7 +1359,7 @@ retval.xcidx(j+1) = ii; } else - for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols (); j++) { for (octave_idx_type l = 0; l < nc; l++) for (octave_idx_type i = cidx(l); i < cidx(l+1); i++) @@ -1431,13 +1431,13 @@ if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) { - retval.resize (nc, b.cols(), Complex(0.,0.)); + 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 j = 0; j < b.cols (); j++) 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 j = 0; j < b.cols (); j++) for (octave_idx_type k = 0; k < nc; k++) for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) retval(k,j) = b(ridx(i),j) / data (i); @@ -1499,7 +1499,7 @@ retval.xcidx(0) = 0; octave_idx_type ii = 0; if (typ == MatrixType::Diagonal) - for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols (); j++) { for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { @@ -1511,7 +1511,7 @@ retval.xcidx(j+1) = ii; } else - for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols (); j++) { for (octave_idx_type l = 0; l < nc; l++) for (octave_idx_type i = cidx(l); i < cidx(l+1); i++) @@ -1639,7 +1639,7 @@ } for (octave_idx_type i = 0; i < nc; i++) - retval (perm[i], j) = work[i]; + retval(perm[i], j) = work[i]; } if (calc_cond) @@ -2162,7 +2162,7 @@ } for (octave_idx_type i = 0; i < nc; i++) - retval (perm[i], j) = work[i]; + retval(perm[i], j) = work[i]; } if (calc_cond) @@ -2695,7 +2695,7 @@ } for (octave_idx_type i = 0; i < nc; i++) - retval (i, j) = work[i]; + retval(i, j) = work[i]; } if (calc_cond) @@ -3259,7 +3259,7 @@ } for (octave_idx_type i = 0; i < nc; i++) - retval (i, j) = work[i]; + retval(i, j) = work[i]; } if (calc_cond) @@ -3796,12 +3796,12 @@ } } - octave_idx_type b_nc = b.cols(); + octave_idx_type b_nc = b.cols (); retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); F77_XFCN (zptsv, ZPTSV, (nr, b_nc, D, DL, result, - b.rows(), err)); + b.rows (), err)); if (err != 0) { @@ -3853,12 +3853,12 @@ } } - octave_idx_type b_nc = b.cols(); + octave_idx_type b_nc = b.cols (); retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); F77_XFCN (zgtsv, ZGTSV, (nr, b_nc, DL, D, DU, result, - b.rows(), err)); + b.rows (), err)); if (err != 0) { @@ -4095,7 +4095,7 @@ } octave_idx_type b_nr = b.rows (); - octave_idx_type b_nc = b.cols(); + octave_idx_type b_nc = b.cols (); rcond = 1.; retval = ComplexMatrix (b); @@ -4152,8 +4152,8 @@ } } - 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 (); rcond = 1.; retval = ComplexMatrix (b); @@ -4393,7 +4393,7 @@ // Calculate the norm of the matrix, for later use. double anorm; if (calc_cond) - anorm = m_band.abs().sum().row(0).max(); + anorm = m_band.abs ().sum ().row(0).max (); char job = 'L'; F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -4457,7 +4457,7 @@ F77_XFCN (zpbtrs, ZPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, b_nc, tmp_data, - ldm, result, b.rows(), err + ldm, result, b.rows (), err F77_CHAR_ARG_LEN (1))); if (err != 0) @@ -4579,7 +4579,7 @@ F77_XFCN (zgbtrs, ZGBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, n_upper, b_nc, tmp_data, - ldm, pipvt, result, b.rows(), err + ldm, pipvt, result, b.rows (), err F77_CHAR_ARG_LEN (1))); } } @@ -4642,7 +4642,7 @@ // Calculate the norm of the matrix, for later use. double anorm; if (calc_cond) - anorm = m_band.abs().sum().row(0).max(); + anorm = m_band.abs ().sum ().row(0).max (); char job = 'L'; F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -4960,7 +4960,7 @@ // Calculate the norm of the matrix, for later use. double anorm; if (calc_cond) - anorm = m_band.abs().sum().row(0).max(); + anorm = m_band.abs ().sum ().row(0).max (); char job = 'L'; F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -5206,7 +5206,7 @@ // Calculate the norm of the matrix, for later use. double anorm; if (calc_cond) - anorm = m_band.abs().sum().row(0).max(); + anorm = m_band.abs ().sum ().row(0).max (); char job = 'L'; F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -5655,9 +5655,9 @@ A->nrow = nr; A->ncol = nc; - A->p = cidx(); - A->i = ridx(); - A->nzmax = nnz(); + A->p = cidx (); + A->i = ridx (); + A->nzmax = nnz (); A->packed = true; A->sorted = true; A->nz = 0; @@ -5673,21 +5673,21 @@ if (nr < 1) A->x = &dummy; else - A->x = data(); + A->x = data (); cholmod_dense Bstore; cholmod_dense *B = &Bstore; - B->nrow = b.rows(); - B->ncol = b.cols(); + B->nrow = b.rows (); + B->ncol = b.cols (); B->d = B->nrow; B->nzmax = B->nrow * B->ncol; B->dtype = CHOLMOD_DOUBLE; B->xtype = CHOLMOD_REAL; - if (nc < 1 || b.cols() < 1) + if (nc < 1 || b.cols () < 1) B->x = &dummy; else // We won't alter it, honest :-) - B->x = const_cast<double *>(b.fortran_vec()); + B->x = const_cast<double *>(b.fortran_vec ()); cholmod_factor *L; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -5731,11 +5731,11 @@ X = CHOLMOD_NAME(solve) (CHOLMOD_A, L, B, cm); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - retval.resize (b.rows (), b.cols()); - for (octave_idx_type j = 0; j < b.cols(); j++) - { - octave_idx_type jr = j * b.rows(); - for (octave_idx_type i = 0; i < b.rows(); i++) + retval.resize (b.rows (), b.cols ()); + for (octave_idx_type j = 0; j < b.cols (); j++) + { + octave_idx_type jr = j * b.rows (); + for (octave_idx_type i = 0; i < b.rows (); i++) retval.xelem(i,j) = static_cast<Complex *>(X->x)[jr + i]; } @@ -5898,9 +5898,9 @@ A->nrow = nr; A->ncol = nc; - A->p = cidx(); - A->i = ridx(); - A->nzmax = nnz(); + A->p = cidx (); + A->i = ridx (); + A->nzmax = nnz (); A->packed = true; A->sorted = true; A->nz = 0; @@ -5916,15 +5916,15 @@ if (nr < 1) A->x = &dummy; else - A->x = data(); + A->x = data (); cholmod_sparse Bstore; cholmod_sparse *B = &Bstore; - B->nrow = b.rows(); - B->ncol = b.cols(); - B->p = b.cidx(); - B->i = b.ridx(); - B->nzmax = b.nnz(); + B->nrow = b.rows (); + B->ncol = b.cols (); + B->p = b.cidx (); + B->i = b.ridx (); + B->nzmax = b.nnz (); B->packed = true; B->sorted = true; B->nz = 0; @@ -5937,10 +5937,10 @@ B->stype = 0; B->xtype = CHOLMOD_REAL; - if (b.rows() < 1 || b.cols() < 1) + if (b.rows () < 1 || b.cols () < 1) B->x = &dummy; else - B->x = b.data(); + B->x = b.data (); cholmod_factor *L; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -6189,9 +6189,9 @@ A->nrow = nr; A->ncol = nc; - A->p = cidx(); - A->i = ridx(); - A->nzmax = nnz(); + A->p = cidx (); + A->i = ridx (); + A->nzmax = nnz (); A->packed = true; A->sorted = true; A->nz = 0; @@ -6207,21 +6207,21 @@ if (nr < 1) A->x = &dummy; else - A->x = data(); + A->x = data (); cholmod_dense Bstore; cholmod_dense *B = &Bstore; - B->nrow = b.rows(); - B->ncol = b.cols(); + B->nrow = b.rows (); + B->ncol = b.cols (); B->d = B->nrow; B->nzmax = B->nrow * B->ncol; B->dtype = CHOLMOD_DOUBLE; B->xtype = CHOLMOD_COMPLEX; - if (nc < 1 || b.cols() < 1) + if (nc < 1 || b.cols () < 1) B->x = &dummy; else // We won't alter it, honest :-) - B->x = const_cast<Complex *>(b.fortran_vec()); + B->x = const_cast<Complex *>(b.fortran_vec ()); cholmod_factor *L; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -6265,11 +6265,11 @@ X = CHOLMOD_NAME(solve) (CHOLMOD_A, L, B, cm); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - retval.resize (b.rows (), b.cols()); - for (octave_idx_type j = 0; j < b.cols(); j++) - { - octave_idx_type jr = j * b.rows(); - for (octave_idx_type i = 0; i < b.rows(); i++) + retval.resize (b.rows (), b.cols ()); + for (octave_idx_type j = 0; j < b.cols (); j++) + { + octave_idx_type jr = j * b.rows (); + for (octave_idx_type i = 0; i < b.rows (); i++) retval.xelem(i,j) = static_cast<Complex *>(X->x)[jr + i]; } @@ -6411,9 +6411,9 @@ A->nrow = nr; A->ncol = nc; - A->p = cidx(); - A->i = ridx(); - A->nzmax = nnz(); + A->p = cidx (); + A->i = ridx (); + A->nzmax = nnz (); A->packed = true; A->sorted = true; A->nz = 0; @@ -6429,15 +6429,15 @@ if (nr < 1) A->x = &dummy; else - A->x = data(); + A->x = data (); cholmod_sparse Bstore; cholmod_sparse *B = &Bstore; - B->nrow = b.rows(); - B->ncol = b.cols(); - B->p = b.cidx(); - B->i = b.ridx(); - B->nzmax = b.nnz(); + B->nrow = b.rows (); + B->ncol = b.cols (); + B->p = b.cidx (); + B->i = b.ridx (); + B->nzmax = b.nnz (); B->packed = true; B->sorted = true; B->nz = 0; @@ -6450,10 +6450,10 @@ B->stype = 0; B->xtype = CHOLMOD_COMPLEX; - if (b.rows() < 1 || b.cols() < 1) + if (b.rows () < 1 || b.cols () < 1) B->x = &dummy; else - B->x = b.data(); + B->x = b.data (); cholmod_factor *L; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -7348,8 +7348,8 @@ SparseComplexMatrix SparseComplexMatrix::prod (int dim) const { - if ((rows() == 1 && dim == -1) || dim == 1) - return transpose (). prod (0). transpose(); + if ((rows () == 1 && dim == -1) || dim == 1) + return transpose (). prod (0). transpose (); else { SPARSE_REDUCTION_OP (SparseComplexMatrix, Complex, *=, @@ -7386,7 +7386,7 @@ octave_idx_type nz = nnz (); octave_idx_type nc = cols (); - SparseMatrix retval (rows(), nc, nz); + SparseMatrix retval (rows (), nc, nz); for (octave_idx_type i = 0; i < nc + 1; i++) retval.cidx (i) = cidx (i); @@ -7665,7 +7665,7 @@ { SparseComplexMatrix r; - if ((a.rows() == b.rows()) && (a.cols() == b.cols())) + if ((a.rows () == b.rows ()) && (a.cols () == b.cols ())) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols (); @@ -7785,7 +7785,7 @@ { SparseComplexMatrix r; - if ((a.rows() == b.rows()) && (a.cols() == b.cols())) + if ((a.rows () == b.rows ()) && (a.cols () == b.cols ())) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols ();
--- a/liboctave/CmplxGEPBAL.cc +++ b/liboctave/CmplxGEPBAL.cc @@ -70,7 +70,7 @@ return -1; } - if (a.dims() != b.dims ()) + if (a.dims () != b.dims ()) { gripe_nonconformant ("ComplexGEPBALANCE", n, n, b.rows(), b.cols()); return -1;
--- a/liboctave/EIG.cc +++ b/liboctave/EIG.cc @@ -691,7 +691,7 @@ octave_idx_type n = a.rows (); octave_idx_type nb = b.rows (); - if (n != a.cols () || nb != b.cols()) + if (n != a.cols () || nb != b.cols ()) { (*current_liboctave_error_handler) ("EIG requires square matrix"); return -1;
--- a/liboctave/MSparse.cc +++ b/liboctave/MSparse.cc @@ -417,7 +417,7 @@ else { r = MSparse<T> (b); - octave_idx_type b_nnz = b.nnz(); + octave_idx_type b_nnz = b.nnz (); for (octave_idx_type i = 0 ; i < b_nnz ; i++) { @@ -434,7 +434,7 @@ else { r = MSparse<T> (a); - octave_idx_type a_nnz = a.nnz(); + octave_idx_type a_nnz = a.nnz (); for (octave_idx_type i = 0 ; i < a_nnz ; i++) { @@ -512,10 +512,10 @@ if (a_nr == 1 && a_nc == 1) { T val = a.elem (0,0); - T fill = val / T(); - if (fill == T()) + T fill = val / T (); + if (fill == T ()) { - octave_idx_type b_nnz = b.nnz(); + octave_idx_type b_nnz = b.nnz (); r = MSparse<T> (b); for (octave_idx_type i = 0 ; i < b_nnz ; i++) r.data (i) = val / r.data(i); @@ -540,10 +540,10 @@ else if (b_nr == 1 && b_nc == 1) { T val = b.elem (0,0); - T fill = T() / val; - if (fill == T()) + T fill = T () / val; + if (fill == T ()) { - octave_idx_type a_nnz = a.nnz(); + octave_idx_type a_nnz = a.nnz (); r = MSparse<T> (a); for (octave_idx_type i = 0 ; i < a_nnz ; i++) r.data (i) = r.data(i) / val;
--- a/liboctave/MatrixType.cc +++ b/liboctave/MatrixType.cc @@ -40,7 +40,7 @@ MatrixType::MatrixType (void) : typ (MatrixType::Unknown), - sp_bandden (octave_sparse_params::get_bandden()), + sp_bandden (octave_sparse_params::get_bandden ()), bandden (0), upper_band (0), lower_band (0), dense (false), full (false), nperm (0), perm (0) { } @@ -140,8 +140,8 @@ std::complex<T> d = a.elem (j,j); upper = upper && (d != zero); lower = lower && (d != zero); - hermitian = hermitian && (d.real() > zero && d.imag() == zero); - diag[j] = d.real(); + hermitian = hermitian && (d.real () > zero && d.imag () == zero); + diag[j] = d.real (); } for (octave_idx_type j = 0; @@ -220,7 +220,7 @@ (*current_liboctave_warning_handler) ("Calculating Sparse Matrix Type"); - sp_bandden = octave_sparse_params::get_bandden(); + sp_bandden = octave_sparse_params::get_bandden (); bool maybe_hermitian = false; typ = MatrixType::Full; @@ -541,7 +541,7 @@ (*current_liboctave_warning_handler) ("Calculating Sparse Matrix Type"); - sp_bandden = octave_sparse_params::get_bandden(); + sp_bandden = octave_sparse_params::get_bandden (); bool maybe_hermitian = false; typ = MatrixType::Full; @@ -804,8 +804,8 @@ if (a.ridx(i) == j) { Complex d = a.data(i); - is_herm = d.real() > 0. && d.imag() == 0.; - diag(j) = d.real(); + is_herm = d.real () > 0. && d.imag () == 0.; + diag(j) = d.real (); break; } } @@ -850,7 +850,7 @@ } MatrixType::MatrixType (const matrix_type t, bool _full) : typ (MatrixType::Unknown), - sp_bandden (octave_sparse_params::get_bandden()), + sp_bandden (octave_sparse_params::get_bandden ()), bandden (0), upper_band (0), lower_band (0), dense (false), full (_full), nperm (0), perm (0) { @@ -867,7 +867,7 @@ MatrixType::MatrixType (const matrix_type t, const octave_idx_type np, const octave_idx_type *p, bool _full) : typ (MatrixType::Unknown), - sp_bandden (octave_sparse_params::get_bandden()), + sp_bandden (octave_sparse_params::get_bandden ()), bandden (0), upper_band (0), lower_band (0), dense (false), full (_full), nperm (0), perm (0) { @@ -887,7 +887,7 @@ MatrixType::MatrixType (const matrix_type t, const octave_idx_type ku, const octave_idx_type kl, bool _full) : typ (MatrixType::Unknown), - sp_bandden (octave_sparse_params::get_bandden()), + sp_bandden (octave_sparse_params::get_bandden ()), bandden (0), upper_band (0), lower_band (0), dense (false), full (_full), nperm (0), perm (0) { @@ -944,7 +944,7 @@ MatrixType::type (bool quiet) { if (typ != MatrixType::Unknown && (full || - sp_bandden == octave_sparse_params::get_bandden())) + sp_bandden == octave_sparse_params::get_bandden ())) { if (!quiet && octave_sparse_params::get_key ("spumoni") != 0.) @@ -968,7 +968,7 @@ MatrixType::type (const SparseMatrix &a) { if (typ != MatrixType::Unknown && (full || - sp_bandden == octave_sparse_params::get_bandden())) + sp_bandden == octave_sparse_params::get_bandden ())) { if (octave_sparse_params::get_key ("spumoni") != 0.) (*current_liboctave_warning_handler) @@ -1001,7 +1001,7 @@ MatrixType::type (const SparseComplexMatrix &a) { if (typ != MatrixType::Unknown && (full || - sp_bandden == octave_sparse_params::get_bandden())) + sp_bandden == octave_sparse_params::get_bandden ())) { if (octave_sparse_params::get_key ("spumoni") != 0.) (*current_liboctave_warning_handler)
--- a/liboctave/Sparse-op-defs.h +++ b/liboctave/Sparse-op-defs.h @@ -519,7 +519,7 @@ else \ { \ r = R (m2); \ - octave_idx_type m2_nnz = m2.nnz(); \ + octave_idx_type m2_nnz = m2.nnz (); \ \ for (octave_idx_type i = 0 ; i < m2_nnz ; i++) \ { \ @@ -536,7 +536,7 @@ else \ { \ r = R (m1); \ - octave_idx_type m1_nnz = m1.nnz(); \ + octave_idx_type m1_nnz = m1.nnz (); \ \ for (octave_idx_type i = 0 ; i < m1_nnz ; i++) \ { \ @@ -612,9 +612,9 @@ \ if (m1_nr == 1 && m1_nc == 1) \ { \ - if ((m1.elem (0,0) OP Complex()) == Complex()) \ + if ((m1.elem (0,0) OP Complex ()) == Complex ()) \ { \ - octave_idx_type m2_nnz = m2.nnz(); \ + octave_idx_type m2_nnz = m2.nnz (); \ r = R (m2); \ for (octave_idx_type i = 0 ; i < m2_nnz ; i++) \ r.data (i) = m1.elem(0,0) OP r.data(i); \ @@ -638,9 +638,9 @@ } \ else if (m2_nr == 1 && m2_nc == 1) \ { \ - if ((Complex() OP m1.elem (0,0)) == Complex()) \ + if ((Complex () OP m1.elem (0,0)) == Complex ()) \ { \ - octave_idx_type m1_nnz = m1.nnz(); \ + octave_idx_type m1_nnz = m1.nnz (); \ r = R (m1); \ for (octave_idx_type i = 0 ; i < m1_nnz ; i++) \ r.data (i) = r.data(i) OP m2.elem(0,0); \ @@ -648,7 +648,7 @@ } \ else \ { \ - r = R (m1_nr, m1_nc, Complex() OP m2.elem(0,0)); \ + r = R (m1_nr, m1_nc, Complex () OP m2.elem(0,0)); \ for (octave_idx_type j = 0 ; j < m1_nc ; j++) \ { \ octave_quit (); \ @@ -1830,8 +1830,8 @@ INIT_VAL, MT_RESULT) #define SPARSE_ALL_OP(DIM) \ - if ((rows() == 1 && dim == -1) || dim == 1) \ - return transpose (). all (0). transpose(); \ + if ((rows () == 1 && dim == -1) || dim == 1) \ + return transpose (). all (0). transpose (); \ else \ { \ SPARSE_ANY_ALL_OP (DIM, (cidx(j+1) - cidx(j) < nr ? false : true), \ @@ -1850,7 +1850,7 @@ if (nr == 1 && nc == 1) \ { \ RET_EL_TYPE s = m.elem(0,0); \ - octave_idx_type nz = a.nnz(); \ + octave_idx_type nz = a.nnz (); \ RET_TYPE r (a_nr, a_nc, nz); \ \ for (octave_idx_type i = 0; i < nz; i++) \ @@ -1871,7 +1871,7 @@ else if (a_nr == 1 && a_nc == 1) \ { \ RET_EL_TYPE s = a.elem(0,0); \ - octave_idx_type nz = m.nnz(); \ + octave_idx_type nz = m.nnz (); \ RET_TYPE r (nr, nc, nz); \ \ for (octave_idx_type i = 0; i < nz; i++) \ @@ -1946,7 +1946,7 @@ octave_idx_type n_per_col = (a_nc > 43000 ? 43000 : \ (a_nc * a_nc) / 43000); \ octave_idx_type ii = 0; \ - octave_idx_type *ri = retval.xridx(); \ + octave_idx_type *ri = retval.xridx (); \ octave_sort<octave_idx_type> sort; \ \ for (octave_idx_type i = 0; i < a_nc ; i++) \
--- a/liboctave/Sparse-perm-op-defs.h +++ b/liboctave/Sparse-perm-op-defs.h @@ -49,7 +49,7 @@ sidx[ii++]=i; r.xridx (i) = pcol[a.ridx (i)]; } - sort.sort (r.xridx() + r.xcidx(j), sidx, r.xcidx(j+1) - r.xcidx(j)); + sort.sort (r.xridx () + r.xcidx(j), sidx, r.xcidx(j+1) - r.xcidx(j)); for (octave_idx_type i = r.xcidx(j), ii = 0; i < r.xcidx(j+1); i++) r.xdata(i) = a.data (sidx[ii++]); }
--- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -55,7 +55,7 @@ template <class T> Sparse<T>::Sparse (const PermMatrix& a) : rep (new typename Sparse<T>::SparseRep (a.rows (), a.cols (), a.rows ())), - dimensions (dim_vector (a.rows (), a.cols())) + dimensions (dim_vector (a.rows (), a.cols ())) { octave_idx_type n = a.rows (); for (octave_idx_type i = 0; i <= n; i++) @@ -149,7 +149,7 @@ { octave_idx_type u = c[j]; for (i = i; i < u; i++) - if (d[i] != T()) + if (d[i] != T ()) { d[k] = d[i]; r[k++] = r[i]; @@ -231,7 +231,7 @@ Sparse<T>::Sparse (const dim_vector& dv) : rep (0), dimensions (dv) { - if (dv.length() != 2) + if (dv.length () != 2) (*current_liboctave_error_handler) ("Sparse::Sparse (const dim_vector&): dimension mismatch"); else @@ -254,7 +254,7 @@ ("Sparse::Sparse (const Sparse&, const dim_vector&): dimension mismatch"); else { - dim_vector old_dims = a.dims(); + dim_vector old_dims = a.dims (); octave_idx_type new_nzmx = a.nnz (); octave_idx_type new_nr = dv (0); octave_idx_type new_nc = dv (1); @@ -334,7 +334,7 @@ { // This is completely specialized, because the sorts can be simplified. T a0 = a(0); - if (a0 == T()) + if (a0 == T ()) { // Do nothing, it's an empty matrix. } @@ -815,7 +815,7 @@ (*current_liboctave_warning_handler) ("reshape: sparse reshape to N-d array smashes dims"); - for (octave_idx_type i = 2; i < dims2.length(); i++) + for (octave_idx_type i = 2; i < dims2.length (); i++) dims2(1) *= dims2(i); dims2.resize (2); @@ -1618,7 +1618,7 @@ // If nr == 1 then the vector indexing will return a column vector!! if (nr == 1) - retval.transpose(); + retval.transpose (); } else if (idx_i.is_scalar ()) { @@ -1866,7 +1866,7 @@ octave_idx_type iidx = idx(i); octave_idx_type li = lblookup (ri, nz, iidx); if (li != nz && ri[li] == iidx) - xdata(li) = T(); + xdata(li) = T (); } maybe_compress (true); @@ -2589,7 +2589,7 @@ Array<T> Sparse<T>::array_value () const { - NoAlias< Array<T> > retval (dims (), T()); + NoAlias< Array<T> > retval (dims (), T ()); if (rows () == 1) { octave_idx_type i = 0; @@ -2603,7 +2603,7 @@ { for (octave_idx_type j = 0, nc = cols (); j < nc; j++) for (octave_idx_type i = cidx(j), iu = cidx(j+1); i < iu; i++) - retval (ridx(i), j) = data (i); + retval(ridx(i), j) = data (i); } return retval;
--- a/liboctave/Sparse.h +++ b/liboctave/Sparse.h @@ -299,13 +299,13 @@ T& xelem (octave_idx_type n) { - octave_idx_type i = n % rows (), j = n / rows(); + octave_idx_type i = n % rows (), j = n / rows (); return xelem (i, j); } T xelem (octave_idx_type n) const { - octave_idx_type i = n % rows (), j = n / rows(); + octave_idx_type i = n % rows (), j = n / rows (); return xelem (i, j); }
--- a/liboctave/SparseCmplxCHOL.cc +++ b/liboctave/SparseCmplxCHOL.cc @@ -52,12 +52,12 @@ if (typ == MatrixType::Upper) { rinv = r.inverse(mattype, info, rcond, true, false); - retval = rinv.transpose() * rinv; + retval = rinv.transpose () * rinv; } else if (typ == MatrixType::Lower) { - rinv = r.transpose().inverse(mattype, info, rcond, true, false); - retval = rinv.transpose() * rinv; + rinv = r.transpose ().inverse(mattype, info, rcond, true, false); + retval = rinv.transpose () * rinv; } else (*current_liboctave_error_handler)
--- a/liboctave/SparseCmplxCHOL.h +++ b/liboctave/SparseCmplxCHOL.h @@ -61,7 +61,7 @@ return *this; } - SparseComplexMatrix chol_matrix (void) const { return R(); } + SparseComplexMatrix chol_matrix (void) const { return R (); } SparseComplexMatrix L (void) const { return sparse_base_chol<SparseComplexMatrix, Complex,
--- a/liboctave/SparseCmplxLU.cc +++ b/liboctave/SparseCmplxLU.cc @@ -57,7 +57,7 @@ double tmp = octave_sparse_params::get_key ("spumoni"); if (!xisnan (tmp)) Control (UMFPACK_PRL) = tmp; - if (piv_thres.nelem() == 2) + if (piv_thres.nelem () == 2) { tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0)); if (!xisnan (tmp)) @@ -223,12 +223,12 @@ UMFPACK_ZNAME (report_matrix) (nr, n_inner, Lfact.cidx (), Lfact.ridx (), - reinterpret_cast<double *> (Lfact.data()), + reinterpret_cast<double *> (Lfact.data ()), 0, 1, control); UMFPACK_ZNAME (report_matrix) (n_inner, nc, Ufact.cidx (), Ufact.ridx (), - reinterpret_cast<double *> (Ufact.data()), + reinterpret_cast<double *> (Ufact.data ()), 0, 1, control); UMFPACK_ZNAME (report_perm) (nr, p, control); UMFPACK_ZNAME (report_perm) (nc, q, control); @@ -266,7 +266,7 @@ double tmp = octave_sparse_params::get_key ("spumoni"); if (!xisnan (tmp)) Control (UMFPACK_PRL) = tmp; - if (piv_thres.nelem() == 2) + if (piv_thres.nelem () == 2) { tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0)); if (!xisnan (tmp)) @@ -452,13 +452,13 @@ UMFPACK_ZNAME (report_matrix) (nr, n_inner, Lfact.cidx (), Lfact.ridx (), - reinterpret_cast<double *> (Lfact.data()), + reinterpret_cast<double *> (Lfact.data ()), 0, 1, control); UMFPACK_ZNAME (report_matrix) (n_inner, nc, Ufact.cidx (), Ufact.ridx (), - reinterpret_cast<double *> (Ufact.data()), + reinterpret_cast<double *> (Ufact.data ()), 0, 1, control); UMFPACK_ZNAME (report_perm) (nr, p, control); UMFPACK_ZNAME (report_perm) (nc, q, control);
--- a/liboctave/SparseCmplxQR.cc +++ b/liboctave/SparseCmplxQR.cc @@ -192,14 +192,14 @@ SparseComplexQR::SparseComplexQR_rep::C (const ComplexMatrix &b) const { #ifdef HAVE_CXSPARSE - 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 (); octave_idx_type nc = N->L->n; octave_idx_type nr = nrows; const cs_complex_t *bvec = - reinterpret_cast<const cs_complex_t *>(b.fortran_vec()); + reinterpret_cast<const cs_complex_t *>(b.fortran_vec ()); ComplexMatrix ret(b_nr, b_nc); - Complex *vec = ret.fortran_vec(); + Complex *vec = ret.fortran_vec (); if (nr < 0 || nc < 0 || nr != b_nr) (*current_liboctave_error_handler) ("matrix dimension mismatch"); else if (nr == 0 || nc == 0 || b_nc == 0) @@ -245,7 +245,7 @@ octave_idx_type nc = N->L->n; octave_idx_type nr = nrows; ComplexMatrix ret(nr, nr); - Complex *vec = ret.fortran_vec(); + Complex *vec = ret.fortran_vec (); if (nr < 0 || nc < 0) (*current_liboctave_error_handler) ("matrix dimension mismatch"); else if (nr == 0 || nc == 0) @@ -294,10 +294,10 @@ { info = -1; #ifdef HAVE_CXSPARSE - octave_idx_type nr = a.rows(); - octave_idx_type nc = a.cols(); - octave_idx_type b_nc = b.cols(); - octave_idx_type b_nr = b.rows(); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); ComplexMatrix x; if (nr < 0 || nc < 0 || nr != b_nr) @@ -309,41 +309,41 @@ { SparseComplexQR q (a, 2); if (! q.ok ()) - return ComplexMatrix(); + return ComplexMatrix (); x.resize(nc, b_nc); cs_complex_t *vec = reinterpret_cast<cs_complex_t *> - (x.fortran_vec()); - OCTAVE_C99_COMPLEX (buf, q.S()->m2); + (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) { octave_quit (); for (octave_idx_type j = 0; j < b_nr; j++) Xx[j] = b.xelem(j,i); - for (octave_idx_type j = nr; j < q.S()->m2; j++) + for (octave_idx_type j = nr; j < q.S ()->m2; j++) buf[j] = OCTAVE_C99_ZERO; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) CXSPARSE_ZNAME (_ipvec) - (q.S()->pinv, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); + (q.S ()->pinv, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); #else CXSPARSE_ZNAME (_ipvec) - (nr, q.S()->Pinv, reinterpret_cast<cs_complex_t *>(Xx), buf); + (nr, q.S ()->Pinv, reinterpret_cast<cs_complex_t *>(Xx), buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = 0; j < nc; j++) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_ZNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_ZNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_ZNAME (_usolve) (q.N()->U, buf); + CXSPARSE_ZNAME (_usolve) (q.N ()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_ipvec) (q.S()->q, buf, vec + idx, nc); + CXSPARSE_ZNAME (_ipvec) (q.S ()->q, buf, vec + idx, nc); #else - CXSPARSE_ZNAME (_ipvec) (nc, q.S()->Q, buf, vec + idx); + CXSPARSE_ZNAME (_ipvec) (nc, q.S ()->Q, buf, vec + idx); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } @@ -351,24 +351,24 @@ } else { - SparseComplexMatrix at = a.hermitian(); + SparseComplexMatrix at = a.hermitian (); SparseComplexQR q (at, 2); if (! q.ok ()) - return ComplexMatrix(); + return ComplexMatrix (); x.resize(nc, b_nc); 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); + (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); #if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) OCTAVE_LOCAL_BUFFER (double, B, nr); for (octave_idx_type i = 0; i < nr; i++) - B[i] = q.N()->B [i]; + B[i] = q.N ()->B [i]; #else OCTAVE_LOCAL_BUFFER (Complex, B, nr); for (octave_idx_type i = 0; i < nr; i++) - B[i] = conj (reinterpret_cast<Complex *>(q.N()->B) [i]); + B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B) [i]); #endif for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc) { @@ -380,12 +380,12 @@ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) CXSPARSE_ZNAME (_pvec) - (q.S()->q, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); + (q.S ()->q, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); #else CXSPARSE_ZNAME (_pvec) - (nr, q.S()->Q, reinterpret_cast<cs_complex_t *>(Xx), buf); + (nr, q.S ()->Q, reinterpret_cast<cs_complex_t *>(Xx), buf); #endif - CXSPARSE_ZNAME (_utsolve) (q.N()->U, buf); + CXSPARSE_ZNAME (_utsolve) (q.N ()->U, buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = nr-1; j >= 0; j--) { @@ -393,18 +393,18 @@ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) - CXSPARSE_ZNAME (_happly) (q.N()->L, j, B[j], buf); + CXSPARSE_ZNAME (_happly) (q.N ()->L, j, B[j], buf); #else CXSPARSE_ZNAME (_happly) - (q.N()->L, j, reinterpret_cast<cs_complex_t *>(B)[j], buf); + (q.N ()->L, j, reinterpret_cast<cs_complex_t *>(B)[j], buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_pvec) (q.S()->pinv, buf, vec + idx, nc); + CXSPARSE_ZNAME (_pvec) (q.S ()->pinv, buf, vec + idx, nc); #else - CXSPARSE_ZNAME (_pvec) (nc, q.S()->Pinv, buf, vec + idx); + CXSPARSE_ZNAME (_pvec) (nc, q.S ()->Pinv, buf, vec + idx); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } @@ -422,10 +422,10 @@ { info = -1; #ifdef HAVE_CXSPARSE - octave_idx_type nr = a.rows(); - octave_idx_type nc = a.cols(); - octave_idx_type b_nc = b.cols(); - octave_idx_type b_nr = b.rows(); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); SparseComplexMatrix x; volatile octave_idx_type ii, x_nz; @@ -438,44 +438,44 @@ { SparseComplexQR q (a, 2); if (! q.ok ()) - return SparseComplexMatrix(); - x = SparseComplexMatrix (nc, b_nc, b.nnz()); + return SparseComplexMatrix (); + x = SparseComplexMatrix (nc, b_nc, b.nnz ()); x.xcidx(0) = 0; - x_nz = b.nnz(); + x_nz = b.nnz (); ii = 0; OCTAVE_LOCAL_BUFFER (Complex, Xx, (b_nr > nc ? b_nr : nc)); - OCTAVE_C99_COMPLEX (buf, q.S()->m2); + OCTAVE_C99_COMPLEX (buf, q.S ()->m2); for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc) { octave_quit (); for (octave_idx_type j = 0; j < b_nr; j++) Xx[j] = b.xelem(j,i); - for (octave_idx_type j = nr; j < q.S()->m2; j++) + for (octave_idx_type j = nr; j < q.S ()->m2; j++) buf[j] = OCTAVE_C99_ZERO; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) CXSPARSE_ZNAME (_ipvec) - (q.S()->pinv, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); + (q.S ()->pinv, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); #else CXSPARSE_ZNAME (_ipvec) - (nr, q.S()->Pinv, reinterpret_cast<cs_complex_t *>(Xx), buf); + (nr, q.S ()->Pinv, reinterpret_cast<cs_complex_t *>(Xx), buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = 0; j < nc; j++) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_ZNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_ZNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_ZNAME (_usolve) (q.N()->U, buf); + CXSPARSE_ZNAME (_usolve) (q.N ()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) CXSPARSE_ZNAME (_ipvec) - (q.S()->q, buf, reinterpret_cast<cs_complex_t *>(Xx), nc); + (q.S ()->q, buf, reinterpret_cast<cs_complex_t *>(Xx), nc); #else CXSPARSE_ZNAME (_ipvec) - (nc, q.S()->Q, buf, reinterpret_cast<cs_complex_t *>(Xx)); + (nc, q.S ()->Q, buf, reinterpret_cast<cs_complex_t *>(Xx)); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -502,26 +502,26 @@ } else { - SparseComplexMatrix at = a.hermitian(); + SparseComplexMatrix at = a.hermitian (); SparseComplexQR q (at, 2); if (! q.ok ()) - return SparseComplexMatrix(); - x = SparseComplexMatrix (nc, b_nc, b.nnz()); + return SparseComplexMatrix (); + x = SparseComplexMatrix (nc, b_nc, b.nnz ()); x.xcidx(0) = 0; - x_nz = b.nnz(); + x_nz = b.nnz (); ii = 0; - volatile octave_idx_type nbuf = (nc > q.S()->m2 ? nc : q.S()->m2); + volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2); OCTAVE_LOCAL_BUFFER (Complex, Xx, (b_nr > nc ? b_nr : nc)); OCTAVE_C99_COMPLEX (buf, nbuf); #if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) OCTAVE_LOCAL_BUFFER (double, B, nr); for (octave_idx_type i = 0; i < nr; i++) - B[i] = q.N()->B [i]; + B[i] = q.N ()->B [i]; #else OCTAVE_LOCAL_BUFFER (Complex, B, nr); for (octave_idx_type i = 0; i < nr; i++) - B[i] = conj (reinterpret_cast<Complex *>(q.N()->B) [i]); + B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B) [i]); #endif for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc) { @@ -533,32 +533,32 @@ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) CXSPARSE_ZNAME (_pvec) - (q.S()->q, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); + (q.S ()->q, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); #else CXSPARSE_ZNAME (_pvec) - (nr, q.S()->Q, reinterpret_cast<cs_complex_t *>(Xx), buf); + (nr, q.S ()->Q, reinterpret_cast<cs_complex_t *>(Xx), buf); #endif - CXSPARSE_ZNAME (_utsolve) (q.N()->U, buf); + CXSPARSE_ZNAME (_utsolve) (q.N ()->U, buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = nr-1; j >= 0; j--) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) - CXSPARSE_ZNAME (_happly) (q.N()->L, j, B[j], buf); + CXSPARSE_ZNAME (_happly) (q.N ()->L, j, B[j], buf); #else CXSPARSE_ZNAME (_happly) - (q.N()->L, j, reinterpret_cast<cs_complex_t *>(B)[j], buf); + (q.N ()->L, j, reinterpret_cast<cs_complex_t *>(B)[j], buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) CXSPARSE_ZNAME (_pvec) - (q.S()->pinv, buf, reinterpret_cast<cs_complex_t *>(Xx), nc); + (q.S ()->pinv, buf, reinterpret_cast<cs_complex_t *>(Xx), nc); #else CXSPARSE_ZNAME (_pvec) - (nc, q.S()->Pinv, buf, reinterpret_cast<cs_complex_t *>(Xx)); + (nc, q.S ()->Pinv, buf, reinterpret_cast<cs_complex_t *>(Xx)); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -596,12 +596,12 @@ { info = -1; #ifdef HAVE_CXSPARSE - octave_idx_type nr = a.rows(); - octave_idx_type nc = a.cols(); - octave_idx_type b_nc = b.cols(); - octave_idx_type b_nr = b.rows(); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); const cs_complex_t *bvec = - reinterpret_cast<const cs_complex_t *>(b.fortran_vec()); + reinterpret_cast<const cs_complex_t *>(b.fortran_vec ()); ComplexMatrix x; if (nr < 0 || nc < 0 || nr != b_nr) @@ -613,37 +613,37 @@ { SparseComplexQR q (a, 2); if (! q.ok ()) - return ComplexMatrix(); + return ComplexMatrix (); x.resize(nc, b_nc); cs_complex_t *vec = reinterpret_cast<cs_complex_t *> - (x.fortran_vec()); - OCTAVE_C99_COMPLEX (buf, q.S()->m2); + (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) { octave_quit (); - for (octave_idx_type j = nr; j < q.S()->m2; j++) + for (octave_idx_type j = nr; j < q.S ()->m2; j++) buf[j] = OCTAVE_C99_ZERO; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_ipvec) (q.S()->pinv, bvec + bidx, buf, nr); + CXSPARSE_ZNAME (_ipvec) (q.S ()->pinv, bvec + bidx, buf, nr); #else - CXSPARSE_ZNAME (_ipvec) (nr, q.S()->Pinv, bvec + bidx, buf); + CXSPARSE_ZNAME (_ipvec) (nr, q.S ()->Pinv, bvec + bidx, buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = 0; j < nc; j++) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_ZNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_ZNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_ZNAME (_usolve) (q.N()->U, buf); + CXSPARSE_ZNAME (_usolve) (q.N ()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_ipvec) (q.S()->q, buf, vec + idx, nc); + CXSPARSE_ZNAME (_ipvec) (q.S ()->q, buf, vec + idx, nc); #else - CXSPARSE_ZNAME (_ipvec) (nc, q.S()->Q, buf, vec + idx); + CXSPARSE_ZNAME (_ipvec) (nc, q.S ()->Q, buf, vec + idx); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } @@ -651,23 +651,23 @@ } else { - SparseComplexMatrix at = a.hermitian(); + SparseComplexMatrix at = a.hermitian (); SparseComplexQR q (at, 2); if (! q.ok ()) - return ComplexMatrix(); + return ComplexMatrix (); x.resize(nc, b_nc); 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); + (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)) OCTAVE_LOCAL_BUFFER (double, B, nr); for (octave_idx_type i = 0; i < nr; i++) - B[i] = q.N()->B [i]; + B[i] = q.N ()->B [i]; #else OCTAVE_LOCAL_BUFFER (Complex, B, nr); for (octave_idx_type i = 0; i < nr; i++) - B[i] = conj (reinterpret_cast<Complex *>(q.N()->B) [i]); + B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B) [i]); #endif for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc; i++, idx+=nc, bidx+=b_nr) @@ -677,29 +677,29 @@ buf[j] = OCTAVE_C99_ZERO; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_pvec) (q.S()->q, bvec + bidx, buf, nr); + CXSPARSE_ZNAME (_pvec) (q.S ()->q, bvec + bidx, buf, nr); #else - CXSPARSE_ZNAME (_pvec) (nr, q.S()->Q, bvec + bidx, buf); + CXSPARSE_ZNAME (_pvec) (nr, q.S ()->Q, bvec + bidx, buf); #endif - CXSPARSE_ZNAME (_utsolve) (q.N()->U, buf); + CXSPARSE_ZNAME (_utsolve) (q.N ()->U, buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = nr-1; j >= 0; j--) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) - CXSPARSE_ZNAME (_happly) (q.N()->L, j, B[j], buf); + CXSPARSE_ZNAME (_happly) (q.N ()->L, j, B[j], buf); #else CXSPARSE_ZNAME (_happly) - (q.N()->L, j, reinterpret_cast<cs_complex_t *>(B)[j], buf); + (q.N ()->L, j, reinterpret_cast<cs_complex_t *>(B)[j], buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_pvec) (q.S()->pinv, buf, vec + idx, nc); + CXSPARSE_ZNAME (_pvec) (q.S ()->pinv, buf, vec + idx, nc); #else - CXSPARSE_ZNAME (_pvec) (nc, q.S()->Pinv, buf, vec + idx); + CXSPARSE_ZNAME (_pvec) (nc, q.S ()->Pinv, buf, vec + idx); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } @@ -717,10 +717,10 @@ { info = -1; #ifdef HAVE_CXSPARSE - octave_idx_type nr = a.rows(); - octave_idx_type nc = a.cols(); - octave_idx_type b_nc = b.cols(); - octave_idx_type b_nr = b.rows(); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); SparseComplexMatrix x; volatile octave_idx_type ii, x_nz; @@ -733,44 +733,44 @@ { SparseComplexQR q (a, 2); if (! q.ok ()) - return SparseComplexMatrix(); - x = SparseComplexMatrix (nc, b_nc, b.nnz()); + return SparseComplexMatrix (); + x = SparseComplexMatrix (nc, b_nc, b.nnz ()); x.xcidx(0) = 0; - x_nz = b.nnz(); + x_nz = b.nnz (); ii = 0; OCTAVE_LOCAL_BUFFER (Complex, Xx, (b_nr > nc ? b_nr : nc)); - OCTAVE_C99_COMPLEX (buf, q.S()->m2); + OCTAVE_C99_COMPLEX (buf, q.S ()->m2); for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc) { octave_quit (); for (octave_idx_type j = 0; j < b_nr; j++) Xx[j] = b.xelem(j,i); - for (octave_idx_type j = nr; j < q.S()->m2; j++) + for (octave_idx_type j = nr; j < q.S ()->m2; j++) buf[j] = OCTAVE_C99_ZERO; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) CXSPARSE_ZNAME (_ipvec) - (q.S()->pinv, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); + (q.S ()->pinv, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); #else CXSPARSE_ZNAME (_ipvec) - (nr, q.S()->Pinv, reinterpret_cast<cs_complex_t *>(Xx), buf); + (nr, q.S ()->Pinv, reinterpret_cast<cs_complex_t *>(Xx), buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = 0; j < nc; j++) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_ZNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_ZNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_ZNAME (_usolve) (q.N()->U, buf); + CXSPARSE_ZNAME (_usolve) (q.N ()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) CXSPARSE_ZNAME (_ipvec) - (q.S()->q, buf, reinterpret_cast<cs_complex_t *>(Xx), nc); + (q.S ()->q, buf, reinterpret_cast<cs_complex_t *>(Xx), nc); #else CXSPARSE_ZNAME (_ipvec) - (nc, q.S()->Q, buf, reinterpret_cast<cs_complex_t *>(Xx)); + (nc, q.S ()->Q, buf, reinterpret_cast<cs_complex_t *>(Xx)); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -797,25 +797,25 @@ } else { - SparseComplexMatrix at = a.hermitian(); + SparseComplexMatrix at = a.hermitian (); SparseComplexQR q (at, 2); if (! q.ok ()) - return SparseComplexMatrix(); - x = SparseComplexMatrix (nc, b_nc, b.nnz()); + return SparseComplexMatrix (); + x = SparseComplexMatrix (nc, b_nc, b.nnz ()); x.xcidx(0) = 0; - x_nz = b.nnz(); + x_nz = b.nnz (); ii = 0; - volatile octave_idx_type nbuf = (nc > q.S()->m2 ? nc : q.S()->m2); + volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2); OCTAVE_LOCAL_BUFFER (Complex, Xx, (b_nr > nc ? b_nr : nc)); OCTAVE_C99_COMPLEX (buf, nbuf); #if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) OCTAVE_LOCAL_BUFFER (double, B, nr); for (octave_idx_type i = 0; i < nr; i++) - B[i] = q.N()->B [i]; + B[i] = q.N ()->B [i]; #else OCTAVE_LOCAL_BUFFER (Complex, B, nr); for (octave_idx_type i = 0; i < nr; i++) - B[i] = conj (reinterpret_cast<Complex *>(q.N()->B) [i]); + B[i] = conj (reinterpret_cast<Complex *>(q.N ()->B) [i]); #endif for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc) { @@ -827,32 +827,32 @@ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) CXSPARSE_ZNAME (_pvec) - (q.S()->q, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); + (q.S ()->q, reinterpret_cast<cs_complex_t *>(Xx), buf, nr); #else CXSPARSE_ZNAME (_pvec) - (nr, q.S()->Q, reinterpret_cast<cs_complex_t *>(Xx), buf); + (nr, q.S ()->Q, reinterpret_cast<cs_complex_t *>(Xx), buf); #endif - CXSPARSE_ZNAME (_utsolve) (q.N()->U, buf); + CXSPARSE_ZNAME (_utsolve) (q.N ()->U, buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = nr-1; j >= 0; j--) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) - CXSPARSE_ZNAME (_happly) (q.N()->L, j, B[j], buf); + CXSPARSE_ZNAME (_happly) (q.N ()->L, j, B[j], buf); #else CXSPARSE_ZNAME (_happly) - (q.N()->L, j, reinterpret_cast<cs_complex_t *>(B)[j], buf); + (q.N ()->L, j, reinterpret_cast<cs_complex_t *>(B)[j], buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) CXSPARSE_ZNAME (_pvec) - (q.S()->pinv, buf, reinterpret_cast<cs_complex_t *>(Xx), nc); + (q.S ()->pinv, buf, reinterpret_cast<cs_complex_t *>(Xx), nc); #else CXSPARSE_ZNAME (_pvec) - (nc, q.S()->Pinv, buf, reinterpret_cast<cs_complex_t *>(Xx)); + (nc, q.S ()->Pinv, buf, reinterpret_cast<cs_complex_t *>(Xx)); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
--- a/liboctave/SparseCmplxQR.h +++ b/liboctave/SparseCmplxQR.h @@ -87,7 +87,7 @@ public: SparseComplexQR (void) : - rep (new SparseComplexQR_rep (SparseComplexMatrix(), 0)) { } + rep (new SparseComplexQR_rep (SparseComplexMatrix (), 0)) { } SparseComplexQR (const SparseComplexMatrix& a, int order = 0) : rep (new SparseComplexQR_rep (a, order)) { } @@ -113,20 +113,20 @@ return *this; } - bool ok (void) const { return rep->ok(); } + bool ok (void) const { return rep->ok (); } - SparseComplexMatrix V (void) const { return rep->V(); } + SparseComplexMatrix V (void) const { return rep->V (); } - ColumnVector Pinv (void) const { return rep->P(); } + ColumnVector Pinv (void) const { return rep->P (); } - ColumnVector P (void) const { return rep->P(); } + ColumnVector P (void) const { return rep->P (); } SparseComplexMatrix R (const bool econ = false) const { return rep->R(econ); } ComplexMatrix C (const ComplexMatrix &b) const { return rep->C(b); } - ComplexMatrix Q (void) const { return rep->Q(); } + ComplexMatrix Q (void) const { return rep->Q (); } friend ComplexMatrix qrsolve (const SparseComplexMatrix &a, const Matrix &b, octave_idx_type &info);
--- a/liboctave/SparseQR.cc +++ b/liboctave/SparseQR.cc @@ -174,13 +174,13 @@ SparseQR::SparseQR_rep::C (const Matrix &b) const { #ifdef HAVE_CXSPARSE - 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 (); octave_idx_type nc = N->L->n; octave_idx_type nr = nrows; - const double *bvec = b.fortran_vec(); + const double *bvec = b.fortran_vec (); Matrix ret (b_nr, b_nc); - double *vec = ret.fortran_vec(); + double *vec = ret.fortran_vec (); if (nr < 0 || nc < 0 || nr != b_nr) (*current_liboctave_error_handler) ("matrix dimension mismatch"); else if (nr == 0 || nc == 0 || b_nc == 0) @@ -226,7 +226,7 @@ octave_idx_type nc = N->L->n; octave_idx_type nr = nrows; Matrix ret (nr, nr); - double *vec = ret.fortran_vec(); + double *vec = ret.fortran_vec (); if (nr < 0 || nc < 0) (*current_liboctave_error_handler) ("matrix dimension mismatch"); else if (nr == 0 || nc == 0) @@ -275,11 +275,11 @@ { info = -1; #ifdef HAVE_CXSPARSE - octave_idx_type nr = a.rows(); - octave_idx_type nc = a.cols(); - octave_idx_type b_nc = b.cols(); - octave_idx_type b_nr = b.rows(); - const double *bvec = b.fortran_vec(); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + const double *bvec = b.fortran_vec (); Matrix x; if (nr < 0 || nc < 0 || nr != b_nr) @@ -291,36 +291,36 @@ { SparseQR q (a, 3); if (! q.ok ()) - return Matrix(); + return Matrix (); x.resize(nc, b_nc); - double *vec = x.fortran_vec(); - OCTAVE_LOCAL_BUFFER (double, buf, q.S()->m2); + double *vec = x.fortran_vec (); + OCTAVE_LOCAL_BUFFER (double, buf, q.S ()->m2); for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc; i++, idx+=nc, bidx+=b_nr) { octave_quit (); - for (octave_idx_type j = nr; j < q.S()->m2; j++) + for (octave_idx_type j = nr; j < q.S ()->m2; j++) buf[j] = 0.; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->pinv, bvec + bidx, buf, nr); + CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, bvec + bidx, buf, nr); #else - CXSPARSE_DNAME (_ipvec) (nr, q.S()->Pinv, bvec + bidx, buf); + CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, bvec + bidx, buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = 0; j < nc; j++) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_usolve) (q.N()->U, buf); + CXSPARSE_DNAME (_usolve) (q.N ()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->q, buf, vec + idx, nc); + CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, vec + idx, nc); #else - CXSPARSE_DNAME (_ipvec) (nc, q.S()->Q, buf, vec + idx); + CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, vec + idx); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } @@ -328,13 +328,13 @@ } else { - SparseMatrix at = a.hermitian(); + SparseMatrix at = a.hermitian (); SparseQR q (at, 3); if (! q.ok ()) - return Matrix(); + return Matrix (); x.resize(nc, b_nc); - double *vec = x.fortran_vec(); - volatile octave_idx_type nbuf = (nc > q.S()->m2 ? nc : q.S()->m2); + double *vec = x.fortran_vec (); + volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2); OCTAVE_LOCAL_BUFFER (double, buf, nbuf); for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc; i++, idx+=nc, bidx+=b_nr) @@ -344,24 +344,24 @@ buf[j] = 0.; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->q, bvec + bidx, buf, nr); + CXSPARSE_DNAME (_pvec) (q.S ()->q, bvec + bidx, buf, nr); #else - CXSPARSE_DNAME (_pvec) (nr, q.S()->Q, bvec + bidx, buf); + CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, bvec + bidx, buf); #endif - CXSPARSE_DNAME (_utsolve) (q.N()->U, buf); + CXSPARSE_DNAME (_utsolve) (q.N ()->U, buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = nr-1; j >= 0; j--) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->pinv, buf, vec + idx, nc); + CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, vec + idx, nc); #else - CXSPARSE_DNAME (_pvec) (nc, q.S()->Pinv, buf, vec + idx); + CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, vec + idx); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } @@ -379,10 +379,10 @@ { info = -1; #ifdef HAVE_CXSPARSE - octave_idx_type nr = a.rows(); - octave_idx_type nc = a.cols(); - octave_idx_type b_nr = b.rows(); - octave_idx_type b_nc = b.cols(); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); SparseMatrix x; volatile octave_idx_type ii, x_nz; @@ -395,40 +395,40 @@ { SparseQR q (a, 3); if (! q.ok ()) - return SparseMatrix(); - x = SparseMatrix (nc, b_nc, b.nnz()); + return SparseMatrix (); + x = SparseMatrix (nc, b_nc, b.nnz ()); x.xcidx(0) = 0; - x_nz = b.nnz(); + x_nz = b.nnz (); ii = 0; OCTAVE_LOCAL_BUFFER (double, Xx, (b_nr > nc ? b_nr : nc)); - OCTAVE_LOCAL_BUFFER (double, buf, q.S()->m2); + OCTAVE_LOCAL_BUFFER (double, buf, q.S ()->m2); for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc) { octave_quit (); for (octave_idx_type j = 0; j < b_nr; j++) Xx[j] = b.xelem(j,i); - for (octave_idx_type j = nr; j < q.S()->m2; j++) + for (octave_idx_type j = nr; j < q.S ()->m2; j++) buf[j] = 0.; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->pinv, Xx, buf, nr); + CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, Xx, buf, nr); #else - CXSPARSE_DNAME (_ipvec) (nr, q.S()->Pinv, Xx, buf); + CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, Xx, buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = 0; j < nc; j++) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_usolve) (q.N()->U, buf); + CXSPARSE_DNAME (_usolve) (q.N ()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->q, buf, Xx, nc); + CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, Xx, nc); #else - CXSPARSE_DNAME (_ipvec) (nc, q.S()->Q, buf, Xx); + CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, Xx); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -455,15 +455,15 @@ } else { - SparseMatrix at = a.hermitian(); + SparseMatrix at = a.hermitian (); SparseQR q (at, 3); if (! q.ok ()) - return SparseMatrix(); - x = SparseMatrix (nc, b_nc, b.nnz()); + return SparseMatrix (); + x = SparseMatrix (nc, b_nc, b.nnz ()); x.xcidx(0) = 0; - x_nz = b.nnz(); + x_nz = b.nnz (); ii = 0; - volatile octave_idx_type nbuf = (nc > q.S()->m2 ? nc : q.S()->m2); + volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2); OCTAVE_LOCAL_BUFFER (double, Xx, (b_nr > nc ? b_nr : nc)); OCTAVE_LOCAL_BUFFER (double, buf, nbuf); for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc) @@ -475,24 +475,24 @@ buf[j] = 0.; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->q, Xx, buf, nr); + CXSPARSE_DNAME (_pvec) (q.S ()->q, Xx, buf, nr); #else - CXSPARSE_DNAME (_pvec) (nr, q.S()->Q, Xx, buf); + CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, Xx, buf); #endif - CXSPARSE_DNAME (_utsolve) (q.N()->U, buf); + CXSPARSE_DNAME (_utsolve) (q.N ()->U, buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = nr-1; j >= 0; j--) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->pinv, buf, Xx, nc); + CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, Xx, nc); #else - CXSPARSE_DNAME (_pvec) (nc, q.S()->Pinv, buf, Xx); + CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, Xx); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -530,10 +530,10 @@ { info = -1; #ifdef HAVE_CXSPARSE - octave_idx_type nr = a.rows(); - octave_idx_type nc = a.cols(); - octave_idx_type b_nc = b.cols(); - octave_idx_type b_nr = b.rows(); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); ComplexMatrix x; if (nr < 0 || nc < 0 || nr != b_nr) @@ -545,12 +545,12 @@ { SparseQR q (a, 3); if (! q.ok ()) - return ComplexMatrix(); + return ComplexMatrix (); x.resize(nc, b_nc); - Complex *vec = x.fortran_vec(); + Complex *vec = x.fortran_vec (); OCTAVE_LOCAL_BUFFER (double, Xx, (b_nr > nc ? b_nr : nc)); OCTAVE_LOCAL_BUFFER (double, Xz, (b_nr > nc ? b_nr : nc)); - OCTAVE_LOCAL_BUFFER (double, buf, q.S()->m2); + OCTAVE_LOCAL_BUFFER (double, buf, q.S ()->m2); for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc) { octave_quit (); @@ -560,50 +560,50 @@ Xx[j] = std::real (c); Xz[j] = std::imag (c); } - for (octave_idx_type j = nr; j < q.S()->m2; j++) + for (octave_idx_type j = nr; j < q.S ()->m2; j++) buf[j] = 0.; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->pinv, Xx, buf, nr); + CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, Xx, buf, nr); #else - CXSPARSE_DNAME (_ipvec) (nr, q.S()->Pinv, Xx, buf); + CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, Xx, buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = 0; j < nc; j++) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_usolve) (q.N()->U, buf); + CXSPARSE_DNAME (_usolve) (q.N ()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->q, buf, Xx, nc); + CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, Xx, nc); #else - CXSPARSE_DNAME (_ipvec) (nc, q.S()->Q, buf, Xx); + CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, Xx); #endif - for (octave_idx_type j = nr; j < q.S()->m2; j++) + for (octave_idx_type j = nr; j < q.S ()->m2; j++) buf[j] = 0.; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->pinv, Xz, buf, nr); + CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, Xz, buf, nr); #else - CXSPARSE_DNAME (_ipvec) (nr, q.S()->Pinv, Xz, buf); + CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, Xz, buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = 0; j < nc; j++) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_usolve) (q.N()->U, buf); + CXSPARSE_DNAME (_usolve) (q.N ()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->q, buf, Xz, nc); + CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, Xz, nc); #else - CXSPARSE_DNAME (_ipvec) (nc, q.S()->Q, buf, Xz); + CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, Xz); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (octave_idx_type j = 0; j < nc; j++) @@ -613,13 +613,13 @@ } else { - SparseMatrix at = a.hermitian(); + SparseMatrix at = a.hermitian (); SparseQR q (at, 3); if (! q.ok ()) - return ComplexMatrix(); + return ComplexMatrix (); x.resize(nc, b_nc); - Complex *vec = x.fortran_vec(); - volatile octave_idx_type nbuf = (nc > q.S()->m2 ? nc : q.S()->m2); + Complex *vec = x.fortran_vec (); + volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2); OCTAVE_LOCAL_BUFFER (double, Xx, (b_nr > nc ? b_nr : nc)); OCTAVE_LOCAL_BUFFER (double, Xz, (b_nr > nc ? b_nr : nc)); OCTAVE_LOCAL_BUFFER (double, buf, nbuf); @@ -636,48 +636,48 @@ buf[j] = 0.; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->q, Xx, buf, nr); + CXSPARSE_DNAME (_pvec) (q.S ()->q, Xx, buf, nr); #else - CXSPARSE_DNAME (_pvec) (nr, q.S()->Q, Xx, buf); + CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, Xx, buf); #endif - CXSPARSE_DNAME (_utsolve) (q.N()->U, buf); + CXSPARSE_DNAME (_utsolve) (q.N ()->U, buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = nr-1; j >= 0; j--) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->pinv, buf, Xx, nc); + CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, Xx, nc); #else - CXSPARSE_DNAME (_pvec) (nc, q.S()->Pinv, buf, Xx); + CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, Xx); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (octave_idx_type j = nr; j < nbuf; j++) buf[j] = 0.; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->q, Xz, buf, nr); + CXSPARSE_DNAME (_pvec) (q.S ()->q, Xz, buf, nr); #else - CXSPARSE_DNAME (_pvec) (nr, q.S()->Q, Xz, buf); + CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, Xz, buf); #endif - CXSPARSE_DNAME (_utsolve) (q.N()->U, buf); + CXSPARSE_DNAME (_utsolve) (q.N ()->U, buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = nr-1; j >= 0; j--) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->pinv, buf, Xz, nc); + CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, Xz, nc); #else - CXSPARSE_DNAME (_pvec) (nc, q.S()->Pinv, buf, Xz); + CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, Xz); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (octave_idx_type j = 0; j < nc; j++) @@ -697,10 +697,10 @@ { info = -1; #ifdef HAVE_CXSPARSE - octave_idx_type nr = a.rows(); - octave_idx_type nc = a.cols(); - octave_idx_type b_nr = b.rows(); - octave_idx_type b_nc = b.cols(); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); SparseComplexMatrix x; volatile octave_idx_type ii, x_nz; @@ -713,14 +713,14 @@ { SparseQR q (a, 3); if (! q.ok ()) - return SparseComplexMatrix(); - x = SparseComplexMatrix (nc, b_nc, b.nnz()); + return SparseComplexMatrix (); + x = SparseComplexMatrix (nc, b_nc, b.nnz ()); x.xcidx(0) = 0; - x_nz = b.nnz(); + x_nz = b.nnz (); ii = 0; OCTAVE_LOCAL_BUFFER (double, Xx, (b_nr > nc ? b_nr : nc)); OCTAVE_LOCAL_BUFFER (double, Xz, (b_nr > nc ? b_nr : nc)); - OCTAVE_LOCAL_BUFFER (double, buf, q.S()->m2); + OCTAVE_LOCAL_BUFFER (double, buf, q.S ()->m2); for (volatile octave_idx_type i = 0, idx = 0; i < b_nc; i++, idx+=nc) { octave_quit (); @@ -730,52 +730,52 @@ Xx[j] = std::real (c); Xz[j] = std::imag (c); } - for (octave_idx_type j = nr; j < q.S()->m2; j++) + for (octave_idx_type j = nr; j < q.S ()->m2; j++) buf[j] = 0.; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->pinv, Xx, buf, nr); + CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, Xx, buf, nr); #else - CXSPARSE_DNAME (_ipvec) (nr, q.S()->Pinv, Xx, buf); + CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, Xx, buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = 0; j < nc; j++) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_usolve) (q.N()->U, buf); + CXSPARSE_DNAME (_usolve) (q.N ()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->q, buf, Xx, nc); + CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, Xx, nc); #else - CXSPARSE_DNAME (_ipvec) (nc, q.S()->Q, buf, Xx); + CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, Xx); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - for (octave_idx_type j = nr; j < q.S()->m2; j++) + for (octave_idx_type j = nr; j < q.S ()->m2; j++) buf[j] = 0.; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->pinv, Xz, buf, nr); + CXSPARSE_DNAME (_ipvec) (q.S ()->pinv, Xz, buf, nr); #else - CXSPARSE_DNAME (_ipvec) (nr, q.S()->Pinv, Xz, buf); + CXSPARSE_DNAME (_ipvec) (nr, q.S ()->Pinv, Xz, buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = 0; j < nc; j++) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_usolve) (q.N()->U, buf); + CXSPARSE_DNAME (_usolve) (q.N ()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_ipvec) (q.S()->q, buf, Xz, nc); + CXSPARSE_DNAME (_ipvec) (q.S ()->q, buf, Xz, nc); #else - CXSPARSE_DNAME (_ipvec) (nc, q.S()->Q, buf, Xz); + CXSPARSE_DNAME (_ipvec) (nc, q.S ()->Q, buf, Xz); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -802,15 +802,15 @@ } else { - SparseMatrix at = a.hermitian(); + SparseMatrix at = a.hermitian (); SparseQR q (at, 3); if (! q.ok ()) - return SparseComplexMatrix(); - x = SparseComplexMatrix (nc, b_nc, b.nnz()); + return SparseComplexMatrix (); + x = SparseComplexMatrix (nc, b_nc, b.nnz ()); x.xcidx(0) = 0; - x_nz = b.nnz(); + x_nz = b.nnz (); ii = 0; - volatile octave_idx_type nbuf = (nc > q.S()->m2 ? nc : q.S()->m2); + volatile octave_idx_type nbuf = (nc > q.S ()->m2 ? nc : q.S ()->m2); OCTAVE_LOCAL_BUFFER (double, Xx, (b_nr > nc ? b_nr : nc)); OCTAVE_LOCAL_BUFFER (double, Xz, (b_nr > nc ? b_nr : nc)); OCTAVE_LOCAL_BUFFER (double, buf, nbuf); @@ -827,48 +827,48 @@ buf[j] = 0.; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->q, Xx, buf, nr); + CXSPARSE_DNAME (_pvec) (q.S ()->q, Xx, buf, nr); #else - CXSPARSE_DNAME (_pvec) (nr, q.S()->Q, Xx, buf); + CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, Xx, buf); #endif - CXSPARSE_DNAME (_utsolve) (q.N()->U, buf); + CXSPARSE_DNAME (_utsolve) (q.N ()->U, buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = nr-1; j >= 0; j--) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->pinv, buf, Xx, nc); + CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, Xx, nc); #else - CXSPARSE_DNAME (_pvec) (nc, q.S()->Pinv, buf, Xx); + CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, Xx); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (octave_idx_type j = nr; j < nbuf; j++) buf[j] = 0.; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->q, Xz, buf, nr); + CXSPARSE_DNAME (_pvec) (q.S ()->q, Xz, buf, nr); #else - CXSPARSE_DNAME (_pvec) (nr, q.S()->Q, Xz, buf); + CXSPARSE_DNAME (_pvec) (nr, q.S ()->Q, Xz, buf); #endif - CXSPARSE_DNAME (_utsolve) (q.N()->U, buf); + CXSPARSE_DNAME (_utsolve) (q.N ()->U, buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; for (volatile octave_idx_type j = nr-1; j >= 0; j--) { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_DNAME (_happly) (q.N()->L, j, q.N()->B[j], buf); + CXSPARSE_DNAME (_happly) (q.N ()->L, j, q.N ()->B[j], buf); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_DNAME (_pvec) (q.S()->pinv, buf, Xz, nc); + CXSPARSE_DNAME (_pvec) (q.S ()->pinv, buf, Xz, nc); #else - CXSPARSE_DNAME (_pvec) (nc, q.S()->Pinv, buf, Xz); + CXSPARSE_DNAME (_pvec) (nc, q.S ()->Pinv, buf, Xz); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
--- a/liboctave/SparseQR.h +++ b/liboctave/SparseQR.h @@ -89,7 +89,7 @@ public: - SparseQR (void) : rep (new SparseQR_rep (SparseMatrix(), 0)) { } + SparseQR (void) : rep (new SparseQR_rep (SparseMatrix (), 0)) { } SparseQR (const SparseMatrix& a, int order = 0) : rep (new SparseQR_rep (a, order)) { } @@ -115,19 +115,19 @@ return *this; } - bool ok (void) const { return rep->ok(); } + bool ok (void) const { return rep->ok (); } - SparseMatrix V (void) const { return rep->V(); } + SparseMatrix V (void) const { return rep->V (); } - ColumnVector Pinv (void) const { return rep->P(); } + ColumnVector Pinv (void) const { return rep->P (); } - ColumnVector P (void) const { return rep->P(); } + ColumnVector P (void) const { return rep->P (); } SparseMatrix R (const bool econ = false) const { return rep->R(econ); } Matrix C (const Matrix &b) const { return rep->C(b); } - Matrix Q (void) const { return rep->Q(); } + Matrix Q (void) const { return rep->Q (); } friend Matrix qrsolve (const SparseMatrix &a, const Matrix &b, octave_idx_type &info);
--- a/liboctave/SparsedbleCHOL.cc +++ b/liboctave/SparsedbleCHOL.cc @@ -52,12 +52,12 @@ if (typ == MatrixType::Upper) { rinv = r.inverse(mattype, info, rcond, true, false); - retval = rinv.transpose() * rinv; + retval = rinv.transpose () * rinv; } else if (typ == MatrixType::Lower) { - rinv = r.transpose().inverse(mattype, info, rcond, true, false); - retval = rinv.transpose() * rinv; + rinv = r.transpose ().inverse(mattype, info, rcond, true, false); + retval = rinv.transpose () * rinv; } else (*current_liboctave_error_handler)
--- a/liboctave/SparsedbleCHOL.h +++ b/liboctave/SparsedbleCHOL.h @@ -55,7 +55,7 @@ return *this; } - SparseMatrix chol_matrix (void) const { return R(); } + SparseMatrix chol_matrix (void) const { return R (); } SparseMatrix L (void) const { return sparse_base_chol<SparseMatrix, double, SparseMatrix>:: L (); }
--- a/liboctave/SparsedbleLU.cc +++ b/liboctave/SparsedbleLU.cc @@ -57,7 +57,7 @@ if (!xisnan (tmp)) Control (UMFPACK_PRL) = tmp; - if (piv_thres.nelem() == 2) + if (piv_thres.nelem () == 2) { tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0)); if (!xisnan (tmp)) @@ -253,7 +253,7 @@ if (!xisnan (tmp)) Control (UMFPACK_PRL) = tmp; - if (piv_thres.nelem() == 2) + if (piv_thres.nelem () == 2) { tmp = (piv_thres (0) > 1. ? 1. : piv_thres (0)); if (!xisnan (tmp))
--- a/liboctave/SparsedbleLU.h +++ b/liboctave/SparsedbleLU.h @@ -36,11 +36,11 @@ SparseLU (void) : sparse_base_lu <SparseMatrix, double, SparseMatrix, double> () { } - SparseLU (const SparseMatrix& a, const Matrix& piv_thres = Matrix(), + SparseLU (const SparseMatrix& a, const Matrix& piv_thres = Matrix (), bool scale = false); SparseLU (const SparseMatrix& a, const ColumnVector& Qinit, - const Matrix& piv_thres = Matrix(), bool scale = false, + const Matrix& piv_thres = Matrix (), bool scale = false, bool FixedQ = false, double droptol = -1., bool milu = false, bool udiag = false);
--- a/liboctave/base-lu.cc +++ b/liboctave/base-lu.cc @@ -111,7 +111,7 @@ 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; } @@ -128,7 +128,7 @@ for (octave_idx_type i = 0; i < a_nr; i++) pvt.xelem (i) = i; - for (octave_idx_type i = 0; i < ipvt.length(); i++) + for (octave_idx_type i = 0; i < ipvt.length (); i++) { octave_idx_type k = ipvt.xelem (i);
--- a/liboctave/cmd-hist.cc +++ b/liboctave/cmd-hist.cc @@ -165,7 +165,7 @@ if (history_control & HC_IGNDUPS) { - if (retval.length() > 0) + if (retval.length () > 0) retval.append (":"); retval.append ("ignoredups"); @@ -173,7 +173,7 @@ if (history_control & HC_ERASEDUPS) { - if (retval.length() > 0) + if (retval.length () > 0) retval.append (":"); retval.append ("erasedups");
--- a/liboctave/dColVector.cc +++ b/liboctave/dColVector.cc @@ -143,7 +143,7 @@ RowVector ColumnVector::transpose (void) const { - return MArray<double>::transpose(); + return MArray<double>::transpose (); } ColumnVector @@ -308,7 +308,7 @@ std::istream& operator >> (std::istream& is, ColumnVector& a) { - octave_idx_type len = a.length(); + octave_idx_type len = a.length (); if (len > 0) {
--- a/liboctave/dDiagMatrix.h +++ b/liboctave/dDiagMatrix.h @@ -74,7 +74,7 @@ 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);
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -763,7 +763,7 @@ // 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)); @@ -802,7 +802,7 @@ } if (info != 0) - mattype.mark_as_rectangular(); + mattype.mark_as_rectangular (); } return retval; @@ -1461,8 +1461,8 @@ { octave_idx_type info = 0; char job = 'L'; - 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 (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -1499,8 +1499,8 @@ octave_idx_type *pipvt = ipvt.fortran_vec (); 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 (); Array<double> z (dim_vector (4 * nc, 1)); double *pz = z.fortran_vec (); @@ -1762,7 +1762,7 @@ char job = 'L'; Matrix atmp = *this; double *tmp_data = atmp.fortran_vec (); - 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 (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -1818,7 +1818,7 @@ F77_XFCN (dpotrs, DPOTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, - result, b.rows(), info + result, b.rows (), info F77_CHAR_ARG_LEN (1))); } else @@ -1839,7 +1839,7 @@ Matrix atmp = *this; double *tmp_data = atmp.fortran_vec (); 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 (); Array<double> z (dim_vector (4 * nc, 1)); double *pz = z.fortran_vec (); @@ -1902,7 +1902,7 @@ char job = 'N'; F77_XFCN (dgetrs, DGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, - pipvt, result, b.rows(), info + pipvt, result, b.rows (), info F77_CHAR_ARG_LEN (1))); } else
--- a/liboctave/dNDArray.cc +++ b/liboctave/dNDArray.cc @@ -160,7 +160,7 @@ ComplexNDArray NDArray::fourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); if (dv.length () < 2) return ComplexNDArray (); @@ -168,7 +168,7 @@ const double *in = fortran_vec (); ComplexNDArray retval (dv); Complex *out = retval.fortran_vec (); - octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type howmany = numel () / dv(0) / dv(1); octave_idx_type dist = dv(0) * dv(1); for (octave_idx_type i=0; i < howmany; i++) @@ -180,14 +180,14 @@ ComplexNDArray NDArray::ifourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); if (dv.length () < 2) return ComplexNDArray (); dim_vector dv2(dv(0), dv(1)); ComplexNDArray retval (*this); Complex *out = retval.fortran_vec (); - octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type howmany = numel () / dv(0) / dv(1); octave_idx_type dist = dv(0) * dv(1); for (octave_idx_type i=0; i < howmany; i++) @@ -286,7 +286,7 @@ F77_FUNC (zfftf, ZFFTF) (npts, tmp, pwsave); for (octave_idx_type i = 0; i < npts; i++) - retval ((i + k*npts)*stride + j*dist) = tmp[i]; + retval((i + k*npts)*stride + j*dist) = tmp[i]; } } @@ -333,7 +333,7 @@ F77_FUNC (zfftb, ZFFTB) (npts, tmp, pwsave); for (octave_idx_type i = 0; i < npts; i++) - retval ((i + k*npts)*stride + j*dist) = tmp[i] / + retval((i + k*npts)*stride + j*dist) = tmp[i] / static_cast<double> (npts); } } @@ -344,7 +344,7 @@ ComplexNDArray NDArray::fourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); dim_vector dv2 (dv(0), dv(1)); int rank = 2; ComplexNDArray retval (*this); @@ -374,12 +374,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); F77_FUNC (zfftf, ZFFTF) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval ((l + k*npts)*stride + j*dist) = prow[l]; + retval((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -392,7 +392,7 @@ ComplexNDArray NDArray::ifourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); dim_vector dv2 (dv(0), dv(1)); int rank = 2; ComplexNDArray retval (*this); @@ -422,12 +422,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); 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] / + retval((l + k*npts)*stride + j*dist) = prow[l] / static_cast<double> (npts); } } @@ -470,12 +470,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); F77_FUNC (zfftf, ZFFTF) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval ((l + k*npts)*stride + j*dist) = prow[l]; + retval((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -517,12 +517,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); 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] / + retval((l + k*npts)*stride + j*dist) = prow[l] / static_cast<double> (npts); } }
--- a/liboctave/dRowVector.cc +++ b/liboctave/dRowVector.cc @@ -146,7 +146,7 @@ ColumnVector RowVector::transpose (void) const { - return MArray<double>::transpose(); + return MArray<double>::transpose (); } RowVector @@ -271,7 +271,7 @@ std::istream& operator >> (std::istream& is, RowVector& a) { - octave_idx_type len = a.length(); + octave_idx_type len = a.length (); if (len > 0) {
--- a/liboctave/dSparse.cc +++ b/liboctave/dSparse.cc @@ -719,7 +719,7 @@ { SparseMatrix r; - if ((x.rows() == y.rows()) && (x.cols() == y.cols())) + if ((x.rows () == y.rows ()) && (x.cols () == y.cols ())) { octave_idx_type x_nr = x.rows (); octave_idx_type x_nc = x.cols (); @@ -837,12 +837,12 @@ typ == MatrixType::Permuted_Diagonal) { if (typ == MatrixType::Permuted_Diagonal) - retval = transpose(); + retval = transpose (); else retval = *this; // Force make_unique to be called - double *v = retval.data(); + double *v = retval.data (); if (calccond) { @@ -1022,7 +1022,7 @@ OCTAVE_LOCAL_BUFFER (double, work, nr); OCTAVE_LOCAL_BUFFER (octave_idx_type, rperm, nr); - octave_idx_type *perm = mattyp.triangular_perm(); + octave_idx_type *perm = mattyp.triangular_perm (); if (typ == MatrixType::Permuted_Upper) { for (octave_idx_type i = 0; i < nr; i++) @@ -1142,7 +1142,7 @@ return retval; inverse_singular: - return SparseMatrix(); + return SparseMatrix (); } SparseMatrix @@ -1158,26 +1158,26 @@ if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) ret = dinverse (mattype, info, rcond, true, calc_cond); else if (typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper) - ret = tinverse (mattype, info, rcond, true, calc_cond).transpose(); + ret = tinverse (mattype, info, rcond, true, calc_cond).transpose (); else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) { - MatrixType newtype = mattype.transpose(); - ret = transpose().tinverse (newtype, info, rcond, true, calc_cond); + MatrixType newtype = mattype.transpose (); + ret = transpose ().tinverse (newtype, info, rcond, true, calc_cond); } else { - if (mattype.is_hermitian()) + if (mattype.is_hermitian ()) { MatrixType tmp_typ (MatrixType::Upper); SparseCHOL fact (*this, info, false); - rcond = fact.rcond(); + rcond = fact.rcond (); if (info == 0) { double rcond2; - SparseMatrix Q = fact.Q(); - SparseMatrix InvL = fact.L().transpose().tinverse(tmp_typ, + SparseMatrix Q = fact.Q (); + SparseMatrix InvL = fact.L ().transpose ().tinverse(tmp_typ, info, rcond2, true, false); - ret = Q * InvL.transpose() * InvL * Q.transpose(); + ret = Q * InvL.transpose () * InvL * Q.transpose (); } else { @@ -1187,22 +1187,22 @@ } } - if (!mattype.is_hermitian()) + if (!mattype.is_hermitian ()) { - octave_idx_type n = rows(); + octave_idx_type n = rows (); ColumnVector Qinit(n); for (octave_idx_type i = 0; i < n; i++) Qinit(i) = i; MatrixType tmp_typ (MatrixType::Upper); - SparseLU fact (*this, Qinit, Matrix(), false, false); - rcond = fact.rcond(); + SparseLU fact (*this, Qinit, Matrix (), false, false); + rcond = fact.rcond (); double rcond2; - SparseMatrix InvL = fact.L().transpose().tinverse(tmp_typ, + SparseMatrix InvL = fact.L ().transpose ().tinverse(tmp_typ, info, rcond2, true, false); - SparseMatrix InvU = fact.U().tinverse(tmp_typ, info, rcond2, - true, false).transpose(); - ret = fact.Pc().transpose() * InvU * InvL * fact.Pr(); + SparseMatrix InvU = fact.U ().tinverse(tmp_typ, info, rcond2, + true, false).transpose (); + ret = fact.Pc ().transpose () * InvU * InvL * fact.Pr (); } } @@ -1366,13 +1366,13 @@ if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) { - retval.resize (nc, b.cols(), 0.); + retval.resize (nc, b.cols (), 0.); if (typ == MatrixType::Diagonal) - for (octave_idx_type j = 0; j < b.cols(); j++) + 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); else - for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols (); j++) for (octave_idx_type k = 0; k < nc; k++) for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) retval(k,j) = b(ridx(i),j) / data (i); @@ -1516,13 +1516,13 @@ if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) { - retval.resize (nc, b.cols(), 0); + retval.resize (nc, b.cols (), 0); if (typ == MatrixType::Diagonal) - for (octave_idx_type j = 0; j < b.cols(); j++) + 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); else - for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols (); j++) for (octave_idx_type k = 0; k < nc; k++) for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) retval(k,j) = b(ridx(i),j) / data (i); @@ -1583,7 +1583,7 @@ retval.xcidx(0) = 0; octave_idx_type ii = 0; if (typ == MatrixType::Diagonal) - for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols (); j++) { for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { @@ -1595,7 +1595,7 @@ retval.xcidx(j+1) = ii; } else - for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols (); j++) { for (octave_idx_type l = 0; l < nc; l++) for (octave_idx_type i = cidx(l); i < cidx(l+1); i++) @@ -2783,7 +2783,7 @@ } for (octave_idx_type i = 0; i < nc; i++) - retval (i, j) = work[i]; + retval(i, j) = work[i]; } if (calc_cond) @@ -3349,7 +3349,7 @@ } for (octave_idx_type i = 0; i < nc; i++) - retval (i, j) = cwork[i]; + retval(i, j) = cwork[i]; } if (calc_cond) @@ -3889,12 +3889,12 @@ } } - octave_idx_type b_nc = b.cols(); + octave_idx_type b_nc = b.cols (); retval = b; double *result = retval.fortran_vec (); F77_XFCN (dptsv, DPTSV, (nr, b_nc, D, DL, result, - b.rows(), err)); + b.rows (), err)); if (err != 0) { @@ -3946,12 +3946,12 @@ } } - octave_idx_type b_nc = b.cols(); + octave_idx_type b_nc = b.cols (); retval = b; double *result = retval.fortran_vec (); F77_XFCN (dgtsv, DGTSV, (nr, b_nc, DL, D, DU, result, - b.rows(), err)); + b.rows (), err)); if (err != 0) { @@ -4188,7 +4188,7 @@ } octave_idx_type b_nr = b.rows (); - octave_idx_type b_nc = b.cols(); + octave_idx_type b_nc = b.cols (); rcond = 1.; retval = b; @@ -4245,8 +4245,8 @@ } } - 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 (); rcond = 1.; retval = b; @@ -4506,7 +4506,7 @@ // Calculate the norm of the matrix, for later use. double anorm; if (calc_cond) - anorm = m_band.abs().sum().row(0).max(); + anorm = m_band.abs ().sum ().row(0).max (); char job = 'L'; F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -4570,7 +4570,7 @@ F77_XFCN (dpbtrs, DPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, b_nc, tmp_data, - ldm, result, b.rows(), err + ldm, result, b.rows (), err F77_CHAR_ARG_LEN (1))); if (err != 0) @@ -4693,7 +4693,7 @@ F77_XFCN (dgbtrs, DGBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, n_upper, b_nc, tmp_data, - ldm, pipvt, result, b.rows(), err + ldm, pipvt, result, b.rows (), err F77_CHAR_ARG_LEN (1))); } } @@ -4756,7 +4756,7 @@ // Calculate the norm of the matrix, for later use. double anorm; if (calc_cond) - anorm = m_band.abs().sum().row(0).max(); + anorm = m_band.abs ().sum ().row(0).max (); char job = 'L'; F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -5074,7 +5074,7 @@ // Calculate the norm of the matrix, for later use. double anorm; if (calc_cond) - anorm = m_band.abs().sum().row(0).max(); + anorm = m_band.abs ().sum ().row(0).max (); char job = 'L'; F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -5164,7 +5164,7 @@ F77_XFCN (dpbtrs, DPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, 1, tmp_data, - ldm, Bz, b.rows(), err + ldm, Bz, b.rows (), err F77_CHAR_ARG_LEN (1))); if (err != 0) @@ -5176,7 +5176,7 @@ } for (octave_idx_type i = 0; i < b_nr; i++) - retval (i, j) = Complex (Bx[i], Bz[i]); + retval(i, j) = Complex (Bx[i], Bz[i]); } } } @@ -5310,7 +5310,7 @@ F77_CHAR_ARG_LEN (1))); for (octave_idx_type i = 0; i < nr; i++) - retval (i, j) = Complex (Bx[i], Bz[i]); + retval(i, j) = Complex (Bx[i], Bz[i]); } } } @@ -5373,7 +5373,7 @@ // Calculate the norm of the matrix, for later use. double anorm; if (calc_cond) - anorm = m_band.abs().sum().row(0).max(); + anorm = m_band.abs ().sum ().row(0).max (); char job = 'L'; F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -5853,9 +5853,9 @@ A->nrow = nr; A->ncol = nc; - A->p = cidx(); - A->i = ridx(); - A->nzmax = nnz(); + A->p = cidx (); + A->i = ridx (); + A->nzmax = nnz (); A->packed = true; A->sorted = true; A->nz = 0; @@ -5871,21 +5871,21 @@ if (nr < 1) A->x = &dummy; else - A->x = data(); + A->x = data (); cholmod_dense Bstore; cholmod_dense *B = &Bstore; - B->nrow = b.rows(); - B->ncol = b.cols(); + B->nrow = b.rows (); + B->ncol = b.cols (); B->d = B->nrow; B->nzmax = B->nrow * B->ncol; B->dtype = CHOLMOD_DOUBLE; B->xtype = CHOLMOD_REAL; - if (nc < 1 || b.cols() < 1) + if (nc < 1 || b.cols () < 1) B->x = &dummy; else // We won't alter it, honest :-) - B->x = const_cast<double *>(b.fortran_vec()); + B->x = const_cast<double *>(b.fortran_vec ()); cholmod_factor *L; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -5930,11 +5930,11 @@ X = CHOLMOD_NAME(solve) (CHOLMOD_A, L, B, cm); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - retval.resize (b.rows (), b.cols()); - for (octave_idx_type j = 0; j < b.cols(); j++) - { - octave_idx_type jr = j * b.rows(); - for (octave_idx_type i = 0; i < b.rows(); i++) + retval.resize (b.rows (), b.cols ()); + for (octave_idx_type j = 0; j < b.cols (); j++) + { + octave_idx_type jr = j * b.rows (); + for (octave_idx_type i = 0; i < b.rows (); i++) retval.xelem(i,j) = static_cast<double *>(X->x)[jr + i]; } @@ -5965,7 +5965,7 @@ if (err == 0) { const double *Bx = b.fortran_vec (); - retval.resize (b.rows (), b.cols()); + retval.resize (b.rows (), b.cols ()); double *result = retval.fortran_vec (); octave_idx_type b_nr = b.rows (); octave_idx_type b_nc = b.cols (); @@ -6069,9 +6069,9 @@ A->nrow = nr; A->ncol = nc; - A->p = cidx(); - A->i = ridx(); - A->nzmax = nnz(); + A->p = cidx (); + A->i = ridx (); + A->nzmax = nnz (); A->packed = true; A->sorted = true; A->nz = 0; @@ -6087,15 +6087,15 @@ if (nr < 1) A->x = &dummy; else - A->x = data(); + A->x = data (); cholmod_sparse Bstore; cholmod_sparse *B = &Bstore; - B->nrow = b.rows(); - B->ncol = b.cols(); - B->p = b.cidx(); - B->i = b.ridx(); - B->nzmax = b.nnz(); + B->nrow = b.rows (); + B->ncol = b.cols (); + B->p = b.cidx (); + B->i = b.ridx (); + B->nzmax = b.nnz (); B->packed = true; B->sorted = true; B->nz = 0; @@ -6108,10 +6108,10 @@ B->stype = 0; B->xtype = CHOLMOD_REAL; - if (b.rows() < 1 || b.cols() < 1) + if (b.rows () < 1 || b.cols () < 1) B->x = &dummy; else - B->x = b.data(); + B->x = b.data (); cholmod_factor *L; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -6331,9 +6331,9 @@ A->nrow = nr; A->ncol = nc; - A->p = cidx(); - A->i = ridx(); - A->nzmax = nnz(); + A->p = cidx (); + A->i = ridx (); + A->nzmax = nnz (); A->packed = true; A->sorted = true; A->nz = 0; @@ -6349,21 +6349,21 @@ if (nr < 1) A->x = &dummy; else - A->x = data(); + A->x = data (); cholmod_dense Bstore; cholmod_dense *B = &Bstore; - B->nrow = b.rows(); - B->ncol = b.cols(); + B->nrow = b.rows (); + B->ncol = b.cols (); B->d = B->nrow; B->nzmax = B->nrow * B->ncol; B->dtype = CHOLMOD_DOUBLE; B->xtype = CHOLMOD_COMPLEX; - if (nc < 1 || b.cols() < 1) + if (nc < 1 || b.cols () < 1) B->x = &dummy; else // We won't alter it, honest :-) - B->x = const_cast<Complex *>(b.fortran_vec()); + B->x = const_cast<Complex *>(b.fortran_vec ()); cholmod_factor *L; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -6407,11 +6407,11 @@ X = CHOLMOD_NAME(solve) (CHOLMOD_A, L, B, cm); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - retval.resize (b.rows (), b.cols()); - for (octave_idx_type j = 0; j < b.cols(); j++) - { - octave_idx_type jr = j * b.rows(); - for (octave_idx_type i = 0; i < b.rows(); i++) + retval.resize (b.rows (), b.cols ()); + for (octave_idx_type j = 0; j < b.cols (); j++) + { + octave_idx_type jr = j * b.rows (); + for (octave_idx_type i = 0; i < b.rows (); i++) retval.xelem(i,j) = static_cast<Complex *>(X->x)[jr + i]; } @@ -6487,7 +6487,7 @@ } for (octave_idx_type i = 0; i < b_nr; i++) - retval (i, j) = Complex (Xx[i], Xz[i]); + retval(i, j) = Complex (Xx[i], Xz[i]); } UMFPACK_DNAME (report_info) (control, info); @@ -6565,9 +6565,9 @@ A->nrow = nr; A->ncol = nc; - A->p = cidx(); - A->i = ridx(); - A->nzmax = nnz(); + A->p = cidx (); + A->i = ridx (); + A->nzmax = nnz (); A->packed = true; A->sorted = true; A->nz = 0; @@ -6583,15 +6583,15 @@ if (nr < 1) A->x = &dummy; else - A->x = data(); + A->x = data (); cholmod_sparse Bstore; cholmod_sparse *B = &Bstore; - B->nrow = b.rows(); - B->ncol = b.cols(); - B->p = b.cidx(); - B->i = b.ridx(); - B->nzmax = b.nnz(); + B->nrow = b.rows (); + B->ncol = b.cols (); + B->p = b.cidx (); + B->i = b.ridx (); + B->nzmax = b.nnz (); B->packed = true; B->sorted = true; B->nz = 0; @@ -6604,10 +6604,10 @@ B->stype = 0; B->xtype = CHOLMOD_COMPLEX; - if (b.rows() < 1 || b.cols() < 1) + if (b.rows () < 1 || b.cols () < 1) B->x = &dummy; else - B->x = b.data(); + B->x = b.data (); cholmod_factor *L; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -7495,8 +7495,8 @@ SparseMatrix SparseMatrix::prod (int dim) const { - if ((rows() == 1 && dim == -1) || dim == 1) - return transpose (). prod (0). transpose(); + if ((rows () == 1 && dim == -1) || dim == 1) + return transpose (). prod (0). transpose (); else { SPARSE_REDUCTION_OP (SparseMatrix, double, *=, @@ -7765,7 +7765,7 @@ { SparseMatrix r; - if ((a.rows() == b.rows()) && (a.cols() == b.cols())) + if ((a.rows () == b.rows ()) && (a.cols () == b.cols ())) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols (); @@ -7915,7 +7915,7 @@ { SparseMatrix r; - if ((a.rows() == b.rows()) && (a.cols() == b.cols())) + if ((a.rows () == b.rows ()) && (a.cols () == b.cols ())) { octave_idx_type a_nr = a.rows (); octave_idx_type a_nc = a.cols ();
--- a/liboctave/dbleCHOL.cc +++ b/liboctave/dbleCHOL.cc @@ -157,7 +157,7 @@ octave_idx_type info = 0; Matrix tmp = r; - double *v = tmp.fortran_vec(); + double *v = tmp.fortran_vec (); if (info == 0) {
--- a/liboctave/dbleGEPBAL.cc +++ b/liboctave/dbleGEPBAL.cc @@ -70,7 +70,7 @@ return -1; } - if (a.dims() != b.dims ()) + if (a.dims () != b.dims ()) { gripe_nonconformant ("GEPBALANCE", n, n, b.rows(), b.cols()); return -1;
--- a/liboctave/dim-vector.cc +++ b/liboctave/dim-vector.cc @@ -45,7 +45,7 @@ make_unique (); int j = 0; - int l = ndims(); + int l = ndims (); for (int i = 0; i < l; i++) {
--- a/liboctave/eigs-base.cc +++ b/liboctave/eigs-base.cc @@ -226,14 +226,14 @@ static M ltsolve (const SM& L, const ColumnVector& Q, const M& m) { - octave_idx_type n = L.cols(); - octave_idx_type b_nc = m.cols(); + octave_idx_type n = L.cols (); + octave_idx_type b_nc = m.cols (); octave_idx_type err = 0; double rcond; MatrixType ltyp (MatrixType::Lower); M tmp = L.solve (ltyp, m, err, rcond, 0); M retval; - const double* qv = Q.fortran_vec(); + const double* qv = Q.fortran_vec (); if (!err) { @@ -253,14 +253,14 @@ static M utsolve (const SM& U, const ColumnVector& Q, const M& m) { - octave_idx_type n = U.cols(); - octave_idx_type b_nc = m.cols(); + octave_idx_type n = U.cols (); + octave_idx_type b_nc = m.cols (); octave_idx_type err = 0; double rcond; MatrixType utyp (MatrixType::Upper); M retval (n, b_nc); - const double* qv = Q.fortran_vec(); + const double* qv = Q.fortran_vec (); for (octave_idx_type j = 0; j < b_nc; j++) { for (octave_idx_type i = 0; i < n; i++) @@ -347,14 +347,14 @@ { octave_idx_type info; CHOL fact (b, info); - octave_idx_type n = b.cols(); + octave_idx_type n = b.cols (); if (info != 0) return false; else { bt = fact.chol_matrix (); - b = bt.transpose(); + b = bt.transpose (); permB = ColumnVector(n); for (octave_idx_type i = 0; i < n; i++) permB(i) = i; @@ -368,13 +368,13 @@ octave_idx_type info; SparseCHOL fact (b, info, false); - if (fact.P() != 0) + if (fact.P () != 0) return false; else { - b = fact.L(); - bt = b.transpose(); - permB = fact.perm() - 1.0; + b = fact.L (); + bt = b.transpose (); + permB = fact.perm () - 1.0; return true; } } @@ -384,14 +384,14 @@ { octave_idx_type info; ComplexCHOL fact (b, info); - octave_idx_type n = b.cols(); + octave_idx_type n = b.cols (); if (info != 0) return false; else { bt = fact.chol_matrix (); - b = bt.hermitian(); + b = bt.hermitian (); permB = ColumnVector(n); for (octave_idx_type i = 0; i < n; i++) permB(i) = i; @@ -406,13 +406,13 @@ octave_idx_type info; SparseComplexCHOL fact (b, info, false); - if (fact.P() != 0) + if (fact.P () != 0) return false; else { - b = fact.L(); - bt = b.hermitian(); - permB = fact.perm() - 1.0; + b = fact.L (); + bt = b.hermitian (); + permB = fact.perm () - 1.0; return true; } } @@ -424,7 +424,7 @@ octave_idx_type *Q) { bool have_b = ! b.is_empty (); - octave_idx_type n = m.rows(); + octave_idx_type n = m.rows (); // Caclulate LU decomposition of 'A - sigma * B' SparseMatrix AminusSigmaB (m); @@ -433,7 +433,7 @@ { if (cholB) { - if (permB.length()) + if (permB.length ()) { SparseMatrix tmp(n,n,n); for (octave_idx_type i = 0; i < n; i++) @@ -446,11 +446,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; @@ -522,7 +522,7 @@ octave_idx_type *Q) { bool have_b = ! b.is_empty (); - octave_idx_type n = m.cols(); + octave_idx_type n = m.cols (); // Caclulate LU decomposition of 'A - sigma * B' Matrix AminusSigmaB (m); @@ -531,16 +531,16 @@ { if (cholB) { - Matrix tmp = sigma * b.transpose() * b; - const double *pB = permB.fortran_vec(); - double *p = AminusSigmaB.fortran_vec(); - - if (permB.length()) + Matrix tmp = sigma * b.transpose () * b; + const double *pB = permB.fortran_vec (); + double *p = AminusSigmaB.fortran_vec (); + + if (permB.length ()) { for (octave_idx_type j = 0; - j < b.cols(); j++) + j < b.cols (); j++) for (octave_idx_type i = 0; - i < b.rows(); i++) + i < b.rows (); i++) *p++ -= tmp.xelem (static_cast<octave_idx_type>(pB[i]), static_cast<octave_idx_type>(pB[j])); } @@ -552,7 +552,7 @@ } else { - double *p = AminusSigmaB.fortran_vec(); + double *p = AminusSigmaB.fortran_vec (); for (octave_idx_type i = 0; i < n; i++) p[i*(n+1)] -= sigma; @@ -560,7 +560,7 @@ LU fact (AminusSigmaB); - L = fact.P().transpose() * fact.L (); + L = fact.P ().transpose () * fact.L (); U = fact.U (); for (octave_idx_type j = 0; j < n; j++) P[j] = Q[j] = j; @@ -599,7 +599,7 @@ octave_idx_type *P, octave_idx_type *Q) { bool have_b = ! b.is_empty (); - octave_idx_type n = m.rows(); + octave_idx_type n = m.rows (); // Caclulate LU decomposition of 'A - sigma * B' SparseComplexMatrix AminusSigmaB (m); @@ -608,7 +608,7 @@ { if (cholB) { - if (permB.length()) + if (permB.length ()) { SparseMatrix tmp(n,n,n); for (octave_idx_type i = 0; i < n; i++) @@ -620,11 +620,11 @@ } tmp.xcidx(n) = n; - AminusSigmaB = AminusSigmaB - tmp * b.hermitian() * b * - tmp.transpose() * sigma; + AminusSigmaB = AminusSigmaB - tmp * b.hermitian () * b * + tmp.transpose () * sigma; } else - AminusSigmaB = AminusSigmaB - sigma * b.hermitian() * b; + AminusSigmaB = AminusSigmaB - sigma * b.hermitian () * b; } else AminusSigmaB = AminusSigmaB - sigma * b; @@ -696,7 +696,7 @@ octave_idx_type *Q) { bool have_b = ! b.is_empty (); - octave_idx_type n = m.cols(); + octave_idx_type n = m.cols (); // Caclulate LU decomposition of 'A - sigma * B' ComplexMatrix AminusSigmaB (m); @@ -705,16 +705,16 @@ { if (cholB) { - ComplexMatrix tmp = sigma * b.hermitian() * b; - const double *pB = permB.fortran_vec(); - Complex *p = AminusSigmaB.fortran_vec(); - - if (permB.length()) + ComplexMatrix tmp = sigma * b.hermitian () * b; + const double *pB = permB.fortran_vec (); + Complex *p = AminusSigmaB.fortran_vec (); + + if (permB.length ()) { for (octave_idx_type j = 0; - j < b.cols(); j++) + j < b.cols (); j++) for (octave_idx_type i = 0; - i < b.rows(); i++) + i < b.rows (); i++) *p++ -= tmp.xelem (static_cast<octave_idx_type>(pB[i]), static_cast<octave_idx_type>(pB[j])); } @@ -726,7 +726,7 @@ } else { - Complex *p = AminusSigmaB.fortran_vec(); + Complex *p = AminusSigmaB.fortran_vec (); for (octave_idx_type i = 0; i < n; i++) p[i*(n+1)] -= sigma; @@ -734,7 +734,7 @@ ComplexLU fact (AminusSigmaB); - L = fact.P().transpose() * fact.L (); + L = fact.P ().transpose () * fact.L (); U = fact.U (); for (octave_idx_type j = 0; j < n; j++) P[j] = Q[j] = j; @@ -779,27 +779,27 @@ M b(_b); octave_idx_type n = m.cols (); octave_idx_type mode = 1; - bool have_b = ! b.is_empty(); + bool have_b = ! b.is_empty (); bool note3 = false; char bmat = 'I'; double sigma = 0.; M bt; - if (m.rows() != m.cols()) + if (m.rows () != m.cols ()) { (*current_liboctave_error_handler) ("eigs: A must be square"); return -1; } - if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) + if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) { (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); return -1; } - if (resid.is_empty()) + if (resid.is_empty ()) { - std::string rand_dist = octave_rand::distribution(); + std::string rand_dist = octave_rand::distribution (); octave_rand::distribution("uniform"); resid = ColumnVector (octave_rand::vector(n)); octave_rand::distribution(rand_dist); @@ -838,10 +838,10 @@ return -1; } - if (have_b && cholB && permB.length() != 0) + if (have_b && cholB && permB.length () != 0) { // Check the we really have a permutation vector - if (permB.length() != n) + if (permB.length () != n) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); @@ -888,8 +888,8 @@ if (cholB) { bt = b; - b = b.transpose(); - if (permB.length() == 0) + b = b.transpose (); + if (permB.length () == 0) { permB = ColumnVector(n); for (octave_idx_type i = 0; i < n; i++) @@ -939,7 +939,7 @@ { F77_FUNC (dsaupd, DSAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, - F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), + F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); @@ -1100,15 +1100,15 @@ M b(_b); octave_idx_type n = m.cols (); octave_idx_type mode = 3; - bool have_b = ! b.is_empty(); + bool have_b = ! b.is_empty (); std::string typ = "LM"; - if (m.rows() != m.cols()) + if (m.rows () != m.cols ()) { (*current_liboctave_error_handler) ("eigs: A must be square"); return -1; } - if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) + if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) { (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); @@ -1121,9 +1121,9 @@ // _b, permB, resid, os, tol, rvec, cholB, // disp, maxit); - if (resid.is_empty()) + if (resid.is_empty ()) { - std::string rand_dist = octave_rand::distribution(); + std::string rand_dist = octave_rand::distribution (); octave_rand::distribution("uniform"); resid = ColumnVector (octave_rand::vector(n)); octave_rand::distribution(rand_dist); @@ -1162,10 +1162,10 @@ return -1; } - if (have_b && cholB && permB.length() != 0) + if (have_b && cholB && permB.length () != 0) { // Check the we really have a permutation vector - if (permB.length() != n) + if (permB.length () != n) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; @@ -1215,8 +1215,8 @@ int iter = 0; M L, U; - OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows() : m.rows())); - OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols() : m.cols())); + OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows () : m.rows ())); + OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols () : m.cols ())); if (! LuAminusSigmaB(m, b, cholB, permB, sigma, L, U, P, Q)) return -1; @@ -1232,7 +1232,7 @@ { F77_FUNC (dsaupd, DSAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, - F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), + F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); @@ -1430,9 +1430,9 @@ octave_idx_type mode = 1; int err = 0; - if (resid.is_empty()) + if (resid.is_empty ()) { - std::string rand_dist = octave_rand::distribution(); + std::string rand_dist = octave_rand::distribution (); octave_rand::distribution("uniform"); resid = ColumnVector (octave_rand::vector(n)); octave_rand::distribution(rand_dist); @@ -1533,7 +1533,7 @@ { F77_FUNC (dsaupd, DSAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, - F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), + F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); @@ -1692,28 +1692,28 @@ M b(_b); octave_idx_type n = m.cols (); octave_idx_type mode = 1; - bool have_b = ! b.is_empty(); + bool have_b = ! b.is_empty (); bool note3 = false; char bmat = 'I'; double sigmar = 0.; double sigmai = 0.; M bt; - if (m.rows() != m.cols()) + if (m.rows () != m.cols ()) { (*current_liboctave_error_handler) ("eigs: A must be square"); return -1; } - if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) + if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) { (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); return -1; } - if (resid.is_empty()) + if (resid.is_empty ()) { - std::string rand_dist = octave_rand::distribution(); + std::string rand_dist = octave_rand::distribution (); octave_rand::distribution("uniform"); resid = ColumnVector (octave_rand::vector(n)); octave_rand::distribution(rand_dist); @@ -1752,10 +1752,10 @@ return -1; } - if (have_b && cholB && permB.length() != 0) + if (have_b && cholB && permB.length () != 0) { // Check the we really have a permutation vector - if (permB.length() != n) + if (permB.length () != n) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); @@ -1802,8 +1802,8 @@ if (cholB) { bt = b; - b = b.transpose(); - if (permB.length() == 0) + b = b.transpose (); + if (permB.length () == 0) { permB = ColumnVector(n); for (octave_idx_type i = 0; i < n; i++) @@ -1853,7 +1853,7 @@ { F77_FUNC (dnaupd, DNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, - F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), + F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); @@ -2062,16 +2062,16 @@ M b(_b); octave_idx_type n = m.cols (); octave_idx_type mode = 3; - bool have_b = ! b.is_empty(); + bool have_b = ! b.is_empty (); std::string typ = "LM"; double sigmai = 0.; - if (m.rows() != m.cols()) + if (m.rows () != m.cols ()) { (*current_liboctave_error_handler) ("eigs: A must be square"); return -1; } - if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) + if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) { (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); @@ -2084,9 +2084,9 @@ // _b, permB, resid, os, tol, rvec, cholB, // disp, maxit); - if (resid.is_empty()) + if (resid.is_empty ()) { - std::string rand_dist = octave_rand::distribution(); + std::string rand_dist = octave_rand::distribution (); octave_rand::distribution("uniform"); resid = ColumnVector (octave_rand::vector(n)); octave_rand::distribution(rand_dist); @@ -2125,10 +2125,10 @@ return -1; } - if (have_b && cholB && permB.length() != 0) + if (have_b && cholB && permB.length () != 0) { // Check that we really have a permutation vector - if (permB.length() != n) + if (permB.length () != n) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; @@ -2178,8 +2178,8 @@ int iter = 0; M L, U; - OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows() : m.rows())); - OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols() : m.cols())); + OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows () : m.rows ())); + OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols () : m.cols ())); if (! LuAminusSigmaB(m, b, cholB, permB, sigmar, L, U, P, Q)) return -1; @@ -2195,7 +2195,7 @@ { F77_FUNC (dnaupd, DNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, - F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), + F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); @@ -2447,9 +2447,9 @@ octave_idx_type mode = 1; int err = 0; - if (resid.is_empty()) + if (resid.is_empty ()) { - std::string rand_dist = octave_rand::distribution(); + std::string rand_dist = octave_rand::distribution (); octave_rand::distribution("uniform"); resid = ColumnVector (octave_rand::vector(n)); octave_rand::distribution(rand_dist); @@ -2551,7 +2551,7 @@ { F77_FUNC (dnaupd, DNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, - F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), + F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); @@ -2757,27 +2757,27 @@ M b(_b); octave_idx_type n = m.cols (); octave_idx_type mode = 1; - bool have_b = ! b.is_empty(); + bool have_b = ! b.is_empty (); bool note3 = false; char bmat = 'I'; Complex sigma = 0.; M bt; - if (m.rows() != m.cols()) + if (m.rows () != m.cols ()) { (*current_liboctave_error_handler) ("eigs: A must be square"); return -1; } - if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) + if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) { (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); return -1; } - if (cresid.is_empty()) + if (cresid.is_empty ()) { - std::string rand_dist = octave_rand::distribution(); + std::string rand_dist = octave_rand::distribution (); octave_rand::distribution("uniform"); Array<double> rr (octave_rand::vector(n)); Array<double> ri (octave_rand::vector(n)); @@ -2820,10 +2820,10 @@ return -1; } - if (have_b && cholB && permB.length() != 0) + if (have_b && cholB && permB.length () != 0) { // Check the we really have a permutation vector - if (permB.length() != n) + if (permB.length () != n) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); @@ -2870,8 +2870,8 @@ if (cholB) { bt = b; - b = b.hermitian(); - if (permB.length() == 0) + b = b.hermitian (); + if (permB.length () == 0) { permB = ColumnVector(n); for (octave_idx_type i = 0; i < n; i++) @@ -2922,7 +2922,7 @@ { F77_FUNC (znaupd, ZNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, - F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), + F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, rwork, info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); @@ -3079,15 +3079,15 @@ M b(_b); octave_idx_type n = m.cols (); octave_idx_type mode = 3; - bool have_b = ! b.is_empty(); + bool have_b = ! b.is_empty (); std::string typ = "LM"; - if (m.rows() != m.cols()) + if (m.rows () != m.cols ()) { (*current_liboctave_error_handler) ("eigs: A must be square"); return -1; } - if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) + if (have_b && (m.rows () != b.rows () || m.rows () != b.cols ())) { (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); @@ -3100,9 +3100,9 @@ // eig_val, _b, permB, cresid, os, tol, // rvec, cholB, disp, maxit); - if (cresid.is_empty()) + if (cresid.is_empty ()) { - std::string rand_dist = octave_rand::distribution(); + std::string rand_dist = octave_rand::distribution (); octave_rand::distribution("uniform"); Array<double> rr (octave_rand::vector(n)); Array<double> ri (octave_rand::vector(n)); @@ -3145,10 +3145,10 @@ return -1; } - if (have_b && cholB && permB.length() != 0) + if (have_b && cholB && permB.length () != 0) { // Check that we really have a permutation vector - if (permB.length() != n) + if (permB.length () != n) { (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; @@ -3198,8 +3198,8 @@ int iter = 0; M L, U; - OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows() : m.rows())); - OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols() : m.cols())); + OCTAVE_LOCAL_BUFFER (octave_idx_type, P, (have_b ? b.rows () : m.rows ())); + OCTAVE_LOCAL_BUFFER (octave_idx_type, Q, (have_b ? b.cols () : m.cols ())); if (! LuAminusSigmaB(m, b, cholB, permB, sigma, L, U, P, Q)) return -1; @@ -3216,7 +3216,7 @@ { F77_FUNC (znaupd, ZNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, - F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), + F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, rwork, info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); @@ -3417,9 +3417,9 @@ octave_idx_type mode = 1; int err = 0; - if (cresid.is_empty()) + if (cresid.is_empty ()) { - std::string rand_dist = octave_rand::distribution(); + std::string rand_dist = octave_rand::distribution (); octave_rand::distribution("uniform"); Array<double> rr (octave_rand::vector(n)); Array<double> ri (octave_rand::vector(n)); @@ -3525,7 +3525,7 @@ { F77_FUNC (znaupd, ZNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, - F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), + F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, rwork, info F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2));
--- a/liboctave/f2c-main.c +++ b/liboctave/f2c-main.c @@ -31,5 +31,5 @@ # ifdef __cplusplus extern "C" # endif -int F77_DUMMY_MAIN() { assert(0); return 1; } +int F77_DUMMY_MAIN () { assert(0); return 1; } #endif
--- a/liboctave/fCColVector.cc +++ b/liboctave/fCColVector.cc @@ -514,7 +514,7 @@ std::istream& operator >> (std::istream& is, FloatComplexColumnVector& a) { - octave_idx_type len = a.length(); + octave_idx_type len = a.length (); if (len > 0) {
--- a/liboctave/fCDiagMatrix.h +++ b/liboctave/fCDiagMatrix.h @@ -90,7 +90,7 @@ 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 transpose (void) const { return MDiagArray2<FloatComplex>::transpose (); } FloatDiagMatrix abs (void) const; friend OCTAVE_API FloatComplexDiagMatrix conj (const FloatComplexDiagMatrix& a);
--- a/liboctave/fCMatrix.cc +++ b/liboctave/fCMatrix.cc @@ -1091,7 +1091,7 @@ // 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)); @@ -1129,7 +1129,7 @@ } if (info != 0) - mattype.mark_as_rectangular(); + mattype.mark_as_rectangular (); } return retval; @@ -1155,7 +1155,7 @@ if (info == 0) { if (calc_cond) - rcon = chol.rcond(); + rcon = chol.rcond (); else rcon = 1.0; ret = chol.inverse (); @@ -1789,8 +1789,8 @@ { octave_idx_type info = 0; char job = 'L'; - 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 (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -1829,8 +1829,8 @@ octave_idx_type *pipvt = ipvt.fortran_vec (); 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 (); Array<FloatComplex> z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); @@ -2096,7 +2096,7 @@ char job = 'L'; FloatComplexMatrix atmp = *this; FloatComplex *tmp_data = atmp.fortran_vec (); - 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 (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -2152,7 +2152,7 @@ F77_XFCN (cpotrs, CPOTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, - result, b.rows(), info + result, b.rows (), info F77_CHAR_ARG_LEN (1))); } else @@ -2180,7 +2180,7 @@ // 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)); @@ -2238,7 +2238,7 @@ char job = 'N'; F77_XFCN (cgetrs, CGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, - pipvt, result, b.rows(), info + pipvt, result, b.rows (), info F77_CHAR_ARG_LEN (1))); } else
--- a/liboctave/fCNDArray.cc +++ b/liboctave/fCNDArray.cc @@ -119,7 +119,7 @@ FloatComplexNDArray FloatComplexNDArray::fourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); if (dv.length () < 2) return FloatComplexNDArray (); @@ -127,7 +127,7 @@ const FloatComplex *in = fortran_vec (); FloatComplexNDArray retval (dv); FloatComplex *out = retval.fortran_vec (); - octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type howmany = numel () / dv(0) / dv(1); octave_idx_type dist = dv(0) * dv(1); for (octave_idx_type i=0; i < howmany; i++) @@ -139,7 +139,7 @@ FloatComplexNDArray FloatComplexNDArray::ifourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); if (dv.length () < 2) return FloatComplexNDArray (); @@ -147,7 +147,7 @@ const FloatComplex *in = fortran_vec (); FloatComplexNDArray retval (dv); FloatComplex *out = retval.fortran_vec (); - octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type howmany = numel () / dv(0) / dv(1); octave_idx_type dist = dv(0) * dv(1); for (octave_idx_type i=0; i < howmany; i++) @@ -242,7 +242,7 @@ F77_FUNC (cfftf, CFFTF) (npts, tmp, pwsave); for (octave_idx_type i = 0; i < npts; i++) - retval ((i + k*npts)*stride + j*dist) = tmp[i]; + retval((i + k*npts)*stride + j*dist) = tmp[i]; } } @@ -289,7 +289,7 @@ F77_FUNC (cfftb, CFFTB) (npts, tmp, pwsave); for (octave_idx_type i = 0; i < npts; i++) - retval ((i + k*npts)*stride + j*dist) = tmp[i] / + retval((i + k*npts)*stride + j*dist) = tmp[i] / static_cast<float> (npts); } } @@ -330,12 +330,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); F77_FUNC (cfftf, CFFTF) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval ((l + k*npts)*stride + j*dist) = prow[l]; + retval((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -348,7 +348,7 @@ FloatComplexNDArray FloatComplexNDArray::ifourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); dim_vector dv2 (dv(0), dv(1)); int rank = 2; FloatComplexNDArray retval (*this); @@ -378,12 +378,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); 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] / + retval((l + k*npts)*stride + j*dist) = prow[l] / static_cast<float> (npts); } } @@ -426,12 +426,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); F77_FUNC (cfftf, CFFTF) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval ((l + k*npts)*stride + j*dist) = prow[l]; + retval((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -473,12 +473,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); 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] / + retval((l + k*npts)*stride + j*dist) = prow[l] / static_cast<float> (npts); } }
--- a/liboctave/fCRowVector.cc +++ b/liboctave/fCRowVector.cc @@ -411,7 +411,7 @@ std::istream& operator >> (std::istream& is, FloatComplexRowVector& a) { - octave_idx_type len = a.length(); + octave_idx_type len = a.length (); if (len > 0) {
--- a/liboctave/fCmplxGEPBAL.cc +++ b/liboctave/fCmplxGEPBAL.cc @@ -69,7 +69,7 @@ return -1; } - if (a.dims() != b.dims ()) + if (a.dims () != b.dims ()) { gripe_nonconformant ("FloatComplexGEPBALANCE", n, n, b.rows(), b.cols()); return -1;
--- a/liboctave/fColVector.cc +++ b/liboctave/fColVector.cc @@ -142,7 +142,7 @@ FloatRowVector FloatColumnVector::transpose (void) const { - return MArray<float>::transpose(); + return MArray<float>::transpose (); } FloatColumnVector @@ -307,7 +307,7 @@ std::istream& operator >> (std::istream& is, FloatColumnVector& a) { - octave_idx_type len = a.length(); + octave_idx_type len = a.length (); if (len > 0) {
--- a/liboctave/fDiagMatrix.h +++ b/liboctave/fDiagMatrix.h @@ -74,7 +74,7 @@ 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);
--- a/liboctave/fEIG.cc +++ b/liboctave/fEIG.cc @@ -686,7 +686,7 @@ octave_idx_type n = a.rows (); octave_idx_type nb = b.rows (); - if (n != a.cols () || nb != b.cols()) + if (n != a.cols () || nb != b.cols ()) { (*current_liboctave_error_handler) ("EIG requires square matrix"); return -1;
--- a/liboctave/fMatrix.cc +++ b/liboctave/fMatrix.cc @@ -763,7 +763,7 @@ // 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)); @@ -802,7 +802,7 @@ } if (info != 0) - mattype.mark_as_rectangular(); + mattype.mark_as_rectangular (); } return retval; @@ -1461,8 +1461,8 @@ { octave_idx_type info = 0; char job = 'L'; - 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 (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -1499,8 +1499,8 @@ octave_idx_type *pipvt = ipvt.fortran_vec (); 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 (); Array<float> z (dim_vector (4 * nc, 1)); float *pz = z.fortran_vec (); @@ -1762,7 +1762,7 @@ char job = 'L'; FloatMatrix atmp = *this; float *tmp_data = atmp.fortran_vec (); - 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 (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info @@ -1818,7 +1818,7 @@ F77_XFCN (spotrs, SPOTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, - result, b.rows(), info + result, b.rows (), info F77_CHAR_ARG_LEN (1))); } else @@ -1839,7 +1839,7 @@ FloatMatrix atmp = *this; float *tmp_data = atmp.fortran_vec (); 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 (); Array<float> z (dim_vector (4 * nc, 1)); float *pz = z.fortran_vec (); @@ -1902,7 +1902,7 @@ char job = 'N'; F77_XFCN (sgetrs, SGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, - pipvt, result, b.rows(), info + pipvt, result, b.rows (), info F77_CHAR_ARG_LEN (1))); } else
--- a/liboctave/fNDArray.cc +++ b/liboctave/fNDArray.cc @@ -118,7 +118,7 @@ FloatComplexNDArray FloatNDArray::fourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); if (dv.length () < 2) return FloatComplexNDArray (); @@ -126,7 +126,7 @@ const float *in = fortran_vec (); FloatComplexNDArray retval (dv); FloatComplex *out = retval.fortran_vec (); - octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type howmany = numel () / dv(0) / dv(1); octave_idx_type dist = dv(0) * dv(1); for (octave_idx_type i=0; i < howmany; i++) @@ -138,14 +138,14 @@ FloatComplexNDArray FloatNDArray::ifourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); if (dv.length () < 2) return FloatComplexNDArray (); dim_vector dv2(dv(0), dv(1)); FloatComplexNDArray retval (*this); FloatComplex *out = retval.fortran_vec (); - octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type howmany = numel () / dv(0) / dv(1); octave_idx_type dist = dv(0) * dv(1); for (octave_idx_type i=0; i < howmany; i++) @@ -246,7 +246,7 @@ F77_FUNC (cfftf, CFFTF) (npts, tmp, pwsave); for (octave_idx_type i = 0; i < npts; i++) - retval ((i + k*npts)*stride + j*dist) = tmp[i]; + retval((i + k*npts)*stride + j*dist) = tmp[i]; } } @@ -293,7 +293,7 @@ F77_FUNC (cfftb, CFFTB) (npts, tmp, pwsave); for (octave_idx_type i = 0; i < npts; i++) - retval ((i + k*npts)*stride + j*dist) = tmp[i] / + retval((i + k*npts)*stride + j*dist) = tmp[i] / static_cast<float> (npts); } } @@ -304,7 +304,7 @@ FloatComplexNDArray FloatNDArray::fourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); dim_vector dv2 (dv(0), dv(1)); int rank = 2; FloatComplexNDArray retval (*this); @@ -334,12 +334,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); F77_FUNC (cfftf, CFFTF) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval ((l + k*npts)*stride + j*dist) = prow[l]; + retval((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -352,7 +352,7 @@ FloatComplexNDArray FloatNDArray::ifourier2d (void) const { - dim_vector dv = dims(); + dim_vector dv = dims (); dim_vector dv2 (dv(0), dv(1)); int rank = 2; FloatComplexNDArray retval (*this); @@ -382,12 +382,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); 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] / + retval((l + k*npts)*stride + j*dist) = prow[l] / static_cast<float> (npts); } } @@ -430,12 +430,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); F77_FUNC (cfftf, CFFTF) (npts, prow, pwsave); for (octave_idx_type l = 0; l < npts; l++) - retval ((l + k*npts)*stride + j*dist) = prow[l]; + retval((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -477,12 +477,12 @@ octave_quit (); for (octave_idx_type l = 0; l < npts; l++) - prow[l] = retval ((l + k*npts)*stride + j*dist); + prow[l] = retval((l + k*npts)*stride + j*dist); 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] / + retval((l + k*npts)*stride + j*dist) = prow[l] / static_cast<float> (npts); } }
--- a/liboctave/fRowVector.cc +++ b/liboctave/fRowVector.cc @@ -146,7 +146,7 @@ FloatColumnVector FloatRowVector::transpose (void) const { - return MArray<float>::transpose(); + return MArray<float>::transpose (); } FloatRowVector @@ -271,7 +271,7 @@ std::istream& operator >> (std::istream& is, FloatRowVector& a) { - octave_idx_type len = a.length(); + octave_idx_type len = a.length (); if (len > 0) {
--- a/liboctave/file-ops.cc +++ b/liboctave/file-ops.cc @@ -356,7 +356,7 @@ { return dir.empty () ? file - : (is_dir_sep (dir[dir.length()-1]) + : (is_dir_sep (dir[dir.length ()-1]) ? dir + file : dir + dir_sep_char () + file); }
--- a/liboctave/file-stat.cc +++ b/liboctave/file-stat.cc @@ -189,7 +189,7 @@ // Remove trailing slash. if (file_ops::is_dir_sep (full_file_name[full_file_name.length () - 1]) && full_file_name.length () != 1 - && ! (full_file_name.length() == 3 && full_file_name[1] == ':')) + && ! (full_file_name.length () == 3 && full_file_name[1] == ':')) full_file_name.resize (full_file_name.length () - 1); #endif
--- a/liboctave/floatCHOL.cc +++ b/liboctave/floatCHOL.cc @@ -157,7 +157,7 @@ octave_idx_type info = 0; FloatMatrix tmp = r; - float *v = tmp.fortran_vec(); + float *v = tmp.fortran_vec (); if (info == 0) {
--- a/liboctave/floatGEPBAL.cc +++ b/liboctave/floatGEPBAL.cc @@ -70,7 +70,7 @@ return -1; } - if (a.dims() != b.dims ()) + if (a.dims () != b.dims ()) { gripe_nonconformant ("FloatGEPBALANCE", n, n, b.rows(), b.cols()); return -1;
--- a/liboctave/idx-vector.h +++ b/liboctave/idx-vector.h @@ -604,7 +604,7 @@ { 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
--- a/liboctave/lo-specfun.cc +++ b/liboctave/lo-specfun.cc @@ -460,7 +460,7 @@ if (std:: abs (x) < 1) { - double im = x.imag(); + double im = x.imag (); double u = expm1 (x.real ()); double v = sin (im/2); v = -2*v*v; @@ -515,7 +515,7 @@ if (std:: abs (x) < 1) { - float im = x.imag(); + float im = x.imag (); float u = expm1 (x.real ()); float v = sin (im/2); v = -2*v*v; @@ -556,7 +556,7 @@ { Complex retval; - double r = x.real (), i = x.imag(); + double r = x.real (), i = x.imag (); if (fabs (r) < 0.5 && fabs (i) < 0.5) { @@ -873,7 +873,7 @@ if (kode == 2) { // Compensate for different scaling factor of besk. - tmp2 *= exp(-z - std::abs(z.real())); + tmp2 *= exp(-z - std::abs(z.real ())); } tmp += tmp2; @@ -1483,7 +1483,7 @@ if (kode == 2) { // Compensate for different scaling factor of besk. - tmp2 *= exp(-z - std::abs(z.real())); + tmp2 *= exp(-z - std::abs(z.real ())); } tmp += tmp2; @@ -1986,7 +1986,7 @@ ierr.resize (dv); for (octave_idx_type i = 0; i < nel; i++) - retval (i) = airy (z(i), deriv, scaled, ierr(i)); + retval(i) = airy (z(i), deriv, scaled, ierr(i)); return retval; } @@ -2001,7 +2001,7 @@ ierr.resize (dv); for (octave_idx_type i = 0; i < nel; i++) - retval (i) = biry (z(i), deriv, scaled, ierr(i)); + retval(i) = biry (z(i), deriv, scaled, ierr(i)); return retval; } @@ -2116,7 +2116,7 @@ ierr.resize (dv); for (octave_idx_type i = 0; i < nel; i++) - retval (i) = airy (z(i), deriv, scaled, ierr(i)); + retval(i) = airy (z(i), deriv, scaled, ierr(i)); return retval; } @@ -2131,7 +2131,7 @@ ierr.resize (dv); for (octave_idx_type i = 0; i < nel; i++) - retval (i) = biry (z(i), deriv, scaled, ierr(i)); + retval(i) = biry (z(i), deriv, scaled, ierr(i)); return retval; } @@ -3287,7 +3287,7 @@ bool indx; double pp, prev, qq, r, s, sae = -37.0, sq, t, tx, value, w, xin, ycur, yprev; - double beta = lgamma (p) + lgamma (q) - lgamma (p + q); + double beta = xlgamma (p) + xlgamma (q) - xlgamma (p + q); bool err = false; fpu = pow (10.0, sae); value = y;
--- a/liboctave/lo-sysdep.cc +++ b/liboctave/lo-sysdep.cc @@ -73,7 +73,7 @@ std::string path = file_ops::tilde_expand (path_arg); #if defined (__WIN32__) && ! defined (__CYGWIN__) - if (path.length() == 2 && path[1] == ':') + if (path.length () == 2 && path[1] == ':') path += "\\"; #endif @@ -90,7 +90,7 @@ PROCESS_INFORMATION pi; STARTUPINFO si; std::string command = "\"" + cmd + "\""; - HANDLE hProcess = GetCurrentProcess(), childRead, childWrite, parentRead, parentWrite; + HANDLE hProcess = GetCurrentProcess (), childRead, childWrite, parentRead, parentWrite; DWORD pipeMode; ZeroMemory (&pi, sizeof (pi)); @@ -121,7 +121,7 @@ si.hStdOutput = childWrite; // Ignore first arg as it is the command - for (int k=1; k<args.length(); k++) + for (int k=1; k<args.length (); k++) command += " \"" + args[k] + "\""; OCTAVE_LOCAL_BUFFER (char, c_command, command.length () + 1); strcpy (c_command, command.c_str ());
--- a/liboctave/mx-inlines.cc +++ b/liboctave/mx-inlines.cc @@ -62,7 +62,7 @@ #define DEFMXUNBOOLOP(F, OP) \ template <class X> \ inline void F (size_t n, bool *r, const X *x) throw () \ -{ const X zero = X(); for (size_t i = 0; i < n; i++) r[i] = x[i] OP zero; } +{ const X zero = X (); for (size_t i = 0; i < n; i++) r[i] = x[i] OP zero; } DEFMXUNBOOLOP (mx_inline_iszero, ==) DEFMXUNBOOLOP (mx_inline_notzero, !=)
--- a/liboctave/oct-binmap.h +++ b/liboctave/oct-binmap.h @@ -265,7 +265,7 @@ R yzero = R (); U fz = fcn (xzero, yzero); - if (fz == U()) + if (fz == U ()) { // Sparsity-preserving function. Do it efficiently. octave_idx_type nr = xs.rows (), nc = xs.cols ();
--- a/liboctave/oct-convn.cc +++ b/liboctave/oct-convn.cc @@ -125,7 +125,7 @@ static_cast<octave_idx_type> (0)); } - MArray<T> c (cdims, T()); + MArray<T> c (cdims, T ()); convolve_nd<T, R> (a.fortran_vec (), adims, adims.cumulative (), b.fortran_vec (), bdims, bdims.cumulative (),
--- a/liboctave/oct-md5.cc +++ b/liboctave/oct-md5.cc @@ -79,7 +79,7 @@ } else (*current_liboctave_error_handler) ("unable to open file `%s' for reading", - file.c_str()); + file.c_str ()); return retval; }
--- a/liboctave/oct-mem.h +++ b/liboctave/oct-mem.h @@ -92,7 +92,7 @@ template <class T> inline bool helper_is_zero_mem (const octave_int<T>& value) -{ return value.value () == T(); } +{ return value.value () == T (); } #define DEFINE_POD_FILL(T) \ inline void fill_or_memset (size_t n, const T& value, T *dest) \
--- a/liboctave/oct-rand.cc +++ b/liboctave/oct-rand.cc @@ -513,7 +513,7 @@ { retval.clear (n, 1); - fill (retval.capacity(), retval.fortran_vec(), a); + fill (retval.capacity (), retval.fortran_vec (), a); } else if (n < 0) (*current_liboctave_error_handler) ("rand: invalid negative argument"); @@ -530,7 +530,7 @@ { retval.clear (n, 1); - fill (retval.capacity(), retval.fortran_vec(), a); + fill (retval.capacity (), retval.fortran_vec (), a); } else if (n < 0) (*current_liboctave_error_handler) ("rand: invalid negative argument"); @@ -547,7 +547,7 @@ { retval.clear (dims); - fill (retval.capacity(), retval.fortran_vec(), a); + fill (retval.capacity (), retval.fortran_vec (), a); } return retval; @@ -562,7 +562,7 @@ { retval.clear (dims); - fill (retval.capacity(), retval.fortran_vec(), a); + fill (retval.capacity (), retval.fortran_vec (), a); } return retval; @@ -580,11 +580,11 @@ int stored_distribution = current_distribution; F77_FUNC (setcgn, SETCGN) (uniform_dist); - int hour = tm.hour() + 1; - int minute = tm.min() + 1; - int second = tm.sec() + 1; + int hour = tm.hour () + 1; + int minute = tm.min () + 1; + int second = tm.sec () + 1; - int32_t s0 = tm.mday() * hour * minute * second; + int32_t s0 = tm.mday () * hour * minute * second; int32_t s1 = hour * minute * second; s0 = force_to_fit_range (s0, 1, 2147483563);
--- a/liboctave/oct-syscalls.cc +++ b/liboctave/oct-syscalls.cc @@ -356,7 +356,7 @@ else child_msg = "popen2 (child): file handle duplication failed -- " + child_msg; - (*current_liboctave_error_handler)(child_msg.c_str()); + (*current_liboctave_error_handler)(child_msg.c_str ()); exit(0); }
--- a/liboctave/randgamma.c +++ b/liboctave/randgamma.c @@ -58,7 +58,7 @@ chisq(df) for df>0 r = 2*randg(df/2) t(df) for 0<df<inf (use randn if df is infinite) - r = randn() / sqrt(2*randg(df/2)/df) + r = randn () / sqrt(2*randg(df/2)/df) F(n1,n2) for 0<n1, 0<n2 r1 = 2*randg(n1/2)/n1 or 1 if n1 is infinite r2 = 2*randg(n2/2)/n2 or 1 if n2 is infinite
--- a/liboctave/randmtzig.c +++ b/liboctave/randmtzig.c @@ -277,7 +277,7 @@ if (n < MT_N) entropy[n++] = time(NULL); /* Current time in seconds */ if (n < MT_N) - entropy[n++] = clock(); /* CPU time used (usec) */ + entropy[n++] = clock (); /* CPU time used (usec) */ #ifdef HAVE_GETTIMEOFDAY if (n < MT_N) { @@ -320,7 +320,7 @@ /* if (initf==0) init_by_int(5489UL); */ /* Or better yet, a random seed! */ if (initf == 0) - oct_init_by_entropy(); + oct_init_by_entropy (); left = MT_N; next = state; @@ -341,7 +341,7 @@ register uint32_t y; if (--left == 0) - next_state(); + next_state (); y = *next++; /* Tempering */ @@ -359,8 +359,8 @@ static uint64_t randi53 (void) { - const uint32_t lo = randi32(); - const uint32_t hi = randi32()&0x1FFFFF; + const uint32_t lo = randi32 (); + const uint32_t hi = randi32 ()&0x1FFFFF; #if HAVE_X86_32 uint64_t u; uint32_t *p = (uint32_t *)&u; @@ -375,8 +375,8 @@ static uint64_t randi54 (void) { - const uint32_t lo = randi32(); - const uint32_t hi = randi32()&0x3FFFFF; + const uint32_t lo = randi32 (); + const uint32_t hi = randi32 ()&0x3FFFFF; #if HAVE_X86_32 uint64_t u; uint32_t *p = (uint32_t *)&u; @@ -392,7 +392,7 @@ static float randu32 (void) { - return ((float)randi32() + 0.5) * (1.0/4294967296.0); + return ((float)randi32 () + 0.5) * (1.0/4294967296.0); /* divided by 2^32 */ } @@ -400,8 +400,8 @@ static double randu53 (void) { - const uint32_t a=randi32()>>5; - const uint32_t b=randi32()>>6; + const uint32_t a=randi32 ()>>5; + const uint32_t b=randi32 ()>>6; return (a*67108864.0+b+0.4) * (1.0/9007199254740992.0); } @@ -564,7 +564,7 @@ oct_randn (void) { if (initt) - create_ziggurat_tables(); + create_ziggurat_tables (); while (1) { @@ -583,9 +583,9 @@ register uint32_t lo, hi; int64_t rabs; uint32_t *p = (uint32_t *)&rabs; - lo = randi32(); + lo = randi32 (); idx = lo&0xFF; - hi = randi32(); + hi = randi32 (); si = hi&UMASK; p[0] = lo; p[1] = hi&0x1FFFFF; @@ -629,7 +629,7 @@ oct_rande (void) { if (initt) - create_ziggurat_tables(); + create_ziggurat_tables (); while (1) { @@ -755,12 +755,12 @@ oct_float_randn (void) { if (inittf) - create_ziggurat_float_tables(); + create_ziggurat_float_tables (); while (1) { /* 32-bit mantissa */ - const uint32_t r = randi32(); + const uint32_t r = randi32 (); const uint32_t rabs = r&LMASK; const int idx = (int)(r&0xFF); const float x = ((int32_t)r) * fwi[idx]; @@ -796,7 +796,7 @@ oct_float_rande (void) { if (inittf) - create_ziggurat_float_tables(); + create_ziggurat_float_tables (); while (1) { @@ -825,7 +825,7 @@ { octave_idx_type i; for (i = 0; i < n; i++) - p[i] = oct_randu(); + p[i] = oct_randu (); } void @@ -833,7 +833,7 @@ { octave_idx_type i; for (i = 0; i < n; i++) - p[i] = oct_randn(); + p[i] = oct_randn (); } void @@ -841,7 +841,7 @@ { octave_idx_type i; for (i = 0; i < n; i++) - p[i] = oct_rande(); + p[i] = oct_rande (); } void @@ -849,7 +849,7 @@ { octave_idx_type i; for (i = 0; i < n; i++) - p[i] = oct_float_randu(); + p[i] = oct_float_randu (); } void @@ -857,7 +857,7 @@ { octave_idx_type i; for (i = 0; i < n; i++) - p[i] = oct_float_randn(); + p[i] = oct_float_randn (); } void @@ -865,5 +865,5 @@ { octave_idx_type i; for (i = 0; i < n; i++) - p[i] = oct_float_rande(); + p[i] = oct_float_rande (); }
--- a/liboctave/sparse-base-chol.cc +++ b/liboctave/sparse-base-chol.cc @@ -129,9 +129,9 @@ ac->nrow = a_nr; ac->ncol = a_nc; - ac->p = a.cidx(); - ac->i = a.ridx(); - ac->nzmax = a.nnz(); + ac->p = a.cidx (); + ac->i = a.ridx (); + ac->nzmax = a.nnz (); ac->packed = true; ac->sorted = true; ac->nz = 0; @@ -151,7 +151,7 @@ if (a_nr < 1) ac->x = &dummy; else - ac->x = a.data(); + ac->x = a.data (); // use natural ordering if no q output parameter if (natural) @@ -224,7 +224,7 @@ sparse_base_chol<chol_type, chol_elt, p_type>::L (void) const { #ifdef HAVE_CHOLMOD - cholmod_sparse *m = rep->L(); + cholmod_sparse *m = rep->L (); octave_idx_type nc = m->ncol; octave_idx_type nnz = m->nzmax; chol_type ret (m->nrow, nc, nnz); @@ -237,7 +237,7 @@ } return ret; #else - return chol_type(); + return chol_type (); #endif } @@ -260,7 +260,7 @@ return p; #else - return p_type(); + return p_type (); #endif } @@ -270,19 +270,19 @@ { chol_type retval; #ifdef HAVE_CHOLMOD - cholmod_sparse *m = rep->L(); + cholmod_sparse *m = rep->L (); octave_idx_type n = m->ncol; - ColumnVector perms = rep->perm(); + ColumnVector perms = rep->perm (); chol_type ret; double rcond2; octave_idx_type info; MatrixType mattype (MatrixType::Upper); - chol_type linv = L().hermitian().inverse(mattype, info, rcond2, 1, 0); + chol_type linv = L ().hermitian ().inverse(mattype, info, rcond2, 1, 0); - if (perms.length() == n) + if (perms.length () == n) { - p_type Qc = Q(); - retval = Qc * linv * linv.hermitian() * Qc.transpose(); + p_type Qc = Q (); + retval = Qc * linv * linv.hermitian () * Qc.transpose (); } else retval = linv * linv.hermitian ();
--- a/liboctave/sparse-base-chol.h +++ b/liboctave/sparse-base-chol.h @@ -198,18 +198,18 @@ chol_type L (void) const; - chol_type R (void) const { return L().hermitian (); } + chol_type R (void) const { return L ().hermitian (); } - octave_idx_type P (void) const { return rep->P(); } + octave_idx_type P (void) const { return rep->P (); } - ColumnVector perm (void) const { return rep->perm(); } + ColumnVector perm (void) const { return rep->perm (); } - p_type Q (void) const { return rep->Q(); } + 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(); } + double rcond (void) const { return rep->rcond (); } chol_type inverse (void) const; };
--- a/liboctave/sparse-base-lu.cc +++ b/liboctave/sparse-base-lu.cc @@ -35,7 +35,7 @@ octave_idx_type nc = Ufact.rows (); octave_idx_type rcmin = (nr > nc ? nr : nc); - lu_type Yout (nr, nc, Lfact.nnz() + Ufact.nnz()); + lu_type Yout (nr, nc, Lfact.nnz () + Ufact.nnz ()); octave_idx_type ii = 0; Yout.xcidx(0) = 0;
--- a/liboctave/sparse-dmsolve.cc +++ b/liboctave/sparse-dmsolve.cc @@ -73,7 +73,7 @@ { OCTAVE_LOCAL_BUFFER (T, X, rend - rst); octave_sort<octave_idx_type> sort; - octave_idx_type *ri = B.xridx(); + octave_idx_type *ri = B.xridx (); nz = 0; for (octave_idx_type j = cst ; j < cend ; j++) { @@ -158,11 +158,11 @@ dmsolve_insert (MArray<T> &a, const MArray<T> &b, const octave_idx_type *Q, octave_idx_type r, octave_idx_type c) { - T *ax = a.fortran_vec(); - const T *bx = b.fortran_vec(); - octave_idx_type anr = a.rows(); - octave_idx_type nr = b.rows(); - octave_idx_type nc = b.cols(); + T *ax = a.fortran_vec (); + const T *bx = b.fortran_vec (); + octave_idx_type anr = a.rows (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); for (octave_idx_type j = 0; j < nc; j++) { octave_idx_type aoff = (c + j) * anr; @@ -214,7 +214,7 @@ octave_sort<octave_idx_type> sort; MSparse<T> tmp (a); a = MSparse<T> (nr, nc, nel); - octave_idx_type *ri = a.xridx(); + octave_idx_type *ri = a.xridx (); for (octave_idx_type i = 0; i < tmp.cidx(c); i++) { @@ -278,9 +278,9 @@ { octave_idx_type b_nr = b.rows (); octave_idx_type b_nc = b.cols (); - const T *Bx = b.fortran_vec(); + const T *Bx = b.fortran_vec (); a.resize (dim_vector (b_nr, b_nc)); - RT *Btx = a.fortran_vec(); + RT *Btx = a.fortran_vec (); for (octave_idx_type j = 0; j < b_nc; j++) { octave_idx_type off = j * b_nr; @@ -316,7 +316,7 @@ octave_idx_type nz = 0; a = MSparse<RT> (b_nr, b_nc, b_nz); octave_sort<octave_idx_type> sort; - octave_idx_type *ri = a.xridx(); + octave_idx_type *ri = a.xridx (); OCTAVE_LOCAL_BUFFER (RT, X, b_nr); a.xcidx(0) = 0; for (octave_idx_type j = 0; j < b_nc; j++) @@ -411,7 +411,7 @@ { ST m = dmsolve_extract (a, pinv, q, dm->rr [2], nr, dm->cc [3], nc, nnz_remaining, true); - nnz_remaining -= m.nnz(); + nnz_remaining -= m.nnz (); RT mtmp = qrsolve (m, dmsolve_extract (btmp, 0, 0, dm->rr[2], b_nr, 0, b_nc), info); @@ -420,7 +420,7 @@ { m = dmsolve_extract (a, pinv, q, 0, dm->rr [2], dm->cc [3], nc, nnz_remaining, true); - nnz_remaining -= m.nnz(); + nnz_remaining -= m.nnz (); RT ctmp = dmsolve_extract (btmp, 0, 0, 0, dm->rr[2], 0, b_nc); btmp.insert (ctmp - m * mtmp, 0, 0); @@ -433,7 +433,7 @@ { ST m = dmsolve_extract (a, pinv, q, dm->rr [1], dm->rr [2], dm->cc [2], dm->cc [3], nnz_remaining, false); - nnz_remaining -= m.nnz(); + nnz_remaining -= m.nnz (); RT btmp2 = dmsolve_extract (btmp, 0, 0, dm->rr [1], dm->rr [2], 0, b_nc); double rcond = 0.0; @@ -451,7 +451,7 @@ { m = dmsolve_extract (a, pinv, q, 0, dm->rr [1], dm->cc [2], dm->cc [3], nnz_remaining, true); - nnz_remaining -= m.nnz(); + nnz_remaining -= m.nnz (); RT ctmp = dmsolve_extract (btmp, 0, 0, 0, dm->rr[1], 0, b_nc); btmp.insert (ctmp - m * mtmp, 0, 0);
--- a/liboctave/str-vec.cc +++ b/liboctave/str-vec.cc @@ -212,7 +212,8 @@ // Format a list in neat columns. std::ostream& -string_vector::list_in_columns (std::ostream& os, int width) const +string_vector::list_in_columns (std::ostream& os, int width, + const std::string& prefix) const { // Compute the maximum name length. @@ -241,7 +242,8 @@ // Calculate the maximum number of columns that will fit. octave_idx_type line_length - = (width <= 0) ? command_editor::terminal_cols () : width; + = ((width <= 0 ? command_editor::terminal_cols () : width) + - prefix.length ()); octave_idx_type nc = line_length / max_name_length; if (nc == 0) @@ -264,6 +266,8 @@ // Print the next row. + os << prefix; + while (1) { std::string nm = elem (count);
--- a/liboctave/str-vec.h +++ b/liboctave/str-vec.h @@ -111,7 +111,9 @@ static void delete_c_str_vec (const char * const*); - std::ostream& list_in_columns (std::ostream&, int width = 0) const; + std::ostream& + list_in_columns (std::ostream&, int width = 0, + const std::string& prefix = std::string ()) const; }; #endif
--- a/liboctave/tempname.c +++ b/liboctave/tempname.c @@ -107,7 +107,7 @@ size_t *idx; static char buf[FILENAME_MAX]; static pid_t oldpid = (pid_t) 0; - pid_t pid = getpid(); + pid_t pid = getpid (); register size_t len, plen, dlen; if (dir_search)
--- a/scripts/general/curl.m +++ b/scripts/general/curl.m @@ -71,7 +71,7 @@ dy = varargin{2}(:,1,1)(:); dz = varargin{3}(1,1,:)(:); else - print_usage(); + print_usage (); endif if ((nargin == 4) || (nargin == 2))
--- a/scripts/general/divergence.m +++ b/scripts/general/divergence.m @@ -69,7 +69,7 @@ dy = varargin{2}(:,1,1)(:); dz = varargin{3}(1,1,:)(:); else - print_usage(); + print_usage (); endif if ((nargin == 4) || (nargin == 2))
--- a/scripts/general/randi.m +++ b/scripts/general/randi.m @@ -57,7 +57,7 @@ function ri = randi (bounds, varargin) if (nargin < 1) - print_usage(); + print_usage (); endif if (! (isnumeric (bounds) && isreal (bounds)))
--- a/scripts/io/dlmwrite.m +++ b/scripts/io/dlmwrite.m @@ -146,7 +146,7 @@ elseif (i == 3) c = varargin{i}; else - print_usage(); + print_usage (); endif endif endwhile
--- a/scripts/io/strread.m +++ b/scripts/io/strread.m @@ -226,7 +226,7 @@ switch (lower (varargin{n})) case "bufsize" ## We could synthesize this, but that just seems weird... - warning ('strread: property "bufsize" is not implemented'); + warning ("strread: property 'bufsize' is not implemented"); case "commentstyle" comment_flag = true; switch (lower (varargin{n+1})) @@ -259,7 +259,7 @@ case "emptyvalue" numeric_fill_value = varargin{n+1}; case "expchars" - warning ('strread: property "expchars" is not implemented'); + warning ("strread: property 'expchars' is not implemented"); case "whitespace" white_spaces = varargin{n+1}; if (strcmp (typeinfo (white_spaces), "sq_string")) @@ -281,10 +281,10 @@ elseif (ischar (varargin{n+1})) empty_str = varargin(n+1); else - error ('strread: "treatasempty" value must be string or cellstr'); + error ("strread: 'treatasempty' value must be string or cellstr"); endif otherwise - warning ('strread: unknown property "%s"', varargin{n}); + warning ("strread: unknown property '%s'", varargin{n}); endswitch endfor @@ -297,10 +297,10 @@ ## Determine the number of words per line as a first guess. Forms ## like %f<literal>) (w/o delimiter in between) are fixed further on format = strrep (format, "%", " %"); - fmt_words = regexp (format, '[^ ]+', 'match'); - ## Format conversion specifiers following literals w/o space/delim - ## in between are separate now. Separate those w trailing literals - idy2 = find (! cellfun ("isempty", strfind (fmt_words, "%"))); + fmt_words = regexp (format, '[^ ]+', "match"); + + ## Find position of conversion specifiers (they start with %) + idy2 = find (! cellfun ("isempty", regexp (fmt_words, '^%'))); ## Check for unsupported format specifiers errpat = '(\[.*\]|[cq]|[nfdu]8|[nfdu]16|[nfdu]32|[nfdu]64)'; @@ -308,12 +308,15 @@ error ("strread: %q, %c, %[] or bit width format specifiers are not supported yet."); endif + ## Format conversion specifiers following literals w/o space/delim + ## in between are separate now. Separate those w trailing literals a = strfind (fmt_words(idy2), "%"); - b = regexp (fmt_words(idy2), '[nfdus]', 'end'); + b = regexp (fmt_words(idy2), '[nfdus]', "end"); for jj = 1:numel (a) + ## From right to left to avoid losing track ii = numel (a) - jj + 1; if (! (length (fmt_words{idy2(ii)}) == b{ii}(1))) - ## Fix format_words + ## Split fmt_words(ii) into % conv specifier and trailing literal fmt_words(idy2(ii)+1 : end+1) = fmt_words(idy2(ii) : end); fmt_words{idy2(ii)} = fmt_words{idy2(ii)}(a{ii} : b{ii}(1)); fmt_words{idy2(ii)+1} = fmt_words{idy2(ii)+1}(b{ii}+1:end); @@ -333,7 +336,7 @@ ## Remove comments in str if (comment_flag) ## Expand 'eol_char' here, after option processing which may have set value - comment_end = regexprep (comment_end, 'eol_char', eol_char); + comment_end = regexprep (comment_end, "eol_char", eol_char); cstart = strfind (str, comment_start); cstop = strfind (str, comment_end); ## Treat end of string as additional comment stop @@ -363,7 +366,8 @@ endif if (! isempty (white_spaces)) - ## For numeric fields, whitespace is always a delimiter, but not for text fields + ## For numeric fields, whitespace is always a delimiter, but not for text + ## fields if (isempty (strfind (format, "%s"))) ## Add whitespace to delimiter set delimiter_str = unique ([white_spaces delimiter_str]); @@ -399,16 +403,15 @@ str = str(2:end); endif ## Check for single delimiter followed/preceded by whitespace - ## FIXME: Double strrep on str is enormously expensive of CPU time. - ## Can this be eliminated if (! isempty (delimiter_str)) dlmstr = setdiff (delimiter_str, " "); rxp_dlmwsp = sprintf ("( [%s]|[%s] )", dlmstr, dlmstr); str = regexprep (str, rxp_dlmwsp, delimiter_str(1)); endif + ## Wipe leading and trailing whitespace on each line (it may be + ## delimiter too) ## FIXME: Double strrep on str is enormously expensive of CPU time. ## Can this be eliminated - ## Wipe leading and trailing whitespace on each line (it may be delimiter too) if (! isempty (eol_char)) str = strrep (str, [eol_char " "], eol_char); str = strrep (str, [" " eol_char], eol_char); @@ -418,13 +421,12 @@ ## Split 'str' into words words = split_by (str, delimiter_str, mult_dlms_s1, eol_char); if (! isempty (white_spaces)) - ## Trim leading and trailing white_spaces - ## FIXME: Is this correct? strtrim clears what matches isspace(), not - ## necessarily what is in white_spaces. + ## Trim leading and trailing 'white_spaces'. All whitespace has + ## been converted to space above words = strtrim (words); endif num_words = numel (words); - ## First guess at number of lines in file (ignoring leading/trailing literals) + ## First guess at nr. of lines in file (ignoring leading/trailing literals) num_lines = ceil (num_words / num_words_per_line); ## Replace TreatAsEmpty char sequences by empty strings @@ -436,9 +438,8 @@ endif ## fmt_words has been split properly now, but words{} has only been split on - ## delimiter positions. - ## As numeric fields can also be separated by whitespace, more splits may be - ## needed. + ## delimiter positions. As numeric fields can also be separated by + ## whitespace, more splits may be needed. ## We also don't know the number of lines (as EndOfLine may have been set to ## "" (empty) by the caller). ## @@ -447,6 +448,8 @@ ## B: Leading literals (<literal>%f) w/o delimiter in between. ## C. Skipping leftover parts of specified skip fields (%*N ) ## Some words columns may have to be split further to fix these. + ## To find out, we'll match fmt_words to the words array to see what + ## needs to be done. fwptr tracks which {fmt_words}# starts in what {words}# ## Find indices and pointers to possible literals in fmt_words idf = cellfun ("isempty", strfind (fmt_words, "%")); @@ -454,7 +457,7 @@ idg = ! cellfun ("isempty", regexp (fmt_words, '%\*?\d')); idy = find (idf | idg); ## Find indices to numeric conversion specifiers - idn = ! cellfun ("isempty", regexp (fmt_words, "%[dnfu]")); + idn = ! cellfun ("isempty", regexp (fmt_words, '%[dnfu]')); ## If needed, split up columns in three steps: if (! isempty (idy)) @@ -464,12 +467,16 @@ ## 1. Assess "period" in the split-up words array ( < num_words_per_line). ## Could be done using EndOfLine but that prohibits EndOfLine = "" option. ## Alternative below goes by simply parsing a first grab of words - ## and counting words until the fmt_words array is exhausted: - iwrd = 1; iwrdp = 0; iwrdl = length (words{iwrd}); + ## and matching fmt_words to words until the fmt_words array is exhausted. + ## iwrd: ptr to current analyzed word; iwrdp: ptr to pos before analyzed char + iwrd = 1; iwrdp = 0; iwrdl = length (words{1}); + fwptr = zeros (1, numel (fmt_words)); ii = 1; while ii <= numel (fmt_words) nxt_wrd = 0; + ## Keep track of which words nr. every fmt_words{} is (starts) in. + fwptr(ii) = iwrd; if (idf(ii)) ## Literal expected @@ -493,8 +500,9 @@ elseif (idg(ii)) ## Fixed width specifier (%N or %*N): read just a part of word - iwrdp += floor ... - (str2double (fmt_words{ii}(regexp(fmt_words{ii}, '\d') : end-1))); + sw = regexp (fmt_words{ii}, '\d', "once"); + ew = regexp (fmt_words{ii}, '[nfuds]') - 1; + iwrdp += floor (str2double (fmt_words{ii}(sw:ew))); if (iwrdp > iwrdl) ## Match error. Field extends beyond word boundary. warning ... @@ -532,10 +540,11 @@ if (iwrd > numel (words)) ## Apparently EOF; assume incomplete row already at L.1 of data ii = numel (fmt_words); - elseif (ii < numel (fmt_words)) + elseif (ii < numel (fmt_words) && iwrd <= numel (words)) iwrdl = length (words{iwrd}); endif endif + ++ii; endwhile @@ -544,12 +553,11 @@ num_lines = ceil (num_words / words_period); ## 2. Pad words array so that it can be reshaped - tmp_lines = ceil (num_words / words_period); - num_words_padded = tmp_lines * words_period - num_words; + num_words_padded = num_lines * words_period - num_words; if (num_words_padded) words = [words'; cell(num_words_padded, 1)]; endif - words = reshape (words, words_period, tmp_lines); + words = reshape (words, words_period, num_lines); ## 3. Do the column splitting on rectangular words array icol = 1; ii = 1; # icol = current column, ii = current fmt_word @@ -582,6 +590,7 @@ (@(x) substr(x, e(1)+1, length(x)-e(1)), words(icol, jptr), ... "UniformOutput", false); words(icol, jptr) = fmt_words{ii}; + fwptr = [fwptr(1:ii) (++fwptr(ii+1:end))]; else if (! idg(ii) && ! isempty (strfind (fmt_words{ii-1}, "%s"))) @@ -589,11 +598,19 @@ warning ("Ambiguous '%s' specifier next to literal in column %d", icol); elseif (idg(ii)) ## Current field = fixed width. Strip into icol, rest in icol+1 - wdth = floor (str2double (fmt_words{ii}(regexp(fmt_words{ii}, ... - '\d') : end-1))); + sw = regexp (fmt_words{ii}, '\d', "once"); + ew = regexp (fmt_words{ii}, '[nfuds]') - 1; + wdth = floor (str2double (fmt_words{ii}(sw:ew))); words(icol+1, jptr) = cellfun (@(x) x(wdth+1:end), words(icol,jptr), "UniformOutput", false); - words(icol, jptr) = strtrunc (words(icol, jptr), wdth); + if (isempty ([words(icol+1, :){:}])) + ## Apparently split wasn't needed as turns out to cover + ## entire column. So delete column again + words(icol+1, :) = []; + else + words(icol, jptr) = strtrunc (words(icol, jptr), wdth); + fwptr = [fwptr(1:ii) (++fwptr(ii+1:end))]; + endif else ## FIXME: this assumes char(254)/char(255) won't occur in input! clear wrds; @@ -610,6 +627,7 @@ char(254), fmt_words{ii}), char(255)); ## Former trailing literal may now be leading for next specifier --ii; + fwptr = [fwptr(1:ii) (++fwptr(ii+1:end))]; endif endif endif @@ -617,9 +635,7 @@ else ## Conv. specifier. Peek if next fmt_word needs split from current column if (ii < num_words_per_line) - if (idf(ii+1) && (! isempty (strfind (words{icol, 1}, fmt_words{ii+1})))) - --icol; - elseif (idg(ii+1)) + if (fwptr(ii) == fwptr(ii+1)) --icol; endif endif @@ -678,10 +694,12 @@ varargout{k} = data.'; k++; case {"%0", "%1", "%2", "%3", "%4", "%5", "%6", "%7", "%8", "%9"} - nfmt = strsplit (fmt_words{m}(2:end-1), '.'); + sw = regexp (fmt_words{m}, '\d', "once"); + ew = regexp (fmt_words{m}, '[nfudsq]') - 1; + nfmt = strsplit (fmt_words{m}(2:ew), "."); swidth = str2double (nfmt{1}); - switch fmt_words{m}(end) - case {"d", "u", "f", "n%"} + switch fmt_words{m}(ew+1) + case {"d", "u", "f", "n"} n = cellfun ("isempty", data); ### FIXME - erroneously formatted data lead to NaN, not an error ### => ReturnOnError can't be implemented for numeric data @@ -774,7 +792,7 @@ %! a = rand (10, 1); %! b = char (randi ([65, 85], 10, 1)); %! for k = 1:10 -%! str = sprintf ('%s %.6f %s\n', str, a(k), b(k)); +%! str = sprintf ("%s %.6f %s\n", str, a(k), b(k)); %! endfor %! [aa, bb] = strread (str, "%f %s"); %! assert (a, aa, 1e-6); @@ -785,19 +803,19 @@ %! a = rand (10, 1); %! b = char (randi ([65, 85], 10, 1)); %! for k = 1:10 -%! str = sprintf ('%s %.6f %s\n', str, a(k), b(k)); +%! str = sprintf ("%s %.6f %s\n", str, a(k), b(k)); %! endfor %! aa = strread (str, "%f %*s"); %! assert (a, aa, 1e-6); %!test -%! str = sprintf ('/* this is\nacomment*/ 1 2 3'); +%! str = sprintf ("/* this is\nacomment*/ 1 2 3"); %! a = strread (str, "%f", "commentstyle", "c"); %! assert (a, [1; 2; 3]); %!test %! str = "# comment\n# comment\n1 2 3"; -%! [a, b] = strread (str, '%n %s', 'commentstyle', 'shell', 'endofline', "\n"); +%! [a, b] = strread (str, "%n %s", "commentstyle", "shell", "endofline", "\n"); %! assert (a, [1; 3]); %! assert (b, {"2"}); @@ -922,12 +940,12 @@ %! assert (c, [0.94; 0.87], 0.01) %!test -%! [a, b] = strread (['Empty 1' char(10)], 'Empty%s %f'); +%! [a, b] = strread (["Empty 1" char(10)], "Empty%s %f"); %! assert (a{1}, '1'); %! assert (b, NaN); %!test -%! [a, b] = strread (['Empty' char(10)], 'Empty%f %f'); +%! [a, b] = strread (["Empty" char(10)], "Empty%f %f"); %! assert (a, NaN); %! assert (b, NaN); @@ -940,17 +958,17 @@ %% Unsupported format specifiers %!test -%!error <format specifiers are not supported> strread ('a', '%c') -%!error <format specifiers are not supported> strread ('a', '%*c %d') -%!error <format specifiers are not supported> strread ('a', '%q') -%!error <format specifiers are not supported> strread ('a', '%*q %d') -%!error <format specifiers are not supported> strread ('a', '%[a]') -%!error <format specifiers are not supported> strread ('a', '%*[a] %d') -%!error <format specifiers are not supported> strread ('a', '%[^a]') -%!error <format specifiers are not supported> strread ('a', '%*[â] %d') -%!error <format specifiers are not supported> strread ('a', '%d8') -%!error <format specifiers are not supported> strread ('a', '%*d8 %s') -%!error <format specifiers are not supported> strread ('a', '%f64') -%!error <format specifiers are not supported> strread ('a', '%*f64 %s') -%!error <format specifiers are not supported> strread ('a', '%u32') -%!error <format specifiers are not supported> strread ('a', '%*u32 %d') +%!error <format specifiers are not supported> strread ("a", "%c") +%!error <format specifiers are not supported> strread ("a", "%*c %d") +%!error <format specifiers are not supported> strread ("a", "%q") +%!error <format specifiers are not supported> strread ("a", "%*q %d") +%!error <format specifiers are not supported> strread ("a", "%[a]") +%!error <format specifiers are not supported> strread ("a", "%*[a] %d") +%!error <format specifiers are not supported> strread ("a", "%[^a]") +%!error <format specifiers are not supported> strread ("a", "%*[^a] %d") +%!error <format specifiers are not supported> strread ("a", "%d8") +%!error <format specifiers are not supported> strread ("a", "%*d8 %s") +%!error <format specifiers are not supported> strread ("a", "%f64") +%!error <format specifiers are not supported> strread ("a", "%*f64 %s") +%!error <format specifiers are not supported> strread ("a", "%u32") +%!error <format specifiers are not supported> strread ("a", "%*u32 %d")
--- a/scripts/miscellaneous/edit.m +++ b/scripts/miscellaneous/edit.m @@ -429,7 +429,7 @@ "DEFUN_DLD(", name, ",args,nargout,\"\\\n", name, "\\n\\\n\")\n{\n", " octave_value_list retval;\n", - " int nargin = args.length();\n\n", + " int nargin = args.length ();\n\n", code, "\n return retval;\n}\n"); text = cstrcat (comment, body);
--- a/scripts/miscellaneous/getappdata.m +++ b/scripts/miscellaneous/getappdata.m @@ -32,7 +32,7 @@ ## FIXME - Is there a better way to handle non-existent appdata ## and missing fields? val = cell (numel (h), 1); - appdata = struct(); + appdata = struct (); for nh = 1:numel(h) try appdata = get (h(nh), "__appdata__");
--- a/scripts/miscellaneous/list_primes.m +++ b/scripts/miscellaneous/list_primes.m @@ -51,8 +51,8 @@ endif retval = zeros (1, n); - retval (1) = 2; - retval (2) = 3; + retval(1) = 2; + retval(2) = 3; n = n - 2; i = 3; @@ -75,7 +75,7 @@ endwhile if (is_prime) - retval (i++) = p; + retval(i++) = p; n--; endif p = p + 2;
--- a/scripts/miscellaneous/what.m +++ b/scripts/miscellaneous/what.m @@ -32,7 +32,7 @@ d = pwd (); elseif (isempty (strfind (d, filesep ()))) ## Find the appropriate directory on the path. - p = strtrim (strsplit (path (), pathsep())); + p = strtrim (strsplit (path (), pathsep ())); d = p{find (cellfun (@(x) ! isempty (strfind (x, d)), p))(end)}; else [status, msg, msgid] = fileattrib (d); @@ -91,7 +91,7 @@ printf ("%s %s:\n\n", msg, p); maxlen = max (cellfun ("length", f)); - ncols = max (1, floor (terminal_size()(2) / (maxlen + 3))); + ncols = max (1, floor (terminal_size ()(2) / (maxlen + 3))); fmt = ""; for i = 1: ncols fmt = sprintf ("%s %%-%ds", fmt, maxlen);
--- a/scripts/pkg/private/getarchdir.m +++ b/scripts/pkg/private/getarchdir.m @@ -23,6 +23,6 @@ ## @end deftypefn function archdir = getarchdir (desc) - archdir = fullfile (desc.archprefix, getarch()); + archdir = fullfile (desc.archprefix, getarch ()); endfunction
--- a/scripts/pkg/private/install.m +++ b/scripts/pkg/private/install.m @@ -101,7 +101,7 @@ if (exist (tgz, "file")) packdir = fullfile (tmpdir, dirlist{3}); else - packdir = fullfile (pwd(), dirlist{3}); + packdir = fullfile (pwd (), dirlist{3}); endif packdirs{end+1} = packdir;
--- a/scripts/pkg/private/installed_packages.m +++ b/scripts/pkg/private/installed_packages.m @@ -57,7 +57,7 @@ endif ## Now check if the package is loaded. - tmppath = strrep (path(), "\\", "/"); + tmppath = strrep (path (), "\\", "/"); for i = 1:length (installed_pkgs_lst) if (strfind (tmppath, strrep (installed_pkgs_lst{i}.dir, '\', '/'))) installed_pkgs_lst{i}.loaded = true; @@ -111,7 +111,7 @@ length (installed_pkgs_lst{i}.version)); names{i} = installed_pkgs_lst{i}.name; endfor - max_dir_length = terminal_size()(2) - max_name_length - ... + max_dir_length = terminal_size ()(2) - max_name_length - ... max_version_length - 7; if (max_dir_length < 20) max_dir_length = Inf; @@ -138,7 +138,7 @@ cur_dir = installed_pkgs_lst{idx(i)}.dir; if (length (cur_dir) > max_dir_length) first_char = length (cur_dir) - max_dir_length + 4; - first_filesep = strfind (cur_dir(first_char:end), filesep()); + first_filesep = strfind (cur_dir(first_char:end), filesep ()); if (! isempty (first_filesep)) cur_dir = cstrcat ("...", cur_dir((first_char + first_filesep(1) - 1):end));
--- a/scripts/pkg/private/repackage.m +++ b/scripts/pkg/private/repackage.m @@ -25,7 +25,7 @@ function repackage (builddir, buildlist) packages = installed_packages (buildlist, buildlist); - wd = pwd(); + wd = pwd (); for i = 1 : length(packages) pack = packages{i}; unwind_protect
--- a/scripts/pkg/private/unload_packages.m +++ b/scripts/pkg/private/unload_packages.m @@ -35,7 +35,7 @@ endfor ## Get the current octave path. - p = strtrim (strsplit (path(), pathsep ())); + p = strtrim (strsplit (path (), pathsep ())); if (length (files) == 1 && strcmp (files{1}, "all")) ## Unload all.
--- a/scripts/plot/colorbar.m +++ b/scripts/plot/colorbar.m @@ -182,7 +182,7 @@ ## Don't delete the colorbar and reset the axis size if the ## parent figure is being deleted. if (ishandle (hc) && strcmp (get (hc, "type"), "axes") - && (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off"))) + && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off"))) if (strcmp (get (hc, "beingdeleted"), "off")) delete (hc); endif @@ -209,7 +209,7 @@ function update_colorbar_clim (h, d, hi, vert) if (ishandle (h) && strcmp (get (h, "type"), "image") - && (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off"))) + && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off"))) clen = rows (get (get (h, "parent"), "colormap")); cext = get (h, "clim"); cdiff = (cext(2) - cext(1)) / clen / 2; @@ -229,7 +229,7 @@ function update_colorbar_axis (h, d, cax, orig_props) if (ishandle (cax) && strcmp (get (cax, "type"), "axes") - && (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off"))) + && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off"))) loc = get (cax, "location"); obj = get (h); obj.__my_handle__ = h;
--- a/scripts/plot/figure.m +++ b/scripts/plot/figure.m @@ -59,7 +59,7 @@ ## Check to see if we already have a figure on the screen. If we do, ## then update it if it is different from the figure we are creating ## or switching to. - cf = get (0, "currentfigure"); # Can't use gcf() because it calls figure() + cf = get (0, "currentfigure"); # Can't use gcf () because it calls figure () if (! isempty (cf) && cf != 0) if (isnan (f) || cf != f) drawnow ();
new file mode 100644 --- /dev/null +++ b/scripts/plot/gco.m @@ -0,0 +1,45 @@ +## Copyright (C) 2012 Michael Goffioul +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{h} =} gco () +## @deftypefnx {Function File} {@var{h} =} gco (@var{fig}) +## Return a handle to the current object of the current figure, or a handle +## to the current object of the figure with handle @var{fig}. The current +## object of a figure is the object that was last clicked on. It is stored +## in the CurrentObject property of the target figure. +## +## If the last mouse click didn't occur on any child object of the figure, +## the current object is the figure itself. +## +## If no mouse click occured in the target figure, this function returns and +## empty matrix. +## +## Note that the value returned by this function is not necessarily the same +## as the one returned by gcbo during callback execution. An executing +## callback can be interrupted by another callback and the current object +## can be modified. +## +##@seealso{gcbo, gcf} +##@end deftypefn + +function h = gco () + + h = get (gcf (), "currentobject"); + +endfunction
--- a/scripts/plot/isosurface.m +++ b/scripts/plot/isosurface.m @@ -174,7 +174,7 @@ "FaceColor", "g", "EdgeColor", "k"); endif if (! ishold ()) - set (gca(), "view", [-37.5, 30], + set (gca (), "view", [-37.5, 30], "xgrid", "on", "ygrid", "on", "zgrid", "on"); endif case 1
--- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -856,7 +856,7 @@ for i = 1 : numel (ca) if (ishandle (ca(i)) && strcmp (get (ca(i), "type"), "axes") - && (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off")) + && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")) && strcmp (get (ca(i), "beingdeleted"), "off")) units = get (ca(i), "units"); unwind_protect @@ -875,7 +875,7 @@ function deletelegend1 (h, d, ca) if (ishandle (ca) && strcmp (get (ca, "type"), "axes") - && (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off")) + && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")) && strcmp (get (ca, "beingdeleted"), "off")) delete (ca); endif @@ -884,7 +884,7 @@ function deletelegend2 (h, d, ca, pos, outpos, t1, hplots) for i = 1 : numel (ca) if (ishandle (ca(i)) && strcmp (get (ca(i), "type"), "axes") - && (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off")) + && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")) && strcmp (get (ca(i), "beingdeleted"), "off")) if (!isempty (pos) && !isempty(outpos)) units = get (ca(i), "units");
--- a/scripts/plot/line.m +++ b/scripts/plot/line.m @@ -48,13 +48,13 @@ %! x = 0:0.3:10; %! y1 = cos (x); %! y2 = sin (x); -%! subplot (3, 1, 1) +%! subplot (3,1,1); %! args = {"color", "b", "marker", "s"}; %! line ([x(:), x(:)], [y1(:), y2(:)], args{:}) %! title ("Test broadcasting for line()") -%! subplot (3, 1, 2) +%! subplot (3,1,2); %! line (x(:), [y1(:), y2(:)], args{:}) -%! subplot (3, 1, 3) +%! subplot (3,1,3); %! line ([x(:), x(:)+pi/2], y1(:), args{:}) %! xlim ([0 10])
--- a/scripts/plot/loglog.m +++ b/scripts/plot/loglog.m @@ -38,7 +38,7 @@ [h, varargin, nargs] = __plt_get_axis_arg__ ("loglog", varargin{:}); if (nargs < 1) - print_usage(); + print_usage (); endif oldh = gca ();
--- a/scripts/plot/module.mk +++ b/scripts/plot/module.mk @@ -105,6 +105,7 @@ plot/gcbf.m \ plot/gcbo.m \ plot/gcf.m \ + plot/gco.m \ plot/ginput.m \ plot/graphics_toolkit.m \ plot/grid.m \
--- a/scripts/plot/plot.m +++ b/scripts/plot/plot.m @@ -186,7 +186,7 @@ [h, varargin, nargs] = __plt_get_axis_arg__ ("plot", varargin{:}); if (nargs < 1) - print_usage(); + print_usage (); endif oldh = gca ();
--- a/scripts/plot/plot3.m +++ b/scripts/plot/plot3.m @@ -327,7 +327,7 @@ endif if (!isempty (hlgnd)) - legend (gca(), hlgnd, tlgnd); + legend (gca (), hlgnd, tlgnd); endif set (gca (), "view", [-37.5, 30]);
--- a/scripts/plot/plotyy.m +++ b/scripts/plot/plotyy.m @@ -284,7 +284,7 @@ function deleteplotyy (h, d, ax2, t2) if (ishandle (ax2) && strcmp (get (ax2, "type"), "axes") - && (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off")) + && (isempty (gcbf ()) || strcmp (get (gcbf (), "beingdeleted"),"off")) && strcmp (get (ax2, "beingdeleted"), "off")) set (t2, "deletefcn", []); delete (ax2);
--- a/scripts/plot/polar.m +++ b/scripts/plot/polar.m @@ -38,7 +38,7 @@ [h, varargin, nargs] = __plt_get_axis_arg__ ("polar", varargin{:}); if (nargs < 1) - print_usage(); + print_usage (); endif oldh = gca ();
--- a/scripts/plot/private/__errplot__.m +++ b/scripts/plot/private/__errplot__.m @@ -196,7 +196,7 @@ ## Process legend key if (! isempty (fmt.key)) hlegend = []; - fkids = get (gcf(), "children"); + fkids = get (gcf (), "children"); for i = 1 : numel (fkids) if (ishandle (fkids(i)) && strcmp (get (fkids(i), "type"), "axes") && (strcmp (get (fkids(i), "tag"), "legend"))) @@ -218,7 +218,7 @@ hlgnd(end+1) = hg; tlgnd(end+1) = fmt.key; - legend (gca(), hlgnd, tlgnd); + legend (gca (), hlgnd, tlgnd); endif endfunction
--- a/scripts/plot/private/__ghostscript__.m +++ b/scripts/plot/private/__ghostscript__.m @@ -118,13 +118,13 @@ unwind_protect fid = fopen (offsetfile, "w"); if (fid == -1) - error ("print:fopenfailed", "__ghostscript__.m: fopen() failed"); + error ("print:fopenfailed", "__ghostscript__.m: fopen () failed"); endif fprintf (fid, "%s\n", offset_ps{:}); unwind_protect_cleanup status = fclose (fid); if (status == -1) - error ("print:fclosefailed", "__ghostscript__.m: fclose() failed"); + error ("print:fclosefailed", "__ghostscript__.m: fclose () failed"); endif end_unwind_protect if (opts.debug)
--- a/scripts/plot/private/__marching_cube__.m +++ b/scripts/plot/private/__marching_cube__.m @@ -235,7 +235,7 @@ endif endfunction -function [edge_table, tri_table] = init_mc() +function [edge_table, tri_table] = init_mc () edge_table = [ 0x0 , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, ... 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, ...
--- a/scripts/plot/private/__plt__.m +++ b/scripts/plot/private/__plt__.m @@ -37,7 +37,7 @@ properties = {}; hlegend = []; - fkids = get (gcf(), "children"); + fkids = get (gcf (), "children"); for i = 1 : numel(fkids) if (ishandle (fkids (i)) && strcmp (get (fkids (i), "type"), "axes") && (strcmp (get (fkids (i), "tag"), "legend"))) @@ -132,7 +132,7 @@ endwhile if (setlgnd) - legend (gca(), hlgnd, tlgnd); + legend (gca (), hlgnd, tlgnd); endif else error ("__plt__: invalid number of arguments");
--- a/scripts/plot/private/__scatter__.m +++ b/scripts/plot/private/__scatter__.m @@ -111,7 +111,7 @@ endwhile if (isempty (c)) - c = __next_line_color__(); + c = __next_line_color__ (); endif hg = hggroup (); @@ -268,7 +268,7 @@ ## Does gnuplot only support triangles with different vertex colors ? ## TODO - Verify gnuplot can only support one color. If RGB triplets ## can be assigned to each vertex, then fix __go_draw_axe__.m - gnuplot_hack = (numel (x) > 1 && size(c, 2) == 3 + gnuplot_hack = (numel (x) > 1 && columns (c) == 3 && strcmp (toolkit, "gnuplot")); if (ischar (c) || ! isflat || gnuplot_hack) if (filled)
--- a/scripts/plot/scatter.m +++ b/scripts/plot/scatter.m @@ -93,7 +93,7 @@ %! x = randn (100, 1); %! y = randn (100, 1); %! c = x .* y; -%! scatter (x, y, 20, c, "filled"); +%! scatter (x, y, 20, c, 'filled'); %! title ('Scatter with colors'); %!demo
--- a/scripts/plot/semilogx.m +++ b/scripts/plot/semilogx.m @@ -38,7 +38,7 @@ [h, varargin, nargs] = __plt_get_axis_arg__ ("semilogx", varargin{:}); if (nargs < 1) - print_usage(); + print_usage (); endif oldh = gca ();
--- a/scripts/plot/semilogy.m +++ b/scripts/plot/semilogy.m @@ -38,7 +38,7 @@ [h, varargin, nargs] = __plt_get_axis_arg__ ("semilogy", varargin{:}); if (nargs < 1) - print_usage(); + print_usage (); endif oldh = gca ();
--- a/scripts/plot/trimesh.m +++ b/scripts/plot/trimesh.m @@ -41,10 +41,10 @@ else newplot (); handle = patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri, - "FaceColor", "none", "EdgeColor", __next_line_color__(), + "FaceColor", "none", "EdgeColor", __next_line_color__ (), varargin{:}); if (! ishold ()) - set (gca(), "view", [-37.5, 30], + set (gca (), "view", [-37.5, 30], "xgrid", "on", "ygrid", "on", "zgrid", "on"); endif if (nargout > 0)
--- a/scripts/plot/trisurf.m +++ b/scripts/plot/trisurf.m @@ -64,7 +64,7 @@ endif if (! ishold ()) - set (gca(), "view", [-37.5, 30], + set (gca (), "view", [-37.5, 30], "xgrid", "on", "ygrid", "on", "zgrid", "on"); endif endif
--- a/scripts/signal/private/rectangle_lw.m +++ b/scripts/signal/private/rectangle_lw.m @@ -34,6 +34,6 @@ retval = zeros (n, 1); t = floor (1 / b); - retval (1:t, 1) = ones (t, 1); + retval(1:t, 1) = ones (t, 1); endfunction
--- a/scripts/signal/sinetone.m +++ b/scripts/signal/sinetone.m @@ -58,7 +58,7 @@ retval = zeros (ns, n); for k = 1:n - retval (:, k) = ampl(k) * sin (2 * pi * (1:ns) / rate * freq(k))'; + retval(:, k) = ampl(k) * sin (2 * pi * (1:ns) / rate * freq(k))'; endfor endfunction
--- a/scripts/testfun/demo.m +++ b/scripts/testfun/demo.m @@ -128,7 +128,7 @@ embed_func = regexp (block, '^\s*function ', 'once', 'lineanchors'); if (isempty (embed_func)) ## Use an environment without variables - eval (cstrcat ("function __demo__()\n", block, "\nendfunction")); + eval (cstrcat ("function __demo__ ()\n", block, "\nendfunction")); ## Display the code that will be executed before executing it printf ("%s example %d:%s\n\n", name, doidx(i), block); __demo__;
--- a/scripts/testfun/test.m +++ b/scripts/testfun/test.m @@ -281,7 +281,7 @@ elseif (__rundemo && __isdemo) try ## process the code in an environment without variables - eval (sprintf ("function __test__()\n%s\nendfunction", __code)); + eval (sprintf ("function __test__ ()\n%s\nendfunction", __code)); __test__; input ("Press <enter> to continue: ", "s"); catch
--- a/scripts/time/datetick.m +++ b/scripts/time/datetick.m @@ -135,7 +135,7 @@ else ## Need to do our own axis tick position calculation as ## year, etc, don't fallback on nice datenum values. - objs = findall (gca()); + objs = findall (gca ()); xmax = NaN; xmin = NaN; for i = 1 : length (objs) @@ -244,16 +244,16 @@ if (keepticks) if (keeplimits) - set (gca(), strcat (ax, "ticklabel"), sticks); + set (gca (), strcat (ax, "ticklabel"), sticks); else - set (gca(), strcat (ax, "ticklabel"), sticks, strcat (ax, "lim"), + set (gca (), strcat (ax, "ticklabel"), sticks, strcat (ax, "lim"), [min(ticks), max(ticks)]); endif else if (keeplimits) - set (gca(), strcat (ax, "tick"), ticks, strcat (ax, "ticklabel"), sticks); + set (gca (), strcat (ax, "tick"), ticks, strcat (ax, "ticklabel"), sticks); else - set (gca(), strcat (ax, "tick"), ticks, strcat (ax, "ticklabel"), sticks, + set (gca (), strcat (ax, "tick"), ticks, strcat (ax, "ticklabel"), sticks, strcat (ax, "lim"), [min(ticks), max(ticks)]); endif endif
--- a/src/DLD-FUNCTIONS/__delaunayn__.cc +++ b/src/DLD-FUNCTIONS/__delaunayn__.cc @@ -124,7 +124,7 @@ boolT ismalloc = false; // Qhull flags argument is not const char* - OCTAVE_LOCAL_BUFFER (char, flags, 9 + options.length()); + OCTAVE_LOCAL_BUFFER (char, flags, 9 + options.length ()); sprintf (flags, "qhull d %s", options.c_str ());
--- a/src/DLD-FUNCTIONS/__dsearchn__.cc +++ b/src/DLD-FUNCTIONS/__dsearchn__.cc @@ -40,7 +40,7 @@ Undocumented internal function.\n\ @end deftypefn") { - int nargin = args.length(); + int nargin = args.length (); octave_value_list retval; if (nargin != 2) @@ -49,18 +49,18 @@ return retval; } - Matrix x = args(0).matrix_value().transpose (); - Matrix xi = args(1).matrix_value().transpose (); + Matrix x = args(0).matrix_value ().transpose (); + Matrix xi = args(1).matrix_value ().transpose (); if (! error_state) { - if (x.rows() != xi.rows() || x.columns() < 1) + if (x.rows () != xi.rows () || x.columns () < 1) error ("__dsearch__: number of rows of X and XI must match"); else { - octave_idx_type n = x.rows(); - octave_idx_type nx = x.columns(); - octave_idx_type nxi = xi.columns(); + octave_idx_type n = x.rows (); + octave_idx_type nx = x.columns (); + octave_idx_type nxi = xi.columns (); ColumnVector idx (nxi); double *pidx = idx.fortran_vec ();
--- a/src/DLD-FUNCTIONS/__fltk_uigetfile__.cc +++ b/src/DLD-FUNCTIONS/__fltk_uigetfile__.cc @@ -58,15 +58,15 @@ octave_value_list retval (3, octave_value (0)); - std::string file_filter = args(0).string_value(); - std::string title = args(1).string_value(); - std::string default_name = args(2).string_value(); - Matrix pos = args(3).matrix_value(); + std::string file_filter = args(0).string_value (); + std::string title = args(1).string_value (); + std::string default_name = args(2).string_value (); + Matrix pos = args(3).matrix_value (); int multi_type = Fl_File_Chooser::SINGLE; std::string flabel = "Filename:"; - std::string multi = args(4).string_value(); + std::string multi = args(4).string_value (); if (multi == "on") multi_type = Fl_File_Chooser::MULTI; else if (multi == "dir") @@ -92,7 +92,7 @@ while (fc.shown ()) Fl::wait (); - if (fc.value()) + if (fc.value ()) { int file_count = fc.count (); std::string fname;
--- a/src/DLD-FUNCTIONS/__glpk__.cc +++ b/src/DLD-FUNCTIONS/__glpk__.cc @@ -168,7 +168,7 @@ int typx = 0; int method; - clock_t t_start = clock(); + clock_t t_start = clock (); #if 0 #ifdef GLPK_PRE_4_14 @@ -488,7 +488,7 @@ //-- 1nd Input. A column array containing the objective function //-- coefficients. - volatile int mrowsc = args(0).rows(); + volatile int mrowsc = args(0).rows (); Matrix C (args(0).matrix_value ());
--- a/src/DLD-FUNCTIONS/__init_fltk__.cc +++ b/src/DLD-FUNCTIONS/__init_fltk__.cc @@ -738,7 +738,7 @@ // related windows. Otherwise, the class is just "FLTK" xclass ("Octave"); show (); - if (fp.get_currentaxes ().ok()) + if (fp.get_currentaxes ().ok ()) show_canvas (); else hide_canvas (); @@ -880,7 +880,7 @@ else hide_menubar (); - mark_modified(); + mark_modified (); } }
--- a/src/DLD-FUNCTIONS/__lin_interpn__.cc +++ b/src/DLD-FUNCTIONS/__lin_interpn__.cc @@ -195,7 +195,7 @@ for (int i = 0; i < n; i++) { y[i] = Y[i].data (); - size[i] = V.dims()(i); + size[i] = V.dims ()(i); } OCTAVE_LOCAL_BUFFER (const T *, x, n); @@ -286,7 +286,7 @@ // dimension of the problem int n = (nargin-1)/2; - if (args(n).is_single_type()) + if (args(n).is_single_type ()) { OCTAVE_LOCAL_BUFFER (FloatNDArray, X, n); OCTAVE_LOCAL_BUFFER (FloatNDArray, Y, n);
--- a/src/DLD-FUNCTIONS/__magick_read__.cc +++ b/src/DLD-FUNCTIONS/__magick_read__.cc @@ -428,14 +428,14 @@ bool all_frames = false; if (args.length () == 2 && args(1).is_real_type ()) - frameidx = args(1).int_vector_value(); + frameidx = args(1).int_vector_value (); else if (args.length () == 3 && args(1).is_string () - && args(1).string_value() == "frames") + && args(1).string_value () == "frames") { - if (args(2).is_string () && args(2).string_value() == "all") + if (args(2).is_string () && args(2).string_value () == "all") all_frames = true; else if (args(2).is_real_type ()) - frameidx = args(2).int_vector_value(); + frameidx = args(2).int_vector_value (); } else { @@ -901,7 +901,7 @@ if (args(3).is_real_type ()) write_image (filename, fmt, args(2), args(3)); else - write_image (filename, fmt, args(2), octave_value(), args(3)); + write_image (filename, fmt, args(2), octave_value (), args(3)); else write_image (filename, fmt, args(2)); }
--- a/src/DLD-FUNCTIONS/__pchip_deriv__.cc +++ b/src/DLD-FUNCTIONS/__pchip_deriv__.cc @@ -59,7 +59,7 @@ octave_value retval; const int nargin = args.length (); - bool rows = (nargin == 3 && args (2).uint_value() == 2); + bool rows = (nargin == 3 && args (2).uint_value () == 2); if (nargin >= 2) {
--- a/src/DLD-FUNCTIONS/amd.cc +++ b/src/DLD-FUNCTIONS/amd.cc @@ -190,7 +190,7 @@ for (octave_idx_type i = 0; i < n_col; i++) Pout.xelem (i) = P[i] + 1; - retval (0) = Pout; + retval(0) = Pout; } } }
--- a/src/DLD-FUNCTIONS/balance.cc +++ b/src/DLD-FUNCTIONS/balance.cc @@ -104,14 +104,14 @@ // problem dimension octave_idx_type nn = args(0).rows (); - if (nn != args(0).columns()) + if (nn != args(0).columns ()) { gripe_square_matrix_required ("balance"); return retval; } bool isfloat = args(0).is_single_type () || - (! AEPcase && args(1).is_single_type()); + (! AEPcase && args(1).is_single_type ()); bool complex_case = (args(0).is_complex_type () || (! AEPcase && args(1).is_complex_type ()));
--- a/src/DLD-FUNCTIONS/betainc.cc +++ b/src/DLD-FUNCTIONS/betainc.cc @@ -62,6 +62,7 @@ If @var{x} has more than one component, both @var{a} and @var{b} must be\n\ scalars. If @var{x} is a scalar, @var{a} and @var{b} must be of\n\ compatible dimensions.\n\ +@seealso{betaincinv, beta, betaln}\n\ @end deftypefn") { octave_value retval; @@ -448,10 +449,10 @@ } } - // FIXME: It would be better to have an algorithm for betaincinv which accepted - // float inputs and returned float outputs. As it is, we do extra work - // to calculate betaincinv to double precision and then throw that precision - // away. + // FIXME: It would be better to have an algorithm for betaincinv which + // accepted float inputs and returned float outputs. As it is, we do + // extra work to calculate betaincinv to double precision and then throw + // that precision away. if (x_arg.is_single_type () || a_arg.is_single_type () || b_arg.is_single_type ()) {
--- a/src/DLD-FUNCTIONS/bsxfun.cc +++ b/src/DLD-FUNCTIONS/bsxfun.cc @@ -442,7 +442,7 @@ octave_value_list idxB; octave_value C; octave_value_list inputs; - Array<int> ra_idx (dim_vector (dvc.length(), 1), 0); + Array<int> ra_idx (dim_vector (dvc.length (), 1), 0); for (octave_idx_type i = 0; i < ncount; i++) @@ -549,7 +549,7 @@ result_ComplexNDArray = ComplexNDArray (result_FloatNDArray); result_ComplexNDArray.insert - (tmp(0).complex_array_value(), ra_idx); + (tmp(0).complex_array_value (), ra_idx); have_FloatComplexNDArray = false; have_ComplexNDArray = true; } @@ -558,20 +558,20 @@ result_NDArray = NDArray (result_FloatNDArray); result_NDArray.insert - (tmp(0).array_value(), ra_idx); + (tmp(0).array_value (), ra_idx); have_FloatNDArray = false; have_NDArray = true; } } else if (tmp(0).is_real_type ()) result_FloatNDArray.insert - (tmp(0).float_array_value(), ra_idx); + (tmp(0).float_array_value (), ra_idx); else { result_FloatComplexNDArray = FloatComplexNDArray (result_FloatNDArray); result_FloatComplexNDArray.insert - (tmp(0).float_complex_array_value(), ra_idx); + (tmp(0).float_complex_array_value (), ra_idx); have_FloatNDArray = false; have_FloatComplexNDArray = true; } @@ -585,14 +585,14 @@ C = do_cat_op (C, tmp(0), ra_idx); } else if (tmp(0).is_real_type ()) - result_NDArray.insert (tmp(0).array_value(), + result_NDArray.insert (tmp(0).array_value (), ra_idx); else { result_ComplexNDArray = ComplexNDArray (result_NDArray); result_ComplexNDArray.insert - (tmp(0).complex_array_value(), ra_idx); + (tmp(0).complex_array_value (), ra_idx); have_NDArray = false; have_ComplexNDArray = true; } @@ -630,7 +630,7 @@ #define BSXEND(T) \ (have_ ## T) \ - retval (0) = result_ ## T; + retval(0) = result_ ## T; if BSXEND(NDArray) else if BSXEND(ComplexNDArray)
--- a/src/DLD-FUNCTIONS/ccolamd.cc +++ b/src/DLD-FUNCTIONS/ccolamd.cc @@ -270,8 +270,8 @@ if (nargin > 2) { - NDArray in_cmember = args(2).array_value(); - octave_idx_type cslen = in_cmember.length(); + NDArray in_cmember = args(2).array_value (); + octave_idx_type cslen = in_cmember.length (); OCTAVE_LOCAL_BUFFER (octave_idx_type, cmember, cslen); for (octave_idx_type i = 0; i < cslen; i++) // convert cmember from 1-based to 0-based @@ -304,7 +304,7 @@ for (octave_idx_type i = 0; i < n_col; i++) out_perm(i) = p [i] + 1; - retval (0) = out_perm; + retval(0) = out_perm; // print stats if spumoni > 0 if (spumoni > 0) @@ -502,8 +502,8 @@ if (nargin > 2) { - NDArray in_cmember = args(2).array_value(); - octave_idx_type cslen = in_cmember.length(); + NDArray in_cmember = args(2).array_value (); + octave_idx_type cslen = in_cmember.length (); OCTAVE_LOCAL_BUFFER (octave_idx_type, cmember, cslen); for (octave_idx_type i = 0; i < cslen; i++) // convert cmember from 1-based to 0-based @@ -536,7 +536,7 @@ for (octave_idx_type i = 0; i < n_col; i++) out_perm(i) = perm [i] + 1; - retval (0) = out_perm; + retval(0) = out_perm; // Return the stats vector if (nargout == 2)
--- a/src/DLD-FUNCTIONS/cellfun.cc +++ b/src/DLD-FUNCTIONS/cellfun.cc @@ -184,10 +184,10 @@ { if (nargin == 3) { - std::string class_name = args(2).string_value(); + std::string class_name = args(2).string_value (); boolNDArray result (f_args.dims ()); for (octave_idx_type count = 0; count < k; count++) - result(count) = (f_args.elem(count).class_name() == class_name); + result(count) = (f_args.elem(count).class_name () == class_name); retval(0) = result; } @@ -209,7 +209,7 @@ size_t compare_len = std::max (arg.length (), static_cast<size_t> (2)); if (arg.compare ("uniformoutput", compare_len)) - uniform_output = args(nargin-1).bool_value(); + uniform_output = args(nargin-1).bool_value (); else if (arg.compare ("errorhandler", compare_len)) { if (args(nargin-1).is_function_handle () @@ -239,7 +239,7 @@ else { error ("cellfun: unrecognized parameter %s", - arg.c_str()); + arg.c_str ()); break; } @@ -1839,7 +1839,7 @@ @seealso{mat2cell}\n\ @end deftypefn") { - int nargin = args.length(); + int nargin = args.length (); octave_value retval; if (nargin < 1 || nargin > 2) @@ -2177,7 +2177,7 @@ @seealso{num2cell, cell2mat}\n\ @end deftypefn") { - int nargin = args.length(); + int nargin = args.length (); octave_value retval; if (nargin < 2)
--- a/src/DLD-FUNCTIONS/chol.cc +++ b/src/DLD-FUNCTIONS/chol.cc @@ -204,16 +204,16 @@ if (vecout) retval(2) = fact.perm (); else - retval(2) = fact.Q(); + retval(2) = fact.Q (); } if (nargout > 1 || info == 0) { - retval(1) = fact.P(); + retval(1) = fact.P (); if (LLt) - retval(0) = fact.L(); + retval(0) = fact.L (); else - retval(0) = fact.R(); + retval(0) = fact.R (); } else error ("chol: input matrix must be positive definite"); @@ -233,16 +233,16 @@ if (vecout) retval(2) = fact.perm (); else - retval(2) = fact.Q(); + retval(2) = fact.Q (); } if (nargout > 1 || info == 0) { - retval(1) = fact.P(); + retval(1) = fact.P (); if (LLt) - retval(0) = fact.L(); + retval(0) = fact.L (); else - retval(0) = fact.R(); + retval(0) = fact.R (); } else error ("chol: input matrix must be positive definite");
--- a/src/DLD-FUNCTIONS/daspk.cc +++ b/src/DLD-FUNCTIONS/daspk.cc @@ -297,9 +297,9 @@ if (f_arg.is_cell ()) { Cell c = f_arg.cell_value (); - if (c.length() == 1) + if (c.length () == 1) f_arg = c(0); - else if (c.length() == 2) + else if (c.length () == 2) { if (c(0).is_function_handle () || c(0).is_inline_function ()) daspk_fcn = c(0).function_value (); @@ -328,7 +328,7 @@ if (!daspk_jac) { - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); daspk_fcn = 0; } @@ -339,7 +339,7 @@ DASPK_ABORT1 ("incorrect number of elements in cell array"); } - if (!daspk_fcn && ! f_arg.is_cell()) + if (!daspk_fcn && ! f_arg.is_cell ()) { if (f_arg.is_function_handle () || f_arg.is_inline_function ()) daspk_fcn = f_arg.function_value (); @@ -385,7 +385,7 @@ if (!daspk_jac) { - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); daspk_fcn = 0; } @@ -446,9 +446,9 @@ else output = dae.integrate (out_times, deriv_output); - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); - if (jac_name.length()) + if (jac_name.length ()) clear_function (jac_name); if (! error_state)
--- a/src/DLD-FUNCTIONS/dasrt.cc +++ b/src/DLD-FUNCTIONS/dasrt.cc @@ -385,9 +385,9 @@ if (f_arg.is_cell ()) { Cell c = f_arg.cell_value (); - if (c.length() == 1) + if (c.length () == 1) f_arg = c(0); - else if (c.length() == 2) + else if (c.length () == 2) { if (c(0).is_function_handle () || c(0).is_inline_function ()) dasrt_f = c(0).function_value (); @@ -416,7 +416,7 @@ if (!dasrt_j) { - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); dasrt_f = 0; } @@ -427,7 +427,7 @@ DASRT_ABORT1 ("incorrect number of elements in cell array"); } - if (!dasrt_f && ! f_arg.is_cell()) + if (!dasrt_f && ! f_arg.is_cell ()) { if (f_arg.is_function_handle () || f_arg.is_inline_function ()) dasrt_f = f_arg.function_value (); @@ -487,9 +487,9 @@ argp++; - if (args(1).is_function_handle() || args(1).is_inline_function()) + if (args(1).is_function_handle () || args(1).is_inline_function ()) { - dasrt_cf = args(1).function_value(); + dasrt_cf = args(1).function_value (); if (! dasrt_cf) DASRT_ABORT1 ("expecting function name as argument 2"); @@ -557,9 +557,9 @@ else output = dae.integrate (out_times); - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); - if (jac_name.length()) + if (jac_name.length ()) clear_function (jac_name); if (! error_state)
--- a/src/DLD-FUNCTIONS/dassl.cc +++ b/src/DLD-FUNCTIONS/dassl.cc @@ -298,9 +298,9 @@ if (f_arg.is_cell ()) { Cell c = f_arg.cell_value (); - if (c.length() == 1) + if (c.length () == 1) f_arg = c(0); - else if (c.length() == 2) + else if (c.length () == 2) { if (c(0).is_function_handle () || c(0).is_inline_function ()) dassl_fcn = c(0).function_value (); @@ -329,7 +329,7 @@ if (!dassl_jac) { - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); dassl_fcn = 0; } @@ -340,7 +340,7 @@ DASSL_ABORT1 ("incorrect number of elements in cell array"); } - if (!dassl_fcn && ! f_arg.is_cell()) + if (!dassl_fcn && ! f_arg.is_cell ()) { if (f_arg.is_function_handle () || f_arg.is_inline_function ()) dassl_fcn = f_arg.function_value (); @@ -386,7 +386,7 @@ if (!dassl_jac) { - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); dassl_fcn = 0; } @@ -448,9 +448,9 @@ else output = dae.integrate (out_times, deriv_output); - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); - if (jac_name.length()) + if (jac_name.length ()) clear_function (jac_name); if (! error_state)
--- a/src/DLD-FUNCTIONS/dmperm.cc +++ b/src/DLD-FUNCTIONS/dmperm.cc @@ -70,14 +70,14 @@ if (arg.is_real_type ()) { m = arg.sparse_matrix_value (); - csm.nzmax = m.nnz(); + csm.nzmax = m.nnz (); csm.p = m.xcidx (); csm.i = m.xridx (); } else { cm = arg.sparse_complex_matrix_value (); - csm.nzmax = cm.nnz(); + csm.nzmax = cm.nnz (); csm.p = cm.xcidx (); csm.i = cm.xridx (); } @@ -153,7 +153,7 @@ @seealso{colamd, ccolamd}\n\ @end deftypefn") { - int nargin = args.length(); + int nargin = args.length (); octave_value_list retval; if (nargin != 1) @@ -201,7 +201,7 @@ @seealso{dmperm}\n\ @end deftypefn") { - int nargin = args.length(); + int nargin = args.length (); octave_value_list retval; if (nargin != 1)
--- a/src/DLD-FUNCTIONS/eig.cc +++ b/src/DLD-FUNCTIONS/eig.cc @@ -93,7 +93,7 @@ else if (arg_is_empty > 0) return octave_value_list (2, Matrix ()); - if (!(arg_b.is_single_type() || arg_b.is_double_type ())) + if (!(arg_b.is_single_type () || arg_b.is_double_type ())) { gripe_wrong_type_arg ("eig", arg_b); return retval;
--- a/src/DLD-FUNCTIONS/eigs.cc +++ b/src/DLD-FUNCTIONS/eigs.cc @@ -346,7 +346,7 @@ if (call_depth > 1) { error ("eigs: invalid recursive call"); - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); return retval; } @@ -393,11 +393,11 @@ { if (args(0).is_sparse_type ()) { - ascm = (args(0).sparse_complex_matrix_value()); + ascm = (args(0).sparse_complex_matrix_value ()); a_is_sparse = true; } else - acm = (args(0).complex_matrix_value()); + acm = (args(0).complex_matrix_value ()); a_is_complex = true; symmetric = false; // ARPACK doesn't special case complex symmetric sym_tested = true; @@ -406,12 +406,12 @@ { if (args(0).is_sparse_type ()) { - asmm = (args(0).sparse_matrix_value()); + asmm = (args(0).sparse_matrix_value ()); a_is_sparse = true; } else { - amm = (args(0).matrix_value()); + amm = (args(0).matrix_value ()); } } @@ -547,9 +547,9 @@ if (!sym_tested && !have_a_fun) { if (a_is_sparse) - symmetric = asmm.is_symmetric(); + symmetric = asmm.is_symmetric (); else - symmetric = amm.is_symmetric(); + symmetric = amm.is_symmetric (); } if (have_b) @@ -613,7 +613,7 @@ } if (nargout < 2) - retval (0) = eig_val; + retval(0) = eig_val; else { retval(2) = double (info); @@ -646,7 +646,7 @@ } if (nargout < 2) - retval (0) = eig_val; + retval(0) = eig_val; else { retval(2) = double (info); @@ -694,7 +694,7 @@ } if (nargout < 2) - retval (0) = eig_val; + retval(0) = eig_val; else { retval(2) = double (info); @@ -740,7 +740,7 @@ } if (nargout < 2) - retval (0) = eig_val; + retval(0) = eig_val; else { retval(2) = double (info);
--- a/src/DLD-FUNCTIONS/fftw.cc +++ b/src/DLD-FUNCTIONS/fftw.cc @@ -115,7 +115,7 @@ { octave_value retval; - int nargin = args.length(); + int nargin = args.length (); if (nargin < 1 || nargin > 2) { @@ -196,9 +196,9 @@ { char *str = fftw_export_wisdom_to_string (); - if (arg1.length() < 1) + if (arg1.length () < 1) fftw_forget_wisdom (); - else if (! fftw_import_wisdom_from_string (arg1.c_str())) + else if (! fftw_import_wisdom_from_string (arg1.c_str ())) error ("could not import supplied WISDOM"); if (!error_state) @@ -210,9 +210,9 @@ { char *str = fftwf_export_wisdom_to_string (); - if (arg1.length() < 1) + if (arg1.length () < 1) fftwf_forget_wisdom (); - else if (! fftwf_import_wisdom_from_string (arg1.c_str())) + else if (! fftwf_import_wisdom_from_string (arg1.c_str ())) error ("could not import supplied WISDOM"); if (!error_state)
--- a/src/DLD-FUNCTIONS/filter.cc +++ b/src/DLD-FUNCTIONS/filter.cc @@ -252,7 +252,7 @@ MArray<T> filter (MArray<T>& b, MArray<T>& a, MArray<T>& x, int dim = -1) { - dim_vector x_dims = x.dims(); + dim_vector x_dims = x.dims (); if (dim < 0) { @@ -315,13 +315,15 @@ @noindent\n\ where\n\ @ifnottex\n\ - N=length(a)-1 and M=length(b)-1.\n\ +N=length(a)-1 and M=length(b)-1.\n\ @end ifnottex\n\ @tex\n\ - $a \\in \\Re^{N-1}$, $b \\in \\Re^{M-1}$, and $x \\in \\Re^P$.\n\ +$a \\in \\Re^{N-1}$, $b \\in \\Re^{M-1}$, and $x \\in \\Re^P$.\n\ @end tex\n\ -over the first non-singleton dimension of @var{x} or over @var{dim} if\n\ -supplied. An equivalent form of this equation is:\n\ +The result is calculated over the first non-singleton dimension of @var{x}\n\ +or over @var{dim} if supplied.\n\ +\n\ +An equivalent form of the equation is:\n\ @tex\n\ $$\n\ y_n = -\\sum_{k=1}^N c_{k+1} y_{n-k} + \\sum_{k=0}^M d_{k+1} x_{n-k}, \\qquad\n\ @@ -401,7 +403,7 @@ if (nargin == 5) { - dim = args(4).nint_value() - 1; + dim = args(4).nint_value () - 1; if (dim < 0 || dim >= x_dims.length ()) { error ("filter: DIM must be a valid dimension");
--- a/src/DLD-FUNCTIONS/find.cc +++ b/src/DLD-FUNCTIONS/find.cc @@ -89,9 +89,9 @@ octave_value_list retval ((nargout == 0 ? 1 : nargout), Matrix ()); - octave_idx_type nc = v.cols(); - octave_idx_type nr = v.rows(); - octave_idx_type nz = v.nnz(); + octave_idx_type nc = v.cols (); + octave_idx_type nr = v.rows (); + octave_idx_type nz = v.nnz (); // Search in the default range. octave_idx_type start_nc = -1; @@ -231,7 +231,7 @@ // There are far fewer special cases to handle for a PermMatrix. octave_value_list retval ((nargout == 0 ? 1 : nargout), Matrix ()); - octave_idx_type nc = v.cols(); + octave_idx_type nc = v.cols (); octave_idx_type start_nc, count; // Determine the range to search.
--- a/src/DLD-FUNCTIONS/kron.cc +++ b/src/DLD-FUNCTIONS/kron.cc @@ -82,7 +82,7 @@ octave_idx_type nra = a.rows (), nrb = b.rows (), dla = a.diag_length (); octave_idx_type nca = a.cols (), ncb = b.cols (); - MArray<T> c (dim_vector (nra*nrb, nca*ncb), T()); + MArray<T> c (dim_vector (nra*nrb, nca*ncb), T ()); for (octave_idx_type ja = 0; ja < dla; ja++) for (octave_idx_type jb = 0; jb < ncb; jb++)
--- a/src/DLD-FUNCTIONS/lookup.cc +++ b/src/DLD-FUNCTIONS/lookup.cc @@ -70,7 +70,7 @@ { return std::lexicographical_compare (a.begin (), a.end (), b.begin (), b.end (), - icmp_char_lt()); + icmp_char_lt ()); } // case-insensitive descending comparator @@ -79,7 +79,7 @@ { return std::lexicographical_compare (a.begin (), a.end (), b.begin (), b.end (), - icmp_char_gt()); + icmp_char_gt ()); } #endif
--- a/src/DLD-FUNCTIONS/lsode.cc +++ b/src/DLD-FUNCTIONS/lsode.cc @@ -298,9 +298,9 @@ if (f_arg.is_cell ()) { Cell c = f_arg.cell_value (); - if (c.length() == 1) + if (c.length () == 1) f_arg = c(0); - else if (c.length() == 2) + else if (c.length () == 2) { if (c(0).is_function_handle () || c(0).is_inline_function ()) lsode_fcn = c(0).function_value (); @@ -329,7 +329,7 @@ if (!lsode_jac) { - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); lsode_fcn = 0; } @@ -340,7 +340,7 @@ LSODE_ABORT1 ("incorrect number of elements in cell array"); } - if (!lsode_fcn && ! f_arg.is_cell()) + if (!lsode_fcn && ! f_arg.is_cell ()) { if (f_arg.is_function_handle () || f_arg.is_inline_function ()) lsode_fcn = f_arg.function_value (); @@ -386,7 +386,7 @@ if (!lsode_jac) { - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); lsode_fcn = 0; } @@ -444,9 +444,9 @@ else output = ode.integrate (out_times); - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); - if (jac_name.length()) + if (jac_name.length ()) clear_function (jac_name); if (! error_state)
--- a/src/DLD-FUNCTIONS/lu.cc +++ b/src/DLD-FUNCTIONS/lu.cc @@ -226,7 +226,7 @@ SparseLU fact (m, Qinit, thres, false, true); if (nargout < 2) - retval (0) = fact.Y (); + retval(0) = fact.Y (); else { PermMatrix P = fact.Pr_mat (); @@ -246,7 +246,7 @@ SparseLU fact (m, Qinit, thres, false, true); if (vecout) - retval (2) = fact.Pr_vec (); + retval(2) = fact.Pr_vec (); else retval(2) = fact.Pr_mat (); @@ -296,7 +296,7 @@ SparseComplexLU fact (m, Qinit, thres, false, true); if (nargout < 2) - retval (0) = fact.Y (); + retval(0) = fact.Y (); else { PermMatrix P = fact.Pr_mat (); @@ -316,7 +316,7 @@ SparseComplexLU fact (m, Qinit, thres, false, true); if (vecout) - retval (2) = fact.Pr_vec (); + retval(2) = fact.Pr_vec (); else retval(2) = fact.Pr_mat ();
--- a/src/DLD-FUNCTIONS/matrix_type.cc +++ b/src/DLD-FUNCTIONS/matrix_type.cc @@ -129,7 +129,7 @@ autocomp = false; } - if (args(0).is_scalar_type()) + if (args(0).is_scalar_type ()) { if (nargin == 1) retval = octave_value ("Diagonal"); @@ -198,7 +198,7 @@ retval = octave_value ("Positive Definite"); else if (typ == MatrixType::Rectangular) { - if (args(0).rows() == args(0).columns()) + if (args(0).rows () == args(0).columns ()) retval = octave_value ("Singular"); else retval = octave_value ("Rectangular"); @@ -270,7 +270,7 @@ else if (str_typ == "unknown") mattyp.invalidate_type (); else - error ("matrix_type: Unknown matrix type %s", str_typ.c_str()); + error ("matrix_type: Unknown matrix type %s", str_typ.c_str ()); if (! error_state) { @@ -394,7 +394,7 @@ retval = octave_value ("Positive Definite"); else if (typ == MatrixType::Rectangular) { - if (args(0).rows() == args(0).columns()) + if (args(0).rows () == args(0).columns ()) retval = octave_value ("Singular"); else retval = octave_value ("Rectangular"); @@ -436,7 +436,7 @@ else if (str_typ == "unknown") mattyp.invalidate_type (); else - error ("matrix_type: Unknown matrix type %s", str_typ.c_str()); + error ("matrix_type: Unknown matrix type %s", str_typ.c_str ()); if (! error_state) { @@ -477,7 +477,7 @@ // Set the matrix type if (args(0).is_single_type ()) { - if (args(0).is_complex_type()) + if (args(0).is_complex_type ()) retval = octave_value (args(0).float_complex_matrix_value (), mattyp); @@ -488,7 +488,7 @@ } else { - if (args(0).is_complex_type()) + if (args(0).is_complex_type ()) retval = octave_value (args(0).complex_matrix_value (), mattyp);
--- a/src/DLD-FUNCTIONS/md5sum.cc +++ b/src/DLD-FUNCTIONS/md5sum.cc @@ -49,14 +49,14 @@ int nargin = args.length (); if (nargin != 1 && nargin != 2) - print_usage(); + print_usage (); else { bool have_str = false; - std::string str = args(0).string_value(); + std::string str = args(0).string_value (); if (nargin == 2) - have_str = args(1).bool_value(); + have_str = args(1).bool_value (); if (!error_state) {
--- a/src/DLD-FUNCTIONS/mgorth.cc +++ b/src/DLD-FUNCTIONS/mgorth.cc @@ -67,7 +67,7 @@ { octave_value_list retval; - int nargin = args.length(); + int nargin = args.length (); if (nargin != 2 || nargout > 2) {
--- a/src/DLD-FUNCTIONS/qr.cc +++ b/src/DLD-FUNCTIONS/qr.cc @@ -200,7 +200,7 @@ int nargin = args.length (); - if (nargin < 1 || nargin > (args(0).is_sparse_type() ? 3 : 2)) + if (nargin < 1 || nargin > (args(0).is_sparse_type () ? 3 : 2)) { print_usage (); return retval; @@ -250,7 +250,7 @@ { retval(1) = q.R (economy); retval(0) = q.C (args(have_b).complex_matrix_value ()); - if (arg.rows() < arg.columns()) + if (arg.rows () < arg.columns ()) warning ("qr: non minimum norm solution for under-determined problem"); } else if (nargout > 1) @@ -271,7 +271,7 @@ { retval(1) = q.R (economy); retval(0) = q.C (args(have_b).matrix_value ()); - if (args(0).rows() < args(0).columns()) + if (args(0).rows () < args(0).columns ()) warning ("qr: non minimum norm solution for under-determined problem"); } else if (nargout > 1)
--- a/src/DLD-FUNCTIONS/quad.cc +++ b/src/DLD-FUNCTIONS/quad.cc @@ -150,7 +150,7 @@ #define QUAD_ABORT() \ do \ { \ - if (fcn_name.length()) \ + if (fcn_name.length ()) \ clear_function (fcn_name); \ return retval; \ } \ @@ -463,7 +463,7 @@ retval(0) = val; } - if (fcn_name.length()) + if (fcn_name.length ()) clear_function (fcn_name); } else
--- a/src/DLD-FUNCTIONS/qz.cc +++ b/src/DLD-FUNCTIONS/qz.cc @@ -1196,7 +1196,7 @@ if (complex_case) { #ifdef DEBUG - std::cout << "qz: retval (1) = cbb = " << std::endl; + std::cout << "qz: retval(1) = cbb = " << std::endl; octave_print_internal (std::cout, cbb, 0); std::cout << std::endl << "qz: retval(0) = caa = " <<std::endl; octave_print_internal (std::cout, caa, 0); @@ -1208,7 +1208,7 @@ else { #ifdef DEBUG - std::cout << "qz: retval (1) = bb = " << std::endl; + std::cout << "qz: retval(1) = bb = " << std::endl; octave_print_internal (std::cout, bb, 0); std::cout << std::endl << "qz: retval(0) = aa = " <<std::endl; octave_print_internal (std::cout, aa, 0);
--- a/src/DLD-FUNCTIONS/rand.cc +++ b/src/DLD-FUNCTIONS/rand.cc @@ -70,7 +70,7 @@ octave_rand::distribution (distribution); - if (nargin > 0 && args(nargin-1).is_string()) + if (nargin > 0 && args(nargin-1).is_string ()) { std::string s_arg = args(nargin-1).string_value (); @@ -90,7 +90,7 @@ error ("%s: expecting at least one argument", fcn); goto done; } - else if (args(0).is_string()) + else if (args(0).is_string ()) additional_arg = false; else { @@ -261,7 +261,7 @@ octave_rand::seed (d); } else if (args(idx+1).is_string () - && args(idx+1).string_value() == "reset") + && args(idx+1).string_value () == "reset") octave_rand::reset (); else error ("%s: seed must be a real scalar", fcn); @@ -269,7 +269,7 @@ else if (ts == "state" || ts == "twister") { if (args(idx+1).is_string () - && args(idx+1).string_value() == "reset") + && args(idx+1).string_value () == "reset") octave_rand::reset (fcn); else { @@ -317,11 +317,11 @@ { if (additional_arg) { - if (a.length() == 1) + if (a.length () == 1) return octave_rand::float_nd_array (dims, a(0)); else { - if (a.dims() != dims) + if (a.dims () != dims) { error ("%s: mismatch in argument size", fcn); return retval; @@ -341,11 +341,11 @@ { if (additional_arg) { - if (a.length() == 1) + if (a.length () == 1) return octave_rand::nd_array (dims, a(0)); else { - if (a.dims() != dims) + if (a.dims () != dims) { error ("%s: mismatch in argument size", fcn); return retval;
--- a/src/DLD-FUNCTIONS/regexp.cc +++ b/src/DLD-FUNCTIONS/regexp.cc @@ -231,7 +231,7 @@ if (sz == 1) { - string_vector named_tokens = rx_lst.begin()->named_tokens (); + string_vector named_tokens = rx_lst.begin ()->named_tokens (); for (int j = 0; j < named_pats.length (); j++) nmap.assign (named_pats(j), named_tokens(j)); @@ -1311,9 +1311,9 @@ for (octave_idx_type i = 0; i < dv0.numel (); i++) { new_args(0) = str(i); - if (pat.numel() == 1) + if (pat.numel () == 1) new_args(1) = pat(0); - if (rep.numel() == 1) + if (rep.numel () == 1) new_args(2) = rep(0); for (octave_idx_type j = 0; j < dv1.numel (); j++)
--- a/src/DLD-FUNCTIONS/spparms.cc +++ b/src/DLD-FUNCTIONS/spparms.cc @@ -113,8 +113,8 @@ retval(0) = octave_sparse_params::get_vals (); else if (nargout == 2) { - retval (1) = octave_sparse_params::get_vals (); - retval (0) = octave_sparse_params::get_keys (); + retval(1) = octave_sparse_params::get_vals (); + retval(0) = octave_sparse_params::get_keys (); } else error ("spparms: too many output arguments"); @@ -138,7 +138,7 @@ if (xisnan (val)) error ("spparms: KEY not recognized"); else - retval (0) = val; + retval(0) = val; } } else
--- a/src/DLD-FUNCTIONS/symbfact.cc +++ b/src/DLD-FUNCTIONS/symbfact.cc @@ -143,29 +143,29 @@ if (args(0).is_real_type ()) { - const SparseMatrix a = args(0).sparse_matrix_value(); - A->nrow = a.rows(); - A->ncol = a.cols(); - A->p = a.cidx(); - A->i = a.ridx(); - A->nzmax = a.nnz(); + const SparseMatrix a = args(0).sparse_matrix_value (); + A->nrow = a.rows (); + A->ncol = a.cols (); + A->p = a.cidx (); + A->i = a.ridx (); + A->nzmax = a.nnz (); A->xtype = CHOLMOD_REAL; - if (a.rows() > 0 && a.cols() > 0) - A->x = a.data(); + if (a.rows () > 0 && a.cols () > 0) + A->x = a.data (); } else if (args(0).is_complex_type ()) { - const SparseComplexMatrix a = args(0).sparse_complex_matrix_value(); - A->nrow = a.rows(); - A->ncol = a.cols(); - A->p = a.cidx(); - A->i = a.ridx(); - A->nzmax = a.nnz(); + const SparseComplexMatrix a = args(0).sparse_complex_matrix_value (); + A->nrow = a.rows (); + A->ncol = a.cols (); + A->p = a.cidx (); + A->i = a.ridx (); + A->nzmax = a.nnz (); A->xtype = CHOLMOD_COMPLEX; - if (a.rows() > 0 && a.cols() > 0) - A->x = a.data(); + if (a.rows () > 0 && a.cols () > 0) + A->x = a.data (); } else gripe_wrong_type_arg ("symbfact", args(0)); @@ -176,8 +176,8 @@ if (nargin > 1) { char ch; - std::string str = args(1).string_value(); - ch = tolower (str.c_str()[0]); + std::string str = args(1).string_value (); + ch = tolower (str.c_str ()[0]); if (ch == 'r') A->stype = 0; else if (ch == 'c')
--- a/src/DLD-FUNCTIONS/tril.cc +++ b/src/DLD-FUNCTIONS/tril.cc @@ -69,7 +69,7 @@ for (octave_idx_type j = 0; j < nc; j++) { octave_idx_type ii = std::min (std::max (zero, j - k), nr); - std::fill (rvec, rvec + ii, T()); + std::fill (rvec, rvec + ii, T ()); std::copy (avec + ii, avec + nr, rvec + ii); avec += nr; rvec += nr; @@ -111,7 +111,7 @@ { octave_idx_type ii = std::min (std::max (zero, j + 1 - k), nr); std::copy (avec, avec + ii, rvec); - std::fill (rvec + ii, rvec + nr, T()); + std::fill (rvec + ii, rvec + nr, T ()); avec += nr; rvec += nr; } @@ -134,7 +134,7 @@ } Sparse<T> m = a; - octave_idx_type nc = m.cols(); + octave_idx_type nc = m.cols (); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) @@ -156,7 +156,7 @@ } Sparse<T> m = a; - octave_idx_type nc = m.cols(); + octave_idx_type nc = m.cols (); for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++)
--- a/src/DLD-FUNCTIONS/urlwrite.cc +++ b/src/DLD-FUNCTIONS/urlwrite.cc @@ -188,7 +188,7 @@ init (user, passwd, std::cin, octave_stdout); std::string url = "ftp://" + _host; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); // Setup the link, with no transfer if (!error_state) @@ -220,7 +220,7 @@ setopt (CURLOPT_POSTFIELDS, query_string.c_str ()); } else - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); if (!error_state) retval = perform (false); @@ -296,7 +296,7 @@ { struct curl_slist *slist = 0; std::string cmd = "cwd " + path; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); setopt (CURLOPT_POSTQUOTE, slist); if (! error_state) perform (); @@ -308,7 +308,7 @@ { struct curl_slist *slist = 0; std::string cmd = "dele " + file; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); setopt (CURLOPT_POSTQUOTE, slist); if (! error_state) perform (); @@ -320,7 +320,7 @@ { struct curl_slist *slist = 0; std::string cmd = "rmd " + path; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); setopt (CURLOPT_POSTQUOTE, slist); if (! error_state) perform (); @@ -333,7 +333,7 @@ bool retval = false; struct curl_slist *slist = 0; std::string cmd = "mkd " + path; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); setopt (CURLOPT_POSTQUOTE, slist); if (! error_state) retval = perform (curlerror); @@ -346,9 +346,9 @@ { struct curl_slist *slist = 0; std::string cmd = "rnfr " + oldname; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); cmd = "rnto " + newname; - slist = curl_slist_append (slist, cmd.c_str()); + slist = curl_slist_append (slist, cmd.c_str ()); setopt (CURLOPT_POSTQUOTE, slist); if (! error_state) perform (); @@ -359,7 +359,7 @@ void put (const std::string& file, std::istream& is) const { std::string url = "ftp://" + rep->host + "/" + file; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); setopt (CURLOPT_UPLOAD, 1); setopt (CURLOPT_NOBODY, 0); set_istream (is); @@ -369,13 +369,13 @@ setopt (CURLOPT_NOBODY, 1); setopt (CURLOPT_UPLOAD, 0); url = "ftp://" + rep->host; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); } void get (const std::string& file, std::ostream& os) const { std::string url = "ftp://" + rep->host + "/" + file; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); setopt (CURLOPT_NOBODY, 0); set_ostream (os); if (! error_state) @@ -383,19 +383,19 @@ set_ostream (octave_stdout); setopt (CURLOPT_NOBODY, 1); url = "ftp://" + rep->host; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); } void dir (void) const { std::string url = "ftp://" + rep->host + "/"; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); setopt (CURLOPT_NOBODY, 0); if (! error_state) perform (); setopt (CURLOPT_NOBODY, 1); url = "ftp://" + rep->host; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); } string_vector list (void) const @@ -403,7 +403,7 @@ std::ostringstream buf; std::string url = "ftp://" + rep->host + "/"; setopt (CURLOPT_WRITEDATA, static_cast<void*> (&buf)); - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); setopt (CURLOPT_DIRLISTONLY, 1); setopt (CURLOPT_NOBODY, 0); if (! error_state) @@ -412,7 +412,7 @@ url = "ftp://" + rep->host; setopt (CURLOPT_WRITEDATA, static_cast<void*> (&octave_stdout)); setopt (CURLOPT_DIRLISTONLY, 0); - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); // Count number of directory entries std::string str = buf.str (); @@ -443,10 +443,10 @@ void get_fileinfo (const std::string& filename, double& filesize, time_t& filetime, bool& fileisdir) const { - std::string path = pwd(); + std::string path = pwd (); std::string url = "ftp://" + rep->host + "/" + path + "/" + filename; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); setopt (CURLOPT_FILETIME, 1); setopt (CURLOPT_HEADERFUNCTION, throw_away); setopt (CURLOPT_WRITEFUNCTION, throw_away); @@ -480,7 +480,7 @@ setopt (CURLOPT_HEADERFUNCTION, 0); setopt (CURLOPT_FILETIME, 0); url = "ftp://" + rep->host; - setopt (CURLOPT_URL, url.c_str()); + setopt (CURLOPT_URL, url.c_str ()); // The MDTM command seems to reset the path to the root with the // servers I tested with, so cd again into the correct path. Make @@ -503,7 +503,7 @@ if (! error_state) { perform (); - retval = buf.str(); + retval = buf.str (); // Can I assume that the path is alway in "" on the last line size_t pos2 = retval.rfind ('"'); @@ -536,9 +536,9 @@ std::string text = param(i+1).string_value (); // Encode strings. - char *enc_name = curl_easy_escape (rep->handle(), name.c_str (), + char *enc_name = curl_easy_escape (rep->handle (), name.c_str (), name.length ()); - char *enc_text = curl_easy_escape (rep->handle(), text.c_str (), + char *enc_text = curl_easy_escape (rep->handle (), text.c_str (), text.length ()); query << enc_name << "=" << enc_text; @@ -546,7 +546,7 @@ curl_free (enc_name); curl_free (enc_text); - if (i < param.numel()-1) + if (i < param.numel ()-1) query << "&"; } @@ -615,7 +615,7 @@ { // Remove the elements of the map explicitly as they should // be deleted before the call to curl_global_cleanup - map.erase (begin(), end()); + map.erase (begin (), end ()); curl_global_cleanup (); } @@ -741,7 +741,7 @@ return retval; } - std::string url = args(0).string_value(); + std::string url = args(0).string_value (); if (error_state) { @@ -750,7 +750,7 @@ } // name to store the file if download is succesful - std::string filename = args(1).string_value(); + std::string filename = args(1).string_value (); if (error_state) { @@ -763,7 +763,7 @@ if (nargin == 4) { - method = args(2).string_value(); + method = args(2).string_value (); if (error_state) { @@ -777,7 +777,7 @@ return retval; } - param = args(3).cell_value(); + param = args(3).cell_value (); if (error_state) { @@ -799,7 +799,7 @@ file_stat fs (filename); - std::ofstream ofile (filename.c_str(), std::ios::out | std::ios::binary); + std::ofstream ofile (filename.c_str (), std::ios::out | std::ios::binary); if (! ofile.is_open ()) { @@ -901,7 +901,7 @@ return retval; } - std::string url = args(0).string_value(); + std::string url = args(0).string_value (); if (error_state) { @@ -914,7 +914,7 @@ if (nargin == 3) { - method = args(1).string_value(); + method = args(1).string_value (); if (error_state) { @@ -928,7 +928,7 @@ return retval; } - param = args(2).cell_value(); + param = args(2).cell_value (); if (error_state) { @@ -1268,7 +1268,7 @@ const curl_handle curl = handles.contents (handle); if (curl.is_valid ()) - retval = (curl.is_ascii() ? "ascii" : "binary"); + retval = (curl.is_ascii () ? "ascii" : "binary"); else error ("__ftp_binary__: invalid ftp handle"); } @@ -1422,7 +1422,7 @@ if (! curl.mkdir (dir, false)) warning ("__ftp_mput__: can not create the remote directory ""%s""", - (base.length() == 0 ? dir : base + + (base.length () == 0 ? dir : base + file_ops::dir_sep_str () + dir).c_str ()); curl.cwd (dir); @@ -1433,7 +1433,7 @@ frame.add_fcn (reset_path, curl); - std::string realdir = base.length() == 0 ? dir : base + + std::string realdir = base.length () == 0 ? dir : base + file_ops::dir_sep_str () + dir; dir_entry dirlist (realdir); @@ -1469,7 +1469,7 @@ else { // FIXME Does ascii mode need to be flagged here? - std::ifstream ifile (realfile.c_str(), std::ios::in | + std::ifstream ifile (realfile.c_str (), std::ios::in | std::ios::binary); if (! ifile.is_open ()) @@ -1492,7 +1492,7 @@ } else error ("__ftp_mput__: can not read the directory ""%s""", - realdir.c_str()); + realdir.c_str ()); } return retval; @@ -1547,7 +1547,7 @@ else { // FIXME Does ascii mode need to be flagged here? - std::ifstream ifile (file.c_str(), std::ios::in | + std::ifstream ifile (file.c_str (), std::ios::in | std::ios::binary); if (! ifile.is_open ()) @@ -1593,7 +1593,7 @@ if (status < 0) error ("__ftp_mget__: can't create directory %s%s%s. %s", - target.c_str(), sep.c_str(), dir.c_str(), msg.c_str()); + target.c_str (), sep.c_str (), dir.c_str (), msg.c_str ()); } if (! error_state) @@ -1621,7 +1621,7 @@ else { std::string realfile = target + dir + sep + sv(i); - std::ofstream ofile (realfile.c_str(), + std::ofstream ofile (realfile.c_str (), std::ios::out | std::ios::binary); @@ -1699,7 +1699,7 @@ getallfiles (curl, sv(i), target); else { - std::ofstream ofile ((target + sv(i)).c_str(), + std::ofstream ofile ((target + sv(i)).c_str (), std::ios::out | std::ios::binary);
--- a/src/OPERATORS/op-bm-bm.cc +++ b/src/OPERATORS/op-bm-bm.cc @@ -66,7 +66,7 @@ return octave_value (); } else - return octave_value (v.bool_matrix_value().transpose ()); + return octave_value (v.bool_matrix_value ().transpose ()); } // bool matrix by bool matrix ops.
--- a/src/OPERATORS/op-cdm-cdm.cc +++ b/src/OPERATORS/op-cdm-cdm.cc @@ -43,13 +43,13 @@ DEFUNOP (transpose, complex_diag_matrix) { CAST_UNOP_ARG (const octave_complex_diag_matrix&); - return octave_value (v.complex_diag_matrix_value().transpose ()); + return octave_value (v.complex_diag_matrix_value ().transpose ()); } DEFUNOP (hermitian, complex_diag_matrix) { CAST_UNOP_ARG (const octave_complex_diag_matrix&); - return octave_value (v.complex_diag_matrix_value().hermitian ()); + return octave_value (v.complex_diag_matrix_value ().hermitian ()); } // matrix by matrix ops.
--- a/src/OPERATORS/op-cell.cc +++ b/src/OPERATORS/op-cell.cc @@ -46,7 +46,7 @@ return octave_value (); } else - return octave_value (Cell (v.cell_value().transpose ())); + return octave_value (Cell (v.cell_value ().transpose ())); } DEFCATOP_FN (c_c, cell, cell, concat)
--- a/src/OPERATORS/op-chm.cc +++ b/src/OPERATORS/op-chm.cc @@ -41,7 +41,7 @@ { CAST_UNOP_ARG (const octave_char_matrix&); - return octave_value (v.matrix_value().transpose ()); + return octave_value (v.matrix_value ().transpose ()); } DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array,
--- a/src/OPERATORS/op-cm-cm.cc +++ b/src/OPERATORS/op-cm-cm.cc @@ -51,7 +51,7 @@ return octave_value (); } else - return octave_value (v.complex_matrix_value().transpose ()); + return octave_value (v.complex_matrix_value ().transpose ()); } DEFUNOP (hermitian, complex_matrix) @@ -64,7 +64,7 @@ return octave_value (); } else - return octave_value (v.complex_matrix_value().hermitian ()); + return octave_value (v.complex_matrix_value ().hermitian ()); } DEFNCUNOP_METHOD (incr, complex_matrix, increment)
--- a/src/OPERATORS/op-cm-scm.cc +++ b/src/OPERATORS/op-cm-scm.cc @@ -51,7 +51,7 @@ CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { Complex d = v2.complex_value ();
--- a/src/OPERATORS/op-cm-sm.cc +++ b/src/OPERATORS/op-cm-sm.cc @@ -50,7 +50,7 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { double d = v2.scalar_value ();
--- a/src/OPERATORS/op-cs-scm.cc +++ b/src/OPERATORS/op-cs-scm.cc @@ -48,7 +48,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { Complex d = v2.complex_value ();
--- a/src/OPERATORS/op-cs-sm.cc +++ b/src/OPERATORS/op-cs-sm.cc @@ -50,7 +50,7 @@ { CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { double d = v2.scalar_value ();
--- a/src/OPERATORS/op-dm-dm.cc +++ b/src/OPERATORS/op-dm-dm.cc @@ -43,7 +43,7 @@ DEFUNOP (transpose, diag_matrix) { CAST_UNOP_ARG (const octave_diag_matrix&); - return octave_value (v.diag_matrix_value().transpose ()); + return octave_value (v.diag_matrix_value ().transpose ()); } // matrix by matrix ops.
--- a/src/OPERATORS/op-dm-scm.cc +++ b/src/OPERATORS/op-dm-scm.cc @@ -43,7 +43,7 @@ { CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -66,7 +66,7 @@ { CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -89,7 +89,7 @@ { CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -142,7 +142,7 @@ { CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -158,7 +158,7 @@ { CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -174,7 +174,7 @@ { CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -190,7 +190,7 @@ { CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -206,7 +206,7 @@ { CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -222,7 +222,7 @@ { CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -240,7 +240,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) // If v1 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -263,7 +263,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) // If v1 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -286,7 +286,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) // If v1 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -294,7 +294,7 @@ return octave_value (d * v2.complex_diag_matrix_value ()); } - else if (v2.rows() == 1 && v2.columns() == 1) + else if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, don't bother with further dispatching. { std::complex<double> d = v2.complex_value (); @@ -316,7 +316,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { double d = v2.scalar_value (); @@ -336,7 +336,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { std::complex<double> d = v2.complex_value (); @@ -356,7 +356,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { std::complex<double> d = v2.complex_value (); @@ -376,7 +376,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -392,7 +392,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -408,7 +408,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -424,7 +424,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -440,7 +440,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -456,7 +456,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. {
--- a/src/OPERATORS/op-dm-sm.cc +++ b/src/OPERATORS/op-dm-sm.cc @@ -41,7 +41,7 @@ { CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -72,7 +72,7 @@ { CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -88,7 +88,7 @@ { CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) // If v2 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -106,7 +106,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) // If v1 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -129,7 +129,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { double d = v2.scalar_value (); @@ -149,7 +149,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) // If v1 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. { @@ -165,7 +165,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_diag_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) // If v1 is a scalar in disguise, return a diagonal matrix rather than // a sparse matrix. {
--- a/src/OPERATORS/op-fcdm-fcdm.cc +++ b/src/OPERATORS/op-fcdm-fcdm.cc @@ -43,13 +43,13 @@ DEFUNOP (transpose, float_complex_diag_matrix) { CAST_UNOP_ARG (const octave_float_complex_diag_matrix&); - return octave_value (v.float_complex_diag_matrix_value().transpose ()); + return octave_value (v.float_complex_diag_matrix_value ().transpose ()); } DEFUNOP (hermitian, float_complex_diag_matrix) { CAST_UNOP_ARG (const octave_float_complex_diag_matrix&); - return octave_value (v.float_complex_diag_matrix_value().hermitian ()); + return octave_value (v.float_complex_diag_matrix_value ().hermitian ()); } // matrix by matrix ops.
--- a/src/OPERATORS/op-fcm-fcm.cc +++ b/src/OPERATORS/op-fcm-fcm.cc @@ -51,7 +51,7 @@ return octave_value (); } else - return octave_value (v.float_complex_matrix_value().transpose ()); + return octave_value (v.float_complex_matrix_value ().transpose ()); } DEFUNOP (hermitian, float_complex_matrix) @@ -64,7 +64,7 @@ return octave_value (); } else - return octave_value (v.float_complex_matrix_value().hermitian ()); + return octave_value (v.float_complex_matrix_value ().hermitian ()); } DEFNCUNOP_METHOD (incr, float_complex_matrix, increment)
--- a/src/OPERATORS/op-fdm-fdm.cc +++ b/src/OPERATORS/op-fdm-fdm.cc @@ -43,7 +43,7 @@ DEFUNOP (transpose, float_diag_matrix) { CAST_UNOP_ARG (const octave_float_diag_matrix&); - return octave_value (v.float_diag_matrix_value().transpose ()); + return octave_value (v.float_diag_matrix_value ().transpose ()); } // matrix by matrix ops.
--- a/src/OPERATORS/op-fm-fm.cc +++ b/src/OPERATORS/op-fm-fm.cc @@ -51,7 +51,7 @@ return octave_value (); } else - return octave_value (v.float_matrix_value().transpose ()); + return octave_value (v.float_matrix_value ().transpose ()); } DEFNCUNOP_METHOD (incr, float_matrix, increment)
--- a/src/OPERATORS/op-int.h +++ b/src/OPERATORS/op-int.h @@ -633,7 +633,7 @@ return octave_value (); \ } \ else \ - return octave_value (v.TYPE ## _array_value().transpose ()); \ + return octave_value (v.TYPE ## _array_value ().transpose ()); \ } \ \ DEFNCUNOP_METHOD (m_incr, TYPE ## _matrix, increment) \
--- a/src/OPERATORS/op-m-m.cc +++ b/src/OPERATORS/op-m-m.cc @@ -51,7 +51,7 @@ return octave_value (); } else - return octave_value (v.matrix_value().transpose ()); + return octave_value (v.matrix_value ().transpose ()); } DEFNCUNOP_METHOD (incr, matrix, increment)
--- a/src/OPERATORS/op-m-scm.cc +++ b/src/OPERATORS/op-m-scm.cc @@ -51,7 +51,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { Complex d = v2.complex_value ();
--- a/src/OPERATORS/op-m-sm.cc +++ b/src/OPERATORS/op-m-sm.cc @@ -50,7 +50,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { double d = v2.scalar_value ();
--- a/src/OPERATORS/op-pm-pm.cc +++ b/src/OPERATORS/op-pm-pm.cc @@ -37,7 +37,7 @@ DEFUNOP (transpose, perm_matrix) { CAST_UNOP_ARG (const octave_perm_matrix&); - return octave_value (v.perm_matrix_value().transpose ()); + return octave_value (v.perm_matrix_value ().transpose ()); } DEFBINOP_OP (mul, perm_matrix, perm_matrix, *)
--- a/src/OPERATORS/op-pm-scm.cc +++ b/src/OPERATORS/op-pm-scm.cc @@ -39,13 +39,13 @@ { CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { std::complex<double> d = v2.complex_value (); return octave_value (v1.sparse_matrix_value () * d); } - else if (v1.rows() == 1 && v1.columns() == 1) + else if (v1.rows () == 1 && v1.columns () == 1) return octave_value (v2.sparse_complex_matrix_value ()); else return v1.perm_matrix_value () * v2.sparse_complex_matrix_value (); @@ -64,13 +64,13 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_perm_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { std::complex<double> d = v1.scalar_value (); return octave_value (d * v2.sparse_matrix_value ()); } - else if (v2.rows() == 1 && v2.columns() == 1) + else if (v2.rows () == 1 && v2.columns () == 1) return octave_value (v1.sparse_complex_matrix_value ()); else return v1.sparse_complex_matrix_value () * v2.perm_matrix_value ();
--- a/src/OPERATORS/op-pm-sm.cc +++ b/src/OPERATORS/op-pm-sm.cc @@ -82,13 +82,13 @@ { CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { double d = v2.scalar_value (); return octave_value (v1.sparse_matrix_value () * d); } - else if (v1.rows() == 1 && v1.columns() == 1) + else if (v1.rows () == 1 && v1.columns () == 1) return octave_value (v2.sparse_matrix_value ()); else return v1.perm_matrix_value () * v2.sparse_matrix_value (); @@ -107,13 +107,13 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_perm_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { double d = v1.scalar_value (); return octave_value (d * v2.sparse_matrix_value ()); } - else if (v2.rows() == 1 && v2.columns() == 1) + else if (v2.rows () == 1 && v2.columns () == 1) return octave_value (v1.sparse_matrix_value ()); else return v1.sparse_matrix_value () * v2.perm_matrix_value ();
--- a/src/OPERATORS/op-range.cc +++ b/src/OPERATORS/op-range.cc @@ -47,7 +47,7 @@ { CAST_UNOP_ARG (const octave_range&); - return octave_value (! v.matrix_value()); + return octave_value (! v.matrix_value ()); } DEFUNOP_OP (uplus, range, /* no-op */) @@ -57,7 +57,7 @@ { CAST_UNOP_ARG (const octave_range&); - return octave_value (v.matrix_value().transpose ()); + return octave_value (v.matrix_value ().transpose ()); } DEFBINOP_OP (addrs, range, scalar, +)
--- a/src/OPERATORS/op-s-scm.cc +++ b/src/OPERATORS/op-s-scm.cc @@ -51,7 +51,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { Complex d = v2.complex_value ();
--- a/src/OPERATORS/op-s-sm.cc +++ b/src/OPERATORS/op-s-sm.cc @@ -47,7 +47,7 @@ { CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { double d = v2.scalar_value ();
--- a/src/OPERATORS/op-sbm-sbm.cc +++ b/src/OPERATORS/op-sbm-sbm.cc @@ -55,7 +55,7 @@ DEFUNOP (transpose, sparse_bool_matrix) { CAST_UNOP_ARG (const octave_sparse_bool_matrix&); - return octave_value (v.sparse_bool_matrix_value().transpose ()); + return octave_value (v.sparse_bool_matrix_value ().transpose ()); } // sparse bool matrix by sparse bool matrix ops.
--- a/src/OPERATORS/op-scm-cm.cc +++ b/src/OPERATORS/op-scm-cm.cc @@ -69,7 +69,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { Complex d = v1.complex_value ();
--- a/src/OPERATORS/op-scm-cs.cc +++ b/src/OPERATORS/op-scm-cs.cc @@ -71,7 +71,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { Complex d = v1.complex_value ();
--- a/src/OPERATORS/op-scm-m.cc +++ b/src/OPERATORS/op-scm-m.cc @@ -70,7 +70,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { Complex d = v1.complex_value ();
--- a/src/OPERATORS/op-scm-s.cc +++ b/src/OPERATORS/op-scm-s.cc @@ -79,7 +79,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_scalar&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { Complex d = v1.complex_value ();
--- a/src/OPERATORS/op-scm-scm.cc +++ b/src/OPERATORS/op-scm-scm.cc @@ -60,7 +60,7 @@ { CAST_UNOP_ARG (const octave_sparse_complex_matrix&); return octave_value - (v.sparse_complex_matrix_value().transpose (), + (v.sparse_complex_matrix_value ().transpose (), v.matrix_type ().transpose ()); } @@ -68,7 +68,7 @@ { CAST_UNOP_ARG (const octave_sparse_complex_matrix&); return octave_value - (v.sparse_complex_matrix_value().hermitian (), + (v.sparse_complex_matrix_value ().hermitian (), v.matrix_type ().transpose ()); } @@ -100,7 +100,7 @@ CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { Complex d = v2.complex_value (); @@ -131,7 +131,7 @@ CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_complex_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { Complex d = v1.complex_value ();
--- a/src/OPERATORS/op-scm-sm.cc +++ b/src/OPERATORS/op-scm-sm.cc @@ -49,7 +49,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { double d = v2.scalar_value (); @@ -79,7 +79,7 @@ { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { Complex d = v1.complex_value ();
--- a/src/OPERATORS/op-sm-cm.cc +++ b/src/OPERATORS/op-sm-cm.cc @@ -69,7 +69,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { double d = v1.scalar_value ();
--- a/src/OPERATORS/op-sm-cs.cc +++ b/src/OPERATORS/op-sm-cs.cc @@ -71,7 +71,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { double d = v1.scalar_value ();
--- a/src/OPERATORS/op-sm-m.cc +++ b/src/OPERATORS/op-sm-m.cc @@ -67,7 +67,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { double d = v1.scalar_value ();
--- a/src/OPERATORS/op-sm-s.cc +++ b/src/OPERATORS/op-sm-s.cc @@ -73,7 +73,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { double d = v1.scalar_value ();
--- a/src/OPERATORS/op-sm-scm.cc +++ b/src/OPERATORS/op-sm-scm.cc @@ -49,7 +49,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_complex_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { Complex d = v2.complex_value (); @@ -79,7 +79,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_complex_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { double d = v1.scalar_value ();
--- a/src/OPERATORS/op-sm-sm.cc +++ b/src/OPERATORS/op-sm-sm.cc @@ -46,7 +46,7 @@ DEFUNOP (transpose, sparse_matrix) { CAST_UNOP_ARG (const octave_sparse_matrix&); - return octave_value (v.sparse_matrix_value().transpose (), + return octave_value (v.sparse_matrix_value ().transpose (), v.matrix_type ().transpose ()); } @@ -72,7 +72,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&); - if (v2.rows() == 1 && v2.columns() == 1) + if (v2.rows () == 1 && v2.columns () == 1) { double d = v2.scalar_value (); @@ -102,7 +102,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_matrix&); - if (v1.rows() == 1 && v1.columns() == 1) + if (v1.rows () == 1 && v1.columns () == 1) { double d = v1.double_value ();
--- a/src/OPERATORS/op-str-str.cc +++ b/src/OPERATORS/op-str-str.cc @@ -44,7 +44,7 @@ return octave_value (); } else - return octave_value (v.char_matrix_value().transpose (), + return octave_value (v.char_matrix_value ().transpose (), a.is_sq_string () ? '\'' : '"'); }
--- a/src/OPERATORS/op-struct.cc +++ b/src/OPERATORS/op-struct.cc @@ -44,7 +44,7 @@ return octave_value (); } else - return octave_value (v.map_value().transpose ()); + return octave_value (v.map_value ().transpose ()); } DEFUNOP (scalar_transpose, scalar_struct)
--- a/src/bitfcns.cc +++ b/src/bitfcns.cc @@ -106,7 +106,7 @@ } else error ("%s: size of X and Y must match, or one operand must be a scalar", - fname.c_str()); + fname.c_str ()); return retval; } @@ -156,7 +156,7 @@ uint64NDArray x (args(0).array_value ()); uint64NDArray y (args(1).array_value ()); if (! error_state) - retval = bitopx (fname, x, y).array_value(); + retval = bitopx (fname, x, y).array_value (); } else { @@ -230,7 +230,7 @@ retval = bitopx (fname, x, y); } else - error ("%s: invalid operand type", fname.c_str()); + error ("%s: invalid operand type", fname.c_str ()); } } else if (args(0).class_name () == args(1).class_name ()) @@ -300,10 +300,10 @@ retval = bitopx (fname, x, y); } else - error ("%s: invalid operand type", fname.c_str()); + error ("%s: invalid operand type", fname.c_str ()); } else - error ("%s: must have matching operand types", fname.c_str()); + error ("%s: must have matching operand types", fname.c_str ()); } else print_usage (); @@ -715,7 +715,7 @@ if (cname == "uint8") retval = octave_uint8 (std::numeric_limits<uint8_t>::min ()); else if (cname == "uint16") - retval = octave_uint16 (std::numeric_limits<uint16_t>::min()); + retval = octave_uint16 (std::numeric_limits<uint16_t>::min ()); else if (cname == "uint32") retval = octave_uint32 (std::numeric_limits<uint32_t>::min ()); else if (cname == "uint64")
--- a/src/data.cc +++ b/src/data.cc @@ -449,8 +449,8 @@ // FIXME -- should E be an int value? FloatMatrix e; map_2_xlog2 (x, f, e); - retval (1) = e; - retval (0) = f; + retval(1) = e; + retval(0) = f; } else if (args(0).is_complex_type ()) { @@ -459,8 +459,8 @@ // FIXME -- should E be an int value? FloatNDArray e; map_2_xlog2 (x, f, e); - retval (1) = e; - retval (0) = f; + retval(1) = e; + retval(0) = f; } } else if (args(0).is_real_type ()) @@ -470,8 +470,8 @@ // FIXME -- should E be an int value? Matrix e; map_2_xlog2 (x, f, e); - retval (1) = e; - retval (0) = f; + retval(1) = e; + retval(0) = f; } else if (args(0).is_complex_type ()) { @@ -480,8 +480,8 @@ // FIXME -- should E be an int value? NDArray e; map_2_xlog2 (x, f, e); - retval (1) = e; - retval (0) = f; + retval(1) = e; + retval(0) = f; } else gripe_wrong_type_arg ("log2", args(0)); @@ -1268,7 +1268,7 @@ int nargin = args.length (); if (nargin == 1 && args(0).is_defined ()) - retval = args(0).diag(); + retval = args(0).diag (); else if (nargin == 2 && args(0).is_defined () && args(1).is_defined ()) { octave_idx_type k = args(1).int_value (); @@ -1276,7 +1276,7 @@ if (error_state) error ("diag: invalid argument K"); else - retval = args(0).diag(k); + retval = args(0).diag (k); } else if (nargin == 3) { @@ -1303,40 +1303,40 @@ /* -%!assert(full (diag ([1; 2; 3])), [1, 0, 0; 0, 2, 0; 0, 0, 3]) -%!assert(diag ([1; 2; 3], 1), [0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0]) -%!assert(diag ([1; 2; 3], 2), [0, 0, 1, 0, 0; 0, 0, 0, 2, 0; 0, 0, 0, 0, 3; 0, 0, 0, 0, 0; 0, 0, 0, 0, 0]) -%!assert(diag ([1; 2; 3],-1), [0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]) -%!assert(diag ([1; 2; 3],-2), [0, 0, 0, 0, 0; 0, 0, 0, 0, 0; 1, 0, 0, 0, 0; 0, 2, 0, 0, 0; 0, 0, 3, 0, 0]) - -%!assert(diag ([1, 0, 0; 0, 2, 0; 0, 0, 3]), [1; 2; 3]) -%!assert(diag ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0], 1), [1; 2; 3]) -%!assert(diag ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0], -1), [1; 2; 3]) -%!assert(diag (ones(1, 0), 2), zeros (2)) -%!assert(diag (1:3, 4, 2), [1, 0; 0, 2; 0, 0; 0, 0]) - -%!assert(full (diag (single([1; 2; 3]))), single([1, 0, 0; 0, 2, 0; 0, 0, 3])) -%!assert(diag (single([1; 2; 3]), 1), single([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0])) -%!assert(diag (single([1; 2; 3]), 2), single([0, 0, 1, 0, 0; 0, 0, 0, 2, 0; 0, 0, 0, 0, 3; 0, 0, 0, 0, 0; 0, 0, 0, 0, 0])) -%!assert(diag (single([1; 2; 3]),-1), single([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0])) -%!assert(diag (single([1; 2; 3]),-2), single([0, 0, 0, 0, 0; 0, 0, 0, 0, 0; 1, 0, 0, 0, 0; 0, 2, 0, 0, 0; 0, 0, 3, 0, 0])) - -%!assert(diag (single([1, 0, 0; 0, 2, 0; 0, 0, 3])), single([1; 2; 3])) -%!assert(diag (single([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0]), 1), single([1; 2; 3])) -%!assert(diag (single([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]), -1), single([1; 2; 3])) - -%!assert(diag (int8([1; 2; 3])), int8([1, 0, 0; 0, 2, 0; 0, 0, 3])) -%!assert(diag (int8([1; 2; 3]), 1), int8([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0])) -%!assert(diag (int8([1; 2; 3]), 2), int8([0, 0, 1, 0, 0; 0, 0, 0, 2, 0; 0, 0, 0, 0, 3; 0, 0, 0, 0, 0; 0, 0, 0, 0, 0])) -%!assert(diag (int8([1; 2; 3]),-1), int8([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0])) -%!assert(diag (int8([1; 2; 3]),-2), int8([0, 0, 0, 0, 0; 0, 0, 0, 0, 0; 1, 0, 0, 0, 0; 0, 2, 0, 0, 0; 0, 0, 3, 0, 0])) - -%!assert(diag (int8([1, 0, 0; 0, 2, 0; 0, 0, 3])), int8([1; 2; 3])) -%!assert(diag (int8([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0]), 1), int8([1; 2; 3])) -%!assert(diag (int8([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]), -1), int8([1; 2; 3])) +%!assert (full (diag ([1; 2; 3])), [1, 0, 0; 0, 2, 0; 0, 0, 3]) +%!assert (diag ([1; 2; 3], 1), [0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0]) +%!assert (diag ([1; 2; 3], 2), [0, 0, 1, 0, 0; 0, 0, 0, 2, 0; 0, 0, 0, 0, 3; 0, 0, 0, 0, 0; 0, 0, 0, 0, 0]) +%!assert (diag ([1; 2; 3],-1), [0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]) +%!assert (diag ([1; 2; 3],-2), [0, 0, 0, 0, 0; 0, 0, 0, 0, 0; 1, 0, 0, 0, 0; 0, 2, 0, 0, 0; 0, 0, 3, 0, 0]) + +%!assert (diag ([1, 0, 0; 0, 2, 0; 0, 0, 3]), [1; 2; 3]) +%!assert (diag ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0], 1), [1; 2; 3]) +%!assert (diag ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0], -1), [1; 2; 3]) +%!assert (diag (ones (1, 0), 2), zeros (2)) +%!assert (diag (1:3, 4, 2), [1, 0; 0, 2; 0, 0; 0, 0]) + +%!assert (full (diag (single ([1; 2; 3]))), single ([1, 0, 0; 0, 2, 0; 0, 0, 3])) +%!assert (diag (single ([1; 2; 3]), 1), single ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0])) +%!assert (diag (single ([1; 2; 3]), 2), single ([0, 0, 1, 0, 0; 0, 0, 0, 2, 0; 0, 0, 0, 0, 3; 0, 0, 0, 0, 0; 0, 0, 0, 0, 0])) +%!assert (diag (single ([1; 2; 3]),-1), single ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0])) +%!assert (diag (single ([1; 2; 3]),-2), single ([0, 0, 0, 0, 0; 0, 0, 0, 0, 0; 1, 0, 0, 0, 0; 0, 2, 0, 0, 0; 0, 0, 3, 0, 0])) + +%!assert (diag (single ([1, 0, 0; 0, 2, 0; 0, 0, 3])), single ([1; 2; 3])) +%!assert (diag (single ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0]), 1), single ([1; 2; 3])) +%!assert (diag (single ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]), -1), single ([1; 2; 3])) + +%!assert (diag (int8 ([1; 2; 3])), int8 ([1, 0, 0; 0, 2, 0; 0, 0, 3])) +%!assert (diag (int8 ([1; 2; 3]), 1), int8 ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0])) +%!assert (diag (int8 ([1; 2; 3]), 2), int8 ([0, 0, 1, 0, 0; 0, 0, 0, 2, 0; 0, 0, 0, 0, 3; 0, 0, 0, 0, 0; 0, 0, 0, 0, 0])) +%!assert (diag (int8 ([1; 2; 3]),-1), int8 ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0])) +%!assert (diag (int8 ([1; 2; 3]),-2), int8 ([0, 0, 0, 0, 0; 0, 0, 0, 0, 0; 1, 0, 0, 0, 0; 0, 2, 0, 0, 0; 0, 0, 3, 0, 0])) + +%!assert (diag (int8 ([1, 0, 0; 0, 2, 0; 0, 0, 3])), int8 ([1; 2; 3])) +%!assert (diag (int8 ([0, 1, 0, 0; 0, 0, 2, 0; 0, 0, 0, 3; 0, 0, 0, 0]), 1), int8 ([1; 2; 3])) +%!assert (diag (int8 ([0, 0, 0, 0; 1, 0, 0, 0; 0, 2, 0, 0; 0, 0, 3, 0]), -1), int8 ([1; 2; 3])) ## Test non-square size -%!assert(diag ([1,2,3], 6, 3), [1 0 0; 0 2 0; 0 0 3; 0 0 0; 0 0 0; 0 0 0]) +%!assert (diag ([1,2,3], 6, 3), [1 0 0; 0 2 0; 0 0 3; 0 0 0; 0 0 0; 0 0 0]) %!assert (diag (1, 2, 3), [1,0,0; 0,0,0]); %!assert (diag ({1}, 2, 3), {1,[],[]; [],[],[]}); %!assert (diag ({1,2}, 3, 4), {1,[],[],[]; [],2,[],[]; [],[],[],[]}); @@ -2166,7 +2166,7 @@ /* %!function ret = __testcat (t1, t2, tr, cmplx) -%! assert (cat (1, cast ([], t1), cast([], t2)), cast ([], tr)); +%! assert (cat (1, cast ([], t1), cast ([], t2)), cast ([], tr)); %! %! assert (cat (1, cast (1, t1), cast (2, t2)), cast ([1; 2], tr)); %! assert (cat (1, cast (1, t1), cast ([2; 3], t2)), cast ([1; 2; 3], tr)); @@ -2609,7 +2609,7 @@ { octave_value retval; - if (args.length() == 1) + if (args.length () == 1) retval = args(0).nzmax (); else print_usage (); @@ -3090,7 +3090,7 @@ { SparseComplexMatrix result; if (re_val.nnz () == 0) - result = Complex(0, 1) * SparseComplexMatrix (im_val); + result = Complex (0, 1) * SparseComplexMatrix (im_val); else { result = SparseComplexMatrix (im_val.dims (), re_val (0)); @@ -3116,7 +3116,7 @@ result = SparseComplexMatrix (re_val); else { - result = SparseComplexMatrix (re_val.rows(), re_val.cols(), Complex(0, im_val (0))); + result = SparseComplexMatrix (re_val.rows (), re_val.cols (), Complex (0, im_val (0))); octave_idx_type nr = re_val.rows (); octave_idx_type nc = re_val.cols (); @@ -3136,8 +3136,8 @@ { if (re_val.dims () == im_val.dims ()) { - SparseComplexMatrix result = SparseComplexMatrix(re_val) - + Complex(0, 1) * SparseComplexMatrix (im_val); + SparseComplexMatrix result = SparseComplexMatrix (re_val) + + Complex (0, 1) * SparseComplexMatrix (im_val); retval = octave_value (new octave_sparse_complex_matrix (result)); } else @@ -4087,7 +4087,7 @@ for single precision.\n\ \n\ When called with no arguments, return a scalar with the value\n\ -@code{eps(1.0)}.\n\ +@code{eps (1.0)}.\n\ Given a single argument @var{x}, return the distance between @var{x} and\n\ the next largest value.\n\ When called with more than one argument the first two arguments are taken as\n\ @@ -4108,7 +4108,7 @@ if (! error_state) { - val = ::fabsf(val); + val = ::fabsf (val); if (xisnan (val) || xisinf (val)) retval = fill_matrix (octave_value ("single"), lo_ieee_nan_value (), @@ -4133,7 +4133,7 @@ if (! error_state) { - val = ::fabs(val); + val = ::fabs (val); if (xisnan (val) || xisinf (val)) retval = fill_matrix (octave_value_list (), lo_ieee_nan_value (), @@ -4241,7 +4241,7 @@ for single precision.\n\ \n\ When called with no arguments, return a scalar with the value\n\ -@code{realmax(\"double\")}.\n\ +@code{realmax (\"double\")}.\n\ When called with a single argument, return a square matrix with the dimension\n\ specified. When called with more than one scalar argument the first two\n\ arguments are taken as the number of rows and columns and any further\n\ @@ -4274,7 +4274,7 @@ for single precision.\n\ \n\ When called with no arguments, return a scalar with the value\n\ -@code{realmin(\"double\")}.\n\ +@code{realmin (\"double\")}.\n\ When called with a single argument, return a square matrix with the dimension\n\ specified. When called with more than one scalar argument the first two\n\ arguments are taken as the number of rows and columns and any further\n\ @@ -5774,8 +5774,8 @@ /* %!shared id %! id = tic (); -%!assert (isa (id, "uint64")); -%!assert (isa (toc (id), "double")); +%!assert (isa (id, "uint64")) +%!assert (isa (toc (id), "double")) */ DEFUN (cputime, args, , @@ -5838,9 +5838,9 @@ #endif - retval (2) = sys; - retval (1) = usr; - retval (0) = sys + usr; + retval(2) = sys; + retval(1) = usr; + retval(0) = sys + usr; return retval; } @@ -5932,7 +5932,7 @@ { if (args(1).is_string ()) { - std::string mode = args(1).string_value(); + std::string mode = args(1).string_value (); if (mode == "ascend") smode = ASCENDING; else if (mode == "descend") @@ -5960,7 +5960,7 @@ error ("sort: MODE must be a string"); return retval; } - std::string mode = args(2).string_value(); + std::string mode = args(2).string_value (); if (mode == "ascend") smode = ASCENDING; else if (mode == "descend") @@ -5993,8 +5993,8 @@ Array<octave_idx_type> sidx; - retval (0) = arg.sort (sidx, dim, smode); - retval (1) = idx_vector (sidx, dv(dim)); // No checking, the extent is known. + retval(0) = arg.sort (sidx, dim, smode); + retval(1) = idx_vector (sidx, dv(dim)); // No checking, the extent is known. } else retval(0) = arg.sort (dim, smode); @@ -6202,7 +6202,7 @@ if (nargin > 1) { - std::string mode = args(1).string_value(); + std::string mode = args(1).string_value (); if (mode == "ascend") smode = ASCENDING; else if (mode == "descend") @@ -6461,7 +6461,7 @@ else if (idx.extent (n) > n) error ("accumarray: index out of range"); - NDT retval (dim_vector (n, 1), T()); + NDT retval (dim_vector (n, 1), T ()); if (vals.numel () == 1) retval.idx_add (idx, vals (0)); @@ -6654,7 +6654,7 @@ rdv(dim) = n; - NDT retval (rdv, T()); + NDT retval (rdv, T ()); if (idx.length () != vals_dim(dim)) error ("accumdim: dimension mismatch");
--- a/src/debug.cc +++ b/src/debug.cc @@ -209,7 +209,7 @@ // Problem because parse_dbfunction_params() can only pass out a // single function } - else if (args(0).is_string()) + else if (args(0).is_string ()) { symbol_name = args(0).string_value (); if (error_state) @@ -223,7 +223,7 @@ { if (args(i).is_string ()) { - int line = atoi (args(i).string_value().c_str ()); + int line = atoi (args(i).string_value ().c_str ()); if (error_state) break; lines[list_idx++] = line;
--- a/src/dynamic-ld.cc +++ b/src/dynamic-ld.cc @@ -342,7 +342,7 @@ { warning_with_id ("Octave:reload-forces-clear", "reloading %s clears the following functions:", - oct_file.file_name().c_str ()); + oct_file.file_name ().c_str ()); octave_shlib_list::remove (oct_file, do_clear_function); }
--- a/src/error.cc +++ b/src/error.cc @@ -838,7 +838,7 @@ @end deftypefn") { octave_value retval; - int nargin = args.length(); + int nargin = args.length (); if (nargin != 1) print_usage (); @@ -852,7 +852,7 @@ { std::string msg = err.contents("message").string_value (); std::string id = err.contents("identifier").string_value (); - int len = msg.length(); + int len = msg.length (); std::string file; std::string nm; @@ -992,7 +992,7 @@ if (arg1.find_first_of ("% \f\n\r\t\v") == std::string::npos && arg1.find (':') != std::string::npos && arg1[0] != ':' - && arg1[arg1.length()-1] != ':') + && arg1[arg1.length ()-1] != ':') { if (nargin > 1) { @@ -1557,7 +1557,7 @@ @end deftypefn") { octave_value retval; - int nargin = args.length(); + int nargin = args.length (); unwind_protect frame; @@ -1575,12 +1575,12 @@ if (nargin == 1) { - if (args(0).is_string()) + if (args(0).is_string ()) { if (args(0).string_value () == "reset") { - Vlast_error_message = std::string(); - Vlast_error_id = std::string(); + Vlast_error_message = std::string (); + Vlast_error_id = std::string (); Vlast_error_stack = initialize_last_error_stack (); }
--- a/src/gl-render.cc +++ b/src/gl-render.cc @@ -236,7 +236,7 @@ public: - opengl_tesselator (void) : glu_tess (0), fill() { init (); } + opengl_tesselator (void) : glu_tess (0), fill () { init (); } virtual ~opengl_tesselator (void) { if (glu_tess) gluDeleteTess (glu_tess); } @@ -552,6 +552,9 @@ const base_properties& props = go.get_properties (); + if (! toolkit) + toolkit = props.get_toolkit (); + if (go.isa ("figure")) draw_figure (dynamic_cast<const figure::properties&> (props)); else if (go.isa ("axes")) @@ -587,8 +590,6 @@ void opengl_renderer::draw_figure (const figure::properties& props) { - toolkit = props.get_toolkit (); - // Initialize OpenGL context init_gl_context (props.is___enhanced__ (), props.get_color_rgb ()); @@ -606,8 +607,6 @@ const figure::properties& figProps = dynamic_cast<const figure::properties&> (fig.get_properties ()); - toolkit = figProps.get_toolkit (); - // Initialize OpenGL context init_gl_context (figProps.is___enhanced__ (), @@ -642,7 +641,7 @@ // Clear background - if (c.length() >= 3) + if (c.length () >= 3) { glClearColor (c(0), c(1), c(2), 1); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -2898,7 +2897,7 @@ glVertex2d (-sz/2, sz/2); glVertex2d (sz/2, sz/2); glVertex2d (sz/2, -sz/2); - glEnd(); + glEnd (); break; case 'o': { @@ -2916,7 +2915,7 @@ glVertex2d (sz/2, 0); glVertex2d (0, sz/2); glVertex2d (-sz/2, 0); - glEnd(); + glEnd (); break; case 'v': glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP));
--- a/src/gl-render.h +++ b/src/gl-render.h @@ -90,6 +90,7 @@ const graphics_object& go); virtual void init_gl_context (bool enhanced, const Matrix& backgroundColor); + virtual void setup_opengl_transformation (const axes::properties& props); virtual void set_color (const Matrix& c); virtual void set_polygon_offset (bool on, double offset = 0.0); @@ -168,8 +169,6 @@ unsigned int make_marker_list (const std::string& m, double size, bool filled) const; - void setup_opengl_transformation (const axes::properties& props); - void draw_axes_planes (const axes::properties& props); void draw_axes_boxes (const axes::properties& props);
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -1037,7 +1037,7 @@ { double tmp_rgb[3] = {0, 0, 0}; bool retval = true; - unsigned int len = str.length(); + unsigned int len = str.length (); std::transform (str.begin (), str.end (), str.begin (), tolower); @@ -1271,7 +1271,7 @@ } \ } - if (data.is_double_type() || data.is_bool_type ()) + if (data.is_double_type () || data.is_bool_type ()) CHECK_ARRAY_EQUAL (double, , NDArray) else if (data.is_single_type ()) CHECK_ARRAY_EQUAL (float, float_, FloatNDArray) @@ -1428,7 +1428,7 @@ // complete validation will be done at execution-time return true; else if (v.is_cell () && v.length () > 0 - && (v.rows() == 1 || v.columns () == 1) + && (v.rows () == 1 || v.columns () == 1) && v.cell_value ()(0).is_function_handle ()) return true; else if (v.is_empty ()) @@ -5629,7 +5629,7 @@ bool ignore_vertical = false; if (only_text_height) { - double text_rotation = text_props.get_rotation(); + double text_rotation = text_props.get_rotation (); if (text_rotation == 0. || text_rotation == 180.) ignore_horizontal = true; else if (text_rotation == 90. || text_rotation == 270.) @@ -5677,9 +5677,9 @@ graphics_object obj = gh_manager::get_object (get_parent ()); Matrix parent_bb = obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); caseless_str new_units = get_units (); - position.set (octave_value (convert_position (get_position().matrix_value(), old_units, new_units, parent_bb)), false); - outerposition.set (octave_value (convert_position (get_outerposition().matrix_value(), old_units, new_units, parent_bb)), false); - tightinset.set (octave_value (convert_position (get_tightinset().matrix_value(), old_units, new_units, parent_bb)), false); + position.set (octave_value (convert_position (get_position ().matrix_value (), old_units, new_units, parent_bb)), false); + outerposition.set (octave_value (convert_position (get_outerposition ().matrix_value (), old_units, new_units, parent_bb)), false); + tightinset.set (octave_value (convert_position (get_tightinset ().matrix_value (), old_units, new_units, parent_bb)), false); } void @@ -6168,7 +6168,7 @@ hmax = std::max (hmax, ext(1)); #else //FIXME: find a better approximation - int len = ticklabels(i).length(); + int len = ticklabels(i).length (); wmax = std::max (wmax, 0.5*fontsize*len); hmax = fontsize; #endif @@ -6286,7 +6286,7 @@ double val; #define FIX_LIMITS \ - if (limits.numel() == 4) \ + if (limits.numel () == 4) \ { \ val = limits(0); \ if (! (xisinf (val) || xisnan (val))) \ @@ -6841,7 +6841,7 @@ v (0) = fmod(v(0) - delta_az + 720,360); set_view(v); - update_transform(); + update_transform (); } void @@ -6997,7 +6997,7 @@ renderer.text_to_pixels (sv.join ("\n"), pixels, bbox, halign, valign, get_rotation ()); /* The bbox is relative to the text's position. - We'll leave it that way, because get_position() does not return + We'll leave it that way, because get_position () does not return valid results when the text is first constructed. Conversion to proper coordinates is performed in get_extent. */ set_extent (bbox); @@ -7077,7 +7077,7 @@ octave_value patch::properties::get_color_data (void) const { - octave_value fvc = get_facevertexcdata(); + octave_value fvc = get_facevertexcdata (); if (fvc.is_undefined () || fvc.is_empty ()) return Matrix (); else @@ -7257,7 +7257,7 @@ update_type = 'a'; } - if (limits.numel() == 4) + if (limits.numel () == 4) { val = limits(0); if (! (xisinf (val) || xisnan (val))) @@ -7480,7 +7480,7 @@ void uicontrol::properties::set_style (const octave_value& st) { - if (get___object__ ().is_empty()) + if (get___object__ ().is_empty ()) style = st; else error ("set: cannot change the style of a uicontrol object after creation."); @@ -8515,7 +8515,7 @@ if (nargin == 1 || nargin == 2) { - if (args(0).is_empty()) + if (args(0).is_empty ()) { retval = Matrix (); return retval; @@ -8918,7 +8918,7 @@ if ((go.isa ("line") || go.isa ("patch")) && ! go.get("zdata").is_empty ()) nd = 3; - Matrix kids = go.get_properties().get_children (); + Matrix kids = go.get_properties ().get_children (); for (octave_idx_type i = 0; i < kids.length (); i++) { @@ -8928,7 +8928,7 @@ { const graphics_object& kid = gh_manager::get_object(hnd); - if (kid.valid_object()) + if (kid.valid_object ()) nd = calc_dimensions (kid); if (nd == 3) @@ -9857,7 +9857,7 @@ if (obj) retval = obj.get (caseless_str (property)); else - error ("%s: invalid handle (= %g)", func.c_str(), handle); + error ("%s: invalid handle (= %g)", func.c_str (), handle); return retval; } @@ -9879,7 +9879,7 @@ ret = true; } else - error ("%s: invalid handle (= %g)", func.c_str(), handle); + error ("%s: invalid handle (= %g)", func.c_str (), handle); return ret; }
--- a/src/graphics.in.h +++ b/src/graphics.in.h @@ -298,7 +298,7 @@ public: scaler (void) : rep (new base_scaler ()) { } - scaler (const scaler& s) : rep (s.rep->clone()) { } + scaler (const scaler& s) : rep (s.rep->clone ()) { } scaler (const std::string& s) : rep (s == "log" @@ -464,7 +464,7 @@ } if (found) { - for (int j = i; j < l.length() - 1; j++) + for (int j = i; j < l.length () - 1; j++) l(j) = l (j + 1); l.resize (l.length () - 1); @@ -4413,9 +4413,9 @@ array_property cdata u , Matrix () radio_property cdatamapping al , "{scaled}|direct" // hidden properties for limit computation - row_vector_property xlim hlr , Matrix() - row_vector_property ylim hlr , Matrix() - row_vector_property clim hlr , Matrix() + row_vector_property xlim hlr , Matrix () + row_vector_property ylim hlr , Matrix () + row_vector_property clim hlr , Matrix () bool_property xliminclude hl , "on" bool_property yliminclude hl , "on" bool_property climinclude hlg , "on" @@ -4810,11 +4810,11 @@ BEGIN_PROPERTIES (hggroup) // hidden properties for limit computation - row_vector_property xlim hr , Matrix() - row_vector_property ylim hr , Matrix() - row_vector_property zlim hr , Matrix() - row_vector_property clim hr , Matrix() - row_vector_property alim hr , Matrix() + row_vector_property xlim hr , Matrix () + row_vector_property ylim hr , Matrix () + row_vector_property zlim hr , Matrix () + row_vector_property clim hr , Matrix () + row_vector_property alim hr , Matrix () bool_property xliminclude h , "on" bool_property yliminclude h , "on" bool_property zliminclude h , "on" @@ -4882,7 +4882,7 @@ BEGIN_PROPERTIES (uimenu) any_property __object__ , Matrix () string_property accelerator , "" - callback_property callback , Matrix() + callback_property callback , Matrix () bool_property checked , "off" bool_property enable , "on" color_property foregroundcolor , color_values (0, 0, 0) @@ -4930,7 +4930,7 @@ BEGIN_PROPERTIES (uicontextmenu) any_property __object__ , Matrix () - callback_property callback , Matrix() + callback_property callback , Matrix () array_property position , Matrix (1, 2, 0.0) END_PROPERTIES @@ -5223,7 +5223,7 @@ BEGIN_PROPERTIES (uipushtool) any_property __object__ , Matrix () array_property cdata , Matrix () - callback_property clickedcallback , Matrix() + callback_property clickedcallback , Matrix () bool_property enable , "on" bool_property separator , "off" string_property tooltipstring , "" @@ -5273,10 +5273,10 @@ BEGIN_PROPERTIES (uitoggletool) any_property __object__ , Matrix () array_property cdata , Matrix () - callback_property clickedcallback , Matrix() + callback_property clickedcallback , Matrix () bool_property enable , "on" - callback_property offcallback , Matrix() - callback_property oncallback , Matrix() + callback_property offcallback , Matrix () + callback_property oncallback , Matrix () bool_property separator , "off" bool_property state , "off" string_property tooltipstring , ""
--- a/src/load-path.cc +++ b/src/load-path.cc @@ -526,14 +526,14 @@ load_path::do_clear (std::set<std::string>& new_elts) { bool warn_default_path_clobbered = false; - for (dir_info_list_iterator i = dir_info_list.begin(); - i != dir_info_list.end(); + for (dir_info_list_iterator i = dir_info_list.begin (); + i != dir_info_list.end (); /* conditionally advance iterator in loop body */) { //Don't remove it if it's gonna be added again, but remove it from //list of items to add, to avoid duplicates later on std::set<std::string>::iterator j = new_elts.find(i->dir_name); - if (j != new_elts.end()) + if (j != new_elts.end ()) { new_elts.erase(j); i++; @@ -595,7 +595,7 @@ load_path::do_set (const std::string& p, bool warn, bool is_init) { std::list<std::string> elts_l = split_path (p); - std::set<std::string> elts(elts_l.begin(), elts_l.end()); + std::set<std::string> elts(elts_l.begin (), elts_l.end ()); // Temporarily disable add hook.
--- a/src/ls-hdf5.cc +++ b/src/ls-hdf5.cc @@ -840,7 +840,7 @@ || val.type_id () == octave_lazy_index::static_type_id ()) val = val.full_value (); - std::string t = val.type_name(); + std::string t = val.type_name (); #if HAVE_HDF5_18 data_id = H5Gcreate (loc_id, name.c_str (), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else
--- a/src/ls-mat5.cc +++ b/src/ls-mat5.cc @@ -863,24 +863,24 @@ // Octave can handle both "/" and "\" as a directry seperator // and so can ignore the seperator field of m0. I think the // sentinel field is also save to ignore. - Octave_map m0 = tc2.map_value(); - Octave_map m1 = m0.contents("function_handle")(0).map_value(); - std::string ftype = m1.contents("type")(0).string_value(); - std::string fname = m1.contents("function")(0).string_value(); - std::string fpath = m1.contents("file")(0).string_value(); + Octave_map m0 = tc2.map_value (); + Octave_map m1 = m0.contents("function_handle")(0).map_value (); + std::string ftype = m1.contents("type")(0).string_value (); + std::string fname = m1.contents("function")(0).string_value (); + std::string fpath = m1.contents("file")(0).string_value (); if (ftype == "simple" || ftype == "scopedfunction") { - if (fpath.length() == 0) + if (fpath.length () == 0) // We have a builtin function tc = make_fcn_handle (fname); else { std::string mroot = - m0.contents("matlabroot")(0).string_value(); + m0.contents("matlabroot")(0).string_value (); if ((fpath.length () >= mroot.length ()) && - fpath.substr(0, mroot.length()) == mroot && + fpath.substr(0, mroot.length ()) == mroot && OCTAVE_EXEC_PREFIX != mroot) { // If fpath starts with matlabroot, and matlabroot @@ -942,7 +942,7 @@ else { warning ("load: can't find the file %s", - fpath.c_str()); + fpath.c_str ()); goto skip_ahead; } } @@ -966,7 +966,7 @@ else { warning ("load: can't find the file %s", - fpath.c_str()); + fpath.c_str ()); goto skip_ahead; } } @@ -979,13 +979,13 @@ } else if (ftype == "anonymous") { - Octave_map m2 = m1.contents("workspace")(0).map_value(); - uint32NDArray MCOS = m2.contents("MCOS")(0).uint32_array_value(); + Octave_map m2 = m1.contents("workspace")(0).map_value (); + uint32NDArray MCOS = m2.contents("MCOS")(0).uint32_array_value (); octave_idx_type off = static_cast<octave_idx_type>(MCOS(4).double_value ()); - m2 = subsys_ov.map_value(); - m2 = m2.contents("MCOS")(0).map_value(); - tc2 = m2.contents("MCOS")(0).cell_value()(1 + off).cell_value()(1); - m2 = tc2.map_value(); + m2 = subsys_ov.map_value (); + m2 = m2.contents("MCOS")(0).map_value (); + tc2 = m2.contents("MCOS")(0).cell_value ()(1 + off).cell_value ()(1); + m2 = tc2.map_value (); unwind_protect_safe frame; @@ -1000,12 +1000,12 @@ octave_call_stack::push (local_scope, 0); frame.add_fcn (octave_call_stack::pop); - if (m2.nfields() > 0) + if (m2.nfields () > 0) { octave_value tmp; - for (Octave_map::iterator p0 = m2.begin() ; - p0 != m2.end(); p0++) + for (Octave_map::iterator p0 = m2.begin () ; + p0 != m2.end (); p0++) { std::string key = m2.key(p0); octave_value val = m2.contents(p0)(0); @@ -1219,8 +1219,8 @@ // inline is not an object in Octave but rather an // overload of a function handle. Special case. tc = - new octave_fcn_inline (m.contents("expr")(0).string_value(), - m.contents("args")(0).string_value()); + new octave_fcn_inline (m.contents("expr")(0).string_value (), + m.contents("args")(0).string_value ()); } else { @@ -1236,7 +1236,7 @@ tc = cls; if (load_path::find_method (classname, "loadobj") != - std::string()) + std::string ()) { octave_value_list tmp = feval ("loadobj", tc, 1); @@ -1563,7 +1563,7 @@ if (tc.is_uint8_type ()) { - const uint8NDArray itmp = tc.uint8_array_value(); + const uint8NDArray itmp = tc.uint8_array_value (); octave_idx_type ilen = itmp.numel (); // Why should I have to initialize outbuf as just overwrite @@ -2620,11 +2620,11 @@ write_mat5_array (os, ::imag (m_cmplx), save_as_floats); } } - else if (tc.is_map () || tc.is_inline_function() || tc.is_object ()) + else if (tc.is_map () || tc.is_inline_function () || tc.is_object ()) { if (tc.is_inline_function () || tc.is_object ()) { - std::string classname = tc.is_object() ? tc.class_name () : "inline"; + std::string classname = tc.is_object () ? tc.class_name () : "inline"; size_t namelen = classname.length (); if (namelen > max_namelen) @@ -2642,7 +2642,7 @@ Octave_map m; if (tc.is_object () && - load_path::find_method (tc.class_name (), "saveobj") != std::string()) + load_path::find_method (tc.class_name (), "saveobj") != std::string ()) { octave_value_list tmp = feval ("saveobj", tc, 1); if (! error_state)
--- a/src/ls-mat5.h +++ b/src/ls-mat5.h @@ -48,7 +48,7 @@ extern int read_mat5_binary_file_header (std::istream& is, bool& swap, bool quiet = false, - const std::string& filename = std::string()); + const std::string& filename = std::string ()); extern std::string read_mat5_binary_element (std::istream& is, const std::string& filename, bool swap, bool& global, octave_value& tc);
--- a/src/ls-oct-ascii.cc +++ b/src/ls-oct-ascii.cc @@ -323,7 +323,7 @@ if (mark_as_global) os << "# type: global " << val.type_name () << "\n"; else - os << "# type: " << val.type_name() << "\n"; + os << "# type: " << val.type_name () << "\n"; if (! precision) precision = Vsave_precision;
--- a/src/ls-oct-ascii.h +++ b/src/ls-oct-ascii.h @@ -74,7 +74,7 @@ const bool next_only = false) { bool status = false; - value = T(); + value = T (); char c; while (is.get (c))
--- a/src/mex.cc +++ b/src/mex.cc @@ -397,7 +397,7 @@ mwSize n = 1; // Force dims and ndims to be cached. - get_dimensions(); + get_dimensions (); for (mwIndex i = ndims - 1; i > 0; i--) n *= dims[i]; @@ -1514,7 +1514,7 @@ { public: - mxArray_sparse (mxClassID id_arg, int m, int n, int nzmax_arg, + mxArray_sparse (mxClassID id_arg, mwSize m, mwSize n, mwSize nzmax_arg, mxComplexity flag = mxREAL) : mxArray_matlab (id_arg, m, n), nzmax (nzmax_arg), pr (calloc (nzmax, get_element_size ())), @@ -3463,7 +3463,7 @@ mxArray *m = 0; octave_value ret = get_property_from_handle (handle, property, "mexGet"); - if (!error_state && ret.is_defined()) + if (!error_state && ret.is_defined ()) m = ret.as_mxArray (); return m; }
--- a/src/mk-errno-list +++ b/src/mk-errno-list @@ -41,7 +41,7 @@ t = "#if defined (%s)\n { \"%s\", %s, },\n#endif\n" errstr = "" -for k in errorcode.keys(): +for k in errorcode.keys (): errstr += t % tuple(3*[errorcode[k]]) for l in stdin:
--- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -1559,8 +1559,8 @@ } else { - string_vector a_keys = a.keys().sort (); - string_vector b_keys = b.keys().sort (); + string_vector a_keys = a.keys ().sort (); + string_vector b_keys = b.keys ().sort (); octave_idx_type a_len = a_keys.length (); octave_idx_type b_len = b_keys.length (); @@ -1585,7 +1585,7 @@ Octave_map& Octave_map::maybe_delete_elements (const octave_value_list& idx) { - string_vector t_keys = keys(); + string_vector t_keys = keys (); octave_idx_type len = t_keys.length (); if (len > 0) @@ -1601,7 +1601,7 @@ } if (!error_state) - dimensions = contents(t_keys[0]).dims(); + dimensions = contents(t_keys[0]).dims (); } return *this;
--- a/src/oct-obj.h +++ b/src/oct-obj.h @@ -126,7 +126,7 @@ bool has_magic_colon (void) const; - string_vector make_argv (const std::string& = std::string()) const; + string_vector make_argv (const std::string& = std::string ()) const; void stash_name_tags (const string_vector& nm) { names = nm; }
--- a/src/oct-parse.yy +++ b/src/oct-parse.yy @@ -2877,7 +2877,7 @@ fcn->stash_parent_fcn_name (curr_fcn_file_name); if (current_function_depth > 1) - fcn->stash_parent_fcn_scope (function_scopes[function_scopes.size()-2]); + fcn->stash_parent_fcn_scope (function_scopes[function_scopes.size ()-2]); else fcn->stash_parent_fcn_scope (primary_fcn_scope); } @@ -2958,7 +2958,7 @@ if (endfunction_found && function_scopes.size () > 1) { symbol_table::scope_id pscope - = function_scopes[function_scopes.size()-2]; + = function_scopes[function_scopes.size ()-2]; symbol_table::install_nestfunction (nm, octave_value (fcn), pscope); @@ -3204,7 +3204,7 @@ { if (current_function_depth > 0) { - tree_statement *tmp = t->back(); + tree_statement *tmp = t->back (); if (tmp->is_expression ()) warning_with_id @@ -3608,7 +3608,7 @@ if (status != 0) error ("parse error while reading %s file %s", - file_type.c_str(), ff.c_str ()); + file_type.c_str (), ff.c_str ()); } else { @@ -3692,7 +3692,7 @@ string_vector autoloaded_functions (void) { - string_vector names (autoload_map.size()); + string_vector names (autoload_map.size ()); octave_idx_type i = 0; typedef std::map<std::string, std::string>::const_iterator am_iter;
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -2138,7 +2138,7 @@ else { if (tmp.is_defined ()) - retval (num_values++) = tmp; + retval(num_values++) = tmp; if (! ok ()) break;
--- a/src/octave-config.in.cc +++ b/src/octave-config.in.cc @@ -167,7 +167,7 @@ vars["OCTFILEDIR"] =substitute_prefix (%OCTAVE_OCTFILEDIR%, PREFIX, OCTAVE_HOME); vars["OCTINCLUDEDIR"] =substitute_prefix (%OCTAVE_OCTINCLUDEDIR%, PREFIX, OCTAVE_HOME); vars["OCTLIBDIR"] =substitute_prefix (%OCTAVE_OCTLIBDIR%, PREFIX, OCTAVE_HOME); - vars["PREFIX"] = (OCTAVE_HOME.empty() ? PREFIX : OCTAVE_HOME); + vars["PREFIX"] = (OCTAVE_HOME.empty () ? PREFIX : OCTAVE_HOME); vars["STARTUPFILEDIR"] =substitute_prefix (%OCTAVE_STARTUPFILEDIR%, PREFIX, OCTAVE_HOME); vars["VERSION"] = %OCTAVE_VERSION%; }
--- a/src/ov-base-int.cc +++ b/src/ov-base-int.cc @@ -239,11 +239,11 @@ octave_base_int_matrix<T>::save_binary (std::ostream& os, bool&) { dim_vector d = this->dims (); - if (d.length() < 1) + if (d.length () < 1) return false; // Use negative value for ndims to differentiate with old format!! - int32_t tmp = - d.length(); + int32_t tmp = - d.length (); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i=0; i < d.length (); i++) { @@ -251,7 +251,7 @@ os.write (reinterpret_cast<char *> (&tmp), 4); } - os.write (reinterpret_cast<const char *> (this->matrix.data()), this->byte_size()); + os.write (reinterpret_cast<const char *> (this->matrix.data ()), this->byte_size ()); return true; } @@ -303,7 +303,7 @@ if (swap) { int nel = dv.numel (); - int bytes = nel / m.byte_size(); + int bytes = nel / m.byte_size (); for (int i = 0; i < nel; i++) switch (bytes) { @@ -364,7 +364,7 @@ } retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL, - H5P_DEFAULT, this->matrix.data()) >= 0; + H5P_DEFAULT, this->matrix.data ()) >= 0; H5Dclose (data_hid); H5Sclose (space_hid); @@ -422,7 +422,7 @@ T m (dv); if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL, - H5P_DEFAULT, m.fortran_vec()) >= 0) + H5P_DEFAULT, m.fortran_vec ()) >= 0) { retval = true; this->matrix = m; @@ -501,7 +501,7 @@ bool octave_base_int_scalar<T>::save_binary (std::ostream& os, bool&) { - os.write (reinterpret_cast<char *> (&(this->scalar)), this->byte_size()); + os.write (reinterpret_cast<char *> (&(this->scalar)), this->byte_size ()); return true; } @@ -511,11 +511,11 @@ oct_mach_info::float_format) { T tmp; - if (! is.read (reinterpret_cast<char *> (&tmp), this->byte_size())) + if (! is.read (reinterpret_cast<char *> (&tmp), this->byte_size ())) return false; if (swap) - switch (this->byte_size()) + switch (this->byte_size ()) { case 8: swap_bytes<8> (&tmp);
--- a/src/ov-base-mat.cc +++ b/src/ov-base-mat.cc @@ -475,7 +475,7 @@ // Set up the pointer to the proper place. void *here = reinterpret_cast<void *> (&matrix(n)); // Ask x to store there if it can. - return x.get_rep().fast_elem_insert_self (here, btyp); + return x.get_rep ().fast_elem_insert_self (here, btyp); } else return false;
--- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -1117,7 +1117,7 @@ { gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ()); - return octave_value(); + return octave_value (); } octave_value @@ -1125,7 +1125,7 @@ { gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ()); - return octave_value(); + return octave_value (); } octave_value @@ -1133,7 +1133,7 @@ { gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ()); - return octave_value(); + return octave_value (); } octave_value @@ -1142,7 +1142,7 @@ { gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ()); - return octave_value(); + return octave_value (); } sortmode
--- a/src/ov-bool-mat.cc +++ b/src/ov-bool-mat.cc @@ -329,11 +329,11 @@ { dim_vector d = dims (); - if (d.length() < 1) + if (d.length () < 1) return false; // Use negative value for ndims to differentiate with old format!! - int32_t tmp = - d.length(); + int32_t tmp = - d.length (); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i = 0; i < d.length (); i++) {
--- a/src/ov-bool-sparse.cc +++ b/src/ov-bool-sparse.cc @@ -209,7 +209,7 @@ octave_sparse_bool_matrix::save_binary (std::ostream& os, bool&) { dim_vector d = this->dims (); - if (d.length() < 1) + if (d.length () < 1) return false; // Ensure that additional memory is deallocated @@ -440,7 +440,7 @@ H5Sclose (space_hid); - hdims[0] = m.cols() + 1; + hdims[0] = m.cols () + 1; hdims[1] = 1; space_hid = H5Screate_simple (2, hdims, 0);
--- a/src/ov-bool.cc +++ b/src/ov-bool.cc @@ -89,14 +89,14 @@ if (fill) { boolNDArray retval (dv, false); - if (dv.numel()) + if (dv.numel ()) retval(0) = scalar; return retval; } else { boolNDArray retval (dv); - if (dv.numel()) + if (dv.numel ()) retval(0) = scalar; return retval; }
--- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -944,7 +944,7 @@ return false; // Use negative value for ndims - int32_t di = - d.length(); + int32_t di = - d.length (); os.write (reinterpret_cast<char *> (&di), 4); for (int i = 0; i < d.length (); i++) {
--- a/src/ov-class.cc +++ b/src/ov-class.cc @@ -521,7 +521,7 @@ case '.': { - if (map.numel() > 0) + if (map.numel () > 0) { Cell t = dotref (idx.front ()); @@ -705,7 +705,7 @@ if (tmp.length () > 1) error ("expecting single return value from @%s/subsasgn", - class_name().c_str ()); + class_name ().c_str ()); else retval = tmp(0); @@ -914,7 +914,7 @@ { if (t_rhs.is_empty ()) { - map.delete_elements (idx.front()); + map.delete_elements (idx.front ()); if (! error_state) { @@ -999,7 +999,7 @@ if (!error_state && tmp.length () >= 1) { - if (tmp(0).is_object()) + if (tmp(0).is_object ()) error ("subsindex function must return a valid index vector"); else // Index vector returned by subsindex is zero based @@ -1012,7 +1012,7 @@ } else error ("no subsindex method defined for class %s", - class_name().c_str ()); + class_name ().c_str ()); return retval; } @@ -1136,7 +1136,7 @@ } } else - error ("no char method defined for class %s", class_name().c_str ()); + error ("no char method defined for class %s", class_name ().c_str ()); return retval; } @@ -1274,10 +1274,10 @@ { std::string key = map.key (p); Cell val = map.contents (p); - if ( val(0).is_object() ) + if ( val(0).is_object () ) { dbgstr = "blork"; - if( key == val(0).class_name() ) + if( key == val(0).class_name () ) { might_have_inheritance = true; dbgstr = "cork"; @@ -1444,7 +1444,7 @@ bool octave_class::save_binary (std::ostream& os, bool& save_as_floats) { - int32_t classname_len = class_name().length (); + int32_t classname_len = class_name ().length (); os.write (reinterpret_cast<char *> (&classname_len), 4); os << class_name (); @@ -1462,7 +1462,7 @@ else m = map_value (); - int32_t len = m.nfields(); + int32_t len = m.nfields (); os.write (reinterpret_cast<char *> (&len), 4); octave_map::iterator i = m.begin (); @@ -2189,7 +2189,7 @@ if (fcn && fcn->is_class_constructor ()) { - for (int i = 0; i < args.length(); i++) + for (int i = 0; i < args.length (); i++) { std::string class_name = args(i).string_value (); @@ -2241,7 +2241,7 @@ if (fcn && fcn->is_class_constructor ()) { - for (int i = 0; i < args.length(); i++) + for (int i = 0; i < args.length (); i++) { std::string class_name = args(i).string_value ();
--- a/src/ov-class.h +++ b/src/ov-class.h @@ -136,7 +136,7 @@ octave_value reshape (const dim_vector& new_dims) const { octave_class retval = octave_class (*this); - retval.map = retval.map_value().reshape (new_dims); + retval.map = retval.map_value ().reshape (new_dims); return octave_value (new octave_class (retval)); }
--- a/src/ov-cx-mat.cc +++ b/src/ov-cx-mat.cc @@ -437,11 +437,11 @@ octave_complex_matrix::save_binary (std::ostream& os, bool& save_as_floats) { dim_vector d = dims (); - if (d.length() < 1) + if (d.length () < 1) return false; // Use negative value for ndims to differentiate with old format!! - int32_t tmp = - d.length(); + int32_t tmp = - d.length (); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i = 0; i < d.length (); i++) {
--- a/src/ov-cx-sparse.cc +++ b/src/ov-cx-sparse.cc @@ -228,7 +228,7 @@ bool&save_as_floats) { dim_vector d = this->dims (); - if (d.length() < 1) + if (d.length () < 1) return false; // Ensure that additional memory is deallocated @@ -286,7 +286,7 @@ os.write (reinterpret_cast<char *> (&itmp), 4); } - write_doubles (os, reinterpret_cast<const double *> (matrix.data()), st, 2 * nz); + write_doubles (os, reinterpret_cast<const double *> (matrix.data ()), st, 2 * nz); return true; } @@ -476,7 +476,7 @@ H5Sclose (space_hid); - hdims[0] = m.cols() + 1; + hdims[0] = m.cols () + 1; hdims[1] = 1; space_hid = H5Screate_simple (2, hdims, 0); @@ -868,7 +868,7 @@ ir[i] = matrix.ridx(i); } - for (mwIndex i = 0; i < columns() + 1; i++) + for (mwIndex i = 0; i < columns () + 1; i++) jc[i] = matrix.cidx(i); return retval;
--- a/src/ov-fcn-handle.cc +++ b/src/ov-fcn-handle.cc @@ -401,14 +401,14 @@ std::streampos pos = is.tellg (); std::string octaveroot = extract_keyword (is, "octaveroot", true); - if (octaveroot.length() == 0) + if (octaveroot.length () == 0) { is.seekg (pos); is.clear (); } pos = is.tellg (); std::string fpath = extract_keyword (is, "path", true); - if (fpath.length() == 0) + if (fpath.length () == 0) { is.seekg (pos); is.clear (); @@ -533,7 +533,7 @@ else nmbuf << nm; - std::string buf_str = nmbuf.str(); + std::string buf_str = nmbuf.str (); int32_t tmp = buf_str.length (); os.write (reinterpret_cast<char *> (&tmp), 4); os.write (buf_str.c_str (), buf_str.length ()); @@ -598,11 +598,11 @@ size_t anl = anonymous.length (); - if (nm.length() >= anl && nm.substr (0, anl) == anonymous) + if (nm.length () >= anl && nm.substr (0, anl) == anonymous) { octave_idx_type len = 0; - if (nm.length() > anl) + if (nm.length () > anl) { std::istringstream nm_is (nm.substr (anl)); nm_is >> len;
--- a/src/ov-flt-cx-mat.cc +++ b/src/ov-flt-cx-mat.cc @@ -426,11 +426,11 @@ octave_float_complex_matrix::save_binary (std::ostream& os, bool&) { dim_vector d = dims (); - if (d.length() < 1) + if (d.length () < 1) return false; // Use negative value for ndims to differentiate with old format!! - int32_t tmp = - d.length(); + int32_t tmp = - d.length (); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i = 0; i < d.length (); i++) {
--- a/src/ov-flt-re-mat.cc +++ b/src/ov-flt-re-mat.cc @@ -459,11 +459,11 @@ { dim_vector d = dims (); - if (d.length() < 1) + if (d.length () < 1) return false; // Use negative value for ndims to differentiate with old format!! - int32_t tmp = - d.length(); + int32_t tmp = - d.length (); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i = 0; i < d.length (); i++) {
--- a/src/ov-intx.h +++ b/src/ov-intx.h @@ -145,7 +145,7 @@ Matrix retval; dim_vector dv = dims (); if (dv.length () > 2) - error ("invalid conversion of %s to Matrix", type_name().c_str ()); + error ("invalid conversion of %s to Matrix", type_name ().c_str ()); else { retval = Matrix (dv(0), dv(1)); @@ -163,7 +163,7 @@ FloatMatrix retval; dim_vector dv = dims (); if (dv.length () > 2) - error ("invalid conversion of %s to FloatMatrix", type_name().c_str ()); + error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ()); else { retval = FloatMatrix (dv(0), dv(1)); @@ -179,9 +179,9 @@ complex_matrix_value (bool = false) const { ComplexMatrix retval; - dim_vector dv = dims(); + dim_vector dv = dims (); if (dv.length () > 2) - error ("invalid conversion of %s to Matrix", type_name().c_str ()); + error ("invalid conversion of %s to Matrix", type_name ().c_str ()); else { retval = ComplexMatrix (dv(0), dv(1)); @@ -197,9 +197,9 @@ float_complex_matrix_value (bool = false) const { FloatComplexMatrix retval; - dim_vector dv = dims(); + dim_vector dv = dims (); if (dv.length () > 2) - error ("invalid conversion of %s to FloatMatrix", type_name().c_str ()); + error ("invalid conversion of %s to FloatMatrix", type_name ().c_str ()); else { retval = FloatComplexMatrix (dv(0), dv(1)); @@ -289,12 +289,12 @@ // Use matrix_ref here to clear index cache. void increment (void) { - matrix_ref() += OCTAVE_INT_T (1); + matrix_ref () += OCTAVE_INT_T (1); } void decrement (void) { - matrix_ref() -= OCTAVE_INT_T (1); + matrix_ref () -= OCTAVE_INT_T (1); } void changesign (void) @@ -479,14 +479,14 @@ if (fill) { intNDArray<OCTAVE_INT_T> retval (dv, 0); - if (dv.numel()) + if (dv.numel ()) retval(0) = scalar; return retval; } else { intNDArray<OCTAVE_INT_T> retval (dv); - if (dv.numel()) + if (dv.numel ()) retval(0) = scalar; return retval; }
--- a/src/ov-range.h +++ b/src/ov-range.h @@ -118,10 +118,10 @@ size_t byte_size (void) const { return 3 * sizeof (double); } octave_value reshape (const dim_vector& new_dims) const - { return NDArray (array_value().reshape (new_dims)); } + { return NDArray (array_value ().reshape (new_dims)); } octave_value permute (const Array<int>& vec, bool inv = false) const - { return NDArray (array_value().permute (vec, inv)); } + { return NDArray (array_value ().permute (vec, inv)); } octave_value squeeze (void) const { return range; }
--- a/src/ov-re-mat.cc +++ b/src/ov-re-mat.cc @@ -561,11 +561,11 @@ { dim_vector d = dims (); - if (d.length() < 1) + if (d.length () < 1) return false; // Use negative value for ndims to differentiate with old format!! - int32_t tmp = - d.length(); + int32_t tmp = - d.length (); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i = 0; i < d.length (); i++) {
--- a/src/ov-re-sparse.cc +++ b/src/ov-re-sparse.cc @@ -261,7 +261,7 @@ octave_sparse_matrix::save_binary (std::ostream& os, bool&save_as_floats) { dim_vector d = this->dims (); - if (d.length() < 1) + if (d.length () < 1) return false; // Ensure that additional memory is deallocated @@ -319,7 +319,7 @@ os.write (reinterpret_cast<char *> (&itmp), 4); } - write_doubles (os, matrix.data(), st, nz); + write_doubles (os, matrix.data (), st, nz); return true; } @@ -506,7 +506,7 @@ H5Sclose (space_hid); - hdims[0] = m.cols() + 1; + hdims[0] = m.cols () + 1; hdims[1] = 1; space_hid = H5Screate_simple (2, hdims, 0); @@ -857,13 +857,13 @@ mxArray * octave_sparse_matrix::as_mxArray (void) const { - mwSize nz = nzmax(); - mwSize nr = rows(); - mwSize nc = columns(); + mwSize nz = nzmax (); + mwSize nr = rows (); + mwSize nc = columns (); mxArray *retval = new mxArray (mxDOUBLE_CLASS, nr, nc, nz, mxREAL); double *pr = static_cast<double *> (retval->get_data ()); - mwIndex *ir = retval->get_ir(); - mwIndex *jc = retval->get_jc(); + mwIndex *ir = retval->get_ir (); + mwIndex *jc = retval->get_jc (); for (mwIndex i = 0; i < nz; i++) {
--- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -465,11 +465,11 @@ bool& /* save_as_floats */) { dim_vector d = dims (); - if (d.length() < 1) + if (d.length () < 1) return false; // Use negative value for ndims to differentiate with old format!! - int32_t tmp = - d.length(); + int32_t tmp = - d.length (); os.write (reinterpret_cast<char *> (&tmp), 4); for (int i=0; i < d.length (); i++) {
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -154,7 +154,7 @@ case '.': { - if (map.numel() > 0) + if (map.numel () > 0) { const Cell t = dotref (idx.front ()); @@ -220,7 +220,7 @@ case '.': { - if (map.numel() > 0) + if (map.numel () > 0) { const Cell t = dotref (idx.front (), auto_add); @@ -481,7 +481,7 @@ } else { - if (t_rhs.is_map() || t_rhs.is_object ()) + if (t_rhs.is_map () || t_rhs.is_object ()) { octave_map rhs_map = t_rhs.map_value (); @@ -502,9 +502,9 @@ } else { - if (t_rhs.is_null_value()) + if (t_rhs.is_null_value ()) { - map.delete_elements (idx.front()); + map.delete_elements (idx.front ()); if (! error_state) { @@ -823,7 +823,7 @@ return false; // Use negative value for ndims - int32_t di = - d.length(); + int32_t di = - d.length (); os.write (reinterpret_cast<char *> (&di), 4); for (int i = 0; i < d.length (); i++) { @@ -1079,7 +1079,7 @@ // itself. const octave_scalar_map *sm_ptr; void *here = reinterpret_cast<void *>(&sm_ptr); - return (x.get_rep().fast_elem_insert_self (here, btyp_struct) + return (x.get_rep ().fast_elem_insert_self (here, btyp_struct) && map.fast_elem_insert (n, *sm_ptr)); }
--- a/src/ov-usr-fcn.h +++ b/src/ov-usr-fcn.h @@ -278,7 +278,7 @@ { return anonymous_function ? (cname.empty () - ? (! dispatch_class().empty ()) + ? (! dispatch_class ().empty ()) : cname == dispatch_class ()) : false; }
--- a/src/ov.h +++ b/src/ov.h @@ -194,8 +194,8 @@ octave_value (float d); octave_value (const Array<octave_value>& a, bool is_cs_list = false); octave_value (const Cell& c, bool is_cs_list = false); - octave_value (const Matrix& m, const MatrixType& t = MatrixType()); - octave_value (const FloatMatrix& m, const MatrixType& t = MatrixType()); + octave_value (const Matrix& m, const MatrixType& t = MatrixType ()); + octave_value (const FloatMatrix& m, const MatrixType& t = MatrixType ()); octave_value (const NDArray& nda); octave_value (const FloatNDArray& nda); octave_value (const Array<double>& m); @@ -208,8 +208,8 @@ octave_value (const FloatColumnVector& v); octave_value (const Complex& C); octave_value (const FloatComplex& C); - octave_value (const ComplexMatrix& m, const MatrixType& t = MatrixType()); - octave_value (const FloatComplexMatrix& m, const MatrixType& t = MatrixType()); + octave_value (const ComplexMatrix& m, const MatrixType& t = MatrixType ()); + octave_value (const FloatComplexMatrix& m, const MatrixType& t = MatrixType ()); octave_value (const ComplexNDArray& cnda); octave_value (const FloatComplexNDArray& cnda); octave_value (const Array<Complex>& m); @@ -222,7 +222,7 @@ octave_value (const FloatComplexColumnVector& v); octave_value (const PermMatrix& p); octave_value (bool b); - octave_value (const boolMatrix& bm, const MatrixType& t = MatrixType()); + octave_value (const boolMatrix& bm, const MatrixType& t = MatrixType ()); octave_value (const boolNDArray& bnda); octave_value (const Array<bool>& bnda); octave_value (char c, char type = '\''); @@ -458,7 +458,7 @@ int ndims (void) const { return rep->ndims (); } - bool all_zero_dims (void) const { return dims().all_zero (); } + bool all_zero_dims (void) const { return dims ().all_zero (); } octave_idx_type numel (void) const { return rep->numel (); }
--- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -375,7 +375,7 @@ std::ostringstream buf2; buf2.flags (std::ios::fixed); buf2 << std::setprecision (0) << static_cast<int>(n); - s = buf2.str(); + s = buf2.str (); while (1) { @@ -407,15 +407,15 @@ if (n < 0 && d < 0) { // Double negative, string can be two characters longer.. - if (buf.str().length() > static_cast<unsigned int>(len + 2) && + if (buf.str ().length () > static_cast<unsigned int>(len + 2) && m > 1) break; } - else if (buf.str().length() > static_cast<unsigned int>(len) && + else if (buf.str ().length () > static_cast<unsigned int>(len) && m > 1) break; - s = buf.str(); + s = buf.str (); } if (lastd < 0.) @@ -427,7 +427,7 @@ buf.flags (std::ios::fixed); buf << std::setprecision (0) << static_cast<int>(lastn) << "/" << static_cast<int>(lastd); - s = buf.str(); + s = buf.str (); } } @@ -460,7 +460,7 @@ os.flags (static_cast<std::ios::fmtflags> (prf.f.fmt | prf.f.up | prf.f.sp)); - if (fw > 0 && s.length() > static_cast<unsigned int>(fw)) + if (fw > 0 && s.length () > static_cast<unsigned int>(fw)) os << "*"; else os << s; @@ -2964,8 +2964,8 @@ /* static */ inline void pr_int (std::ostream& os, const T& d, int fw = 0) { - size_t sz = d.byte_size(); - const unsigned char * tmpi = d.iptr(); + size_t sz = d.byte_size (); + const unsigned char * tmpi = d.iptr (); // Unless explicitly asked for, always print in big-endian // format for hex and bit formats.
--- a/src/pt-id.cc +++ b/src/pt-id.cc @@ -114,7 +114,11 @@ octave_lvalue tree_identifier::lvalue (void) { +<<<<<<< local return octave_lvalue (&(sym->varref ())); +======= + return octave_lvalue (&(xsym ().varref ())); +>>>>>>> other } tree_identifier *
--- a/src/pt-id.h +++ b/src/pt-id.h @@ -63,9 +63,17 @@ // accessing it through sym so that this function may remain const. std::string name (void) const { return sym.name (); } +<<<<<<< local bool is_defined (void) { return sym->is_defined (); } +======= + bool is_defined (void) { return xsym ().is_defined (); } +>>>>>>> other +<<<<<<< local virtual bool is_variable (void) { return sym->is_variable (); } +======= + virtual bool is_variable (void) { return xsym ().is_variable (); } +>>>>>>> other virtual bool is_black_hole (void) { return false; } @@ -87,14 +95,30 @@ octave_value do_lookup (const octave_value_list& args = octave_value_list ()) { +<<<<<<< local return sym->find (args); +======= + return xsym ().find (args); +>>>>>>> other } +<<<<<<< local void mark_global (void) { sym->mark_global (); } +======= + void mark_global (void) { xsym ().mark_global (); } +>>>>>>> other +<<<<<<< local void mark_as_static (void) { sym->init_persistent (); } +======= + void mark_as_static (void) { xsym ().init_persistent (); } +>>>>>>> other +<<<<<<< local void mark_as_formal_parameter (void) { sym->mark_formal (); } +======= + void mark_as_formal_parameter (void) { xsym ().mark_formal (); } +>>>>>>> other // We really need to know whether this symbol referst to a variable // or a function, but we may not know that yet.
--- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -1110,7 +1110,7 @@ } } - ctmp = (*(tmp.begin() -> begin())); + ctmp = (*(tmp.begin () -> begin ())); found_non_empty:
--- a/src/pt-select.cc +++ b/src/pt-select.cc @@ -123,7 +123,7 @@ { octave_value label_value = label->rvalue1 (); - if (! error_state && label_value.is_defined() ) + if (! error_state && label_value.is_defined () ) { if (label_value.is_cell ()) {
--- a/src/sparse.cc +++ b/src/sparse.cc @@ -48,7 +48,7 @@ @seealso{ismatrix}\n\ @end deftypefn") { - if (args.length() != 1) + if (args.length () != 1) { print_usage (); return octave_value ();
--- a/src/strfns.cc +++ b/src/strfns.cc @@ -858,11 +858,13 @@ DEFUN (list_in_columns, args, , "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} list_in_columns (@var{arg}, @var{width})\n\ +@deftypefn {Built-in Function} {} list_in_columns (@var{arg}, @var{width}, @var{prefix})\n\ Return a string containing the elements of @var{arg} listed in\n\ -columns with an overall maximum width of @var{width}. The argument\n\ -@var{arg} must be a cell array of character strings or a character array.\n\ -If @var{width} is not specified, the width of the terminal screen is used.\n\ +columns with an overall maximum width of @var{width} and optional\n\ +prefix @var{prefix}. The argument @var{arg} must be a cell array\n\ +of character strings or a character array. If @var{width} is not\n\ +specified or is an empty matrix, or less than or equal to zero,\n\ +the width of the terminal screen is used.\n\ Newline characters are used to break the lines in the output string.\n\ For example:\n\ @c Set example in small font to prevent overfull line\n\ @@ -893,34 +895,59 @@ int nargin = args.length (); - if (nargin == 1 || nargin == 2) + if (nargin < 1 || nargin > 3) { - string_vector s = args(0).all_strings (); + print_usage (); + return retval; + } + + string_vector s = args(0).all_strings (); - if (! error_state) - { - std::ostringstream buf; + if (error_state) + { + error ("list_in_columns: expecting cellstr or char array"); + return retval; + } + + int width = -1; + + if (nargin > 1 && ! args(1).is_empty ()) + { + width = args(1).int_value (); - if (nargin == 1) - // Let list_in_columns query terminal width. - s.list_in_columns (buf); - else - { - int width = args(1).int_value (); + if (error_state) + { + error ("list_in_columns: WIDTH must be an integer"); + return retval; + } + } + + std::string prefix; - if (! error_state) - s.list_in_columns (buf, width); - else - error ("list_in_columns: WIDTH must be an integer"); + if (nargin > 2) + { + if (args(2).is_string ()) + { + prefix = args(2).string_value (); + + if (error_state) + { + error ("list_in_columns: PREFIX must be a character string"); + return retval; } - - retval = buf.str (); } else - error ("list_in_columns: expecting cellstr or char array"); + { + error ("list_in_columns: PREFIX must be a character string"); + return retval; + } } - else - print_usage (); + + std::ostringstream buf; + + s.list_in_columns (buf, width, prefix); + + retval = buf.str (); return retval; } @@ -934,8 +961,13 @@ %! input = ["abc"; "def"; "ghijkl"; "mnop"; "qrs"; "tuv"]; %! result = "abc mnop \ndef qrs \nghijkl tuv \n"; %! assert (list_in_columns (input, 20), result); +%!test +%! input = ["abc"; "def"; "ghijkl"; "mnop"; "qrs"; "tuv"]; +%! result = " abc mnop \n def qrs \n ghijkl tuv \n"; +%! assert (list_in_columns (input, 20, " "), result); %!error list_in_columns () %!error list_in_columns (["abc", "def"], 20, 2) +%!error list_in_columns (["abc", "def"], 20, " ", 3) %!error <invalid conversion from string to real scalar> list_in_columns (["abc", "def"], "a") */
--- a/src/symtab.cc +++ b/src/symtab.cc @@ -1141,9 +1141,9 @@ install_subfunction (name, fcn, parent_scope); // Stash the nest_parent for resolving variables after parsing is done. - octave_function *fv = fcn.function_value(); + octave_function *fv = fcn.function_value (); - symbol_table *fcn_table_loc = get_instance (fv->scope()); + symbol_table *fcn_table_loc = get_instance (fv->scope ()); symbol_table *parent_table = get_instance (parent_scope); @@ -1491,7 +1491,7 @@ ours.set_curr_fcn (curr_fcn); } } - else if (nest_children.size()) + else if (nest_children.size ()) for (table_iterator ti = table.begin (); ti != table.end (); ++ti) ti->second.set_curr_fcn (curr_fcn);
--- a/src/symtab.h +++ b/src/symtab.h @@ -2402,7 +2402,7 @@ { symbol_record& sr = p->second; octave_value& val = sr.varref (); - if (val.is_object()) + if (val.is_object ()) p->second.clear (my_scope); } }
--- a/src/syscalls.cc +++ b/src/syscalls.cc @@ -291,7 +291,7 @@ if (nargin >= 1 && nargin <= 3) { - std::string exec_file = args(0).string_value(); + std::string exec_file = args(0).string_value (); if (! error_state) { @@ -324,7 +324,7 @@ if (! error_state) { - bool sync_mode = (nargin == 3 ? args(2).bool_value() : false); + bool sync_mode = (nargin == 3 ? args(2).bool_value () : false); if (! error_state) {
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -962,7 +962,7 @@ PROCESS_INFORMATION pi; ZeroMemory (&si, sizeof (si)); ZeroMemory (&pi, sizeof (pi)); - OCTAVE_LOCAL_BUFFER (char, xcmd_str, cmd_str.length()+1); + OCTAVE_LOCAL_BUFFER (char, xcmd_str, cmd_str.length ()+1); strcpy (xcmd_str, cmd_str.c_str ()); if (! CreateProcess (0, xcmd_str, 0, 0, FALSE, 0, 0, 0, &si, &pi))
--- a/src/txt-eng-ft.cc +++ b/src/txt-eng-ft.cc @@ -240,7 +240,7 @@ ft_render::ft_render (void) : text_processor (), face (0), bbox (1, 4, 0.0), xoffset (0), yoffset (0), multiline_halign (0), - multiline_align_xoffsets(), mode (MODE_BBOX), + multiline_align_xoffsets (), mode (MODE_BBOX), red (0), green (0), blue (0) { } @@ -314,7 +314,7 @@ FT_UInt glyph_index, previous = 0; if (mode == MODE_BBOX) - multiline_align_xoffsets.clear(); + multiline_align_xoffsets.clear (); else if (mode == MODE_RENDER) xoffset += multiline_align_xoffsets[line_index]; @@ -376,8 +376,8 @@ for (int c = 0; c < bitmap.width; c++) { unsigned char pix = bitmap.buffer[r*bitmap.width+c]; - if (x0+c < 0 || x0+c >= pixels.dim2() - || y0-r < 0 || y0-r >= pixels.dim3()) + if (x0+c < 0 || x0+c >= pixels.dim2 () + || y0-r < 0 || y0-r >= pixels.dim3 ()) { //::error ("out-of-bound indexing!!"); } @@ -467,7 +467,7 @@ /* Push last the width associated with the last line */ multiline_align_xoffsets.push_back(box_line_width); - for (unsigned int i = 0; i < multiline_align_xoffsets.size(); i++) + for (unsigned int i = 0; i < multiline_align_xoffsets.size (); i++) { /* Center align */ if (multiline_halign == 1) @@ -529,7 +529,7 @@ Array<idx_vector> idx (dim_vector (3, 1)); idx(0) = idx_vector (':'); - idx(1) = idx_vector (pixels.dim2()-1, -1, -1); + idx(1) = idx_vector (pixels.dim2 ()-1, -1, -1); idx(2) = idx_vector (':'); pixels = uint8NDArray (pixels.index (idx)); } @@ -538,8 +538,8 @@ { Array<idx_vector> idx (dim_vector (3, 1)); idx(0) = idx_vector (':'); - idx(1) = idx_vector (pixels.dim2()-1, -1, -1); - idx(2)= idx_vector (pixels.dim3()-1, -1, -1); + idx(1) = idx_vector (pixels.dim2 ()-1, -1, -1); + idx(2)= idx_vector (pixels.dim3 ()-1, -1, -1); pixels = uint8NDArray (pixels.index (idx)); } break; @@ -554,7 +554,7 @@ Array<idx_vector> idx (dim_vector (3, 1)); idx(0) = idx_vector (':'); idx(1) = idx_vector (':'); - idx(2) = idx_vector (pixels.dim3()-1, -1, -1); + idx(2) = idx_vector (pixels.dim3 ()-1, -1, -1); pixels = uint8NDArray (pixels.index (idx)); } break;
--- a/src/variables.cc +++ b/src/variables.cc @@ -1519,7 +1519,7 @@ // Push parameter into list ... idx += text.length (); param.text=text; - param.line.assign (text.length(), ' '); + param.line.assign (text.length (), ' '); params.push_back (param); } } @@ -1976,7 +1976,7 @@ { octave_value_list retval; - if (args.length() == 1) + if (args.length () == 1) { std::string name = args(0).string_value (); @@ -2012,7 +2012,7 @@ { octave_value retval; - if (args.length() == 1) + if (args.length () == 1) { std::string name = args(0).string_value ();
--- a/src/zfstream.cc +++ b/src/zfstream.cc @@ -52,24 +52,24 @@ /*****************************************************************************/ // Default constructor -gzfilebuf::gzfilebuf() +gzfilebuf::gzfilebuf () : file(0), io_mode(std::ios_base::openmode(0)), own_fd(false), buffer(0), buffer_size(BIGBUFSIZE), own_buffer(true) { // No buffers to start with - this->disable_buffer(); + this->disable_buffer (); } // Destructor -gzfilebuf::~gzfilebuf() +gzfilebuf::~gzfilebuf () { // Sync output buffer and close only if responsible for file // (i.e. attached streams should be left open at this stage) - this->sync(); + this->sync (); if (own_fd) - this->close(); + this->close (); // Make sure internal buffer is deallocated - this->disable_buffer(); + this->disable_buffer (); } // Set compression level and strategy @@ -86,7 +86,7 @@ std::ios_base::openmode mode) { // Fail if file already open - if (this->is_open()) + if (this->is_open ()) return 0; // Don't support simultaneous read/write access (yet) if ((mode & std::ios_base::in) && (mode & std::ios_base::out)) @@ -102,7 +102,7 @@ return 0; // On success, allocate internal buffer and set flags - this->enable_buffer(); + this->enable_buffer (); io_mode = mode; own_fd = true; return this; @@ -114,7 +114,7 @@ std::ios_base::openmode mode) { // Fail if file already open - if (this->is_open()) + if (this->is_open ()) return 0; // Don't support simultaneous read/write access (yet) if ((mode & std::ios_base::in) && (mode & std::ios_base::out)) @@ -130,7 +130,7 @@ return 0; // On success, allocate internal buffer and set flags - this->enable_buffer(); + this->enable_buffer (); io_mode = mode; own_fd = false; return this; @@ -138,15 +138,15 @@ // Close gzipped file gzfilebuf* -gzfilebuf::close() +gzfilebuf::close () { // Fail immediately if no file is open - if (!this->is_open()) + if (!this->is_open ()) return 0; // Assume success gzfilebuf* retval = this; // Attempt to sync and close gzipped file - if (this->sync() == -1) + if (this->sync () == -1) retval = 0; if (gzclose(file) < 0) retval = 0; @@ -154,7 +154,7 @@ file = 0; own_fd = false; // Destroy internal buffer if it exists - this->disable_buffer(); + this->disable_buffer (); return retval; } @@ -202,14 +202,14 @@ // Determine number of characters in internal get buffer std::streamsize -gzfilebuf::showmanyc() +gzfilebuf::showmanyc () { // Calls to underflow will fail if file not opened for reading - if (!this->is_open() || !(io_mode & std::ios_base::in)) + if (!this->is_open () || !(io_mode & std::ios_base::in)) return -1; // Make sure get area is in use - if (this->gptr() && (this->gptr() < this->egptr())) - return std::streamsize(this->egptr() - this->gptr()); + if (this->gptr () && (this->gptr () < this->egptr ())) + return std::streamsize(this->egptr () - this->gptr ()); else return 0; } @@ -221,10 +221,10 @@ gzfilebuf::int_type gzfilebuf::pbackfail (gzfilebuf::int_type c) { - if (this->is_open()) + if (this->is_open ()) { - if (gzseek (file, this->gptr() - this->egptr() - 1, SEEK_CUR) < 0) - return traits_type::eof(); + if (gzseek (file, this->gptr () - this->egptr () - 1, SEEK_CUR) < 0) + return traits_type::eof (); // Invalidates contents of the buffer enable_buffer (); @@ -237,7 +237,7 @@ { // Reset get area this->setg(buffer, buffer, buffer); - return traits_type::eof(); + return traits_type::eof (); } // Make all bytes read from file available as get area @@ -245,37 +245,37 @@ // If next character in get area differs from putback character // flag a failure - gzfilebuf::int_type ret = traits_type::to_int_type(*(this->gptr())); + gzfilebuf::int_type ret = traits_type::to_int_type(*(this->gptr ())); if (ret != c) - return traits_type::eof(); + return traits_type::eof (); else return ret; } else - return traits_type::eof(); + return traits_type::eof (); } // Fill get area from gzipped file gzfilebuf::int_type -gzfilebuf::underflow() +gzfilebuf::underflow () { // If something is left in the get area by chance, return it // (this shouldn't normally happen, as underflow is only supposed // to be called when gptr >= egptr, but it serves as error check) - if (this->gptr() && (this->gptr() < this->egptr())) - return traits_type::to_int_type(*(this->gptr())); + if (this->gptr () && (this->gptr () < this->egptr ())) + return traits_type::to_int_type(*(this->gptr ())); // If the file hasn't been opened for reading, produce error - if (!this->is_open() || !(io_mode & std::ios_base::in)) - return traits_type::eof(); + if (!this->is_open () || !(io_mode & std::ios_base::in)) + return traits_type::eof (); // Copy the final characters to the front of the buffer int stash = 0; - if (this->eback() && buffer && buffer_size > STASHED_CHARACTERS) + if (this->eback () && buffer && buffer_size > STASHED_CHARACTERS) { char_type *ptr1 = buffer; - char_type *ptr2 = this->egptr() - STASHED_CHARACTERS + 1; - if (ptr2 > this->eback()) + char_type *ptr2 = this->egptr () - STASHED_CHARACTERS + 1; + if (ptr2 > this->eback ()) while (stash++ <= STASHED_CHARACTERS) *ptr1++ = *ptr2++; } @@ -289,13 +289,13 @@ { // Reset get area this->setg(buffer, buffer, buffer); - return traits_type::eof(); + return traits_type::eof (); } // Make all bytes read from file plus the stash available as get area this->setg(buffer, buffer + stash, buffer + bytes_read + stash); // Return next character in get area - return traits_type::to_int_type(*(this->gptr())); + return traits_type::to_int_type(*(this->gptr ())); } // Write put area to gzipped file @@ -303,48 +303,48 @@ gzfilebuf::overflow(int_type c) { // Determine whether put area is in use - if (this->pbase()) + if (this->pbase ()) { // Double-check pointer range - if (this->pptr() > this->epptr() || this->pptr() < this->pbase()) - return traits_type::eof(); + if (this->pptr () > this->epptr () || this->pptr () < this->pbase ()) + return traits_type::eof (); // Add extra character to buffer if not EOF - if (!traits_type::eq_int_type(c, traits_type::eof())) + if (!traits_type::eq_int_type(c, traits_type::eof ())) { *(this->pptr()) = traits_type::to_char_type(c); this->pbump(1); } // Number of characters to write to file - int bytes_to_write = this->pptr() - this->pbase(); + int bytes_to_write = this->pptr () - this->pbase (); // Overflow doesn't fail if nothing is to be written if (bytes_to_write > 0) { // If the file hasn't been opened for writing, produce error - if (!this->is_open() || !(io_mode & std::ios_base::out)) - return traits_type::eof(); + if (!this->is_open () || !(io_mode & std::ios_base::out)) + return traits_type::eof (); // If gzipped file won't accept all bytes written to it, fail - if (gzwrite(file, this->pbase(), bytes_to_write) != bytes_to_write) - return traits_type::eof(); + if (gzwrite(file, this->pbase (), bytes_to_write) != bytes_to_write) + return traits_type::eof (); // Reset next pointer to point to pbase on success this->pbump(-bytes_to_write); } } // Write extra character to file if not EOF - else if (!traits_type::eq_int_type(c, traits_type::eof())) + else if (!traits_type::eq_int_type(c, traits_type::eof ())) { // If the file hasn't been opened for writing, produce error - if (!this->is_open() || !(io_mode & std::ios_base::out)) - return traits_type::eof(); + if (!this->is_open () || !(io_mode & std::ios_base::out)) + return traits_type::eof (); // Impromptu char buffer (allows "unbuffered" output) char_type last_char = traits_type::to_char_type(c); // If gzipped file won't accept this character, fail if (gzwrite(file, &last_char, 1) != 1) - return traits_type::eof(); + return traits_type::eof (); } // If you got here, you have succeeded (even if c was EOF) // The return value should therefore be non-EOF - if (traits_type::eq_int_type(c, traits_type::eof())) + if (traits_type::eq_int_type(c, traits_type::eof ())) return traits_type::not_eof(c); else return c; @@ -356,7 +356,7 @@ std::streamsize n) { // First make sure stuff is sync'ed, for safety - if (this->sync() == -1) + if (this->sync () == -1) return 0; // If buffering is turned off on purpose via setbuf(0,0), still allocate one... // "Unbuffered" only really refers to put [27.8.1.4.10], while get needs at @@ -365,36 +365,36 @@ if (!p || !n) { // Replace existing buffer (if any) with small internal buffer - this->disable_buffer(); + this->disable_buffer (); buffer = 0; buffer_size = 0; own_buffer = true; - this->enable_buffer(); + this->enable_buffer (); } else { // Replace existing buffer (if any) with external buffer - this->disable_buffer(); + this->disable_buffer (); buffer = p; buffer_size = n; own_buffer = false; - this->enable_buffer(); + this->enable_buffer (); } return this; } // Write put area to gzipped file (i.e. ensures that put area is empty) int -gzfilebuf::sync() +gzfilebuf::sync () { - return traits_type::eq_int_type(this->overflow(), traits_type::eof()) ? -1 : 0; + return traits_type::eq_int_type(this->overflow (), traits_type::eof ()) ? -1 : 0; } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ // Allocate internal buffer void -gzfilebuf::enable_buffer() +gzfilebuf::enable_buffer () { // If internal buffer required, allocate one if (own_buffer && !buffer) @@ -433,13 +433,13 @@ // Destroy internal buffer void -gzfilebuf::disable_buffer() +gzfilebuf::disable_buffer () { // If internal buffer exists, deallocate it if (own_buffer && buffer) { // Preserve unbuffered status by zeroing size - if (!this->pbase()) + if (!this->pbase ()) buffer_size = 0; delete[] buffer; buffer = 0; @@ -466,12 +466,12 @@ { pos_type ret = pos_type (off_type (-1)); - if (this->is_open()) + if (this->is_open ()) { off_type computed_off = off; if ((io_mode & std::ios_base::in) && way == std::ios_base::cur) - computed_off += this->gptr() - this->egptr(); + computed_off += this->gptr () - this->egptr (); if (way == std::ios_base::beg) ret = pos_type (gzseek (file, computed_off, SEEK_SET)); @@ -515,14 +515,14 @@ /*****************************************************************************/ // Default constructor initializes stream buffer -gzifstream::gzifstream() -: std::istream(0), sb() +gzifstream::gzifstream () +: std::istream(0), sb () { this->init(&sb); } // Initialize stream buffer and open file gzifstream::gzifstream(const char* name, std::ios_base::openmode mode) -: std::istream(0), sb() +: std::istream(0), sb () { this->init(&sb); this->open(name, mode); @@ -531,7 +531,7 @@ // Initialize stream buffer and attach to file gzifstream::gzifstream(int fd, std::ios_base::openmode mode) -: std::istream(0), sb() +: std::istream(0), sb () { this->init(&sb); this->attach(fd, mode); @@ -545,7 +545,7 @@ if (!sb.open(name, mode | std::ios_base::in)) this->setstate(std::ios_base::failbit); else - this->clear(); + this->clear (); } // Attach to file and go into fail() state if unsuccessful @@ -556,28 +556,28 @@ if (!sb.attach(fd, mode | std::ios_base::in)) this->setstate(std::ios_base::failbit); else - this->clear(); + this->clear (); } // Close file void -gzifstream::close() +gzifstream::close () { - if (!sb.close()) + if (!sb.close ()) this->setstate(std::ios_base::failbit); } /*****************************************************************************/ // Default constructor initializes stream buffer -gzofstream::gzofstream() -: std::ostream(0), sb() +gzofstream::gzofstream () +: std::ostream(0), sb () { this->init(&sb); } // Initialize stream buffer and open file gzofstream::gzofstream(const char* name, std::ios_base::openmode mode) -: std::ostream(0), sb() +: std::ostream(0), sb () { this->init(&sb); this->open(name, mode); @@ -586,7 +586,7 @@ // Initialize stream buffer and attach to file gzofstream::gzofstream(int fd, std::ios_base::openmode mode) -: std::ostream(0), sb() +: std::ostream(0), sb () { this->init(&sb); this->attach(fd, mode); @@ -600,7 +600,7 @@ if (!sb.open(name, mode | std::ios_base::out)) this->setstate(std::ios_base::failbit); else - this->clear(); + this->clear (); } // Attach to file and go into fail() state if unsuccessful @@ -611,14 +611,14 @@ if (!sb.attach(fd, mode | std::ios_base::out)) this->setstate(std::ios_base::failbit); else - this->clear(); + this->clear (); } // Close file void -gzofstream::close() +gzofstream::close () { - if (!sb.close()) + if (!sb.close ()) this->setstate(std::ios_base::failbit); }
--- a/src/zfstream.h +++ b/src/zfstream.h @@ -53,11 +53,11 @@ { public: // Default constructor. - gzfilebuf(); + gzfilebuf (); // Destructor. virtual - ~gzfilebuf(); + ~gzfilebuf (); /** * @brief Set compression level and strategy on the fly. @@ -79,7 +79,7 @@ * @return True if file is open. */ bool - is_open() const { return (file != 0); } + is_open () const { return (file != 0); } /** * @brief Open gzipped file. @@ -106,7 +106,7 @@ * @return @c this on success, NULL on failure. */ gzfilebuf* - close(); + close (); protected: /** @@ -125,7 +125,7 @@ * These characters can be read without accessing the gzipped file. */ virtual std::streamsize - showmanyc(); + showmanyc (); /** * @brief Fill get area from gzipped file. @@ -135,7 +135,7 @@ * buffer. Always buffered. */ virtual int_type - underflow(); + underflow (); /** * @brief Write put area to gzipped file. @@ -147,7 +147,7 @@ * character at a time. */ virtual int_type - overflow(int_type c = traits_type::eof()); + overflow(int_type c = traits_type::eof ()); /** * @brief Installs external stream buffer. @@ -168,7 +168,7 @@ * This calls underflow(EOF) to do the job. */ virtual int - sync(); + sync (); /** * @brief Alters the stream positions. @@ -190,7 +190,7 @@ std::ios_base::in|std::ios_base::out); virtual int_type - pbackfail (int_type c = traits_type::eof()); + pbackfail (int_type c = traits_type::eof ()); // // Some future enhancements @@ -215,7 +215,7 @@ * reset to their original state. */ void - enable_buffer(); + enable_buffer (); /** * @brief Destroy internal buffer. @@ -225,7 +225,7 @@ * case, it will also reset the buffer pointers. */ void - disable_buffer(); + disable_buffer (); /** * Underlying file pointer. @@ -282,7 +282,7 @@ { public: // Default constructor - gzifstream(); + gzifstream (); /** * @brief Construct stream on gzipped file to be opened. @@ -306,7 +306,7 @@ * Obtain underlying stream buffer. */ gzfilebuf* - rdbuf() const + rdbuf () const { return const_cast<gzfilebuf*>(&sb); } /** @@ -314,7 +314,7 @@ * @return True if file is open. */ bool - is_open() { return sb.is_open(); } + is_open () { return sb.is_open (); } /** * @brief Open gzipped file. @@ -350,7 +350,7 @@ * Stream will be in state fail() if close failed. */ void - close(); + close (); private: /** @@ -371,7 +371,7 @@ { public: // Default constructor - gzofstream(); + gzofstream (); /** * @brief Construct stream on gzipped file to be opened. @@ -395,7 +395,7 @@ * Obtain underlying stream buffer. */ gzfilebuf* - rdbuf() const + rdbuf () const { return const_cast<gzfilebuf*>(&sb); } /** @@ -403,7 +403,7 @@ * @return True if file is open. */ bool - is_open() { return sb.is_open(); } + is_open () { return sb.is_open (); } /** * @brief Open gzipped file. @@ -439,7 +439,7 @@ * Stream will be in state fail() if close failed. */ void - close(); + close (); private: /** @@ -486,7 +486,7 @@ inline gzofstream& setcompression(gzofstream &gzs, int l, int s = Z_DEFAULT_STRATEGY) { - (gzs.rdbuf())->setcompression(l, s); + (gzs.rdbuf ())->setcompression(l, s); return gzs; }
--- a/test/classes/@Dork/Dork.m +++ b/test/classes/@Dork/Dork.m @@ -5,7 +5,7 @@ else s.gack = 0; if nargin == 0 - s0 = Snork(); + s0 = Snork (); elseif nargin==1 s0 = Snork(gick); else
--- a/test/classes/@Dork/getStash.m +++ b/test/classes/@Dork/getStash.m @@ -1,5 +1,5 @@ function [ out ] = getStash(cls) - out = myStash(); + out = myStash (); end
--- a/test/classes/@Dork/private/myStash.m +++ b/test/classes/@Dork/private/myStash.m @@ -1,4 +1,4 @@ -function [ out ] = myStash() +function [ out ] = myStash () out = 2;
--- a/test/classes/@Gork/Gork.m +++ b/test/classes/@Gork/Gork.m @@ -4,9 +4,9 @@ return; end - drk = Dork(); - prk = Pork(); - blrk = Blork(); + drk = Dork (); + prk = Pork (); + blrk = Blork (); s.Cork = Cork(17); % Aggregation. s.gark = -2; s.gyrk = -3;
--- a/test/classes/@Pork/Pork.m +++ b/test/classes/@Pork/Pork.m @@ -5,7 +5,7 @@ else s.gurk = 0; if nargin == 0 - s0 = Spork(); + s0 = Spork (); elseif nargin==1 s0 = Spork(geek); else
--- a/test/classes/@Pork/private/myStash.m +++ b/test/classes/@Pork/private/myStash.m @@ -1,4 +1,4 @@ -function [ out ] = myStash() +function [ out ] = myStash () out = 4;
--- a/test/classes/@Snork/getStash.m +++ b/test/classes/@Snork/getStash.m @@ -1,5 +1,5 @@ function [ out ] = getStash(cls) - out = myStash(); + out = myStash (); end
--- a/test/classes/@Snork/private/myStash.m +++ b/test/classes/@Snork/private/myStash.m @@ -1,4 +1,4 @@ -function [ out ] = myStash() +function [ out ] = myStash () out = 1;
--- a/test/classes/@Spork/getStash.m +++ b/test/classes/@Spork/getStash.m @@ -1,5 +1,5 @@ function [ out ] = getStash(cls) - out = myStash(); + out = myStash (); end