# HG changeset patch # User John W. Eaton # Date 1295562299 18000 # Node ID 12df7854fa7ccc7457baea63f7263b6e22bf77d5 # Parent 1473d0cf86d210e31834f6806e070f4d2a565453 strip trailing whitespace from source files diff -r 1473d0cf86d2 -r 12df7854fa7c libcruft/ChangeLog --- a/libcruft/ChangeLog Thu Jan 20 17:21:27 2011 -0500 +++ b/libcruft/ChangeLog Thu Jan 20 17:24:59 2011 -0500 @@ -1,3 +1,8 @@ +2011-01-20 John W. Eaton + + * misc/cquit.c, misc/f77-fcn.h, misc/quit.cc: Strip trailing + whitespace. + 2011-01-14 John W. Eaton * Update copyright notices for 2011. diff -r 1473d0cf86d2 -r 12df7854fa7c libcruft/misc/cquit.c --- a/libcruft/misc/cquit.c Thu Jan 20 17:21:27 2011 -0500 +++ b/libcruft/misc/cquit.c Thu Jan 20 17:24:59 2011 -0500 @@ -98,10 +98,10 @@ DEBUGs ("enter w32_set_context"); SuspendThread (w32_main_thread); DEBUGs ("main suspended"); - if (! SetThreadContext (w32_main_thread, context)) + if (! SetThreadContext (w32_main_thread, context)) { fprintf (stderr, "%lx: context failed: ctrl-c won't work\n", - GetCurrentThreadId ()); + GetCurrentThreadId ()); fflush (stderr); } DEBUGs ("context captured (or not)"); @@ -112,7 +112,7 @@ return 0; } -static void +static void w32_raise_in_main (void) { DWORD threadid; @@ -127,16 +127,16 @@ CloseHandle (w32_restore_thread); w32_restore_thread = CreateThread (NULL, 10000, w32_reset_context, &w32_signal_context, 0, &threadid); - if (w32_restore_thread == NULL) + if (w32_restore_thread == NULL) { - fprintf (stderr, "w32_raise_in_main couldn't create thread\n"); + fprintf (stderr, "w32_raise_in_main couldn't create thread\n"); fflush (stderr); - } - else + } + else { DEBUGs ("waiting to restore raise context"); WaitForSingleObject (w32_restore_thread, INFINITE); - fprintf (stderr, "w32_raise_in_main couldn't restore context\n"); + fprintf (stderr, "w32_raise_in_main couldn't restore context\n"); fflush (stderr); } } @@ -157,14 +157,14 @@ { int ret; - if (w32_in_main_thread ()) + if (w32_in_main_thread ()) { /* Called from main thread -- a simple raise () should work. */ DEBUGd ("raising signal %d within main", signal); raise (sig); DEBUGd ("returning from signal %d within main", signal); - } - else + } + else { /* Called from alternate thread -- call w32_raise_in_main in the main thread with w32_signal_to_raise set to the signal */ @@ -174,7 +174,7 @@ /* Suspend main and remember the context. */ SuspendThread (w32_main_thread); /* X86 code */ - w32_signal_context.ContextFlags + w32_signal_context.ContextFlags = CONTEXT_FULL|CONTEXT_FLOATING_POINT|CONTEXT_DEBUG_REGISTERS; GetThreadContext (w32_main_thread, &w32_signal_context); diff -r 1473d0cf86d2 -r 12df7854fa7c libcruft/misc/f77-fcn.h --- a/libcruft/misc/f77-fcn.h Thu Jan 20 17:21:27 2011 -0500 +++ b/libcruft/misc/f77-fcn.h Thu Jan 20 17:24:59 2011 -0500 @@ -102,7 +102,7 @@ Fortran-style character strings. */ #define F77_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s #define F77_CONST_CHAR_ARG_DEF(s, len) octave_cray_ftn_ch_dsc s -#define F77_CHAR_ARG_LEN_DEF(len) +#define F77_CHAR_ARG_LEN_DEF(len) #define F77_CHAR_ARG_USE(s) s.ptr #define F77_CHAR_ARG_LEN_USE(s, len) (s.mask.len>>3) @@ -171,7 +171,7 @@ Fortran-style character strings. */ #define F77_CHAR_ARG_DEF(s, len) char *s, int len #define F77_CONST_CHAR_ARG_DEF(s, len) const char *s, int len -#define F77_CHAR_ARG_LEN_DEF(len) +#define F77_CHAR_ARG_LEN_DEF(len) #define F77_CHAR_ARG_USE(s) s #define F77_CHAR_ARG_LEN_USE(s, len) len @@ -209,13 +209,13 @@ /* Build a C string local variable CS from the Fortran string parameter S declared as F77_CHAR_ARG_DEF(s, len) or F77_CONST_CHAR_ARG_DEF(s, len). - The string will be cleaned up at the end of the current block. + The string will be cleaned up at the end of the current block. Needs to include and . */ #define F77_CSTRING(s, len, cs) \ OCTAVE_LOCAL_BUFFER (char, cs, F77_CHAR_ARG_LEN_USE (s, len) + 1); \ memcpy (cs, F77_CHAR_ARG_USE (s), F77_CHAR_ARG_LEN_USE (s, len)); \ - cs[F77_CHAR_ARG_LEN_USE(s, len)] = '\0' + cs[F77_CHAR_ARG_LEN_USE(s, len)] = '\0' extern CRUFT_API F77_RET_T diff -r 1473d0cf86d2 -r 12df7854fa7c libcruft/misc/quit.cc --- a/libcruft/misc/quit.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/libcruft/misc/quit.cc Thu Jan 20 17:24:59 2011 -0500 @@ -53,7 +53,7 @@ { if (octave_interrupt_hook) octave_interrupt_hook (); - + throw octave_interrupt_exception (); } @@ -63,7 +63,7 @@ // FIXME -- would a hook function be useful here? octave_exception_state = octave_exec_exception; - + throw octave_execution_exception (); } @@ -72,7 +72,7 @@ { if (octave_bad_alloc_hook) octave_bad_alloc_hook (); - + octave_exception_state = octave_alloc_exception; throw std::bad_alloc (); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Array-b.cc --- a/liboctave/Array-b.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Array-b.cc Thu Jan 20 17:24:59 2011 -0500 @@ -46,7 +46,7 @@ } template -static void do_bool_partition (bool *data, octave_idx_type *idx, +static void do_bool_partition (bool *data, octave_idx_type *idx, octave_idx_type nel) { // FIXME: This is essentially a simple bucket sort. diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Array-d.cc --- a/liboctave/Array-d.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Array-d.cc Thu Jan 20 17:24:59 2011 -0500 @@ -116,7 +116,7 @@ r = el[j++]; while (xisnan (r) && j < n); - // Orient the test so that NaN will not pass through. + // Orient the test so that NaN will not pass through. for (; j < n; j++) { if (r >= el[j]) @@ -137,7 +137,7 @@ if (n > 0) { - // Orient the test so that NaN will not pass through. + // Orient the test so that NaN will not pass through. double r = el[0]; for (octave_idx_type j = 1; j < n; j++) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Array-f.cc --- a/liboctave/Array-f.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Array-f.cc Thu Jan 20 17:24:59 2011 -0500 @@ -116,7 +116,7 @@ r = el[j++]; while (xisnan (r) && j < n); - // Orient the test so that NaN will not pass through. + // Orient the test so that NaN will not pass through. for (; j < n; j++) { if (r >= el[j]) @@ -137,7 +137,7 @@ if (n > 0) { - // Orient the test so that NaN will not pass through. + // Orient the test so that NaN will not pass through. float r = el[0]; for (octave_idx_type j = 1; j < n; j++) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Array-util.cc --- a/liboctave/Array-util.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Array-util.cc Thu Jan 20 17:24:59 2011 -0500 @@ -88,9 +88,9 @@ retval = idx(--n); while (--n >= 0) - { + { retval *= dims (n); - + retval += idx(n); } } @@ -129,7 +129,7 @@ if (dim (i) != 1) { retval = false; - + break; } } @@ -167,14 +167,14 @@ if (arr (i) == 1) { retval = true; - + break; } } return retval; } -octave_idx_type +octave_idx_type compute_index (octave_idx_type n, const dim_vector& dims) { if (n < 0) @@ -185,7 +185,7 @@ return n; } -octave_idx_type +octave_idx_type compute_index (octave_idx_type i, octave_idx_type j, const dim_vector& dims) { if (i < 0 || j < 0) @@ -198,7 +198,7 @@ return j*dims(0) + i; } -octave_idx_type +octave_idx_type compute_index (octave_idx_type i, octave_idx_type j, octave_idx_type k, const dim_vector& dims) { @@ -214,7 +214,7 @@ return (k*dims(1) + j)*dims(0) + i; } -octave_idx_type +octave_idx_type compute_index (const Array& ra_idx, const dim_vector& dims) { int nd = ra_idx.length (); @@ -428,7 +428,7 @@ dim_vector rdv = dim_vector::alloc (ial); bool *scalar = new bool[ial], *colon = new bool[ial]; // Mark scalars and colons, count non-scalar indices. - int nonsc = 0; + int nonsc = 0; bool all_colons = true; for (int i = 0; i < ial; i++) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Array-util.h --- a/liboctave/Array-util.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Array-util.h Thu Jan 20 17:24:59 2011 -0500 @@ -47,17 +47,17 @@ // These four compute a linear index for given dimensions, throwing // exceptions on invalid indices. -extern OCTAVE_API octave_idx_type +extern OCTAVE_API octave_idx_type compute_index (octave_idx_type n, const dim_vector& dims); -extern OCTAVE_API octave_idx_type +extern OCTAVE_API octave_idx_type compute_index (octave_idx_type i, octave_idx_type j, const dim_vector& dims); -extern OCTAVE_API octave_idx_type +extern OCTAVE_API octave_idx_type compute_index (octave_idx_type i, octave_idx_type j, octave_idx_type k, const dim_vector& dims); -extern OCTAVE_API octave_idx_type +extern OCTAVE_API octave_idx_type compute_index (const Array& ra_idx, const dim_vector& dims); extern OCTAVE_API Array conv_to_int_array (const Array& a); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Array.cc --- a/liboctave/Array.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Array.cc Thu Jan 20 17:24:59 2011 -0500 @@ -1,7 +1,7 @@ // Template array classes /* -Copyright (C) 1993-2011 John W. Eaton +Copyright (C) 1993-2011 John W. Eaton Copyright (C) 2008-2009 Jaroslav Hajek Copyright (C) 2009 VZLU Prague @@ -88,7 +88,7 @@ delete rep; rep = nil_rep (); - rep->count++; + rep->count++; slice_data = rep->data; slice_len = rep->len; @@ -185,7 +185,7 @@ } template -T& +T& Array::checkelem (octave_idx_type n) { // Do checks directly to avoid recomputing slice_len. @@ -198,21 +198,21 @@ } template -T& +T& Array::checkelem (octave_idx_type i, octave_idx_type j) { return elem (compute_index (i, j)); } template -T& +T& Array::checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return elem (compute_index (i, j, k)); } template -T& +T& Array::checkelem (const Array& ra_idx) { return elem (compute_index (ra_idx)); @@ -416,7 +416,7 @@ return dest; } - + public: template @@ -505,7 +505,7 @@ // Helper class for multi-d index reduction and recursive // indexing/indexed assignment. Rationale: we could avoid recursion // using a state machine instead. However, using recursion is much -// more amenable to possible parallelization in the future. +// more amenable to possible parallelization in the future. // Also, the recursion solution is cleaner and more understandable. class rec_index_helper @@ -545,7 +545,7 @@ idx[top] = ia(i); dim[top] = dv(i); cdim[top] = cdim[top-1] * dim[top-1]; - } + } } } @@ -568,7 +568,7 @@ return dest; } - + // Recursive N-d indexed assignment template const T *do_assign (const T *src, T *dest, int lev) const @@ -610,7 +610,7 @@ template void fill (const T& val, T *dest) const { do_fill (val, dest, top); } - bool is_cont_range (octave_idx_type& l, + bool is_cont_range (octave_idx_type& l, octave_idx_type& u) const { return top == 0 && idx[0].is_cont_range (dim[0], l, u); @@ -675,7 +675,7 @@ } public: template - void resize_fill (const T* src, T *dest, const T& rfv) const + void resize_fill (const T* src, T *dest, const T& rfv) const { do_resize_fill (src, dest, rfv, n-1); } }; @@ -833,7 +833,7 @@ dv.chop_trailing_singletons (); retval = Array (*this, dv); } - else + else { // Form result dimensions. dim_vector rdv = dim_vector::alloc (ial); @@ -889,12 +889,12 @@ // treated). bool invalid = false; if (rows () == 0 || rows () == 1) - dv = dim_vector (1, n); + dv = dim_vector (1, n); else if (columns () == 1) dv = dim_vector (n, 1); else invalid = true; - + if (invalid) gripe_invalid_resize (); else @@ -1004,7 +1004,7 @@ rec_resize_helper rh (dv, dimensions.redim (dvl)); // Do it. - rh.resize_fill (data (), tmp.fortran_vec (), rfv); + rh.resize_fill (data (), tmp.fortran_vec (), rfv); *this = tmp; } else @@ -1013,7 +1013,7 @@ } template -Array +Array Array::index (const idx_vector& i, bool resize_ok, const T& rfv) const { Array tmp = *this; @@ -1036,8 +1036,8 @@ } template -Array -Array::index (const idx_vector& i, const idx_vector& j, +Array +Array::index (const idx_vector& i, const idx_vector& j, bool resize_ok, const T& rfv) const { Array tmp = *this; @@ -1058,11 +1058,11 @@ return Array (); } - return tmp.index (i, j); + return tmp.index (i, j); } template -Array +Array Array::index (const Array& ia, bool resize_ok, const T& rfv) const { @@ -1076,7 +1076,7 @@ if (! (dvx == dv)) { bool all_scalars = true; - for (int i = 0; i < ial; i++) + for (int i = 0; i < ial; i++) all_scalars = all_scalars && ia(i).is_scalar (); if (all_scalars) return Array (dim_vector (1, 1), rfv); @@ -1088,7 +1088,7 @@ return Array (); } - return tmp.index (ia); + return tmp.index (ia); } @@ -1102,10 +1102,10 @@ { octave_idx_type nx = i.extent (n); bool colon = i.is_colon_equiv (nx); - // Try to resize first if necessary. + // Try to resize first if necessary. if (nx != n) { - // Optimize case A = []; A(1:n) = X with A empty. + // Optimize case A = []; A(1:n) = X with A empty. if (dimensions.zero_by_zero () && colon) { if (rhl == 1) @@ -1115,7 +1115,7 @@ return; } - resize1 (nx, rfv); + resize1 (nx, rfv); n = numel (); } @@ -1145,11 +1145,11 @@ const Array& rhs, const T& rfv) { // Get RHS extents, discarding singletons. - dim_vector rhdv = rhs.dims (); + dim_vector rhdv = rhs.dims (); // Get LHS extents, allowing Fortran indexing in the second dim. dim_vector dv = dimensions.redim (2); // Check for out-of-bounds and form resizing dimensions. - dim_vector rdv; + dim_vector rdv; // In the special when all dimensions are zero, colons are allowed // to inquire the shape of RHS. The rules are more obscure, so we // solve that elsewhere. @@ -1170,7 +1170,7 @@ if (match) { - bool all_colons = (i.is_colon_equiv (rdv(0)) + bool all_colons = (i.is_colon_equiv (rdv(0)) && j.is_colon_equiv (rdv(1))); // Resize if requested. if (rdv != dv) @@ -1252,8 +1252,8 @@ // Get LHS extents, allowing Fortran indexing in the second dim. dim_vector dv = dimensions.redim (ial); - - // Get the extents forced by indexing. + + // Get the extents forced by indexing. dim_vector rdv; // In the special when all dimensions are zero, colons are @@ -1283,7 +1283,7 @@ match = match && (j == rhdvl || rhdv(j) == 1); match = match || isfill; - + if (match) { // Resize first if necessary. @@ -1326,18 +1326,18 @@ rh.assign (rhs.data (), fortran_vec ()); } } - else + else gripe_assignment_dimension_mismatch (); } } template -void +void Array::delete_elements (const idx_vector& i) { octave_idx_type n = numel (); if (i.is_colon ()) - { + { *this = Array (); } else if (i.length (n) != 0) @@ -1372,7 +1372,7 @@ } template -void +void Array::delete_elements (int dim, const idx_vector& i) { if (dim < 0 || dim >= ndims ()) @@ -1384,7 +1384,7 @@ octave_idx_type n = dimensions (dim); if (i.is_colon ()) - { + { *this = Array (); } else if (i.length (n) != 0) @@ -1430,7 +1430,7 @@ } template -void +void Array::delete_elements (const Array& ia) { if (ia.length () == 1) @@ -1575,15 +1575,15 @@ for (ii = 0; ii < (nr - 8 + 1); ii += 8) { // Copy to buffer - for (octave_idx_type j = jj, k = 0, idxj = jj * nr; + for (octave_idx_type j = jj, k = 0, idxj = jj * nr; j < jj + 8; j++, idxj += nr) for (octave_idx_type i = ii; i < ii + 8; i++) buf[k++] = xelem (i + idxj); // Copy from buffer - for (octave_idx_type i = ii, idxi = ii * nc; i < ii + 8; + for (octave_idx_type i = ii, idxi = ii * nc; i < ii + 8; i++, idxi += nc) - for (octave_idx_type j = jj, k = i - ii; j < jj + 8; + for (octave_idx_type j = jj, k = i - ii; j < jj + 8; j++, k+=8) result.xelem (j + idxi) = fcn (buf[k]); } @@ -1592,7 +1592,7 @@ for (octave_idx_type j = jj; j < jj + 8; j++) for (octave_idx_type i = ii; i < nr; i++) result.xelem (j, i) = fcn (xelem (i, j)); - } + } for (octave_idx_type j = jj; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) @@ -1695,8 +1695,8 @@ const T *ov = data (); octave_sort lsort; - - if (mode != UNSORTED) + + if (mode != UNSORTED) lsort.set_compare (mode); else return m; @@ -1705,7 +1705,7 @@ { for (octave_idx_type j = 0; j < iter; j++) { - // copy and partition out NaNs. + // copy and partition out NaNs. // FIXME: impact on integer types noticeable? octave_idx_type kl = 0, ku = ns; for (octave_idx_type i = 0; i < ns; i++) @@ -1736,7 +1736,7 @@ { OCTAVE_LOCAL_BUFFER (T, buf, ns); - for (octave_idx_type j = 0; j < iter; j++) + for (octave_idx_type j = 0; j < iter; j++) { octave_idx_type offset = j; octave_idx_type offset2 = 0; @@ -1748,8 +1748,8 @@ } offset += offset2 * stride * ns; - - // gather and partition out NaNs. + + // gather and partition out NaNs. // FIXME: impact on integer types noticeable? octave_idx_type kl = 0, ku = ns; for (octave_idx_type i = 0; i < ns; i++) @@ -1783,7 +1783,7 @@ template Array -Array::sort (Array &sidx, int dim, +Array::sort (Array &sidx, int dim, sortmode mode) const { if (dim < 0 || dim >= ndims ()) @@ -1817,8 +1817,8 @@ sidx = Array (dv); octave_idx_type *vi = sidx.fortran_vec (); - - if (mode != UNSORTED) + + if (mode != UNSORTED) lsort.set_compare (mode); else return m; @@ -1827,7 +1827,7 @@ { for (octave_idx_type j = 0; j < iter; j++) { - // copy and partition out NaNs. + // copy and partition out NaNs. // FIXME: impact on integer types noticeable? octave_idx_type kl = 0, ku = ns; for (octave_idx_type i = 0; i < ns; i++) @@ -1872,7 +1872,7 @@ OCTAVE_LOCAL_BUFFER (T, buf, ns); OCTAVE_LOCAL_BUFFER (octave_idx_type, bufi, ns); - for (octave_idx_type j = 0; j < iter; j++) + for (octave_idx_type j = 0; j < iter; j++) { octave_idx_type offset = j; octave_idx_type offset2 = 0; @@ -1884,8 +1884,8 @@ } offset += offset2 * stride * ns; - - // gather and partition out NaNs. + + // gather and partition out NaNs. // FIXME: impact on integer types noticeable? octave_idx_type kl = 0, ku = ns; for (octave_idx_type i = 0; i < ns; i++) @@ -1998,7 +1998,7 @@ template -sortmode +sortmode Array::is_sorted_rows (sortmode mode) const { octave_sort lsort; @@ -2057,7 +2057,7 @@ // Do a binary lookup in a sorted array. template -octave_idx_type +octave_idx_type Array::lookup (const T& value, sortmode mode) const { octave_idx_type n = numel (); @@ -2078,7 +2078,7 @@ } template -Array +Array Array::lookup (const Array& values, sortmode mode) const { octave_idx_type n = numel (), nval = values.numel (); @@ -2120,7 +2120,7 @@ } template -octave_idx_type +octave_idx_type Array::nnz (void) const { const T *src = data (); @@ -2134,7 +2134,7 @@ } template -Array +Array Array::find (octave_idx_type n, bool backward) const { Array retval; @@ -2302,7 +2302,7 @@ if (stride == 1) { - // copy without NaNs. + // copy without NaNs. // FIXME: impact on integer types noticeable? for (octave_idx_type i = 0; i < ns; i++) { @@ -2318,7 +2318,7 @@ else { octave_idx_type offset = j % stride; - // copy without NaNs. + // copy without NaNs. // FIXME: impact on integer types noticeable? for (octave_idx_type i = 0; i < ns; i++) { @@ -2421,7 +2421,7 @@ Array d; if (nd > 2) - (*current_liboctave_error_handler) ("Matrix must be 2-dimensional"); + (*current_liboctave_error_handler) ("Matrix must be 2-dimensional"); else { octave_idx_type nnr = dv (0); @@ -2628,7 +2628,7 @@ bool retval = dimensions == dv; if (retval) dimensions = dv; - + return retval; } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Array.h --- a/liboctave/Array.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Array.h Thu Jan 20 17:24:59 2011 -0500 @@ -61,16 +61,16 @@ octave_idx_type len; int count; - ArrayRep (T *d, octave_idx_type l) - : data (no_ctor_new (l)), len (l), count (1) - { + ArrayRep (T *d, octave_idx_type l) + : data (no_ctor_new (l)), len (l), count (1) + { copy_or_memcpy (l, d, data); } template - ArrayRep (U *d, octave_idx_type l) - : data (no_ctor_new (l)), len (l), count (1) - { + ArrayRep (U *d, octave_idx_type l) + : data (no_ctor_new (l)), len (l), count (1) + { std::copy (d, d+l, data); } @@ -89,7 +89,7 @@ { copy_or_memcpy (a.len, a.data, data); } - + ~ArrayRep (void) { no_ctor_delete (data); } octave_idx_type length (void) const { return len; } @@ -164,8 +164,8 @@ Array (void) : dimensions (), rep (nil_rep ()), slice_data (rep->data), slice_len (rep->len) - { - rep->count++; + { + rep->count++; } // Obsolete 1D ctor (there are no 1D arrays). @@ -187,7 +187,7 @@ : dimensions (dv), rep (new typename Array::ArrayRep (dv.safe_numel ())), slice_data (rep->data), slice_len (rep->len) - { + { dimensions.chop_trailing_singletons (); } @@ -246,7 +246,7 @@ return *this; } - void fill (const T& val); + void fill (const T& val); void clear (void); void clear (const dim_vector& dv); @@ -304,10 +304,10 @@ const dim_vector& dims (void) const { return dimensions; } Array squeeze (void) const; - + void chop_trailing_singletons (void) GCC_ATTR_DEPRECATED { dimensions.chop_trailing_singletons (); } - + octave_idx_type compute_index (octave_idx_type i, octave_idx_type j) const; octave_idx_type compute_index (octave_idx_type i, octave_idx_type j, octave_idx_type k) const; octave_idx_type compute_index (const Array& ra_idx) const; @@ -323,9 +323,9 @@ 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) + T& xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return xelem (i, dim2()*k+j); } - crefT xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const + crefT xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { return xelem (i, dim2()*k+j); } T& xelem (const Array& ra_idx) @@ -443,7 +443,7 @@ Array index (const Array& ia) const; - static const T& resize_fill_value (); + static const T& resize_fill_value (); // Resizing (with fill). @@ -467,7 +467,7 @@ Array index (const idx_vector& i, bool resize_ok, const T& rfv = resize_fill_value ()) const; - Array index (const idx_vector& i, const idx_vector& j, + Array index (const idx_vector& i, const idx_vector& j, bool resize_ok, const T& rfv = resize_fill_value ()) const; Array index (const Array& ia, @@ -475,7 +475,7 @@ // Indexed assignment (always with resize & fill). - void assign (const idx_vector& i, const Array& rhs, + void assign (const idx_vector& i, const Array& rhs, const T& rfv = resize_fill_value ()); void assign (const idx_vector& i, const idx_vector& j, const Array& rhs, @@ -615,7 +615,7 @@ { octave_quit (); - if (fcn (m[i]) != zero + if (fcn (m[i]) != zero || fcn (m[i+1]) != zero || fcn (m[i+2]) != zero || fcn (m[i+3]) != zero) @@ -663,7 +663,7 @@ private: - void resize2 (octave_idx_type nr, octave_idx_type nc, + void resize2 (octave_idx_type nr, octave_idx_type nc, const T& rfv = resize_fill_value ()); static void instantiation_guard (); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Array3.h --- a/liboctave/Array3.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Array3.h Thu Jan 20 17:24:59 2011 -0500 @@ -63,7 +63,7 @@ return *this; } - void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p) + void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p) { Array::resize (dim_vector (r, c, p)); } void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CColVector.cc --- a/liboctave/CColVector.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CColVector.cc Thu Jan 20 17:24:59 2011 -0500 @@ -221,9 +221,9 @@ return retval; } -ComplexRowVector +ComplexRowVector ComplexColumnVector::hermitian (void) const -{ +{ return MArray::hermitian (std::conj); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CColVector.h --- a/liboctave/CColVector.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CColVector.h Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ explicit ComplexColumnVector (octave_idx_type n) : MArray (dim_vector (n, 1)) { } - explicit ComplexColumnVector (const dim_vector& dv) + explicit ComplexColumnVector (const dim_vector& dv) : MArray (dv.as_column ()) { } ComplexColumnVector (octave_idx_type n, const Complex& val) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CDiagMatrix.cc --- a/liboctave/CDiagMatrix.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CDiagMatrix.cc Thu Jan 20 17:24:59 2011 -0500 @@ -275,7 +275,7 @@ if (i < 0 || i >= r) { (*current_liboctave_error_handler) ("invalid row selection"); - return ComplexRowVector (); + return ComplexRowVector (); } ComplexRowVector retval (c, 0.0); @@ -291,7 +291,7 @@ if (! s) { (*current_liboctave_error_handler) ("invalid row selection"); - return ComplexRowVector (); + return ComplexRowVector (); } char c = *s; @@ -314,7 +314,7 @@ if (i < 0 || i >= c) { (*current_liboctave_error_handler) ("invalid column selection"); - return ComplexColumnVector (); + return ComplexColumnVector (); } ComplexColumnVector retval (r, 0.0); @@ -330,7 +330,7 @@ if (! s) { (*current_liboctave_error_handler) ("invalid column selection"); - return ComplexColumnVector (); + return ComplexColumnVector (); } char c = *s; @@ -341,7 +341,7 @@ else { (*current_liboctave_error_handler) ("invalid column selection"); - return ComplexColumnVector (); + return ComplexColumnVector (); } } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CDiagMatrix.h --- a/liboctave/CDiagMatrix.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CDiagMatrix.h Thu Jan 20 17:24:59 2011 -0500 @@ -52,7 +52,7 @@ explicit ComplexDiagMatrix (const Array& a) : MDiagArray2 (Array (a)) { } - ComplexDiagMatrix (const Array& a, octave_idx_type r, octave_idx_type c) + ComplexDiagMatrix (const Array& a, octave_idx_type r, octave_idx_type c) : MDiagArray2 (a, r, c) { } explicit ComplexDiagMatrix (const DiagMatrix& a); @@ -64,7 +64,7 @@ : MDiagArray2 (a) { } template - ComplexDiagMatrix (const DiagArray2& a) + ComplexDiagMatrix (const DiagArray2& a) : MDiagArray2 (a) { } ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) @@ -91,7 +91,7 @@ ComplexDiagMatrix hermitian (void) const { return MDiagArray2::hermitian (std::conj); } ComplexDiagMatrix transpose (void) const { return MDiagArray2::transpose(); } - DiagMatrix abs (void) const; + DiagMatrix abs (void) const; friend OCTAVE_API ComplexDiagMatrix conj (const ComplexDiagMatrix& a); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CMatrix.cc --- a/liboctave/CMatrix.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CMatrix.cc Thu Jan 20 17:24:59 2011 -0500 @@ -123,7 +123,7 @@ F77_RET_T F77_FUNC (zsyrk, ZSYRK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, const Complex&, const Complex*, const octave_idx_type&, const Complex&, Complex*, const octave_idx_type& @@ -133,7 +133,7 @@ F77_RET_T F77_FUNC (zherk, ZHERK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, const double&, const Complex*, const octave_idx_type&, const double&, Complex*, const octave_idx_type& @@ -161,8 +161,8 @@ F77_RET_T F77_FUNC (zgecon, ZGECON) (F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, Complex*, - const octave_idx_type&, const double&, double&, + const octave_idx_type&, Complex*, + const octave_idx_type&, const double&, double&, Complex*, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); @@ -181,7 +181,7 @@ const octave_idx_type&, Complex*, const octave_idx_type&, double*, double&, octave_idx_type&, Complex*, - const octave_idx_type&, double*, + const octave_idx_type&, double*, octave_idx_type*, octave_idx_type&); F77_RET_T @@ -200,25 +200,25 @@ F77_RET_T F77_FUNC (zpotrs, ZPOTRS) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const octave_idx_type&, - const Complex*, const octave_idx_type&, Complex*, + const Complex*, const octave_idx_type&, Complex*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (ztrtri, ZTRTRI) (F77_CONST_CHAR_ARG_DECL, - F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, const Complex*, - const octave_idx_type&, octave_idx_type& + F77_CONST_CHAR_ARG_DECL, + const octave_idx_type&, const Complex*, + const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (ztrcon, ZTRCON) (F77_CONST_CHAR_ARG_DECL, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const Complex*, const octave_idx_type&, double&, - Complex*, double*, octave_idx_type& + Complex*, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); @@ -228,7 +228,7 @@ F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const octave_idx_type&, - const Complex*, const octave_idx_type&, Complex*, + const Complex*, const octave_idx_type&, Complex*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL @@ -1016,15 +1016,15 @@ F77_XFCN (ztrtri, ZTRTRI, (F77_CONST_CHAR_ARG2 (&uplo, 1), F77_CONST_CHAR_ARG2 (&udiag, 1), - nr, tmp_data, nr, info + nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) info = -1; - else if (calc_cond) + else if (calc_cond) { octave_idx_type ztrcon_info = 0; char job = '1'; @@ -1035,13 +1035,13 @@ F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&job, 1), F77_CONST_CHAR_ARG2 (&uplo, 1), F77_CONST_CHAR_ARG2 (&udiag, 1), - nr, tmp_data, nr, rcon, - cwork, rwork, ztrcon_info + nr, tmp_data, nr, rcon, + cwork, rwork, ztrcon_info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (ztrcon_info != 0) + if (ztrcon_info != 0) info = -1; } @@ -1076,7 +1076,7 @@ // Query the optimum work array size. - F77_XFCN (zgetri, ZGETRI, (nc, tmp_data, nr, pipvt, + F77_XFCN (zgetri, ZGETRI, (nc, tmp_data, nr, pipvt, z.fortran_vec (), lwork, info)); lwork = static_cast (std::real(z(0))); @@ -1095,9 +1095,9 @@ // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) info = -1; - else if (calc_cond) + else if (calc_cond) { // Now calculate the condition number for non-singular matrix. octave_idx_type zgecon_info = 0; @@ -1105,11 +1105,11 @@ Array rz (dim_vector (2 * nc, 1)); double *prz = rz.fortran_vec (); F77_XFCN (zgecon, ZGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, prz, zgecon_info F77_CHAR_ARG_LEN (1))); - if (zgecon_info != 0) + if (zgecon_info != 0) info = -1; } @@ -1122,14 +1122,14 @@ F77_XFCN (zgetri, ZGETRI, (nc, tmp_data, nr, pipvt, pz, lwork, zgetri_info)); - if (zgetri_info != 0) + if (zgetri_info != 0) info = -1; } if (info != 0) mattype.mark_as_rectangular(); } - + return retval; } @@ -1239,7 +1239,7 @@ const Complex *in (data ()); Complex *out (retval.fortran_vec ()); - octave_fftw::fft (in, out, npts, nsamples); + octave_fftw::fft (in, out, npts, nsamples); return retval; } @@ -1268,7 +1268,7 @@ const Complex *in (data ()); Complex *out (retval.fortran_vec ()); - octave_fftw::ifft (in, out, npts, nsamples); + octave_fftw::ifft (in, out, npts, nsamples); return retval; } @@ -1591,7 +1591,7 @@ if (typ == MatrixType::Lower || typ == MatrixType::Upper) { - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval *= elem (i,i); } else if (typ == MatrixType::Hermitian) @@ -1605,17 +1605,17 @@ char job = 'L'; - F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) { rcon = 0.0; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { Array z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); @@ -1627,10 +1627,10 @@ rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval *= atmp (i,i); retval = retval.square (); @@ -1657,14 +1657,14 @@ // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) { info = -1; retval = ComplexDET (); - } - else + } + else { - if (calc_cond) + if (calc_cond) { // Now calc the condition number for non-singular matrix. char job = '1'; @@ -1674,19 +1674,19 @@ double *prz = rz.fortran_vec (); F77_XFCN (zgecon, ZGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); } - if (info != 0) + if (info != 0) { info = -1; retval = ComplexDET (); - } - else + } + else { - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { Complex c = atmp(i,i); retval *= (ipvt(i) != (i+1)) ? -c : c; @@ -1738,16 +1738,16 @@ Array rz (dim_vector (nc, 1)); double *prz = rz.fortran_vec (); - F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, prz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0; } else if (typ == MatrixType::Permuted_Upper) @@ -1766,16 +1766,16 @@ Array rz (dim_vector (nc, 1)); double *prz = rz.fortran_vec (); - F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, prz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } else if (typ == MatrixType::Permuted_Lower) @@ -1794,18 +1794,18 @@ anorm = atmp.abs().sum(). row(static_cast(0)).max(); - F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) { rcon = 0.0; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { Array z (dim_vector (2 * nc, 1)); Complex *pz = z.fortran_vec (); @@ -1817,7 +1817,7 @@ rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } } @@ -1841,20 +1841,20 @@ F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info)); - if (info != 0) - { + if (info != 0) + { rcon = 0.0; mattype.mark_as_rectangular (); - } - else + } + else { char job = '1'; F77_XFCN (zgecon, ZGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } } @@ -1867,8 +1867,8 @@ } ComplexMatrix -ComplexMatrix::utsolve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& info, double& rcon, +ComplexMatrix::utsolve (MatrixType &mattype, const ComplexMatrix& b, + octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, bool calc_cond, blas_trans_type transt) const { @@ -1913,16 +1913,16 @@ Array rz (dim_vector (nc, 1)); double *prz = rz.fortran_vec (); - F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, prz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile double rcond_plus_one = rcon + 1.0; @@ -1949,9 +1949,9 @@ char trans = get_blas_char (transt); char dia = 'N'; - F77_XFCN (ztrtrs, ZTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&trans, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ztrtrs, ZTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&trans, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, b_nc, tmp_data, nr, result, nr, info F77_CHAR_ARG_LEN (1) @@ -1968,8 +1968,8 @@ } ComplexMatrix -ComplexMatrix::ltsolve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& info, double& rcon, +ComplexMatrix::ltsolve (MatrixType &mattype, const ComplexMatrix& b, + octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, bool calc_cond, blas_trans_type transt) const { @@ -2014,16 +2014,16 @@ Array rz (dim_vector (nc, 1)); double *prz = rz.fortran_vec (); - F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ztrcon, ZTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, prz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile double rcond_plus_one = rcon + 1.0; @@ -2050,9 +2050,9 @@ char trans = get_blas_char (transt); char dia = 'N'; - F77_XFCN (ztrtrs, ZTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&trans, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ztrtrs, ZTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&trans, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, b_nc, tmp_data, nr, result, nr, info F77_CHAR_ARG_LEN (1) @@ -2069,7 +2069,7 @@ } ComplexMatrix -ComplexMatrix::fsolve (MatrixType &mattype, const ComplexMatrix& b, +ComplexMatrix::fsolve (MatrixType &mattype, const ComplexMatrix& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, bool calc_cond) const @@ -2088,7 +2088,7 @@ else { volatile int typ = mattype.type (); - + // Calculate the norm of the matrix, for later use. double anorm = -1.; @@ -2100,20 +2100,20 @@ Complex *tmp_data = atmp.fortran_vec (); anorm = atmp.abs().sum().row(static_cast(0)).max(); - F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) { info = -2; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { if (calc_cond) { @@ -2127,7 +2127,7 @@ rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile double rcond_plus_one = rcon + 1.0; @@ -2188,8 +2188,8 @@ // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) - { + if (info != 0) + { info = -2; if (sing_handler) @@ -2199,20 +2199,20 @@ ("matrix singular to machine precision"); mattype.mark_as_rectangular (); - } - else + } + else { if (calc_cond) { - // Now calculate the condition number for + // Now calculate the condition number for // non-singular matrix. char job = '1'; F77_XFCN (zgecon, ZGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile double rcond_plus_one = rcon + 1.0; @@ -2241,14 +2241,14 @@ F77_XFCN (zgetrs, ZGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, pipvt, result, b.rows(), info - F77_CHAR_ARG_LEN (1))); + F77_CHAR_ARG_LEN (1))); } else - mattype.mark_as_rectangular (); + mattype.mark_as_rectangular (); } } } - + return retval; } @@ -2261,7 +2261,7 @@ } ComplexMatrix -ComplexMatrix::solve (MatrixType &typ, const Matrix& b, +ComplexMatrix::solve (MatrixType &typ, const Matrix& b, octave_idx_type& info) const { double rcon; @@ -2276,7 +2276,7 @@ } ComplexMatrix -ComplexMatrix::solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, +ComplexMatrix::solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, bool singular_fallback, blas_trans_type transt) const { @@ -2293,7 +2293,7 @@ } ComplexMatrix -ComplexMatrix::solve (MatrixType &typ, const ComplexMatrix& b, +ComplexMatrix::solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info) const { double rcon; @@ -2301,14 +2301,14 @@ } ComplexMatrix -ComplexMatrix::solve (MatrixType &typ, const ComplexMatrix& b, +ComplexMatrix::solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcon) const { return solve (typ, b, info, rcon, 0); } ComplexMatrix -ComplexMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, +ComplexMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, bool singular_fallback, blas_trans_type transt) const @@ -2355,7 +2355,7 @@ } ComplexColumnVector -ComplexMatrix::solve (MatrixType &typ, const ColumnVector& b, +ComplexMatrix::solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info) const { double rcon; @@ -2363,14 +2363,14 @@ } ComplexColumnVector -ComplexMatrix::solve (MatrixType &typ, const ColumnVector& b, +ComplexMatrix::solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info, double& rcon) const { return solve (typ, ComplexColumnVector (b), info, rcon, 0); } ComplexColumnVector -ComplexMatrix::solve (MatrixType &typ, const ColumnVector& b, +ComplexMatrix::solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const { @@ -2386,7 +2386,7 @@ } ComplexColumnVector -ComplexMatrix::solve (MatrixType &typ, const ComplexColumnVector& b, +ComplexMatrix::solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info) const { double rcon; @@ -2485,15 +2485,15 @@ } ComplexColumnVector -ComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, +ComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcon) const { return solve (ComplexColumnVector (b), info, rcon, 0); } ComplexColumnVector -ComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, - double& rcon, +ComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, + double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const { return solve (ComplexColumnVector (b), info, rcon, sing_handler, transt); @@ -2588,7 +2588,7 @@ } ComplexMatrix -ComplexMatrix::lssolve (const ComplexMatrix& b, octave_idx_type& info, +ComplexMatrix::lssolve (const ComplexMatrix& b, octave_idx_type& info, octave_idx_type& rank, double& rcon) const { ComplexMatrix retval; @@ -2713,7 +2713,7 @@ F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, - work.fortran_vec (), lwork, + work.fortran_vec (), lwork, prwork, piwork, info)); if (s.elem (0) == 0.0) @@ -2745,7 +2745,7 @@ } ComplexColumnVector -ComplexMatrix::lssolve (const ColumnVector& b, octave_idx_type& info, +ComplexMatrix::lssolve (const ColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const { double rcon; @@ -2753,7 +2753,7 @@ } ComplexColumnVector -ComplexMatrix::lssolve (const ColumnVector& b, octave_idx_type& info, +ComplexMatrix::lssolve (const ColumnVector& b, octave_idx_type& info, octave_idx_type& rank, double& rcon) const { return lssolve (ComplexColumnVector (b), info, rank, rcon); @@ -2874,7 +2874,7 @@ F77_XFCN (zgelsd, ZGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, - work.fortran_vec (), lwork, + work.fortran_vec (), lwork, prwork, piwork, info)); if (rank < minmn) @@ -3103,7 +3103,7 @@ // Return nonzero if any element of CM has a non-integer real or // imaginary part. Also extract the largest and smallest (real or -// imaginary) values and return them in MAX_VAL and MIN_VAL. +// imaginary) values and return them in MAX_VAL and MIN_VAL. bool ComplexMatrix::all_integers (double& max_val, double& min_val) const @@ -3253,7 +3253,7 @@ } } - return retval; + return retval; } bool @@ -3272,7 +3272,7 @@ } } - return retval; + return retval; } ComplexColumnVector @@ -3618,7 +3618,7 @@ { double cc; Complex cs, temp_r; - + F77_FUNC (zlartg, ZLARTG) (x, y, cc, cs, temp_r); ComplexMatrix g (2, 2); @@ -3644,7 +3644,7 @@ ComplexSCHUR as (a, "U"); ComplexSCHUR bs (b, "U"); - + // Transform c to new coordinates. ComplexMatrix ua = as.unitary_matrix (); @@ -3652,7 +3652,7 @@ ComplexMatrix ub = bs.unitary_matrix (); ComplexMatrix sch_b = bs.schur_matrix (); - + ComplexMatrix cx = ua.hermitian () * c * ub; // Solve the sylvester equation, back-transform, and return the @@ -3667,7 +3667,7 @@ Complex *pa = sch_a.fortran_vec (); Complex *pb = sch_b.fortran_vec (); Complex *px = cx.fortran_vec (); - + F77_XFCN (ztrsyl, ZTRSYL, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 ("N", 1), 1, a_nr, b_nr, pa, a_nr, pb, @@ -3730,7 +3730,7 @@ // the general GEMM operation ComplexMatrix -xgemm (const ComplexMatrix& a, const ComplexMatrix& b, +xgemm (const ComplexMatrix& a, const ComplexMatrix& b, blas_trans_type transa, blas_trans_type transb) { ComplexMatrix retval; @@ -4030,8 +4030,8 @@ return result; } -ComplexMatrix linspace (const ComplexColumnVector& x1, - const ComplexColumnVector& x2, +ComplexMatrix linspace (const ComplexColumnVector& x1, + const ComplexColumnVector& x2, octave_idx_type n) { @@ -4049,7 +4049,7 @@ retval(i, 0) = x1(i); // The last column is not needed while using delta. - Complex *delta = &retval(0, n-1); + Complex *delta = &retval(0, n-1); for (octave_idx_type i = 0; i < m; i++) delta[i] = (x2(i) - x1(i)) / (n - 1.0); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CMatrix.h --- a/liboctave/CMatrix.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CMatrix.h Thu Jan 20 17:24:59 2011 -0500 @@ -37,7 +37,7 @@ ComplexMatrix : public MArray { public: - + typedef ComplexColumnVector column_vector_type; typedef ComplexRowVector row_vector_type; @@ -53,7 +53,7 @@ ComplexMatrix (const dim_vector& dv) : MArray (dv.redim (2)) { } - ComplexMatrix (const dim_vector& dv, const Complex& val) + ComplexMatrix (const dim_vector& dv, const Complex& val) : MArray (dv.redim (2), val) { } ComplexMatrix (const ComplexMatrix& a) : MArray (a) { } @@ -167,13 +167,13 @@ public: ComplexMatrix inverse (void) const; ComplexMatrix inverse (octave_idx_type& info) const; - ComplexMatrix inverse (octave_idx_type& info, double& rcon, int force = 0, + ComplexMatrix inverse (octave_idx_type& info, double& rcon, int force = 0, int calc_cond = 1) const; ComplexMatrix inverse (MatrixType &mattype) const; ComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info) const; ComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info, - double& rcon, int force = 0, + double& rcon, int force = 0, int calc_cond = 1) const; ComplexMatrix pseudo_inverse (double tol = 0.0) const; @@ -187,7 +187,7 @@ ComplexDET determinant (void) const; ComplexDET determinant (octave_idx_type& info) const; ComplexDET determinant (octave_idx_type& info, double& rcon, int calc_cond = 1) const; - ComplexDET determinant (MatrixType &mattype, octave_idx_type& info, + ComplexDET determinant (MatrixType &mattype, octave_idx_type& info, double& rcon, int calc_cond = 1) const; double rcond (void) const; @@ -196,65 +196,65 @@ private: // Upper triangular matrix solvers ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcon, + octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, - bool calc_cond = false, + bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; // Lower triangular matrix solvers ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcon, + octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; // Full matrix solvers (umfpack/cholesky) ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcon, + octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, bool calc_cond = false) const; public: // Generic interface to solver with no probing of type ComplexMatrix solve (MatrixType &typ, const Matrix& b) const; - ComplexMatrix solve (MatrixType &typ, const Matrix& b, + ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info) const; - ComplexMatrix solve (MatrixType &typ, const Matrix& b, + ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcon) const; ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, - bool singular_fallback = true, + bool singular_fallback = true, blas_trans_type transt = blas_no_trans) const; ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; - ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, + ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info) const; - ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, + ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcon) const; - ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, + ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, - bool singular_fallback = true, + bool singular_fallback = true, blas_trans_type transt = blas_no_trans) const; ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b) const; - ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info) const; - ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info, double& rcon) const; - ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; - ComplexColumnVector solve (MatrixType &typ, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b) const; - ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info) const; - ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info, double& rcon) const; - ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; // Generic interface to solver with probing of type @@ -262,14 +262,14 @@ ComplexMatrix solve (const Matrix& b, octave_idx_type& info) const; ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon) const; ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ComplexMatrix solve (const ComplexMatrix& b) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ComplexColumnVector solve (const ColumnVector& b) const; @@ -277,7 +277,7 @@ ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon) const; ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ComplexColumnVector solve (const ComplexColumnVector& b) const; @@ -285,14 +285,14 @@ ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcon) const; ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, - double& rcon, solve_singularity_handler sing_handler, + double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ComplexMatrix lssolve (const Matrix& b) const; ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info) const; - ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, + ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank) const; - ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, + ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank, double& rcon) const; ComplexMatrix lssolve (const ComplexMatrix& b) const; @@ -363,7 +363,7 @@ ComplexColumnVector row_min (void) const; ComplexColumnVector row_max (void) const; - ComplexColumnVector row_min (Array& index) const; + ComplexColumnVector row_min (Array& index) const; ComplexColumnVector row_max (Array& index) const; ComplexRowVector column_min (void) const; @@ -400,9 +400,9 @@ extern OCTAVE_API ComplexMatrix Sylvester (const ComplexMatrix&, const ComplexMatrix&, const ComplexMatrix&); -extern OCTAVE_API ComplexMatrix +extern OCTAVE_API ComplexMatrix xgemm (const ComplexMatrix& a, const ComplexMatrix& b, - blas_trans_type transa = blas_no_trans, + blas_trans_type transa = blas_no_trans, blas_trans_type transb = blas_no_trans); extern OCTAVE_API ComplexMatrix operator * (const Matrix&, const ComplexMatrix&); @@ -417,8 +417,8 @@ extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& m, const Complex& c); extern OCTAVE_API ComplexMatrix max (const ComplexMatrix& a, const ComplexMatrix& b); -extern OCTAVE_API ComplexMatrix linspace (const ComplexColumnVector& x1, - const ComplexColumnVector& x2, +extern OCTAVE_API ComplexMatrix linspace (const ComplexColumnVector& x1, + const ComplexColumnVector& x2, octave_idx_type n); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CNDArray.cc --- a/liboctave/CNDArray.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CNDArray.cc Thu Jan 20 17:24:59 2011 -0500 @@ -79,7 +79,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) - octave_fftw::fft (in + k * stride * n, out + k * stride * n, + octave_fftw::fft (in + k * stride * n, out + k * stride * n, n, howmany, stride, dist); return retval; @@ -110,7 +110,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) - octave_fftw::ifft (in + k * stride * n, out + k * stride * n, + octave_fftw::ifft (in + k * stride * n, out + k * stride * n, n, howmany, stride, dist); return retval; @@ -319,7 +319,7 @@ Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -367,7 +367,7 @@ Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -415,7 +415,7 @@ Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -462,7 +462,7 @@ Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -529,7 +529,7 @@ // Return nonzero if any element of CM has a non-integer real or // imaginary part. Also extract the largest and smallest (real or -// imaginary) values and return them in MAX_VAL and MIN_VAL. +// imaginary) values and return them in MAX_VAL and MIN_VAL. bool ComplexNDArray::all_integers (double& max_val, double& min_val) const @@ -542,7 +542,7 @@ double r_val = std::real (val); double i_val = std::imag (val); - + max_val = r_val; min_val = r_val; @@ -767,16 +767,16 @@ ComplexNDArray::insert (const NDArray& a, octave_idx_type r, octave_idx_type c) { dim_vector a_dv = a.dims (); - + int n = a_dv.length (); - + if (n == dimensions.length ()) { Array a_ra_idx (dim_vector (a_dv.length (), 1), 0); - + a_ra_idx.elem (0) = r; a_ra_idx.elem (1) = c; - + for (int i = 0; i < n; i++) { if (a_ra_idx (i) < 0 || (a_ra_idx (i) + a_dv (i)) > dimensions (i)) @@ -786,21 +786,21 @@ return *this; } } - + a_ra_idx.elem (0) = 0; a_ra_idx.elem (1) = 0; - + octave_idx_type n_elt = a.numel (); - + // IS make_unique () NECCESSARY HERE?? for (octave_idx_type i = 0; i < n_elt; i++) { Array ra_idx = a_ra_idx; - + ra_idx.elem (0) = a_ra_idx (0) + r; ra_idx.elem (1) = a_ra_idx (1) + c; - + elem (ra_idx) = a.elem (a_ra_idx); increment_index (a_ra_idx, a_dv); @@ -849,7 +849,7 @@ ::increment_index (ra_idx, dimensions, start_dimension); } -octave_idx_type +octave_idx_type ComplexNDArray::compute_index (Array& ra_idx, const dim_vector& dimensions) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CNDArray.h --- a/liboctave/CNDArray.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CNDArray.h Thu Jan 20 17:24:59 2011 -0500 @@ -44,7 +44,7 @@ ComplexNDArray (const dim_vector& dv, const Complex& val) : MArray (dv, val) { } - + ComplexNDArray (const ComplexNDArray& a) : MArray (a) { } ComplexNDArray (const ComplexMatrix& a) : MArray (a) { } @@ -55,7 +55,7 @@ template ComplexNDArray (const Array& a) : MArray (a) { } - ComplexNDArray (const charNDArray&); + ComplexNDArray (const charNDArray&); ComplexNDArray& operator = (const ComplexNDArray& a) { @@ -102,7 +102,7 @@ ComplexNDArray& insert (const NDArray& a, octave_idx_type r, octave_idx_type c); ComplexNDArray& insert (const ComplexNDArray& a, octave_idx_type r, octave_idx_type c); ComplexNDArray& insert (const ComplexNDArray& a, const Array& ra_idx); - + NDArray abs (void) const; boolNDArray isnan (void) const; boolNDArray isinf (void) const; @@ -142,10 +142,10 @@ ComplexNDArray diag (octave_idx_type k = 0) const; - ComplexNDArray& changesign (void) - { - MArray::changesign (); - return *this; + ComplexNDArray& changesign (void) + { + MArray::changesign (); + return *this; } }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CSparse.cc --- a/liboctave/CSparse.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CSparse.cc Thu Jan 20 17:24:59 2011 -0500 @@ -261,7 +261,7 @@ if (dv.numel () == 0 || dim >= dv.length ()) return result; - + if (dim < 0) dim = dv.first_non_singleton (); @@ -347,7 +347,7 @@ found = true; break; } - + if (!found) idx_arg.elem(i) = j; @@ -416,7 +416,7 @@ if (dv.numel () == 0 || dim >= dv.length ()) return result; - + if (dim < 0) dim = dv.first_non_singleton (); @@ -502,7 +502,7 @@ found = true; break; } - + if (!found) idx_arg.elem(i) = j; @@ -556,7 +556,7 @@ return result; } -ComplexRowVector +ComplexRowVector SparseComplexMatrix::row (octave_idx_type i) const { octave_idx_type nc = columns (); @@ -575,7 +575,7 @@ return retval; } -ComplexColumnVector +ComplexColumnVector SparseComplexMatrix::column (octave_idx_type i) const { octave_idx_type nr = rows (); @@ -618,7 +618,7 @@ } SparseComplexMatrix -SparseComplexMatrix::concat (const SparseComplexMatrix& rb, +SparseComplexMatrix::concat (const SparseComplexMatrix& rb, const Array& ra_idx) { // Don't use numel to avoid all possiblity of an overflow @@ -720,8 +720,8 @@ return inverse (mattype, info, rcond, 0, 0); } -SparseComplexMatrix -SparseComplexMatrix::dinverse (MatrixType &mattyp, octave_idx_type& info, +SparseComplexMatrix +SparseComplexMatrix::dinverse (MatrixType &mattyp, octave_idx_type& info, double& rcond, const bool, const bool calccond) const { @@ -746,13 +746,13 @@ retval = transpose(); else retval = *this; - + // Force make_unique to be called Complex *v = retval.data(); if (calccond) { - double dmax = 0., dmin = octave_Inf; + double dmax = 0., dmin = octave_Inf; for (octave_idx_type i = 0; i < nr; i++) { double tmp = std::abs(v[i]); @@ -774,8 +774,8 @@ return retval; } -SparseComplexMatrix -SparseComplexMatrix::tinverse (MatrixType &mattyp, octave_idx_type& info, +SparseComplexMatrix +SparseComplexMatrix::tinverse (MatrixType &mattyp, octave_idx_type& info, double& rcond, const bool, const bool calccond) const { @@ -824,7 +824,7 @@ octave_quit (); // place the 1 in the identity position octave_idx_type cx_colstart = cx; - + if (cx == nz2) { nz2 *= 2; @@ -837,7 +837,7 @@ cx++; // iterate accross columns of input matrix - for (octave_idx_type j = i+1; j < nr; j++) + for (octave_idx_type j = i+1; j < nr; j++) { Complex v = 0.; // iterate to calculate sum @@ -847,7 +847,7 @@ if (cidx(j) == cidx(j+1)) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("division by zero"); goto inverse_singular; } @@ -858,17 +858,17 @@ rpX = retval.xridx(colXp); rpU = ridx(colUp); - if (rpX < rpU) + if (rpX < rpU) colXp++; - else if (rpX > rpU) + else if (rpX > rpU) colUp++; - else + else { v -= retval.xdata(colXp) * data(colUp); colXp++; colUp++; } - } while ((rpX ainvnorm) ainvnorm = atmp; } - rcond = 1. / ainvnorm / anorm; + rcond = 1. / ainvnorm / anorm; } } else @@ -1053,7 +1053,7 @@ } SparseComplexMatrix -SparseComplexMatrix::inverse (MatrixType& mattype, octave_idx_type& info, +SparseComplexMatrix::inverse (MatrixType& mattype, octave_idx_type& info, double& rcond, int, int calc_cond) const { int typ = mattype.type (false); @@ -1067,7 +1067,7 @@ else if (typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper) 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); } @@ -1169,7 +1169,7 @@ if (!xisnan (tmp)) Control (UMFPACK_FIXQ) = tmp; - // Turn-off UMFPACK scaling for LU + // Turn-off UMFPACK scaling for LU Control (UMFPACK_SCALE) = UMFPACK_SCALE_NONE; UMFPACK_ZNAME (report_control) (control); @@ -1178,20 +1178,20 @@ const octave_idx_type *Ai = ridx (); const Complex *Ax = data (); - UMFPACK_ZNAME (report_matrix) (nr, nc, Ap, Ai, - reinterpret_cast (Ax), + UMFPACK_ZNAME (report_matrix) (nr, nc, Ap, Ai, + reinterpret_cast (Ax), 0, 1, control); void *Symbolic; Matrix Info (1, UMFPACK_INFO); double *info = Info.fortran_vec (); - int status = UMFPACK_ZNAME (qsymbolic) - (nr, nc, Ap, Ai, reinterpret_cast (Ax), 0, + int status = UMFPACK_ZNAME (qsymbolic) + (nr, nc, Ap, Ai, reinterpret_cast (Ax), 0, 0, &Symbolic, control, info); if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexMatrix::determinant symbolic factorization failed"); UMFPACK_ZNAME (report_status) (control, status); @@ -1214,7 +1214,7 @@ if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexMatrix::determinant numeric factorization failed"); UMFPACK_ZNAME (report_status) (control, status); @@ -1233,15 +1233,15 @@ if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexMatrix::determinant error calculating determinant"); - + UMFPACK_ZNAME (report_status) (control, status); UMFPACK_ZNAME (report_info) (control, info); } else retval = ComplexDET (Complex (c10[0], c10[1]), e10, 10); - + UMFPACK_ZNAME (free_numeric) (&Numeric); } } @@ -1255,7 +1255,7 @@ ComplexMatrix SparseComplexMatrix::dsolve (MatrixType &mattype, const Matrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler, bool calc_cond) const { ComplexMatrix retval; @@ -1289,10 +1289,10 @@ 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); - + if (calc_cond) { - double dmax = 0., dmin = octave_Inf; + double dmax = 0., dmin = octave_Inf; for (octave_idx_type i = 0; i < nm; i++) { double tmp = std::abs(data(i)); @@ -1315,7 +1315,7 @@ SparseComplexMatrix SparseComplexMatrix::dsolve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler, bool calc_cond) const { @@ -1380,10 +1380,10 @@ } retval.xcidx(j+1) = ii; } - + if (calc_cond) { - double dmax = 0., dmin = octave_Inf; + double dmax = 0., dmin = octave_Inf; for (octave_idx_type i = 0; i < nm; i++) { double tmp = std::abs(data(i)); @@ -1406,7 +1406,7 @@ ComplexMatrix SparseComplexMatrix::dsolve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler, bool calc_cond) const { @@ -1441,10 +1441,10 @@ 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); - + if (calc_cond) { - double dmax = 0., dmin = octave_Inf; + double dmax = 0., dmin = octave_Inf; for (octave_idx_type i = 0; i < nr; i++) { double tmp = std::abs(data(i)); @@ -1467,7 +1467,7 @@ SparseComplexMatrix SparseComplexMatrix::dsolve (MatrixType &mattype, const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler, bool calc_cond) const { @@ -1532,10 +1532,10 @@ } retval.xcidx(j+1) = ii; } - + if (calc_cond) { - double dmax = 0., dmin = octave_Inf; + double dmax = 0., dmin = octave_Inf; for (octave_idx_type i = 0; i < nm; i++) { double tmp = std::abs(data(i)); @@ -1625,11 +1625,11 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(kidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(kidx); + for (octave_idx_type i = cidx(kidx); i < cidx(kidx+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -1660,7 +1660,7 @@ { Complex tmp = work[k] / data(cidx(iidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(iidx); + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { octave_idx_type idx2 = ridx(i); @@ -1701,7 +1701,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; @@ -1733,7 +1733,7 @@ { Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -1794,7 +1794,7 @@ SparseComplexMatrix SparseComplexMatrix::utsolve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -1870,11 +1870,11 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(kidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(kidx); + for (octave_idx_type i = cidx(kidx); i < cidx(kidx+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -1927,7 +1927,7 @@ { Complex tmp = work[k] / data(cidx(iidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(iidx); + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { octave_idx_type idx2 = ridx(i); @@ -1967,7 +1967,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; @@ -2021,7 +2021,7 @@ { Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -2081,7 +2081,7 @@ ComplexMatrix SparseComplexMatrix::utsolve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -2102,7 +2102,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Upper || typ == MatrixType::Upper) { @@ -2148,11 +2148,11 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(kidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(kidx); + for (octave_idx_type i = cidx(kidx); i < cidx(kidx+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -2183,7 +2183,7 @@ { Complex tmp = work[k] / data(cidx(iidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(iidx); + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { octave_idx_type idx2 = ridx(i); @@ -2224,7 +2224,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; @@ -2256,7 +2256,7 @@ { Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -2317,7 +2317,7 @@ SparseComplexMatrix SparseComplexMatrix::utsolve (MatrixType &mattype, const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -2338,7 +2338,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Upper || typ == MatrixType::Upper) { @@ -2393,11 +2393,11 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(kidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(kidx); + for (octave_idx_type i = cidx(kidx); i < cidx(kidx+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -2450,7 +2450,7 @@ { Complex tmp = work[k] / data(cidx(iidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(iidx); + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { octave_idx_type idx2 = ridx(i); @@ -2490,7 +2490,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; @@ -2544,7 +2544,7 @@ { Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -2604,8 +2604,8 @@ } ComplexMatrix -SparseComplexMatrix::ltsolve (MatrixType &mattype, const Matrix& b, - octave_idx_type& err, double& rcond, +SparseComplexMatrix::ltsolve (MatrixType &mattype, const Matrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -2626,7 +2626,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) { @@ -2679,7 +2679,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(mini); work[k] = tmp; @@ -2715,7 +2715,7 @@ octave_idx_type minr = nr; octave_idx_type mini = 0; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) if (perm[ridx(i)] < minr) { @@ -2725,7 +2725,7 @@ Complex tmp = work[k] / data(mini); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) { if (i == mini) @@ -2769,7 +2769,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; @@ -2801,7 +2801,7 @@ { Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (octave_idx_type i = cidx(k)+1; + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { octave_idx_type iidx = ridx(i); @@ -2860,8 +2860,8 @@ } SparseComplexMatrix -SparseComplexMatrix::ltsolve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& err, double& rcond, +SparseComplexMatrix::ltsolve (MatrixType &mattype, const SparseMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -2883,7 +2883,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) { @@ -2941,7 +2941,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(mini); work[k] = tmp; @@ -2999,7 +2999,7 @@ octave_idx_type minr = nr; octave_idx_type mini = 0; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) if (perm[ridx(i)] < minr) { @@ -3009,7 +3009,7 @@ Complex tmp = work[k] / data(mini); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) { if (i == mini) @@ -3053,7 +3053,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; @@ -3108,7 +3108,7 @@ { Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (octave_idx_type i = cidx(k)+1; + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { octave_idx_type iidx = ridx(i); @@ -3190,7 +3190,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) { @@ -3243,7 +3243,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(mini); work[k] = tmp; @@ -3279,7 +3279,7 @@ octave_idx_type minr = nr; octave_idx_type mini = 0; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) if (perm[ridx(i)] < minr) { @@ -3289,7 +3289,7 @@ Complex tmp = work[k] / data(mini); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) { if (i == mini) @@ -3335,7 +3335,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; @@ -3368,7 +3368,7 @@ { Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (octave_idx_type i = cidx(k)+1; + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { octave_idx_type iidx = ridx(i); @@ -3429,7 +3429,7 @@ SparseComplexMatrix SparseComplexMatrix::ltsolve (MatrixType &mattype, const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -3450,7 +3450,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) { @@ -3508,7 +3508,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(mini); work[k] = tmp; @@ -3566,7 +3566,7 @@ octave_idx_type minr = nr; octave_idx_type mini = 0; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) if (perm[ridx(i)] < minr) { @@ -3576,7 +3576,7 @@ Complex tmp = work[k] / data(mini); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) { if (i == mini) @@ -3620,7 +3620,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; @@ -3675,7 +3675,7 @@ { Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (octave_idx_type i = cidx(k)+1; + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { octave_idx_type iidx = ridx(i); @@ -3752,14 +3752,14 @@ else if (nr == 0 || b.cols () == 0) retval = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0)); else if (calc_cond) - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("calculation of condition number not implemented"); else { // Print spparms("spumoni") info if requested volatile int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Tridiagonal_Hermitian) { OCTAVE_LOCAL_BUFFER (double, D, nr); @@ -3795,12 +3795,12 @@ DL[j] = data(i); } } - + 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, + F77_XFCN (zptsv, ZPTSV, (nr, b_nc, D, DL, result, b.rows(), err)); if (err != 0) @@ -3809,7 +3809,7 @@ mattype.mark_as_unsymmetric (); typ = MatrixType::Tridiagonal; } - else + else rcond = 1.; } @@ -3857,7 +3857,7 @@ retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); - F77_XFCN (zgtsv, ZGTSV, (nr, b_nc, DL, D, DU, result, + F77_XFCN (zgtsv, ZGTSV, (nr, b_nc, DL, D, DU, result, b.rows(), err)); if (err != 0) @@ -3874,8 +3874,8 @@ (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else + } + else rcond = 1.; } else if (typ != MatrixType::Tridiagonal_Hermitian) @@ -3887,7 +3887,7 @@ SparseComplexMatrix SparseComplexMatrix::trisolve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -3903,14 +3903,14 @@ else if (nr == 0 || b.cols () == 0) retval = SparseComplexMatrix (nc, b.cols ()); else if (calc_cond) - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("calculation of condition number not implemented"); else { // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + // Note can't treat symmetric case as there is no dpttrf function if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) @@ -3958,7 +3958,7 @@ F77_XFCN (zgttrf, ZGTTRF, (nr, DL, D, DU, DU2, pipvt, err)); - if (err != 0) + if (err != 0) { err = -2; rcond = 0.0; @@ -3972,8 +3972,8 @@ (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else + } + else { char job = 'N'; volatile octave_idx_type x_nz = b.nnz (); @@ -3992,13 +3992,13 @@ for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - F77_XFCN (zgttrs, ZGTTRS, + F77_XFCN (zgttrs, ZGTTRS, (F77_CONST_CHAR_ARG2 (&job, 1), - nr, 1, DL, D, DU, DU2, pipvt, + nr, 1, DL, D, DU, DU2, pipvt, work, b.rows (), err F77_CHAR_ARG_LEN (1))); - // Count non-zeros in work vector and adjust + // Count non-zeros in work vector and adjust // space in retval if needed octave_idx_type new_nnz = 0; for (octave_idx_type i = 0; i < nr; i++) @@ -4034,7 +4034,7 @@ ComplexMatrix SparseComplexMatrix::trisolve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -4050,14 +4050,14 @@ else if (nr == 0 || b.cols () == 0) retval = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0)); else if (calc_cond) - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("calculation of condition number not implemented"); else { // Print spparms("spumoni") info if requested volatile int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Tridiagonal_Hermitian) { OCTAVE_LOCAL_BUFFER (double, D, nr); @@ -4100,8 +4100,8 @@ retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); - - F77_XFCN (zptsv, ZPTSV, (nr, b_nc, D, DL, result, + + F77_XFCN (zptsv, ZPTSV, (nr, b_nc, D, DL, result, b_nr, err)); if (err != 0) @@ -4158,15 +4158,15 @@ retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); - - F77_XFCN (zgtsv, ZGTSV, (nr, b_nc, DL, D, DU, result, + + F77_XFCN (zgtsv, ZGTSV, (nr, b_nc, DL, D, DU, result, b_nr, err)); if (err != 0) { rcond = 0.; err = -2; - + if (sing_handler) { sing_handler (rcond); @@ -4185,9 +4185,9 @@ } SparseComplexMatrix -SparseComplexMatrix::trisolve (MatrixType &mattype, - const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, +SparseComplexMatrix::trisolve (MatrixType &mattype, + const SparseComplexMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -4203,14 +4203,14 @@ else if (nr == 0 || b.cols () == 0) retval = SparseComplexMatrix (nc, b.cols ()); else if (calc_cond) - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("calculation of condition number not implemented"); else { // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + // Note can't treat symmetric case as there is no dpttrf function if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) @@ -4258,7 +4258,7 @@ F77_XFCN (zgttrf, ZGTTRF, (nr, DL, D, DU, DU2, pipvt, err)); - if (err != 0) + if (err != 0) { rcond = 0.0; err = -2; @@ -4271,9 +4271,9 @@ else (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else - { + } + else + { rcond = 1.; char job = 'N'; octave_idx_type b_nr = b.rows (); @@ -4293,9 +4293,9 @@ for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b (i,j); - F77_XFCN (zgttrs, ZGTTRS, + F77_XFCN (zgttrs, ZGTTRS, (F77_CONST_CHAR_ARG2 (&job, 1), - nr, 1, DL, D, DU, DU2, pipvt, + nr, 1, DL, D, DU, DU2, pipvt, Bx, b_nr, err F77_CHAR_ARG_LEN (1))); @@ -4308,7 +4308,7 @@ break; } - // Count non-zeros in work vector and adjust + // Count non-zeros in work vector and adjust // space in retval if needed octave_idx_type new_nnz = 0; for (octave_idx_type i = 0; i < nr; i++) @@ -4372,8 +4372,8 @@ octave_idx_type ldm = n_lower + 1; ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -4399,8 +4399,8 @@ F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, err F77_CHAR_ARG_LEN (1))); - - if (err != 0) + + if (err != 0) { rcond = 0.0; // Matrix is not positive definite!! Fall through to @@ -4408,8 +4408,8 @@ mattype.mark_as_unsymmetric (); typ = MatrixType::Banded; err = 0; - } - else + } + else { if (calc_cond) { @@ -4418,13 +4418,13 @@ Array iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); - F77_XFCN (zpbcon, ZPBCON, + F77_XFCN (zpbcon, ZPBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -4454,7 +4454,7 @@ octave_idx_type b_nc = b.cols (); - F77_XFCN (zpbtrs, ZPBTRS, + F77_XFCN (zpbtrs, ZPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, b_nc, tmp_data, ldm, result, b.rows(), err @@ -4462,7 +4462,7 @@ if (err != 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve solve failed"); err = -1; } @@ -4479,8 +4479,8 @@ ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -4510,12 +4510,12 @@ Array ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); - F77_XFCN (zgbtrf, ZGBTRF, (nr, nc, n_lower, n_upper, tmp_data, + F77_XFCN (zgbtrf, ZGBTRF, (nr, nc, n_lower, n_upper, tmp_data, ldm, pipvt, err)); - - // Throw-away extra info LAPACK gives so as to not + + // Throw-away extra info LAPACK gives so as to not // change output. - if (err != 0) + if (err != 0) { rcond = 0.0; err = -2; @@ -4528,8 +4528,8 @@ else (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else + } + else { if (calc_cond) { @@ -4539,13 +4539,13 @@ Array iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); - F77_XFCN (zgbcon, ZGBCON, + F77_XFCN (zgbcon, ZGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, n_lower, n_upper, tmp_data, ldm, pipvt, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -4576,7 +4576,7 @@ octave_idx_type b_nc = b.cols (); char job = 'N'; - F77_XFCN (zgbtrs, ZGBTRS, + 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 @@ -4593,7 +4593,7 @@ SparseComplexMatrix SparseComplexMatrix::bsolve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -4621,8 +4621,8 @@ ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -4648,15 +4648,15 @@ F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, err F77_CHAR_ARG_LEN (1))); - - if (err != 0) + + if (err != 0) { rcond = 0.0; mattype.mark_as_unsymmetric (); typ = MatrixType::Banded; err = 0; - } - else + } + else { if (calc_cond) { @@ -4665,13 +4665,13 @@ Array iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); - F77_XFCN (zpbcon, ZPBCON, + F77_XFCN (zpbcon, ZPBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -4712,7 +4712,7 @@ for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b.elem (i, j); - F77_XFCN (zpbtrs, ZPBTRS, + F77_XFCN (zpbtrs, ZPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, 1, tmp_data, ldm, Bx, b_nr, err @@ -4720,7 +4720,7 @@ if (err != 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexMatrix::solve solve failed"); err = -1; break; @@ -4734,7 +4734,7 @@ if (ii == x_nz) { // Resize the sparse matrix - octave_idx_type sz = x_nz * + octave_idx_type sz = x_nz * (b_nc - j) / b_nc; sz = (sz > 10 ? sz : 10) + x_nz; retval.change_capacity (sz); @@ -4761,8 +4761,8 @@ ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -4792,10 +4792,10 @@ Array ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); - F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, + F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); - - if (err != 0) + + if (err != 0) { rcond = 0.0; err = -2; @@ -4809,8 +4809,8 @@ (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else + } + else { if (calc_cond) { @@ -4820,13 +4820,13 @@ Array iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); - F77_XFCN (zgbcon, ZGBCON, + F77_XFCN (zgbcon, ZGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, n_lower, n_upper, tmp_data, ldm, pipvt, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -4864,17 +4864,17 @@ { for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (octave_idx_type i = b.cidx(j); + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - F77_XFCN (zgbtrs, ZGBTRS, + F77_XFCN (zgbtrs, ZGBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, n_upper, 1, tmp_data, ldm, pipvt, work, b.rows (), err F77_CHAR_ARG_LEN (1))); - // Count non-zeros in work vector and adjust + // Count non-zeros in work vector and adjust // space in retval if needed octave_idx_type new_nnz = 0; for (octave_idx_type i = 0; i < nr; i++) @@ -4910,8 +4910,8 @@ } ComplexMatrix -SparseComplexMatrix::bsolve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& err, double& rcond, +SparseComplexMatrix::bsolve (MatrixType &mattype, const ComplexMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -4939,8 +4939,8 @@ ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -4966,8 +4966,8 @@ F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, err F77_CHAR_ARG_LEN (1))); - - if (err != 0) + + if (err != 0) { // Matrix is not positive definite!! Fall through to // unsymmetric banded solver. @@ -4975,8 +4975,8 @@ mattype.mark_as_unsymmetric (); typ = MatrixType::Banded; err = 0; - } - else + } + else { if (calc_cond) { @@ -4985,13 +4985,13 @@ Array iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); - F77_XFCN (zpbcon, ZPBCON, + F77_XFCN (zpbcon, ZPBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -5021,7 +5021,7 @@ retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); - F77_XFCN (zpbtrs, ZPBTRS, + F77_XFCN (zpbtrs, ZPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, b_nc, tmp_data, ldm, result, b_nr, err @@ -5029,7 +5029,7 @@ if (err != 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexMatrix::solve solve failed"); err = -1; } @@ -5046,8 +5046,8 @@ ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -5077,10 +5077,10 @@ Array ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); - F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, + F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); - - if (err != 0) + + if (err != 0) { err = -2; rcond = 0.0; @@ -5093,8 +5093,8 @@ else (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else + } + else { if (calc_cond) { @@ -5104,13 +5104,13 @@ Array iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); - F77_XFCN (zgbcon, ZGBCON, + F77_XFCN (zgbcon, ZGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, n_lower, n_upper, tmp_data, ldm, pipvt, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -5140,7 +5140,7 @@ retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); - F77_XFCN (zgbtrs, ZGBTRS, + 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 @@ -5157,7 +5157,7 @@ SparseComplexMatrix SparseComplexMatrix::bsolve (MatrixType &mattype, const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -5185,8 +5185,8 @@ ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -5212,8 +5212,8 @@ F77_XFCN (zpbtrf, ZPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, err F77_CHAR_ARG_LEN (1))); - - if (err != 0) + + if (err != 0) { // Matrix is not positive definite!! Fall through to // unsymmetric banded solver. @@ -5222,8 +5222,8 @@ rcond = 0.0; err = 0; - } - else + } + else { if (calc_cond) { @@ -5232,13 +5232,13 @@ Array iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); - F77_XFCN (zpbcon, ZPBCON, + F77_XFCN (zpbcon, ZPBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -5280,7 +5280,7 @@ for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b (i,j); - F77_XFCN (zpbtrs, ZPBTRS, + F77_XFCN (zpbtrs, ZPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, 1, tmp_data, ldm, Bx, b_nr, err @@ -5288,13 +5288,13 @@ if (err != 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve solve failed"); err = -1; break; } - // Count non-zeros in work vector and adjust + // Count non-zeros in work vector and adjust // space in retval if needed octave_idx_type new_nnz = 0; for (octave_idx_type i = 0; i < nr; i++) @@ -5333,8 +5333,8 @@ ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -5364,10 +5364,10 @@ Array ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); - F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, + F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); - - if (err != 0) + + if (err != 0) { err = -2; rcond = 0.0; @@ -5382,7 +5382,7 @@ ("matrix singular to machine precision"); } - else + else { if (calc_cond) { @@ -5392,13 +5392,13 @@ Array iz (dim_vector (nr, 1)); double *piz = iz.fortran_vec (); - F77_XFCN (zgbcon, ZGBCON, + F77_XFCN (zgbcon, ZGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, n_lower, n_upper, tmp_data, ldm, pipvt, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -5437,17 +5437,17 @@ for (octave_idx_type i = 0; i < nr; i++) Bx[i] = 0.; - for (octave_idx_type i = b.cidx(j); + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) Bx[b.ridx(i)] = b.data(i); - F77_XFCN (zgbtrs, ZGBTRS, + F77_XFCN (zgbtrs, ZGBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, n_upper, 1, tmp_data, ldm, pipvt, Bx, b.rows (), err F77_CHAR_ARG_LEN (1))); - // Count non-zeros in work vector and adjust + // Count non-zeros in work vector and adjust // space in retval if needed octave_idx_type new_nnz = 0; for (octave_idx_type i = 0; i < nr; i++) @@ -5466,7 +5466,7 @@ if (Bx[i] != 0.) { retval.xridx(ii) = i; - retval.xdata(ii++) = Bx[i]; + retval.xdata(ii++) = Bx[i]; } retval.xcidx(j+1) = ii; } @@ -5478,7 +5478,7 @@ else if (typ != MatrixType::Banded_Hermitian) (*current_liboctave_error_handler) ("incorrect matrix type"); } - + return retval; } @@ -5528,13 +5528,13 @@ void *Symbolic; Info = Matrix (1, UMFPACK_INFO); double *info = Info.fortran_vec (); - int status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, - reinterpret_cast (Ax), + int status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, + reinterpret_cast (Ax), 0, 0, &Symbolic, control, info); if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexMatrix::solve symbolic factorization failed"); err = -1; @@ -5548,7 +5548,7 @@ UMFPACK_ZNAME (report_symbolic) (Symbolic, control); status = UMFPACK_ZNAME (numeric) (Ap, Ai, - reinterpret_cast (Ax), 0, + reinterpret_cast (Ax), 0, Symbolic, &Numeric, control, info) ; UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; @@ -5558,7 +5558,7 @@ rcond = 1.; volatile double rcond_plus_one = rcond + 1.0; - if (status == UMFPACK_WARNING_singular_matrix || + if (status == UMFPACK_WARNING_singular_matrix || rcond_plus_one == 1.0 || xisnan (rcond)) { UMFPACK_ZNAME (report_numeric) (Numeric, control); @@ -5575,12 +5575,12 @@ } else if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexMatrix::solve numeric factorization failed"); UMFPACK_ZNAME (report_status) (control, status); UMFPACK_ZNAME (report_info) (control, info); - + err = -1; } else @@ -5722,7 +5722,7 @@ (*current_liboctave_error_handler) ("SparseMatrix::solve matrix singular to machine precision, rcond = %g", rcond); - + return retval; } @@ -5760,7 +5760,7 @@ { #ifdef HAVE_UMFPACK Matrix Control, Info; - void *Numeric = factorize (err, rcond, Control, Info, + void *Numeric = factorize (err, rcond, Control, Info, sing_handler, calc_cond); if (err == 0) @@ -5789,11 +5789,11 @@ #ifdef UMFPACK_SEPARATE_SPLIT status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, - reinterpret_cast (Ax), + reinterpret_cast (Ax), 0, - reinterpret_cast (&Xx[iidx]), + reinterpret_cast (&Xx[iidx]), 0, - &Bx[iidx], Bz, Numeric, + &Bx[iidx], Bz, Numeric, control, info); #else for (octave_idx_type i = 0; i < b_nr; i++) @@ -5801,22 +5801,22 @@ status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, - reinterpret_cast (Ax), + reinterpret_cast (Ax), 0, - reinterpret_cast (&Xx[iidx]), + reinterpret_cast (&Xx[iidx]), 0, reinterpret_cast (Bz), - 0, Numeric, + 0, Numeric, control, info); #endif if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexMatrix::solve solve failed"); UMFPACK_ZNAME (report_status) (control, status); - + err = -1; break; @@ -5837,12 +5837,12 @@ else if (typ != MatrixType::Hermitian) (*current_liboctave_error_handler) ("incorrect matrix type"); } - + return retval; } SparseComplexMatrix -SparseComplexMatrix::fsolve (MatrixType &mattype, const SparseMatrix& b, +SparseComplexMatrix::fsolve (MatrixType &mattype, const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const @@ -5975,7 +5975,7 @@ (*current_liboctave_error_handler) ("SparseMatrix::solve matrix singular to machine precision, rcond = %g", rcond); - + return retval; } @@ -5984,14 +5984,14 @@ X = CHOLMOD_NAME(spsolve) (CHOLMOD_A, L, B, cm); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - retval = SparseComplexMatrix - (static_cast(X->nrow), + retval = SparseComplexMatrix + (static_cast(X->nrow), static_cast(X->ncol), static_cast(X->nzmax)); - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j <= static_cast(X->ncol); j++) retval.xcidx(j) = static_cast(X->p)[j]; - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j < static_cast(X->nzmax); j++) { retval.xridx(j) = static_cast(X->i)[j]; @@ -6019,7 +6019,7 @@ { #ifdef HAVE_UMFPACK Matrix Control, Info; - void *Numeric = factorize (err, rcond, Control, Info, + void *Numeric = factorize (err, rcond, Control, Info, sing_handler, calc_cond); if (err == 0) @@ -6049,7 +6049,7 @@ retval = SparseComplexMatrix (b_nr, b_nc, x_nz); OCTAVE_LOCAL_BUFFER (Complex, Xx, b_nr); - + retval.xcidx(0) = 0; for (octave_idx_type j = 0; j < b_nc; j++) { @@ -6063,30 +6063,30 @@ reinterpret_cast (Ax), 0, reinterpret_cast (Xx), - 0, - Bx, Bz, Numeric, control, + 0, + Bx, Bz, Numeric, control, info); #else for (octave_idx_type i = 0; i < b_nr; i++) Bz[i] = b.elem (i, j); - status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, + status = UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, reinterpret_cast (Ax), 0, reinterpret_cast (Xx), 0, reinterpret_cast (Bz), 0, - Numeric, control, + Numeric, control, info); #endif if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexMatrix::solve solve failed"); UMFPACK_ZNAME (report_status) (control, status); - + err = -1; break; @@ -6128,12 +6128,12 @@ else if (typ != MatrixType::Hermitian) (*current_liboctave_error_handler) ("incorrect matrix type"); } - + return retval; } ComplexMatrix -SparseComplexMatrix::fsolve (MatrixType &mattype, const ComplexMatrix& b, +SparseComplexMatrix::fsolve (MatrixType &mattype, const ComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const @@ -6256,7 +6256,7 @@ (*current_liboctave_error_handler) ("SparseMatrix::solve matrix singular to machine precision, rcond = %g", rcond); - + return retval; } @@ -6311,25 +6311,25 @@ retval.resize (b_nr, b_nc); Complex *Xx = retval.fortran_vec (); - + for (octave_idx_type j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) { - status = - UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, - reinterpret_cast (Ax), + status = + UMFPACK_ZNAME (solve) (UMFPACK_A, Ap, Ai, + reinterpret_cast (Ax), 0, - reinterpret_cast (&Xx[iidx]), + reinterpret_cast (&Xx[iidx]), 0, - reinterpret_cast (&Bx[iidx]), + reinterpret_cast (&Bx[iidx]), 0, Numeric, control, info); - + if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexMatrix::solve solve failed"); UMFPACK_ZNAME (report_status) (control, status); - + err = -1; break; @@ -6350,7 +6350,7 @@ else if (typ != MatrixType::Hermitian) (*current_liboctave_error_handler) ("incorrect matrix type"); } - + return retval; } @@ -6488,7 +6488,7 @@ (*current_liboctave_error_handler) ("SparseMatrix::solve matrix singular to machine precision, rcond = %g", rcond); - + return retval; } @@ -6497,14 +6497,14 @@ X = CHOLMOD_NAME(spsolve) (CHOLMOD_A, L, B, cm); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - retval = SparseComplexMatrix - (static_cast(X->nrow), + retval = SparseComplexMatrix + (static_cast(X->nrow), static_cast(X->ncol), static_cast(X->nzmax)); - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j <= static_cast(X->ncol); j++) retval.xcidx(j) = static_cast(X->p)[j]; - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j < static_cast(X->nzmax); j++) { retval.xridx(j) = static_cast(X->i)[j]; @@ -6555,7 +6555,7 @@ retval = SparseComplexMatrix (b_nr, b_nc, x_nz); OCTAVE_LOCAL_BUFFER (Complex, Xx, b_nr); - + retval.xcidx(0) = 0; for (octave_idx_type j = 0; j < b_nc; j++) { @@ -6570,14 +6570,14 @@ 0, reinterpret_cast (Bx), 0, Numeric, control, info); - + if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexMatrix::solve solve failed"); UMFPACK_ZNAME (report_status) (control, status); - + err = -1; break; @@ -6608,7 +6608,7 @@ rcond = Info (UMFPACK_RCOND); volatile double rcond_plus_one = rcond + 1.0; - if (status == UMFPACK_WARNING_singular_matrix || + if (status == UMFPACK_WARNING_singular_matrix || rcond_plus_one == 1.0 || xisnan (rcond)) { err = -2; @@ -6636,7 +6636,7 @@ else if (typ != MatrixType::Hermitian) (*current_liboctave_error_handler) ("incorrect matrix type"); } - + return retval; } @@ -6649,7 +6649,7 @@ } ComplexMatrix -SparseComplexMatrix::solve (MatrixType &mattype, const Matrix& b, +SparseComplexMatrix::solve (MatrixType &mattype, const Matrix& b, octave_idx_type& info) const { double rcond; @@ -6665,7 +6665,7 @@ ComplexMatrix SparseComplexMatrix::solve (MatrixType &mattype, const Matrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback) const { @@ -6683,7 +6683,7 @@ retval = ltsolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) retval = bsolve (mattype, b, err, rcond, sing_handler, false); - else if (typ == MatrixType::Tridiagonal || + else if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) retval = trisolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) @@ -6717,7 +6717,7 @@ } SparseComplexMatrix -SparseComplexMatrix::solve (MatrixType &mattype, const SparseMatrix& b, +SparseComplexMatrix::solve (MatrixType &mattype, const SparseMatrix& b, octave_idx_type& info) const { double rcond; @@ -6732,7 +6732,7 @@ } SparseComplexMatrix -SparseComplexMatrix::solve (MatrixType &mattype, const SparseMatrix& b, +SparseComplexMatrix::solve (MatrixType &mattype, const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback) const @@ -6751,7 +6751,7 @@ retval = ltsolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) retval = bsolve (mattype, b, err, rcond, sing_handler, false); - else if (typ == MatrixType::Tridiagonal || + else if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) retval = trisolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) @@ -6785,7 +6785,7 @@ } ComplexMatrix -SparseComplexMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, +SparseComplexMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, octave_idx_type& info) const { double rcond; @@ -6793,15 +6793,15 @@ } ComplexMatrix -SparseComplexMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, +SparseComplexMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ComplexMatrix -SparseComplexMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& err, double& rcond, +SparseComplexMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback) const { @@ -6819,7 +6819,7 @@ retval = ltsolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) retval = bsolve (mattype, b, err, rcond, sing_handler, false); - else if (typ == MatrixType::Tridiagonal || + else if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) retval = trisolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) @@ -6845,7 +6845,7 @@ } SparseComplexMatrix -SparseComplexMatrix::solve (MatrixType &mattype, +SparseComplexMatrix::solve (MatrixType &mattype, const SparseComplexMatrix& b) const { octave_idx_type info; @@ -6854,7 +6854,7 @@ } SparseComplexMatrix -SparseComplexMatrix::solve (MatrixType &mattype, const SparseComplexMatrix& b, +SparseComplexMatrix::solve (MatrixType &mattype, const SparseComplexMatrix& b, octave_idx_type& info) const { double rcond; @@ -6869,7 +6869,7 @@ } SparseComplexMatrix -SparseComplexMatrix::solve (MatrixType &mattype, const SparseComplexMatrix& b, +SparseComplexMatrix::solve (MatrixType &mattype, const SparseComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback) const @@ -6888,7 +6888,7 @@ retval = ltsolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) retval = bsolve (mattype, b, err, rcond, sing_handler, false); - else if (typ == MatrixType::Tridiagonal || + else if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) retval = trisolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) @@ -6921,7 +6921,7 @@ } ComplexColumnVector -SparseComplexMatrix::solve (MatrixType &mattype, const ColumnVector& b, +SparseComplexMatrix::solve (MatrixType &mattype, const ColumnVector& b, octave_idx_type& info) const { double rcond; @@ -6929,14 +6929,14 @@ } ComplexColumnVector -SparseComplexMatrix::solve (MatrixType &mattype, const ColumnVector& b, +SparseComplexMatrix::solve (MatrixType &mattype, const ColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ComplexColumnVector -SparseComplexMatrix::solve (MatrixType &mattype, const ColumnVector& b, +SparseComplexMatrix::solve (MatrixType &mattype, const ColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { @@ -6945,7 +6945,7 @@ } ComplexColumnVector -SparseComplexMatrix::solve (MatrixType &mattype, +SparseComplexMatrix::solve (MatrixType &mattype, const ComplexColumnVector& b) const { octave_idx_type info; @@ -6993,15 +6993,15 @@ } ComplexMatrix -SparseComplexMatrix::solve (const Matrix& b, octave_idx_type& info, +SparseComplexMatrix::solve (const Matrix& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ComplexMatrix -SparseComplexMatrix::solve (const Matrix& b, octave_idx_type& err, - double& rcond, +SparseComplexMatrix::solve (const Matrix& b, octave_idx_type& err, + double& rcond, solve_singularity_handler sing_handler) const { MatrixType mattype (*this); @@ -7017,7 +7017,7 @@ } SparseComplexMatrix -SparseComplexMatrix::solve (const SparseMatrix& b, +SparseComplexMatrix::solve (const SparseMatrix& b, octave_idx_type& info) const { double rcond; @@ -7032,7 +7032,7 @@ } SparseComplexMatrix -SparseComplexMatrix::solve (const SparseMatrix& b, +SparseComplexMatrix::solve (const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { @@ -7041,7 +7041,7 @@ } ComplexMatrix -SparseComplexMatrix::solve (const ComplexMatrix& b, +SparseComplexMatrix::solve (const ComplexMatrix& b, octave_idx_type& info) const { double rcond; @@ -7049,15 +7049,15 @@ } ComplexMatrix -SparseComplexMatrix::solve (const ComplexMatrix& b, +SparseComplexMatrix::solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ComplexMatrix -SparseComplexMatrix::solve (const ComplexMatrix& b, - octave_idx_type& err, double& rcond, +SparseComplexMatrix::solve (const ComplexMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { MatrixType mattype (*this); @@ -7073,7 +7073,7 @@ } SparseComplexMatrix -SparseComplexMatrix::solve (const SparseComplexMatrix& b, +SparseComplexMatrix::solve (const SparseComplexMatrix& b, octave_idx_type& info) const { double rcond; @@ -7088,7 +7088,7 @@ } SparseComplexMatrix -SparseComplexMatrix::solve (const SparseComplexMatrix& b, +SparseComplexMatrix::solve (const SparseComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { @@ -7111,7 +7111,7 @@ } ComplexColumnVector -SparseComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, +SparseComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); @@ -7141,14 +7141,14 @@ } ComplexColumnVector -SparseComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, +SparseComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ComplexColumnVector -SparseComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, +SparseComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { @@ -7167,9 +7167,9 @@ octave_idx_type nc = cols (); octave_idx_type nz1 = nnz (); octave_idx_type nz2 = nr*nc - nz1; - + SparseBoolMatrix r (nr, nc, nz2); - + octave_idx_type ii = 0; octave_idx_type jj = 0; r.cidx (0) = 0; @@ -7191,10 +7191,10 @@ return r; } -SparseComplexMatrix +SparseComplexMatrix SparseComplexMatrix::squeeze (void) const -{ - return MSparse::squeeze (); +{ + return MSparse::squeeze (); } SparseComplexMatrix @@ -7257,7 +7257,7 @@ // Return nonzero if any element of CM has a non-integer real or // imaginary part. Also extract the largest and smallest (real or -// imaginary) values and return them in MAX_VAL and MIN_VAL. +// imaginary) values and return them in MAX_VAL and MIN_VAL. bool SparseComplexMatrix::all_integers (double& max_val, double& min_val) const @@ -7352,7 +7352,7 @@ return transpose (). prod (0). transpose(); else { - SPARSE_REDUCTION_OP (SparseComplexMatrix, Complex, *=, + SPARSE_REDUCTION_OP (SparseComplexMatrix, Complex, *=, (cidx(j+1) - cidx(j) < nr ? 0.0 : 1.0), 1.0); } } @@ -7374,7 +7374,7 @@ Complex d = data (i); \ tmp [j] += d * conj (d) - SPARSE_BASE_REDUCTION_OP (SparseComplexMatrix, Complex, ROW_EXPR, + SPARSE_BASE_REDUCTION_OP (SparseComplexMatrix, Complex, ROW_EXPR, COL_EXPR, 0.0, 0.0); #undef ROW_EXPR @@ -7650,7 +7650,7 @@ for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) result.data(i) = xmin(c, m.data(i)); } - + return result; } @@ -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 (); @@ -7681,7 +7681,7 @@ else { r = SparseComplexMatrix (a_nr, a_nc, (a.nnz () + b.nnz ())); - + octave_idx_type jx = 0; r.cidx (0) = 0; for (octave_idx_type i = 0 ; i < a_nc ; i++) @@ -7689,11 +7689,11 @@ octave_idx_type ja = a.cidx(i); octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - + octave_idx_type jb = b.cidx(i); octave_idx_type jb_max = b.cidx(i+1); bool jb_lt_max = jb < jb_max; - + while (ja_lt_max || jb_lt_max ) { octave_quit (); @@ -7740,7 +7740,7 @@ } r.cidx(i+1) = jx; } - + r.maybe_compress (); } } @@ -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 (); @@ -7805,7 +7805,7 @@ else { r = SparseComplexMatrix (a_nr, a_nc, (a.nnz () + b.nnz ())); - + octave_idx_type jx = 0; r.cidx (0) = 0; for (octave_idx_type i = 0 ; i < a_nc ; i++) @@ -7813,11 +7813,11 @@ octave_idx_type ja = a.cidx(i); octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - + octave_idx_type jb = b.cidx(i); octave_idx_type jb_max = b.cidx(i+1); bool jb_lt_max = jb < jb_max; - + while (ja_lt_max || jb_lt_max ) { octave_quit (); @@ -7864,7 +7864,7 @@ } r.cidx(i+1) = jx; } - + r.maybe_compress (); } } @@ -7874,14 +7874,14 @@ return r; } -SPARSE_SMS_CMP_OPS (SparseComplexMatrix, 0.0, real, Complex, +SPARSE_SMS_CMP_OPS (SparseComplexMatrix, 0.0, real, Complex, 0.0, real) SPARSE_SMS_BOOL_OPS (SparseComplexMatrix, Complex, 0.0) -SPARSE_SSM_CMP_OPS (Complex, 0.0, real, SparseComplexMatrix, +SPARSE_SSM_CMP_OPS (Complex, 0.0, real, SparseComplexMatrix, 0.0, real) SPARSE_SSM_BOOL_OPS (Complex, SparseComplexMatrix, 0.0) -SPARSE_SMSM_CMP_OPS (SparseComplexMatrix, 0.0, real, SparseComplexMatrix, +SPARSE_SMSM_CMP_OPS (SparseComplexMatrix, 0.0, real, SparseComplexMatrix, 0.0, real) SPARSE_SMSM_BOOL_OPS (SparseComplexMatrix, SparseComplexMatrix, 0.0) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CSparse.h --- a/liboctave/CSparse.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CSparse.h Thu Jan 20 17:24:59 2011 -0500 @@ -48,40 +48,40 @@ SparseComplexMatrix : public MSparse { public: - + typedef void (*solve_singularity_handler) (double rcond); SparseComplexMatrix (void) : MSparse () { } SparseComplexMatrix (octave_idx_type r, octave_idx_type c) : MSparse (r, c) { } - SparseComplexMatrix (const dim_vector& dv, octave_idx_type nz = 0) : + SparseComplexMatrix (const dim_vector& dv, octave_idx_type nz = 0) : MSparse (dv, nz) { } - explicit SparseComplexMatrix (octave_idx_type r, octave_idx_type c, Complex val) + explicit SparseComplexMatrix (octave_idx_type r, octave_idx_type c, Complex val) : MSparse (r, c, val) { } - SparseComplexMatrix (octave_idx_type r, octave_idx_type c, double val) + SparseComplexMatrix (octave_idx_type r, octave_idx_type c, double val) : MSparse (r, c, Complex (val)) { } - SparseComplexMatrix (const SparseComplexMatrix& a) + SparseComplexMatrix (const SparseComplexMatrix& a) : MSparse (a) { } - SparseComplexMatrix (const SparseComplexMatrix& a, const dim_vector& dv) + SparseComplexMatrix (const SparseComplexMatrix& a, const dim_vector& dv) : MSparse (a, dv) { } SparseComplexMatrix (const MSparse& a) : MSparse (a) { } SparseComplexMatrix (const Sparse& a) : MSparse (a) { } - explicit SparseComplexMatrix (const ComplexMatrix& a) + explicit SparseComplexMatrix (const ComplexMatrix& a) : MSparse (a) { } - explicit SparseComplexMatrix (const ComplexNDArray& a) + explicit SparseComplexMatrix (const ComplexNDArray& a) : MSparse (a) { } - SparseComplexMatrix (const Array& a, const idx_vector& r, - const idx_vector& c, octave_idx_type nr = -1, + SparseComplexMatrix (const Array& a, const idx_vector& r, + const idx_vector& c, octave_idx_type nr = -1, octave_idx_type nc = -1, bool sum_terms = true, octave_idx_type nzm = -1) : MSparse (a, r, c, nr, nc, sum_terms, nzm) { } @@ -92,7 +92,7 @@ explicit SparseComplexMatrix (const ComplexDiagMatrix& a); - SparseComplexMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) + SparseComplexMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) : MSparse (r, c, num_nz) { } SparseComplexMatrix& operator = (const SparseComplexMatrix& a) @@ -136,46 +136,46 @@ ComplexColumnVector column (octave_idx_type i) const; private: - SparseComplexMatrix dinverse (MatrixType &mattyp, octave_idx_type& info, - double& rcond, const bool force = false, + SparseComplexMatrix dinverse (MatrixType &mattyp, octave_idx_type& info, + double& rcond, const bool force = false, const bool calccond = true) const; - SparseComplexMatrix tinverse (MatrixType &mattyp, octave_idx_type& info, - double& rcond, const bool force = false, + SparseComplexMatrix tinverse (MatrixType &mattyp, octave_idx_type& info, + double& rcond, const bool force = false, const bool calccond = true) const; public: SparseComplexMatrix inverse (void) const; SparseComplexMatrix inverse (MatrixType& mattype) const; - SparseComplexMatrix inverse (MatrixType& mattype, + SparseComplexMatrix inverse (MatrixType& mattype, octave_idx_type& info) const; - SparseComplexMatrix inverse (MatrixType& mattype, octave_idx_type& info, - double& rcond, int force = 0, + SparseComplexMatrix inverse (MatrixType& mattype, octave_idx_type& info, + double& rcond, int force = 0, int calc_cond = 1) const; ComplexDET determinant (void) const; ComplexDET determinant (octave_idx_type& info) const; - ComplexDET determinant (octave_idx_type& info, double& rcond, + ComplexDET determinant (octave_idx_type& info, double& rcond, int calc_cond = 1) const; private: // Diagonal matrix solvers - ComplexMatrix dsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, + ComplexMatrix dsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; - ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, + ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, bool calc_cond = false) const; - SparseComplexMatrix dsolve (MatrixType &typ, const SparseMatrix& b, + SparseComplexMatrix dsolve (MatrixType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseComplexMatrix dsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; @@ -184,60 +184,60 @@ double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; - ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; - SparseComplexMatrix utsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, + SparseComplexMatrix utsolve (MatrixType &typ, const SparseMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; - SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; // Lower triangular matrix solvers - ComplexMatrix ltsolve (MatrixType &typ, const Matrix& b, - octave_idx_type& info, double& rcond, + ComplexMatrix ltsolve (MatrixType &typ, const Matrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; - ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseComplexMatrix ltsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; - SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; // Tridiagonal matrix solvers ComplexMatrix trisolve (MatrixType &typ, const Matrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; - ComplexMatrix trisolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + ComplexMatrix trisolve (MatrixType &typ, const ComplexMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseComplexMatrix trisolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseComplexMatrix trisolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; @@ -246,13 +246,13 @@ double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; - ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; - SparseComplexMatrix bsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, + SparseComplexMatrix bsolve (MatrixType &typ, const SparseMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; @@ -262,83 +262,83 @@ bool calc_cond = false) const; // Full matrix solvers (umfpack/cholesky) - void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, + void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, Matrix &Info, solve_singularity_handler sing_handler, bool calc_cond) const; - ComplexMatrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, + ComplexMatrix fsolve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; - ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; - SparseComplexMatrix fsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, + SparseComplexMatrix fsolve (MatrixType &typ, const SparseMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseComplexMatrix fsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; public: // Generic interface to solver with no probing of type ComplexMatrix solve (MatrixType &typ, const Matrix& b) const; - ComplexMatrix solve (MatrixType &typ, const Matrix& b, + ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info) const; - ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, + ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcond) const; - ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, + ComplexMatrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback = true) const; ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; - ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, + ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info) const; - ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, + ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback = true) const; SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b) const; - SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, + SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, octave_idx_type& info) const; - SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, + SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond) const; - SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, + SparseComplexMatrix solve (MatrixType &typ, const SparseMatrix& b, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback = true) const; - SparseComplexMatrix solve (MatrixType &typ, + SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b) const; - SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, + SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, octave_idx_type& info) const; - SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, + SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, octave_idx_type& info, double& rcond) const; SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback = true) const; ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b) const; - ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info) const; - ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info, double& rcond) const; ComplexColumnVector solve (MatrixType &typ, const ColumnVector& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexColumnVector solve (MatrixType &typ, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b) const; - ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info) const; ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const; @@ -349,28 +349,28 @@ // Generic interface to solver with probing of type ComplexMatrix solve (const Matrix& b) const; ComplexMatrix solve (const Matrix& b, octave_idx_type& info) const; - ComplexMatrix solve (const Matrix& b, octave_idx_type& info, + ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcond) const; - ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcond, + ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexMatrix solve (const ComplexMatrix& b) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; - ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix solve (const SparseMatrix& b) const; SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info) const; - SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, + SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, double& rcond) const; - SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, - double& rcond, + SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, + double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix solve (const SparseComplexMatrix& b) const; - SparseComplexMatrix solve (const SparseComplexMatrix& b, + SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info) const; SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, double& rcond) const; @@ -382,12 +382,12 @@ ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const; - ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, + ComplexColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexColumnVector solve (const ComplexColumnVector& b) const; - ComplexColumnVector solve (const ComplexColumnVector& b, + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const; @@ -399,7 +399,7 @@ SparseComplexMatrix reshape (const dim_vector& new_dims) const; - SparseComplexMatrix permute (const Array& vec, + SparseComplexMatrix permute (const Array& vec, bool inv = false) const; SparseComplexMatrix ipermute (const Array& vec) const; @@ -425,39 +425,39 @@ SparseComplexMatrix diag (octave_idx_type k = 0) const; // i/o - friend OCTAVE_API std::ostream& operator << (std::ostream& os, + friend OCTAVE_API std::ostream& operator << (std::ostream& os, const SparseComplexMatrix& a); - friend OCTAVE_API std::istream& operator >> (std::istream& is, + friend OCTAVE_API std::istream& operator >> (std::istream& is, SparseComplexMatrix& a); }; -extern OCTAVE_API SparseComplexMatrix operator * (const SparseMatrix&, +extern OCTAVE_API SparseComplexMatrix operator * (const SparseMatrix&, const SparseComplexMatrix&); -extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, +extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, const SparseMatrix&); -extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, +extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, const SparseComplexMatrix&); -extern OCTAVE_API ComplexMatrix operator * (const Matrix&, +extern OCTAVE_API ComplexMatrix operator * (const Matrix&, const SparseComplexMatrix&); -extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, +extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, const SparseMatrix&); -extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, +extern OCTAVE_API ComplexMatrix operator * (const ComplexMatrix&, const SparseComplexMatrix&); -extern OCTAVE_API ComplexMatrix mul_trans (const ComplexMatrix&, +extern OCTAVE_API ComplexMatrix mul_trans (const ComplexMatrix&, const SparseComplexMatrix&); -extern OCTAVE_API ComplexMatrix mul_herm (const ComplexMatrix&, +extern OCTAVE_API ComplexMatrix mul_herm (const ComplexMatrix&, const SparseComplexMatrix&); -extern OCTAVE_API ComplexMatrix operator * (const SparseMatrix&, +extern OCTAVE_API ComplexMatrix operator * (const SparseMatrix&, const ComplexMatrix&); -extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, +extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, const Matrix&); -extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, +extern OCTAVE_API ComplexMatrix operator * (const SparseComplexMatrix&, const ComplexMatrix&); -extern OCTAVE_API ComplexMatrix trans_mul (const SparseComplexMatrix&, +extern OCTAVE_API ComplexMatrix trans_mul (const SparseComplexMatrix&, const ComplexMatrix&); -extern OCTAVE_API ComplexMatrix herm_mul (const SparseComplexMatrix&, +extern OCTAVE_API ComplexMatrix herm_mul (const SparseComplexMatrix&, const ComplexMatrix&); extern OCTAVE_API SparseComplexMatrix operator * (const DiagMatrix&, const SparseComplexMatrix&); @@ -488,18 +488,18 @@ extern OCTAVE_API SparseComplexMatrix operator * (const SparseComplexMatrix&, const PermMatrix&); -extern OCTAVE_API SparseComplexMatrix min (const Complex& c, +extern OCTAVE_API SparseComplexMatrix min (const Complex& c, const SparseComplexMatrix& m); -extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& m, +extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& m, const Complex& c); -extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& a, +extern OCTAVE_API SparseComplexMatrix min (const SparseComplexMatrix& a, const SparseComplexMatrix& b); -extern OCTAVE_API SparseComplexMatrix max (const Complex& c, +extern OCTAVE_API SparseComplexMatrix max (const Complex& c, const SparseComplexMatrix& m); -extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& m, +extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& m, const Complex& c); -extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& a, +extern OCTAVE_API SparseComplexMatrix max (const SparseComplexMatrix& a, const SparseComplexMatrix& b); SPARSE_SMS_CMP_OP_DECLS (SparseComplexMatrix, Complex, OCTAVE_API) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/ChangeLog --- a/liboctave/ChangeLog Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/ChangeLog Thu Jan 20 17:24:59 2011 -0500 @@ -1,3 +1,56 @@ +2011-01-20 John W. Eaton + + * Array-b.cc, Array-d.cc, Array-f.cc, Array-util.cc, + Array-util.h, Array.cc, Array.h, Array3.h, CColVector.cc, + CColVector.h, CDiagMatrix.cc, CDiagMatrix.h, CMatrix.cc, + CMatrix.h, CNDArray.cc, CNDArray.h, CSparse.cc, CSparse.h, + CmplxAEPBAL.cc, CmplxAEPBAL.h, CmplxCHOL.cc, CmplxGEPBAL.cc, + CmplxGEPBAL.h, CmplxHESS.cc, CmplxLU.h, CmplxQR.cc, CmplxQR.h, + CmplxSCHUR.cc, CmplxSVD.h, CollocWt.cc, CollocWt.h, DASPK.cc, + DASPK.h, DASRT.cc, DASRT.h, DASSL.cc, DASSL.h, DET.h, + DiagArray2.h, EIG.cc, LSODE.cc, MArray.cc, MArray.h, + MDiagArray2.cc, MDiagArray2.h, MSparse.cc, MSparse.h, + MatrixType.cc, MatrixType.h, ODESFunc.h, PermMatrix.cc, + PermMatrix.h, Quad.cc, Range.cc, Sparse.cc, Sparse.h, + SparseCmplxCHOL.cc, SparseCmplxCHOL.h, SparseCmplxLU.cc, + SparseCmplxLU.h, SparseCmplxQR.cc, SparseCmplxQR.h, SparseQR.cc, + SparseQR.h, SparsedbleCHOL.cc, SparsedbleCHOL.h, + SparsedbleLU.cc, SparsedbleLU.h, base-aepbal.h, base-de.h, + base-lu.cc, base-lu.h, boolNDArray.cc, boolNDArray.h, + boolSparse.cc, boolSparse.h, bsxfun-defs.cc, chMatrix.cc, + chNDArray.cc, chNDArray.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, + dColVector.h, dDiagMatrix.cc, dDiagMatrix.h, dMatrix.cc, + dMatrix.h, dNDArray.cc, dNDArray.h, dSparse.cc, dSparse.h, + dbleAEPBAL.h, dbleCHOL.cc, dbleCHOL.h, dbleGEPBAL.cc, + dbleGEPBAL.h, dbleQR.cc, dbleQR.h, dbleSCHUR.h, dbleSVD.h, + dim-vector.cc, dim-vector.h, dir-ops.cc, eigs-base.cc, + f2c-main.c, fCColVector.cc, fCColVector.h, fCDiagMatrix.cc, + fCDiagMatrix.h, fCMatrix.cc, fCMatrix.h, fCNDArray.cc, + fCNDArray.h, fCRowVector.cc, fCRowVector.h, fCmplxAEPBAL.cc, + fCmplxAEPBAL.h, fCmplxCHOL.cc, fCmplxGEPBAL.cc, fCmplxGEPBAL.h, + fCmplxHESS.cc, fCmplxLU.h, fCmplxQR.cc, fCmplxQR.h, + fCmplxQRP.cc, fCmplxSCHUR.cc, fCmplxSVD.h, fColVector.h, + fDiagMatrix.cc, fDiagMatrix.h, fEIG.cc, fMatrix.cc, fMatrix.h, + fNDArray.cc, fNDArray.h, file-ops.cc, file-stat.cc, + floatAEPBAL.cc, floatAEPBAL.h, floatCHOL.cc, floatCHOL.h, + floatGEPBAL.cc, floatGEPBAL.h, floatLU.h, floatQR.cc, floatQR.h, + floatQRP.cc, floatSCHUR.h, floatSVD.h, idx-vector.cc, + idx-vector.h, intNDArray.cc, intNDArray.h, kpse.cc, + lo-array-gripes.cc, lo-array-gripes.h, lo-cieee.c, lo-ieee.h, + lo-mappers.cc, lo-mappers.h, lo-specfun.cc, mx-defs.h, + mx-inlines.cc, oct-binmap.h, oct-convn.cc, oct-env.cc, + oct-fftw.cc, oct-fftw.h, oct-glob.cc, oct-group.h, + oct-inttypes.cc, oct-inttypes.h, oct-locbuf.cc, oct-locbuf.h, + oct-md5.cc, oct-mem.h, oct-norm.cc, oct-norm.h, oct-rand.cc, + oct-rand.h, oct-rl-hist.c, oct-shlib.cc, oct-shlib.h, + oct-sort.cc, oct-sort.h, oct-spparms.cc, oct-spparms.h, + oct-syscalls.cc, oct-time.cc, randgamma.c, randmtzig.c, + randmtzig.h, randpoisson.c, regex-match.cc, regex-match.h, + sparse-base-chol.cc, sparse-base-chol.h, sparse-base-lu.cc, + sparse-base-lu.h, sparse-dmsolve.cc, sparse-sort.cc, + sparse-sort.h, sparse-util.h, tempname.c: + Strip trailing whitespace. + 2011-01-20 John W. Eaton * Array.h, Array.cc diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CmplxAEPBAL.cc --- a/liboctave/CmplxAEPBAL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CmplxAEPBAL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -39,7 +39,7 @@ const octave_idx_type&, octave_idx_type&, octave_idx_type&, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); - + F77_RET_T F77_FUNC (zgebak, ZGEBAK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, @@ -51,7 +51,7 @@ F77_CHAR_ARG_LEN_DECL); } -ComplexAEPBALANCE::ComplexAEPBALANCE (const ComplexMatrix& a, +ComplexAEPBALANCE::ComplexAEPBALANCE (const ComplexMatrix& a, bool noperm, bool noscal) : base_aepbal () { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CmplxAEPBAL.h --- a/liboctave/CmplxAEPBAL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CmplxAEPBAL.h Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ ComplexAEPBALANCE (const ComplexMatrix& a, bool noperm = false, bool noscal = false); - ComplexAEPBALANCE (const ComplexAEPBALANCE& a) + ComplexAEPBALANCE (const ComplexAEPBALANCE& a) : base_aepbal (a) { } ComplexMatrix balancing_matrix (void) const; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CmplxCHOL.cc --- a/liboctave/CmplxCHOL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CmplxCHOL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -113,7 +113,7 @@ // Calculate the norm of the matrix, for later use. double anorm = 0; - if (calc_cond) + if (calc_cond) anorm = xnorm (a, 1); F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, n, info @@ -122,7 +122,7 @@ xrcond = 0.0; if (info > 0) chol_mat.resize (info - 1, info - 1); - else if (calc_cond) + else if (calc_cond) { octave_idx_type zpocon_info = 0; @@ -135,7 +135,7 @@ n, anorm, xrcond, pz, prz, zpocon_info F77_CHAR_ARG_LEN (1))); - if (zpocon_info != 0) + if (zpocon_info != 0) info = -1; } @@ -187,7 +187,7 @@ void ComplexCHOL::set (const ComplexMatrix& R) { - if (R.is_square ()) + if (R.is_square ()) chol_mat = R; else (*current_liboctave_error_handler) ("CHOL requires square matrix"); @@ -241,7 +241,7 @@ octave_idx_type info = -1; octave_idx_type n = chol_mat.rows (); - + if (u.length () != n + 1) (*current_liboctave_error_handler) ("cholinsert: dimension mismatch"); else if (j < 0 || j > n) @@ -265,14 +265,14 @@ ComplexCHOL::delete_sym (octave_idx_type j) { octave_idx_type n = chol_mat.rows (); - + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("choldelete: index out of range"); else { OCTAVE_LOCAL_BUFFER (double, rw, n); - F77_XFCN (zchdex, ZCHDEX, (n, chol_mat.fortran_vec (), chol_mat.rows (), + F77_XFCN (zchdex, ZCHDEX, (n, chol_mat.fortran_vec (), chol_mat.rows (), j + 1, rw)); chol_mat.resize (n-1, n-1); @@ -283,8 +283,8 @@ ComplexCHOL::shift_sym (octave_idx_type i, octave_idx_type j) { octave_idx_type n = chol_mat.rows (); - - if (i < 0 || i > n-1 || j < 0 || j > n-1) + + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("cholshift: index out of range"); else { @@ -307,7 +307,7 @@ if (u.length () == n) { - init (chol_mat.hermitian () * chol_mat + init (chol_mat.hermitian () * chol_mat + ComplexMatrix (u) * ComplexMatrix (u).hermitian (), false); } else @@ -337,7 +337,7 @@ info = 2; else { - info = init (chol_mat.hermitian () * chol_mat + info = init (chol_mat.hermitian () * chol_mat - ComplexMatrix (u) * ComplexMatrix (u).hermitian (), false); if (info) info = 1; } @@ -356,7 +356,7 @@ octave_idx_type info = -1; octave_idx_type n = chol_mat.rows (); - + if (u.length () != n + 1) (*current_liboctave_error_handler) ("cholinsert: dimension mismatch"); else if (j < 0 || j > n) @@ -395,7 +395,7 @@ warn_qrupdate_once (); octave_idx_type n = chol_mat.rows (); - + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("choldelete: index out of range"); else @@ -413,8 +413,8 @@ warn_qrupdate_once (); octave_idx_type n = chol_mat.rows (); - - if (i < 0 || i > n-1 || j < 0 || j > n-1) + + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("cholshift: index out of range"); else { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CmplxGEPBAL.cc --- a/liboctave/CmplxGEPBAL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CmplxGEPBAL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -59,7 +59,7 @@ } octave_idx_type -ComplexGEPBALANCE::init (const ComplexMatrix& a, const ComplexMatrix& b, +ComplexGEPBALANCE::init (const ComplexMatrix& a, const ComplexMatrix& b, const std::string& balance_job) { octave_idx_type n = a.cols (); @@ -74,7 +74,7 @@ { gripe_nonconformant ("ComplexGEPBALANCE", n, n, b.rows(), b.cols()); return -1; - } + } octave_idx_type info; octave_idx_type ilo; @@ -115,7 +115,7 @@ n, p_balancing_mat, n, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - + // then right F77_XFCN (dggbak, DGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1), F77_CONST_CHAR_ARG2 ("R", 1), diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CmplxGEPBAL.h --- a/liboctave/CmplxGEPBAL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CmplxGEPBAL.h Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ const std::string& balance_job) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () { - init (a, b, balance_job); + init (a, b, balance_job); } ComplexGEPBALANCE (const ComplexGEPBALANCE& a) @@ -81,7 +81,7 @@ Matrix balancing_mat; Matrix balancing_mat2; - octave_idx_type init (const ComplexMatrix& a, const ComplexMatrix& b, + octave_idx_type init (const ComplexMatrix& a, const ComplexMatrix& b, const std::string& balance_job); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CmplxHESS.cc --- a/liboctave/CmplxHESS.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CmplxHESS.cc Thu Jan 20 17:24:59 2011 -0500 @@ -36,13 +36,13 @@ const octave_idx_type&, octave_idx_type&, octave_idx_type&, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); - + F77_RET_T F77_FUNC (zgehrd, ZGEHRD) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, Complex*, const octave_idx_type&, Complex*, Complex*, const octave_idx_type&, octave_idx_type&); - + F77_RET_T F77_FUNC (zunghr, ZUNGHR) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, Complex*, diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CmplxLU.h --- a/liboctave/CmplxLU.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CmplxLU.h Thu Jan 20 17:24:59 2011 -0500 @@ -41,7 +41,7 @@ ComplexLU (const ComplexLU& a) : base_lu (a) { } - ComplexLU (const ComplexMatrix& l, const ComplexMatrix& u, + ComplexLU (const ComplexMatrix& l, const ComplexMatrix& u, const PermMatrix& p) : base_lu (l, u, p) { } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CmplxQR.cc --- a/liboctave/CmplxQR.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CmplxQR.cc Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ F77_FUNC (zgeqrf, ZGEQRF) (const octave_idx_type&, const octave_idx_type&, Complex*, const octave_idx_type&, Complex*, Complex*, const octave_idx_type&, - octave_idx_type&); + octave_idx_type&); F77_RET_T F77_FUNC (zungqr, ZUNGQR) (const octave_idx_type&, const octave_idx_type&, @@ -75,13 +75,13 @@ double*); F77_RET_T - F77_FUNC (zqrinr, ZQRINR) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (zqrinr, ZQRINR) (const octave_idx_type&, const octave_idx_type&, Complex*, const octave_idx_type&, Complex*, const octave_idx_type&, const octave_idx_type&, const Complex*, double*); F77_RET_T - F77_FUNC (zqrder, ZQRDER) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (zqrder, ZQRDER) (const octave_idx_type&, const octave_idx_type&, Complex*, const octave_idx_type&, Complex*, const octave_idx_type&, const octave_idx_type&, Complex*, double*); @@ -132,7 +132,7 @@ form (n, afact, tau, qr_type); } -void ComplexQR::form (octave_idx_type n, ComplexMatrix& afact, +void ComplexQR::form (octave_idx_type n, ComplexMatrix& afact, Complex *tau, qr_type_t qr_type) { octave_idx_type m = afact.rows (), min_mn = std::min (m, n); @@ -252,7 +252,7 @@ if (u.length () != m) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > n) + else if (j < 0 || j > n) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -269,7 +269,7 @@ ComplexColumnVector utmp = u; OCTAVE_LOCAL_BUFFER (double, rw, k); F77_XFCN (zqrinc, ZQRINC, (m, n, k, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), j + 1, + r.fortran_vec (), r.rows (), j + 1, utmp.data (), rw)); } } @@ -312,9 +312,9 @@ { octave_idx_type ii = i; ComplexColumnVector utmp = u.column (jsi(i)); - F77_XFCN (zqrinc, ZQRINC, (m, n + ii, std::min (kmax, k + ii), + F77_XFCN (zqrinc, ZQRINC, (m, n + ii, std::min (kmax, k + ii), q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), js(ii) + 1, + r.fortran_vec (), r.rows (), js(ii) + 1, utmp.data (), rw)); } } @@ -327,7 +327,7 @@ octave_idx_type k = r.rows (); octave_idx_type n = r.columns (); - if (j < 0 || j > n-1) + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -371,7 +371,7 @@ for (volatile octave_idx_type i = 0; i < js.length (); i++) { octave_idx_type ii = i; - F77_XFCN (zqrdec, ZQRDEC, (m, n - ii, k == m ? k : k - ii, + F77_XFCN (zqrdec, ZQRDEC, (m, n - ii, k == m ? k : k - ii, q.fortran_vec (), q.rows (), r.fortran_vec (), r.rows (), js(ii) + 1, rw)); } @@ -397,7 +397,7 @@ if (! q.is_square () || u.length () != n) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > m) + else if (j < 0 || j > m) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -406,7 +406,7 @@ ComplexRowVector utmp = u; OCTAVE_LOCAL_BUFFER (double, rw, k); F77_XFCN (zqrinr, ZQRINR, (m, n, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), + r.fortran_vec (), r.rows (), j + 1, utmp.fortran_vec (), rw)); } @@ -420,7 +420,7 @@ if (! q.is_square ()) (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); - else if (j < 0 || j > m-1) + else if (j < 0 || j > m-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -442,13 +442,13 @@ octave_idx_type k = r.rows (); octave_idx_type n = r.columns (); - if (i < 0 || i > n-1 || j < 0 || j > n-1) + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrshift: index out of range"); else { OCTAVE_LOCAL_BUFFER (Complex, w, k); OCTAVE_LOCAL_BUFFER (double, rw, k); - F77_XFCN (zqrshc, ZQRSHC, (m, n, k, + F77_XFCN (zqrshc, ZQRSHC, (m, n, k, q.fortran_vec (), q.rows (), r.fortran_vec (), r.rows (), i + 1, j + 1, w, rw)); @@ -534,7 +534,7 @@ } static -ComplexMatrix shift_cols (const ComplexMatrix& a, +ComplexMatrix shift_cols (const ComplexMatrix& a, octave_idx_type i, octave_idx_type j) { octave_idx_type n = a.columns (); @@ -564,7 +564,7 @@ if (u.length () != m) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > n) + else if (j < 0 || j > n) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -610,7 +610,7 @@ octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); - if (j < 0 || j > n-1) + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -656,7 +656,7 @@ if (! q.is_square () || u.length () != n) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > m) + else if (j < 0 || j > m) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -674,7 +674,7 @@ if (! q.is_square ()) (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); - else if (j < 0 || j > m-1) + else if (j < 0 || j > m-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -690,7 +690,7 @@ octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); - if (i < 0 || i > n-1 || j < 0 || j > n-1) + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrshift: index out of range"); else { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CmplxQR.h --- a/liboctave/CmplxQR.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CmplxQR.h Thu Jan 20 17:24:59 2011 -0500 @@ -1,7 +1,7 @@ /* Copyright (C) 1994-2011 John W. Eaton -Copyright (C) 2008-2009 Jaroslav Hajek +Copyright (C) 2008-2009 Jaroslav Hajek This file is part of Octave. @@ -42,7 +42,7 @@ ComplexQR (const ComplexMatrix&, qr_type_t = qr_type_std); - ComplexQR (const ComplexMatrix& qx, const ComplexMatrix& rx) + ComplexQR (const ComplexMatrix& qx, const ComplexMatrix& rx) : base_qr (qx, rx) { } ComplexQR (const ComplexQR& a) : base_qr (a) { } @@ -69,7 +69,7 @@ protected: - void form (octave_idx_type n, ComplexMatrix& afact, + void form (octave_idx_type n, ComplexMatrix& afact, Complex *tau, qr_type_t qr_type); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CmplxSCHUR.cc --- a/liboctave/CmplxSCHUR.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CmplxSCHUR.cc Thu Jan 20 17:24:59 2011 -0500 @@ -64,7 +64,7 @@ } octave_idx_type -ComplexSCHUR::init (const ComplexMatrix& a, const std::string& ord, +ComplexSCHUR::init (const ComplexMatrix& a, const std::string& ord, bool calc_unitary) { octave_idx_type a_nr = a.rows (); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CmplxSVD.h --- a/liboctave/CmplxSVD.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CmplxSVD.h Thu Jan 20 17:24:59 2011 -0500 @@ -40,7 +40,7 @@ { } ComplexSVD (const ComplexMatrix& a, SVD::type svd_type = SVD::std, - SVD::driver svd_driver = SVD::GESVD) + SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () { init (a, svd_type, svd_driver); @@ -48,7 +48,7 @@ ComplexSVD (const ComplexMatrix& a, octave_idx_type& info, SVD::type svd_type = SVD::std, - SVD::driver svd_driver = SVD::GESVD) + SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () { info = init (a, svd_type, svd_driver); @@ -90,7 +90,7 @@ ComplexMatrix right_sm; octave_idx_type init (const ComplexMatrix& a, - SVD::type svd_type = SVD::std, + SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GESVD); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CollocWt.cc --- a/liboctave/CollocWt.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CollocWt.cc Thu Jan 20 17:24:59 2011 -0500 @@ -473,7 +473,7 @@ id = 2; for (octave_idx_type i = 0; i < nt; i++) { - dfopr (n, inc_left, inc_right, i, id, pdif1, pdif2, pdif3, pr, pvect); + dfopr (n, inc_left, inc_right, i, id, pdif1, pdif2, pdif3, pr, pvect); for (octave_idx_type j = 0; j < nt; j++) B(i,j) = vect(j); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/CollocWt.h --- a/liboctave/CollocWt.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/CollocWt.h Thu Jan 20 17:24:59 2011 -0500 @@ -54,7 +54,7 @@ CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il, octave_idx_type ir, - double ll, double rr) + double ll, double rr) : n (nc), inc_left (il), inc_right (ir), lb (ll), rb (rr), Alpha (a), Beta (b), r (), q (), A (), B (), initialized (false) { } @@ -62,7 +62,7 @@ : n (a.n), inc_left (a.inc_left), inc_right (a.inc_right), lb (a.lb), rb (a.rb), Alpha (a.Alpha), Beta (a.Beta), r (a.r), q (a.q), A (a.A), B (a.B), - initialized (a.initialized) { } + initialized (a.initialized) { } CollocWt& operator = (const CollocWt& a) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/DASPK.cc --- a/liboctave/DASPK.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/DASPK.cc Thu Jan 20 17:24:59 2011 -0500 @@ -213,7 +213,7 @@ integration_error = true; return retval; } - + info(4) = user_jac ? 1 : 0; DAEFunc::reset = false; @@ -579,7 +579,7 @@ Matrix DASPK::integrate (const ColumnVector& tout, Matrix& xdot_out, - const ColumnVector& tcrit) + const ColumnVector& tcrit) { Matrix retval; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/DASPK.h --- a/liboctave/DASPK.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/DASPK.h Thu Jan 20 17:24:59 2011 -0500 @@ -54,12 +54,12 @@ Matrix do_integrate (const ColumnVector& tout); - Matrix do_integrate (const ColumnVector& tout, const ColumnVector& tcrit); + Matrix do_integrate (const ColumnVector& tout, const ColumnVector& tcrit); Matrix integrate (const ColumnVector& tout, Matrix& xdot_out); Matrix integrate (const ColumnVector& tout, Matrix& xdot_out, - const ColumnVector& tcrit); + const ColumnVector& tcrit); std::string error_message (void) const; @@ -67,7 +67,7 @@ bool initialized; - octave_idx_type liw; + octave_idx_type liw; octave_idx_type lrw; Array info; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/DASRT.cc --- a/liboctave/DASRT.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/DASRT.cc Thu Jan 20 17:24:59 2011 -0500 @@ -58,7 +58,7 @@ octave_idx_type*, const double*, const double*, octave_idx_type&, double*, const octave_idx_type&, octave_idx_type*, - const octave_idx_type&, double*, + const octave_idx_type&, double*, octave_idx_type*, dasrt_jac_ptr, dasrt_constr_ptr, const octave_idx_type&, octave_idx_type*); @@ -130,7 +130,7 @@ static octave_idx_type ddasrt_g (const octave_idx_type& neq, const double& t, const double *state, - const octave_idx_type& ng, double *gout, double *, octave_idx_type *) + const octave_idx_type& ng, double *gout, double *, octave_idx_type *) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -444,7 +444,7 @@ } DASRT_result -DASRT::integrate (const ColumnVector& tout, const ColumnVector& tcrit) +DASRT::integrate (const ColumnVector& tout, const ColumnVector& tcrit) { DASRT_result retval; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/DASRT.h --- a/liboctave/DASRT.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/DASRT.h Thu Jan 20 17:24:59 2011 -0500 @@ -96,7 +96,7 @@ DASRT_result integrate (const ColumnVector& tout); DASRT_result integrate (const ColumnVector& tout, - const ColumnVector& tcrit); + const ColumnVector& tcrit); std::string error_message (void) const; @@ -104,7 +104,7 @@ bool initialized; - octave_idx_type liw; + octave_idx_type liw; octave_idx_type lrw; octave_idx_type ng; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/DASSL.cc --- a/liboctave/DASSL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/DASSL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -194,7 +194,7 @@ } info(4) = user_jac ? 1 : 0; - + DAEFunc::reset = false; // DASSL_options @@ -394,7 +394,7 @@ Matrix DASSL::integrate (const ColumnVector& tout, Matrix& xdot_out, - const ColumnVector& tcrit) + const ColumnVector& tcrit) { Matrix retval; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/DASSL.h --- a/liboctave/DASSL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/DASSL.h Thu Jan 20 17:24:59 2011 -0500 @@ -54,12 +54,12 @@ Matrix do_integrate (const ColumnVector& tout); - Matrix do_integrate (const ColumnVector& tout, const ColumnVector& tcrit); + Matrix do_integrate (const ColumnVector& tout, const ColumnVector& tcrit); Matrix integrate (const ColumnVector& tout, Matrix& xdot_out); Matrix integrate (const ColumnVector& tout, Matrix& xdot_out, - const ColumnVector& tcrit); + const ColumnVector& tcrit); std::string error_message (void) const; @@ -67,7 +67,7 @@ bool initialized; - octave_idx_type liw; + octave_idx_type liw; octave_idx_type lrw; Array info; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/DET.h --- a/liboctave/DET.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/DET.h Thu Jan 20 17:24:59 2011 -0500 @@ -35,14 +35,14 @@ base_det (T c = 1, int e = 0) : c2 (), e2 () - { - c2 = xlog2 (c, e2); - e2 += e; + { + c2 = xlog2 (c, e2); + e2 += e; } - base_det (T c, double e, double b) + base_det (T c, double e, double b) : c2 (), e2 () - { + { e *= xlog2 (b); e2 = e; c *= xexp2 (e - e2); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/DiagArray2.h --- a/liboctave/DiagArray2.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/DiagArray2.h Thu Jan 20 17:24:59 2011 -0500 @@ -45,25 +45,25 @@ using Array::element_type; - DiagArray2 (void) + DiagArray2 (void) : Array (), d1 (0), d2 (0) { } - DiagArray2 (octave_idx_type r, octave_idx_type c) + DiagArray2 (octave_idx_type r, octave_idx_type c) : Array (dim_vector (std::min (r, c), 1)), d1 (r), d2 (c) { } - DiagArray2 (octave_idx_type r, octave_idx_type c, const T& val) + DiagArray2 (octave_idx_type r, octave_idx_type c, const T& val) : Array (dim_vector (std::min (r, c), 1), val), d1 (r), d2 (c) { } - explicit DiagArray2 (const Array& a) + explicit DiagArray2 (const Array& a) : Array (a.as_column ()), d1 (a.numel ()), d2 (a.numel ()) { } DiagArray2 (const Array& a, octave_idx_type r, octave_idx_type c); - DiagArray2 (const DiagArray2& a) + DiagArray2 (const DiagArray2& a) : Array (a), d1 (a.d1), d2 (a.d2) { } template - DiagArray2 (const DiagArray2& a) + DiagArray2 (const DiagArray2& a) : Array (a.diag ()), d1 (a.dim1 ()), d2 (a.dim2 ()) { } ~DiagArray2 (void) { } @@ -100,7 +100,7 @@ Array diag (octave_idx_type k = 0) const; // Warning: the non-const two-index versions will silently ignore assignments - // to off-diagonal elements. + // to off-diagonal elements. T elem (octave_idx_type r, octave_idx_type c) const { @@ -116,7 +116,7 @@ T dgelem (octave_idx_type i) const { return Array::elem (i); } - T& dgelem (octave_idx_type i) + T& dgelem (octave_idx_type i) { return Array::elem (i); } T checkelem (octave_idx_type r, octave_idx_type c) const; @@ -143,7 +143,7 @@ T dgxelem (octave_idx_type i) const { return Array::xelem (i); } - void resize (octave_idx_type n, octave_idx_type m, + void resize (octave_idx_type n, octave_idx_type m, const T& rfv = Array::resize_fill_value ()); DiagArray2 transpose (void) const; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/EIG.cc --- a/liboctave/EIG.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/EIG.cc Thu Jan 20 17:24:59 2011 -0500 @@ -73,24 +73,24 @@ F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dpotrf, DPOTRF) (F77_CONST_CHAR_ARG_DECL, + F77_FUNC (dpotrf, DPOTRF) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (zpotrf, ZPOTRF) (F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, + F77_FUNC (zpotrf, ZPOTRF) (F77_CONST_CHAR_ARG_DECL, + const octave_idx_type&, Complex*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dggev, DGGEV) (F77_CONST_CHAR_ARG_DECL, + F77_FUNC (dggev, DGGEV) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, + const octave_idx_type&, double*, const octave_idx_type&, double*, const octave_idx_type&, double*, double*, double *, double*, @@ -112,9 +112,9 @@ F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (zggev, ZGGEV) (F77_CONST_CHAR_ARG_DECL, + F77_FUNC (zggev, ZGGEV) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, + const octave_idx_type&, Complex*, const octave_idx_type&, Complex*, const octave_idx_type&, Complex*, Complex*, Complex*, @@ -126,7 +126,7 @@ F77_RET_T F77_FUNC (zhegv, ZHEGV) (const octave_idx_type&, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, Complex*, const octave_idx_type&, Complex*, @@ -250,7 +250,7 @@ return info; } -octave_idx_type +octave_idx_type EIG::symmetric_init (const Matrix& a, bool calc_ev) { octave_idx_type n = a.rows (); @@ -492,7 +492,7 @@ double *tmp_data = tmp.fortran_vec (); F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 ("L", 1), - n, tmp_data, n, + n, tmp_data, n, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); @@ -527,7 +527,7 @@ F77_XFCN (dggev, DGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), - n, atmp_data, n, btmp_data, n, + n, atmp_data, n, btmp_data, n, par, pai, pbeta, dummy, idummy, pvr, n, &dummy_work, lwork, info @@ -542,7 +542,7 @@ F77_XFCN (dggev, DGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), - n, atmp_data, n, btmp_data, n, + n, atmp_data, n, btmp_data, n, par, pai, pbeta, dummy, idummy, pvr, n, pwork, lwork, info @@ -581,9 +581,9 @@ return -1; } - lambda.elem(j) = Complex (ar.elem(j) / beta.elem (j), + lambda.elem(j) = Complex (ar.elem(j) / beta.elem (j), ai.elem(j) / beta.elem (j)); - lambda.elem(j+1) = Complex (ar.elem(j+1) / beta.elem (j+1), + lambda.elem(j+1) = Complex (ar.elem(j+1) / beta.elem (j+1), ai.elem(j+1) / beta.elem (j+1)); for (octave_idx_type i = 0; i < nvr; i++) @@ -603,7 +603,7 @@ return info; } -octave_idx_type +octave_idx_type EIG::symmetric_init (const Matrix& a, const Matrix& b, bool calc_ev) { octave_idx_type n = a.rows (); @@ -637,8 +637,8 @@ F77_XFCN (dsygv, DSYGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), F77_CONST_CHAR_ARG2 ("U", 1), - n, atmp_data, n, - btmp_data, n, + n, atmp_data, n, + btmp_data, n, pwr, &dummy_work, lwork, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); @@ -651,8 +651,8 @@ F77_XFCN (dsygv, DSYGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), F77_CONST_CHAR_ARG2 ("U", 1), - n, atmp_data, n, - btmp_data, n, + n, atmp_data, n, + btmp_data, n, pwr, pwork, lwork, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); @@ -709,7 +709,7 @@ Complex*tmp_data = tmp.fortran_vec (); F77_XFCN (zpotrf, ZPOTRF, (F77_CONST_CHAR_ARG2 ("L", 1), - n, tmp_data, n, + n, tmp_data, n, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); @@ -745,7 +745,7 @@ F77_XFCN (zggev, ZGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), - n, atmp_data, n, btmp_data, n, + n, atmp_data, n, btmp_data, n, palpha, pbeta, dummy, idummy, pv, n, &dummy_work, lwork, prwork, info F77_CHAR_ARG_LEN (1) @@ -759,12 +759,12 @@ F77_XFCN (zggev, ZGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), - n, atmp_data, n, btmp_data, n, + n, atmp_data, n, btmp_data, n, palpha, pbeta, dummy, idummy, pv, n, pwork, lwork, prwork, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - + if (info < 0) { (*current_liboctave_error_handler) ("unrecoverable error in zggev"); @@ -828,7 +828,7 @@ F77_XFCN (zhegv, ZHEGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), F77_CONST_CHAR_ARG2 ("U", 1), - n, atmp_data, n, + n, atmp_data, n, btmp_data, n, pwr, &dummy_work, lwork, prwork, info @@ -843,8 +843,8 @@ F77_XFCN (zhegv, ZHEGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), F77_CONST_CHAR_ARG2 ("U", 1), - n, atmp_data, n, - btmp_data, n, + n, atmp_data, n, + btmp_data, n, pwr, pwork, lwork, prwork, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/LSODE.cc --- a/liboctave/LSODE.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/LSODE.cc Thu Jan 20 17:24:59 2011 -0500 @@ -62,7 +62,7 @@ static octave_idx_type lsode_f (const octave_idx_type& neq, const double& time, double *, - double *deriv, octave_idx_type& ierr) + double *deriv, octave_idx_type& ierr) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -171,7 +171,7 @@ { iwork(4) = maxord; iopt = 1; - } + } else { (*current_liboctave_error_handler) @@ -329,11 +329,11 @@ case 2: retval = "successful exit"; break; - + case 3: retval = "prior to continuation call with modified parameters"; break; - + case -1: retval = std::string ("excess work on this call (t = ") + t_curr + "; perhaps wrong integration method)"; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/MArray.cc --- a/liboctave/MArray.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/MArray.cc Thu Jan 20 17:24:59 2011 -0500 @@ -1,7 +1,7 @@ /* Copyright (C) 1993-2011 John W. Eaton -Copyright (C) 2009 VZLU Prague +Copyright (C) 2009 VZLU Prague This file is part of Octave. @@ -358,5 +358,5 @@ MArray operator - (const MArray& a) { - return do_mx_unary_op (a, mx_inline_uminus); + return do_mx_unary_op (a, mx_inline_uminus); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/MArray.h --- a/liboctave/MArray.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/MArray.h Thu Jan 20 17:24:59 2011 -0500 @@ -40,19 +40,19 @@ MArray : public Array { public: - + MArray (void) : Array () {} - + explicit MArray (octave_idx_type n) GCC_ATTR_DEPRECATED : Array (dim_vector (n, 1)) { } MArray (octave_idx_type n, const T& val) GCC_ATTR_DEPRECATED : Array (dim_vector (n, 1), val) { } - explicit MArray (const dim_vector& dv) + explicit MArray (const dim_vector& dv) : Array (dv) { } - - explicit MArray (const dim_vector& dv, const T& val) + + explicit MArray (const dim_vector& dv, const T& val) : Array (dv, val) { } MArray (const MArray& a) : Array (a) { } @@ -71,7 +71,7 @@ MArray reshape (const dim_vector& new_dims) const { return Array::reshape (new_dims); } - MArray permute (const Array& vec, + MArray permute (const Array& vec, bool inv = false) const { return Array::permute (vec, inv); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/MDiagArray2.cc --- a/liboctave/MDiagArray2.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/MDiagArray2.cc Thu Jan 20 17:24:59 2011 -0500 @@ -32,14 +32,14 @@ #include "MArray-defs.h" template -bool +bool MDiagArray2::is_multiple_of_identity (T val) const { bool retval = this->rows () == this->cols (); if (retval) { octave_idx_type len = this->length (), i = 0; - for (;i < len; i++) + for (;i < len; i++) if (DiagArray2::elem (i, i) != val) break; retval = i == len; } @@ -102,5 +102,5 @@ MDiagArray2 operator - (const MDiagArray2& a) { - return MDiagArray2 (do_mx_unary_op (a, mx_inline_uminus), a.d1, a.d2); + return MDiagArray2 (do_mx_unary_op (a, mx_inline_uminus), a.d1, a.d2); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/MDiagArray2.h --- a/liboctave/MDiagArray2.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/MDiagArray2.h Thu Jan 20 17:24:59 2011 -0500 @@ -41,7 +41,7 @@ MDiagArray2 : public DiagArray2 { public: - + MDiagArray2 (void) : DiagArray2 () { } MDiagArray2 (octave_idx_type r, octave_idx_type c) : DiagArray2 (r, c) { } @@ -57,7 +57,7 @@ explicit MDiagArray2 (const Array& a) : DiagArray2 (a) { } - MDiagArray2 (const Array& a, octave_idx_type r, octave_idx_type c) + MDiagArray2 (const Array& a, octave_idx_type r, octave_idx_type c) : DiagArray2 (a, r, c) { } ~MDiagArray2 (void) { } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/MSparse.cc --- a/liboctave/MSparse.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/MSparse.cc Thu Jan 20 17:24:59 2011 -0500 @@ -54,18 +54,18 @@ else { r = MSparse (a_nr, a_nc, (a.nnz () + b.nnz ())); - + octave_idx_type jx = 0; for (octave_idx_type i = 0 ; i < a_nc ; i++) { octave_idx_type ja = a.cidx(i); octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - + octave_idx_type jb = b.cidx(i); octave_idx_type jb_max = b.cidx(i+1); bool jb_lt_max = jb < jb_max; - + while (ja_lt_max || jb_lt_max ) { octave_quit (); @@ -103,7 +103,7 @@ } r.cidx(i+1) = jx; } - + a = r.maybe_compress (); } @@ -127,18 +127,18 @@ else { r = MSparse (a_nr, a_nc, (a.nnz () + b.nnz ())); - + octave_idx_type jx = 0; for (octave_idx_type i = 0 ; i < a_nc ; i++) { octave_idx_type ja = a.cidx(i); octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - + octave_idx_type jb = b.cidx(i); octave_idx_type jb_max = b.cidx(i+1); bool jb_lt_max = jb < jb_max; - + while (ja_lt_max || jb_lt_max ) { octave_quit (); @@ -176,7 +176,7 @@ } r.cidx(i+1) = jx; } - + a = r.maybe_compress (); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/MSparse.h --- a/liboctave/MSparse.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/MSparse.h Thu Jan 20 17:24:59 2011 -0500 @@ -46,7 +46,7 @@ MSparse (octave_idx_type n, octave_idx_type m) : Sparse (n, m) { } - MSparse (const dim_vector& dv, octave_idx_type nz = 0) : + MSparse (const dim_vector& dv, octave_idx_type nz = 0) : Sparse (dv, nz) { } MSparse (const MSparse& a) : Sparse (a) { } @@ -59,7 +59,7 @@ MSparse (const Sparse& a) : Sparse (a) { } MSparse (const Array& a, const idx_vector& r, const idx_vector& c, - octave_idx_type nr = -1, octave_idx_type nc = -1, + octave_idx_type nr = -1, octave_idx_type nc = -1, bool sum_terms = true, octave_idx_type nzm = -1) : Sparse (a, r, c, nr, nc, sum_terms, nzm) { } @@ -93,7 +93,7 @@ MSparse reshape (const dim_vector& new_dims) const { return Sparse::reshape (new_dims); } - + MSparse permute (const Array& vec, bool inv = false) const { return Sparse::permute (vec, inv); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/MatrixType.cc --- a/liboctave/MatrixType.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/MatrixType.cc Thu Jan 20 17:24:59 2011 -0500 @@ -39,16 +39,16 @@ // FIXME There is a large code duplication here MatrixType::MatrixType (void) - : typ (MatrixType::Unknown), + : typ (MatrixType::Unknown), sp_bandden (octave_sparse_params::get_bandden()), - bandden (0), upper_band (0), + bandden (0), upper_band (0), lower_band (0), dense (false), full (false), nperm (0), perm (0) { } MatrixType::MatrixType (const MatrixType &a) - : typ (a.typ), sp_bandden (a.sp_bandden), bandden (a.bandden), - upper_band (a.upper_band), lower_band (a.lower_band), + : typ (a.typ), sp_bandden (a.sp_bandden), bandden (a.bandden), + upper_band (a.upper_band), lower_band (a.lower_band), dense (a.dense), full (a.full), nperm (a.nperm), perm (0) -{ +{ if (nperm != 0) { perm = new octave_idx_type [nperm]; @@ -57,8 +57,8 @@ } } -template -MatrixType::matrix_type +template +MatrixType::matrix_type matrix_real_probe (const MArray& a) { MatrixType::matrix_type typ; @@ -66,7 +66,7 @@ octave_idx_type ncols = a.cols (); const T zero = 0; - + if (ncols == nrows) { bool upper = true; @@ -76,7 +76,7 @@ // do the checks for lower/upper/hermitian all in one pass. OCTAVE_LOCAL_BUFFER(T, diag, ncols); - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j < ncols && upper; j++) { T d = a.elem (j,j); @@ -86,7 +86,7 @@ diag[j] = d; } - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j < ncols && (upper || lower || hermitian); j++) { for (octave_idx_type i = 0; i < j; i++) @@ -94,7 +94,7 @@ double aij = a.elem (i,j), aji = a.elem (j,i); lower = lower && (aij == zero); upper = upper && (aji == zero); - hermitian = hermitian && (aij == aji + hermitian = hermitian && (aij == aji && aij*aij < diag[i]*diag[j]); } } @@ -105,7 +105,7 @@ typ = MatrixType::Lower; else if (hermitian) typ = MatrixType::Hermitian; - else + else typ = MatrixType::Full; } else @@ -114,8 +114,8 @@ return typ; } -template -MatrixType::matrix_type +template +MatrixType::matrix_type matrix_complex_probe (const MArray >& a) { MatrixType::matrix_type typ; @@ -134,7 +134,7 @@ // do the checks for lower/upper/hermitian all in one pass. OCTAVE_LOCAL_BUFFER(T, diag, ncols); - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j < ncols && upper; j++) { std::complex d = a.elem (j,j); @@ -144,7 +144,7 @@ diag[j] = d.real(); } - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j < ncols && (upper || lower || hermitian); j++) { for (octave_idx_type i = 0; i < j; i++) @@ -217,7 +217,7 @@ octave_idx_type nnz = a.nnz (); if (octave_sparse_params::get_key ("spumoni") != 0.) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Calculating Sparse Matrix Type"); sp_bandden = octave_sparse_params::get_bandden(); @@ -242,7 +242,7 @@ break; } } - + if (tmp_typ == MatrixType::Permuted_Diagonal) { std::vector found (nrows); @@ -251,10 +251,10 @@ found [j] = true; for (octave_idx_type j = i; j < nrows; j++) found [j] = false; - + for (octave_idx_type j = i; j < nm; j++) { - if ((a.cidx(j+1) > a.cidx(j) + 1) || + if ((a.cidx(j+1) > a.cidx(j) + 1) || ((a.cidx(j+1) == a.cidx(j) + 1) && found [a.ridx(j)])) { tmp_typ = MatrixType::Full; @@ -299,7 +299,7 @@ if (j - ru > upper_band) upper_band = j - ru; - + if (rl - j > lower_band) lower_band = rl - j; } @@ -320,13 +320,13 @@ else typ = MatrixType::Banded; - octave_idx_type nnz_in_band = + octave_idx_type nnz_in_band = (upper_band + lower_band + 1) * nrows - (1 + upper_band) * upper_band / 2 - (1 + lower_band) * lower_band / 2; if (nnz_in_band == nnz) dense = true; - else + else dense = false; } else if (upper_band == 0) @@ -359,7 +359,7 @@ for (octave_idx_type j = 0; j < ncols; j++) { - if ((a.cidx(j+1) - a.cidx(j)) > 0 && + if ((a.cidx(j+1) - a.cidx(j)) > 0 && (a.ridx(a.cidx(j+1)-1) == i)) { perm [i] = j; @@ -466,8 +466,8 @@ if (typ == MatrixType::Full && ncols != nrows) typ = MatrixType::Rectangular; - if (maybe_hermitian && (typ == MatrixType::Full || - typ == MatrixType::Tridiagonal || + if (maybe_hermitian && (typ == MatrixType::Full || + typ == MatrixType::Tridiagonal || typ == MatrixType::Banded)) { bool is_herm = true; @@ -498,7 +498,7 @@ { octave_idx_type k = a.ridx(i); is_herm = k == j; - if (is_herm) + if (is_herm) continue; double d = a.data(i); if (d*d < diag(j)*diag(k)) @@ -538,7 +538,7 @@ octave_idx_type nnz = a.nnz (); if (octave_sparse_params::get_key ("spumoni") != 0.) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Calculating Sparse Matrix Type"); sp_bandden = octave_sparse_params::get_bandden(); @@ -563,7 +563,7 @@ break; } } - + if (tmp_typ == MatrixType::Permuted_Diagonal) { std::vector found (nrows); @@ -572,10 +572,10 @@ found [j] = true; for (octave_idx_type j = i; j < nrows; j++) found [j] = false; - + for (octave_idx_type j = i; j < nm; j++) { - if ((a.cidx(j+1) > a.cidx(j) + 1) || + if ((a.cidx(j+1) > a.cidx(j) + 1) || ((a.cidx(j+1) == a.cidx(j) + 1) && found [a.ridx(j)])) { tmp_typ = MatrixType::Full; @@ -620,7 +620,7 @@ if (j - ru > upper_band) upper_band = j - ru; - + if (rl - j > lower_band) lower_band = rl - j; } @@ -641,13 +641,13 @@ else typ = MatrixType::Banded; - octave_idx_type nnz_in_band = + octave_idx_type nnz_in_band = (upper_band + lower_band + 1) * nrows - (1 + upper_band) * upper_band / 2 - (1 + lower_band) * lower_band / 2; if (nnz_in_band == nnz) dense = true; - else + else dense = false; } else if (upper_band == 0) @@ -680,7 +680,7 @@ for (octave_idx_type j = 0; j < ncols; j++) { - if ((a.cidx(j+1) - a.cidx(j)) > 0 && + if ((a.cidx(j+1) - a.cidx(j)) > 0 && (a.ridx(a.cidx(j+1)-1) == i)) { perm [i] = j; @@ -787,8 +787,8 @@ if (typ == MatrixType::Full && ncols != nrows) typ = MatrixType::Rectangular; - if (maybe_hermitian && (typ == MatrixType::Full || - typ == MatrixType::Tridiagonal || + if (maybe_hermitian && (typ == MatrixType::Full || + typ == MatrixType::Tridiagonal || typ == MatrixType::Banded)) { bool is_herm = true; @@ -818,7 +818,7 @@ { octave_idx_type k = a.ridx(i); is_herm = k == j; - if (is_herm) + if (is_herm) continue; Complex d = a.data(i); if (std::norm (d) < diag(j)*diag(k)) @@ -854,9 +854,9 @@ bandden (0), upper_band (0), lower_band (0), dense (false), full (_full), nperm (0), perm (0) { - if (t == MatrixType::Unknown || t == MatrixType::Full - || t == MatrixType::Diagonal || t == MatrixType::Permuted_Diagonal - || t == MatrixType::Upper || t == MatrixType::Lower + if (t == MatrixType::Unknown || t == MatrixType::Full + || t == MatrixType::Diagonal || t == MatrixType::Permuted_Diagonal + || t == MatrixType::Upper || t == MatrixType::Lower || t == MatrixType::Tridiagonal || t == MatrixType::Tridiagonal_Hermitian || t == MatrixType::Rectangular) typ = t; @@ -898,18 +898,18 @@ lower_band = kl; } else - (*current_liboctave_warning_handler) ("Invalid sparse matrix type"); + (*current_liboctave_warning_handler) ("Invalid sparse matrix type"); } -MatrixType::~MatrixType (void) -{ +MatrixType::~MatrixType (void) +{ if (nperm != 0) { - delete [] perm; + delete [] perm; } } -MatrixType& +MatrixType& MatrixType::operator = (const MatrixType& a) { if (this != &a) @@ -942,15 +942,15 @@ { if (!quiet && octave_sparse_params::get_key ("spumoni") != 0.) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Using Cached Matrix Type"); - + return typ; } - if (typ != MatrixType::Unknown && + if (typ != MatrixType::Unknown && octave_sparse_params::get_key ("spumoni") != 0.) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Invalidating Matrix Type"); typ = MatrixType::Unknown; @@ -965,9 +965,9 @@ sp_bandden == octave_sparse_params::get_bandden())) { if (octave_sparse_params::get_key ("spumoni") != 0.) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Using Cached Matrix Type"); - + return typ; } @@ -994,13 +994,13 @@ int MatrixType::type (const SparseComplexMatrix &a) { - if (typ != MatrixType::Unknown && (full || + if (typ != MatrixType::Unknown && (full || sp_bandden == octave_sparse_params::get_bandden())) { if (octave_sparse_params::get_key ("spumoni") != 0.) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Using Cached Matrix Type"); - + return typ; } @@ -1030,9 +1030,9 @@ if (typ != MatrixType::Unknown) { if (octave_sparse_params::get_key ("spumoni") != 0.) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Using Cached Matrix Type"); - + return typ; } @@ -1057,15 +1057,15 @@ if (typ != MatrixType::Unknown) { if (octave_sparse_params::get_key ("spumoni") != 0.) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Using Cached Matrix Type"); - + return typ; } MatrixType tmp_typ (a); typ = tmp_typ.typ; - full = tmp_typ.full; + full = tmp_typ.full; nperm = tmp_typ.nperm; if (nperm != 0) @@ -1084,9 +1084,9 @@ if (typ != MatrixType::Unknown) { if (octave_sparse_params::get_key ("spumoni") != 0.) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Using Cached Matrix Type"); - + return typ; } @@ -1111,15 +1111,15 @@ if (typ != MatrixType::Unknown) { if (octave_sparse_params::get_key ("spumoni") != 0.) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Using Cached Matrix Type"); - + return typ; } MatrixType tmp_typ (a); typ = tmp_typ.typ; - full = tmp_typ.full; + full = tmp_typ.full; nperm = tmp_typ.nperm; if (nperm != 0) @@ -1138,48 +1138,48 @@ if (octave_sparse_params::get_key ("spumoni") != 0.) { if (typ == MatrixType::Unknown) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Unknown Matrix Type"); else if (typ == MatrixType::Diagonal) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Diagonal Sparse Matrix"); else if (typ == MatrixType::Permuted_Diagonal) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Permuted Diagonal Sparse Matrix"); else if (typ == MatrixType::Upper) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Upper Triangular Matrix"); else if (typ == MatrixType::Lower) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Lower Triangular Matrix"); else if (typ == MatrixType::Permuted_Upper) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Permuted Upper Triangular Matrix"); else if (typ == MatrixType::Permuted_Lower) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Permuted Lower Triangular Matrix"); else if (typ == MatrixType::Banded) - (*current_liboctave_warning_handler) - ("Banded Sparse Matrix %d-1-%d (Density %f)", lower_band, + (*current_liboctave_warning_handler) + ("Banded Sparse Matrix %d-1-%d (Density %f)", lower_band, upper_band, bandden); else if (typ == MatrixType::Banded_Hermitian) - (*current_liboctave_warning_handler) - ("Banded Hermitian/Symmetric Sparse Matrix %d-1-%d (Density %f)", + (*current_liboctave_warning_handler) + ("Banded Hermitian/Symmetric Sparse Matrix %d-1-%d (Density %f)", lower_band, upper_band, bandden); else if (typ == MatrixType::Hermitian) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Hermitian/Symmetric Matrix"); else if (typ == MatrixType::Tridiagonal) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Tridiagonal Sparse Matrix"); else if (typ == MatrixType::Tridiagonal_Hermitian) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Hermitian/Symmetric Tridiagonal Sparse Matrix"); else if (typ == MatrixType::Rectangular) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Rectangular/Singular Matrix"); else if (typ == MatrixType::Full) - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("Full Matrix"); } } @@ -1187,30 +1187,30 @@ void MatrixType::mark_as_symmetric (void) { - if (typ == MatrixType::Tridiagonal || + if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) typ = MatrixType::Tridiagonal_Hermitian; else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) typ = MatrixType::Banded_Hermitian; - else if (typ == MatrixType::Full || typ == MatrixType::Hermitian || + else if (typ == MatrixType::Full || typ == MatrixType::Hermitian || typ == MatrixType::Unknown) typ = MatrixType::Hermitian; else - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("Can not mark current matrix type as symmetric"); } void MatrixType::mark_as_unsymmetric (void) { - if (typ == MatrixType::Tridiagonal || + if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) typ = MatrixType::Tridiagonal; else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) typ = MatrixType::Banded; - else if (typ == MatrixType::Full || typ == MatrixType::Hermitian || + else if (typ == MatrixType::Full || typ == MatrixType::Hermitian || typ == MatrixType::Unknown) typ = MatrixType::Full; } @@ -1230,7 +1230,7 @@ else if (typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) typ = MatrixType::Permuted_Lower; else - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("Can not mark current matrix type as symmetric"); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/MatrixType.h --- a/liboctave/MatrixType.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/MatrixType.h Thu Jan 20 17:24:59 2011 -0500 @@ -74,7 +74,7 @@ MatrixType (const matrix_type t, const octave_idx_type np, const octave_idx_type *p, bool _full = false); - MatrixType (const matrix_type t, const octave_idx_type ku, + MatrixType (const matrix_type t, const octave_idx_type ku, const octave_idx_type kl, bool _full = false); ~MatrixType (void); @@ -103,21 +103,21 @@ bool is_dense (void) const { return dense; } - bool is_diagonal (void) const + bool is_diagonal (void) const { return (typ == Diagonal || typ == Permuted_Diagonal); } - - bool is_upper_triangular (void) const + + bool is_upper_triangular (void) const { return (typ == Upper || typ == Permuted_Upper); } - bool is_lower_triangular (void) const + bool is_lower_triangular (void) const { return (typ == Lower || typ == Permuted_Lower); } bool is_banded (void) { return (typ == Banded || typ == Banded_Hermitian); } - + bool is_tridiagonal (void) const { return (typ == Tridiagonal || typ == Tridiagonal_Hermitian); } - + bool is_hermitian (void) const { return (typ == Banded_Hermitian || typ == Tridiagonal_Hermitian || typ == Hermitian); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/ODESFunc.h --- a/liboctave/ODESFunc.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/ODESFunc.h Thu Jan 20 17:24:59 2011 -0500 @@ -37,7 +37,7 @@ }; typedef ColumnVector (*ODES_fsub) (const ColumnVector& x, double, - const ColumnVector& theta); + const ColumnVector& theta); typedef ColumnVector (*ODES_bsub) (const ColumnVector& x, double, const ColumnVector& theta, int column); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/PermMatrix.cc --- a/liboctave/PermMatrix.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/PermMatrix.cc Thu Jan 20 17:24:59 2011 -0500 @@ -69,7 +69,7 @@ for (octave_idx_type i = 0; i < n; i++) xelem (i) = i; } -octave_idx_type +octave_idx_type PermMatrix::checkelem (octave_idx_type i, octave_idx_type j) const { octave_idx_type len = Array::length (); @@ -83,7 +83,7 @@ } -PermMatrix +PermMatrix PermMatrix::transpose (void) const { PermMatrix retval (*this); @@ -91,13 +91,13 @@ return retval; } -PermMatrix +PermMatrix PermMatrix::inverse (void) const { return transpose (); } -octave_idx_type +octave_idx_type PermMatrix::determinant (void) const { // Determine the sign of a permutation in linear time. @@ -127,11 +127,11 @@ neg = ! neg; } } - + return neg ? -1 : 1; } -PermMatrix +PermMatrix PermMatrix::power (octave_idx_type m) const { octave_idx_type n = rows (); @@ -188,7 +188,7 @@ return PermMatrix (p, false, false); } -PermMatrix +PermMatrix operator *(const PermMatrix& a, const PermMatrix& b) { const Array ia = a.pvec (), ib = b.pvec (); @@ -198,8 +198,8 @@ gripe_nonconformant ("operator *", n, n, b.rows (), b.rows ()); else if (a._colp == b._colp) { - r = PermMatrix ((a._colp - ? ia.index (idx_vector (ib)) + r = PermMatrix ((a._colp + ? ia.index (idx_vector (ib)) : ib.index (idx_vector (ia))), a._colp, false); } else diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/PermMatrix.h --- a/liboctave/PermMatrix.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/PermMatrix.h Thu Jan 20 17:24:59 2011 -0500 @@ -38,32 +38,32 @@ PermMatrix (octave_idx_type n); - PermMatrix (const Array& p, bool colp = false, + PermMatrix (const Array& p, bool colp = false, bool check = true); PermMatrix (const PermMatrix& m) : Array (m), _colp(m._colp) { } - - PermMatrix (const idx_vector& idx, bool colp = false, octave_idx_type n = 0); + + PermMatrix (const idx_vector& idx, bool colp = false, octave_idx_type n = 0); - octave_idx_type dim1 (void) const + octave_idx_type dim1 (void) const { return Array::length (); } - octave_idx_type dim2 (void) const + octave_idx_type dim2 (void) const { return Array::length (); } octave_idx_type rows (void) const { return dim1 (); } octave_idx_type cols (void) const { return dim2 (); } octave_idx_type columns (void) const { return dim2 (); } - octave_idx_type perm_length (void) const + octave_idx_type perm_length (void) const { return Array::length (); } // FIXME: a dangerous ambiguity? - octave_idx_type length (void) const + octave_idx_type length (void) const { return perm_length (); } octave_idx_type nelem (void) const { return dim1 () * dim2 (); } octave_idx_type numel (void) const { return nelem (); } - size_t byte_size (void) const + size_t byte_size (void) const { return Array::byte_size (); } dim_vector dims (void) const { return dim_vector (dim1 (), dim2 ()); } @@ -71,15 +71,15 @@ Array pvec (void) const { return *this; } - octave_idx_type + octave_idx_type elem (octave_idx_type i, octave_idx_type j) const { - return (_colp + return (_colp ? ((Array::elem (j) == i) ? 1 : 0) : ((Array::elem (i) == j) ? 1 : 0)); } - octave_idx_type + octave_idx_type checkelem (octave_idx_type i, octave_idx_type j) const; octave_idx_type @@ -91,7 +91,7 @@ return elem (i, j); #endif } - + // These are, in fact, super-fast. PermMatrix transpose (void) const; PermMatrix inverse (void) const; @@ -107,13 +107,13 @@ friend OCTAVE_API PermMatrix operator *(const PermMatrix& a, const PermMatrix& b); - const octave_idx_type *data (void) const + const octave_idx_type *data (void) const { return Array::data (); } - const octave_idx_type *fortran_vec (void) const + const octave_idx_type *fortran_vec (void) const { return Array::fortran_vec (); } - octave_idx_type *fortran_vec (void) + octave_idx_type *fortran_vec (void) { return Array::fortran_vec (); } void print_info (std::ostream& os, const std::string& prefix) const @@ -126,7 +126,7 @@ }; // Multiplying permutations together. -PermMatrix +PermMatrix OCTAVE_API operator *(const PermMatrix& a, const PermMatrix& b); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Quad.cc --- a/liboctave/Quad.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Quad.cc Thu Jan 20 17:24:59 2011 -0500 @@ -41,7 +41,7 @@ typedef octave_idx_type (*quad_fcn_ptr) (double*, int&, double*); typedef octave_idx_type (*quad_float_fcn_ptr) (float*, int&, float*); - + extern "C" { F77_RET_T @@ -58,7 +58,7 @@ const double&, double&, double&, octave_idx_type&, octave_idx_type&, const octave_idx_type&, const octave_idx_type&, - octave_idx_type&, octave_idx_type*, double*); + octave_idx_type&, octave_idx_type*, double*); F77_RET_T F77_FUNC (qagp, QAGP) (quad_float_fcn_ptr, const float&, const float&, @@ -74,7 +74,7 @@ const float&, float&, float&, octave_idx_type&, octave_idx_type&, const octave_idx_type&, const octave_idx_type&, octave_idx_type&, - octave_idx_type*, float*); + octave_idx_type*, float*); } static octave_idx_type diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Range.cc --- a/liboctave/Range.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Range.cc Thu Jan 20 17:24:59 2011 -0500 @@ -37,7 +37,7 @@ #include "Array-util.h" Range::Range (double b, double i, octave_idx_type n) - : rng_base (b), rng_limit (b + n * i), rng_inc (i), + : rng_base (b), rng_limit (b + n * i), rng_inc (i), rng_nelem (n), cache () { if (! xfinite (b) || ! xfinite (i)) @@ -93,13 +93,13 @@ struct _rangeidx_helper { double *array, base, inc; - _rangeidx_helper (double *a, double b, double i) + _rangeidx_helper (double *a, double b, double i) : array (a), base (b), inc (i) { } void operator () (octave_idx_type i) { *array++ = base + i * inc; } }; -Array +Array Range::index (const idx_vector& i) const { Array retval; @@ -235,7 +235,7 @@ } -Matrix +Matrix Range::diag (octave_idx_type k) const { return matrix_value ().diag (k); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Sparse.cc --- a/liboctave/Sparse.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Sparse.cc Thu Jan 20 17:24:59 2011 -0500 @@ -64,7 +64,7 @@ else if (r[i] > _r) break; - // Ok, If we've gotten here, we're in trouble.. Have to create a + // Ok, If we've gotten here, we're in trouble.. Have to create a // new element in the sparse array. This' gonna be slow!!! if (c[ncols] == nzmx) { @@ -85,7 +85,7 @@ for (octave_idx_type j = _c + 1; j < ncols + 1; j++) c[j] = c[j] + 1; - + d[i] = 0.; r[i] = _r; @@ -174,7 +174,7 @@ template Sparse::Sparse (octave_idx_type nr, octave_idx_type nc, T val) : rep (0), dimensions (dim_vector (nr, nc)) -{ +{ if (val != T ()) { rep = new typename Sparse::SparseRep (nr, nc, nr*nc); @@ -187,7 +187,7 @@ { xdata (ii) = val; xridx (ii++) = i; - } + } xcidx (j+1) = ii; } } @@ -202,7 +202,7 @@ template Sparse::Sparse (const dim_vector& dv) : rep (0), dimensions (dv) -{ +{ if (dv.length() != 2) (*current_liboctave_error_handler) ("Sparse::Sparse (const dim_vector&): dimension mismatch"); @@ -242,7 +242,7 @@ { octave_idx_type tmp = i * old_nr + a.ridx(j); octave_idx_type ii = tmp % new_nr; - octave_idx_type jj = (tmp - ii) / new_nr; + octave_idx_type jj = (tmp - ii) / new_nr; for (octave_idx_type k = kk; k < jj; k++) xcidx(k+1) = j; kk = jj; @@ -255,7 +255,7 @@ } template -Sparse::Sparse (const Array& a, const idx_vector& r, +Sparse::Sparse (const Array& a, const idx_vector& r, const idx_vector& c, octave_idx_type nr, octave_idx_type nc, bool sum_terms, octave_idx_type nzm) @@ -290,7 +290,7 @@ if ((rl != 1 && rl != n) || (cl != 1 && cl != n)) (*current_liboctave_error_handler) ("sparse: dimension mismatch"); - + if (rl <= 1 && cl <= 1) { if (n == 1 && a(0) != T ()) @@ -456,7 +456,7 @@ // Sparse column vector. Sort row indices. Array rsi; idx_vector rs = r.sorted (rsi); - + octave_quit (); const octave_idx_type *rd = rs.raw (), *rdi = rsi.data (); @@ -739,7 +739,7 @@ buf << ", " << ra_idx(i); buf << "): range error"; - + std::string buf_str = buf.str (); (*current_liboctave_error_handler) (buf_str.c_str ()); @@ -809,7 +809,7 @@ { octave_idx_type tmp = i * old_nr + ridx(j); octave_idx_type ii = tmp % new_nr; - octave_idx_type jj = (tmp - ii) / new_nr; + octave_idx_type jj = (tmp - ii) / new_nr; for (octave_idx_type k = kk; k < jj; k++) retval.xcidx(k+1) = j; kk = jj; @@ -1313,7 +1313,7 @@ { for (octave_idx_type j = cidx(i); j < cidx(i+1); j++) { - retval.xdata(j) = data(j); + retval.xdata(j) = data(j); retval.xridx(j) = ridx(j) + i * nr; } } @@ -1339,8 +1339,8 @@ { // You have to be pretty sick to get to this bit of code, // since you have a scalar stored as a sparse matrix, and - // then want to make a dense matrix with sparse - // representation. Ok, we'll do it, but you deserve what + // then want to make a dense matrix with sparse + // representation. Ok, we'll do it, but you deserve what // you get!! retval = Sparse (idx_dims(0), idx_dims(1), nz ? data(0) : T ()); } @@ -1391,7 +1391,7 @@ // If indexing a sparse column vector by a vector, the result is a // sparse column vector, otherwise it inherits the shape of index. // Vector transpose is cheap, so do it right here. - const Array idxa = (idx_dims(0) == 1 + const Array idxa = (idx_dims(0) == 1 ? idx.as_array ().transpose () : idx.as_array ()); @@ -1420,7 +1420,7 @@ } retval.change_capacity (retval.xcidx(new_nc)); - + // Copy data and set row indices. octave_idx_type k = 0; for (octave_idx_type j = 0; j < new_nc; j++) @@ -1458,14 +1458,14 @@ } else { - (*current_liboctave_warning_with_id_handler) + (*current_liboctave_warning_with_id_handler) ("Octave:fortran-indexing", "single index used for sparse matrix"); if (nr != 0 && idx.is_scalar ()) retval = Sparse (1, 1, elem (idx(0) % nr, idx(0) / nr)); else { - // Indexing a non-vector sparse matrix by linear indexing. + // Indexing a non-vector sparse matrix by linear indexing. // I suppose this is rare (and it may easily overflow), so let's take the easy way, // and reshape first to column vector, which is already handled above. retval = index (idx_vector::colon).index (idx); @@ -1717,7 +1717,7 @@ return; octave_idx_type nx = idx.extent (n); - // Try to resize first if necessary. + // Try to resize first if necessary. if (nx != n) { resize1 (nx); @@ -1754,7 +1754,7 @@ std::copy_backward (data () + ui, data () + nz, data () + nz + rnz); std::copy_backward (ridx () + ui, ridx () + nz, ridx () + nz + rnz); } - + // Copy data and adjust indices from rhs. copy_or_memcpy (rnz, rhs.data (), data () + li); mx_inline_add (rnz, ridx () + li, rhs.ridx (), lb); @@ -1864,7 +1864,7 @@ return; octave_idx_type nrx = idx_i.extent (nr), ncx = idx_j.extent (nc); - // Try to resize first if necessary. + // Try to resize first if necessary. if (nrx != nr || ncx != nc) { resize (nrx, ncx); @@ -1944,7 +1944,7 @@ const Sparse tmp = *this; *this = Sparse (nr, nc); OCTAVE_LOCAL_BUFFER_INIT (octave_idx_type, jsav, nc, -1); - + // Assemble column lengths. for (octave_idx_type i = 0; i < nc; i++) xcidx(i+1) = tmp.cidx(i+1) - tmp.cidx(i); @@ -1997,7 +1997,7 @@ } else { - // FIXME: optimize more special cases? + // FIXME: optimize more special cases? // In general this requires unpacking the columns, which is slow, // especially for many small columns. OTOH, transpose is an // efficient O(nr+nc+nnz) operation. @@ -2027,19 +2027,19 @@ gripe_assignment_dimension_mismatch (); } -// Can't use versions of these in Array.cc due to duplication of the +// Can't use versions of these in Array.cc due to duplication of the // instantiations for Array, etc template -bool -sparse_ascending_compare (typename ref_param::type a, +bool +sparse_ascending_compare (typename ref_param::type a, typename ref_param::type b) { return (a < b); } template -bool -sparse_descending_compare (typename ref_param::type a, +bool +sparse_descending_compare (typename ref_param::type a, typename ref_param::type b) { return (a > b); @@ -2066,7 +2066,7 @@ octave_sort lsort; - if (mode == ASCENDING) + if (mode == ASCENDING) lsort.set_compare (sparse_ascending_compare); else if (mode == DESCENDING) lsort.set_compare (sparse_descending_compare); @@ -2083,7 +2083,7 @@ lsort.sort (v, ns); octave_idx_type i; - if (mode == ASCENDING) + if (mode == ASCENDING) { for (i = 0; i < ns; i++) if (sparse_ascending_compare (static_cast (0), v [i])) @@ -2098,7 +2098,7 @@ for (octave_idx_type k = 0; k < i; k++) mridx [k] = k; for (octave_idx_type k = i; k < ns; k++) - mridx [k] = k - ns + nr; + mridx [k] = k - ns + nr; v += ns; mridx += ns; @@ -2112,7 +2112,7 @@ template Sparse -Sparse::sort (Array &sidx, octave_idx_type dim, +Sparse::sort (Array &sidx, octave_idx_type dim, sortmode mode) const { Sparse m = *this; @@ -2135,7 +2135,7 @@ octave_sort indexed_sort; - if (mode == ASCENDING) + if (mode == ASCENDING) indexed_sort.set_compare (sparse_ascending_compare); else if (mode == DESCENDING) indexed_sort.set_compare (sparse_descending_compare); @@ -2167,7 +2167,7 @@ indexed_sort.sort (v, vi, ns); octave_idx_type i; - if (mode == ASCENDING) + if (mode == ASCENDING) { for (i = 0; i < ns; i++) if (sparse_ascending_compare (static_cast (0), v[i])) @@ -2199,7 +2199,7 @@ for (octave_idx_type k = i; k < ns; k++) { sidx (k - ns + nr + offset) = vi [k]; - mridx [k] = k - ns + nr; + mridx [k] = k - ns + nr; } v += ns; @@ -2257,7 +2257,7 @@ if (elem (i, i) != 0.) nel++; } - + d = Sparse (ndiag, 1, nel); d.xcidx (0) = 0; d.xcidx (1) = nel; @@ -2301,25 +2301,25 @@ } } else - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("diag: requested diagonal out of range"); } else if (nnr != 0 && nnc != 0) { octave_idx_type roff = 0; octave_idx_type coff = 0; - if (k > 0) + if (k > 0) { roff = 0; coff = k; - } - else if (k < 0) + } + else if (k < 0) { roff = -k; coff = 0; } - if (nnr == 1) + if (nnr == 1) { octave_idx_type n = nnc + std::abs (k); octave_idx_type nz = nnz (); @@ -2344,8 +2344,8 @@ for (octave_idx_type i = nnc + coff + 1; i < n + 1; i++) d.xcidx (i) = nz; } - } - else + } + else { octave_idx_type n = nnr + std::abs (k); octave_idx_type nz = nnz (); @@ -2418,7 +2418,7 @@ ("cat: invalid dimension for sparse concatenation"); Sparse retval (dv, total_nz); - + if (retval.is_empty ()) return retval; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/Sparse.h --- a/liboctave/Sparse.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/Sparse.h Thu Jan 20 17:24:59 2011 -0500 @@ -75,28 +75,28 @@ SparseRep (octave_idx_type n) : d (0), r (0), c (new octave_idx_type [n+1]), nzmx (0), nrows (n), ncols (n), count (1) - { + { for (octave_idx_type i = 0; i < n + 1; i++) c[i] = 0; } - SparseRep (octave_idx_type nr, octave_idx_type nc) : d (0), r (0), c (new octave_idx_type [nc+1]), nzmx (0), + SparseRep (octave_idx_type nr, octave_idx_type nc) : d (0), r (0), c (new octave_idx_type [nc+1]), nzmx (0), nrows (nr), ncols (nc), count (1) - { + { for (octave_idx_type i = 0; i < nc + 1; i++) c[i] = 0; } - SparseRep (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz) : d (new T [nz]), - r (new octave_idx_type [nz]), c (new octave_idx_type [nc+1]), nzmx (nz), nrows (nr), + SparseRep (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz) : d (new T [nz]), + r (new octave_idx_type [nz]), c (new octave_idx_type [nc+1]), nzmx (nz), nrows (nr), ncols (nc), count (1) - { + { for (octave_idx_type i = 0; i < nc + 1; i++) c[i] = 0; } SparseRep (const SparseRep& a) - : d (new T [a.nzmx]), r (new octave_idx_type [a.nzmx]), c (new octave_idx_type [a.ncols + 1]), + : d (new T [a.nzmx]), r (new octave_idx_type [a.nzmx]), c (new octave_idx_type [a.ncols + 1]), nzmx (a.nzmx), nrows (a.nrows), ncols (a.ncols), count (1) { octave_idx_type nz = a.nnz (); @@ -104,7 +104,7 @@ copy_or_memcpy (nz, a.r, r); copy_or_memcpy (ncols + 1, a.c, c); } - + ~SparseRep (void) { delete [] d; delete [] r; delete [] c; } octave_idx_type length (void) const { return nzmx; } @@ -178,11 +178,11 @@ : rep (nil_rep ()), dimensions (dim_vector(0,0)) { } explicit Sparse (octave_idx_type n) - : rep (new typename Sparse::SparseRep (n)), + : rep (new typename Sparse::SparseRep (n)), dimensions (dim_vector (n, n)) { } explicit Sparse (octave_idx_type nr, octave_idx_type nc) - : rep (new typename Sparse::SparseRep (nr, nc)), + : rep (new typename Sparse::SparseRep (nr, nc)), dimensions (dim_vector (nr, nc)) { } explicit Sparse (octave_idx_type nr, octave_idx_type nc, T val); @@ -196,11 +196,11 @@ dimensions (dim_vector (nr, nc)) { } // Type conversion case. Preserves capacity (). - template + template Sparse (const Sparse& a) : rep (new typename Sparse::SparseRep (a.rep->nrows, a.rep->ncols, a.rep->nzmx)), - dimensions (a.dimensions) - { + dimensions (a.dimensions) + { octave_idx_type nz = a.nnz (); std::copy (a.rep->d, a.rep->d + nz, rep->d); copy_or_memcpy (nz, a.rep->r, rep->r); @@ -240,9 +240,9 @@ // Querying the number of elements (incl. zeros) may overflow the index type, // so don't do it unless you really need it. - octave_idx_type numel (void) const - { - return dimensions.safe_numel (); + octave_idx_type numel (void) const + { + return dimensions.safe_numel (); } octave_idx_type nelem (void) const { return capacity (); } @@ -264,16 +264,16 @@ return ret; } - size_t byte_size (void) const - { + size_t byte_size (void) const + { return (static_cast(cols () + 1) * sizeof (octave_idx_type) - + static_cast (capacity ()) * (sizeof (T) + sizeof (octave_idx_type))); + + static_cast (capacity ()) * (sizeof (T) + sizeof (octave_idx_type))); } dim_vector dims (void) const { return dimensions; } Sparse squeeze (void) const { return *this; } - + octave_idx_type compute_index (const Array& ra_idx) const; T range_error (const char *fcn, octave_idx_type n) const; @@ -287,18 +287,18 @@ // No checking, even for multiple references, ever. - T& xelem (octave_idx_type n) - { - octave_idx_type i = n % rows (), j = n / rows(); - return xelem (i, j); + T& xelem (octave_idx_type n) + { + 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(); - return xelem (i, j); + T xelem (octave_idx_type n) const + { + octave_idx_type i = n % rows (), j = n / rows(); + return xelem (i, j); } - + T& xelem (octave_idx_type i, octave_idx_type j) { return rep->elem (i, j); } T xelem (octave_idx_type i, octave_idx_type j) const { return rep->celem (i, j); } @@ -350,10 +350,10 @@ return xelem (n); } - T& elem (octave_idx_type i, octave_idx_type j) - { + T& elem (octave_idx_type i, octave_idx_type j) + { make_unique (); - return xelem (i, j); + return xelem (i, j); } T& elem (const Array& ra_idx) @@ -412,13 +412,13 @@ T operator () (const Array& ra_idx) const { return elem (ra_idx); } #endif - Sparse maybe_compress (bool remove_zeros = false) - { + Sparse maybe_compress (bool remove_zeros = false) + { if (remove_zeros) make_unique (); // Needs to unshare because elements are removed. - rep->maybe_compress (remove_zeros); - return (*this); + rep->maybe_compress (remove_zeros); + return (*this); } Sparse reshape (const dim_vector& new_dims) const; @@ -434,11 +434,11 @@ void resize (const dim_vector& dv); - void change_capacity (octave_idx_type nz) - { + void change_capacity (octave_idx_type nz) + { if (nz < nnz ()) make_unique (); // Unshare now because elements will be truncated. - rep->change_length (nz); + rep->change_length (nz); } Sparse& insert (const Sparse& a, octave_idx_type r, octave_idx_type c); @@ -526,7 +526,7 @@ { octave_idx_type nr = rows (); octave_idx_type nc = cols (); - + result = Sparse (nr, nc, f_zero); for (octave_idx_type j = 0; j < nc; j++) @@ -601,7 +601,7 @@ octave_idx_type jold = 0; octave_idx_type ii = 0; T tmp; - + a.cidx (0) = 0; for (octave_idx_type i = 0; i < nz; i++) { @@ -654,7 +654,7 @@ jold = jtmp; tmp = read_fcn (is); - + if (is) { a.data (ii) = tmp; @@ -667,7 +667,7 @@ for (octave_idx_type j = jold; j < nc; j++) a.cidx(j+1) = ii; } - + done: return is; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparseCmplxCHOL.cc --- a/liboctave/SparseCmplxCHOL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparseCmplxCHOL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -60,7 +60,7 @@ retval = rinv.transpose() * rinv; } else - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("spchol2inv requires triangular matrix"); } else diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparseCmplxCHOL.h --- a/liboctave/SparseCmplxCHOL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparseCmplxCHOL.h Thu Jan 20 17:24:59 2011 -0500 @@ -30,24 +30,24 @@ class OCTAVE_API -SparseComplexCHOL : +SparseComplexCHOL : public sparse_base_chol { public: - SparseComplexCHOL (void) : + SparseComplexCHOL (void) : sparse_base_chol () { } - SparseComplexCHOL (const SparseComplexMatrix& a, bool natural = true) : - sparse_base_chol + SparseComplexCHOL (const SparseComplexMatrix& a, bool natural = true) : + sparse_base_chol (a, natural) { } - SparseComplexCHOL (const SparseComplexMatrix& a, octave_idx_type& info, + SparseComplexCHOL (const SparseComplexMatrix& a, octave_idx_type& info, bool natural = true) : - sparse_base_chol + sparse_base_chol (a, info, natural) { } - SparseComplexCHOL (const SparseComplexCHOL& a) : + SparseComplexCHOL (const SparseComplexCHOL& a) : sparse_base_chol (a) { } ~SparseComplexCHOL (void) { } @@ -63,33 +63,33 @@ SparseComplexMatrix chol_matrix (void) const { return R(); } - SparseComplexMatrix L (void) const - { return sparse_base_chol:: L (); } - SparseComplexMatrix R (void) const + SparseComplexMatrix R (void) const { return sparse_base_chol:: R (); } - octave_idx_type P (void) const - { return sparse_base_chol:: P (); } - ColumnVector perm (void) const - { return sparse_base_chol:: perm (); } - SparseMatrix Q (void) const - { return sparse_base_chol:: Q (); } double rcond (void) const - { return sparse_base_chol:: rcond (); } // Compute the inverse of a matrix using the Cholesky factorization. SparseComplexMatrix inverse (void) const - { return sparse_base_chol:: inverse (); } }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparseCmplxLU.cc --- a/liboctave/SparseCmplxLU.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparseCmplxLU.cc Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ #include "oct-sparse.h" -SparseComplexLU::SparseComplexLU (const SparseComplexMatrix& a, +SparseComplexLU::SparseComplexLU (const SparseComplexMatrix& a, const Matrix& piv_thres, bool scale) { #ifdef HAVE_UMFPACK @@ -82,7 +82,7 @@ if (!xisnan (tmp)) Control (UMFPACK_FIXQ) = tmp; - // Turn-off UMFPACK scaling for LU + // Turn-off UMFPACK scaling for LU if (scale) Control (UMFPACK_SCALE) = UMFPACK_SCALE_SUM; else @@ -101,14 +101,14 @@ void *Symbolic; Matrix Info (1, UMFPACK_INFO); double *info = Info.fortran_vec (); - int status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, + int status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, reinterpret_cast (Ax), 0, 0, &Symbolic, control, info); if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexLU::SparseComplexLU symbolic factorization failed"); UMFPACK_ZNAME (report_status) (control, status); @@ -131,7 +131,7 @@ if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexLU::SparseComplexLU numeric factorization failed"); UMFPACK_ZNAME (report_status) (control, status); @@ -146,10 +146,10 @@ octave_idx_type lnz, unz, ignore1, ignore2, ignore3; status = UMFPACK_ZNAME (get_lunz) (&lnz, &unz, &ignore1, &ignore2, &ignore3, Numeric) ; - + if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); UMFPACK_ZNAME (report_status) (control, status); @@ -180,7 +180,7 @@ octave_idx_type *Up = Ufact.cidx (); octave_idx_type *Uj = Ufact.ridx (); Complex *Ux = Ufact.data (); - + Rfact = SparseMatrix (nr, nr, nr); for (octave_idx_type i = 0; i < nr; i++) { @@ -208,7 +208,7 @@ if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); UMFPACK_ZNAME (report_status) (control, status); @@ -222,13 +222,13 @@ Rx[i] = 1.0 / Rx[i]; UMFPACK_ZNAME (report_matrix) (nr, n_inner, - Lfact.cidx (), Lfact.ridx (), - reinterpret_cast (Lfact.data()), + Lfact.cidx (), Lfact.ridx (), + reinterpret_cast (Lfact.data()), 0, 1, control); UMFPACK_ZNAME (report_matrix) (n_inner, nc, - Ufact.cidx (), Ufact.ridx (), - reinterpret_cast (Ufact.data()), + Ufact.cidx (), Ufact.ridx (), + reinterpret_cast (Ufact.data()), 0, 1, control); UMFPACK_ZNAME (report_perm) (nr, p, control); UMFPACK_ZNAME (report_perm) (nc, q, control); @@ -243,16 +243,16 @@ #endif } -SparseComplexLU::SparseComplexLU (const SparseComplexMatrix& a, - const ColumnVector& Qinit, +SparseComplexLU::SparseComplexLU (const SparseComplexMatrix& a, + const ColumnVector& Qinit, const Matrix& piv_thres, bool scale, - bool FixedQ, double droptol, + bool FixedQ, double droptol, bool milu, bool udiag) { #ifdef HAVE_UMFPACK if (milu) - (*current_liboctave_error_handler) - ("Modified incomplete LU not implemented"); + (*current_liboctave_error_handler) + ("Modified incomplete LU not implemented"); else { octave_idx_type nr = a.rows (); @@ -299,7 +299,7 @@ Control (UMFPACK_FIXQ) = tmp; } - // Turn-off UMFPACK scaling for LU + // Turn-off UMFPACK scaling for LU if (scale) Control (UMFPACK_SCALE) = UMFPACK_SCALE_SUM; else @@ -311,7 +311,7 @@ const octave_idx_type *Ai = a.ridx (); const Complex *Ax = a.data (); - UMFPACK_ZNAME (report_matrix) (nr, nc, Ap, Ai, + UMFPACK_ZNAME (report_matrix) (nr, nc, Ap, Ai, reinterpret_cast (Ax), 0, 1, control); @@ -328,15 +328,15 @@ for (octave_idx_type i = 0; i < nc; i++) qinit [i] = static_cast (Qinit (i)); - status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, + status = UMFPACK_ZNAME (qsymbolic) (nr, nc, Ap, Ai, reinterpret_cast (Ax), - 0, qinit, &Symbolic, control, + 0, qinit, &Symbolic, control, info); } while (0); if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexLU::SparseComplexLU symbolic factorization failed"); UMFPACK_ZNAME (report_status) (control, status); @@ -349,7 +349,7 @@ UMFPACK_ZNAME (report_symbolic) (Symbolic, control); void *Numeric; - status = UMFPACK_ZNAME (numeric) (Ap, Ai, + status = UMFPACK_ZNAME (numeric) (Ap, Ai, reinterpret_cast (Ax), 0, Symbolic, &Numeric, control, info) ; UMFPACK_ZNAME (free_symbolic) (&Symbolic) ; @@ -358,7 +358,7 @@ if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexLU::SparseComplexLU numeric factorization failed"); UMFPACK_ZNAME (report_status) (control, status); @@ -373,10 +373,10 @@ octave_idx_type lnz, unz, ignore1, ignore2, ignore3; status = UMFPACK_ZNAME (get_lunz) (&lnz, &unz, &ignore1, &ignore2, &ignore3, Numeric); - + if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); UMFPACK_ZNAME (report_status) (control, status); @@ -407,7 +407,7 @@ octave_idx_type *Up = Ufact.cidx (); octave_idx_type *Uj = Ufact.ridx (); Complex *Ux = Ufact.data (); - + Rfact = SparseMatrix (nr, nr, nr); for (octave_idx_type i = 0; i < nr; i++) { @@ -424,19 +424,19 @@ octave_idx_type *q = Q.fortran_vec (); octave_idx_type do_recip; - status = - UMFPACK_ZNAME (get_numeric) (Ltp, Ltj, + status = + UMFPACK_ZNAME (get_numeric) (Ltp, Ltj, reinterpret_cast (Ltx), 0, Up, Uj, - reinterpret_cast (Ux), - 0, p, q, 0, 0, + reinterpret_cast (Ux), + 0, p, q, 0, 0, &do_recip, Rx, Numeric) ; UMFPACK_ZNAME (free_numeric) (&Numeric) ; if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseComplexLU::SparseComplexLU extracting LU factors failed"); UMFPACK_ZNAME (report_status) (control, status); @@ -449,16 +449,16 @@ for (octave_idx_type i = 0; i < nr; i++) Rx[i] = 1.0 / Rx[i]; - UMFPACK_ZNAME (report_matrix) (nr, n_inner, - Lfact.cidx (), - Lfact.ridx (), - reinterpret_cast (Lfact.data()), + UMFPACK_ZNAME (report_matrix) (nr, n_inner, + Lfact.cidx (), + Lfact.ridx (), + reinterpret_cast (Lfact.data()), 0, 1, control); - UMFPACK_ZNAME (report_matrix) (n_inner, nc, - Ufact.cidx (), - Ufact.ridx (), - reinterpret_cast (Ufact.data()), + UMFPACK_ZNAME (report_matrix) (n_inner, nc, + Ufact.cidx (), + Ufact.ridx (), + reinterpret_cast (Ufact.data()), 0, 1, control); UMFPACK_ZNAME (report_perm) (nr, p, control); UMFPACK_ZNAME (report_perm) (nc, q, control); @@ -470,8 +470,8 @@ } if (udiag) - (*current_liboctave_error_handler) - ("Option udiag of incomplete LU not implemented"); + (*current_liboctave_error_handler) + ("Option udiag of incomplete LU not implemented"); } #else (*current_liboctave_error_handler) ("UMFPACK not installed"); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparseCmplxLU.h --- a/liboctave/SparseCmplxLU.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparseCmplxLU.h Thu Jan 20 17:24:59 2011 -0500 @@ -30,31 +30,31 @@ class OCTAVE_API -SparseComplexLU +SparseComplexLU : public sparse_base_lu { public: - SparseComplexLU (void) + SparseComplexLU (void) : sparse_base_lu () { } - SparseComplexLU (const SparseComplexMatrix& a, + SparseComplexLU (const SparseComplexMatrix& a, const Matrix& piv_thres = Matrix (), bool scale = false); SparseComplexLU (const SparseComplexMatrix& a, const ColumnVector& Qinit, - const Matrix& piv_thres = Matrix (), + const Matrix& piv_thres = Matrix (), bool scale = false, bool FixedQ = false, double droptol = -1., bool milu = false, bool udiag = false); - SparseComplexLU (const SparseComplexLU& a) + SparseComplexLU (const SparseComplexLU& a) : sparse_base_lu (a) { } SparseComplexLU& operator = (const SparseComplexLU& a) { if (this != &a) - sparse_base_lu + sparse_base_lu :: operator = (a); return *this; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparseCmplxQR.cc --- a/liboctave/SparseCmplxQR.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparseCmplxQR.cc Thu Jan 20 17:24:59 2011 -0500 @@ -48,7 +48,7 @@ #define OCTAVE_C99_ONE cs_complex_t(1., 0.); #endif -SparseComplexQR::SparseComplexQR_rep::SparseComplexQR_rep +SparseComplexQR::SparseComplexQR_rep::SparseComplexQR_rep (GCC_ATTR_UNUSED const SparseComplexMatrix& a, GCC_ATTR_UNUSED int order) : count (1), nrows (0) #ifdef HAVE_CXSPARSE @@ -65,7 +65,7 @@ // Prevents the methods below making a copy of the data. A.p = const_cast(a.cidx ()); A.i = const_cast(a.ridx ()); - A.x = const_cast(reinterpret_cast + A.x = const_cast(reinterpret_cast (a.data ())); A.nz = -1; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -94,7 +94,7 @@ #endif } -SparseComplexMatrix +SparseComplexMatrix SparseComplexQR::SparseComplexQR_rep::V (void) const { #ifdef HAVE_CXSPARSE @@ -124,7 +124,7 @@ #endif } -ColumnVector +ColumnVector SparseComplexQR::SparseComplexQR_rep::Pinv (void) const { #ifdef HAVE_CXSPARSE @@ -141,7 +141,7 @@ #endif } -ColumnVector +ColumnVector SparseComplexQR::SparseComplexQR_rep::P (void) const { #ifdef HAVE_CXSPARSE @@ -158,7 +158,7 @@ #endif } -SparseComplexMatrix +SparseComplexMatrix SparseComplexQR::SparseComplexQR_rep::R (const bool econ) const { #ifdef HAVE_CXSPARSE @@ -196,7 +196,7 @@ octave_idx_type b_nc = b.cols(); octave_idx_type nc = N->L->n; octave_idx_type nr = nrows; - const cs_complex_t *bvec = + const cs_complex_t *bvec = reinterpret_cast(b.fortran_vec()); ComplexMatrix ret(b_nr, b_nc); Complex *vec = ret.fortran_vec(); @@ -213,10 +213,10 @@ volatile octave_idx_type nm = (nr < nc ? nr : nc); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (S->pinv, bvec + idx, reinterpret_cast(buf), b_nr); #else - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (b_nr, S->Pinv, bvec + idx, reinterpret_cast(buf)); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -224,7 +224,7 @@ { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_ZNAME (_happly) + CXSPARSE_ZNAME (_happly) (N->L, i, N->B[i], reinterpret_cast(buf)); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } @@ -263,10 +263,10 @@ volatile octave_idx_type nm = (nr < nc ? nr : nc); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (S->pinv, bvec, reinterpret_cast(buf), nr); #else - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (nr, S->Pinv, bvec, reinterpret_cast(buf)); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -274,7 +274,7 @@ { octave_quit (); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CXSPARSE_ZNAME (_happly) + CXSPARSE_ZNAME (_happly) (N->L, i, N->B[i], reinterpret_cast(buf)); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } @@ -324,10 +324,10 @@ buf[j] = OCTAVE_C99_ZERO; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (q.S()->pinv, reinterpret_cast(Xx), buf, nr); #else - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (nr, q.S()->Pinv, reinterpret_cast(Xx), buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -395,7 +395,7 @@ #if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) CXSPARSE_ZNAME (_happly) (q.N()->L, j, B[j], buf); #else - CXSPARSE_ZNAME (_happly) + CXSPARSE_ZNAME (_happly) (q.N()->L, j, reinterpret_cast(B)[j], buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -454,10 +454,10 @@ buf[j] = OCTAVE_C99_ZERO; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (q.S()->pinv, reinterpret_cast(Xx), buf, nr); #else - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (nr, q.S()->Pinv, reinterpret_cast(Xx), buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -471,10 +471,10 @@ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; CXSPARSE_ZNAME (_usolve) (q.N()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (q.S()->q, buf, reinterpret_cast(Xx), nc); #else - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (nc, q.S()->Q, buf, reinterpret_cast(Xx)); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -547,17 +547,17 @@ #if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) CXSPARSE_ZNAME (_happly) (q.N()->L, j, B[j], buf); #else - CXSPARSE_ZNAME (_happly) + CXSPARSE_ZNAME (_happly) (q.N()->L, j, reinterpret_cast(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) + CXSPARSE_ZNAME (_pvec) (q.S()->pinv, buf, reinterpret_cast(Xx), nc); #else - CXSPARSE_ZNAME (_pvec) + CXSPARSE_ZNAME (_pvec) (nc, q.S()->Pinv, buf, reinterpret_cast(Xx)); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -600,7 +600,7 @@ 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 = + const cs_complex_t *bvec = reinterpret_cast(b.fortran_vec()); ComplexMatrix x; @@ -618,7 +618,7 @@ cs_complex_t *vec = reinterpret_cast (x.fortran_vec()); OCTAVE_C99_COMPLEX (buf, q.S()->m2); - for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc; + for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc; i++, idx+=nc, bidx+=b_nr) { octave_quit (); @@ -669,7 +669,7 @@ for (octave_idx_type i = 0; i < nr; i++) B[i] = conj (reinterpret_cast(q.N()->B) [i]); #endif - for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc; + for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc; i++, idx+=nc, bidx+=b_nr) { octave_quit (); @@ -690,7 +690,7 @@ #if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) CXSPARSE_ZNAME (_happly) (q.N()->L, j, B[j], buf); #else - CXSPARSE_ZNAME (_happly) + CXSPARSE_ZNAME (_happly) (q.N()->L, j, reinterpret_cast(B)[j], buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -749,10 +749,10 @@ buf[j] = OCTAVE_C99_ZERO; BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (q.S()->pinv, reinterpret_cast(Xx), buf, nr); #else - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (nr, q.S()->Pinv, reinterpret_cast(Xx), buf); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -766,10 +766,10 @@ BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; CXSPARSE_ZNAME (_usolve) (q.N()->U, buf); #if defined(CS_VER) && (CS_VER >= 2) - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (q.S()->q, buf, reinterpret_cast(Xx), nc); #else - CXSPARSE_ZNAME (_ipvec) + CXSPARSE_ZNAME (_ipvec) (nc, q.S()->Q, buf, reinterpret_cast(Xx)); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -841,17 +841,17 @@ #if defined(CS_VER) && (((CS_VER == 2) && (CS_SUBVER >= 2)) || (CS_VER > 2)) CXSPARSE_ZNAME (_happly) (q.N()->L, j, B[j], buf); #else - CXSPARSE_ZNAME (_happly) + CXSPARSE_ZNAME (_happly) (q.N()->L, j, reinterpret_cast(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) + CXSPARSE_ZNAME (_pvec) (q.S()->pinv, buf, reinterpret_cast(Xx), nc); #else - CXSPARSE_ZNAME (_pvec) + CXSPARSE_ZNAME (_pvec) (nc, q.S()->Pinv, buf, reinterpret_cast(Xx)); #endif END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; @@ -885,15 +885,15 @@ #endif } -ComplexMatrix -qrsolve (const SparseComplexMatrix &a, const MArray &b, +ComplexMatrix +qrsolve (const SparseComplexMatrix &a, const MArray &b, octave_idx_type &info) { return qrsolve (a, Matrix (b), info); } -ComplexMatrix -qrsolve (const SparseComplexMatrix &a, const MArray &b, +ComplexMatrix +qrsolve (const SparseComplexMatrix &a, const MArray &b, octave_idx_type &info) { return qrsolve (a, ComplexMatrix (b), info); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparseCmplxQR.h --- a/liboctave/SparseCmplxQR.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparseCmplxQR.h Thu Jan 20 17:24:59 2011 -0500 @@ -77,11 +77,11 @@ private: SparseComplexQR_rep *rep; -public: - SparseComplexQR (void) : +public: + SparseComplexQR (void) : rep (new SparseComplexQR_rep (SparseComplexMatrix(), 0)) { } - SparseComplexQR (const SparseComplexMatrix& a, int order = 0) : + SparseComplexQR (const SparseComplexMatrix& a, int order = 0) : rep (new SparseComplexQR_rep (a, order)) { } SparseComplexQR (const SparseComplexQR& a) : rep (a.rep) { rep->count++; } @@ -113,7 +113,7 @@ ColumnVector P (void) const { return rep->P(); } - SparseComplexMatrix R (const bool econ = false) const + SparseComplexMatrix R (const bool econ = false) const { return rep->R(econ); } ComplexMatrix C (const ComplexMatrix &b) const { return rep->C(b); } @@ -123,15 +123,15 @@ friend ComplexMatrix qrsolve (const SparseComplexMatrix &a, const Matrix &b, octave_idx_type &info); - friend SparseComplexMatrix qrsolve (const SparseComplexMatrix &a, + friend SparseComplexMatrix qrsolve (const SparseComplexMatrix &a, const SparseMatrix &b, octave_idx_type &info); - friend ComplexMatrix qrsolve (const SparseComplexMatrix &a, + friend ComplexMatrix qrsolve (const SparseComplexMatrix &a, const ComplexMatrix &b, octave_idx_type &info); - friend SparseComplexMatrix qrsolve (const SparseComplexMatrix &a, + friend SparseComplexMatrix qrsolve (const SparseComplexMatrix &a, const SparseComplexMatrix &b, octave_idx_type &info); @@ -149,23 +149,23 @@ extern ComplexMatrix qrsolve (const SparseComplexMatrix &a, const Matrix &b, octave_idx_type &info); -extern ComplexMatrix qrsolve (const SparseComplexMatrix &a, - const MArray &b, +extern ComplexMatrix qrsolve (const SparseComplexMatrix &a, + const MArray &b, octave_idx_type &info); -extern SparseComplexMatrix qrsolve (const SparseComplexMatrix &a, +extern SparseComplexMatrix qrsolve (const SparseComplexMatrix &a, const SparseMatrix &b, octave_idx_type &info); -extern ComplexMatrix qrsolve (const SparseComplexMatrix &a, +extern ComplexMatrix qrsolve (const SparseComplexMatrix &a, const ComplexMatrix &b, octave_idx_type &info); -extern ComplexMatrix qrsolve (const SparseComplexMatrix &a, - const MArray &b, +extern ComplexMatrix qrsolve (const SparseComplexMatrix &a, + const MArray &b, octave_idx_type &info); -extern SparseComplexMatrix qrsolve (const SparseComplexMatrix &a, +extern SparseComplexMatrix qrsolve (const SparseComplexMatrix &a, const SparseComplexMatrix &b, octave_idx_type &info); #endif diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparseQR.cc --- a/liboctave/SparseQR.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparseQR.cc Thu Jan 20 17:24:59 2011 -0500 @@ -74,7 +74,7 @@ #endif } -SparseMatrix +SparseMatrix SparseQR::SparseQR_rep::V (void) const { #ifdef HAVE_CXSPARSE @@ -104,7 +104,7 @@ #endif } -ColumnVector +ColumnVector SparseQR::SparseQR_rep::Pinv (void) const { #ifdef HAVE_CXSPARSE @@ -121,7 +121,7 @@ #endif } -ColumnVector +ColumnVector SparseQR::SparseQR_rep::P (void) const { #ifdef HAVE_CXSPARSE @@ -138,7 +138,7 @@ #endif } -SparseMatrix +SparseMatrix SparseQR::SparseQR_rep::R (const bool econ) const { #ifdef HAVE_CXSPARSE @@ -290,12 +290,12 @@ else if (nr >= nc) { SparseQR q (a, 3); - if (! q.ok ()) + if (! q.ok ()) return Matrix(); x.resize(nc, b_nc); 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; + for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc; i++, idx+=nc, bidx+=b_nr) { octave_quit (); @@ -336,7 +336,7 @@ 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; + for (volatile octave_idx_type i = 0, idx = 0, bidx = 0; i < b_nc; i++, idx+=nc, bidx+=b_nr) { octave_quit (); @@ -394,7 +394,7 @@ else if (nr >= nc) { SparseQR q (a, 3); - if (! q.ok ()) + if (! q.ok ()) return SparseMatrix(); x = SparseMatrix (nc, b_nc, b.nnz()); x.xcidx(0) = 0; @@ -712,7 +712,7 @@ else if (nr >= nc) { SparseQR q (a, 3); - if (! q.ok ()) + if (! q.ok ()) return SparseComplexMatrix(); x = SparseComplexMatrix (nc, b_nc, b.nnz()); x.xcidx(0) = 0; @@ -901,16 +901,16 @@ #endif } -Matrix -qrsolve(const SparseMatrix &a, const MArray &b, +Matrix +qrsolve(const SparseMatrix &a, const MArray &b, octave_idx_type &info) -{ - return qrsolve (a, Matrix (b), info); +{ + return qrsolve (a, Matrix (b), info); } -ComplexMatrix -qrsolve(const SparseMatrix &a, const MArray &b, +ComplexMatrix +qrsolve(const SparseMatrix &a, const MArray &b, octave_idx_type &info) -{ +{ return qrsolve (a, ComplexMatrix (b), info); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparseQR.h --- a/liboctave/SparseQR.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparseQR.h Thu Jan 20 17:24:59 2011 -0500 @@ -77,10 +77,10 @@ private: SparseQR_rep *rep; -public: +public: SparseQR (void) : rep (new SparseQR_rep (SparseMatrix(), 0)) { } - SparseQR (const SparseMatrix& a, int order = 0) : + SparseQR (const SparseMatrix& a, int order = 0) : rep (new SparseQR_rep (a, order)) { } SparseQR (const SparseQR& a) : rep (a.rep) { rep->count++; } @@ -118,7 +118,7 @@ Matrix Q (void) const { return rep->Q(); } - friend Matrix qrsolve (const SparseMatrix &a, const Matrix &b, + friend Matrix qrsolve (const SparseMatrix &a, const Matrix &b, octave_idx_type &info); friend SparseMatrix qrsolve (const SparseMatrix &a, const SparseMatrix &b, @@ -127,7 +127,7 @@ friend ComplexMatrix qrsolve (const SparseMatrix &a, const ComplexMatrix &b, octave_idx_type &info); - friend SparseComplexMatrix qrsolve (const SparseMatrix &a, + friend SparseComplexMatrix qrsolve (const SparseMatrix &a, const SparseComplexMatrix &b, octave_idx_type &info); @@ -142,10 +142,10 @@ // Publish externally used friend functions. -extern Matrix qrsolve (const SparseMatrix &a, const Matrix &b, +extern Matrix qrsolve (const SparseMatrix &a, const Matrix &b, octave_idx_type &info); -extern Matrix qrsolve (const SparseMatrix &a, const MArray &b, +extern Matrix qrsolve (const SparseMatrix &a, const MArray &b, octave_idx_type &info); extern SparseMatrix qrsolve (const SparseMatrix &a, const SparseMatrix &b, @@ -154,10 +154,10 @@ extern ComplexMatrix qrsolve (const SparseMatrix &a, const ComplexMatrix &b, octave_idx_type &info); -extern ComplexMatrix qrsolve (const SparseMatrix &a, const MArray &b, +extern ComplexMatrix qrsolve (const SparseMatrix &a, const MArray &b, octave_idx_type &info); -extern SparseComplexMatrix qrsolve (const SparseMatrix &a, +extern SparseComplexMatrix qrsolve (const SparseMatrix &a, const SparseComplexMatrix &b, octave_idx_type &info); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparsedbleCHOL.cc --- a/liboctave/SparsedbleCHOL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparsedbleCHOL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -60,7 +60,7 @@ retval = rinv.transpose() * rinv; } else - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("spchol2inv requires triangular matrix"); } else diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparsedbleCHOL.h --- a/liboctave/SparsedbleCHOL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparsedbleCHOL.h Thu Jan 20 17:24:59 2011 -0500 @@ -35,14 +35,14 @@ SparseCHOL (void) : sparse_base_chol () { } - SparseCHOL (const SparseMatrix& a, bool natural = true) : + SparseCHOL (const SparseMatrix& a, bool natural = true) : sparse_base_chol (a, natural) { } - SparseCHOL (const SparseMatrix& a, octave_idx_type& info, - bool natural = true) : + SparseCHOL (const SparseMatrix& a, octave_idx_type& info, + bool natural = true) : sparse_base_chol (a, info, natural) { } - SparseCHOL (const SparseCHOL& a) : + SparseCHOL (const SparseCHOL& a) : sparse_base_chol (a) { } ~SparseCHOL (void) { } @@ -57,19 +57,19 @@ SparseMatrix chol_matrix (void) const { return R(); } - SparseMatrix L (void) const + SparseMatrix L (void) const { return sparse_base_chol:: L (); } - SparseMatrix R (void) const + SparseMatrix R (void) const { return sparse_base_chol:: R (); } - octave_idx_type P (void) const + octave_idx_type P (void) const { return sparse_base_chol:: P (); } - ColumnVector perm (void) const + ColumnVector perm (void) const { return sparse_base_chol:: perm (); } - SparseMatrix Q (void) const + SparseMatrix Q (void) const { return sparse_base_chol:: Q (); } double rcond (void) const @@ -77,7 +77,7 @@ // Compute the inverse of a matrix using the Cholesky factorization. SparseMatrix inverse (void) const - { return sparse_base_chol:: + { return sparse_base_chol:: inverse (); } }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparsedbleLU.cc --- a/liboctave/SparsedbleLU.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparsedbleLU.cc Thu Jan 20 17:24:59 2011 -0500 @@ -103,7 +103,7 @@ if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseLU::SparseLU symbolic factorization failed"); UMFPACK_DNAME (report_status) (control, status); @@ -116,7 +116,7 @@ UMFPACK_DNAME (report_symbolic) (Symbolic, control); void *Numeric; - status = UMFPACK_DNAME (numeric) (Ap, Ai, Ax, Symbolic, + status = UMFPACK_DNAME (numeric) (Ap, Ai, Ax, Symbolic, &Numeric, control, info) ; UMFPACK_DNAME (free_symbolic) (&Symbolic) ; @@ -124,7 +124,7 @@ if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseLU::SparseLU numeric factorization failed"); UMFPACK_DNAME (report_status) (control, status); @@ -139,10 +139,10 @@ octave_idx_type lnz, unz, ignore1, ignore2, ignore3; status = UMFPACK_DNAME (get_lunz) (&lnz, &unz, &ignore1, &ignore2, &ignore3, Numeric) ; - + if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseLU::SparseLU extracting LU factors failed"); UMFPACK_DNAME (report_status) (control, status); @@ -192,14 +192,14 @@ octave_idx_type do_recip; status = UMFPACK_DNAME (get_numeric) (Ltp, Ltj, Ltx, Up, Uj, Ux, p, q, 0, - &do_recip, Rx, + &do_recip, Rx, Numeric) ; UMFPACK_DNAME (free_numeric) (&Numeric) ; if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseLU::SparseLU extracting LU factors failed"); UMFPACK_DNAME (report_status) (control, status); @@ -212,10 +212,10 @@ for (octave_idx_type i = 0; i < nr; i++) Rx[i] = 1.0 / Rx[i]; - UMFPACK_DNAME (report_matrix) (nr, n_inner, + UMFPACK_DNAME (report_matrix) (nr, n_inner, Lfact.cidx (), Lfact.ridx (), Lfact.data (), 1, control); - UMFPACK_DNAME (report_matrix) (n_inner, nc, + UMFPACK_DNAME (report_matrix) (n_inner, nc, Ufact.cidx (), Ufact.ridx (), Ufact.data (), 1, control); UMFPACK_DNAME (report_perm) (nr, p, control); @@ -237,8 +237,8 @@ { #ifdef HAVE_UMFPACK if (milu) - (*current_liboctave_error_handler) - ("Modified incomplete LU not implemented"); + (*current_liboctave_error_handler) + ("Modified incomplete LU not implemented"); else { octave_idx_type nr = a.rows (); @@ -298,7 +298,7 @@ const octave_idx_type *Ai = a.ridx (); const double *Ax = a.data (); - UMFPACK_DNAME (report_matrix) (nr, nc, Ap, Ai, Ax, 1, + UMFPACK_DNAME (report_matrix) (nr, nc, Ap, Ai, Ax, 1, control); void *Symbolic; @@ -313,13 +313,13 @@ for (octave_idx_type i = 0; i < nc; i++) qinit [i] = static_cast (Qinit (i)); - status = UMFPACK_DNAME (qsymbolic) (nr, nc, Ap, Ai, Ax, + status = UMFPACK_DNAME (qsymbolic) (nr, nc, Ap, Ai, Ax, qinit, &Symbolic, control, info); } while (0); if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseLU::SparseLU symbolic factorization failed"); UMFPACK_DNAME (report_status) (control, status); @@ -340,7 +340,7 @@ if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseLU::SparseLU numeric factorization failed"); UMFPACK_DNAME (report_status) (control, status); @@ -355,10 +355,10 @@ octave_idx_type lnz, unz, ignore1, ignore2, ignore3; status = UMFPACK_DNAME (get_lunz) (&lnz, &unz, &ignore1, &ignore2, &ignore3, Numeric) ; - + if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseLU::SparseLU extracting LU factors failed"); UMFPACK_DNAME (report_status) (control, status); @@ -407,15 +407,15 @@ octave_idx_type do_recip; status = UMFPACK_DNAME (get_numeric) (Ltp, Ltj, - Ltx, Up, Uj, Ux, p, q, - 0, &do_recip, + Ltx, Up, Uj, Ux, p, q, + 0, &do_recip, Rx, Numeric) ; UMFPACK_DNAME (free_numeric) (&Numeric) ; if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseLU::SparseLU extracting LU factors failed"); UMFPACK_DNAME (report_status) (control, status); @@ -428,14 +428,14 @@ for (octave_idx_type i = 0; i < nr; i++) Rx[i] = 1.0 / Rx[i]; - UMFPACK_DNAME (report_matrix) (nr, n_inner, - Lfact.cidx (), - Lfact.ridx (), + UMFPACK_DNAME (report_matrix) (nr, n_inner, + Lfact.cidx (), + Lfact.ridx (), Lfact.data (), 1, control); - UMFPACK_DNAME (report_matrix) (n_inner, nc, - Ufact.cidx (), - Ufact.ridx (), + UMFPACK_DNAME (report_matrix) (n_inner, nc, + Ufact.cidx (), + Ufact.ridx (), Ufact.data (), 1, control); UMFPACK_DNAME (report_perm) (nr, p, control); @@ -448,8 +448,8 @@ } if (udiag) - (*current_liboctave_error_handler) - ("Option udiag of incomplete LU not implemented"); + (*current_liboctave_error_handler) + ("Option udiag of incomplete LU not implemented"); } #else (*current_liboctave_error_handler) ("UMFPACK not installed"); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/SparsedbleLU.h --- a/liboctave/SparsedbleLU.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/SparsedbleLU.h Thu Jan 20 17:24:59 2011 -0500 @@ -33,24 +33,24 @@ { public: - SparseLU (void) + SparseLU (void) : sparse_base_lu () { } 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, - bool FixedQ = false, double droptol = -1., + SparseLU (const SparseMatrix& a, const ColumnVector& Qinit, + const Matrix& piv_thres = Matrix(), bool scale = false, + bool FixedQ = false, double droptol = -1., bool milu = false, bool udiag = false); - SparseLU (const SparseLU& a) + SparseLU (const SparseLU& a) : sparse_base_lu (a) { } SparseLU& operator = (const SparseLU& a) { if (this != &a) - sparse_base_lu + sparse_base_lu :: operator = (a); return *this; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/base-aepbal.h --- a/liboctave/base-aepbal.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/base-aepbal.h Thu Jan 20 17:24:59 2011 -0500 @@ -36,10 +36,10 @@ public: - base_aepbal (const base_aepbal& a) - : balanced_mat (a.balanced_mat), scale (a.scale), + base_aepbal (const base_aepbal& a) + : balanced_mat (a.balanced_mat), scale (a.scale), ilo(a.ilo), ihi(a.ihi), job(a.job) - { + { } base_aepbal& operator = (const base_aepbal& a) @@ -72,7 +72,7 @@ octave_idx_type j = scale(i) - 1; std::swap (pv(i), pv(j)); } - + return pv; } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/base-de.h --- a/liboctave/base-de.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/base-de.h Thu Jan 20 17:24:59 2011 -0500 @@ -35,7 +35,7 @@ base_diff_eqn (void) : x (), t (0.0), stop_time (0.0), stop_time_set (false), - restart (true), integration_error (false), istate (0) { } + restart (true), integration_error (false), istate (0) { } base_diff_eqn (const ColumnVector& xx, double tt) : x (xx), t (tt), stop_time (0.0), stop_time_set (false), diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/base-lu.cc --- a/liboctave/base-lu.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/base-lu.cc Thu Jan 20 17:24:59 2011 -0500 @@ -28,7 +28,7 @@ #include "base-lu.h" template -base_lu::base_lu (const lu_type& l, const lu_type& u, +base_lu::base_lu (const lu_type& l, const lu_type& u, const PermMatrix& p) : a_fact (u), l_fact (l), ipvt (p.pvec ()) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/base-lu.h --- a/liboctave/base-lu.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/base-lu.h Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ base_lu (const base_lu& a) : a_fact (a.a_fact), l_fact (a.l_fact), ipvt (a.ipvt) { } - base_lu (const lu_type& l, const lu_type& u, + base_lu (const lu_type& l, const lu_type& u, const PermMatrix& p); base_lu& operator = (const base_lu& a) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/boolNDArray.cc --- a/liboctave/boolNDArray.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/boolNDArray.cc Thu Jan 20 17:24:59 2011 -0500 @@ -68,15 +68,15 @@ return do_mx_red_op (*this, dim, mx_inline_any); } -NDArray +NDArray boolNDArray::sum (int dim) const { // NOTE: going via octave_idx_type is typically faster even though it - // requires a conversion. + // requires a conversion. return do_mx_red_op (*this, dim, mx_inline_count); } -NDArray +NDArray boolNDArray::cumsum (int dim) const { // In this case, it's better to sum directly to doubles. @@ -143,7 +143,7 @@ SND_BOOL_OPS (bool, boolNDArray) SND_CMP_OPS (bool, boolNDArray) -boolNDArray& +boolNDArray& mx_el_and_assign (boolNDArray& a, const boolNDArray& b) { if (a.is_shared ()) @@ -154,7 +154,7 @@ return a; } -boolNDArray& +boolNDArray& mx_el_or_assign (boolNDArray& a, const boolNDArray& b) { if (a.is_shared ()) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/boolNDArray.h --- a/liboctave/boolNDArray.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/boolNDArray.h Thu Jan 20 17:24:59 2011 -0500 @@ -46,7 +46,7 @@ boolNDArray (const dim_vector& dv, const bool& val) : Array (dv, val) { } - + boolNDArray (const boolNDArray& a) : Array (a) { } boolNDArray (const boolMatrix& a) : Array (a) { } @@ -63,7 +63,7 @@ boolNDArray operator ! (void) const; - boolNDArray& invert (void); + boolNDArray& invert (void); bool any_element_is_nan (void) const { return false; } @@ -114,9 +114,9 @@ SND_BOOL_OP_DECLS (bool, boolNDArray, OCTAVE_API) SND_CMP_OP_DECLS (bool, boolNDArray, OCTAVE_API) -extern OCTAVE_API boolNDArray& +extern OCTAVE_API boolNDArray& mx_el_and_assign (boolNDArray& m, const boolNDArray& a); -extern OCTAVE_API boolNDArray& +extern OCTAVE_API boolNDArray& mx_el_or_assign (boolNDArray& m, const boolNDArray& a); BSXFUN_OP_DECL (and, boolNDArray, OCTAVE_API); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/boolSparse.cc --- a/liboctave/boolSparse.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/boolSparse.cc Thu Jan 20 17:24:59 2011 -0500 @@ -103,9 +103,9 @@ octave_idx_type nc = cols (); octave_idx_type nz1 = nnz (); octave_idx_type nz2 = nr*nc - nz1; - + SparseBoolMatrix r (nr, nc, nz2); - + octave_idx_type ii = 0; octave_idx_type jj = 0; r.cidx (0) = 0; @@ -259,13 +259,13 @@ // add one to the printed indices to go from // zero-based to one-based arrays - for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { octave_quit (); for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) os << a.ridx(i) + 1 << " " << j + 1 << " " << a.data(i) << "\n"; } - + return os; } @@ -278,23 +278,23 @@ } SparseBoolMatrix -SparseBoolMatrix::squeeze (void) const -{ - return Sparse::squeeze (); +SparseBoolMatrix::squeeze (void) const +{ + return Sparse::squeeze (); } SparseBoolMatrix -SparseBoolMatrix::index (const idx_vector& i, bool resize_ok) const -{ - return Sparse::index (i, resize_ok); +SparseBoolMatrix::index (const idx_vector& i, bool resize_ok) const +{ + return Sparse::index (i, resize_ok); } SparseBoolMatrix -SparseBoolMatrix::index (const idx_vector& i, const idx_vector& j, bool resize_ok) const -{ - return Sparse::index (i, j, resize_ok); +SparseBoolMatrix::index (const idx_vector& i, const idx_vector& j, bool resize_ok) const +{ + return Sparse::index (i, j, resize_ok); } - + SparseBoolMatrix SparseBoolMatrix::reshape (const dim_vector& new_dims) const { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/boolSparse.h --- a/liboctave/boolSparse.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/boolSparse.h Thu Jan 20 17:24:59 2011 -0500 @@ -40,25 +40,25 @@ SparseBoolMatrix (octave_idx_type r, octave_idx_type c) : Sparse (r, c) { } - explicit SparseBoolMatrix (octave_idx_type r, octave_idx_type c, bool val) + explicit SparseBoolMatrix (octave_idx_type r, octave_idx_type c, bool val) : Sparse (r, c, val) { } - SparseBoolMatrix (const dim_vector& dv, octave_idx_type nz = 0) : + SparseBoolMatrix (const dim_vector& dv, octave_idx_type nz = 0) : Sparse (dv, nz) { } SparseBoolMatrix (const Sparse& a) : Sparse (a) { } SparseBoolMatrix (const SparseBoolMatrix& a) : Sparse (a) { } - SparseBoolMatrix (const SparseBoolMatrix& a, const dim_vector& dv) + SparseBoolMatrix (const SparseBoolMatrix& a, const dim_vector& dv) : Sparse (a, dv) { } explicit SparseBoolMatrix (const boolMatrix& a) : Sparse (a) { } explicit SparseBoolMatrix (const boolNDArray& a) : Sparse (a) { } - SparseBoolMatrix (const Array& a, const idx_vector& r, - const idx_vector& c, octave_idx_type nr = -1, + SparseBoolMatrix (const Array& a, const idx_vector& r, + const idx_vector& c, octave_idx_type nr = -1, octave_idx_type nc = -1, bool sum_terms = true, octave_idx_type nzm = -1) : Sparse (a, r, c, nr, nc, sum_terms, nzm) { } @@ -74,7 +74,7 @@ bool operator == (const SparseBoolMatrix& a) const; bool operator != (const SparseBoolMatrix& a) const; - SparseBoolMatrix transpose (void) const + SparseBoolMatrix transpose (void) const { return Sparse::transpose (); } // destructive insert/delete/reorder operations @@ -83,7 +83,7 @@ SparseBoolMatrix& insert (const SparseBoolMatrix& a, const Array& indx); - SparseBoolMatrix concat (const SparseBoolMatrix& rb, + SparseBoolMatrix concat (const SparseBoolMatrix& rb, const Array& ra_idx); SparseBoolMatrix diag (octave_idx_type k = 0) const; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/bsxfun-defs.cc --- a/liboctave/bsxfun-defs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/bsxfun-defs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -113,7 +113,7 @@ { octave_quit (); - // Compute indices. + // Compute indices. // FIXME: performance impact noticeable? octave_idx_type xidx = cdvx.cum_compute_index (idx); octave_idx_type yidx = cdvy.cum_compute_index (idx); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/chMatrix.cc --- a/liboctave/chMatrix.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/chMatrix.cc Thu Jan 20 17:24:59 2011 -0500 @@ -130,7 +130,7 @@ } std::string -charMatrix::row_as_string (octave_idx_type r, bool strip_ws) const +charMatrix::row_as_string (octave_idx_type r, bool strip_ws) const { std::string retval; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/chNDArray.cc --- a/liboctave/chNDArray.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/chNDArray.cc Thu Jan 20 17:24:59 2011 -0500 @@ -120,7 +120,7 @@ ::increment_index (ra_idx, dimensions, start_dimension); } -octave_idx_type +octave_idx_type charNDArray::compute_index (Array& ra_idx, const dim_vector& dimensions) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/chNDArray.h --- a/liboctave/chNDArray.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/chNDArray.h Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ charNDArray (const dim_vector& dv) : Array (dv) { } charNDArray (const dim_vector& dv, char val) : Array (dv, val) { } - + charNDArray (const charNDArray& a) : Array (a) { } charNDArray (const charMatrix& a) : Array (a) { } @@ -75,7 +75,7 @@ charNDArray& insert (const charNDArray& a, octave_idx_type r, octave_idx_type c); charNDArray& insert (const charNDArray& a, const Array& ra_idx); - + charMatrix matrix_value (void) const; charNDArray squeeze (void) const { return Array::squeeze (); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/cmd-edit.cc --- a/liboctave/cmd-edit.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/cmd-edit.cc Thu Jan 20 17:24:59 2011 -0500 @@ -427,7 +427,7 @@ user_accept_line_function = f; if (f) - octave_rl_add_defun ("accept-line", gnu_readline::command_accept_line, + octave_rl_add_defun ("accept-line", gnu_readline::command_accept_line, ::octave_rl_ctrl ('M')); else octave_rl_add_defun ("accept-line", ::octave_rl_newline, @@ -848,7 +848,7 @@ #endif } -void +void command_editor::force_default_editor (void) { delete instance; @@ -1253,8 +1253,8 @@ } // Return a string which will be printed as a prompt. The string may -// contain special characters which are decoded as follows: -// +// contain special characters which are decoded as follows: +// // \a bell (ascii 07) // \d the date // \e escape (ascii 033) @@ -1427,7 +1427,7 @@ if (pos != std::string::npos) temp.resize (pos); - + goto add_string; } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/cmd-edit.h --- a/liboctave/cmd-edit.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/cmd-edit.h Thu Jan 20 17:24:59 2011 -0500 @@ -217,7 +217,7 @@ virtual std::string do_decode_prompt_string (const std::string&); - virtual std::string newline_chars (void) { return "\n"; } + virtual std::string newline_chars (void) { return "\n"; } virtual void do_restore_terminal_state (void) { } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/cmd-hist.cc --- a/liboctave/cmd-hist.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/cmd-hist.cc Thu Jan 20 17:24:59 2011 -0500 @@ -598,7 +598,7 @@ void command_history::read_range (const std::string& f, int from, int to, - bool must_exist) + bool must_exist) { if (instance_ok ()) instance->do_read_range (f, from, to, must_exist); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dColVector.h --- a/liboctave/dColVector.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dColVector.h Thu Jan 20 17:24:59 2011 -0500 @@ -39,7 +39,7 @@ explicit ColumnVector (octave_idx_type n) : MArray (dim_vector (n, 1)) { } - explicit ColumnVector (const dim_vector& dv) + explicit ColumnVector (const dim_vector& dv) : MArray (dv.as_column ()) { } ColumnVector (octave_idx_type n, double val) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dDiagMatrix.cc --- a/liboctave/dDiagMatrix.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dDiagMatrix.cc Thu Jan 20 17:24:59 2011 -0500 @@ -184,7 +184,7 @@ if (i < 0 || i >= r) { (*current_liboctave_error_handler) ("invalid row selection"); - return RowVector (); + return RowVector (); } RowVector retval (c, 0.0); @@ -200,7 +200,7 @@ if (! s) { (*current_liboctave_error_handler) ("invalid row selection"); - return RowVector (); + return RowVector (); } char c = *s; @@ -211,7 +211,7 @@ else { (*current_liboctave_error_handler) ("invalid row selection"); - return RowVector (); + return RowVector (); } } @@ -223,7 +223,7 @@ if (i < 0 || i >= c) { (*current_liboctave_error_handler) ("invalid column selection"); - return ColumnVector (); + return ColumnVector (); } ColumnVector retval (r, 0.0); @@ -239,7 +239,7 @@ if (! s) { (*current_liboctave_error_handler) ("invalid column selection"); - return ColumnVector (); + return ColumnVector (); } char c = *s; @@ -250,7 +250,7 @@ else { (*current_liboctave_error_handler) ("invalid column selection"); - return ColumnVector (); + return ColumnVector (); } } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dDiagMatrix.h --- a/liboctave/dDiagMatrix.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dDiagMatrix.h Thu Jan 20 17:24:59 2011 -0500 @@ -55,7 +55,7 @@ explicit DiagMatrix (const Array& a) : MDiagArray2 (a) { } - DiagMatrix (const Array& a, octave_idx_type r, octave_idx_type c) + DiagMatrix (const Array& a, octave_idx_type r, octave_idx_type c) : MDiagArray2 (a, r, c) { } DiagMatrix& operator = (const DiagMatrix& a) @@ -75,7 +75,7 @@ DiagMatrix& fill (const RowVector& a, octave_idx_type beg); DiagMatrix transpose (void) const { return MDiagArray2::transpose(); } - DiagMatrix abs (void) const; + DiagMatrix abs (void) const; friend OCTAVE_API DiagMatrix real (const ComplexDiagMatrix& a); friend OCTAVE_API DiagMatrix imag (const ComplexDiagMatrix& a); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dMatrix.cc --- a/liboctave/dMatrix.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dMatrix.cc Thu Jan 20 17:24:59 2011 -0500 @@ -117,7 +117,7 @@ F77_RET_T F77_FUNC (dsyrk, DSYRK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, const double&, const double*, const octave_idx_type&, const double&, double*, const octave_idx_type& F77_CHAR_ARG_LEN_DECL @@ -144,8 +144,8 @@ F77_RET_T F77_FUNC (dgecon, DGECON) (F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, double*, - const octave_idx_type&, const double&, double&, + const octave_idx_type&, double*, + const octave_idx_type&, const double&, double&, double*, octave_idx_type*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); @@ -182,33 +182,33 @@ F77_RET_T F77_FUNC (dpotrs, DPOTRS) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const octave_idx_type&, - const double*, const octave_idx_type&, double*, + const double*, const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (dtrtri, DTRTRI) (F77_CONST_CHAR_ARG_DECL, - F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, const double*, + F77_CONST_CHAR_ARG_DECL, + const octave_idx_type&, const double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (dtrcon, DTRCON) (F77_CONST_CHAR_ARG_DECL, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const double*, const octave_idx_type&, double&, - double*, octave_idx_type*, octave_idx_type& + double*, octave_idx_type*, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (dtrtrs, DTRTRS) (F77_CONST_CHAR_ARG_DECL, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const octave_idx_type&, - const double*, const octave_idx_type&, double*, + const double*, const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL @@ -234,7 +234,7 @@ const octave_idx_type&, const octave_idx_type&, const double*, const octave_idx_type&, double*, double& - F77_CHAR_ARG_LEN_DECL); + F77_CHAR_ARG_LEN_DECL); } // Matrix class. @@ -670,7 +670,7 @@ } Matrix -Matrix::tinverse (MatrixType &mattype, octave_idx_type& info, double& rcon, +Matrix::tinverse (MatrixType &mattype, octave_idx_type& info, double& rcon, int force, int calc_cond) const { Matrix retval; @@ -690,15 +690,15 @@ F77_XFCN (dtrtri, DTRTRI, (F77_CONST_CHAR_ARG2 (&uplo, 1), F77_CONST_CHAR_ARG2 (&udiag, 1), - nr, tmp_data, nr, info + nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) info = -1; - else if (calc_cond) + else if (calc_cond) { octave_idx_type dtrcon_info = 0; char job = '1'; @@ -709,13 +709,13 @@ F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&job, 1), F77_CONST_CHAR_ARG2 (&uplo, 1), F77_CONST_CHAR_ARG2 (&udiag, 1), - nr, tmp_data, nr, rcon, - work, iwork, dtrcon_info + nr, tmp_data, nr, rcon, + work, iwork, dtrcon_info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (dtrcon_info != 0) + if (dtrcon_info != 0) info = -1; } @@ -728,7 +728,7 @@ Matrix -Matrix::finverse (MatrixType &mattype, octave_idx_type& info, double& rcon, +Matrix::finverse (MatrixType &mattype, octave_idx_type& info, double& rcon, int force, int calc_cond) const { Matrix retval; @@ -750,7 +750,7 @@ octave_idx_type lwork = -1; // Query the optimum work array size. - F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt, + F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt, z.fortran_vec (), lwork, info)); lwork = static_cast (z(0)); @@ -762,16 +762,16 @@ // Calculate the norm of the matrix, for later use. double anorm = 0; - if (calc_cond) + if (calc_cond) anorm = retval.abs().sum().row(static_cast(0)).max(); F77_XFCN (dgetrf, DGETRF, (nc, nc, tmp_data, nr, pipvt, info)); // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) info = -1; - else if (calc_cond) + else if (calc_cond) { octave_idx_type dgecon_info = 0; @@ -780,11 +780,11 @@ Array iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, piz, dgecon_info F77_CHAR_ARG_LEN (1))); - if (dgecon_info != 0) + if (dgecon_info != 0) info = -1; } @@ -797,7 +797,7 @@ F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt, pz, lwork, dgetri_info)); - if (dgetri_info != 0) + if (dgetri_info != 0) info = -1; } @@ -809,7 +809,7 @@ } Matrix -Matrix::inverse (MatrixType &mattype, octave_idx_type& info, double& rcon, +Matrix::inverse (MatrixType &mattype, octave_idx_type& info, double& rcon, int force, int calc_cond) const { int typ = mattype.type (false); @@ -910,7 +910,7 @@ const double *in (fortran_vec ()); Complex *out (retval.fortran_vec ()); - octave_fftw::fft (in, out, npts, nsamples); + octave_fftw::fft (in, out, npts, nsamples); return retval; } @@ -940,7 +940,7 @@ Complex *in (tmp.fortran_vec ()); Complex *out (retval.fortran_vec ()); - octave_fftw::ifft (in, out, npts, nsamples); + octave_fftw::ifft (in, out, npts, nsamples); return retval; } @@ -1259,7 +1259,7 @@ if (typ == MatrixType::Lower || typ == MatrixType::Upper) { - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval *= elem (i,i); } else if (typ == MatrixType::Hermitian) @@ -1273,17 +1273,17 @@ char job = 'L'; - F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) { rcon = 0.0; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { Array z (dim_vector (3 * nc, 1)); double *pz = z.fortran_vec (); @@ -1295,10 +1295,10 @@ rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval *= atmp (i,i); retval = retval.square (); @@ -1325,14 +1325,14 @@ // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) { info = -1; retval = DET (); - } - else + } + else { - if (calc_cond) + if (calc_cond) { // Now calc the condition number for non-singular matrix. char job = '1'; @@ -1342,19 +1342,19 @@ octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); } - if (info != 0) + if (info != 0) { info = -1; retval = DET (); - } - else + } + else { - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { double c = atmp(i,i); retval *= (ipvt(i) != (i+1)) ? -c : c; @@ -1406,16 +1406,16 @@ Array iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, piz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } else if (typ == MatrixType::Permuted_Upper) @@ -1434,16 +1434,16 @@ Array iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, piz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } else if (typ == MatrixType::Permuted_Lower) @@ -1462,17 +1462,17 @@ anorm = atmp.abs().sum(). row(static_cast(0)).max(); - F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) { rcon = 0.0; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { Array z (dim_vector (3 * nc, 1)); double *pz = z.fortran_vec (); @@ -1484,7 +1484,7 @@ rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } } @@ -1507,20 +1507,20 @@ F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info)); - if (info != 0) + if (info != 0) { rcon = 0.0; mattype.mark_as_rectangular (); } - else + else { char job = '1'; F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } } @@ -1578,16 +1578,16 @@ Array iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, piz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile double rcond_plus_one = rcon + 1.0; @@ -1614,9 +1614,9 @@ char trans = get_blas_char (transt); char dia = 'N'; - F77_XFCN (dtrtrs, DTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&trans, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (dtrtrs, DTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&trans, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, b_nc, tmp_data, nr, result, nr, info F77_CHAR_ARG_LEN (1) @@ -1678,16 +1678,16 @@ Array iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (dtrcon, DTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, piz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile double rcond_plus_one = rcon + 1.0; @@ -1714,9 +1714,9 @@ char trans = get_blas_char (transt); char dia = 'N'; - F77_XFCN (dtrtrs, DTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&trans, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (dtrtrs, DTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&trans, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, b_nc, tmp_data, nr, result, nr, info F77_CHAR_ARG_LEN (1) @@ -1750,7 +1750,7 @@ else { volatile int typ = mattype.type (); - + // Calculate the norm of the matrix, for later use. double anorm = -1.; @@ -1762,20 +1762,20 @@ double *tmp_data = atmp.fortran_vec (); anorm = atmp.abs().sum().row(static_cast(0)).max(); - F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) { info = -2; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { if (calc_cond) { @@ -1789,7 +1789,7 @@ rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile double rcond_plus_one = rcon + 1.0; @@ -1823,7 +1823,7 @@ { mattype.mark_as_unsymmetric (); typ = MatrixType::Full; - } + } } } @@ -1848,7 +1848,7 @@ // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) { info = -2; @@ -1860,19 +1860,19 @@ mattype.mark_as_rectangular (); } - else + else { if (calc_cond) { - // Now calculate the condition number for + // Now calculate the condition number for // non-singular matrix. char job = '1'; F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile double rcond_plus_one = rcon + 1.0; @@ -1930,7 +1930,7 @@ } Matrix -Matrix::solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, +Matrix::solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcon) const { return solve (typ, b, info, rcon, 0); @@ -1981,7 +1981,7 @@ } ComplexMatrix -Matrix::solve (MatrixType &typ, const ComplexMatrix& b, +Matrix::solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info) const { double rcon; @@ -2040,7 +2040,7 @@ } ColumnVector -Matrix::solve (MatrixType &typ, const ColumnVector& b, +Matrix::solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info) const { double rcon; @@ -2071,7 +2071,7 @@ } ComplexColumnVector -Matrix::solve (MatrixType &typ, const ComplexColumnVector& b, +Matrix::solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info) const { ComplexMatrix tmp (*this); @@ -2079,7 +2079,7 @@ } ComplexColumnVector -Matrix::solve (MatrixType &typ, const ComplexColumnVector& b, +Matrix::solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info, double& rcon) const { ComplexMatrix tmp (*this); @@ -2087,7 +2087,7 @@ } ComplexColumnVector -Matrix::solve (MatrixType &typ, const ComplexColumnVector& b, +Matrix::solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const { @@ -2358,7 +2358,7 @@ F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, - work.fortran_vec (), lwork, + work.fortran_vec (), lwork, piwork, info)); if (s.elem (0) == 0.0) @@ -2392,7 +2392,7 @@ } ComplexMatrix -Matrix::lssolve (const ComplexMatrix& b, octave_idx_type& info, +Matrix::lssolve (const ComplexMatrix& b, octave_idx_type& info, octave_idx_type& rank) const { ComplexMatrix tmp (*this); @@ -2401,7 +2401,7 @@ } ComplexMatrix -Matrix::lssolve (const ComplexMatrix& b, octave_idx_type& info, +Matrix::lssolve (const ComplexMatrix& b, octave_idx_type& info, octave_idx_type& rank, double& rcon) const { ComplexMatrix tmp (*this); @@ -2454,7 +2454,7 @@ volatile octave_idx_type minmn = (m < n ? m : n); octave_idx_type maxmn = m > n ? m : n; rcon = -1.0; - + if (m != n) { retval = ColumnVector (maxmn, 0.0); @@ -2512,7 +2512,7 @@ F77_XFCN (dgelsd, DGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, - work.fortran_vec (), lwork, + work.fortran_vec (), lwork, piwork, info)); if (rank < minmn) @@ -2549,7 +2549,7 @@ } ComplexColumnVector -Matrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info, +Matrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const { ComplexMatrix tmp (*this); @@ -2558,7 +2558,7 @@ } ComplexColumnVector -Matrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info, +Matrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info, octave_idx_type& rank, double &rcon) const { ComplexMatrix tmp (*this); @@ -2633,7 +2633,7 @@ retval = Matrix (len, a_len); double *c = retval.fortran_vec (); - + F77_XFCN (dgemm, DGEMM, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 ("N", 1), len, a_len, 1, 1.0, v.data (), len, @@ -3063,7 +3063,7 @@ SCHUR as (a, "U"); SCHUR bs (b, "U"); - + // Transform c to new coordinates. Matrix ua = as.unitary_matrix (); @@ -3071,9 +3071,9 @@ Matrix ub = bs.unitary_matrix (); Matrix sch_b = bs.schur_matrix (); - + Matrix cx = ua.transpose () * c * ub; - + // Solve the sylvester equation, back-transform, and return the // solution. @@ -3096,7 +3096,7 @@ // FIXME -- check info? - + retval = -ua*cx*ub.transpose (); return retval; @@ -3130,8 +3130,8 @@ // the general GEMM operation -Matrix -xgemm (const Matrix& a, const Matrix& b, +Matrix +xgemm (const Matrix& a, const Matrix& b, blas_trans_type transa, blas_trans_type transb) { Matrix retval; @@ -3362,8 +3362,8 @@ return result; } -Matrix linspace (const ColumnVector& x1, - const ColumnVector& x2, +Matrix linspace (const ColumnVector& x1, + const ColumnVector& x2, octave_idx_type n) { @@ -3381,7 +3381,7 @@ retval(i, 0) = x1(i); // The last column is not needed while using delta. - double *delta = &retval(0, n-1); + double *delta = &retval(0, n-1); for (octave_idx_type i = 0; i < m; i++) delta[i] = (x2(i) - x1(i)) / (n - 1); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dMatrix.h --- a/liboctave/dMatrix.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dMatrix.h Thu Jan 20 17:24:59 2011 -0500 @@ -132,10 +132,10 @@ } private: - Matrix tinverse (MatrixType &mattype, octave_idx_type& info, double& rcon, + Matrix tinverse (MatrixType &mattype, octave_idx_type& info, double& rcon, int force, int calc_cond) const; - Matrix finverse (MatrixType &mattype, octave_idx_type& info, double& rcon, + Matrix finverse (MatrixType &mattype, octave_idx_type& info, double& rcon, int force, int calc_cond) const; public: @@ -160,7 +160,7 @@ DET determinant (void) const; DET determinant (octave_idx_type& info) const; DET determinant (octave_idx_type& info, double& rcon, int calc_cond = 1) const; - DET determinant (MatrixType &mattype, octave_idx_type& info, + DET determinant (MatrixType &mattype, octave_idx_type& info, double& rcon, int calc_cond = 1) const; double rcond (void) const; @@ -186,42 +186,42 @@ // Generic interface to solver with no probing of type Matrix solve (MatrixType &typ, const Matrix& b) const; Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info) const; - Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, + Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcon) const; Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, bool singular_fallback = true, blas_trans_type transt = blas_no_trans) const; ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; - ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, + ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info) const; - ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, + ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcon) const; - ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, + ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcon, solve_singularity_handler sing_handler, - bool singular_fallback = true, + bool singular_fallback = true, blas_trans_type transt = blas_no_trans) const; ColumnVector solve (MatrixType &typ, const ColumnVector& b) const; - ColumnVector solve (MatrixType &typ, const ColumnVector& b, + ColumnVector solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info) const; - ColumnVector solve (MatrixType &typ, const ColumnVector& b, + ColumnVector solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info, double& rcon) const; - ColumnVector solve (MatrixType &typ, const ColumnVector& b, + ColumnVector solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; - ComplexColumnVector solve (MatrixType &typ, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b) const; - ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info) const; - ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info, double& rcon) const; - ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; // Generic interface to solver with probing of type @@ -229,21 +229,21 @@ Matrix solve (const Matrix& b, octave_idx_type& info) const; Matrix solve (const Matrix& b, octave_idx_type& info, double& rcon) const; Matrix solve (const Matrix& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ComplexMatrix solve (const ComplexMatrix& b) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ColumnVector solve (const ColumnVector& b) const; ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon) const; ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; ComplexColumnVector solve (const ComplexColumnVector& b) const; @@ -251,15 +251,15 @@ ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcon) const; ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, - double& rcon, solve_singularity_handler sing_handler, + double& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; // Singular solvers Matrix lssolve (const Matrix& b) const; Matrix lssolve (const Matrix& b, octave_idx_type& info) const; - Matrix lssolve (const Matrix& b, octave_idx_type& info, + Matrix lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank) const; - Matrix lssolve (const Matrix& b, octave_idx_type& info, + Matrix lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank, double& rcon) const; ComplexMatrix lssolve (const ComplexMatrix& b) const; @@ -277,12 +277,12 @@ octave_idx_type& rank, double& rcon) const; ComplexColumnVector lssolve (const ComplexColumnVector& b) const; - ComplexColumnVector lssolve (const ComplexColumnVector& b, + ComplexColumnVector lssolve (const ComplexColumnVector& b, octave_idx_type& info) const; ComplexColumnVector lssolve (const ComplexColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const; - ComplexColumnVector lssolve (const ComplexColumnVector& b, + ComplexColumnVector lssolve (const ComplexColumnVector& b, octave_idx_type& info, octave_idx_type& rank, double& rcon) const; @@ -302,7 +302,7 @@ bool all_elements_are_int_or_inf_or_nan (void) const; bool all_integers (double& max_val, double& min_val) const; bool too_large_for_float (void) const; - + boolMatrix all (int dim = -1) const; boolMatrix any (int dim = -1) const; @@ -351,7 +351,7 @@ extern OCTAVE_API Matrix Sylvester (const Matrix&, const Matrix&, const Matrix&); extern OCTAVE_API Matrix xgemm (const Matrix& a, const Matrix& b, - blas_trans_type transa = blas_no_trans, + blas_trans_type transa = blas_no_trans, blas_trans_type transb = blas_no_trans); extern OCTAVE_API Matrix operator * (const Matrix& a, const Matrix& b); @@ -364,8 +364,8 @@ extern OCTAVE_API Matrix max (const Matrix& m, double d); extern OCTAVE_API Matrix max (const Matrix& a, const Matrix& b); -extern OCTAVE_API Matrix linspace (const ColumnVector& x1, - const ColumnVector& x2, +extern OCTAVE_API Matrix linspace (const ColumnVector& x1, + const ColumnVector& x2, octave_idx_type n); MS_CMP_OP_DECLS (Matrix, double, OCTAVE_API) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dNDArray.cc --- a/liboctave/dNDArray.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dNDArray.cc Thu Jan 20 17:24:59 2011 -0500 @@ -57,7 +57,7 @@ if (zero_based) for (octave_idx_type i = 0; i < a.numel (); i++) { - double val = static_cast + double val = static_cast (pa[i] + static_cast (1)); if (val <= 0) ptmp[i] = nan_val; @@ -78,7 +78,7 @@ { if (zero_based) for (octave_idx_type i = 0; i < a.numel (); i++) - ptmp[i] = static_cast + ptmp[i] = static_cast (pa[i] + static_cast (1)); else for (octave_idx_type i = 0; i < a.numel (); i++) @@ -121,7 +121,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) - octave_fftw::fft (in + k * stride * n, out + k * stride * n, + octave_fftw::fft (in + k * stride * n, out + k * stride * n, n, howmany, stride, dist); return retval; @@ -151,7 +151,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) - octave_fftw::ifft (out + k * stride * n, out + k * stride * n, + octave_fftw::ifft (out + k * stride * n, out + k * stride * n, n, howmany, stride, dist); return retval; @@ -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 (npts); } } @@ -360,7 +360,7 @@ Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -408,7 +408,7 @@ Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -427,7 +427,7 @@ 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 (npts); } } @@ -456,7 +456,7 @@ Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -503,7 +503,7 @@ Complex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -923,5 +923,5 @@ BSXFUN_STDREL_DEFS_MXLOOP (NDArray) BSXFUN_OP_DEF_MXLOOP (pow, NDArray, mx_inline_pow) -BSXFUN_OP2_DEF_MXLOOP (pow, ComplexNDArray, ComplexNDArray, +BSXFUN_OP2_DEF_MXLOOP (pow, ComplexNDArray, ComplexNDArray, NDArray, mx_inline_pow) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dNDArray.h --- a/liboctave/dNDArray.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dNDArray.h Thu Jan 20 17:24:59 2011 -0500 @@ -45,12 +45,12 @@ NDArray (const dim_vector& dv, double val) : MArray (dv, val) { } - + NDArray (const NDArray& a) : MArray (a) { } NDArray (const Matrix& a) : MArray (a) { } - NDArray (const Array& a, bool zero_based = false, + NDArray (const Array& a, bool zero_based = false, bool negative_to_nan = false); template @@ -62,7 +62,7 @@ template explicit NDArray (const intNDArray& a) : MArray (a) { } - NDArray (const charNDArray&); + NDArray (const charNDArray&); NDArray& operator = (const NDArray& a) { @@ -92,8 +92,8 @@ NDArray cumprod (int dim = -1) const; NDArray cumsum (int dim = -1) const; NDArray prod (int dim = -1) const; - NDArray sum (int dim = -1) const; - NDArray xsum (int dim = -1) const; + NDArray sum (int dim = -1) const; + NDArray xsum (int dim = -1) const; NDArray sumsq (int dim = -1) const; NDArray concat (const NDArray& rb, const Array& ra_idx); ComplexNDArray concat (const ComplexNDArray& rb, const Array& ra_idx); @@ -103,7 +103,7 @@ NDArray max (Array& index, int dim = -1) const; NDArray min (int dim = -1) const; NDArray min (Array& index, int dim = -1) const; - + NDArray cummax (int dim = -1) const; NDArray cummax (Array& index, int dim = -1) const; NDArray cummin (int dim = -1) const; @@ -153,10 +153,10 @@ NDArray diag (octave_idx_type k = 0) const; - NDArray& changesign (void) - { - MArray::changesign (); - return *this; + NDArray& changesign (void) + { + MArray::changesign (); + return *this; } }; @@ -183,7 +183,7 @@ BSXFUN_STDREL_DECLS (NDArray, OCTAVE_API) BSXFUN_OP_DECL (pow, NDArray, OCTAVE_API) -BSXFUN_OP2_DECL (pow, ComplexNDArray, ComplexNDArray, +BSXFUN_OP2_DECL (pow, ComplexNDArray, ComplexNDArray, NDArray, OCTAVE_API) #endif diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dSparse.cc --- a/liboctave/dSparse.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dSparse.cc Thu Jan 20 17:24:59 2011 -0500 @@ -184,7 +184,7 @@ : MSparse (a.rows (), a.cols (), a.rows ()) { octave_idx_type n = a.rows (); - for (octave_idx_type i = 0; i <= n; i++) + for (octave_idx_type i = 0; i <= n; i++) cidx (i) = i; const Array pv = a.pvec (); @@ -302,7 +302,7 @@ if (dv.numel () == 0 || dim >= dv.length ()) return result; - + if (dim < 0) dim = dv.first_non_singleton (); @@ -382,7 +382,7 @@ found = true; break; } - + if (!found) idx_arg.elem(i) = j; @@ -451,7 +451,7 @@ if (dv.numel () == 0 || dim >= dv.length ()) return result; - + if (dim < 0) dim = dv.first_non_singleton (); @@ -531,7 +531,7 @@ found = true; break; } - + if (!found) idx_arg.elem(i) = j; @@ -585,7 +585,7 @@ return result; } -RowVector +RowVector SparseMatrix::row (octave_idx_type i) const { octave_idx_type nc = columns (); @@ -604,7 +604,7 @@ return retval; } -ColumnVector +ColumnVector SparseMatrix::column (octave_idx_type i) const { octave_idx_type nr = rows (); @@ -674,7 +674,7 @@ return r; } -SparseMatrix +SparseMatrix atan2 (const double& x, const SparseMatrix& y) { octave_idx_type nr = y.rows (); @@ -696,7 +696,7 @@ } } -SparseMatrix +SparseMatrix atan2 (const SparseMatrix& x, const double& y) { octave_idx_type nr = x.rows (); @@ -737,12 +737,12 @@ return retval; } -SparseMatrix +SparseMatrix atan2 (const SparseMatrix& x, const SparseMatrix& y) { 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 (); @@ -755,7 +755,7 @@ else { r = SparseMatrix (x_nr, x_nc, (x.nnz () + y.nnz ())); - + octave_idx_type jx = 0; r.cidx (0) = 0; for (octave_idx_type i = 0 ; i < x_nc ; i++) @@ -763,11 +763,11 @@ octave_idx_type ja = x.cidx(i); octave_idx_type ja_max = x.cidx(i+1); bool ja_lt_max= ja < ja_max; - + octave_idx_type jb = y.cidx(i); octave_idx_type jb_max = y.cidx(i+1); bool jb_lt_max = jb < jb_max; - + while (ja_lt_max || jb_lt_max ) { octave_quit (); @@ -803,7 +803,7 @@ } r.cidx(i+1) = jx; } - + r.maybe_compress (); } } @@ -837,9 +837,9 @@ return inverse (mattype, info, rcond, 0, 0); } -SparseMatrix -SparseMatrix::dinverse (MatrixType &mattyp, octave_idx_type& info, - double& rcond, const bool, +SparseMatrix +SparseMatrix::dinverse (MatrixType &mattyp, octave_idx_type& info, + double& rcond, const bool, const bool calccond) const { SparseMatrix retval; @@ -863,13 +863,13 @@ retval = transpose(); else retval = *this; - + // Force make_unique to be called double *v = retval.data(); if (calccond) { - double dmax = 0., dmin = octave_Inf; + double dmax = 0., dmin = octave_Inf; for (octave_idx_type i = 0; i < nr; i++) { double tmp = fabs(v[i]); @@ -891,9 +891,9 @@ return retval; } -SparseMatrix -SparseMatrix::tinverse (MatrixType &mattyp, octave_idx_type& info, - double& rcond, const bool, +SparseMatrix +SparseMatrix::tinverse (MatrixType &mattyp, octave_idx_type& info, + double& rcond, const bool, const bool calccond) const { SparseMatrix retval; @@ -910,7 +910,7 @@ int typ = mattyp.type (); mattyp.info (); - if (typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper || + if (typ == MatrixType::Upper || typ == MatrixType::Permuted_Upper || typ == MatrixType::Lower || typ == MatrixType::Permuted_Lower) { double anorm = 0.; @@ -941,7 +941,7 @@ octave_quit (); // place the 1 in the identity position octave_idx_type cx_colstart = cx; - + if (cx == nz2) { nz2 *= 2; @@ -954,7 +954,7 @@ cx++; // iterate accross columns of input matrix - for (octave_idx_type j = i+1; j < nr; j++) + for (octave_idx_type j = i+1; j < nr; j++) { double v = 0.; // iterate to calculate sum @@ -964,7 +964,7 @@ if (cidx(j) == cidx(j+1)) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("division by zero"); goto inverse_singular; } @@ -975,17 +975,17 @@ rpX = retval.xridx(colXp); rpU = ridx(colUp); - if (rpX < rpU) + if (rpX < rpU) colXp++; - else if (rpX > rpU) + else if (rpX > rpU) colUp++; - else + else { v -= retval.xdata(colXp) * data(colUp); colXp++; colUp++; } - } while ((rpX ainvnorm) ainvnorm = atmp; } - rcond = 1. / ainvnorm / anorm; + rcond = 1. / ainvnorm / anorm; } } else @@ -1169,7 +1169,7 @@ } SparseMatrix -SparseMatrix::inverse (MatrixType &mattype, octave_idx_type& info, +SparseMatrix::inverse (MatrixType &mattype, octave_idx_type& info, double& rcond, int, int calc_cond) const { int typ = mattype.type (false); @@ -1221,7 +1221,7 @@ 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(); @@ -1285,7 +1285,7 @@ if (!xisnan (tmp)) Control (UMFPACK_FIXQ) = tmp; - // Turn-off UMFPACK scaling for LU + // Turn-off UMFPACK scaling for LU Control (UMFPACK_SCALE) = UMFPACK_SCALE_NONE; UMFPACK_DNAME (report_control) (control); @@ -1299,12 +1299,12 @@ void *Symbolic; Matrix Info (1, UMFPACK_INFO); double *info = Info.fortran_vec (); - int status = UMFPACK_DNAME (qsymbolic) (nr, nc, Ap, Ai, + int status = UMFPACK_DNAME (qsymbolic) (nr, nc, Ap, Ai, Ax, 0, &Symbolic, control, info); if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::determinant symbolic factorization failed"); UMFPACK_DNAME (report_status) (control, status); @@ -1317,7 +1317,7 @@ UMFPACK_DNAME (report_symbolic) (Symbolic, control); void *Numeric; - status = UMFPACK_DNAME (numeric) (Ap, Ai, Ax, Symbolic, + status = UMFPACK_DNAME (numeric) (Ap, Ai, Ax, Symbolic, &Numeric, control, info) ; UMFPACK_DNAME (free_symbolic) (&Symbolic) ; @@ -1325,7 +1325,7 @@ if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::determinant numeric factorization failed"); UMFPACK_DNAME (report_status) (control, status); @@ -1343,9 +1343,9 @@ if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::determinant error calculating determinant"); - + UMFPACK_DNAME (report_status) (control, status); UMFPACK_DNAME (report_info) (control, info); } @@ -1365,7 +1365,7 @@ Matrix SparseMatrix::dsolve (MatrixType &mattype, const Matrix& b, octave_idx_type& err, - double& rcond, solve_singularity_handler, + double& rcond, solve_singularity_handler, bool calc_cond) const { Matrix retval; @@ -1402,7 +1402,7 @@ if (calc_cond) { - double dmax = 0., dmin = octave_Inf; + double dmax = 0., dmin = octave_Inf; for (octave_idx_type i = 0; i < nm; i++) { double tmp = fabs(data(i)); @@ -1424,8 +1424,8 @@ } SparseMatrix -SparseMatrix::dsolve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& err, double& rcond, +SparseMatrix::dsolve (MatrixType &mattype, const SparseMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler, bool calc_cond) const { SparseMatrix retval; @@ -1492,7 +1492,7 @@ if (calc_cond) { - double dmax = 0., dmin = octave_Inf; + double dmax = 0., dmin = octave_Inf; for (octave_idx_type i = 0; i < nm; i++) { double tmp = fabs(data(i)); @@ -1549,10 +1549,10 @@ 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); - + if (calc_cond) { - double dmax = 0., dmin = octave_Inf; + double dmax = 0., dmin = octave_Inf; for (octave_idx_type i = 0; i < nm; i++) { double tmp = fabs(data(i)); @@ -1575,7 +1575,7 @@ SparseComplexMatrix SparseMatrix::dsolve (MatrixType &mattype, const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler, bool calc_cond) const { SparseComplexMatrix retval; @@ -1639,10 +1639,10 @@ } retval.xcidx(j+1) = ii; } - + if (calc_cond) { - double dmax = 0., dmin = octave_Inf; + double dmax = 0., dmin = octave_Inf; for (octave_idx_type i = 0; i < nm; i++) { double tmp = fabs(data(i)); @@ -1666,7 +1666,7 @@ Matrix SparseMatrix::utsolve (MatrixType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, bool calc_cond) const { Matrix retval; @@ -1732,11 +1732,11 @@ { err = -2; goto triangular_error; - } + } double tmp = work[k] / data(cidx(kidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(kidx); + for (octave_idx_type i = cidx(kidx); i < cidx(kidx+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -1767,7 +1767,7 @@ { double tmp = work[k] / data(cidx(iidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(iidx); + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { octave_idx_type idx2 = ridx(i); @@ -1808,7 +1808,7 @@ { err = -2; goto triangular_error; - } + } double tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; @@ -1900,7 +1900,7 @@ SparseMatrix SparseMatrix::utsolve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -1976,11 +1976,11 @@ { err = -2; goto triangular_error; - } + } double tmp = work[k] / data(cidx(kidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(kidx); + for (octave_idx_type i = cidx(kidx); i < cidx(kidx+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -2033,7 +2033,7 @@ { double tmp = work[k] / data(cidx(iidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(iidx); + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { octave_idx_type idx2 = ridx(i); @@ -2073,7 +2073,7 @@ { err = -2; goto triangular_error; - } + } double tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; @@ -2127,7 +2127,7 @@ { double tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -2186,8 +2186,8 @@ } ComplexMatrix -SparseMatrix::utsolve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& err, double& rcond, +SparseMatrix::utsolve (MatrixType &mattype, const ComplexMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -2208,7 +2208,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Upper || typ == MatrixType::Upper) { @@ -2254,11 +2254,11 @@ { err = -2; goto triangular_error; - } + } Complex tmp = cwork[k] / data(cidx(kidx+1)-1); cwork[k] = tmp; - for (octave_idx_type i = cidx(kidx); + for (octave_idx_type i = cidx(kidx); i < cidx(kidx+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -2290,7 +2290,7 @@ { double tmp = work[k] / data(cidx(iidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(iidx); + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { octave_idx_type idx2 = ridx(i); @@ -2331,7 +2331,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = cwork[k] / data(cidx(k+1)-1); cwork[k] = tmp; @@ -2364,7 +2364,7 @@ { double tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -2425,7 +2425,7 @@ SparseComplexMatrix SparseMatrix::utsolve (MatrixType &mattype, const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -2446,7 +2446,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Upper || typ == MatrixType::Upper) { @@ -2501,11 +2501,11 @@ { err = -2; goto triangular_error; - } + } Complex tmp = cwork[k] / data(cidx(kidx+1)-1); cwork[k] = tmp; - for (octave_idx_type i = cidx(kidx); + for (octave_idx_type i = cidx(kidx); i < cidx(kidx+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -2559,7 +2559,7 @@ { double tmp = work[k] / data(cidx(iidx+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(iidx); + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { octave_idx_type idx2 = ridx(i); @@ -2599,7 +2599,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = cwork[k] / data(cidx(k+1)-1); cwork[k] = tmp; @@ -2654,7 +2654,7 @@ { double tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { octave_idx_type iidx = ridx(i); @@ -2736,7 +2736,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) { @@ -2790,7 +2790,7 @@ { err = -2; goto triangular_error; - } + } double tmp = work[k] / data(mini); work[k] = tmp; @@ -2826,7 +2826,7 @@ octave_idx_type minr = nr; octave_idx_type mini = 0; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) if (perm[ridx(i)] < minr) { @@ -2836,7 +2836,7 @@ double tmp = work[k] / data(mini); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) { if (i == mini) @@ -2880,11 +2880,11 @@ { err = -2; goto triangular_error; - } + } double tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (octave_idx_type i = cidx(k)+1; + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { octave_idx_type iidx = ridx(i); @@ -2914,7 +2914,7 @@ { double tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (octave_idx_type i = cidx(k)+1; + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { octave_idx_type iidx = ridx(i); @@ -2974,8 +2974,8 @@ } SparseMatrix -SparseMatrix::ltsolve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& err, double& rcond, +SparseMatrix::ltsolve (MatrixType &mattype, const SparseMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -2996,7 +2996,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) { @@ -3054,7 +3054,7 @@ { err = -2; goto triangular_error; - } + } double tmp = work[k] / data(mini); work[k] = tmp; @@ -3112,7 +3112,7 @@ octave_idx_type minr = nr; octave_idx_type mini = 0; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) if (perm[ridx(i)] < minr) { @@ -3122,7 +3122,7 @@ double tmp = work[k] / data(mini); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) { if (i == mini) @@ -3166,7 +3166,7 @@ { err = -2; goto triangular_error; - } + } double tmp = work[k] / data(cidx(k)); work[k] = tmp; @@ -3221,7 +3221,7 @@ { double tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (octave_idx_type i = cidx(k)+1; + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { octave_idx_type iidx = ridx(i); @@ -3281,8 +3281,8 @@ } ComplexMatrix -SparseMatrix::ltsolve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& err, double& rcond, +SparseMatrix::ltsolve (MatrixType &mattype, const ComplexMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -3303,7 +3303,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) { @@ -3356,7 +3356,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = cwork[k] / data(mini); cwork[k] = tmp; @@ -3393,7 +3393,7 @@ octave_idx_type minr = nr; octave_idx_type mini = 0; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) if (perm[ridx(i)] < minr) { @@ -3403,7 +3403,7 @@ double tmp = work[k] / data(mini); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) { if (i == mini) @@ -3448,7 +3448,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = cwork[k] / data(cidx(k)); cwork[k] = tmp; @@ -3482,7 +3482,7 @@ { double tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (octave_idx_type i = cidx(k)+1; + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { octave_idx_type iidx = ridx(i); @@ -3543,7 +3543,7 @@ SparseComplexMatrix SparseMatrix::ltsolve (MatrixType &mattype, const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -3564,7 +3564,7 @@ // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Permuted_Lower || typ == MatrixType::Lower) { @@ -3622,7 +3622,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = cwork[k] / data(mini); cwork[k] = tmp; @@ -3681,7 +3681,7 @@ octave_idx_type minr = nr; octave_idx_type mini = 0; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) if (perm[ridx(i)] < minr) { @@ -3691,7 +3691,7 @@ double tmp = work[k] / data(mini); work[k] = tmp; - for (octave_idx_type i = cidx(k); + for (octave_idx_type i = cidx(k); i < cidx(k+1); i++) { if (i == mini) @@ -3735,7 +3735,7 @@ { err = -2; goto triangular_error; - } + } Complex tmp = cwork[k] / data(cidx(k)); cwork[k] = tmp; @@ -3791,7 +3791,7 @@ { double tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (octave_idx_type i = cidx(k)+1; + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { octave_idx_type iidx = ridx(i); @@ -3868,14 +3868,14 @@ else if (nr == 0 || b.cols () == 0) retval = Matrix (nc, b.cols (), 0.0); else if (calc_cond) - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("calculation of condition number not implemented"); else { // Print spparms("spumoni") info if requested volatile int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Tridiagonal_Hermitian) { OCTAVE_LOCAL_BUFFER (double, D, nr); @@ -3911,12 +3911,12 @@ DL[j] = data(i); } } - + octave_idx_type b_nc = b.cols(); retval = b; double *result = retval.fortran_vec (); - F77_XFCN (dptsv, DPTSV, (nr, b_nc, D, DL, result, + F77_XFCN (dptsv, DPTSV, (nr, b_nc, D, DL, result, b.rows(), err)); if (err != 0) @@ -3925,7 +3925,7 @@ mattype.mark_as_unsymmetric (); typ = MatrixType::Tridiagonal; } - else + else rcond = 1.; } @@ -3973,7 +3973,7 @@ retval = b; double *result = retval.fortran_vec (); - F77_XFCN (dgtsv, DGTSV, (nr, b_nc, DL, D, DU, result, + F77_XFCN (dgtsv, DGTSV, (nr, b_nc, DL, D, DU, result, b.rows(), err)); if (err != 0) @@ -3990,8 +3990,8 @@ (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else + } + else rcond = 1.; } else if (typ != MatrixType::Tridiagonal_Hermitian) @@ -4002,8 +4002,8 @@ } SparseMatrix -SparseMatrix::trisolve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& err, double& rcond, +SparseMatrix::trisolve (MatrixType &mattype, const SparseMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -4019,14 +4019,14 @@ else if (nr == 0 || b.cols () == 0) retval = SparseMatrix (nc, b.cols ()); else if (calc_cond) - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("calculation of condition number not implemented"); else { // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + // Note can't treat symmetric case as there is no dpttrf function if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) @@ -4074,7 +4074,7 @@ F77_XFCN (dgttrf, DGTTRF, (nr, DL, D, DU, DU2, pipvt, err)); - if (err != 0) + if (err != 0) { rcond = 0.0; err = -2; @@ -4088,8 +4088,8 @@ (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else + } + else { rcond = 1.0; char job = 'N'; @@ -4108,13 +4108,13 @@ for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - F77_XFCN (dgttrs, DGTTRS, + F77_XFCN (dgttrs, DGTTRS, (F77_CONST_CHAR_ARG2 (&job, 1), - nr, 1, DL, D, DU, DU2, pipvt, + nr, 1, DL, D, DU, DU2, pipvt, work, b.rows (), err F77_CHAR_ARG_LEN (1))); - // Count non-zeros in work vector and adjust + // Count non-zeros in work vector and adjust // space in retval if needed octave_idx_type new_nnz = 0; for (octave_idx_type i = 0; i < nr; i++) @@ -4149,8 +4149,8 @@ } ComplexMatrix -SparseMatrix::trisolve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& err, double& rcond, +SparseMatrix::trisolve (MatrixType &mattype, const ComplexMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -4166,14 +4166,14 @@ else if (nr == 0 || b.cols () == 0) retval = ComplexMatrix (nc, b.cols (), Complex (0.0, 0.0)); else if (calc_cond) - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("calculation of condition number not implemented"); else { // Print spparms("spumoni") info if requested volatile int typ = mattype.type (); mattype.info (); - + if (typ == MatrixType::Tridiagonal_Hermitian) { OCTAVE_LOCAL_BUFFER (double, D, nr); @@ -4216,8 +4216,8 @@ retval = b; Complex *result = retval.fortran_vec (); - - F77_XFCN (zptsv, ZPTSV, (nr, b_nc, D, DL, result, + + F77_XFCN (zptsv, ZPTSV, (nr, b_nc, D, DL, result, b_nr, err)); if (err != 0) @@ -4274,15 +4274,15 @@ retval = b; Complex *result = retval.fortran_vec (); - - F77_XFCN (zgtsv, ZGTSV, (nr, b_nc, DL, D, DU, result, + + F77_XFCN (zgtsv, ZGTSV, (nr, b_nc, DL, D, DU, result, b_nr, err)); if (err != 0) { rcond = 0.; err = -2; - + if (sing_handler) { sing_handler (rcond); @@ -4302,7 +4302,7 @@ SparseComplexMatrix SparseMatrix::trisolve (MatrixType &mattype, const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -4318,14 +4318,14 @@ else if (nr == 0 || b.cols () == 0) retval = SparseComplexMatrix (nc, b.cols ()); else if (calc_cond) - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("calculation of condition number not implemented"); else { // Print spparms("spumoni") info if requested int typ = mattype.type (); mattype.info (); - + // Note can't treat symmetric case as there is no dpttrf function if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) @@ -4373,7 +4373,7 @@ F77_XFCN (dgttrf, DGTTRF, (nr, DL, D, DU, DU2, pipvt, err)); - if (err != 0) + if (err != 0) { rcond = 0.0; err = -2; @@ -4386,9 +4386,9 @@ else (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else - { + } + else + { rcond = 1.; char job = 'N'; octave_idx_type b_nr = b.rows (); @@ -4413,9 +4413,9 @@ Bz[i] = std::imag (c); } - F77_XFCN (dgttrs, DGTTRS, + F77_XFCN (dgttrs, DGTTRS, (F77_CONST_CHAR_ARG2 (&job, 1), - nr, 1, DL, D, DU, DU2, pipvt, + nr, 1, DL, D, DU, DU2, pipvt, Bx, b_nr, err F77_CHAR_ARG_LEN (1))); @@ -4428,9 +4428,9 @@ break; } - F77_XFCN (dgttrs, DGTTRS, + F77_XFCN (dgttrs, DGTTRS, (F77_CONST_CHAR_ARG2 (&job, 1), - nr, 1, DL, D, DU, DU2, pipvt, + nr, 1, DL, D, DU, DU2, pipvt, Bz, b_nr, err F77_CHAR_ARG_LEN (1))); @@ -4443,7 +4443,7 @@ break; } - // Count non-zeros in work vector and adjust + // Count non-zeros in work vector and adjust // space in retval if needed octave_idx_type new_nnz = 0; for (octave_idx_type i = 0; i < nr; i++) @@ -4462,7 +4462,7 @@ if (Bx[i] != 0. || Bz[i] != 0.) { retval.xridx(ii) = i; - retval.xdata(ii++) = + retval.xdata(ii++) = Complex (Bx[i], Bz[i]); } @@ -4508,8 +4508,8 @@ octave_idx_type ldm = n_lower + 1; Matrix m_band (ldm, nc); double *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -4535,8 +4535,8 @@ F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, err F77_CHAR_ARG_LEN (1))); - - if (err != 0) + + if (err != 0) { // Matrix is not positive definite!! Fall through to // unsymmetric banded solver. @@ -4544,8 +4544,8 @@ typ = MatrixType::Banded; rcond = 0.0; err = 0; - } - else + } + else { if (calc_cond) { @@ -4554,13 +4554,13 @@ Array iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dpbcon, DPBCON, + F77_XFCN (dpbcon, DPBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -4590,7 +4590,7 @@ octave_idx_type b_nc = b.cols (); - F77_XFCN (dpbtrs, DPBTRS, + F77_XFCN (dpbtrs, DPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, b_nc, tmp_data, ldm, result, b.rows(), err @@ -4598,7 +4598,7 @@ if (err != 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve solve failed"); err = -1; } @@ -4615,8 +4615,8 @@ Matrix m_band (ldm, nc); double *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -4646,12 +4646,12 @@ Array ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); - F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, + F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); - - // Throw-away extra info LAPACK gives so as to not + + // Throw-away extra info LAPACK gives so as to not // change output. - if (err != 0) + if (err != 0) { err = -2; rcond = 0.0; @@ -4665,8 +4665,8 @@ (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else + } + else { if (calc_cond) { @@ -4676,13 +4676,13 @@ Array iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dgbcon, DGBCON, + F77_XFCN (dgbcon, DGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, n_lower, n_upper, tmp_data, ldm, pipvt, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -4713,7 +4713,7 @@ octave_idx_type b_nc = b.cols (); char job = 'N'; - F77_XFCN (dgbtrs, DGBTRS, + 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 @@ -4730,7 +4730,7 @@ SparseMatrix SparseMatrix::bsolve (MatrixType &mattype, const SparseMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -4758,8 +4758,8 @@ Matrix m_band (ldm, nc); double *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -4785,15 +4785,15 @@ F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, err F77_CHAR_ARG_LEN (1))); - - if (err != 0) + + if (err != 0) { mattype.mark_as_unsymmetric (); typ = MatrixType::Banded; rcond = 0.0; err = 0; - } - else + } + else { if (calc_cond) { @@ -4802,13 +4802,13 @@ Array iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dpbcon, DPBCON, + F77_XFCN (dpbcon, DPBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -4849,7 +4849,7 @@ for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b.elem (i, j); - F77_XFCN (dpbtrs, DPBTRS, + F77_XFCN (dpbtrs, DPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, 1, tmp_data, ldm, Bx, b_nr, err @@ -4857,7 +4857,7 @@ if (err != 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve solve failed"); err = -1; break; @@ -4871,7 +4871,7 @@ if (ii == x_nz) { // Resize the sparse matrix - octave_idx_type sz = x_nz * + octave_idx_type sz = x_nz * (b_nc - j) / b_nc; sz = (sz > 10 ? sz : 10) + x_nz; retval.change_capacity (sz); @@ -4898,8 +4898,8 @@ Matrix m_band (ldm, nc); double *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -4929,10 +4929,10 @@ Array ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); - F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, + F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); - - if (err != 0) + + if (err != 0) { err = -2; rcond = 0.0; @@ -4946,8 +4946,8 @@ (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else + } + else { if (calc_cond) { @@ -4957,13 +4957,13 @@ Array iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dgbcon, DGBCON, + F77_XFCN (dgbcon, DGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, n_lower, n_upper, tmp_data, ldm, pipvt, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -5001,17 +5001,17 @@ { for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (octave_idx_type i = b.cidx(j); + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - F77_XFCN (dgbtrs, DGBTRS, + F77_XFCN (dgbtrs, DGBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, n_upper, 1, tmp_data, ldm, pipvt, work, b.rows (), err F77_CHAR_ARG_LEN (1))); - // Count non-zeros in work vector and adjust + // Count non-zeros in work vector and adjust // space in retval if needed octave_idx_type new_nnz = 0; for (octave_idx_type i = 0; i < nr; i++) @@ -5047,8 +5047,8 @@ } ComplexMatrix -SparseMatrix::bsolve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& err, double& rcond, +SparseMatrix::bsolve (MatrixType &mattype, const ComplexMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -5076,8 +5076,8 @@ Matrix m_band (ldm, nc); double *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -5103,8 +5103,8 @@ F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, err F77_CHAR_ARG_LEN (1))); - - if (err != 0) + + if (err != 0) { // Matrix is not positive definite!! Fall through to // unsymmetric banded solver. @@ -5112,8 +5112,8 @@ typ = MatrixType::Banded; rcond = 0.0; err = 0; - } - else + } + else { if (calc_cond) { @@ -5122,13 +5122,13 @@ Array iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dpbcon, DPBCON, + F77_XFCN (dpbcon, DPBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -5170,7 +5170,7 @@ Bz[i] = std::imag (c); } - F77_XFCN (dpbtrs, DPBTRS, + F77_XFCN (dpbtrs, DPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, 1, tmp_data, ldm, Bx, b_nr, err @@ -5178,13 +5178,13 @@ if (err != 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve solve failed"); err = -1; break; } - F77_XFCN (dpbtrs, DPBTRS, + F77_XFCN (dpbtrs, DPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, 1, tmp_data, ldm, Bz, b.rows(), err @@ -5192,7 +5192,7 @@ if (err != 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve solve failed"); err = -1; break; @@ -5214,8 +5214,8 @@ Matrix m_band (ldm, nc); double *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -5245,10 +5245,10 @@ Array ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); - F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, + F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); - - if (err != 0) + + if (err != 0) { err = -2; rcond = 0.0; @@ -5262,8 +5262,8 @@ (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else + } + else { if (calc_cond) { @@ -5273,13 +5273,13 @@ Array iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dpbcon, DPBCON, + F77_XFCN (dpbcon, DPBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -5320,13 +5320,13 @@ Bz[i] = std::imag (c); } - F77_XFCN (dgbtrs, DGBTRS, + F77_XFCN (dgbtrs, DGBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, n_upper, 1, tmp_data, ldm, pipvt, Bx, b.rows (), err F77_CHAR_ARG_LEN (1))); - F77_XFCN (dgbtrs, DGBTRS, + F77_XFCN (dgbtrs, DGBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, n_upper, 1, tmp_data, ldm, pipvt, Bz, b.rows (), err @@ -5347,7 +5347,7 @@ SparseComplexMatrix SparseMatrix::bsolve (MatrixType &mattype, const SparseComplexMatrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -5375,8 +5375,8 @@ Matrix m_band (ldm, nc); double *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -5402,8 +5402,8 @@ F77_XFCN (dpbtrf, DPBTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, err F77_CHAR_ARG_LEN (1))); - - if (err != 0) + + if (err != 0) { // Matrix is not positive definite!! Fall through to // unsymmetric banded solver. @@ -5412,8 +5412,8 @@ rcond = 0.0; err = 0; - } - else + } + else { if (calc_cond) { @@ -5422,13 +5422,13 @@ Array iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dpbcon, DPBCON, + F77_XFCN (dpbcon, DPBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, tmp_data, ldm, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -5475,7 +5475,7 @@ Bz[i] = std::imag (c); } - F77_XFCN (dpbtrs, DPBTRS, + F77_XFCN (dpbtrs, DPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, 1, tmp_data, ldm, Bx, b_nr, err @@ -5483,13 +5483,13 @@ if (err != 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve solve failed"); err = -1; break; } - F77_XFCN (dpbtrs, DPBTRS, + F77_XFCN (dpbtrs, DPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, 1, tmp_data, ldm, Bz, b_nr, err @@ -5504,7 +5504,7 @@ break; } - // Count non-zeros in work vector and adjust + // Count non-zeros in work vector and adjust // space in retval if needed octave_idx_type new_nnz = 0; for (octave_idx_type i = 0; i < nr; i++) @@ -5523,7 +5523,7 @@ if (Bx[i] != 0. || Bz[i] != 0.) { retval.xridx(ii) = i; - retval.xdata(ii++) = + retval.xdata(ii++) = Complex (Bx[i], Bz[i]); } @@ -5544,8 +5544,8 @@ Matrix m_band (ldm, nc); double *tmp_data = m_band.fortran_vec (); - - if (! mattype.is_dense ()) + + if (! mattype.is_dense ()) { octave_idx_type ii = 0; @@ -5575,10 +5575,10 @@ Array ipvt (dim_vector (nr, 1)); octave_idx_type *pipvt = ipvt.fortran_vec (); - F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, + F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); - - if (err != 0) + + if (err != 0) { err = -2; rcond = 0.0; @@ -5592,8 +5592,8 @@ (*current_liboctave_error_handler) ("matrix singular to machine precision"); - } - else + } + else { if (calc_cond) { @@ -5603,13 +5603,13 @@ Array iz (dim_vector (nr, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (dgbcon, DGBCON, + F77_XFCN (dgbcon, DGBCON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, n_lower, n_upper, tmp_data, ldm, pipvt, anorm, rcond, pz, piz, err F77_CHAR_ARG_LEN (1))); - if (err != 0) + if (err != 0) err = -2; volatile double rcond_plus_one = rcond + 1.0; @@ -5651,7 +5651,7 @@ Bx[i] = 0.; Bz[i] = 0.; } - for (octave_idx_type i = b.cidx(j); + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { Complex c = b.data(i); @@ -5659,19 +5659,19 @@ Bz[b.ridx(i)] = std::imag (c); } - F77_XFCN (dgbtrs, DGBTRS, + F77_XFCN (dgbtrs, DGBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, n_upper, 1, tmp_data, ldm, pipvt, Bx, b.rows (), err F77_CHAR_ARG_LEN (1))); - F77_XFCN (dgbtrs, DGBTRS, + F77_XFCN (dgbtrs, DGBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, n_lower, n_upper, 1, tmp_data, ldm, pipvt, Bz, b.rows (), err F77_CHAR_ARG_LEN (1))); - // Count non-zeros in work vector and adjust + // Count non-zeros in work vector and adjust // space in retval if needed octave_idx_type new_nnz = 0; for (octave_idx_type i = 0; i < nr; i++) @@ -5690,7 +5690,7 @@ if (Bx[i] != 0. || Bz[i] != 0.) { retval.xridx(ii) = i; - retval.xdata(ii++) = + retval.xdata(ii++) = Complex (Bx[i], Bz[i]); } retval.xcidx(j+1) = ii; @@ -5703,7 +5703,7 @@ else if (typ != MatrixType::Banded_Hermitian) (*current_liboctave_error_handler) ("incorrect matrix type"); } - + return retval; } @@ -5755,7 +5755,7 @@ if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve symbolic factorization failed"); err = -1; @@ -5778,7 +5778,7 @@ rcond = 1.; volatile double rcond_plus_one = rcond + 1.0; - if (status == UMFPACK_WARNING_singular_matrix || + if (status == UMFPACK_WARNING_singular_matrix || rcond_plus_one == 1.0 || xisnan (rcond)) { UMFPACK_DNAME (report_numeric) (Numeric, control); @@ -5795,12 +5795,12 @@ } else if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve numeric factorization failed"); UMFPACK_DNAME (report_status) (control, status); UMFPACK_DNAME (report_info) (control, info); - + err = -1; } else @@ -5821,7 +5821,7 @@ Matrix SparseMatrix::fsolve (MatrixType &mattype, const Matrix& b, - octave_idx_type& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const { @@ -5944,7 +5944,7 @@ (*current_liboctave_error_handler) ("SparseMatrix::solve matrix singular to machine precision, rcond = %g", rcond); - + return retval; } @@ -5982,7 +5982,7 @@ { #ifdef HAVE_UMFPACK Matrix Control, Info; - void *Numeric = + void *Numeric = factorize (err, rcond, Control, Info, sing_handler, calc_cond); if (err == 0) @@ -6001,24 +6001,24 @@ for (octave_idx_type j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) { - status = UMFPACK_DNAME (solve) (UMFPACK_A, Ap, + status = UMFPACK_DNAME (solve) (UMFPACK_A, Ap, Ai, Ax, &result[iidx], &Bx[iidx], Numeric, control, info); if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve solve failed"); UMFPACK_DNAME (report_status) (control, status); - + err = -1; - + break; } } UMFPACK_DNAME (report_info) (control, info); - + UMFPACK_DNAME (free_numeric) (&Numeric); } else @@ -6031,7 +6031,7 @@ else if (typ != MatrixType::Hermitian) (*current_liboctave_error_handler) ("incorrect matrix type"); } - + return retval; } @@ -6169,7 +6169,7 @@ (*current_liboctave_error_handler) ("SparseMatrix::solve matrix singular to machine precision, rcond = %g", rcond); - + return retval; } @@ -6178,13 +6178,13 @@ X = CHOLMOD_NAME(spsolve) (CHOLMOD_A, L, B, cm); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - retval = SparseMatrix (static_cast(X->nrow), + retval = SparseMatrix (static_cast(X->nrow), static_cast(X->ncol), static_cast(X->nzmax)); - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j <= static_cast(X->ncol); j++) retval.xcidx(j) = static_cast(X->p)[j]; - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j < static_cast(X->nzmax); j++) { retval.xridx(j) = static_cast(X->i)[j]; @@ -6212,7 +6212,7 @@ { #ifdef HAVE_UMFPACK Matrix Control, Info; - void *Numeric = factorize (err, rcond, Control, Info, + void *Numeric = factorize (err, rcond, Control, Info, sing_handler, calc_cond); if (err == 0) @@ -6242,21 +6242,21 @@ for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b.elem (i, j); - status = UMFPACK_DNAME (solve) (UMFPACK_A, Ap, - Ai, Ax, Xx, Bx, Numeric, control, + status = UMFPACK_DNAME (solve) (UMFPACK_A, Ap, + Ai, Ax, Xx, Bx, Numeric, control, info); if (status < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve solve failed"); UMFPACK_DNAME (report_status) (control, status); - + err = -1; break; } - + for (octave_idx_type i = 0; i < b_nr; i++) { double tmp = Xx[i]; @@ -6293,12 +6293,12 @@ else if (typ != MatrixType::Hermitian) (*current_liboctave_error_handler) ("incorrect matrix type"); } - + return retval; } ComplexMatrix -SparseMatrix::fsolve (MatrixType &mattype, const ComplexMatrix& b, +SparseMatrix::fsolve (MatrixType &mattype, const ComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const @@ -6421,7 +6421,7 @@ (*current_liboctave_error_handler) ("SparseMatrix::solve matrix singular to machine precision, rcond = %g", rcond); - + return retval; } @@ -6459,7 +6459,7 @@ { #ifdef HAVE_UMFPACK Matrix Control, Info; - void *Numeric = factorize (err, rcond, Control, Info, + void *Numeric = factorize (err, rcond, Control, Info, sing_handler, calc_cond); if (err == 0) @@ -6480,7 +6480,7 @@ OCTAVE_LOCAL_BUFFER (double, Xx, b_nr); OCTAVE_LOCAL_BUFFER (double, Xz, b_nr); - + for (octave_idx_type j = 0; j < b_nc; j++) { for (octave_idx_type i = 0; i < b_nr; i++) @@ -6490,20 +6490,20 @@ Bz[i] = std::imag (c); } - status = UMFPACK_DNAME (solve) (UMFPACK_A, Ap, - Ai, Ax, Xx, Bx, Numeric, control, + status = UMFPACK_DNAME (solve) (UMFPACK_A, Ap, + Ai, Ax, Xx, Bx, Numeric, control, info); int status2 = UMFPACK_DNAME (solve) (UMFPACK_A, - Ap, Ai, Ax, Xz, Bz, Numeric, + Ap, Ai, Ax, Xz, Bz, Numeric, control, info) ; if (status < 0 || status2 < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve solve failed"); UMFPACK_DNAME (report_status) (control, status); - + err = -1; break; @@ -6527,12 +6527,12 @@ else if (typ != MatrixType::Hermitian) (*current_liboctave_error_handler) ("incorrect matrix type"); } - + return retval; } SparseComplexMatrix -SparseMatrix::fsolve (MatrixType &mattype, const SparseComplexMatrix& b, +SparseMatrix::fsolve (MatrixType &mattype, const SparseComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool calc_cond) const @@ -6665,7 +6665,7 @@ (*current_liboctave_error_handler) ("SparseMatrix::solve matrix singular to machine precision, rcond = %g", rcond); - + return retval; } @@ -6674,14 +6674,14 @@ X = CHOLMOD_NAME(spsolve) (CHOLMOD_A, L, B, cm); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - retval = SparseComplexMatrix - (static_cast(X->nrow), + retval = SparseComplexMatrix + (static_cast(X->nrow), static_cast(X->ncol), static_cast(X->nzmax)); - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j <= static_cast(X->ncol); j++) retval.xcidx(j) = static_cast(X->p)[j]; - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j < static_cast(X->nzmax); j++) { retval.xridx(j) = static_cast(X->i)[j]; @@ -6709,7 +6709,7 @@ { #ifdef HAVE_UMFPACK Matrix Control, Info; - void *Numeric = factorize (err, rcond, Control, Info, + void *Numeric = factorize (err, rcond, Control, Info, sing_handler, calc_cond); if (err == 0) @@ -6734,7 +6734,7 @@ OCTAVE_LOCAL_BUFFER (double, Xx, b_nr); OCTAVE_LOCAL_BUFFER (double, Xz, b_nr); - + retval.xcidx(0) = 0; for (octave_idx_type j = 0; j < b_nc; j++) { @@ -6746,19 +6746,19 @@ } status = UMFPACK_DNAME (solve) (UMFPACK_A, Ap, - Ai, Ax, Xx, Bx, Numeric, control, + Ai, Ax, Xx, Bx, Numeric, control, info); int status2 = UMFPACK_DNAME (solve) (UMFPACK_A, - Ap, Ai, Ax, Xz, Bz, Numeric, + Ap, Ai, Ax, Xz, Bz, Numeric, control, info) ; if (status < 0 || status2 < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseMatrix::solve solve failed"); UMFPACK_DNAME (report_status) (control, status); - + err = -1; break; @@ -6799,7 +6799,7 @@ else if (typ != MatrixType::Hermitian) (*current_liboctave_error_handler) ("incorrect matrix type"); } - + return retval; } @@ -6812,7 +6812,7 @@ } Matrix -SparseMatrix::solve (MatrixType &mattype, const Matrix& b, +SparseMatrix::solve (MatrixType &mattype, const Matrix& b, octave_idx_type& info) const { double rcond; @@ -6820,14 +6820,14 @@ } Matrix -SparseMatrix::solve (MatrixType &mattype, const Matrix& b, octave_idx_type& info, +SparseMatrix::solve (MatrixType &mattype, const Matrix& b, octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } Matrix -SparseMatrix::solve (MatrixType &mattype, const Matrix& b, octave_idx_type& err, +SparseMatrix::solve (MatrixType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback) const { @@ -6846,7 +6846,7 @@ retval = ltsolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) retval = bsolve (mattype, b, err, rcond, sing_handler, false); - else if (typ == MatrixType::Tridiagonal || + else if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) retval = trisolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) @@ -6880,7 +6880,7 @@ } SparseMatrix -SparseMatrix::solve (MatrixType &mattype, const SparseMatrix& b, +SparseMatrix::solve (MatrixType &mattype, const SparseMatrix& b, octave_idx_type& info) const { double rcond; @@ -6895,7 +6895,7 @@ } SparseMatrix -SparseMatrix::solve (MatrixType &mattype, const SparseMatrix& b, +SparseMatrix::solve (MatrixType &mattype, const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback) const @@ -6914,7 +6914,7 @@ retval = ltsolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) retval = bsolve (mattype, b, err, rcond, sing_handler, false); - else if (typ == MatrixType::Tridiagonal || + else if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) retval = trisolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) @@ -6931,7 +6931,7 @@ #ifdef USE_QRSOLVE retval = qrsolve (*this, b, err); #else - retval = dmsolve (*this, b, err); #endif } @@ -6948,7 +6948,7 @@ } ComplexMatrix -SparseMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, +SparseMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, octave_idx_type& info) const { double rcond; @@ -6956,15 +6956,15 @@ } ComplexMatrix -SparseMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, +SparseMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ComplexMatrix -SparseMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, - octave_idx_type& err, double& rcond, +SparseMatrix::solve (MatrixType &mattype, const ComplexMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback) const { @@ -6982,7 +6982,7 @@ retval = ltsolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) retval = bsolve (mattype, b, err, rcond, sing_handler, false); - else if (typ == MatrixType::Tridiagonal || + else if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) retval = trisolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) @@ -6999,7 +6999,7 @@ #ifdef USE_QRSOLVE retval = qrsolve (*this, b, err); #else - retval = dmsolve (*this, b, err); #endif } @@ -7016,7 +7016,7 @@ } SparseComplexMatrix -SparseMatrix::solve (MatrixType &mattype, const SparseComplexMatrix& b, +SparseMatrix::solve (MatrixType &mattype, const SparseComplexMatrix& b, octave_idx_type& info) const { double rcond; @@ -7031,7 +7031,7 @@ } SparseComplexMatrix -SparseMatrix::solve (MatrixType &mattype, const SparseComplexMatrix& b, +SparseMatrix::solve (MatrixType &mattype, const SparseComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback) const @@ -7050,7 +7050,7 @@ retval = ltsolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Banded || typ == MatrixType::Banded_Hermitian) retval = bsolve (mattype, b, err, rcond, sing_handler, false); - else if (typ == MatrixType::Tridiagonal || + else if (typ == MatrixType::Tridiagonal || typ == MatrixType::Tridiagonal_Hermitian) retval = trisolve (mattype, b, err, rcond, sing_handler, false); else if (typ == MatrixType::Full || typ == MatrixType::Hermitian) @@ -7067,7 +7067,7 @@ #ifdef USE_QRSOLVE retval = qrsolve (*this, b, err); #else - retval = dmsolve (*this, b, err); #endif } @@ -7119,7 +7119,7 @@ } ComplexColumnVector -SparseMatrix::solve (MatrixType &mattype, const ComplexColumnVector& b, octave_idx_type& info, +SparseMatrix::solve (MatrixType &mattype, const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); @@ -7149,15 +7149,15 @@ } Matrix -SparseMatrix::solve (const Matrix& b, octave_idx_type& info, +SparseMatrix::solve (const Matrix& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } Matrix -SparseMatrix::solve (const Matrix& b, octave_idx_type& err, - double& rcond, +SparseMatrix::solve (const Matrix& b, octave_idx_type& err, + double& rcond, solve_singularity_handler sing_handler) const { MatrixType mattype (*this); @@ -7173,7 +7173,7 @@ } SparseMatrix -SparseMatrix::solve (const SparseMatrix& b, +SparseMatrix::solve (const SparseMatrix& b, octave_idx_type& info) const { double rcond; @@ -7188,7 +7188,7 @@ } SparseMatrix -SparseMatrix::solve (const SparseMatrix& b, +SparseMatrix::solve (const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { @@ -7197,7 +7197,7 @@ } ComplexMatrix -SparseMatrix::solve (const ComplexMatrix& b, +SparseMatrix::solve (const ComplexMatrix& b, octave_idx_type& info) const { double rcond; @@ -7205,15 +7205,15 @@ } ComplexMatrix -SparseMatrix::solve (const ComplexMatrix& b, +SparseMatrix::solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ComplexMatrix -SparseMatrix::solve (const ComplexMatrix& b, - octave_idx_type& err, double& rcond, +SparseMatrix::solve (const ComplexMatrix& b, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { MatrixType mattype (*this); @@ -7229,7 +7229,7 @@ } SparseComplexMatrix -SparseMatrix::solve (const SparseComplexMatrix& b, +SparseMatrix::solve (const SparseComplexMatrix& b, octave_idx_type& info) const { double rcond; @@ -7244,7 +7244,7 @@ } SparseComplexMatrix -SparseMatrix::solve (const SparseComplexMatrix& b, +SparseMatrix::solve (const SparseComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { @@ -7296,7 +7296,7 @@ } ComplexColumnVector -SparseMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, +SparseMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); @@ -7454,9 +7454,9 @@ return false; } -SparseBoolMatrix -SparseMatrix::operator ! (void) const -{ +SparseBoolMatrix +SparseMatrix::operator ! (void) const +{ if (any_element_is_nan ()) gripe_nan_to_logical_conversion (); @@ -7464,9 +7464,9 @@ octave_idx_type nc = cols (); octave_idx_type nz1 = nnz (); octave_idx_type nz2 = nr*nc - nz1; - + SparseBoolMatrix r (nr, nc, nz2); - + octave_idx_type ii = 0; octave_idx_type jj = 0; r.cidx (0) = 0; @@ -7522,7 +7522,7 @@ return transpose (). prod (0). transpose(); else { - SPARSE_REDUCTION_OP (SparseMatrix, double, *=, + SPARSE_REDUCTION_OP (SparseMatrix, double, *=, (cidx(j+1) - cidx(j) < nr ? 0.0 : 1.0), 1.0); } } @@ -7544,7 +7544,7 @@ double d = data (i); \ tmp[j] += d * d - SPARSE_BASE_REDUCTION_OP (SparseMatrix, double, ROW_EXPR, COL_EXPR, + SPARSE_BASE_REDUCTION_OP (SparseMatrix, double, ROW_EXPR, COL_EXPR, 0.0, 0.0); #undef ROW_EXPR @@ -7606,9 +7606,9 @@ } SparseMatrix -SparseMatrix::squeeze (void) const -{ - return MSparse::squeeze (); +SparseMatrix::squeeze (void) const +{ + return MSparse::squeeze (); } SparseMatrix @@ -7788,7 +7788,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 (); @@ -7801,7 +7801,7 @@ else { r = SparseMatrix (a_nr, a_nc, (a.nnz () + b.nnz ())); - + octave_idx_type jx = 0; r.cidx (0) = 0; for (octave_idx_type i = 0 ; i < a_nc ; i++) @@ -7809,11 +7809,11 @@ octave_idx_type ja = a.cidx(i); octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - + octave_idx_type jb = b.cidx(i); octave_idx_type jb_max = b.cidx(i+1); bool jb_lt_max = jb < jb_max; - + while (ja_lt_max || jb_lt_max ) { octave_quit (); @@ -7860,7 +7860,7 @@ } r.cidx(i+1) = jx; } - + r.maybe_compress (); } } @@ -7938,7 +7938,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 (); @@ -7951,7 +7951,7 @@ else { r = SparseMatrix (a_nr, a_nc, (a.nnz () + b.nnz ())); - + octave_idx_type jx = 0; r.cidx (0) = 0; for (octave_idx_type i = 0 ; i < a_nc ; i++) @@ -7959,11 +7959,11 @@ octave_idx_type ja = a.cidx(i); octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - + octave_idx_type jb = b.cidx(i); octave_idx_type jb_max = b.cidx(i+1); bool jb_lt_max = jb < jb_max; - + while (ja_lt_max || jb_lt_max ) { octave_quit (); @@ -8010,7 +8010,7 @@ } r.cidx(i+1) = jx; } - + r.maybe_compress (); } } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dSparse.h --- a/liboctave/dSparse.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dSparse.h Thu Jan 20 17:24:59 2011 -0500 @@ -53,15 +53,15 @@ SparseMatrix (octave_idx_type r, octave_idx_type c) : MSparse (r, c) { } - SparseMatrix (const dim_vector& dv, octave_idx_type nz = 0) : + SparseMatrix (const dim_vector& dv, octave_idx_type nz = 0) : MSparse (dv, nz) { } - explicit SparseMatrix (octave_idx_type r, octave_idx_type c, double val) + explicit SparseMatrix (octave_idx_type r, octave_idx_type c, double val) : MSparse (r, c, val) { } SparseMatrix (const SparseMatrix& a) : MSparse (a) { } - SparseMatrix (const SparseMatrix& a, const dim_vector& dv) + SparseMatrix (const SparseMatrix& a, const dim_vector& dv) : MSparse (a, dv) { } SparseMatrix (const MSparse& a) : MSparse (a) { } @@ -74,8 +74,8 @@ explicit SparseMatrix (const NDArray& a) : MSparse (a) { } - SparseMatrix (const Array& a, const idx_vector& r, - const idx_vector& c, octave_idx_type nr = -1, + SparseMatrix (const Array& a, const idx_vector& r, + const idx_vector& c, octave_idx_type nr = -1, octave_idx_type nc = -1, bool sum_terms = true, octave_idx_type nzm = -1) : MSparse (a, r, c, nr, nc, sum_terms, nzm) { } @@ -101,7 +101,7 @@ SparseMatrix max (Array& index, int dim = -1) const; SparseMatrix min (int dim = -1) const; SparseMatrix min (Array& index, int dim = -1) const; - + // destructive insert/delete/reorder operations SparseMatrix& insert (const SparseMatrix& a, octave_idx_type r, octave_idx_type c); @@ -119,9 +119,9 @@ friend OCTAVE_API SparseMatrix atan2 (const SparseMatrix& x, const double& y); friend OCTAVE_API SparseMatrix atan2 (const SparseMatrix& x, const SparseMatrix& y); - SparseMatrix transpose (void) const - { - return MSparse::transpose (); + SparseMatrix transpose (void) const + { + return MSparse::transpose (); } SparseMatrix hermitian (void) const { return transpose (); } @@ -132,19 +132,19 @@ ColumnVector column (octave_idx_type i) const; private: - SparseMatrix dinverse (MatrixType &mattyp, octave_idx_type& info, - double& rcond, const bool force = false, + SparseMatrix dinverse (MatrixType &mattyp, octave_idx_type& info, + double& rcond, const bool force = false, const bool calccond = true) const; - SparseMatrix tinverse (MatrixType &mattyp, octave_idx_type& info, - double& rcond, const bool force = false, + SparseMatrix tinverse (MatrixType &mattyp, octave_idx_type& info, + double& rcond, const bool force = false, const bool calccond = true) const; public: SparseMatrix inverse (void) const; SparseMatrix inverse (MatrixType& mattype) const; SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info) const; - SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info, + SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info, double& rcond, int force = 0, int calc_cond = 1) const; DET determinant (void) const; @@ -158,17 +158,17 @@ bool calc_cond = false) const; ComplexMatrix dsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, - solve_singularity_handler sing_handler, + octave_idx_type& info, double& rcond, + solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseMatrix dsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseComplexMatrix dsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; @@ -178,7 +178,7 @@ bool calc_cond = false) const; ComplexMatrix utsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; @@ -188,7 +188,7 @@ bool calc_cond = false) const; SparseComplexMatrix utsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; @@ -198,17 +198,17 @@ bool calc_cond = false) const; ComplexMatrix ltsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseMatrix ltsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseComplexMatrix ltsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; @@ -218,7 +218,7 @@ bool calc_cond = false) const; ComplexMatrix trisolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; @@ -228,7 +228,7 @@ bool calc_cond = false) const; SparseComplexMatrix trisolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; @@ -238,17 +238,17 @@ bool calc_cond = false) const; ComplexMatrix bsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseMatrix bsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseComplexMatrix bsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; @@ -262,17 +262,17 @@ bool calc_cond = false) const; ComplexMatrix fsolve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseMatrix fsolve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; SparseComplexMatrix fsolve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool calc_cond = false) const; @@ -280,55 +280,55 @@ // Generic interface to solver with no probing of type Matrix solve (MatrixType &typ, const Matrix& b) const; Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info) const; - Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, + Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcond) const; Matrix solve (MatrixType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback = true) const; ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b) const; - ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, + ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info) const; - ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, + ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; ComplexMatrix solve (MatrixType &typ, const ComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback = true) const; SparseMatrix solve (MatrixType &typ, const SparseMatrix& b) const; - SparseMatrix solve (MatrixType &typ, const SparseMatrix& b, + SparseMatrix solve (MatrixType &typ, const SparseMatrix& b, octave_idx_type& info) const; SparseMatrix solve (MatrixType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond) const; SparseMatrix solve (MatrixType &typ, const SparseMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool singular_fallback = true) const; - SparseComplexMatrix solve (MatrixType &typ, + SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b) const; - SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, + SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, octave_idx_type& info) const; - SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, + SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, octave_idx_type& info, double& rcond) const; SparseComplexMatrix solve (MatrixType &typ, const SparseComplexMatrix& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler, bool singular_fallabck = true) const; ColumnVector solve (MatrixType &typ, const ColumnVector& b) const; - ColumnVector solve (MatrixType &typ, const ColumnVector& b, + ColumnVector solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info) const; - ColumnVector solve (MatrixType &typ, const ColumnVector& b, + ColumnVector solve (MatrixType &typ, const ColumnVector& b, octave_idx_type& info, double& rcond) const; ColumnVector solve (MatrixType &typ, const ColumnVector& b, - octave_idx_type& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexColumnVector solve (MatrixType &typ, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b) const; - ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, + ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info) const; ComplexColumnVector solve (MatrixType &typ, const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const; @@ -345,23 +345,23 @@ ComplexMatrix solve (const ComplexMatrix& b) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; - ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseMatrix solve (const SparseMatrix& b) const; SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info) const; - SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, + SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, double& rcond) const; SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix solve (const SparseComplexMatrix& b) const; SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info) const; - SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, + SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, double& rcond) const; - SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, + SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; @@ -389,7 +389,7 @@ bool all_elements_are_int_or_inf_or_nan (void) const; bool all_integers (double& max_val, double& min_val) const; bool too_large_for_float (void) const; - + SparseBoolMatrix operator ! (void) const; SparseBoolMatrix all (int dim = -1) const; @@ -428,15 +428,15 @@ // Other operators. -extern OCTAVE_API SparseMatrix operator * (const SparseMatrix& a, +extern OCTAVE_API SparseMatrix operator * (const SparseMatrix& a, const SparseMatrix& b); -extern OCTAVE_API Matrix operator * (const Matrix& a, +extern OCTAVE_API Matrix operator * (const Matrix& a, const SparseMatrix& b); -extern OCTAVE_API Matrix mul_trans (const Matrix& a, +extern OCTAVE_API Matrix mul_trans (const Matrix& a, const SparseMatrix& b); -extern OCTAVE_API Matrix operator * (const SparseMatrix& a, +extern OCTAVE_API Matrix operator * (const SparseMatrix& a, const Matrix& b); -extern OCTAVE_API Matrix trans_mul (const SparseMatrix& a, +extern OCTAVE_API Matrix trans_mul (const SparseMatrix& a, const Matrix& b); extern OCTAVE_API SparseMatrix operator * (const DiagMatrix&, const SparseMatrix&); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dbleAEPBAL.h --- a/liboctave/dbleAEPBAL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dbleAEPBAL.h Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ AEPBALANCE (const Matrix& a, bool noperm = false, bool noscal = false); - AEPBALANCE (const AEPBALANCE& a) + AEPBALANCE (const AEPBALANCE& a) : base_aepbal (a) { } Matrix balancing_matrix (void) const; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dbleCHOL.cc --- a/liboctave/dbleCHOL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dbleCHOL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -55,7 +55,7 @@ F77_FUNC (dpocon, DPOCON) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, double*, const octave_idx_type&, const double&, - double&, double*, octave_idx_type*, + double&, double*, octave_idx_type*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); #ifdef HAVE_QRUPDATE @@ -113,7 +113,7 @@ // Calculate the norm of the matrix, for later use. double anorm = 0; - if (calc_cond) + if (calc_cond) anorm = xnorm (a, 1); F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), @@ -123,7 +123,7 @@ xrcond = 0.0; if (info > 0) chol_mat.resize (info - 1, info - 1); - else if (calc_cond) + else if (calc_cond) { octave_idx_type dpocon_info = 0; @@ -136,7 +136,7 @@ n, anorm, xrcond, pz, piz, dpocon_info F77_CHAR_ARG_LEN (1))); - if (dpocon_info != 0) + if (dpocon_info != 0) info = -1; } @@ -192,7 +192,7 @@ void CHOL::set (const Matrix& R) { - if (R.is_square ()) + if (R.is_square ()) chol_mat = R; else (*current_liboctave_error_handler) ("CHOL requires square matrix"); @@ -246,7 +246,7 @@ octave_idx_type info = -1; octave_idx_type n = chol_mat.rows (); - + if (u.length () != n + 1) (*current_liboctave_error_handler) ("cholinsert: dimension mismatch"); else if (j < 0 || j > n) @@ -270,14 +270,14 @@ CHOL::delete_sym (octave_idx_type j) { octave_idx_type n = chol_mat.rows (); - + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("choldelete: index out of range"); else { OCTAVE_LOCAL_BUFFER (double, w, n); - F77_XFCN (dchdex, DCHDEX, (n, chol_mat.fortran_vec (), chol_mat.rows (), + F77_XFCN (dchdex, DCHDEX, (n, chol_mat.fortran_vec (), chol_mat.rows (), j + 1, w)); chol_mat.resize (n-1, n-1); @@ -288,8 +288,8 @@ CHOL::shift_sym (octave_idx_type i, octave_idx_type j) { octave_idx_type n = chol_mat.rows (); - - if (i < 0 || i > n-1 || j < 0 || j > n-1) + + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("cholshift: index out of range"); else { @@ -311,7 +311,7 @@ if (u.length () == n) { - init (chol_mat.transpose () * chol_mat + init (chol_mat.transpose () * chol_mat + Matrix (u) * Matrix (u).transpose (), false); } else @@ -341,7 +341,7 @@ info = 2; else { - info = init (chol_mat.transpose () * chol_mat + info = init (chol_mat.transpose () * chol_mat - Matrix (u) * Matrix (u).transpose (), false); if (info) info = 1; } @@ -416,7 +416,7 @@ octave_idx_type n = chol_mat.rows (); - if (i < 0 || i > n-1 || j < 0 || j > n-1) + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("cholshift: index out of range"); else { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dbleCHOL.h --- a/liboctave/dbleCHOL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dbleCHOL.h Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ init (a, calc_cond); } - CHOL (const Matrix& a, octave_idx_type& info, bool calc_cond = false) + CHOL (const Matrix& a, octave_idx_type& info, bool calc_cond = false) : chol_mat (), xrcond (0) { info = init (a, calc_cond); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dbleGEPBAL.cc --- a/liboctave/dbleGEPBAL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dbleGEPBAL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -59,7 +59,7 @@ } octave_idx_type -GEPBALANCE::init (const Matrix& a, const Matrix& b, +GEPBALANCE::init (const Matrix& a, const Matrix& b, const std::string& balance_job) { octave_idx_type n = a.cols (); @@ -74,7 +74,7 @@ { gripe_nonconformant ("GEPBALANCE", n, n, b.rows(), b.cols()); return -1; - } + } octave_idx_type info; octave_idx_type ilo; @@ -115,7 +115,7 @@ n, p_balancing_mat, n, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - + // then right F77_XFCN (dggbak, DGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1), F77_CONST_CHAR_ARG2 ("R", 1), diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dbleGEPBAL.h --- a/liboctave/dbleGEPBAL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dbleGEPBAL.h Thu Jan 20 17:24:59 2011 -0500 @@ -41,7 +41,7 @@ GEPBALANCE (const Matrix& a, const Matrix& b, const std::string& balance_job) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () { - init (a, b, balance_job); + init (a, b, balance_job); } GEPBALANCE (const GEPBALANCE& a) @@ -80,7 +80,7 @@ Matrix balancing_mat; Matrix balancing_mat2; - octave_idx_type init (const Matrix& a, const Matrix& b, + octave_idx_type init (const Matrix& a, const Matrix& b, const std::string& balance_job); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dbleQR.cc --- a/liboctave/dbleQR.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dbleQR.cc Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ F77_FUNC (dgeqrf, DGEQRF) (const octave_idx_type&, const octave_idx_type&, double*, const octave_idx_type&, double*, double*, const octave_idx_type&, - octave_idx_type&); + octave_idx_type&); F77_RET_T F77_FUNC (dorgqr, DORGQR) (const octave_idx_type&, const octave_idx_type&, @@ -74,13 +74,13 @@ double*); F77_RET_T - F77_FUNC (dqrinr, DQRINR) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (dqrinr, DQRINR) (const octave_idx_type&, const octave_idx_type&, double*, const octave_idx_type&, double*, const octave_idx_type&, const octave_idx_type&, const double*, double*); F77_RET_T - F77_FUNC (dqrder, DQRDER) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (dqrder, DQRDER) (const octave_idx_type&, const octave_idx_type&, double*, const octave_idx_type&, double*, const octave_idx_type&, const octave_idx_type&, double*); @@ -133,7 +133,7 @@ form (n, afact, tau, qr_type); } -void QR::form (octave_idx_type n, Matrix& afact, +void QR::form (octave_idx_type n, Matrix& afact, double *tau, qr_type_t qr_type) { octave_idx_type m = afact.rows (), min_mn = std::min (m, n); @@ -251,7 +251,7 @@ if (u.length () != m) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > n) + else if (j < 0 || j > n) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -268,7 +268,7 @@ ColumnVector utmp = u; OCTAVE_LOCAL_BUFFER (double, w, k); F77_XFCN (dqrinc, DQRINC, (m, n, k, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), j + 1, + r.fortran_vec (), r.rows (), j + 1, utmp.data (), w)); } } @@ -311,9 +311,9 @@ { octave_idx_type ii = i; ColumnVector utmp = u.column (jsi(i)); - F77_XFCN (dqrinc, DQRINC, (m, n + ii, std::min (kmax, k + ii), + F77_XFCN (dqrinc, DQRINC, (m, n + ii, std::min (kmax, k + ii), q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), js(ii) + 1, + r.fortran_vec (), r.rows (), js(ii) + 1, utmp.data (), w)); } } @@ -326,7 +326,7 @@ octave_idx_type k = r.rows (); octave_idx_type n = r.columns (); - if (j < 0 || j > n-1) + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -370,7 +370,7 @@ for (volatile octave_idx_type i = 0; i < js.length (); i++) { octave_idx_type ii = i; - F77_XFCN (dqrdec, DQRDEC, (m, n - ii, k == m ? k : k - ii, + F77_XFCN (dqrdec, DQRDEC, (m, n - ii, k == m ? k : k - ii, q.fortran_vec (), q.rows (), r.fortran_vec (), r.rows (), js(ii) + 1, w)); } @@ -396,7 +396,7 @@ if (! q.is_square () || u.length () != n) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > m) + else if (j < 0 || j > m) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -405,7 +405,7 @@ RowVector utmp = u; OCTAVE_LOCAL_BUFFER (double, w, k); F77_XFCN (dqrinr, DQRINR, (m, n, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), + r.fortran_vec (), r.rows (), j + 1, utmp.fortran_vec (), w)); } @@ -419,7 +419,7 @@ if (! q.is_square ()) (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); - else if (j < 0 || j > m-1) + else if (j < 0 || j > m-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -440,12 +440,12 @@ octave_idx_type k = r.rows (); octave_idx_type n = r.columns (); - if (i < 0 || i > n-1 || j < 0 || j > n-1) + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrshift: index out of range"); else { OCTAVE_LOCAL_BUFFER (double, w, 2*k); - F77_XFCN (dqrshc, DQRSHC, (m, n, k, + F77_XFCN (dqrshc, DQRSHC, (m, n, k, q.fortran_vec (), q.rows (), r.fortran_vec (), r.rows (), i + 1, j + 1, w)); @@ -531,7 +531,7 @@ } static -Matrix shift_cols (const Matrix& a, +Matrix shift_cols (const Matrix& a, octave_idx_type i, octave_idx_type j) { octave_idx_type n = a.columns (); @@ -561,7 +561,7 @@ if (u.length () != m) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > n) + else if (j < 0 || j > n) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -607,7 +607,7 @@ octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); - if (j < 0 || j > n-1) + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -653,7 +653,7 @@ if (! q.is_square () || u.length () != n) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > m) + else if (j < 0 || j > m) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -669,7 +669,7 @@ if (! q.is_square ()) (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); - else if (j < 0 || j > m-1) + else if (j < 0 || j > m-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -685,7 +685,7 @@ octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); - if (i < 0 || i > n-1 || j < 0 || j > n-1) + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrshift: index out of range"); else { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dbleQR.h --- a/liboctave/dbleQR.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dbleQR.h Thu Jan 20 17:24:59 2011 -0500 @@ -1,7 +1,7 @@ /* Copyright (C) 1994-2011 John W. Eaton -Copyright (C) 2008-2009 Jaroslav Hajek +Copyright (C) 2008-2009 Jaroslav Hajek This file is part of Octave. @@ -48,7 +48,7 @@ QR (const Matrix&, qr_type_t = qr_type_std); - QR (const Matrix& qx, const Matrix& rx) + QR (const Matrix& qx, const Matrix& rx) : base_qr (qx, rx) { } QR (const QR& a) : base_qr (a) { } @@ -75,7 +75,7 @@ protected: - void form (octave_idx_type n, Matrix& afact, + void form (octave_idx_type n, Matrix& afact, double *tau, qr_type_t qr_type); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dbleSCHUR.h --- a/liboctave/dbleSCHUR.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dbleSCHUR.h Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ init (a, ord, calc_unitary); } - SCHUR (const Matrix& a, const std::string& ord, int& info, + SCHUR (const Matrix& a, const std::string& ord, int& info, bool calc_unitary = true) : schur_mat (), unitary_mat (), selector (0) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dbleSVD.h --- a/liboctave/dbleSVD.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dbleSVD.h Thu Jan 20 17:24:59 2011 -0500 @@ -49,15 +49,15 @@ SVD (void) : type_computed (), sigma (), left_sm (), right_sm () { } - SVD (const Matrix& a, - type svd_type = SVD::std, driver svd_driver = SVD::GESVD) + SVD (const Matrix& a, + type svd_type = SVD::std, driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () { init (a, svd_type, svd_driver); } - SVD (const Matrix& a, octave_idx_type& info, - type svd_type = SVD::std, driver svd_driver = SVD::GESVD) + SVD (const Matrix& a, octave_idx_type& info, + type svd_type = SVD::std, driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () { info = init (a, svd_type, svd_driver); @@ -99,7 +99,7 @@ Matrix left_sm; Matrix right_sm; - octave_idx_type init (const Matrix& a, + octave_idx_type init (const Matrix& a, type svd_type = std, driver svd_driver = GESVD); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dim-vector.cc --- a/liboctave/dim-vector.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dim-vector.cc Thu Jan 20 17:24:59 2011 -0500 @@ -108,7 +108,7 @@ return n; } -dim_vector +dim_vector dim_vector::squeeze (void) const { dim_vector new_dims = *this; @@ -226,12 +226,12 @@ } // Rules for horzcat/vertcat are yet looser. -// two arrays A, B can be concatenated +// two arrays A, B can be concatenated // horizontally (dim = 2) or vertically (dim = 1) if one of the // following holds, in this order: -// +// // 1. cat(dim, A, B) works -// +// // 2. A, B are 2D and one of them is an empty vector, in which // case the result is the other one except if both of them // are empty vectors, in which case the result is 0x0. diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dim-vector.h --- a/liboctave/dim-vector.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dim-vector.h Thu Jan 20 17:24:59 2011 -0500 @@ -208,7 +208,7 @@ void chop_all_singletons (void); private: - + static octave_idx_type *nil_rep (void) { static dim_vector zv (0, 0); @@ -367,7 +367,7 @@ // This corresponds to cat(). bool concat (const dim_vector& dvb, int dim); - // This corresponds to [,] (horzcat, dim = 0) and [;] (vertcat, dim = 1). + // This corresponds to [,] (horzcat, dim = 0) and [;] (vertcat, dim = 1). // The rules are more relaxed here. bool hvcat (const dim_vector& dvb, int dim); @@ -408,7 +408,7 @@ return i; } - return def; + return def; } // Compute a linear index from an index tuple. diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/dir-ops.cc --- a/liboctave/dir-ops.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/dir-ops.cc Thu Jan 20 17:24:59 2011 -0500 @@ -50,7 +50,7 @@ if (! name.empty ()) { close (); - + std::string fullname = file_ops::tilde_expand (name); dir = static_cast (gnulib::opendir (fullname.c_str ())); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/eigs-base.cc --- a/liboctave/eigs-base.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/eigs-base.cc Thu Jan 20 17:24:59 2011 -0500 @@ -46,7 +46,7 @@ #ifdef HAVE_ARPACK typedef ColumnVector (*EigsFunc) (const ColumnVector &x, int &eigs_error); -typedef ComplexColumnVector (*EigsComplexFunc) +typedef ComplexColumnVector (*EigsComplexFunc) (const ComplexColumnVector &x, int &eigs_error); // Arpack and blas fortran functions we call. @@ -56,11 +56,11 @@ F77_FUNC (dsaupd, DSAUPD) (octave_idx_type&, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const double&, double*, const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type*, - octave_idx_type*, double*, double*, + octave_idx_type*, double*, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); @@ -71,12 +71,12 @@ octave_idx_type*, double*, double*, const octave_idx_type&, const double&, F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, + const octave_idx_type&, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const double&, double*, const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type*, - octave_idx_type*, double*, double*, + octave_idx_type*, double*, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL @@ -86,11 +86,11 @@ F77_FUNC (dnaupd, DNAUPD) (octave_idx_type&, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, octave_idx_type&, const double&, double*, const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type*, - octave_idx_type*, double*, double*, + octave_idx_type*, double*, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); @@ -101,13 +101,13 @@ octave_idx_type*, double*, double*, double*, const octave_idx_type&, const double&, const double&, double*, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, - F77_CONST_CHAR_ARG_DECL, - octave_idx_type&, const double&, double*, - const octave_idx_type&, double*, - const octave_idx_type&, octave_idx_type*, - octave_idx_type*, double*, double*, + F77_CONST_CHAR_ARG_DECL, + octave_idx_type&, const double&, double*, + const octave_idx_type&, double*, + const octave_idx_type&, octave_idx_type*, + octave_idx_type*, double*, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL @@ -121,7 +121,7 @@ const octave_idx_type&, const double&, Complex*, const octave_idx_type&, Complex*, const octave_idx_type&, octave_idx_type*, - octave_idx_type*, Complex*, Complex*, + octave_idx_type*, Complex*, Complex*, const octave_idx_type&, double *, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); @@ -129,15 +129,15 @@ F77_RET_T F77_FUNC (zneupd, ZNEUPD) (const octave_idx_type&, F77_CONST_CHAR_ARG_DECL, - octave_idx_type*, Complex*, Complex*, + octave_idx_type*, Complex*, Complex*, const octave_idx_type&, const Complex&, Complex*, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const double&, Complex*, const octave_idx_type&, Complex*, const octave_idx_type&, octave_idx_type*, - octave_idx_type*, Complex*, Complex*, + octave_idx_type*, Complex*, Complex*, const octave_idx_type&, double *, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL @@ -168,7 +168,7 @@ lusolve (const SparseMatrix&, const SparseMatrix&, Matrix&); static octave_idx_type -lusolve (const SparseComplexMatrix&, const SparseComplexMatrix&, +lusolve (const SparseComplexMatrix&, const SparseComplexMatrix&, ComplexMatrix&); static octave_idx_type @@ -178,7 +178,7 @@ lusolve (const ComplexMatrix&, const ComplexMatrix&, ComplexMatrix&); static ComplexMatrix -ltsolve (const SparseComplexMatrix&, const ColumnVector&, +ltsolve (const SparseComplexMatrix&, const ColumnVector&, const ComplexMatrix&); static Matrix @@ -241,7 +241,7 @@ for (octave_idx_type j = 0; j < b_nc; j++) { for (octave_idx_type i = 0; i < n; i++) - retval.elem(static_cast(qv[i]), j) = + retval.elem(static_cast(qv[i]), j) = tmp.elem(i,j); } } @@ -297,7 +297,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable error in dgemv"); return false; } @@ -306,7 +306,7 @@ } static bool -vector_product (const SparseComplexMatrix& m, const Complex* x, +vector_product (const SparseComplexMatrix& m, const Complex* x, Complex* y) { octave_idx_type nc = m.cols (); @@ -334,7 +334,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable error in zgemv"); return false; } @@ -400,7 +400,7 @@ } static bool -make_cholb (SparseComplexMatrix& b, SparseComplexMatrix& bt, +make_cholb (SparseComplexMatrix& b, SparseComplexMatrix& bt, ColumnVector& permB) { octave_idx_type info; @@ -418,9 +418,9 @@ } static bool -LuAminusSigmaB (const SparseMatrix &m, const SparseMatrix &b, +LuAminusSigmaB (const SparseMatrix &m, const SparseMatrix &b, bool cholB, const ColumnVector& permB, double sigma, - SparseMatrix &L, SparseMatrix &U, octave_idx_type *P, + SparseMatrix &L, SparseMatrix &U, octave_idx_type *P, octave_idx_type *Q) { bool have_b = ! b.is_empty (); @@ -439,7 +439,7 @@ for (octave_idx_type i = 0; i < n; i++) { tmp.xcidx(i) = i; - tmp.xridx(i) = + tmp.xridx(i) = static_cast(permB(i)); tmp.xdata(i) = 1; } @@ -516,9 +516,9 @@ } static bool -LuAminusSigmaB (const Matrix &m, const Matrix &b, +LuAminusSigmaB (const Matrix &m, const Matrix &b, bool cholB, const ColumnVector& permB, double sigma, - Matrix &L, Matrix &U, octave_idx_type *P, + Matrix &L, Matrix &U, octave_idx_type *P, octave_idx_type *Q) { bool have_b = ! b.is_empty (); @@ -537,9 +537,9 @@ if (permB.length()) { - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j < b.cols(); j++) - for (octave_idx_type i = 0; + for (octave_idx_type i = 0; i < b.rows(); i++) *p++ -= tmp.xelem (static_cast(pB[i]), static_cast(pB[j])); @@ -563,7 +563,7 @@ L = fact.P().transpose() * fact.L (); U = fact.U (); for (octave_idx_type j = 0; j < n; j++) - P[j] = Q[j] = j; + P[j] = Q[j] = j; // Test condition number of LU decomposition double minU = octave_NaN; @@ -583,9 +583,9 @@ if (rcond_plus_one == 1.0 || xisnan (rcond)) { - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("eigs: 'A - sigma*B' is singular, indicating sigma is exactly"); - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) (" an eigenvalue. Convergence is not guaranteed"); } @@ -593,7 +593,7 @@ } static bool -LuAminusSigmaB (const SparseComplexMatrix &m, const SparseComplexMatrix &b, +LuAminusSigmaB (const SparseComplexMatrix &m, const SparseComplexMatrix &b, bool cholB, const ColumnVector& permB, Complex sigma, SparseComplexMatrix &L, SparseComplexMatrix &U, octave_idx_type *P, octave_idx_type *Q) @@ -614,13 +614,13 @@ for (octave_idx_type i = 0; i < n; i++) { tmp.xcidx(i) = i; - tmp.xridx(i) = + tmp.xridx(i) = static_cast(permB(i)); tmp.xdata(i) = 1; } tmp.xcidx(n) = n; - AminusSigmaB = AminusSigmaB - tmp * b.hermitian() * b * + AminusSigmaB = AminusSigmaB - tmp * b.hermitian() * b * tmp.transpose() * sigma; } else @@ -690,9 +690,9 @@ } static bool -LuAminusSigmaB (const ComplexMatrix &m, const ComplexMatrix &b, +LuAminusSigmaB (const ComplexMatrix &m, const ComplexMatrix &b, bool cholB, const ColumnVector& permB, Complex sigma, - ComplexMatrix &L, ComplexMatrix &U, octave_idx_type *P, + ComplexMatrix &L, ComplexMatrix &U, octave_idx_type *P, octave_idx_type *Q) { bool have_b = ! b.is_empty (); @@ -711,9 +711,9 @@ if (permB.length()) { - for (octave_idx_type j = 0; + for (octave_idx_type j = 0; j < b.cols(); j++) - for (octave_idx_type i = 0; + for (octave_idx_type i = 0; i < b.rows(); i++) *p++ -= tmp.xelem (static_cast(pB[i]), static_cast(pB[j])); @@ -737,7 +737,7 @@ L = fact.P().transpose() * fact.L (); U = fact.U (); for (octave_idx_type j = 0; j < n; j++) - P[j] = Q[j] = j; + P[j] = Q[j] = j; // Test condition number of LU decomposition double minU = octave_NaN; @@ -757,9 +757,9 @@ if (rcond_plus_one == 1.0 || xisnan (rcond)) { - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) ("eigs: 'A - sigma*B' is singular, indicating sigma is exactly"); - (*current_liboctave_warning_handler) + (*current_liboctave_warning_handler) (" an eigenvalue. Convergence is not guaranteed"); } @@ -768,12 +768,12 @@ template octave_idx_type -EigsRealSymmetricMatrix (const M& m, const std::string typ, +EigsRealSymmetricMatrix (const M& m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const M& _b, - ColumnVector &permB, ColumnVector &resid, - std::ostream& os, double tol, bool rvec, + ColumnVector &permB, ColumnVector &resid, + std::ostream& os, double tol, bool rvec, bool cholB, int disp, int maxit) { M b(_b); @@ -792,7 +792,7 @@ } if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); return -1; } @@ -818,14 +818,14 @@ if (p < 20) p = 20; - + if (p > n - 1) p = n - 1 ; } - + if (k < 1 || k > n - 2) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1-1).\n" " Use 'eig(full(A))' instead"); return -1; @@ -833,17 +833,17 @@ if (p <= k || p >= n) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: opts.p must be greater than k and less than n"); 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) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; } @@ -852,12 +852,12 @@ Array checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { - octave_idx_type bidx = + octave_idx_type bidx = static_cast (permB(i)); if (checked(bidx) || bidx < 0 || bidx >= n || D_NINT (bidx) != bidx) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; } @@ -865,18 +865,18 @@ } } - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && typ != "SI") { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); return -1; } - + if (typ == "LI" || typ == "SI" || typ == "LR" || typ == "SR") { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: invalid sigma value for real symmetric problem"); return -1; } @@ -900,7 +900,7 @@ { if (! make_cholb(b, bt, permB)) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: The matrix B is not positive definite"); return -1; } @@ -922,7 +922,7 @@ ip(9) = 0; ip(10) = 0; // ip(7) to ip(10) return values - + Array iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); @@ -935,9 +935,9 @@ OCTAVE_LOCAL_BUFFER (double, workd, 3 * n); double *presid = resid.fortran_vec (); - do + do { - F77_FUNC (dsaupd, DSAUPD) + F77_FUNC (dsaupd, DSAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), k, tol, presid, p, v, n, iparam, @@ -946,7 +946,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in dsaupd"); return -1; } @@ -955,7 +955,7 @@ { if (iter++) { - os << "Iteration " << iter - 1 << + os << "Iteration " << iter - 1 << ": a few Ritz values of the " << p << "-by-" << p << " matrix\n"; for (int i = 0 ; i < k; i++) @@ -968,7 +968,7 @@ // a value in this array to NaN and testing for it // is a way of obtaining the iteration counter. if (ido != 99) - workl[iptr(5)-1] = octave_NaN; + workl[iptr(5)-1] = octave_NaN; } if (ido == -1 || ido == 1 || ido == 2) @@ -978,13 +978,13 @@ Matrix mtmp (n,1); for (octave_idx_type i = 0; i < n; i++) mtmp(i,0) = workd[i + iptr(0) - 1]; - + mtmp = utsolve(bt, permB, m * ltsolve(b, permB, mtmp)); for (octave_idx_type i = 0; i < n; i++) workd[i+iptr(1)-1] = mtmp(i,0); } - else if (!vector_product (m, workd + iptr(0) - 1, + else if (!vector_product (m, workd + iptr(0) - 1, workd + iptr(1) - 1)) break; } @@ -992,23 +992,23 @@ { if (info < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dsaupd", info); return -1; } break; } - } + } while (1); octave_idx_type info2; - // We have a problem in that the size of the C++ bool - // type relative to the fortran logical type. It appears - // that fortran uses 4- or 8-bytes per logical and C++ 1-byte - // per bool, though this might be system dependent. As + // We have a problem in that the size of the C++ bool + // type relative to the fortran logical type. It appears + // that fortran uses 4- or 8-bytes per logical and C++ 1-byte + // per bool, though this might be system dependent. As // long as the HOWMNY arg is not "S", the logical array - // is just workspace for ARPACK, so use int type to + // is just workspace for ARPACK, so use int type to // avoid problems. Array s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); @@ -1019,11 +1019,11 @@ eig_val.resize (k); double *d = eig_val.fortran_vec (); - F77_FUNC (dseupd, DSEUPD) - (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, d, z, n, sigma, - F77_CONST_CHAR_ARG2 (&bmat, 1), n, + F77_FUNC (dseupd, DSEUPD) + (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, d, z, n, sigma, + F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, - ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) + ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); if (f77_exception_encountered) @@ -1078,7 +1078,7 @@ } else { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dseupd", info2); return -1; } @@ -1090,11 +1090,11 @@ template octave_idx_type EigsRealSymmetricMatrixShift (const M& m, double sigma, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, Matrix &eig_vec, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const M& _b, - ColumnVector &permB, ColumnVector &resid, - std::ostream& os, double tol, bool rvec, + ColumnVector &permB, ColumnVector &resid, + std::ostream& os, double tol, bool rvec, bool cholB, int disp, int maxit) { M b(_b); @@ -1110,7 +1110,7 @@ } if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); return -1; } @@ -1138,7 +1138,7 @@ if (k <= 0 || k >= n - 1) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1-1).\n" " Use 'eig(full(A))' instead"); return -1; @@ -1150,19 +1150,19 @@ if (p < 20) p = 20; - + if (p > n - 1) p = n - 1 ; } - + if (p <= k || p >= n) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: opts.p must be greater than k and less than n"); 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) @@ -1175,12 +1175,12 @@ Array checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { - octave_idx_type bidx = + octave_idx_type bidx = static_cast (permB(i)); if (checked(bidx) || bidx < 0 || bidx >= n || D_NINT (bidx) != bidx) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; } @@ -1228,9 +1228,9 @@ OCTAVE_LOCAL_BUFFER (double, workd, 3 * n); double *presid = resid.fortran_vec (); - do + do { - F77_FUNC (dsaupd, DSAUPD) + F77_FUNC (dsaupd, DSAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), k, tol, presid, p, v, n, iparam, @@ -1239,7 +1239,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in dsaupd"); return -1; } @@ -1248,7 +1248,7 @@ { if (iter++) { - os << "Iteration " << iter - 1 << + os << "Iteration " << iter - 1 << ": a few Ritz values of the " << p << "-by-" << p << " matrix\n"; for (int i = 0 ; i < k; i++) @@ -1261,7 +1261,7 @@ // a value in this array to NaN and testing for it // is a way of obtaining the iteration counter. if (ido != 99) - workl[iptr(5)-1] = octave_NaN; + workl[iptr(5)-1] = octave_NaN; } if (ido == -1 || ido == 1 || ido == 2) @@ -1278,7 +1278,7 @@ for (octave_idx_type i = 0; i < n; i++) tmp(i,0) = dtmp[P[i]]; - + lusolve (L, U, tmp); double *ip2 = workd+iptr(1)-1; @@ -1294,7 +1294,7 @@ for (octave_idx_type i = 0; i < n; i++) tmp(i,0) = ip2[P[i]]; - + lusolve (L, U, tmp); ip2 = workd+iptr(1)-1; @@ -1316,7 +1316,7 @@ for (octave_idx_type i = 0; i < n; i++) tmp(i,0) = ip2[P[i]]; - + lusolve (L, U, tmp); ip2 = workd+iptr(1)-1; @@ -1329,35 +1329,35 @@ { if (info < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dsaupd", info); return -1; } break; } - } + } while (1); octave_idx_type info2; - // We have a problem in that the size of the C++ bool - // type relative to the fortran logical type. It appears - // that fortran uses 4- or 8-bytes per logical and C++ 1-byte - // per bool, though this might be system dependent. As + // We have a problem in that the size of the C++ bool + // type relative to the fortran logical type. It appears + // that fortran uses 4- or 8-bytes per logical and C++ 1-byte + // per bool, though this might be system dependent. As // long as the HOWMNY arg is not "S", the logical array - // is just workspace for ARPACK, so use int type to + // is just workspace for ARPACK, so use int type to // avoid problems. Array s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); - + eig_vec.resize (n, k); double *z = eig_vec.fortran_vec (); eig_val.resize (k); double *d = eig_val.fortran_vec (); - F77_FUNC (dseupd, DSEUPD) - (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, d, z, n, sigma, + F77_FUNC (dseupd, DSEUPD) + (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, d, z, n, sigma, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info2 @@ -1418,9 +1418,9 @@ octave_idx_type EigsRealSymmetricFunc (EigsFunc fun, octave_idx_type n, const std::string &_typ, double sigma, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, Matrix &eig_vec, - ColumnVector &eig_val, ColumnVector &resid, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, Matrix &eig_vec, + ColumnVector &eig_val, ColumnVector &resid, std::ostream& os, double tol, bool rvec, bool /* cholB */, int disp, int maxit) { @@ -1451,11 +1451,11 @@ if (p < 20) p = 20; - + if (p > n - 1) p = n - 1 ; } - + if (k <= 0 || k >= n - 1) { (*current_liboctave_error_handler) @@ -1473,15 +1473,15 @@ if (! have_sigma) { - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && typ != "SI") - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); if (typ == "LI" || typ == "SI" || typ == "LR" || typ == "SR") { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: invalid sigma value for real symmetric problem"); return -1; } @@ -1516,7 +1516,7 @@ ip(9) = 0; ip(10) = 0; // ip(7) to ip(10) return values - + Array iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); @@ -1529,9 +1529,9 @@ OCTAVE_LOCAL_BUFFER (double, workd, 3 * n); double *presid = resid.fortran_vec (); - do + do { - F77_FUNC (dsaupd, DSAUPD) + F77_FUNC (dsaupd, DSAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), k, tol, presid, p, v, n, iparam, @@ -1540,7 +1540,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in dsaupd"); return -1; } @@ -1549,7 +1549,7 @@ { if (iter++) { - os << "Iteration " << iter - 1 << + os << "Iteration " << iter - 1 << ": a few Ritz values of the " << p << "-by-" << p << " matrix\n"; for (int i = 0 ; i < k; i++) @@ -1562,7 +1562,7 @@ // a value in this array to NaN and testing for it // is a way of obtaining the iteration counter. if (ido != 99) - workl[iptr(5)-1] = octave_NaN; + workl[iptr(5)-1] = octave_NaN; } @@ -1587,35 +1587,35 @@ { if (info < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dsaupd", info); return -1; } break; } - } + } while (1); octave_idx_type info2; - // We have a problem in that the size of the C++ bool - // type relative to the fortran logical type. It appears - // that fortran uses 4- or 8-bytes per logical and C++ 1-byte - // per bool, though this might be system dependent. As + // We have a problem in that the size of the C++ bool + // type relative to the fortran logical type. It appears + // that fortran uses 4- or 8-bytes per logical and C++ 1-byte + // per bool, though this might be system dependent. As // long as the HOWMNY arg is not "S", the logical array - // is just workspace for ARPACK, so use int type to + // is just workspace for ARPACK, so use int type to // avoid problems. Array s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); - + eig_vec.resize (n, k); double *z = eig_vec.fortran_vec (); eig_val.resize (k); double *d = eig_val.fortran_vec (); - F77_FUNC (dseupd, DSEUPD) - (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, d, z, n, sigma, + F77_FUNC (dseupd, DSEUPD) + (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, d, z, n, sigma, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, ipntr, workd, workl, lwork, info2 @@ -1681,12 +1681,12 @@ template octave_idx_type -EigsRealNonSymmetricMatrix (const M& m, const std::string typ, +EigsRealNonSymmetricMatrix (const M& m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M& _b, - ColumnVector &permB, ColumnVector &resid, - std::ostream& os, double tol, bool rvec, + ColumnVector &permB, ColumnVector &resid, + std::ostream& os, double tol, bool rvec, bool cholB, int disp, int maxit) { M b(_b); @@ -1706,7 +1706,7 @@ } if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); return -1; } @@ -1732,14 +1732,14 @@ if (p < 20) p = 20; - + if (p > n - 1) p = n - 1 ; } if (k <= 0 || k >= n - 1) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n" " Use 'eig(full(A))' instead"); return -1; @@ -1747,17 +1747,17 @@ if (p <= k || p >= n) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: opts.p must be greater than k and less than n"); 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) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; } @@ -1766,12 +1766,12 @@ Array checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { - octave_idx_type bidx = + octave_idx_type bidx = static_cast (permB(i)); if (checked(bidx) || bidx < 0 || bidx >= n || D_NINT (bidx) != bidx) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; } @@ -1779,18 +1779,18 @@ } } - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && typ != "SI") { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); return -1; } - + if (typ == "LA" || typ == "SA" || typ == "BE") { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: invalid sigma value for unsymmetric problem"); return -1; } @@ -1814,7 +1814,7 @@ { if (! make_cholb(b, bt, permB)) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: The matrix B is not positive definite"); return -1; } @@ -1836,7 +1836,7 @@ ip(9) = 0; ip(10) = 0; // ip(7) to ip(10) return values - + Array iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); @@ -1849,9 +1849,9 @@ OCTAVE_LOCAL_BUFFER (double, workd, 3 * n + 1); double *presid = resid.fortran_vec (); - do + do { - F77_FUNC (dnaupd, DNAUPD) + F77_FUNC (dnaupd, DNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), k, tol, presid, p, v, n, iparam, @@ -1860,7 +1860,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in dnaupd"); return -1; } @@ -1869,7 +1869,7 @@ { if (iter++) { - os << "Iteration " << iter - 1 << + os << "Iteration " << iter - 1 << ": a few Ritz values of the " << p << "-by-" << p << " matrix\n"; for (int i = 0 ; i < k; i++) @@ -1882,7 +1882,7 @@ // a value in this array to NaN and testing for it // is a way of obtaining the iteration counter. if (ido != 99) - workl[iptr(5)-1] = octave_NaN; + workl[iptr(5)-1] = octave_NaN; } if (ido == -1 || ido == 1 || ido == 2) @@ -1892,13 +1892,13 @@ Matrix mtmp (n,1); for (octave_idx_type i = 0; i < n; i++) mtmp(i,0) = workd[i + iptr(0) - 1]; - + mtmp = utsolve(bt, permB, m * ltsolve(b, permB, mtmp)); for (octave_idx_type i = 0; i < n; i++) workd[i+iptr(1)-1] = mtmp(i,0); } - else if (!vector_product (m, workd + iptr(0) - 1, + else if (!vector_product (m, workd + iptr(0) - 1, workd + iptr(1) - 1)) break; } @@ -1906,23 +1906,23 @@ { if (info < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dnaupd", info); return -1; } break; } - } + } while (1); octave_idx_type info2; - // We have a problem in that the size of the C++ bool - // type relative to the fortran logical type. It appears - // that fortran uses 4- or 8-bytes per logical and C++ 1-byte - // per bool, though this might be system dependent. As + // We have a problem in that the size of the C++ bool + // type relative to the fortran logical type. It appears + // that fortran uses 4- or 8-bytes per logical and C++ 1-byte + // per bool, though this might be system dependent. As // long as the HOWMNY arg is not "S", the logical array - // is just workspace for ARPACK, so use int type to + // is just workspace for ARPACK, so use int type to // avoid problems. Array s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); @@ -1936,11 +1936,11 @@ for (octave_idx_type i = 0; i < k+1; i++) dr[i] = di[i] = 0.; - F77_FUNC (dneupd, DNEUPD) - (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, dr, di, z, n, sigmar, + F77_FUNC (dneupd, DNEUPD) + (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, dr, di, z, n, sigmar, sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, - ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) + ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); if (f77_exception_encountered) @@ -2008,7 +2008,7 @@ if (std::imag(eig_val(i)) == 0) { for (octave_idx_type j = 0; j < n; j++) - eig_vec(j,i) = + eig_vec(j,i) = Complex(z[j+off1],0.); i++; } @@ -2016,10 +2016,10 @@ { for (octave_idx_type j = 0; j < n; j++) { - eig_vec(j,i) = + eig_vec(j,i) = Complex(z[j+off1],z[j+off2]); if (i < k - 1) - eig_vec(j,i+1) = + eig_vec(j,i+1) = Complex(z[j+off1],-z[j+off2]); } i+=2; @@ -2032,7 +2032,7 @@ } else { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dneupd", info2); return -1; } @@ -2044,12 +2044,12 @@ template octave_idx_type EigsRealNonSymmetricMatrixShift (const M& m, double sigmar, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, - ComplexMatrix &eig_vec, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, + ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M& _b, - ColumnVector &permB, ColumnVector &resid, - std::ostream& os, double tol, bool rvec, + ColumnVector &permB, ColumnVector &resid, + std::ostream& os, double tol, bool rvec, bool cholB, int disp, int maxit) { M b(_b); @@ -2066,7 +2066,7 @@ } if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); return -1; } @@ -2098,14 +2098,14 @@ if (p < 20) p = 20; - + if (p > n - 1) p = n - 1 ; } if (k <= 0 || k >= n - 1) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n" " Use 'eig(full(A))' instead"); return -1; @@ -2113,12 +2113,12 @@ if (p <= k || p >= n) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: opts.p must be greater than k and less than n"); 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) @@ -2131,12 +2131,12 @@ Array checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { - octave_idx_type bidx = + octave_idx_type bidx = static_cast (permB(i)); if (checked(bidx) || bidx < 0 || bidx >= n || D_NINT (bidx) != bidx) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; } @@ -2184,9 +2184,9 @@ OCTAVE_LOCAL_BUFFER (double, workd, 3 * n + 1); double *presid = resid.fortran_vec (); - do + do { - F77_FUNC (dnaupd, DNAUPD) + F77_FUNC (dnaupd, DNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), k, tol, presid, p, v, n, iparam, @@ -2195,7 +2195,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in dsaupd"); return -1; } @@ -2204,7 +2204,7 @@ { if (iter++) { - os << "Iteration " << iter - 1 << + os << "Iteration " << iter - 1 << ": a few Ritz values of the " << p << "-by-" << p << " matrix\n"; for (int i = 0 ; i < k; i++) @@ -2217,7 +2217,7 @@ // a value in this array to NaN and testing for it // is a way of obtaining the iteration counter. if (ido != 99) - workl[iptr(5)-1] = octave_NaN; + workl[iptr(5)-1] = octave_NaN; } if (ido == -1 || ido == 1 || ido == 2) @@ -2234,7 +2234,7 @@ for (octave_idx_type i = 0; i < n; i++) tmp(i,0) = dtmp[P[i]]; - + lusolve (L, U, tmp); double *ip2 = workd+iptr(1)-1; @@ -2250,7 +2250,7 @@ for (octave_idx_type i = 0; i < n; i++) tmp(i,0) = ip2[P[i]]; - + lusolve (L, U, tmp); ip2 = workd+iptr(1)-1; @@ -2272,7 +2272,7 @@ for (octave_idx_type i = 0; i < n; i++) tmp(i,0) = ip2[P[i]]; - + lusolve (L, U, tmp); ip2 = workd+iptr(1)-1; @@ -2285,27 +2285,27 @@ { if (info < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dsaupd", info); return -1; } break; } - } + } while (1); octave_idx_type info2; - // We have a problem in that the size of the C++ bool - // type relative to the fortran logical type. It appears - // that fortran uses 4- or 8-bytes per logical and C++ 1-byte - // per bool, though this might be system dependent. As + // We have a problem in that the size of the C++ bool + // type relative to the fortran logical type. It appears + // that fortran uses 4- or 8-bytes per logical and C++ 1-byte + // per bool, though this might be system dependent. As // long as the HOWMNY arg is not "S", the logical array - // is just workspace for ARPACK, so use int type to + // is just workspace for ARPACK, so use int type to // avoid problems. Array s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); - + Matrix eig_vec2 (n, k + 1); double *z = eig_vec2.fortran_vec (); @@ -2315,11 +2315,11 @@ for (octave_idx_type i = 0; i < k+1; i++) dr[i] = di[i] = 0.; - F77_FUNC (dneupd, DNEUPD) - (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, dr, di, z, n, sigmar, + F77_FUNC (dneupd, DNEUPD) + (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, dr, di, z, n, sigmar, sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, - ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) + ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); if (f77_exception_encountered) @@ -2387,7 +2387,7 @@ if (std::imag(eig_val(i)) == 0) { for (octave_idx_type j = 0; j < n; j++) - eig_vec(j,i) = + eig_vec(j,i) = Complex(z[j+off1],0.); i++; } @@ -2395,10 +2395,10 @@ { for (octave_idx_type j = 0; j < n; j++) { - eig_vec(j,i) = + eig_vec(j,i) = Complex(z[j+off1],z[j+off2]); if (i < k - 1) - eig_vec(j,i+1) = + eig_vec(j,i+1) = Complex(z[j+off1],-z[j+off2]); } i+=2; @@ -2408,7 +2408,7 @@ } else { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dneupd", info2); return -1; } @@ -2420,9 +2420,9 @@ octave_idx_type EigsRealNonSymmetricFunc (EigsFunc fun, octave_idx_type n, const std::string &_typ, double sigmar, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, ComplexMatrix &eig_vec, - ComplexColumnVector &eig_val, ColumnVector &resid, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, ComplexMatrix &eig_vec, + ComplexColumnVector &eig_val, ColumnVector &resid, std::ostream& os, double tol, bool rvec, bool /* cholB */, int disp, int maxit) { @@ -2454,7 +2454,7 @@ if (p < 20) p = 20; - + if (p > n - 1) p = n - 1 ; } @@ -2477,15 +2477,15 @@ if (! have_sigma) { - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && typ != "SI") - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); if (typ == "LA" || typ == "SA" || typ == "BE") { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: invalid sigma value for unsymmetric problem"); return -1; } @@ -2520,7 +2520,7 @@ ip(9) = 0; ip(10) = 0; // ip(7) to ip(10) return values - + Array iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); @@ -2533,9 +2533,9 @@ OCTAVE_LOCAL_BUFFER (double, workd, 3 * n + 1); double *presid = resid.fortran_vec (); - do + do { - F77_FUNC (dnaupd, DNAUPD) + F77_FUNC (dnaupd, DNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), k, tol, presid, p, v, n, iparam, @@ -2544,7 +2544,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in dnaupd"); return -1; } @@ -2553,7 +2553,7 @@ { if (iter++) { - os << "Iteration " << iter - 1 << + os << "Iteration " << iter - 1 << ": a few Ritz values of the " << p << "-by-" << p << " matrix\n"; for (int i = 0 ; i < k; i++) @@ -2566,7 +2566,7 @@ // a value in this array to NaN and testing for it // is a way of obtaining the iteration counter. if (ido != 99) - workl[iptr(5)-1] = octave_NaN; + workl[iptr(5)-1] = octave_NaN; } if (ido == -1 || ido == 1 || ido == 2) @@ -2590,23 +2590,23 @@ { if (info < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dsaupd", info); return -1; } break; } - } + } while (1); octave_idx_type info2; - // We have a problem in that the size of the C++ bool - // type relative to the fortran logical type. It appears - // that fortran uses 4- or 8-bytes per logical and C++ 1-byte - // per bool, though this might be system dependent. As + // We have a problem in that the size of the C++ bool + // type relative to the fortran logical type. It appears + // that fortran uses 4- or 8-bytes per logical and C++ 1-byte + // per bool, though this might be system dependent. As // long as the HOWMNY arg is not "S", the logical array - // is just workspace for ARPACK, so use int type to + // is just workspace for ARPACK, so use int type to // avoid problems. Array s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); @@ -2620,11 +2620,11 @@ for (octave_idx_type i = 0; i < k+1; i++) dr[i] = di[i] = 0.; - F77_FUNC (dneupd, DNEUPD) - (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, dr, di, z, n, sigmar, + F77_FUNC (dneupd, DNEUPD) + (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, dr, di, z, n, sigmar, sigmai, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), k, tol, presid, p, v, n, iparam, - ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) + ipntr, workd, workl, lwork, info2 F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(1) F77_CHAR_ARG_LEN(2)); if (f77_exception_encountered) @@ -2692,7 +2692,7 @@ if (std::imag(eig_val(i)) == 0) { for (octave_idx_type j = 0; j < n; j++) - eig_vec(j,i) = + eig_vec(j,i) = Complex(z[j+off1],0.); i++; } @@ -2700,10 +2700,10 @@ { for (octave_idx_type j = 0; j < n; j++) { - eig_vec(j,i) = + eig_vec(j,i) = Complex(z[j+off1],z[j+off2]); if (i < k - 1) - eig_vec(j,i+1) = + eig_vec(j,i+1) = Complex(z[j+off1],-z[j+off2]); } i+=2; @@ -2713,7 +2713,7 @@ } else { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dneupd", info2); return -1; } @@ -2724,13 +2724,13 @@ template octave_idx_type -EigsComplexNonSymmetricMatrix (const M& m, const std::string typ, +EigsComplexNonSymmetricMatrix (const M& m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M& _b, - ColumnVector &permB, - ComplexColumnVector &cresid, - std::ostream& os, double tol, bool rvec, + ColumnVector &permB, + ComplexColumnVector &cresid, + std::ostream& os, double tol, bool rvec, bool cholB, int disp, int maxit) { M b(_b); @@ -2749,7 +2749,7 @@ } if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); return -1; } @@ -2779,14 +2779,14 @@ if (p < 20) p = 20; - + if (p > n - 1) p = n - 1 ; } if (k <= 0 || k >= n - 1) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n" " Use 'eig(full(A))' instead"); return -1; @@ -2794,17 +2794,17 @@ if (p <= k || p >= n) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: opts.p must be greater than k and less than n"); 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) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; } @@ -2813,12 +2813,12 @@ Array checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { - octave_idx_type bidx = + octave_idx_type bidx = static_cast (permB(i)); if (checked(bidx) || bidx < 0 || bidx >= n || D_NINT (bidx) != bidx) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; } @@ -2826,18 +2826,18 @@ } } - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && typ != "SI") { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); return -1; } - + if (typ == "LA" || typ == "SA" || typ == "BE") { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: invalid sigma value for complex problem"); return -1; } @@ -2861,7 +2861,7 @@ { if (! make_cholb(b, bt, permB)) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: The matrix B is not positive definite"); return -1; } @@ -2883,23 +2883,23 @@ ip(9) = 0; ip(10) = 0; // ip(7) to ip(10) return values - + Array iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); octave_idx_type ido = 0; int iter = 0; octave_idx_type lwork = p * (3 * p + 5); - + OCTAVE_LOCAL_BUFFER (Complex, v, n * p); OCTAVE_LOCAL_BUFFER (Complex, workl, lwork); OCTAVE_LOCAL_BUFFER (Complex, workd, 3 * n); OCTAVE_LOCAL_BUFFER (double, rwork, p); Complex *presid = cresid.fortran_vec (); - do + do { - F77_FUNC (znaupd, ZNAUPD) + F77_FUNC (znaupd, ZNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), k, tol, presid, p, v, n, iparam, @@ -2908,7 +2908,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in znaupd"); return -1; } @@ -2917,20 +2917,20 @@ { if (iter++) { - os << "Iteration " << iter - 1 << + os << "Iteration " << iter - 1 << ": a few Ritz values of the " << p << "-by-" << p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; } - + // This is a kludge, as ARPACK doesn't give its // iteration pointer. But as workl[iptr(5)-1] is // an output value updated at each iteration, setting // a value in this array to NaN and testing for it // is a way of obtaining the iteration counter. if (ido != 99) - workl[iptr(5)-1] = octave_NaN; + workl[iptr(5)-1] = octave_NaN; } if (ido == -1 || ido == 1 || ido == 2) @@ -2945,7 +2945,7 @@ workd[i+iptr(1)-1] = mtmp(i,0); } - else if (!vector_product (m, workd + iptr(0) - 1, + else if (!vector_product (m, workd + iptr(0) - 1, workd + iptr(1) - 1)) break; } @@ -2953,23 +2953,23 @@ { if (info < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in znaupd", info); return -1; } break; } - } + } while (1); octave_idx_type info2; - // We have a problem in that the size of the C++ bool - // type relative to the fortran logical type. It appears - // that fortran uses 4- or 8-bytes per logical and C++ 1-byte - // per bool, though this might be system dependent. As + // We have a problem in that the size of the C++ bool + // type relative to the fortran logical type. It appears + // that fortran uses 4- or 8-bytes per logical and C++ 1-byte + // per bool, though this might be system dependent. As // long as the HOWMNY arg is not "S", the logical array - // is just workspace for ARPACK, so use int type to + // is just workspace for ARPACK, so use int type to // avoid problems. Array s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); @@ -2982,7 +2982,7 @@ OCTAVE_LOCAL_BUFFER (Complex, workev, 2 * p); - F77_FUNC (zneupd, ZNEUPD) + F77_FUNC (zneupd, ZNEUPD) (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, d, z, n, sigma, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), @@ -2991,7 +2991,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in zneupd"); return -1; } @@ -3035,7 +3035,7 @@ } else { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in zneupd", info2); return -1; } @@ -3046,13 +3046,13 @@ template octave_idx_type EigsComplexNonSymmetricMatrixShift (const M& m, Complex sigma, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, - ComplexMatrix &eig_vec, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, + ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M& _b, - ColumnVector &permB, - ComplexColumnVector &cresid, - std::ostream& os, double tol, bool rvec, + ColumnVector &permB, + ComplexColumnVector &cresid, + std::ostream& os, double tol, bool rvec, bool cholB, int disp, int maxit) { M b(_b); @@ -3068,7 +3068,7 @@ } if (have_b && (m.rows() != b.rows() || m.rows() != b.cols())) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: B must be square and the same size as A"); return -1; } @@ -3104,14 +3104,14 @@ if (p < 20) p = 20; - + if (p > n - 1) p = n - 1 ; } if (k <= 0 || k >= n - 1) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: Invalid number of eigenvalues to extract (must be 0 < k < n-1).\n" " Use 'eig(full(A))' instead"); return -1; @@ -3119,12 +3119,12 @@ if (p <= k || p >= n) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: opts.p must be greater than k and less than n"); 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) @@ -3137,12 +3137,12 @@ Array checked (dim_vector (n, 1), false); for (octave_idx_type i = 0; i < n; i++) { - octave_idx_type bidx = + octave_idx_type bidx = static_cast (permB(i)); if (checked(bidx) || bidx < 0 || bidx >= n || D_NINT (bidx) != bidx) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: permB vector invalid"); return -1; } @@ -3184,16 +3184,16 @@ return -1; octave_idx_type lwork = p * (3 * p + 5); - + OCTAVE_LOCAL_BUFFER (Complex, v, n * p); OCTAVE_LOCAL_BUFFER (Complex, workl, lwork); OCTAVE_LOCAL_BUFFER (Complex, workd, 3 * n); OCTAVE_LOCAL_BUFFER (double, rwork, p); Complex *presid = cresid.fortran_vec (); - do + do { - F77_FUNC (znaupd, ZNAUPD) + F77_FUNC (znaupd, ZNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), k, tol, presid, p, v, n, iparam, @@ -3202,7 +3202,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in znaupd"); return -1; } @@ -3211,20 +3211,20 @@ { if (iter++) { - os << "Iteration " << iter - 1 << + os << "Iteration " << iter - 1 << ": a few Ritz values of the " << p << "-by-" << p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; } - + // This is a kludge, as ARPACK doesn't give its // iteration pointer. But as workl[iptr(5)-1] is // an output value updated at each iteration, setting // a value in this array to NaN and testing for it // is a way of obtaining the iteration counter. if (ido != 99) - workl[iptr(5)-1] = octave_NaN; + workl[iptr(5)-1] = octave_NaN; } if (ido == -1 || ido == 1 || ido == 2) @@ -3241,7 +3241,7 @@ for (octave_idx_type i = 0; i < n; i++) tmp(i,0) = ctmp[P[i]]; - + lusolve (L, U, tmp); Complex *ip2 = workd+iptr(1)-1; @@ -3257,7 +3257,7 @@ for (octave_idx_type i = 0; i < n; i++) tmp(i,0) = ip2[P[i]]; - + lusolve (L, U, tmp); ip2 = workd+iptr(1)-1; @@ -3280,7 +3280,7 @@ for (octave_idx_type i = 0; i < n; i++) tmp(i,0) = ip2[P[i]]; - + lusolve (L, U, tmp); ip2 = workd+iptr(1)-1; @@ -3293,23 +3293,23 @@ { if (info < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dsaupd", info); return -1; } break; } - } + } while (1); octave_idx_type info2; - // We have a problem in that the size of the C++ bool - // type relative to the fortran logical type. It appears - // that fortran uses 4- or 8-bytes per logical and C++ 1-byte - // per bool, though this might be system dependent. As + // We have a problem in that the size of the C++ bool + // type relative to the fortran logical type. It appears + // that fortran uses 4- or 8-bytes per logical and C++ 1-byte + // per bool, though this might be system dependent. As // long as the HOWMNY arg is not "S", the logical array - // is just workspace for ARPACK, so use int type to + // is just workspace for ARPACK, so use int type to // avoid problems. Array s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); @@ -3322,7 +3322,7 @@ OCTAVE_LOCAL_BUFFER (Complex, workev, 2 * p); - F77_FUNC (zneupd, ZNEUPD) + F77_FUNC (zneupd, ZNEUPD) (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, d, z, n, sigma, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), @@ -3331,7 +3331,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in zneupd"); return -1; } @@ -3372,7 +3372,7 @@ } else { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in zneupd", info2); return -1; } @@ -3383,10 +3383,10 @@ octave_idx_type EigsComplexNonSymmetricFunc (EigsComplexFunc fun, octave_idx_type n, const std::string &_typ, Complex sigma, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, ComplexMatrix &eig_vec, - ComplexColumnVector &eig_val, - ComplexColumnVector &cresid, std::ostream& os, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, ComplexMatrix &eig_vec, + ComplexColumnVector &eig_val, + ComplexColumnVector &cresid, std::ostream& os, double tol, bool rvec, bool /* cholB */, int disp, int maxit) { @@ -3421,7 +3421,7 @@ if (p < 20) p = 20; - + if (p > n - 1) p = n - 1 ; } @@ -3443,15 +3443,15 @@ if (! have_sigma) { - if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && + if (typ != "LM" && typ != "SM" && typ != "LA" && typ != "SA" && typ != "BE" && typ != "LR" && typ != "SR" && typ != "LI" && typ != "SI") - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecognized sigma value"); if (typ == "LA" || typ == "SA" || typ == "BE") { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: invalid sigma value for complex problem"); return -1; } @@ -3486,23 +3486,23 @@ ip(9) = 0; ip(10) = 0; // ip(7) to ip(10) return values - + Array iptr (dim_vector (14, 1)); octave_idx_type *ipntr = iptr.fortran_vec (); octave_idx_type ido = 0; int iter = 0; octave_idx_type lwork = p * (3 * p + 5); - + OCTAVE_LOCAL_BUFFER (Complex, v, n * p); OCTAVE_LOCAL_BUFFER (Complex, workl, lwork); OCTAVE_LOCAL_BUFFER (Complex, workd, 3 * n); OCTAVE_LOCAL_BUFFER (double, rwork, p); Complex *presid = cresid.fortran_vec (); - do + do { - F77_FUNC (znaupd, ZNAUPD) + F77_FUNC (znaupd, ZNAUPD) (ido, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str()), 2), k, tol, presid, p, v, n, iparam, @@ -3511,7 +3511,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in znaupd"); return -1; } @@ -3520,20 +3520,20 @@ { if (iter++) { - os << "Iteration " << iter - 1 << + os << "Iteration " << iter - 1 << ": a few Ritz values of the " << p << "-by-" << p << " matrix\n"; for (int i = 0 ; i < k; i++) os << " " << workl[iptr(5)+i-1] << "\n"; } - + // This is a kludge, as ARPACK doesn't give its // iteration pointer. But as workl[iptr(5)-1] is // an output value updated at each iteration, setting // a value in this array to NaN and testing for it // is a way of obtaining the iteration counter. if (ido != 99) - workl[iptr(5)-1] = octave_NaN; + workl[iptr(5)-1] = octave_NaN; } if (ido == -1 || ido == 1 || ido == 2) @@ -3557,23 +3557,23 @@ { if (info < 0) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in dsaupd", info); return -1; } break; } - } + } while (1); octave_idx_type info2; - // We have a problem in that the size of the C++ bool - // type relative to the fortran logical type. It appears - // that fortran uses 4- or 8-bytes per logical and C++ 1-byte - // per bool, though this might be system dependent. As + // We have a problem in that the size of the C++ bool + // type relative to the fortran logical type. It appears + // that fortran uses 4- or 8-bytes per logical and C++ 1-byte + // per bool, though this might be system dependent. As // long as the HOWMNY arg is not "S", the logical array - // is just workspace for ARPACK, so use int type to + // is just workspace for ARPACK, so use int type to // avoid problems. Array s (dim_vector (p, 1)); octave_idx_type *sel = s.fortran_vec (); @@ -3586,7 +3586,7 @@ OCTAVE_LOCAL_BUFFER (Complex, workev, 2 * p); - F77_FUNC (zneupd, ZNEUPD) + F77_FUNC (zneupd, ZNEUPD) (rvec, F77_CONST_CHAR_ARG2 ("A", 1), sel, d, z, n, sigma, workev, F77_CONST_CHAR_ARG2 (&bmat, 1), n, F77_CONST_CHAR_ARG2 ((typ.c_str ()), 2), @@ -3595,7 +3595,7 @@ if (f77_exception_encountered) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: unrecoverable exception encountered in zneupd"); return -1; } @@ -3636,7 +3636,7 @@ } else { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("eigs: error %d in zneupd", info2); return -1; } @@ -3646,95 +3646,95 @@ #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) extern octave_idx_type -EigsRealSymmetricMatrix (const Matrix& m, const std::string typ, +EigsRealSymmetricMatrix (const Matrix& m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const Matrix& b, - ColumnVector &permB, ColumnVector &resid, + ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); extern octave_idx_type -EigsRealSymmetricMatrix (const SparseMatrix& m, const std::string typ, +EigsRealSymmetricMatrix (const SparseMatrix& m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const SparseMatrix& b, - ColumnVector &permB, ColumnVector &resid, + ColumnVector &permB, ColumnVector &resid, std::ostream& os, double tol = DBL_EPSILON, - bool rvec = false, bool cholB = 0, int disp = 0, + bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); extern octave_idx_type EigsRealSymmetricMatrixShift (const Matrix& m, double sigma, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, Matrix &eig_vec, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const Matrix& b, - ColumnVector &permB, ColumnVector &resid, + ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, - bool rvec = false, bool cholB = 0, int disp = 0, + bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); extern octave_idx_type EigsRealSymmetricMatrixShift (const SparseMatrix& m, double sigma, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, Matrix &eig_vec, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const SparseMatrix& b, - ColumnVector &permB, ColumnVector &resid, + ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, - bool rvec = false, bool cholB = 0, int disp = 0, + bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); extern octave_idx_type EigsRealSymmetricFunc (EigsFunc fun, octave_idx_type n, const std::string &typ, double sigma, - octave_idx_type k, octave_idx_type p, + octave_idx_type k, octave_idx_type p, octave_idx_type &info, - Matrix &eig_vec, ColumnVector &eig_val, + Matrix &eig_vec, ColumnVector &eig_val, ColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); extern octave_idx_type -EigsRealNonSymmetricMatrix (const Matrix& m, const std::string typ, +EigsRealNonSymmetricMatrix (const Matrix& m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const Matrix& b, - ColumnVector &permB, ColumnVector &resid, + ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); extern octave_idx_type -EigsRealNonSymmetricMatrix (const SparseMatrix& m, const std::string typ, +EigsRealNonSymmetricMatrix (const SparseMatrix& m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, - ComplexColumnVector &eig_val, + ComplexColumnVector &eig_val, const SparseMatrix& b, - ColumnVector &permB, ColumnVector &resid, + ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); extern octave_idx_type EigsRealNonSymmetricMatrixShift (const Matrix& m, double sigma, - octave_idx_type k, octave_idx_type p, + octave_idx_type k, octave_idx_type p, octave_idx_type &info, - ComplexMatrix &eig_vec, + ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const Matrix& b, - ColumnVector &permB, ColumnVector &resid, + ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); extern octave_idx_type EigsRealNonSymmetricMatrixShift (const SparseMatrix& m, double sigma, - octave_idx_type k, octave_idx_type p, + octave_idx_type k, octave_idx_type p, octave_idx_type &info, - ComplexMatrix &eig_vec, - ComplexColumnVector &eig_val, + ComplexMatrix &eig_vec, + ComplexColumnVector &eig_val, const SparseMatrix& b, - ColumnVector &permB, ColumnVector &resid, + ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); @@ -3742,46 +3742,46 @@ extern octave_idx_type EigsRealNonSymmetricFunc (EigsFunc fun, octave_idx_type n, const std::string &_typ, double sigma, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, ComplexMatrix &eig_vec, - ComplexColumnVector &eig_val, - ColumnVector &resid, std::ostream& os, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, ComplexMatrix &eig_vec, + ComplexColumnVector &eig_val, + ColumnVector &resid, std::ostream& os, double tol = DBL_EPSILON, bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); extern octave_idx_type -EigsComplexNonSymmetricMatrix (const ComplexMatrix& m, const std::string typ, +EigsComplexNonSymmetricMatrix (const ComplexMatrix& m, const std::string typ, octave_idx_type k, octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, - ComplexColumnVector &eig_val, - const ComplexMatrix& b, ColumnVector &permB, - ComplexColumnVector &resid, + ComplexColumnVector &eig_val, + const ComplexMatrix& b, ColumnVector &permB, + ComplexColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, - bool rvec = false, bool cholB = 0, int disp = 0, + bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); extern octave_idx_type -EigsComplexNonSymmetricMatrix (const SparseComplexMatrix& m, - const std::string typ, octave_idx_type k, - octave_idx_type p, octave_idx_type &info, +EigsComplexNonSymmetricMatrix (const SparseComplexMatrix& m, + const std::string typ, octave_idx_type k, + octave_idx_type p, octave_idx_type &info, ComplexMatrix &eig_vec, - ComplexColumnVector &eig_val, + ComplexColumnVector &eig_val, const SparseComplexMatrix& b, ColumnVector &permB, - ComplexColumnVector &resid, + ComplexColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, - bool rvec = false, bool cholB = 0, int disp = 0, + bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); extern octave_idx_type EigsComplexNonSymmetricMatrixShift (const ComplexMatrix& m, Complex sigma, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, - ComplexMatrix &eig_vec, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, + ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const ComplexMatrix& b, ColumnVector &permB, - ComplexColumnVector &resid, + ComplexColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); @@ -3789,13 +3789,13 @@ extern octave_idx_type EigsComplexNonSymmetricMatrixShift (const SparseComplexMatrix& m, Complex sigma, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, - ComplexMatrix &eig_vec, - ComplexColumnVector &eig_val, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, + ComplexMatrix &eig_vec, + ComplexColumnVector &eig_val, const SparseComplexMatrix& b, ColumnVector &permB, - ComplexColumnVector &resid, + ComplexColumnVector &resid, std::ostream &os, double tol = DBL_EPSILON, bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); @@ -3803,10 +3803,10 @@ extern octave_idx_type EigsComplexNonSymmetricFunc (EigsComplexFunc fun, octave_idx_type n, const std::string &_typ, Complex sigma, - octave_idx_type k, octave_idx_type p, - octave_idx_type &info, ComplexMatrix &eig_vec, - ComplexColumnVector &eig_val, - ComplexColumnVector &resid, std::ostream& os, + octave_idx_type k, octave_idx_type p, + octave_idx_type &info, ComplexMatrix &eig_vec, + ComplexColumnVector &eig_val, + ComplexColumnVector &resid, std::ostream& os, double tol = DBL_EPSILON, bool rvec = false, bool cholB = 0, int disp = 0, int maxit = 300); #endif @@ -3816,7 +3816,7 @@ lusolve (const SparseMatrix&, const SparseMatrix&, Matrix&); template static octave_idx_type -lusolve (const SparseComplexMatrix&, const SparseComplexMatrix&, +lusolve (const SparseComplexMatrix&, const SparseComplexMatrix&, ComplexMatrix&); template static octave_idx_type @@ -3826,7 +3826,7 @@ lusolve (const ComplexMatrix&, const ComplexMatrix&, ComplexMatrix&); template static ComplexMatrix -ltsolve (const SparseComplexMatrix&, const ColumnVector&, +ltsolve (const SparseComplexMatrix&, const ColumnVector&, const ComplexMatrix&); template static Matrix diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/f2c-main.c --- a/liboctave/f2c-main.c Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/f2c-main.c Thu Jan 20 17:24:59 2011 -0500 @@ -24,7 +24,7 @@ /* Dummy Fortran main declaration, needed in order to link to some - Fortran libraries. See the AC_F77_DUMMY_MAIN macro documentation. + Fortran libraries. See the AC_F77_DUMMY_MAIN macro documentation. This function should never be called. */ #ifdef F77_DUMMY_MAIN diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCColVector.cc --- a/liboctave/fCColVector.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCColVector.cc Thu Jan 20 17:24:59 2011 -0500 @@ -221,13 +221,13 @@ return retval; } -FloatComplexRowVector +FloatComplexRowVector FloatComplexColumnVector::hermitian (void) const { return MArray::hermitian (std::conj); } -FloatComplexRowVector +FloatComplexRowVector FloatComplexColumnVector::transpose (void) const { return MArray::transpose (); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCColVector.h --- a/liboctave/fCColVector.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCColVector.h Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ explicit FloatComplexColumnVector (octave_idx_type n) : MArray (dim_vector (n, 1)) { } - explicit FloatComplexColumnVector (const dim_vector& dv) + explicit FloatComplexColumnVector (const dim_vector& dv) : MArray (dv.as_column ()) { } FloatComplexColumnVector (octave_idx_type n, const FloatComplex& val) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCDiagMatrix.cc --- a/liboctave/fCDiagMatrix.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCDiagMatrix.cc Thu Jan 20 17:24:59 2011 -0500 @@ -275,7 +275,7 @@ if (i < 0 || i >= r) { (*current_liboctave_error_handler) ("invalid row selection"); - return FloatComplexRowVector (); + return FloatComplexRowVector (); } FloatComplexRowVector retval (c, 0.0); @@ -291,7 +291,7 @@ if (! s) { (*current_liboctave_error_handler) ("invalid row selection"); - return FloatComplexRowVector (); + return FloatComplexRowVector (); } char c = *s; @@ -314,7 +314,7 @@ if (i < 0 || i >= c) { (*current_liboctave_error_handler) ("invalid column selection"); - return FloatComplexColumnVector (); + return FloatComplexColumnVector (); } FloatComplexColumnVector retval (r, 0.0); @@ -330,7 +330,7 @@ if (! s) { (*current_liboctave_error_handler) ("invalid column selection"); - return FloatComplexColumnVector (); + return FloatComplexColumnVector (); } char c = *s; @@ -341,7 +341,7 @@ else { (*current_liboctave_error_handler) ("invalid column selection"); - return FloatComplexColumnVector (); + return FloatComplexColumnVector (); } } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCDiagMatrix.h --- a/liboctave/fCDiagMatrix.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCDiagMatrix.h Thu Jan 20 17:24:59 2011 -0500 @@ -49,7 +49,7 @@ explicit FloatComplexDiagMatrix (const Array& a) : MDiagArray2 (a) { } - FloatComplexDiagMatrix (const Array& a, octave_idx_type r, octave_idx_type c) + FloatComplexDiagMatrix (const Array& a, octave_idx_type r, octave_idx_type c) : MDiagArray2 (a, r, c) { } explicit FloatComplexDiagMatrix (const Array& a) @@ -64,7 +64,7 @@ : MDiagArray2 (a) { } template - FloatComplexDiagMatrix (const DiagArray2& a) + FloatComplexDiagMatrix (const DiagArray2& a) : MDiagArray2 (a) { } FloatComplexDiagMatrix& operator = (const FloatComplexDiagMatrix& a) @@ -91,7 +91,7 @@ FloatComplexDiagMatrix hermitian (void) const { return MDiagArray2::hermitian (std::conj); } FloatComplexDiagMatrix transpose (void) const { return MDiagArray2::transpose(); } - FloatDiagMatrix abs (void) const; + FloatDiagMatrix abs (void) const; friend OCTAVE_API FloatComplexDiagMatrix conj (const FloatComplexDiagMatrix& a); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCMatrix.cc --- a/liboctave/fCMatrix.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCMatrix.cc Thu Jan 20 17:24:59 2011 -0500 @@ -161,8 +161,8 @@ F77_RET_T F77_FUNC (cgecon, CGECON) (F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, FloatComplex*, - const octave_idx_type&, const float&, float&, + const octave_idx_type&, FloatComplex*, + const octave_idx_type&, const float&, float&, FloatComplex*, float*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); @@ -180,7 +180,7 @@ const octave_idx_type&, FloatComplex*, const octave_idx_type&, float*, float&, octave_idx_type&, FloatComplex*, - const octave_idx_type&, float*, + const octave_idx_type&, float*, octave_idx_type*, octave_idx_type&); F77_RET_T @@ -198,34 +198,34 @@ F77_RET_T F77_FUNC (cpotrs, CPOTRS) (F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, - const octave_idx_type&, const FloatComplex*, - const octave_idx_type&, FloatComplex*, + const octave_idx_type&, + const octave_idx_type&, const FloatComplex*, + const octave_idx_type&, FloatComplex*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (ctrtri, CTRTRI) (F77_CONST_CHAR_ARG_DECL, - F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, const FloatComplex*, - const octave_idx_type&, octave_idx_type& + F77_CONST_CHAR_ARG_DECL, + const octave_idx_type&, const FloatComplex*, + const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (ctrcon, CTRCON) (F77_CONST_CHAR_ARG_DECL, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const FloatComplex*, const octave_idx_type&, float&, FloatComplex*, - float*, octave_idx_type& + float*, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (ctrtrs, CTRTRS) (F77_CONST_CHAR_ARG_DECL, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const octave_idx_type&, const FloatComplex*, const octave_idx_type&, @@ -1018,15 +1018,15 @@ F77_XFCN (ctrtri, CTRTRI, (F77_CONST_CHAR_ARG2 (&uplo, 1), F77_CONST_CHAR_ARG2 (&udiag, 1), - nr, tmp_data, nr, info + nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) info = -1; - else if (calc_cond) + else if (calc_cond) { octave_idx_type ztrcon_info = 0; char job = '1'; @@ -1037,13 +1037,13 @@ F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&job, 1), F77_CONST_CHAR_ARG2 (&uplo, 1), F77_CONST_CHAR_ARG2 (&udiag, 1), - nr, tmp_data, nr, rcon, - cwork, rwork, ztrcon_info + nr, tmp_data, nr, rcon, + cwork, rwork, ztrcon_info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (ztrcon_info != 0) + if (ztrcon_info != 0) info = -1; } @@ -1078,7 +1078,7 @@ // Query the optimum work array size. - F77_XFCN (cgetri, CGETRI, (nc, tmp_data, nr, pipvt, + F77_XFCN (cgetri, CGETRI, (nc, tmp_data, nr, pipvt, z.fortran_vec (), lwork, info)); lwork = static_cast (std::real(z(0))); @@ -1097,9 +1097,9 @@ // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) info = -1; - else if (calc_cond) + else if (calc_cond) { // Now calculate the condition number for non-singular matrix. octave_idx_type zgecon_info = 0; @@ -1107,11 +1107,11 @@ Array rz (dim_vector (2 * nc, 1)); float *prz = rz.fortran_vec (); F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, prz, zgecon_info F77_CHAR_ARG_LEN (1))); - if (zgecon_info != 0) + if (zgecon_info != 0) info = -1; } @@ -1124,14 +1124,14 @@ F77_XFCN (cgetri, CGETRI, (nc, tmp_data, nr, pipvt, pz, lwork, zgetri_info)); - if (zgetri_info != 0) + if (zgetri_info != 0) info = -1; } if (info != 0) mattype.mark_as_rectangular(); } - + return retval; } @@ -1241,7 +1241,7 @@ const FloatComplex *in (data ()); FloatComplex *out (retval.fortran_vec ()); - octave_fftw::fft (in, out, npts, nsamples); + octave_fftw::fft (in, out, npts, nsamples); return retval; } @@ -1270,7 +1270,7 @@ const FloatComplex *in (data ()); FloatComplex *out (retval.fortran_vec ()); - octave_fftw::ifft (in, out, npts, nsamples); + octave_fftw::ifft (in, out, npts, nsamples); return retval; } @@ -1587,7 +1587,7 @@ if (typ == MatrixType::Lower || typ == MatrixType::Upper) { - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval *= elem (i,i); } else if (typ == MatrixType::Hermitian) @@ -1601,17 +1601,17 @@ char job = 'L'; - F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) { rcon = 0.0; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { Array z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); @@ -1623,10 +1623,10 @@ rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval *= atmp (i,i); retval = retval.square (); @@ -1653,14 +1653,14 @@ // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) { info = -1; retval = FloatComplexDET (); - } - else + } + else { - if (calc_cond) + if (calc_cond) { // Now calc the condition number for non-singular matrix. char job = '1'; @@ -1670,19 +1670,19 @@ float *prz = rz.fortran_vec (); F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); } - if (info != 0) + if (info != 0) { info = -1; retval = FloatComplexDET (); - } - else + } + else { - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { FloatComplex c = atmp(i,i); retval *= (ipvt(i) != (i+1)) ? -c : c; @@ -1734,16 +1734,16 @@ Array rz (dim_vector (nc, 1)); float *prz = rz.fortran_vec (); - F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, prz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0; } else if (typ == MatrixType::Permuted_Upper) @@ -1762,16 +1762,16 @@ Array rz (dim_vector (nc, 1)); float *prz = rz.fortran_vec (); - F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, prz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } else if (typ == MatrixType::Permuted_Lower) @@ -1790,18 +1790,18 @@ anorm = atmp.abs().sum(). row(static_cast(0)).max(); - F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) { rcon = 0.0; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { Array z (dim_vector (2 * nc, 1)); FloatComplex *pz = z.fortran_vec (); @@ -1813,7 +1813,7 @@ rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } } @@ -1837,20 +1837,20 @@ F77_XFCN (cgetrf, CGETRF, (nr, nr, tmp_data, nr, pipvt, info)); - if (info != 0) - { + if (info != 0) + { rcon = 0.0; mattype.mark_as_rectangular (); - } - else + } + else { char job = '1'; F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } } @@ -1863,8 +1863,8 @@ } FloatComplexMatrix -FloatComplexMatrix::utsolve (MatrixType &mattype, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, +FloatComplexMatrix::utsolve (MatrixType &mattype, const FloatComplexMatrix& b, + octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, bool calc_cond, blas_trans_type transt) const { @@ -1909,16 +1909,16 @@ Array rz (dim_vector (nc, 1)); float *prz = rz.fortran_vec (); - F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, prz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile float rcond_plus_one = rcon + 1.0; @@ -1945,9 +1945,9 @@ char trans = get_blas_char (transt); char dia = 'N'; - F77_XFCN (ctrtrs, CTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&trans, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ctrtrs, CTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&trans, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, b_nc, tmp_data, nr, result, nr, info F77_CHAR_ARG_LEN (1) @@ -1964,8 +1964,8 @@ } FloatComplexMatrix -FloatComplexMatrix::ltsolve (MatrixType &mattype, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, +FloatComplexMatrix::ltsolve (MatrixType &mattype, const FloatComplexMatrix& b, + octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, bool calc_cond, blas_trans_type transt) const { @@ -2010,16 +2010,16 @@ Array rz (dim_vector (nc, 1)); float *prz = rz.fortran_vec (); - F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ctrcon, CTRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, prz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile float rcond_plus_one = rcon + 1.0; @@ -2046,9 +2046,9 @@ char trans = get_blas_char (transt); char dia = 'N'; - F77_XFCN (ctrtrs, CTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&trans, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (ctrtrs, CTRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&trans, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, b_nc, tmp_data, nr, result, nr, info F77_CHAR_ARG_LEN (1) @@ -2065,7 +2065,7 @@ } FloatComplexMatrix -FloatComplexMatrix::fsolve (MatrixType &mattype, const FloatComplexMatrix& b, +FloatComplexMatrix::fsolve (MatrixType &mattype, const FloatComplexMatrix& b, octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, bool calc_cond) const @@ -2084,7 +2084,7 @@ else { volatile int typ = mattype.type (); - + // Calculate the norm of the matrix, for later use. float anorm = -1.; @@ -2096,20 +2096,20 @@ FloatComplex *tmp_data = atmp.fortran_vec (); anorm = atmp.abs().sum().row(static_cast(0)).max(); - F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) { info = -2; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { if (calc_cond) { @@ -2123,7 +2123,7 @@ rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile float rcond_plus_one = rcon + 1.0; @@ -2184,8 +2184,8 @@ // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) - { + if (info != 0) + { info = -2; if (sing_handler) @@ -2195,20 +2195,20 @@ ("matrix singular to machine precision"); mattype.mark_as_rectangular (); - } - else + } + else { if (calc_cond) { - // Now calculate the condition number for + // Now calculate the condition number for // non-singular matrix. char job = '1'; F77_XFCN (cgecon, CGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, prz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile float rcond_plus_one = rcon + 1.0; @@ -2237,14 +2237,14 @@ F77_XFCN (cgetrs, CGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), nr, b_nc, tmp_data, nr, pipvt, result, b.rows(), info - F77_CHAR_ARG_LEN (1))); + F77_CHAR_ARG_LEN (1))); } else - mattype.mark_as_rectangular (); + mattype.mark_as_rectangular (); } } } - + return retval; } @@ -2257,7 +2257,7 @@ } FloatComplexMatrix -FloatComplexMatrix::solve (MatrixType &typ, const FloatMatrix& b, +FloatComplexMatrix::solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info) const { float rcon; @@ -2272,7 +2272,7 @@ } FloatComplexMatrix -FloatComplexMatrix::solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, +FloatComplexMatrix::solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, bool singular_fallback, blas_trans_type transt) const { @@ -2289,7 +2289,7 @@ } FloatComplexMatrix -FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, +FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, octave_idx_type& info) const { float rcon; @@ -2297,14 +2297,14 @@ } FloatComplexMatrix -FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, +FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, octave_idx_type& info, float& rcon) const { return solve (typ, b, info, rcon, 0); } FloatComplexMatrix -FloatComplexMatrix::solve (MatrixType &mattype, const FloatComplexMatrix& b, +FloatComplexMatrix::solve (MatrixType &mattype, const FloatComplexMatrix& b, octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, bool singular_fallback, blas_trans_type transt) const @@ -2351,7 +2351,7 @@ } FloatComplexColumnVector -FloatComplexMatrix::solve (MatrixType &typ, const FloatColumnVector& b, +FloatComplexMatrix::solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info) const { float rcon; @@ -2359,14 +2359,14 @@ } FloatComplexColumnVector -FloatComplexMatrix::solve (MatrixType &typ, const FloatColumnVector& b, +FloatComplexMatrix::solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info, float& rcon) const { return solve (typ, FloatComplexColumnVector (b), info, rcon, 0); } FloatComplexColumnVector -FloatComplexMatrix::solve (MatrixType &typ, const FloatColumnVector& b, +FloatComplexMatrix::solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const { @@ -2382,7 +2382,7 @@ } FloatComplexColumnVector -FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, +FloatComplexMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, octave_idx_type& info) const { float rcon; @@ -2481,15 +2481,15 @@ } FloatComplexColumnVector -FloatComplexMatrix::solve (const FloatColumnVector& b, octave_idx_type& info, +FloatComplexMatrix::solve (const FloatColumnVector& b, octave_idx_type& info, float& rcon) const { return solve (FloatComplexColumnVector (b), info, rcon, 0); } FloatComplexColumnVector -FloatComplexMatrix::solve (const FloatColumnVector& b, octave_idx_type& info, - float& rcon, +FloatComplexMatrix::solve (const FloatColumnVector& b, octave_idx_type& info, + float& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const { return solve (FloatComplexColumnVector (b), info, rcon, sing_handler, transt); @@ -2584,7 +2584,7 @@ } FloatComplexMatrix -FloatComplexMatrix::lssolve (const FloatComplexMatrix& b, octave_idx_type& info, +FloatComplexMatrix::lssolve (const FloatComplexMatrix& b, octave_idx_type& info, octave_idx_type& rank, float& rcon) const { FloatComplexMatrix retval; @@ -2709,7 +2709,7 @@ F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, - work.fortran_vec (), lwork, + work.fortran_vec (), lwork, prwork, piwork, info)); if (s.elem (0) == 0.0) @@ -2741,7 +2741,7 @@ } FloatComplexColumnVector -FloatComplexMatrix::lssolve (const FloatColumnVector& b, octave_idx_type& info, +FloatComplexMatrix::lssolve (const FloatColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const { float rcon; @@ -2749,7 +2749,7 @@ } FloatComplexColumnVector -FloatComplexMatrix::lssolve (const FloatColumnVector& b, octave_idx_type& info, +FloatComplexMatrix::lssolve (const FloatColumnVector& b, octave_idx_type& info, octave_idx_type& rank, float& rcon) const { return lssolve (FloatComplexColumnVector (b), info, rank, rcon); @@ -2870,7 +2870,7 @@ F77_XFCN (cgelsd, CGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, - work.fortran_vec (), lwork, + work.fortran_vec (), lwork, prwork, piwork, info)); if (rank < minmn) @@ -3099,7 +3099,7 @@ // Return nonzero if any element of CM has a non-integer real or // imaginary part. Also extract the largest and smallest (real or -// imaginary) values and return them in MAX_VAL and MIN_VAL. +// imaginary) values and return them in MAX_VAL and MIN_VAL. bool FloatComplexMatrix::all_integers (float& max_val, float& min_val) const @@ -3249,7 +3249,7 @@ } } - return retval; + return retval; } bool @@ -3268,7 +3268,7 @@ } } - return retval; + return retval; } FloatComplexColumnVector @@ -3614,7 +3614,7 @@ { float cc; FloatComplex cs, temp_r; - + F77_FUNC (clartg, CLARTG) (x, y, cc, cs, temp_r); FloatComplexMatrix g (2, 2); @@ -3640,7 +3640,7 @@ FloatComplexSCHUR as (a, "U"); FloatComplexSCHUR bs (b, "U"); - + // Transform c to new coordinates. FloatComplexMatrix ua = as.unitary_matrix (); @@ -3648,7 +3648,7 @@ FloatComplexMatrix ub = bs.unitary_matrix (); FloatComplexMatrix sch_b = bs.schur_matrix (); - + FloatComplexMatrix cx = ua.hermitian () * c * ub; // Solve the sylvester equation, back-transform, and return the @@ -3663,7 +3663,7 @@ FloatComplex *pa = sch_a.fortran_vec (); FloatComplex *pb = sch_b.fortran_vec (); FloatComplex *px = cx.fortran_vec (); - + F77_XFCN (ctrsyl, CTRSYL, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 ("N", 1), 1, a_nr, b_nr, pa, a_nr, pb, @@ -3726,7 +3726,7 @@ // the general GEMM operation FloatComplexMatrix -xgemm (const FloatComplexMatrix& a, const FloatComplexMatrix& b, +xgemm (const FloatComplexMatrix& a, const FloatComplexMatrix& b, blas_trans_type transa, blas_trans_type transb) { FloatComplexMatrix retval; @@ -4026,8 +4026,8 @@ return result; } -FloatComplexMatrix linspace (const FloatComplexColumnVector& x1, - const FloatComplexColumnVector& x2, +FloatComplexMatrix linspace (const FloatComplexColumnVector& x1, + const FloatComplexColumnVector& x2, octave_idx_type n) { @@ -4045,7 +4045,7 @@ retval(i, 0) = x1(i); // The last column is not needed while using delta. - FloatComplex *delta = &retval(0, n-1); + FloatComplex *delta = &retval(0, n-1); for (octave_idx_type i = 0; i < m; i++) delta[i] = (x2(i) - x1(i)) / (n - 1.0f); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCMatrix.h --- a/liboctave/fCMatrix.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCMatrix.h Thu Jan 20 17:24:59 2011 -0500 @@ -37,7 +37,7 @@ FloatComplexMatrix : public MArray { public: - + typedef FloatComplexColumnVector column_vector_type; typedef FloatComplexRowVector row_vector_type; @@ -55,7 +55,7 @@ FloatComplexMatrix (const dim_vector& dv) : MArray (dv.redim (2)) { } - FloatComplexMatrix (const dim_vector& dv, const FloatComplex& val) + FloatComplexMatrix (const dim_vector& dv, const FloatComplex& val) : MArray (dv.redim (2), val) { } FloatComplexMatrix (const FloatComplexMatrix& a) @@ -172,13 +172,13 @@ public: FloatComplexMatrix inverse (void) const; FloatComplexMatrix inverse (octave_idx_type& info) const; - FloatComplexMatrix inverse (octave_idx_type& info, float& rcon, int force = 0, + FloatComplexMatrix inverse (octave_idx_type& info, float& rcon, int force = 0, int calc_cond = 1) const; FloatComplexMatrix inverse (MatrixType &mattype) const; FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info) const; FloatComplexMatrix inverse (MatrixType &mattype, octave_idx_type& info, - float& rcon, int force = 0, + float& rcon, int force = 0, int calc_cond = 1) const; FloatComplexMatrix pseudo_inverse (float tol = 0.0) const; @@ -192,7 +192,7 @@ FloatComplexDET determinant (void) const; FloatComplexDET determinant (octave_idx_type& info) const; FloatComplexDET determinant (octave_idx_type& info, float& rcon, int calc_cond = 1) const; - FloatComplexDET determinant (MatrixType &mattype, octave_idx_type& info, + FloatComplexDET determinant (MatrixType &mattype, octave_idx_type& info, float& rcon, int calc_cond = 1) const; float rcond (void) const; @@ -201,64 +201,64 @@ private: // Upper triangular matrix solvers FloatComplexMatrix utsolve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, + octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; // Lower triangular matrix solvers FloatComplexMatrix ltsolve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, + octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, bool calc_cond = false, blas_trans_type transt = blas_no_trans) const; // Full matrix solvers (umfpack/cholesky) FloatComplexMatrix fsolve (MatrixType &typ, const FloatComplexMatrix& b, - octave_idx_type& info, float& rcon, + octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, bool calc_cond = false) const; public: // Generic interface to solver with no probing of type FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b) const; - FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, + FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info) const; - FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, + FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, float& rcon) const; FloatComplexMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, - bool singular_fallback = true, + bool singular_fallback = true, blas_trans_type transt = blas_no_trans) const; FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b) const; - FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, + FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, octave_idx_type& info) const; - FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, + FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, octave_idx_type& info, float& rcon) const; - FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, + FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, - bool singular_fallback = true, + bool singular_fallback = true, blas_trans_type transt = blas_no_trans) const; FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, + FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, + FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info, float& rcon) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, + FloatComplexColumnVector solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; - FloatComplexColumnVector solve (MatrixType &typ, + FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, + FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, octave_idx_type& info) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, + FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, octave_idx_type& info, float& rcon) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, + FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; // Generic interface to solver with probing of type @@ -266,14 +266,14 @@ FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info) const; FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rcon) const; FloatComplexMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; FloatComplexMatrix solve (const FloatComplexMatrix& b) const; FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info) const; FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon) const; FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; FloatComplexColumnVector solve (const FloatColumnVector& b) const; @@ -281,7 +281,7 @@ FloatComplexColumnVector solve (const FloatColumnVector& b, octave_idx_type& info, float& rcon) const; FloatComplexColumnVector solve (const FloatColumnVector& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; FloatComplexColumnVector solve (const FloatComplexColumnVector& b) const; @@ -290,14 +290,14 @@ float& rcon) const; FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; FloatComplexMatrix lssolve (const FloatMatrix& b) const; FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info) const; - FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, + FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, octave_idx_type& rank) const; - FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, + FloatComplexMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, octave_idx_type& rank, float& rcon) const; FloatComplexMatrix lssolve (const FloatComplexMatrix& b) const; @@ -368,7 +368,7 @@ FloatComplexColumnVector row_min (void) const; FloatComplexColumnVector row_max (void) const; - FloatComplexColumnVector row_min (Array& index) const; + FloatComplexColumnVector row_min (Array& index) const; FloatComplexColumnVector row_max (Array& index) const; FloatComplexRowVector column_min (void) const; @@ -405,9 +405,9 @@ extern OCTAVE_API FloatComplexMatrix Sylvester (const FloatComplexMatrix&, const FloatComplexMatrix&, const FloatComplexMatrix&); -extern OCTAVE_API FloatComplexMatrix +extern OCTAVE_API FloatComplexMatrix xgemm (const FloatComplexMatrix& a, const FloatComplexMatrix& b, - blas_trans_type transa = blas_no_trans, + blas_trans_type transa = blas_no_trans, blas_trans_type transb = blas_no_trans); extern OCTAVE_API FloatComplexMatrix operator * (const FloatMatrix&, const FloatComplexMatrix&); @@ -422,8 +422,8 @@ extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& m, const FloatComplex& c); extern OCTAVE_API FloatComplexMatrix max (const FloatComplexMatrix& a, const FloatComplexMatrix& b); -extern OCTAVE_API FloatComplexMatrix linspace (const FloatComplexColumnVector& x1, - const FloatComplexColumnVector& x2, +extern OCTAVE_API FloatComplexMatrix linspace (const FloatComplexColumnVector& x1, + const FloatComplexColumnVector& x2, octave_idx_type n); MS_CMP_OP_DECLS (FloatComplexMatrix, FloatComplex, OCTAVE_API) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCNDArray.cc --- a/liboctave/fCNDArray.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCNDArray.cc Thu Jan 20 17:24:59 2011 -0500 @@ -79,7 +79,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) - octave_fftw::fft (in + k * stride * n, out + k * stride * n, + octave_fftw::fft (in + k * stride * n, out + k * stride * n, n, howmany, stride, dist); return retval; @@ -110,7 +110,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) - octave_fftw::ifft (in + k * stride * n, out + k * stride * n, + octave_fftw::ifft (in + k * stride * n, out + k * stride * n, n, howmany, stride, dist); return retval; @@ -316,7 +316,7 @@ FloatComplex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -364,7 +364,7 @@ FloatComplex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -412,7 +412,7 @@ FloatComplex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -459,7 +459,7 @@ FloatComplex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -526,7 +526,7 @@ // Return nonzero if any element of CM has a non-integer real or // imaginary part. Also extract the largest and smallest (real or -// imaginary) values and return them in MAX_VAL and MIN_VAL. +// imaginary) values and return them in MAX_VAL and MIN_VAL. bool FloatComplexNDArray::all_integers (float& max_val, float& min_val) const @@ -539,7 +539,7 @@ float r_val = std::real (val); float i_val = std::imag (val); - + max_val = r_val; min_val = r_val; @@ -764,16 +764,16 @@ FloatComplexNDArray::insert (const NDArray& a, octave_idx_type r, octave_idx_type c) { dim_vector a_dv = a.dims (); - + int n = a_dv.length (); - + if (n == dimensions.length ()) { Array a_ra_idx (dim_vector (a_dv.length (), 1), 0); - + a_ra_idx.elem (0) = r; a_ra_idx.elem (1) = c; - + for (int i = 0; i < n; i++) { if (a_ra_idx (i) < 0 || (a_ra_idx (i) + a_dv (i)) > dimensions (i)) @@ -783,21 +783,21 @@ return *this; } } - + a_ra_idx.elem (0) = 0; a_ra_idx.elem (1) = 0; - + octave_idx_type n_elt = a.numel (); - + // IS make_unique () NECCESSARY HERE?? for (octave_idx_type i = 0; i < n_elt; i++) { Array ra_idx = a_ra_idx; - + ra_idx.elem (0) = a_ra_idx (0) + r; ra_idx.elem (1) = a_ra_idx (1) + c; - + elem (ra_idx) = a.elem (a_ra_idx); increment_index (a_ra_idx, a_dv); @@ -846,7 +846,7 @@ ::increment_index (ra_idx, dimensions, start_dimension); } -octave_idx_type +octave_idx_type FloatComplexNDArray::compute_index (Array& ra_idx, const dim_vector& dimensions) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCNDArray.h --- a/liboctave/fCNDArray.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCNDArray.h Thu Jan 20 17:24:59 2011 -0500 @@ -44,7 +44,7 @@ FloatComplexNDArray (const dim_vector& dv, const FloatComplex& val) : MArray (dv, val) { } - + FloatComplexNDArray (const FloatComplexNDArray& a) : MArray (a) { } FloatComplexNDArray (const FloatComplexMatrix& a) : MArray (a) { } @@ -55,7 +55,7 @@ template FloatComplexNDArray (const Array& a) : MArray (a) { } - FloatComplexNDArray (const charNDArray&); + FloatComplexNDArray (const charNDArray&); FloatComplexNDArray& operator = (const FloatComplexNDArray& a) { @@ -102,7 +102,7 @@ FloatComplexNDArray& insert (const NDArray& a, octave_idx_type r, octave_idx_type c); FloatComplexNDArray& insert (const FloatComplexNDArray& a, octave_idx_type r, octave_idx_type c); FloatComplexNDArray& insert (const FloatComplexNDArray& a, const Array& ra_idx); - + FloatNDArray abs (void) const; boolNDArray isnan (void) const; boolNDArray isinf (void) const; @@ -142,10 +142,10 @@ FloatComplexNDArray diag (octave_idx_type k = 0) const; - FloatComplexNDArray& changesign (void) - { - MArray::changesign (); - return *this; + FloatComplexNDArray& changesign (void) + { + MArray::changesign (); + return *this; } }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCRowVector.cc --- a/liboctave/fCRowVector.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCRowVector.cc Thu Jan 20 17:24:59 2011 -0500 @@ -219,13 +219,13 @@ return retval; } -FloatComplexColumnVector +FloatComplexColumnVector FloatComplexRowVector::hermitian (void) const { return MArray::hermitian (std::conj); } -FloatComplexColumnVector +FloatComplexColumnVector FloatComplexRowVector::transpose (void) const { return MArray::transpose (); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCRowVector.h --- a/liboctave/fCRowVector.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCRowVector.h Thu Jan 20 17:24:59 2011 -0500 @@ -45,7 +45,7 @@ explicit FloatComplexRowVector (const dim_vector& dv) : MArray (dv.as_row ()) { } - FloatComplexRowVector (octave_idx_type n, const FloatComplex& val) + FloatComplexRowVector (octave_idx_type n, const FloatComplex& val) : MArray (dim_vector (1, n), val) { } FloatComplexRowVector (const FloatComplexRowVector& a) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxAEPBAL.cc --- a/liboctave/fCmplxAEPBAL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxAEPBAL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -39,7 +39,7 @@ const octave_idx_type&, octave_idx_type&, octave_idx_type&, float*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); - + F77_RET_T F77_FUNC (cgebak, CGEBAK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, @@ -51,7 +51,7 @@ F77_CHAR_ARG_LEN_DECL); } -FloatComplexAEPBALANCE::FloatComplexAEPBALANCE (const FloatComplexMatrix& a, +FloatComplexAEPBALANCE::FloatComplexAEPBALANCE (const FloatComplexMatrix& a, bool noperm, bool noscal) : base_aepbal () { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxAEPBAL.h --- a/liboctave/fCmplxAEPBAL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxAEPBAL.h Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ FloatComplexAEPBALANCE (const FloatComplexMatrix& a, bool noperm = false, bool noscal = false); - FloatComplexAEPBALANCE (const FloatComplexAEPBALANCE& a) + FloatComplexAEPBALANCE (const FloatComplexAEPBALANCE& a) : base_aepbal (a) { } FloatComplexMatrix balancing_matrix (void) const; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxCHOL.cc --- a/liboctave/fCmplxCHOL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxCHOL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -113,7 +113,7 @@ // Calculate the norm of the matrix, for later use. float anorm = 0; - if (calc_cond) + if (calc_cond) anorm = xnorm (a, 1); F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, n, info @@ -122,7 +122,7 @@ xrcond = 0.0; if (info > 0) chol_mat.resize (info - 1, info - 1); - else if (calc_cond) + else if (calc_cond) { octave_idx_type cpocon_info = 0; @@ -135,7 +135,7 @@ n, anorm, xrcond, pz, prz, cpocon_info F77_CHAR_ARG_LEN (1))); - if (cpocon_info != 0) + if (cpocon_info != 0) info = -1; } @@ -187,7 +187,7 @@ void FloatComplexCHOL::set (const FloatComplexMatrix& R) { - if (R.is_square ()) + if (R.is_square ()) chol_mat = R; else (*current_liboctave_error_handler) ("CHOL requires square matrix"); @@ -241,7 +241,7 @@ octave_idx_type info = -1; octave_idx_type n = chol_mat.rows (); - + if (u.length () != n + 1) (*current_liboctave_error_handler) ("cholinsert: dimension mismatch"); else if (j < 0 || j > n) @@ -265,14 +265,14 @@ FloatComplexCHOL::delete_sym (octave_idx_type j) { octave_idx_type n = chol_mat.rows (); - + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("choldelete: index out of range"); else { OCTAVE_LOCAL_BUFFER (float, rw, n); - F77_XFCN (cchdex, CCHDEX, (n, chol_mat.fortran_vec (), chol_mat.rows (), + F77_XFCN (cchdex, CCHDEX, (n, chol_mat.fortran_vec (), chol_mat.rows (), j + 1, rw)); chol_mat.resize (n-1, n-1); @@ -283,8 +283,8 @@ FloatComplexCHOL::shift_sym (octave_idx_type i, octave_idx_type j) { octave_idx_type n = chol_mat.rows (); - - if (i < 0 || i > n-1 || j < 0 || j > n-1) + + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("cholshift: index out of range"); else { @@ -307,7 +307,7 @@ if (u.length () == n) { - init (chol_mat.hermitian () * chol_mat + init (chol_mat.hermitian () * chol_mat + FloatComplexMatrix (u) * FloatComplexMatrix (u).hermitian (), false); } else @@ -337,7 +337,7 @@ info = 2; else { - info = init (chol_mat.hermitian () * chol_mat + info = init (chol_mat.hermitian () * chol_mat - FloatComplexMatrix (u) * FloatComplexMatrix (u).hermitian (), false); if (info) info = 1; } @@ -414,7 +414,7 @@ octave_idx_type n = chol_mat.rows (); - if (i < 0 || i > n-1 || j < 0 || j > n-1) + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("cholshift: index out of range"); else { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxGEPBAL.cc --- a/liboctave/fCmplxGEPBAL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxGEPBAL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -58,7 +58,7 @@ } octave_idx_type -FloatComplexGEPBALANCE::init (const FloatComplexMatrix& a, const FloatComplexMatrix& b, +FloatComplexGEPBALANCE::init (const FloatComplexMatrix& a, const FloatComplexMatrix& b, const std::string& balance_job) { octave_idx_type n = a.cols (); @@ -73,7 +73,7 @@ { gripe_nonconformant ("FloatComplexGEPBALANCE", n, n, b.rows(), b.cols()); return -1; - } + } octave_idx_type info; octave_idx_type ilo; @@ -114,7 +114,7 @@ n, p_balancing_mat, n, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - + // then right F77_XFCN (sggbak, SGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1), F77_CONST_CHAR_ARG2 ("R", 1), diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxGEPBAL.h --- a/liboctave/fCmplxGEPBAL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxGEPBAL.h Thu Jan 20 17:24:59 2011 -0500 @@ -44,7 +44,7 @@ const std::string& balance_job) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () { - init (a, b, balance_job); + init (a, b, balance_job); } FloatComplexGEPBALANCE (const FloatComplexGEPBALANCE& a) @@ -83,7 +83,7 @@ FloatMatrix balancing_mat; FloatMatrix balancing_mat2; - octave_idx_type init (const FloatComplexMatrix& a, const FloatComplexMatrix& b, + octave_idx_type init (const FloatComplexMatrix& a, const FloatComplexMatrix& b, const std::string& balance_job); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxHESS.cc --- a/liboctave/fCmplxHESS.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxHESS.cc Thu Jan 20 17:24:59 2011 -0500 @@ -36,14 +36,14 @@ const octave_idx_type&, octave_idx_type&, octave_idx_type&, float*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); - + F77_RET_T F77_FUNC (cgehrd, CGEHRD) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, FloatComplex*, const octave_idx_type&, FloatComplex*, FloatComplex*, const octave_idx_type&, octave_idx_type&); - + F77_RET_T F77_FUNC (cunghr, CUNGHR) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, FloatComplex*, diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxLU.h --- a/liboctave/fCmplxLU.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxLU.h Thu Jan 20 17:24:59 2011 -0500 @@ -41,7 +41,7 @@ FloatComplexLU (const FloatComplexLU& a) : base_lu (a) { } - FloatComplexLU (const FloatComplexMatrix& l, const FloatComplexMatrix& u, + FloatComplexLU (const FloatComplexMatrix& l, const FloatComplexMatrix& u, const PermMatrix& p) : base_lu (l, u, p) { } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxQR.cc --- a/liboctave/fCmplxQR.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxQR.cc Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ F77_FUNC (cgeqrf, CGEQRF) (const octave_idx_type&, const octave_idx_type&, FloatComplex*, const octave_idx_type&, FloatComplex*, FloatComplex*, - const octave_idx_type&, octave_idx_type&); + const octave_idx_type&, octave_idx_type&); F77_RET_T F77_FUNC (cungqr, CUNGQR) (const octave_idx_type&, const octave_idx_type&, @@ -76,14 +76,14 @@ float*); F77_RET_T - F77_FUNC (cqrinr, CQRINR) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (cqrinr, CQRINR) (const octave_idx_type&, const octave_idx_type&, FloatComplex*, const octave_idx_type&, FloatComplex*, const octave_idx_type&, const octave_idx_type&, const FloatComplex*, float*); F77_RET_T - F77_FUNC (cqrder, CQRDER) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (cqrder, CQRDER) (const octave_idx_type&, const octave_idx_type&, FloatComplex*, const octave_idx_type&, FloatComplex*, const octave_idx_type&, const octave_idx_type&, FloatComplex*, float*); @@ -135,7 +135,7 @@ form (n, afact, tau, qr_type); } -void FloatComplexQR::form (octave_idx_type n, FloatComplexMatrix& afact, +void FloatComplexQR::form (octave_idx_type n, FloatComplexMatrix& afact, FloatComplex *tau, qr_type_t qr_type) { octave_idx_type m = afact.rows (), min_mn = std::min (m, n); @@ -255,7 +255,7 @@ if (u.length () != m) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > n) + else if (j < 0 || j > n) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -272,7 +272,7 @@ FloatComplexColumnVector utmp = u; OCTAVE_LOCAL_BUFFER (float, rw, k); F77_XFCN (cqrinc, CQRINC, (m, n, k, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), j + 1, + r.fortran_vec (), r.rows (), j + 1, utmp.data (), rw)); } } @@ -314,9 +314,9 @@ for (volatile octave_idx_type i = 0; i < js.length (); i++) { octave_idx_type ii = i; - F77_XFCN (cqrinc, CQRINC, (m, n + ii, std::min (kmax, k + ii), + F77_XFCN (cqrinc, CQRINC, (m, n + ii, std::min (kmax, k + ii), q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), js(ii) + 1, + r.fortran_vec (), r.rows (), js(ii) + 1, u.column (jsi(i)).data (), rw)); } } @@ -329,7 +329,7 @@ octave_idx_type k = r.rows (); octave_idx_type n = r.columns (); - if (j < 0 || j > n-1) + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -373,7 +373,7 @@ for (volatile octave_idx_type i = 0; i < js.length (); i++) { octave_idx_type ii = i; - F77_XFCN (cqrdec, CQRDEC, (m, n - ii, k == m ? k : k - ii, + F77_XFCN (cqrdec, CQRDEC, (m, n - ii, k == m ? k : k - ii, q.fortran_vec (), q.rows (), r.fortran_vec (), r.rows (), js(ii) + 1, rw)); } @@ -399,7 +399,7 @@ if (! q.is_square () || u.length () != n) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > m) + else if (j < 0 || j > m) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -408,7 +408,7 @@ FloatComplexRowVector utmp = u; OCTAVE_LOCAL_BUFFER (float, rw, k); F77_XFCN (cqrinr, CQRINR, (m, n, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), + r.fortran_vec (), r.rows (), j + 1, utmp.fortran_vec (), rw)); } @@ -422,7 +422,7 @@ if (! q.is_square ()) (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); - else if (j < 0 || j > m-1) + else if (j < 0 || j > m-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -444,13 +444,13 @@ octave_idx_type k = r.rows (); octave_idx_type n = r.columns (); - if (i < 0 || i > n-1 || j < 0 || j > n-1) + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrshift: index out of range"); else { OCTAVE_LOCAL_BUFFER (FloatComplex, w, k); OCTAVE_LOCAL_BUFFER (float, rw, k); - F77_XFCN (cqrshc, CQRSHC, (m, n, k, + F77_XFCN (cqrshc, CQRSHC, (m, n, k, q.fortran_vec (), q.rows (), r.fortran_vec (), r.rows (), i + 1, j + 1, w, rw)); @@ -536,7 +536,7 @@ } static -FloatComplexMatrix shift_cols (const FloatComplexMatrix& a, +FloatComplexMatrix shift_cols (const FloatComplexMatrix& a, octave_idx_type i, octave_idx_type j) { octave_idx_type n = a.columns (); @@ -566,7 +566,7 @@ if (u.length () != m) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > n) + else if (j < 0 || j > n) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -612,7 +612,7 @@ octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); - if (j < 0 || j > n-1) + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -658,7 +658,7 @@ if (! q.is_square () || u.length () != n) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > m) + else if (j < 0 || j > m) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -676,7 +676,7 @@ if (! q.is_square ()) (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); - else if (j < 0 || j > m-1) + else if (j < 0 || j > m-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -692,7 +692,7 @@ octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); - if (i < 0 || i > n-1 || j < 0 || j > n-1) + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrshift: index out of range"); else { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxQR.h --- a/liboctave/fCmplxQR.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxQR.h Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ FloatComplexQR (const FloatComplexMatrix&, qr_type_t = qr_type_std); - FloatComplexQR (const FloatComplexMatrix& qx, const FloatComplexMatrix& rx) + FloatComplexQR (const FloatComplexMatrix& qx, const FloatComplexMatrix& rx) : base_qr (qx, rx) { } FloatComplexQR (const FloatComplexQR& a) : base_qr (a) { } @@ -70,7 +70,7 @@ protected: - void form (octave_idx_type n, FloatComplexMatrix& afact, + void form (octave_idx_type n, FloatComplexMatrix& afact, FloatComplex *tau, qr_type_t qr_type); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxQRP.cc --- a/liboctave/fCmplxQRP.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxQRP.cc Thu Jan 20 17:24:59 2011 -0500 @@ -97,7 +97,7 @@ form (n, afact, tau, qr_type); } -FloatRowVector +FloatRowVector FloatComplexQRP::Pvec (void) const { Array pa (p.pvec ()); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxSCHUR.cc --- a/liboctave/fCmplxSCHUR.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxSCHUR.cc Thu Jan 20 17:24:59 2011 -0500 @@ -63,7 +63,7 @@ } octave_idx_type -FloatComplexSCHUR::init (const FloatComplexMatrix& a, const std::string& ord, +FloatComplexSCHUR::init (const FloatComplexMatrix& a, const std::string& ord, bool calc_unitary) { octave_idx_type a_nr = a.rows (); @@ -147,7 +147,7 @@ return info; } -FloatComplexSCHUR::FloatComplexSCHUR (const FloatComplexMatrix& s, +FloatComplexSCHUR::FloatComplexSCHUR (const FloatComplexMatrix& s, const FloatComplexMatrix& u) : schur_mat (s), unitary_mat (u), selector (0) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fCmplxSVD.h --- a/liboctave/fCmplxSVD.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fCmplxSVD.h Thu Jan 20 17:24:59 2011 -0500 @@ -39,9 +39,9 @@ : type_computed (), sigma (), left_sm (), right_sm () { } - FloatComplexSVD (const FloatComplexMatrix& a, + FloatComplexSVD (const FloatComplexMatrix& a, SVD::type svd_type = SVD::std, - SVD::driver svd_driver = SVD::GESVD) + SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () { init (a, svd_type, svd_driver); @@ -49,7 +49,7 @@ FloatComplexSVD (const FloatComplexMatrix& a, octave_idx_type& info, SVD::type svd_type = SVD::std, - SVD::driver svd_driver = SVD::GESVD) + SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () { info = init (a, svd_type, svd_driver); @@ -90,8 +90,8 @@ FloatComplexMatrix left_sm; FloatComplexMatrix right_sm; - octave_idx_type init (const FloatComplexMatrix& a, - SVD::type svd_type = SVD::std, + octave_idx_type init (const FloatComplexMatrix& a, + SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GESVD); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fColVector.h --- a/liboctave/fColVector.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fColVector.h Thu Jan 20 17:24:59 2011 -0500 @@ -39,7 +39,7 @@ explicit FloatColumnVector (octave_idx_type n) : MArray (dim_vector (n, 1)) { } - explicit FloatColumnVector (const dim_vector& dv) + explicit FloatColumnVector (const dim_vector& dv) : MArray (dv.as_column ()) { } FloatColumnVector (octave_idx_type n, float val) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fDiagMatrix.cc --- a/liboctave/fDiagMatrix.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fDiagMatrix.cc Thu Jan 20 17:24:59 2011 -0500 @@ -184,7 +184,7 @@ if (i < 0 || i >= r) { (*current_liboctave_error_handler) ("invalid row selection"); - return FloatRowVector (); + return FloatRowVector (); } FloatRowVector retval (c, 0.0); @@ -200,7 +200,7 @@ if (! s) { (*current_liboctave_error_handler) ("invalid row selection"); - return FloatRowVector (); + return FloatRowVector (); } char c = *s; @@ -211,7 +211,7 @@ else { (*current_liboctave_error_handler) ("invalid row selection"); - return FloatRowVector (); + return FloatRowVector (); } } @@ -223,7 +223,7 @@ if (i < 0 || i >= c) { (*current_liboctave_error_handler) ("invalid column selection"); - return FloatColumnVector (); + return FloatColumnVector (); } FloatColumnVector retval (r, 0.0); @@ -239,7 +239,7 @@ if (! s) { (*current_liboctave_error_handler) ("invalid column selection"); - return FloatColumnVector (); + return FloatColumnVector (); } char c = *s; @@ -250,7 +250,7 @@ else { (*current_liboctave_error_handler) ("invalid column selection"); - return FloatColumnVector (); + return FloatColumnVector (); } } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fDiagMatrix.h --- a/liboctave/fDiagMatrix.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fDiagMatrix.h Thu Jan 20 17:24:59 2011 -0500 @@ -55,7 +55,7 @@ explicit FloatDiagMatrix (const Array& a) : MDiagArray2 (a) { } - FloatDiagMatrix (const Array& a, octave_idx_type r, octave_idx_type c) + FloatDiagMatrix (const Array& a, octave_idx_type r, octave_idx_type c) : MDiagArray2 (a, r, c) { } FloatDiagMatrix& operator = (const FloatDiagMatrix& a) @@ -75,7 +75,7 @@ FloatDiagMatrix& fill (const FloatRowVector& a, octave_idx_type beg); FloatDiagMatrix transpose (void) const { return MDiagArray2::transpose(); } - FloatDiagMatrix abs (void) const; + FloatDiagMatrix abs (void) const; friend OCTAVE_API FloatDiagMatrix real (const FloatComplexDiagMatrix& a); friend OCTAVE_API FloatDiagMatrix imag (const FloatComplexDiagMatrix& a); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fEIG.cc --- a/liboctave/fEIG.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fEIG.cc Thu Jan 20 17:24:59 2011 -0500 @@ -72,21 +72,21 @@ F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (spotrf, SPOTRF) (F77_CONST_CHAR_ARG_DECL, + F77_FUNC (spotrf, SPOTRF) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, float*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (cpotrf, CPOTRF) (F77_CONST_CHAR_ARG_DECL, + F77_FUNC (cpotrf, CPOTRF) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, FloatComplex*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (sggev, SGGEV) (F77_CONST_CHAR_ARG_DECL, + F77_FUNC (sggev, SGGEV) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, float*, const octave_idx_type&, float*, @@ -109,7 +109,7 @@ F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (cggev, CGGEV) (F77_CONST_CHAR_ARG_DECL, + F77_FUNC (cggev, CGGEV) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, FloatComplex*, const octave_idx_type&, FloatComplex*, @@ -123,7 +123,7 @@ F77_RET_T F77_FUNC (chegv, CHEGV) (const octave_idx_type&, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, FloatComplex*, const octave_idx_type&, FloatComplex*, @@ -246,7 +246,7 @@ return info; } -octave_idx_type +octave_idx_type FloatEIG::symmetric_init (const FloatMatrix& a, bool calc_ev) { octave_idx_type n = a.rows (); @@ -488,7 +488,7 @@ float *tmp_data = tmp.fortran_vec (); F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 ("L", 1), - n, tmp_data, n, + n, tmp_data, n, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); @@ -523,7 +523,7 @@ F77_XFCN (sggev, SGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), - n, atmp_data, n, btmp_data, n, + n, atmp_data, n, btmp_data, n, par, pai, pbeta, dummy, idummy, pvr, n, &dummy_work, lwork, info @@ -538,7 +538,7 @@ F77_XFCN (sggev, SGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), - n, atmp_data, n, btmp_data, n, + n, atmp_data, n, btmp_data, n, par, pai, pbeta, dummy, idummy, pvr, n, pwork, lwork, info @@ -576,9 +576,9 @@ return -1; } - lambda.elem(j) = FloatComplex (ar.elem(j) / beta.elem (j), + lambda.elem(j) = FloatComplex (ar.elem(j) / beta.elem (j), ai.elem(j) / beta.elem (j)); - lambda.elem(j+1) = FloatComplex (ar.elem(j+1) / beta.elem (j+1), + lambda.elem(j+1) = FloatComplex (ar.elem(j+1) / beta.elem (j+1), ai.elem(j+1) / beta.elem (j+1)); for (octave_idx_type i = 0; i < nvr; i++) @@ -598,7 +598,7 @@ return info; } -octave_idx_type +octave_idx_type FloatEIG::symmetric_init (const FloatMatrix& a, const FloatMatrix& b, bool calc_ev) { octave_idx_type n = a.rows (); @@ -632,8 +632,8 @@ F77_XFCN (ssygv, SSYGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), F77_CONST_CHAR_ARG2 ("U", 1), - n, atmp_data, n, - btmp_data, n, + n, atmp_data, n, + btmp_data, n, pwr, &dummy_work, lwork, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); @@ -646,8 +646,8 @@ F77_XFCN (ssygv, SSYGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), F77_CONST_CHAR_ARG2 ("U", 1), - n, atmp_data, n, - btmp_data, n, + n, atmp_data, n, + btmp_data, n, pwr, pwork, lwork, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); @@ -704,7 +704,7 @@ FloatComplex *tmp_data = tmp.fortran_vec (); F77_XFCN (cpotrf, CPOTRF, (F77_CONST_CHAR_ARG2 ("L", 1), - n, tmp_data, n, + n, tmp_data, n, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); @@ -740,7 +740,7 @@ F77_XFCN (cggev, CGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), - n, atmp_data, n, btmp_data, n, + n, atmp_data, n, btmp_data, n, palpha, pbeta, dummy, idummy, pv, n, &dummy_work, lwork, prwork, info F77_CHAR_ARG_LEN (1) @@ -754,12 +754,12 @@ F77_XFCN (cggev, CGGEV, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), - n, atmp_data, n, btmp_data, n, + n, atmp_data, n, btmp_data, n, palpha, pbeta, dummy, idummy, pv, n, pwork, lwork, prwork, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - + if (info < 0) { (*current_liboctave_error_handler) ("unrecoverable error in cggev"); @@ -823,7 +823,7 @@ F77_XFCN (chegv, CHEGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), F77_CONST_CHAR_ARG2 ("U", 1), - n, atmp_data, n, + n, atmp_data, n, btmp_data, n, pwr, &dummy_work, lwork, prwork, info @@ -838,8 +838,8 @@ F77_XFCN (chegv, CHEGV, (1, F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), F77_CONST_CHAR_ARG2 ("U", 1), - n, atmp_data, n, - btmp_data, n, + n, atmp_data, n, + btmp_data, n, pwr, pwork, lwork, prwork, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fMatrix.cc --- a/liboctave/fMatrix.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fMatrix.cc Thu Jan 20 17:24:59 2011 -0500 @@ -116,7 +116,7 @@ F77_RET_T F77_FUNC (ssyrk, SSYRK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, const float&, const float*, const octave_idx_type&, const float&, float*, const octave_idx_type& F77_CHAR_ARG_LEN_DECL @@ -130,7 +130,7 @@ F77_RET_T F77_FUNC (sgetrs, SGETRS) (F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, const float*, const octave_idx_type&, const octave_idx_type*, float*, const octave_idx_type&, octave_idx_type& @@ -143,8 +143,8 @@ F77_RET_T F77_FUNC (sgecon, SGECON) (F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, float*, - const octave_idx_type&, const float&, float&, + const octave_idx_type&, float*, + const octave_idx_type&, const float&, float&, float*, octave_idx_type*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); @@ -181,34 +181,34 @@ F77_RET_T F77_FUNC (spotrs, SPOTRS) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const octave_idx_type&, - const float*, const octave_idx_type&, float*, + const float*, const octave_idx_type&, float*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (strtri, STRTRI) (F77_CONST_CHAR_ARG_DECL, - F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, const float*, + F77_CONST_CHAR_ARG_DECL, + const octave_idx_type&, const float*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (strcon, STRCON) (F77_CONST_CHAR_ARG_DECL, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const float*, const octave_idx_type&, float&, - float*, octave_idx_type*, octave_idx_type& + float*, octave_idx_type*, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (strtrs, STRTRS) (F77_CONST_CHAR_ARG_DECL, - F77_CONST_CHAR_ARG_DECL, + F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const octave_idx_type&, - const octave_idx_type&, const float*, - const octave_idx_type&, float*, + const octave_idx_type&, + const octave_idx_type&, const float*, + const octave_idx_type&, float*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL @@ -234,7 +234,7 @@ const octave_idx_type&, const octave_idx_type&, const float*, const octave_idx_type&, float*, float& - F77_CHAR_ARG_LEN_DECL); + F77_CHAR_ARG_LEN_DECL); } // Matrix class. @@ -670,7 +670,7 @@ } FloatMatrix -FloatMatrix::tinverse (MatrixType &mattype, octave_idx_type& info, float& rcon, +FloatMatrix::tinverse (MatrixType &mattype, octave_idx_type& info, float& rcon, int force, int calc_cond) const { FloatMatrix retval; @@ -690,15 +690,15 @@ F77_XFCN (strtri, STRTRI, (F77_CONST_CHAR_ARG2 (&uplo, 1), F77_CONST_CHAR_ARG2 (&udiag, 1), - nr, tmp_data, nr, info + nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) info = -1; - else if (calc_cond) + else if (calc_cond) { octave_idx_type dtrcon_info = 0; char job = '1'; @@ -709,13 +709,13 @@ F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&job, 1), F77_CONST_CHAR_ARG2 (&uplo, 1), F77_CONST_CHAR_ARG2 (&udiag, 1), - nr, tmp_data, nr, rcon, - work, iwork, dtrcon_info + nr, tmp_data, nr, rcon, + work, iwork, dtrcon_info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (dtrcon_info != 0) + if (dtrcon_info != 0) info = -1; } @@ -728,7 +728,7 @@ FloatMatrix -FloatMatrix::finverse (MatrixType &mattype, octave_idx_type& info, float& rcon, +FloatMatrix::finverse (MatrixType &mattype, octave_idx_type& info, float& rcon, int force, int calc_cond) const { FloatMatrix retval; @@ -750,7 +750,7 @@ octave_idx_type lwork = -1; // Query the optimum work array size. - F77_XFCN (sgetri, SGETRI, (nc, tmp_data, nr, pipvt, + F77_XFCN (sgetri, SGETRI, (nc, tmp_data, nr, pipvt, z.fortran_vec (), lwork, info)); lwork = static_cast (z(0)); @@ -762,16 +762,16 @@ // Calculate the norm of the matrix, for later use. float anorm = 0; - if (calc_cond) + if (calc_cond) anorm = retval.abs().sum().row(static_cast(0)).max(); F77_XFCN (sgetrf, SGETRF, (nc, nc, tmp_data, nr, pipvt, info)); // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) info = -1; - else if (calc_cond) + else if (calc_cond) { octave_idx_type dgecon_info = 0; @@ -780,11 +780,11 @@ Array iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, piz, dgecon_info F77_CHAR_ARG_LEN (1))); - if (dgecon_info != 0) + if (dgecon_info != 0) info = -1; } @@ -797,7 +797,7 @@ F77_XFCN (sgetri, SGETRI, (nc, tmp_data, nr, pipvt, pz, lwork, dgetri_info)); - if (dgetri_info != 0) + if (dgetri_info != 0) info = -1; } @@ -809,7 +809,7 @@ } FloatMatrix -FloatMatrix::inverse (MatrixType &mattype, octave_idx_type& info, float& rcon, +FloatMatrix::inverse (MatrixType &mattype, octave_idx_type& info, float& rcon, int force, int calc_cond) const { int typ = mattype.type (false); @@ -910,7 +910,7 @@ const float *in (fortran_vec ()); FloatComplex *out (retval.fortran_vec ()); - octave_fftw::fft (in, out, npts, nsamples); + octave_fftw::fft (in, out, npts, nsamples); return retval; } @@ -940,7 +940,7 @@ FloatComplex *in (tmp.fortran_vec ()); FloatComplex *out (retval.fortran_vec ()); - octave_fftw::ifft (in, out, npts, nsamples); + octave_fftw::ifft (in, out, npts, nsamples); return retval; } @@ -1259,7 +1259,7 @@ if (typ == MatrixType::Lower || typ == MatrixType::Upper) { - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval *= elem (i,i); } else if (typ == MatrixType::Hermitian) @@ -1273,17 +1273,17 @@ char job = 'L'; - F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) { rcon = 0.0; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { Array z (dim_vector (3 * nc, 1)); float *pz = z.fortran_vec (); @@ -1295,10 +1295,10 @@ rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval *= atmp (i,i); retval = retval.square (); @@ -1325,14 +1325,14 @@ // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) { info = -1; retval = FloatDET (); - } - else + } + else { - if (calc_cond) + if (calc_cond) { // Now calc the condition number for non-singular matrix. char job = '1'; @@ -1342,19 +1342,19 @@ octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); } - if (info != 0) + if (info != 0) { info = -1; retval = FloatDET (); - } - else + } + else { - for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { float c = atmp(i,i); retval *= (ipvt(i) != (i+1)) ? -c : c; @@ -1406,16 +1406,16 @@ Array iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, piz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } else if (typ == MatrixType::Permuted_Upper) @@ -1434,16 +1434,16 @@ Array iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, piz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } else if (typ == MatrixType::Permuted_Lower) @@ -1462,17 +1462,17 @@ anorm = atmp.abs().sum(). row(static_cast(0)).max(); - F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) { rcon = 0.0; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { Array z (dim_vector (3 * nc, 1)); float *pz = z.fortran_vec (); @@ -1484,7 +1484,7 @@ rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } } @@ -1507,20 +1507,20 @@ F77_XFCN (sgetrf, SGETRF, (nr, nr, tmp_data, nr, pipvt, info)); - if (info != 0) + if (info != 0) { rcon = 0.0; mattype.mark_as_rectangular (); } - else + else { char job = '1'; F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) rcon = 0.0; } } @@ -1578,16 +1578,16 @@ Array iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, piz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile float rcond_plus_one = rcon + 1.0; @@ -1614,9 +1614,9 @@ char trans = get_blas_char (transt); char dia = 'N'; - F77_XFCN (strtrs, STRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&trans, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (strtrs, STRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&trans, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, b_nc, tmp_data, nr, result, nr, info F77_CHAR_ARG_LEN (1) @@ -1678,16 +1678,16 @@ Array iz (dim_vector (nc, 1)); octave_idx_type *piz = iz.fortran_vec (); - F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), - F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (strcon, STRCON, (F77_CONST_CHAR_ARG2 (&norm, 1), + F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, tmp_data, nr, rcon, pz, piz, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile float rcond_plus_one = rcon + 1.0; @@ -1714,9 +1714,9 @@ char trans = get_blas_char (transt); char dia = 'N'; - F77_XFCN (strtrs, STRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), - F77_CONST_CHAR_ARG2 (&trans, 1), - F77_CONST_CHAR_ARG2 (&dia, 1), + F77_XFCN (strtrs, STRTRS, (F77_CONST_CHAR_ARG2 (&uplo, 1), + F77_CONST_CHAR_ARG2 (&trans, 1), + F77_CONST_CHAR_ARG2 (&dia, 1), nr, b_nc, tmp_data, nr, result, nr, info F77_CHAR_ARG_LEN (1) @@ -1750,7 +1750,7 @@ else { volatile int typ = mattype.type (); - + // Calculate the norm of the matrix, for later use. float anorm = -1.; @@ -1762,20 +1762,20 @@ float *tmp_data = atmp.fortran_vec (); anorm = atmp.abs().sum().row(static_cast(0)).max(); - F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, + F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 (&job, 1), nr, tmp_data, nr, info F77_CHAR_ARG_LEN (1))); // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) { info = -2; mattype.mark_as_unsymmetric (); typ = MatrixType::Full; } - else + else { if (calc_cond) { @@ -1789,7 +1789,7 @@ rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile float rcond_plus_one = rcon + 1.0; @@ -1823,7 +1823,7 @@ { mattype.mark_as_unsymmetric (); typ = MatrixType::Full; - } + } } } @@ -1848,7 +1848,7 @@ // Throw-away extra info LAPACK gives so as to not change output. rcon = 0.0; - if (info != 0) + if (info != 0) { info = -2; @@ -1860,19 +1860,19 @@ mattype.mark_as_rectangular (); } - else + else { if (calc_cond) { - // Now calculate the condition number for + // Now calculate the condition number for // non-singular matrix. char job = '1'; F77_XFCN (sgecon, SGECON, (F77_CONST_CHAR_ARG2 (&job, 1), - nc, tmp_data, nr, anorm, + nc, tmp_data, nr, anorm, rcon, pz, piz, info F77_CHAR_ARG_LEN (1))); - if (info != 0) + if (info != 0) info = -2; volatile float rcond_plus_one = rcon + 1.0; @@ -1930,7 +1930,7 @@ } FloatMatrix -FloatMatrix::solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, +FloatMatrix::solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, float& rcon) const { return solve (typ, b, info, rcon, 0); @@ -1981,7 +1981,7 @@ } FloatComplexMatrix -FloatMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, +FloatMatrix::solve (MatrixType &typ, const FloatComplexMatrix& b, octave_idx_type& info) const { float rcon; @@ -2040,7 +2040,7 @@ } FloatColumnVector -FloatMatrix::solve (MatrixType &typ, const FloatColumnVector& b, +FloatMatrix::solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info) const { float rcon; @@ -2071,7 +2071,7 @@ } FloatComplexColumnVector -FloatMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, +FloatMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, octave_idx_type& info) const { FloatComplexMatrix tmp (*this); @@ -2079,7 +2079,7 @@ } FloatComplexColumnVector -FloatMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, +FloatMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, octave_idx_type& info, float& rcon) const { FloatComplexMatrix tmp (*this); @@ -2087,7 +2087,7 @@ } FloatComplexColumnVector -FloatMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, +FloatMatrix::solve (MatrixType &typ, const FloatComplexColumnVector& b, octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, blas_trans_type transt) const { @@ -2358,7 +2358,7 @@ F77_XFCN (sgelsd, SGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, - work.fortran_vec (), lwork, + work.fortran_vec (), lwork, piwork, info)); if (s.elem (0) == 0.0) @@ -2392,7 +2392,7 @@ } FloatComplexMatrix -FloatMatrix::lssolve (const FloatComplexMatrix& b, octave_idx_type& info, +FloatMatrix::lssolve (const FloatComplexMatrix& b, octave_idx_type& info, octave_idx_type& rank) const { FloatComplexMatrix tmp (*this); @@ -2401,7 +2401,7 @@ } FloatComplexMatrix -FloatMatrix::lssolve (const FloatComplexMatrix& b, octave_idx_type& info, +FloatMatrix::lssolve (const FloatComplexMatrix& b, octave_idx_type& info, octave_idx_type& rank, float& rcon) const { FloatComplexMatrix tmp (*this); @@ -2454,7 +2454,7 @@ volatile octave_idx_type minmn = (m < n ? m : n); octave_idx_type maxmn = m > n ? m : n; rcon = -1.0; - + if (m != n) { retval = FloatColumnVector (maxmn, 0.0); @@ -2512,7 +2512,7 @@ F77_XFCN (sgelsd, SGELSD, (m, n, nrhs, tmp_data, m, pretval, maxmn, ps, rcon, rank, - work.fortran_vec (), lwork, + work.fortran_vec (), lwork, piwork, info)); if (rank < minmn) @@ -2549,7 +2549,7 @@ } FloatComplexColumnVector -FloatMatrix::lssolve (const FloatComplexColumnVector& b, octave_idx_type& info, +FloatMatrix::lssolve (const FloatComplexColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const { FloatComplexMatrix tmp (*this); @@ -2558,7 +2558,7 @@ } FloatComplexColumnVector -FloatMatrix::lssolve (const FloatComplexColumnVector& b, octave_idx_type& info, +FloatMatrix::lssolve (const FloatComplexColumnVector& b, octave_idx_type& info, octave_idx_type& rank, float &rcon) const { FloatComplexMatrix tmp (*this); @@ -2633,7 +2633,7 @@ retval = FloatMatrix (len, a_len); float *c = retval.fortran_vec (); - + F77_XFCN (sgemm, SGEMM, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 ("N", 1), len, a_len, 1, 1.0, v.data (), len, @@ -3063,7 +3063,7 @@ FloatSCHUR as (a, "U"); FloatSCHUR bs (b, "U"); - + // Transform c to new coordinates. FloatMatrix ua = as.unitary_matrix (); @@ -3071,9 +3071,9 @@ FloatMatrix ub = bs.unitary_matrix (); FloatMatrix sch_b = bs.schur_matrix (); - + FloatMatrix cx = ua.transpose () * c * ub; - + // Solve the sylvester equation, back-transform, and return the // solution. @@ -3096,7 +3096,7 @@ // FIXME -- check info? - + retval = -ua*cx*ub.transpose (); return retval; @@ -3130,8 +3130,8 @@ // the general GEMM operation -FloatMatrix -xgemm (const FloatMatrix& a, const FloatMatrix& b, +FloatMatrix +xgemm (const FloatMatrix& a, const FloatMatrix& b, blas_trans_type transa, blas_trans_type transb) { FloatMatrix retval; @@ -3362,8 +3362,8 @@ return result; } -FloatMatrix linspace (const FloatColumnVector& x1, - const FloatColumnVector& x2, +FloatMatrix linspace (const FloatColumnVector& x1, + const FloatColumnVector& x2, octave_idx_type n) { @@ -3381,7 +3381,7 @@ retval(i, 0) = x1(i); // The last column is not needed while using delta. - float *delta = &retval(0, n-1); + float *delta = &retval(0, n-1); for (octave_idx_type i = 0; i < m; i++) delta[i] = (x2(i) - x1(i)) / (n - 1); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fMatrix.h --- a/liboctave/fMatrix.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fMatrix.h Thu Jan 20 17:24:59 2011 -0500 @@ -133,10 +133,10 @@ } private: - FloatMatrix tinverse (MatrixType &mattype, octave_idx_type& info, float& rcon, + FloatMatrix tinverse (MatrixType &mattype, octave_idx_type& info, float& rcon, int force, int calc_cond) const; - FloatMatrix finverse (MatrixType &mattype, octave_idx_type& info, float& rcon, + FloatMatrix finverse (MatrixType &mattype, octave_idx_type& info, float& rcon, int force, int calc_cond) const; public: @@ -161,7 +161,7 @@ FloatDET determinant (void) const; FloatDET determinant (octave_idx_type& info) const; FloatDET determinant (octave_idx_type& info, float& rcon, int calc_cond = 1) const; - FloatDET determinant (MatrixType &mattype, octave_idx_type& info, + FloatDET determinant (MatrixType &mattype, octave_idx_type& info, float& rcon, int calc_cond = 1) const; float rcond (void) const; @@ -187,40 +187,40 @@ // Generic interface to solver with no probing of type FloatMatrix solve (MatrixType &typ, const FloatMatrix& b) const; FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info) const; - FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, + FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, float& rcon) const; FloatMatrix solve (MatrixType &typ, const FloatMatrix& b, octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, bool singular_fallback = true, blas_trans_type transt = blas_no_trans) const; FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b) const; - FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, + FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, octave_idx_type& info) const; - FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, + FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, octave_idx_type& info, float& rcon) const; - FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, + FloatComplexMatrix solve (MatrixType &typ, const FloatComplexMatrix& b, octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, - bool singular_fallback = true, + bool singular_fallback = true, blas_trans_type transt = blas_no_trans) const; FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b) const; - FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, + FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info) const; - FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, + FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info, float& rcon) const; - FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, + FloatColumnVector solve (MatrixType &typ, const FloatColumnVector& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; - FloatComplexColumnVector solve (MatrixType &typ, + FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, + FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, octave_idx_type& info) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, + FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, octave_idx_type& info, float& rcon) const; - FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, + FloatComplexColumnVector solve (MatrixType &typ, const FloatComplexColumnVector& b, octave_idx_type& info, float& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; @@ -229,21 +229,21 @@ FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info) const; FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rcon) const; FloatMatrix solve (const FloatMatrix& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; FloatComplexMatrix solve (const FloatComplexMatrix& b) const; FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info) const; FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon) const; FloatComplexMatrix solve (const FloatComplexMatrix& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; FloatColumnVector solve (const FloatColumnVector& b) const; FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& info) const; FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& info, float& rcon) const; FloatColumnVector solve (const FloatColumnVector& b, octave_idx_type& info, float& rcon, - solve_singularity_handler sing_handler, + solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; FloatComplexColumnVector solve (const FloatComplexColumnVector& b) const; @@ -251,15 +251,15 @@ FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info, float& rcon) const; FloatComplexColumnVector solve (const FloatComplexColumnVector& b, octave_idx_type& info, - float& rcon, solve_singularity_handler sing_handler, + float& rcon, solve_singularity_handler sing_handler, blas_trans_type transt = blas_no_trans) const; // Singular solvers FloatMatrix lssolve (const FloatMatrix& b) const; FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info) const; - FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, + FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, octave_idx_type& rank) const; - FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, + FloatMatrix lssolve (const FloatMatrix& b, octave_idx_type& info, octave_idx_type& rank, float& rcon) const; FloatComplexMatrix lssolve (const FloatComplexMatrix& b) const; @@ -277,12 +277,12 @@ octave_idx_type& rank, float& rcon) const; FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b) const; - FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, + FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, octave_idx_type& info) const; FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const; - FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, + FloatComplexColumnVector lssolve (const FloatComplexColumnVector& b, octave_idx_type& info, octave_idx_type& rank, float& rcon) const; @@ -302,7 +302,7 @@ bool all_elements_are_int_or_inf_or_nan (void) const; bool all_integers (float& max_val, float& min_val) const; bool too_large_for_float (void) const; - + boolMatrix all (int dim = -1) const; boolMatrix any (int dim = -1) const; @@ -352,7 +352,7 @@ extern OCTAVE_API FloatMatrix Sylvester (const FloatMatrix&, const FloatMatrix&, const FloatMatrix&); extern OCTAVE_API FloatMatrix xgemm (const FloatMatrix& a, const FloatMatrix& b, - blas_trans_type transa = blas_no_trans, + blas_trans_type transa = blas_no_trans, blas_trans_type transb = blas_no_trans); extern OCTAVE_API FloatMatrix operator * (const FloatMatrix& a, const FloatMatrix& b); @@ -365,8 +365,8 @@ extern OCTAVE_API FloatMatrix max (const FloatMatrix& m, float d); extern OCTAVE_API FloatMatrix max (const FloatMatrix& a, const FloatMatrix& b); -extern OCTAVE_API FloatMatrix linspace (const FloatColumnVector& x1, - const FloatColumnVector& x2, +extern OCTAVE_API FloatMatrix linspace (const FloatColumnVector& x1, + const FloatColumnVector& x2, octave_idx_type n); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fNDArray.cc --- a/liboctave/fNDArray.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fNDArray.cc Thu Jan 20 17:24:59 2011 -0500 @@ -79,7 +79,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) - octave_fftw::fft (in + k * stride * n, out + k * stride * n, + octave_fftw::fft (in + k * stride * n, out + k * stride * n, n, howmany, stride, dist); return retval; @@ -109,7 +109,7 @@ // Need to be careful here about the distance between fft's for (octave_idx_type k = 0; k < nloop; k++) - octave_fftw::ifft (out + k * stride * n, out + k * stride * n, + octave_fftw::ifft (out + k * stride * n, out + k * stride * n, n, howmany, stride, dist); return retval; @@ -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 (npts); } } @@ -320,7 +320,7 @@ FloatComplex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -368,7 +368,7 @@ FloatComplex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -387,7 +387,7 @@ 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 (npts); } } @@ -416,7 +416,7 @@ FloatComplex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -463,7 +463,7 @@ FloatComplex *prow = row.fortran_vec (); octave_idx_type howmany = numel () / npts; - howmany = (stride == 1 ? howmany : + howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); octave_idx_type dist = (stride == 1 ? npts : 1); @@ -883,5 +883,5 @@ BSXFUN_STDREL_DEFS_MXLOOP (FloatNDArray) BSXFUN_OP_DEF_MXLOOP (pow, FloatNDArray, mx_inline_pow) -BSXFUN_OP2_DEF_MXLOOP (pow, FloatComplexNDArray, FloatComplexNDArray, +BSXFUN_OP2_DEF_MXLOOP (pow, FloatComplexNDArray, FloatComplexNDArray, FloatNDArray, mx_inline_pow) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/fNDArray.h --- a/liboctave/fNDArray.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/fNDArray.h Thu Jan 20 17:24:59 2011 -0500 @@ -45,7 +45,7 @@ FloatNDArray (const dim_vector& dv, float val) : MArray (dv, val) { } - + FloatNDArray (const FloatNDArray& a) : MArray (a) { } FloatNDArray (const FloatMatrix& a) : MArray (a) { } @@ -59,7 +59,7 @@ template explicit FloatNDArray (const intNDArray& a) : MArray (a) { } - FloatNDArray (const charNDArray&); + FloatNDArray (const charNDArray&); FloatNDArray& operator = (const FloatNDArray& a) { @@ -89,8 +89,8 @@ FloatNDArray cumprod (int dim = -1) const; FloatNDArray cumsum (int dim = -1) const; FloatNDArray prod (int dim = -1) const; - FloatNDArray sum (int dim = -1) const; - NDArray dsum (int dim = -1) const; + FloatNDArray sum (int dim = -1) const; + NDArray dsum (int dim = -1) const; FloatNDArray sumsq (int dim = -1) const; FloatNDArray concat (const FloatNDArray& rb, const Array& ra_idx); FloatComplexNDArray concat (const FloatComplexNDArray& rb, const Array& ra_idx); @@ -100,7 +100,7 @@ FloatNDArray max (Array& index, int dim = -1) const; FloatNDArray min (int dim = -1) const; FloatNDArray min (Array& index, int dim = -1) const; - + FloatNDArray cummax (int dim = -1) const; FloatNDArray cummax (Array& index, int dim = -1) const; FloatNDArray cummin (int dim = -1) const; @@ -150,10 +150,10 @@ FloatNDArray diag (octave_idx_type k = 0) const; - FloatNDArray& changesign (void) - { - MArray::changesign (); - return *this; + FloatNDArray& changesign (void) + { + MArray::changesign (); + return *this; } }; @@ -180,7 +180,7 @@ BSXFUN_STDREL_DECLS (FloatNDArray, OCTAVE_API) BSXFUN_OP_DECL (pow, FloatNDArray, OCTAVE_API) -BSXFUN_OP2_DECL (pow, FloatComplexNDArray, FloatComplexNDArray, +BSXFUN_OP2_DECL (pow, FloatComplexNDArray, FloatComplexNDArray, FloatNDArray, OCTAVE_API) #endif diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/file-ops.cc --- a/liboctave/file-ops.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/file-ops.cc Thu Jan 20 17:24:59 2011 -0500 @@ -651,7 +651,7 @@ msg = std::string (); std::string retval; - + const char *pdir = dir.empty () ? 0 : dir.c_str (); const char *ppfx = pfx.empty () ? 0 : pfx.c_str (); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/file-stat.cc --- a/liboctave/file-stat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/file-stat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -54,31 +54,31 @@ bool base_file_stat::is_dir (void) const -{ +{ return exists () && is_dir (fs_mode); } bool base_file_stat::is_fifo (void) const -{ +{ return exists () && is_fifo (fs_mode); } bool base_file_stat::is_lnk (void) const -{ +{ return exists () && is_lnk (fs_mode); } bool base_file_stat::is_reg (void) const -{ +{ return exists () && is_reg (fs_mode); } bool base_file_stat::is_sock (void) const -{ +{ return exists () && is_sock (fs_mode); } @@ -104,7 +104,7 @@ bool base_file_stat::is_dir (mode_t mode) -{ +{ #ifdef S_ISDIR return S_ISDIR (mode); #else @@ -114,7 +114,7 @@ bool base_file_stat::is_fifo (mode_t mode) -{ +{ #ifdef S_ISFIFO return S_ISFIFO (mode); #else @@ -124,7 +124,7 @@ bool base_file_stat::is_lnk (mode_t mode) -{ +{ #ifdef S_ISLNK return S_ISLNK (mode); #else @@ -134,7 +134,7 @@ bool base_file_stat::is_reg (mode_t mode) -{ +{ #ifdef S_ISREG return S_ISREG (mode); #else @@ -144,7 +144,7 @@ bool base_file_stat::is_sock (mode_t mode) -{ +{ #ifdef S_ISSOCK return S_ISSOCK (mode); #else @@ -182,7 +182,7 @@ { initialized = false; fail = false; - + std::string full_file_name = file_ops::tilde_expand (file_name); #if defined (__WIN32__) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatAEPBAL.cc --- a/liboctave/floatAEPBAL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatAEPBAL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -50,7 +50,7 @@ F77_CHAR_ARG_LEN_DECL); } -FloatAEPBALANCE::FloatAEPBALANCE (const FloatMatrix& a, +FloatAEPBALANCE::FloatAEPBALANCE (const FloatMatrix& a, bool noperm, bool noscal) : base_aepbal () { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatAEPBAL.h --- a/liboctave/floatAEPBAL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatAEPBAL.h Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ FloatAEPBALANCE (const FloatMatrix& a, bool noperm = false, bool noscal = false); - FloatAEPBALANCE (const FloatAEPBALANCE& a) + FloatAEPBALANCE (const FloatAEPBALANCE& a) : base_aepbal (a) { } FloatMatrix balancing_matrix (void) const; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatCHOL.cc --- a/liboctave/floatCHOL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatCHOL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -55,7 +55,7 @@ F77_FUNC (spocon, SPOCON) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, float*, const octave_idx_type&, const float&, - float&, float*, octave_idx_type*, + float&, float*, octave_idx_type*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); #ifdef HAVE_QRUPDATE @@ -113,7 +113,7 @@ // Calculate the norm of the matrix, for later use. float anorm = 0; - if (calc_cond) + if (calc_cond) anorm = xnorm (a, 1); F77_XFCN (spotrf, SPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), @@ -123,7 +123,7 @@ xrcond = 0.0; if (info > 0) chol_mat.resize (info - 1, info - 1); - else if (calc_cond) + else if (calc_cond) { octave_idx_type spocon_info = 0; @@ -136,7 +136,7 @@ n, anorm, xrcond, pz, piz, spocon_info F77_CHAR_ARG_LEN (1))); - if (spocon_info != 0) + if (spocon_info != 0) info = -1; } @@ -192,7 +192,7 @@ void FloatCHOL::set (const FloatMatrix& R) { - if (R.is_square ()) + if (R.is_square ()) chol_mat = R; else (*current_liboctave_error_handler) ("FloatCHOL requires square matrix"); @@ -246,7 +246,7 @@ octave_idx_type info = -1; octave_idx_type n = chol_mat.rows (); - + if (u.length () != n + 1) (*current_liboctave_error_handler) ("cholinsert: dimension mismatch"); else if (j < 0 || j > n) @@ -270,14 +270,14 @@ FloatCHOL::delete_sym (octave_idx_type j) { octave_idx_type n = chol_mat.rows (); - + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("choldelete: index out of range"); else { OCTAVE_LOCAL_BUFFER (float, w, n); - F77_XFCN (schdex, SCHDEX, (n, chol_mat.fortran_vec (), chol_mat.rows (), + F77_XFCN (schdex, SCHDEX, (n, chol_mat.fortran_vec (), chol_mat.rows (), j + 1, w)); chol_mat.resize (n-1, n-1); @@ -288,8 +288,8 @@ FloatCHOL::shift_sym (octave_idx_type i, octave_idx_type j) { octave_idx_type n = chol_mat.rows (); - - if (i < 0 || i > n-1 || j < 0 || j > n-1) + + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("cholshift: index out of range"); else { @@ -311,7 +311,7 @@ if (u.length () == n) { - init (chol_mat.transpose () * chol_mat + init (chol_mat.transpose () * chol_mat + FloatMatrix (u) * FloatMatrix (u).transpose (), false); } else @@ -341,7 +341,7 @@ info = 2; else { - info = init (chol_mat.transpose () * chol_mat + info = init (chol_mat.transpose () * chol_mat - FloatMatrix (u) * FloatMatrix (u).transpose (), false); if (info) info = 1; } @@ -416,7 +416,7 @@ octave_idx_type n = chol_mat.rows (); - if (i < 0 || i > n-1 || j < 0 || j > n-1) + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("cholshift: index out of range"); else { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatCHOL.h --- a/liboctave/floatCHOL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatCHOL.h Thu Jan 20 17:24:59 2011 -0500 @@ -44,7 +44,7 @@ } FloatCHOL (const FloatMatrix& a, octave_idx_type& info, - bool calc_cond = false) + bool calc_cond = false) : chol_mat (), xrcond (0) { info = init (a, calc_cond); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatGEPBAL.cc --- a/liboctave/floatGEPBAL.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatGEPBAL.cc Thu Jan 20 17:24:59 2011 -0500 @@ -59,7 +59,7 @@ } octave_idx_type -FloatGEPBALANCE::init (const FloatMatrix& a, const FloatMatrix& b, +FloatGEPBALANCE::init (const FloatMatrix& a, const FloatMatrix& b, const std::string& balance_job) { octave_idx_type n = a.cols (); @@ -74,7 +74,7 @@ { gripe_nonconformant ("FloatGEPBALANCE", n, n, b.rows(), b.cols()); return -1; - } + } octave_idx_type info; octave_idx_type ilo; @@ -115,7 +115,7 @@ n, p_balancing_mat, n, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - + // then right F77_XFCN (sggbak, SGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1), F77_CONST_CHAR_ARG2 ("R", 1), diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatGEPBAL.h --- a/liboctave/floatGEPBAL.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatGEPBAL.h Thu Jan 20 17:24:59 2011 -0500 @@ -41,7 +41,7 @@ const std::string& balance_job) : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 () { - init (a, b, balance_job); + init (a, b, balance_job); } FloatGEPBALANCE (const FloatGEPBALANCE& a) @@ -79,7 +79,7 @@ FloatMatrix balancing_mat; FloatMatrix balancing_mat2; - octave_idx_type init (const FloatMatrix& a, const FloatMatrix& b, + octave_idx_type init (const FloatMatrix& a, const FloatMatrix& b, const std::string& balance_job); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatLU.h --- a/liboctave/floatLU.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatLU.h Thu Jan 20 17:24:59 2011 -0500 @@ -39,7 +39,7 @@ FloatLU (const FloatLU& a) : base_lu (a) { } - FloatLU (const FloatMatrix& l, const FloatMatrix& u, + FloatLU (const FloatMatrix& l, const FloatMatrix& u, const PermMatrix& p) : base_lu (l, u, p) { } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatQR.cc --- a/liboctave/floatQR.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatQR.cc Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ F77_RET_T F77_FUNC (sgeqrf, SGEQRF) (const octave_idx_type&, const octave_idx_type&, float*, const octave_idx_type&, float*, float*, - const octave_idx_type&, octave_idx_type&); + const octave_idx_type&, octave_idx_type&); F77_RET_T F77_FUNC (sorgqr, SORGQR) (const octave_idx_type&, const octave_idx_type&, @@ -73,13 +73,13 @@ const octave_idx_type&, float*); F77_RET_T - F77_FUNC (sqrinr, SQRINR) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (sqrinr, SQRINR) (const octave_idx_type&, const octave_idx_type&, float*, const octave_idx_type&, float*, const octave_idx_type&, const octave_idx_type&, const float*, float*); F77_RET_T - F77_FUNC (sqrder, SQRDER) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (sqrder, SQRDER) (const octave_idx_type&, const octave_idx_type&, float*, const octave_idx_type&, float*, const octave_idx_type&, const octave_idx_type&, float*); @@ -131,7 +131,7 @@ form (n, afact, tau, qr_type); } -void FloatQR::form (octave_idx_type n, FloatMatrix& afact, +void FloatQR::form (octave_idx_type n, FloatMatrix& afact, float *tau, qr_type_t qr_type) { octave_idx_type m = afact.rows (), min_mn = std::min (m, n); @@ -249,7 +249,7 @@ if (u.length () != m) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > n) + else if (j < 0 || j > n) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -266,7 +266,7 @@ FloatColumnVector utmp = u; OCTAVE_LOCAL_BUFFER (float, w, k); F77_XFCN (sqrinc, SQRINC, (m, n, k, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), j + 1, + r.fortran_vec (), r.rows (), j + 1, utmp.data (), w)); } } @@ -309,9 +309,9 @@ { octave_idx_type ii = i; FloatColumnVector utmp = u.column (jsi(i)); - F77_XFCN (sqrinc, SQRINC, (m, n + ii, std::min (kmax, k + ii), + F77_XFCN (sqrinc, SQRINC, (m, n + ii, std::min (kmax, k + ii), q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), js(ii) + 1, + r.fortran_vec (), r.rows (), js(ii) + 1, utmp.data (), w)); } } @@ -324,7 +324,7 @@ octave_idx_type k = r.rows (); octave_idx_type n = r.columns (); - if (j < 0 || j > n-1) + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -368,7 +368,7 @@ for (volatile octave_idx_type i = 0; i < js.length (); i++) { octave_idx_type ii = i; - F77_XFCN (sqrdec, SQRDEC, (m, n - ii, k == m ? k : k - ii, + F77_XFCN (sqrdec, SQRDEC, (m, n - ii, k == m ? k : k - ii, q.fortran_vec (), q.rows (), r.fortran_vec (), r.rows (), js(ii) + 1, w)); } @@ -394,7 +394,7 @@ if (! q.is_square () || u.length () != n) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > m) + else if (j < 0 || j > m) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -403,7 +403,7 @@ FloatRowVector utmp = u; OCTAVE_LOCAL_BUFFER (float, w, k); F77_XFCN (sqrinr, SQRINR, (m, n, q.fortran_vec (), q.rows (), - r.fortran_vec (), r.rows (), + r.fortran_vec (), r.rows (), j + 1, utmp.fortran_vec (), w)); } @@ -417,7 +417,7 @@ if (! q.is_square ()) (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); - else if (j < 0 || j > m-1) + else if (j < 0 || j > m-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -438,12 +438,12 @@ octave_idx_type k = r.rows (); octave_idx_type n = r.columns (); - if (i < 0 || i > n-1 || j < 0 || j > n-1) + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrshift: index out of range"); else { OCTAVE_LOCAL_BUFFER (float, w, 2*k); - F77_XFCN (sqrshc, SQRSHC, (m, n, k, + F77_XFCN (sqrshc, SQRSHC, (m, n, k, q.fortran_vec (), q.rows (), r.fortran_vec (), r.rows (), i + 1, j + 1, w)); @@ -529,7 +529,7 @@ } static -FloatMatrix shift_cols (const FloatMatrix& a, +FloatMatrix shift_cols (const FloatMatrix& a, octave_idx_type i, octave_idx_type j) { octave_idx_type n = a.columns (); @@ -559,7 +559,7 @@ if (u.length () != m) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > n) + else if (j < 0 || j > n) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -605,7 +605,7 @@ octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); - if (j < 0 || j > n-1) + if (j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -651,7 +651,7 @@ if (! q.is_square () || u.length () != n) (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); - else if (j < 0 || j > m) + else if (j < 0 || j > m) (*current_liboctave_error_handler) ("qrinsert: index out of range"); else { @@ -669,7 +669,7 @@ if (! q.is_square ()) (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); - else if (j < 0 || j > m-1) + else if (j < 0 || j > m-1) (*current_liboctave_error_handler) ("qrdelete: index out of range"); else { @@ -685,7 +685,7 @@ octave_idx_type m = q.rows (); octave_idx_type n = r.columns (); - if (i < 0 || i > n-1 || j < 0 || j > n-1) + if (i < 0 || i > n-1 || j < 0 || j > n-1) (*current_liboctave_error_handler) ("qrshift: index out of range"); else { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatQR.h --- a/liboctave/floatQR.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatQR.h Thu Jan 20 17:24:59 2011 -0500 @@ -41,7 +41,7 @@ FloatQR (const FloatMatrix&, qr_type_t = qr_type_std); - FloatQR (const FloatMatrix& qx, const FloatMatrix& rx) + FloatQR (const FloatMatrix& qx, const FloatMatrix& rx) : base_qr (qx, rx) { } FloatQR (const FloatQR& a) : base_qr (a) { } @@ -68,7 +68,7 @@ protected: - void form (octave_idx_type n, FloatMatrix& afact, + void form (octave_idx_type n, FloatMatrix& afact, float *tau, qr_type_t qr_type); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatQRP.cc --- a/liboctave/floatQRP.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatQRP.cc Thu Jan 20 17:24:59 2011 -0500 @@ -95,7 +95,7 @@ form (n, afact, tau, qr_type); } -FloatRowVector +FloatRowVector FloatQRP::Pvec (void) const { Array pa (p.pvec ()); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatSCHUR.h --- a/liboctave/floatSCHUR.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatSCHUR.h Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ init (a, ord, calc_unitary); } - FloatSCHUR (const FloatMatrix& a, const std::string& ord, int& info, + FloatSCHUR (const FloatMatrix& a, const std::string& ord, int& info, bool calc_unitary = true) : schur_mat (), unitary_mat (), selector (0) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/floatSVD.h --- a/liboctave/floatSVD.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/floatSVD.h Thu Jan 20 17:24:59 2011 -0500 @@ -37,16 +37,16 @@ FloatSVD (void) : type_computed (), sigma (), left_sm (), right_sm () { } - FloatSVD (const FloatMatrix& a, - SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GESVD) + FloatSVD (const FloatMatrix& a, + SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () { init (a, svd_type, svd_driver); } - FloatSVD (const FloatMatrix& a, octave_idx_type& info, + FloatSVD (const FloatMatrix& a, octave_idx_type& info, SVD::type svd_type = SVD::std, - SVD::driver svd_driver = SVD::GESVD) + SVD::driver svd_driver = SVD::GESVD) : type_computed (), sigma (), left_sm (), right_sm () { info = init (a, svd_type, svd_driver); @@ -88,8 +88,8 @@ FloatMatrix left_sm; FloatMatrix right_sm; - octave_idx_type init (const FloatMatrix& a, - SVD::type svd_type = SVD::std, + octave_idx_type init (const FloatMatrix& a, + SVD::type svd_type = SVD::std, SVD::driver svd_driver = SVD::GESVD); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/idx-vector.cc --- a/liboctave/idx-vector.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/idx-vector.cc Thu Jan 20 17:24:59 2011 -0500 @@ -98,7 +98,7 @@ return this; } -std::ostream& +std::ostream& idx_vector::idx_colon_rep::print (std::ostream& os) const { return os << ":"; @@ -134,7 +134,7 @@ else if (len > 0) { if (r.all_elements_are_ints ()) - { + { start = static_cast (r.base ()) - 1; step = static_cast (r.inc ()); if (start < 0 || (step < 0 && start + (len-1)*step < 0)) @@ -195,7 +195,7 @@ } } -std::ostream& +std::ostream& idx_vector::idx_range_rep::print (std::ostream& os) const { os << start << ':' << step << ':' << start + len*step; @@ -205,7 +205,7 @@ Range idx_vector::idx_range_rep::unconvert (void) const { - return Range (static_cast (start+1), + return Range (static_cast (start+1), static_cast (step), len); } @@ -220,10 +220,10 @@ } inline octave_idx_type -convert_index (octave_idx_type i, bool& conv_error, +convert_index (octave_idx_type i, bool& conv_error, octave_idx_type& ext) { - if (i <= 0) + if (i <= 0) conv_error = true; if (ext < i) @@ -251,7 +251,7 @@ template inline octave_idx_type -convert_index (octave_int x, bool& conv_error, +convert_index (octave_int x, bool& conv_error, octave_idx_type& ext) { octave_idx_type i = octave_int (x).value (); @@ -273,10 +273,10 @@ gripe_invalid_index (); } -idx_vector::idx_scalar_rep::idx_scalar_rep (octave_idx_type i) +idx_vector::idx_scalar_rep::idx_scalar_rep (octave_idx_type i) : data (i) { - if (data < 0) + if (data < 0) { gripe_invalid_index (); err = true; @@ -339,7 +339,7 @@ // Note that this makes a shallow copy of the index array. idx_vector::idx_vector_rep::idx_vector_rep (const Array& inda) - : data (inda.data ()), len (inda.numel ()), ext (0), + : data (inda.data ()), len (inda.numel ()), ext (0), aowner (new Array (inda)), orig_dims (inda.dims ()) { if (len != 0) @@ -348,9 +348,9 @@ for (octave_idx_type i = 0; i < len; i++) { octave_idx_type k = inda.xelem (i); - if (k < 0) + if (k < 0) err = true; - else if (k > max) + else if (k > max) max = k; } @@ -363,7 +363,7 @@ idx_vector::idx_vector_rep::idx_vector_rep (const Array& inda, octave_idx_type _ext, direct) - : data (inda.data ()), len (inda.numel ()), ext (_ext), + : data (inda.data ()), len (inda.numel ()), ext (_ext), aowner (new Array (inda)), orig_dims (inda.dims ()) { // No checking. @@ -400,7 +400,7 @@ const dim_vector dv = bnda.dims (); if (! dv.all_zero ()) - orig_dims = ((dv.length () == 2 && dv(0) == 1) + orig_dims = ((dv.length () == 2 && dv(0) == 1) ? dim_vector (1, len) : dim_vector (len, 1)); if (len != 0) @@ -441,7 +441,7 @@ // FIXME: I hope this is OK, i.e. the element iterated this way are correctly ordered. for (octave_idx_type i = 0; i < nnz; i++) { - if (bnda.data (i)) + if (bnda.data (i)) d[k++] = bnda.cidx (i) + bnda.rows () * bnda.ridx (i); } @@ -452,11 +452,11 @@ } idx_vector::idx_vector_rep::~idx_vector_rep (void) -{ - if (aowner) +{ + if (aowner) delete aowner; else - delete [] data; + delete [] data; } octave_idx_type @@ -481,7 +481,7 @@ } // This is wrapped in auto_ptr so that we don't leak on out-of-memory. - std::auto_ptr new_rep ( + std::auto_ptr new_rep ( new idx_vector_rep (0, len, ext, orig_dims, DIRECT)); if (ext > len*xlog2 (1.0 + len)) @@ -604,7 +604,7 @@ return new_rep.release (); } -std::ostream& +std::ostream& idx_vector::idx_vector_rep::print (std::ostream& os) const { os << '['; @@ -675,7 +675,7 @@ const dim_vector dv = bnda.dims (); if (! dv.all_zero ()) - orig_dims = ((dv.length () == 2 && dv(0) == 1) + orig_dims = ((dv.length () == 2 && dv(0) == 1) ? dim_vector (1, len) : dim_vector (len, 1)); aowner = new Array (bnda); @@ -683,11 +683,11 @@ } idx_vector::idx_mask_rep::~idx_mask_rep (void) -{ - if (aowner) +{ + if (aowner) delete aowner; else - delete [] data; + delete [] data; } octave_idx_type @@ -720,7 +720,7 @@ return xelem (n); } -std::ostream& +std::ostream& idx_vector::idx_mask_rep::print (std::ostream& os) const { os << '['; @@ -1150,7 +1150,7 @@ retval = true; for (octave_idx_type i = 0, len = length (); i < len; i++) - { + { octave_idx_type k = xelem (i); if (left[k]) left[k] = false; @@ -1211,7 +1211,7 @@ octave_idx_type *idata = new octave_idx_type [len]; for (octave_idx_type i = 0, j = 0; i < ext; i++) - if (data[i]) + if (data[i]) idata[j++] = i; ext = len > 0 ? idata[len - 1] + 1 : 0; @@ -1224,7 +1224,7 @@ } void idx_vector::unconvert (idx_class_type& iclass, - double& scalar, Range& range, + double& scalar, Range& range, Array& array, Array& mask) const { iclass = idx_class (); @@ -1267,7 +1267,7 @@ } } -Array +Array idx_vector::as_array (void) const { return rep->as_array (); @@ -1278,8 +1278,8 @@ { return idx_class () != class_vector || orig_dimensions ().is_vector (); } - -octave_idx_type + +octave_idx_type idx_vector::freeze (octave_idx_type z_len, const char *, bool resize_ok) { if (! resize_ok && extent (z_len) > z_len) @@ -1293,7 +1293,7 @@ return length (z_len); } -octave_idx_type +octave_idx_type idx_vector::ones_count () const { octave_idx_type n = 0; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/idx-vector.h --- a/liboctave/idx-vector.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/idx-vector.h Thu Jan 20 17:24:59 2011 -0500 @@ -51,7 +51,7 @@ idx_vector { public: - + enum idx_class_type { class_invalid = -1, @@ -157,15 +157,15 @@ { public: idx_range_rep (octave_idx_type _start, octave_idx_type _len, - octave_idx_type _step, direct) + octave_idx_type _step, direct) : idx_base_rep (), start(_start), len(_len), step(_step) { } - idx_range_rep (void) + idx_range_rep (void) : start(0), len(0), step(1) { } // Zero-based constructor. idx_range_rep (octave_idx_type _start, octave_idx_type _limit, - octave_idx_type _step); + octave_idx_type _step); idx_range_rep (const Range&); @@ -275,11 +275,11 @@ { public: // Direct constructor. - idx_vector_rep (octave_idx_type *_data, octave_idx_type _len, + idx_vector_rep (octave_idx_type *_data, octave_idx_type _len, octave_idx_type _ext, const dim_vector& od, direct) : data (_data), len (_len), ext (_ext), aowner (0), orig_dims (od) { } - idx_vector_rep (void) + idx_vector_rep (void) : data (0), len (0), ext (0), aowner (0), orig_dims () { } @@ -324,7 +324,7 @@ Array unconvert (void) const; Array as_array (void); - + private: DECLARE_OCTAVE_ALLOCATOR @@ -343,7 +343,7 @@ // object that provides us the data. Note that we need a pointer // because we deferred the Array declaration and we do not want // it yet to be defined. - + Array *aowner; dim_vector orig_dims; @@ -354,12 +354,12 @@ { public: // Direct constructor. - idx_mask_rep (bool *_data, octave_idx_type _len, + idx_mask_rep (bool *_data, octave_idx_type _len, octave_idx_type _ext, const dim_vector& od, direct) : data (_data), len (_len), ext (_ext), lsti (-1), lste (-1), aowner (0), orig_dims (od) { } - idx_mask_rep (void) + idx_mask_rep (void) : data (0), len (0), ext (0), lsti (-1), lste (-1), aowner (0), orig_dims () { } @@ -381,7 +381,7 @@ idx_class_type idx_class (void) const { return class_mask; } - idx_base_rep *sort_uniq_clone (bool = false) + idx_base_rep *sort_uniq_clone (bool = false) { count++; return this; } idx_base_rep *sort_idx (Array&); @@ -398,7 +398,7 @@ Array unconvert (void) const; Array as_array (void); - + private: DECLARE_OCTAVE_ALLOCATOR @@ -422,7 +422,7 @@ // provides us the data. Note that we need a pointer because we // deferred the Array declaration and we do not want it yet to be // defined. - + Array *aowner; dim_vector orig_dims; @@ -465,27 +465,27 @@ idx_vector (void) : rep (nil_rep ()) { rep->count++; } // Zero-based constructors (for use from C++). - idx_vector (octave_idx_type i) : rep (new idx_scalar_rep (i)) + idx_vector (octave_idx_type i) : rep (new idx_scalar_rep (i)) { chkerr (); } idx_vector (octave_idx_type start, octave_idx_type limit, octave_idx_type step = 1) - : rep (new idx_range_rep (start, limit, step)) + : rep (new idx_range_rep (start, limit, step)) { chkerr (); } - static idx_vector + static idx_vector make_range (octave_idx_type start, octave_idx_type step, octave_idx_type len) { return idx_vector (new idx_range_rep (start, len, step, DIRECT)); } - idx_vector (const Array& inda) + idx_vector (const Array& inda) : rep (new idx_vector_rep (inda)) { chkerr (); } // Directly pass extent, no checking. - idx_vector (const Array& inda, octave_idx_type ext) + idx_vector (const Array& inda, octave_idx_type ext) : rep (new idx_vector_rep (inda, ext, DIRECT)) { } @@ -519,7 +519,7 @@ idx_vector (const Array& nda); - idx_vector (const Range& r) + idx_vector (const Range& r) : rep (new idx_range_rep (r)) { chkerr (); } @@ -549,22 +549,22 @@ idx_class_type idx_class (void) const { return rep->idx_class (); } - octave_idx_type length (octave_idx_type n = 0) const + octave_idx_type length (octave_idx_type n = 0) const { return rep->length (n); } - octave_idx_type extent (octave_idx_type n) const + octave_idx_type extent (octave_idx_type n) const { return rep->extent (n); } - octave_idx_type xelem (octave_idx_type n) const + octave_idx_type xelem (octave_idx_type n) const { return rep->xelem (n); } - octave_idx_type checkelem (octave_idx_type n) const + octave_idx_type checkelem (octave_idx_type n) const { return rep->checkelem (n); } - octave_idx_type operator () (octave_idx_type n) const + octave_idx_type operator () (octave_idx_type n) const { #if defined (BOUNDS_CHECKING) - return rep->checkelem (n); + return rep->checkelem (n); #else return rep->xelem (n); #endif @@ -573,10 +573,10 @@ operator bool (void) const { return ! rep->err; } - bool is_colon (void) const + bool is_colon (void) const { return rep->idx_class () == class_colon; } - bool is_scalar (void) const + bool is_scalar (void) const { return rep->idx_class () == class_scalar; } bool is_range (void) const @@ -895,7 +895,7 @@ // for (octave_idx_type i = 0; i < idx->length (n); i++) // if (body (idx(i))) break; // return i; - // + // template octave_idx_type @@ -973,7 +973,7 @@ return ret; } - // Rationale: + // Rationale: // This method is the key to "smart indexing". When indexing cartesian // arrays, sometimes consecutive index vectors can be reduced into a // single index. If rows (A) = k and i.maybe_reduce (j) gives k, then @@ -1007,7 +1007,7 @@ // Unconverts the index to a scalar, Range, double array or a mask. void unconvert (idx_class_type& iclass, - double& scalar, Range& range, + double& scalar, Range& range, Array& array, Array& mask) const; Array as_array (void) const; @@ -1017,11 +1017,11 @@ const octave_idx_type *raw (void); bool is_vector (void) const; - + // FIXME -- these are here for compatibility. They should be removed // when no longer in use. - octave_idx_type elem (octave_idx_type n) const + octave_idx_type elem (octave_idx_type n) const { return (*this) (n); } bool is_colon_equiv (octave_idx_type n, int) const @@ -1036,7 +1036,7 @@ octave_idx_type ones_count (void) const; octave_idx_type max (void) const { return extent (1) - 1; } - + private: idx_base_rep *rep; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/intNDArray.cc --- a/liboctave/intNDArray.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/intNDArray.cc Thu Jan 20 17:24:59 2011 -0500 @@ -95,7 +95,7 @@ } template -octave_idx_type +octave_idx_type intNDArray::compute_index (Array& ra_idx, const dim_vector& dimensions) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/intNDArray.h --- a/liboctave/intNDArray.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/intNDArray.h Thu Jan 20 17:24:59 2011 -0500 @@ -34,16 +34,16 @@ public: using MArray::element_type; - + intNDArray (void) : MArray () { } intNDArray (T val) : MArray (dim_vector (1, 1), val) { } intNDArray (const dim_vector& dv) : MArray (dv) { } - + intNDArray (const dim_vector& dv, T val) : MArray (dv, val) { } - + template intNDArray (const Array& a) : MArray (a) { } @@ -66,10 +66,10 @@ intNDArray diag (octave_idx_type k = 0) const; - intNDArray& changesign (void) - { - MArray::changesign (); - return *this; + intNDArray& changesign (void) + { + MArray::changesign (); + return *this; } // FIXME -- this is not quite the right thing. @@ -81,12 +81,12 @@ intNDArray max (Array& index, int dim = -1) const; intNDArray min (int dim = -1) const; intNDArray min (Array& index, int dim = -1) const; - + intNDArray cummax (int dim = -1) const; intNDArray cummax (Array& index, int dim = -1) const; intNDArray cummin (int dim = -1) const; intNDArray cummin (Array& index, int dim = -1) const; - + intNDArray sum (int dim) const; NDArray dsum (int dim) const; intNDArray cumsum (int dim) const; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/kpse.cc --- a/liboctave/kpse.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/kpse.cc Thu Jan 20 17:24:59 2011 -0500 @@ -10,7 +10,7 @@ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. +version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -66,7 +66,7 @@ #ifndef KPATHSEA #define KPATHSEA 32 #endif - + /* System dependencies that are figured out by `configure'. If we are compiling standalone, we get our c-auto.h. Otherwise, the package containing us must provide this (unless it can somehow generate ours @@ -112,10 +112,10 @@ #define IS_DIR_SEP(ch) ((ch) == DIR_SEP) #endif #ifndef IS_DEVICE_SEP /* No `devices' on, e.g., Unix. */ -#define IS_DEVICE_SEP(ch) 0 +#define IS_DEVICE_SEP(ch) 0 #endif #ifndef NAME_BEGINS_WITH_DEVICE -#define NAME_BEGINS_WITH_DEVICE(name) 0 +#define NAME_BEGINS_WITH_DEVICE(name) 0 #endif #include "lo-error.h" @@ -916,19 +916,19 @@ /* Call `kpse_expand' on NAME. If the result is an absolute or explicitly relative filename, check whether it is a readable (regular) file. - + Otherwise, look in each of the directories specified in PATH (also do tilde and variable expansion on elements in PATH), using a prebuilt db (see db.h) if it's relevant for a given path element. - + If the prebuilt db doesn't exist, or if MUST_EXIST is true and NAME isn't found in the prebuilt db, look on the filesystem. (I.e., if MUST_EXIST is false, and NAME isn't found in the db, do *not* look on the filesystem.) - + The caller must expand PATH. This is because it makes more sense to do this once, in advance, instead of for every search using it. - + In any case, return the complete filename if found, otherwise NULL. */ static std::string @@ -2387,7 +2387,7 @@ of the corresponding (existing) directory or directories, with trailing slashes, or NULL. If ELT is the empty string, check the current working directory. - + It's up to the caller to expand ELT. This is because this routine is most likely only useful to be called from `kpse_path_search', which has already assumed expansion has been done. */ diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/lo-array-gripes.cc --- a/liboctave/lo-array-gripes.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/lo-array-gripes.cc Thu Jan 20 17:24:59 2011 -0500 @@ -144,11 +144,11 @@ gripe_invalid_resize (void) { (*current_liboctave_error_with_id_handler) - ("Octave:invalid-resize", + ("Octave:invalid-resize", "Invalid resizing operation or ambiguous assignment to an out-of-bounds array element."); } -void +void gripe_invalid_assignment_size (void) { (*current_liboctave_error_handler) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/lo-array-gripes.h --- a/liboctave/lo-array-gripes.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/lo-array-gripes.h Thu Jan 20 17:24:59 2011 -0500 @@ -52,11 +52,11 @@ const dim_vector& op2_dims); extern void OCTAVE_API -gripe_index_out_of_range (int nd, int dim, +gripe_index_out_of_range (int nd, int dim, octave_idx_type iext, octave_idx_type ext); extern void OCTAVE_API -gripe_del_index_out_of_range (bool is1d, octave_idx_type iext, +gripe_del_index_out_of_range (bool is1d, octave_idx_type iext, octave_idx_type ext); extern void OCTAVE_API diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/lo-cieee.c --- a/liboctave/lo-cieee.c Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/lo-cieee.c Thu Jan 20 17:24:59 2011 -0500 @@ -112,7 +112,7 @@ #if defined (HAVE_ISNAN) lo_ieee_double t; t.value = x; - return (isnan (x) && t.word[lo_ieee_hw] == LO_IEEE_NA_HW + return (isnan (x) && t.word[lo_ieee_hw] == LO_IEEE_NA_HW && t.word[lo_ieee_lw] == LO_IEEE_NA_LW) ? 1 : 0; #else return 0; @@ -125,7 +125,7 @@ #if defined (HAVE_ISNAN) lo_ieee_double t; t.value = x; - return (isnan (x) && t.word[lo_ieee_lw] == LO_IEEE_NA_LW_OLD + return (isnan (x) && t.word[lo_ieee_lw] == LO_IEEE_NA_LW_OLD && t.word[lo_ieee_hw] == LO_IEEE_NA_HW_OLD) ? 1 : 0; #else return 0; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/lo-ieee.h --- a/liboctave/lo-ieee.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/lo-ieee.h Thu Jan 20 17:24:59 2011 -0500 @@ -68,7 +68,7 @@ #define LO_IEEE_NA_HW 0x7FF840F4 #define LO_IEEE_NA_LW 0x40000000 #define LO_IEEE_NA_FLOAT 0x7FC207A2 - + extern OCTAVE_API void octave_ieee_init (void); extern OCTAVE_API int __lo_ieee_isnan (double x); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/lo-mappers.cc --- a/liboctave/lo-mappers.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/lo-mappers.cc Thu Jan 20 17:24:59 2011 -0500 @@ -59,7 +59,7 @@ return gnulib::round (x); } -double +double xroundb (double x) { double t = xround (x); @@ -273,7 +273,7 @@ return gnulib::round (x); } -float +float xroundb (float x) { float t = xround (x); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/lo-mappers.h --- a/liboctave/lo-mappers.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/lo-mappers.h Thu Jan 20 17:24:59 2011 -0500 @@ -29,7 +29,7 @@ #include "oct-cmplx.h" #include "lo-math.h" -// Double Precision +// Double Precision extern OCTAVE_API double xtrunc (double x); inline double xcopysign (double x, double y) { return copysign (x, y); } inline double xceil (double x) { return ceil (x); } @@ -42,8 +42,8 @@ extern OCTAVE_API double xround (double x); extern OCTAVE_API double xroundb (double x); extern OCTAVE_API double signum (double x); -extern OCTAVE_API double xlog2 (double x); -extern OCTAVE_API Complex xlog2 (const Complex& x); +extern OCTAVE_API double xlog2 (double x); +extern OCTAVE_API Complex xlog2 (const Complex& x); extern OCTAVE_API double xlog2 (double x, int& exp); extern OCTAVE_API Complex xlog2 (const Complex& x, int& exp); extern OCTAVE_API double xexp2 (double x); @@ -115,7 +115,7 @@ extern OCTAVE_API Complex xmin (const Complex& x, const Complex& y); extern OCTAVE_API Complex xmax (const Complex& x, const Complex& y); -// Single Precision +// Single Precision extern OCTAVE_API float xtrunc (float x); inline float xcopysign (float x, float y) { return copysignf (x, y); } inline float xceil (float x) { return ceilf (x); } @@ -128,8 +128,8 @@ extern OCTAVE_API float xround (float x); extern OCTAVE_API float xroundb (float x); extern OCTAVE_API float signum (float x); -extern OCTAVE_API float xlog2 (float x); -extern OCTAVE_API FloatComplex xlog2 (const FloatComplex& x); +extern OCTAVE_API float xlog2 (float x); +extern OCTAVE_API FloatComplex xlog2 (const FloatComplex& x); extern OCTAVE_API float xlog2 (float x, int& exp); extern OCTAVE_API FloatComplex xlog2 (const FloatComplex& x, int& exp); extern OCTAVE_API float xexp2 (float x); @@ -214,7 +214,7 @@ return xfinite (x) && x == xround (x); } -// Test for negative sign. +// Test for negative sign. extern OCTAVE_API bool xnegative_sign (double x); extern OCTAVE_API bool xnegative_sign (float x); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/lo-specfun.cc --- a/liboctave/lo-specfun.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/lo-specfun.cc Thu Jan 20 17:24:59 2011 -0500 @@ -333,7 +333,7 @@ #if defined (HAVE_LGAMMA_R) int sgngam; - result = lgamma_r (x, &sgngam); + result = lgamma_r (x, &sgngam); #else double sgngam; @@ -398,7 +398,7 @@ #if defined (HAVE_LGAMMAF_R) int sgngam; - result = lgammaf_r (x, &sgngam); + result = lgammaf_r (x, &sgngam); #else float sgngam; @@ -431,7 +431,7 @@ // use Taylor series to calculate exp(x)-1. double t = ax; - double s = 0; + double s = 0; for (int i = 2; i < 7; i++) s += (t *= ax/i); s += ax; @@ -453,7 +453,7 @@ } #endif -Complex +Complex expm1(const Complex& x) { Complex retval; @@ -486,7 +486,7 @@ // use Taylor series to calculate exp(x)-1. float t = ax; - float s = 0; + float s = 0; for (int i = 2; i < 7; i++) s += (t *= ax/i); s += ax; @@ -508,7 +508,7 @@ } #endif -FloatComplex +FloatComplex expm1(const FloatComplex& x) { FloatComplex retval; @@ -551,7 +551,7 @@ } #endif -Complex +Complex log1p (const Complex& x) { Complex retval; @@ -610,7 +610,7 @@ } #endif -FloatComplex +FloatComplex log1p (const FloatComplex& x) { FloatComplex retval; @@ -715,7 +715,7 @@ if (kode != 2) { - double expz = exp (std::abs (zi)); + double expz = exp (std::abs (zi)); yr *= expz; yi *= expz; } @@ -730,7 +730,7 @@ // zbesy can overflow as z->0, and cause troubles for generic case below alpha = -alpha; Complex tmp = zbesj (z, alpha, kode, ierr); - if ((static_cast (alpha)) & 1) + if ((static_cast (alpha)) & 1) tmp = - tmp; retval = bessel_return_value (tmp, ierr); } @@ -800,7 +800,7 @@ // zbesy can overflow as z->0, and cause troubles for generic case below alpha = -alpha; Complex tmp = zbesj (z, alpha, kode, ierr); - if ((static_cast (alpha - 0.5)) & 1) + if ((static_cast (alpha - 0.5)) & 1) tmp = - tmp; retval = bessel_return_value (tmp, ierr); } @@ -862,13 +862,13 @@ { Complex tmp2 = (2.0 / M_PI) * sin (M_PI * alpha) * zbesk (z, alpha, kode, ierr); - - if (kode == 2) + + if (kode == 2) { // Compensate for different scaling factor of besk. tmp2 *= exp(-z - std::abs(z.real())); } - + tmp += tmp2; retval = bessel_return_value (tmp, ierr); @@ -1352,7 +1352,7 @@ // zbesy can overflow as z->0, and cause troubles for generic case below alpha = -alpha; FloatComplex tmp = cbesj (z, alpha, kode, ierr); - if ((static_cast (alpha)) & 1) + if ((static_cast (alpha)) & 1) tmp = - tmp; retval = bessel_return_value (tmp, ierr); } @@ -1415,7 +1415,7 @@ // zbesy can overflow as z->0, and cause troubles for generic case below alpha = -alpha; FloatComplex tmp = cbesj (z, alpha, kode, ierr); - if ((static_cast (alpha - 0.5)) & 1) + if ((static_cast (alpha - 0.5)) & 1) tmp = - tmp; retval = bessel_return_value (tmp, ierr); } @@ -1472,8 +1472,8 @@ { FloatComplex tmp2 = static_cast (2.0 / M_PI) * sinf (static_cast (M_PI) * alpha) * cbesk (z, alpha, kode, ierr); - - if (kode == 2) + + if (kode == 2) { // Compensate for different scaling factor of besk. tmp2 *= exp(-z - std::abs(z.real())); @@ -2259,7 +2259,7 @@ } else gripe_betainc_nonconformant (dim_vector (0, 0), dv, b.dims ()); - + return retval; } @@ -2388,7 +2388,7 @@ } else gripe_betainc_nonconformant (dv, dim_vector (0, 0), b.dims ()); - + return retval; } @@ -2409,7 +2409,7 @@ } else gripe_betainc_nonconformant (dv, a.dims (), dim_vector (0, 0)); - + return retval; } @@ -2542,7 +2542,7 @@ } else gripe_betainc_nonconformant (dim_vector (0, 0), dv, b.dims ()); - + return retval; } @@ -2671,7 +2671,7 @@ } else gripe_betainc_nonconformant (dv, dim_vector (0, 0), b.dims ()); - + return retval; } @@ -2692,7 +2692,7 @@ } else gripe_betainc_nonconformant (dv, a.dims (), dim_vector (0, 0)); - + return retval; } @@ -2902,7 +2902,7 @@ for (octave_idx_type i = 0; i < nel; i++) { result (i) = gammainc (x(i), a(i), err); - + if (err) goto done; } @@ -3107,7 +3107,7 @@ for (octave_idx_type i = 0; i < nel; i++) { result (i) = gammainc (x(i), a(i), err); - + if (err) goto done; } @@ -3152,19 +3152,19 @@ static double do_erfinv (double x, bool refine) { // Coefficients of rational approximation. - static const double a[] = + static const double a[] = { -2.806989788730439e+01, 1.562324844726888e+02, -1.951109208597547e+02, 9.783370457507161e+01, -2.168328665628878e+01, 1.772453852905383e+00 }; - static const double b[] = + static const double b[] = { -5.447609879822406e+01, 1.615858368580409e+02, -1.556989798598866e+02, 6.680131188771972e+01, -1.328068155288572e+01 }; - static const double c[] = + static const double c[] = { -5.504751339936943e-03, -2.279687217114118e-01, -1.697592457770869e+00, -1.802933168781950e+00, 3.093354679843505e+00, 2.077595676404383e+00 }; - static const double d[] = + static const double d[] = { 7.784695709041462e-03, 3.224671290700398e-01, 2.445134137142996e+00, 3.754408661907416e+00 }; @@ -3211,7 +3211,7 @@ float erfinv (float x) { - return do_erfinv (x, false); + return do_erfinv (x, false); } // Implementation based on the Fortran code by W.J.Cody @@ -3222,34 +3222,34 @@ static inline float erfc (float x) { return erfcf (x); } template -static T +static T erfcx_impl (T x) { - static const T c[] = - { + static const T c[] = + { 5.64188496988670089e-1,8.88314979438837594, 6.61191906371416295e+1,2.98635138197400131e+2, 8.81952221241769090e+2,1.71204761263407058e+3, 2.05107837782607147e+3,1.23033935479799725e+3, - 2.15311535474403846e-8 + 2.15311535474403846e-8 }; - static const T d[] = - { + static const T d[] = + { 1.57449261107098347e+1,1.17693950891312499e+2, 5.37181101862009858e+2,1.62138957456669019e+3, 3.29079923573345963e+3,4.36261909014324716e+3, 3.43936767414372164e+3,1.23033935480374942e+3 }; - static const T p[] = + static const T p[] = { 3.05326634961232344e-1,3.60344899949804439e-1, 1.25781726111229246e-1,1.60837851487422766e-2, 6.58749161529837803e-4,1.63153871373020978e-2 }; - static const T q[] = + static const T q[] = { 2.56852019228982242,1.87295284992346047, 5.27905102951428412e-1,6.05183413124413191e-2, diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/mx-defs.h --- a/liboctave/mx-defs.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/mx-defs.h Thu Jan 20 17:24:59 2011 -0500 @@ -132,7 +132,7 @@ blas_conj_trans = 'C' }; -inline char +inline char get_blas_char (blas_trans_type transt) { return static_cast (transt); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/mx-inlines.cc --- a/liboctave/mx-inlines.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/mx-inlines.cc Thu Jan 20 17:24:59 2011 -0500 @@ -114,9 +114,9 @@ // Convert to logical value, for logical op purposes. template inline bool logical_value (T x) { return x; } -template inline bool logical_value (const std::complex& x) +template inline bool logical_value (const std::complex& x) { return x.real () != 0 || x.imag () != 0; } -template inline bool logical_value (const octave_int& x) +template inline bool logical_value (const octave_int& x) { return x.value (); } template @@ -171,8 +171,8 @@ DEFMXBOOLOPEQ (mx_inline_and2, &=) DEFMXBOOLOPEQ (mx_inline_or2, |=) -template -inline bool +template +inline bool mx_inline_any_nan (size_t n, const T* x) throw () { for (size_t i = 0; i < n; i++) @@ -197,9 +197,9 @@ return true; } -template -inline bool -mx_inline_any_negative (size_t n, const T* x) throw () +template +inline bool +mx_inline_any_negative (size_t n, const T* x) throw () { for (size_t i = 0; i < n; i++) { @@ -211,7 +211,7 @@ } template -inline bool +inline bool mx_inline_all_real (size_t n, const std::complex* x) throw () { for (size_t i = 0; i < n; i++) @@ -269,10 +269,10 @@ for (size_t i = 0; i < n; i++) r[i] = (y[i] OP x) ? y[i] : x; \ } -DEFMINMAXSPEC (double, mx_inline_xmin, <=) -DEFMINMAXSPEC (double, mx_inline_xmax, >=) -DEFMINMAXSPEC (float, mx_inline_xmin, <=) -DEFMINMAXSPEC (float, mx_inline_xmax, >=) +DEFMINMAXSPEC (double, mx_inline_xmin, <=) +DEFMINMAXSPEC (double, mx_inline_xmax, >=) +DEFMINMAXSPEC (float, mx_inline_xmin, <=) +DEFMINMAXSPEC (float, mx_inline_xmax, >=) // Pairwise power #define DEFMXMAPPER2X(F, FUN) \ @@ -302,7 +302,7 @@ // a pointer, to allow the compiler reduce number of instances. template -inline Array +inline Array do_mx_unary_op (const Array& x, void (*op) (size_t, R *, const X *) throw ()) { @@ -314,14 +314,14 @@ // Shortcuts for applying mx_inline_map. template -inline Array +inline Array do_mx_unary_map (const Array& x) { return do_mx_unary_op (x, mx_inline_map); } template -inline Array +inline Array do_mx_unary_map (const Array& x) { return do_mx_unary_op (x, mx_inline_map); @@ -338,7 +338,7 @@ template -inline Array +inline Array do_mm_binary_op (const Array& x, const Array& y, void (*op) (size_t, R *, const X *, const Y *) throw (), const char *opname) @@ -358,7 +358,7 @@ } template -inline Array +inline Array do_ms_binary_op (const Array& x, const Y& y, void (*op) (size_t, R *, const X *, Y) throw ()) { @@ -368,7 +368,7 @@ } template -inline Array +inline Array do_sm_binary_op (const X& x, const Array& y, void (*op) (size_t, R *, X, const Y *) throw ()) { @@ -378,7 +378,7 @@ } template -inline Array& +inline Array& do_mm_inplace_op (Array& r, const Array& x, void (*op) (size_t, R *, const X *) throw (), const char *opname) @@ -392,7 +392,7 @@ } template -inline Array& +inline Array& do_ms_inplace_op (Array& r, const X& x, void (*op) (size_t, R *, X) throw ()) { @@ -412,7 +412,7 @@ template inline bool -do_mx_check (const Array& a, +do_mx_check (const Array& a, bool (*op) (size_t, const T *) throw ()) { return op (a.numel (), a.data ()); @@ -421,7 +421,7 @@ // NOTE: we don't use std::norm because it typically does some heavyweight // magic to avoid underflows, which we don't need here. template -inline T cabsq (const std::complex& c) +inline T cabsq (const std::complex& c) { return c.real () * c.real () + c.imag () * c.imag (); } // default. works for integers and bool. @@ -1039,7 +1039,7 @@ } template -void mx_inline_diff (const T *v, T *r, +void mx_inline_diff (const T *v, T *r, octave_idx_type m, octave_idx_type n, octave_idx_type order) { @@ -1125,7 +1125,7 @@ // calculate extent triplet. l = 1, n = dims(dim), u = 1; - for (octave_idx_type i = 0; i < dim; i++) + for (octave_idx_type i = 0; i < dim; i++) l *= dims (i); for (octave_idx_type i = dim + 1; i < ndims; i++) u *= dims (i); @@ -1139,7 +1139,7 @@ template inline Array do_mx_red_op (const Array& src, int dim, - void (*mx_red_op) (const T *, R *, octave_idx_type, + void (*mx_red_op) (const T *, R *, octave_idx_type, octave_idx_type, octave_idx_type)) { octave_idx_type l, n, u; @@ -1163,7 +1163,7 @@ template inline Array do_mx_cum_op (const Array& src, int dim, - void (*mx_cum_op) (const T *, R *, octave_idx_type, + void (*mx_cum_op) (const T *, R *, octave_idx_type, octave_idx_type, octave_idx_type)) { octave_idx_type l, n, u; @@ -1180,7 +1180,7 @@ template inline Array do_mx_minmax_op (const Array& src, int dim, - void (*mx_minmax_op) (const R *, R *, octave_idx_type, + void (*mx_minmax_op) (const R *, R *, octave_idx_type, octave_idx_type, octave_idx_type)) { octave_idx_type l, n, u; @@ -1223,7 +1223,7 @@ template inline Array do_mx_cumminmax_op (const Array& src, int dim, - void (*mx_cumminmax_op) (const R *, R *, octave_idx_type, + void (*mx_cumminmax_op) (const R *, R *, octave_idx_type, octave_idx_type, octave_idx_type)) { octave_idx_type l, n, u; @@ -1294,7 +1294,7 @@ // SIAM J. Sci. Computing, Vol. 26, 2005 template -inline void twosum_accum (T& s, T& e, +inline void twosum_accum (T& s, T& e, const T& x) { T s1 = s + x, t = s1 - s, e1 = (s - (s1 - t)) + (x - t); @@ -1304,7 +1304,7 @@ template inline T -mx_inline_xsum (const T *v, octave_idx_type n) +mx_inline_xsum (const T *v, octave_idx_type n) { T s = 0, e = 0; for (octave_idx_type i = 0; i < n; i++) @@ -1315,7 +1315,7 @@ template inline void -mx_inline_xsum (const T *v, T *r, +mx_inline_xsum (const T *v, T *r, octave_idx_type m, octave_idx_type n) { OCTAVE_LOCAL_BUFFER (T, e, m); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-binmap.h --- a/liboctave/oct-binmap.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-binmap.h Thu Jan 20 17:24:59 2011 -0500 @@ -36,7 +36,7 @@ // Sparse-Sparse // Sparse-scalar // scalar-Sparse -// +// // If both operands are nonscalar, name must be supplied. It is used as the base for error message // when operands are nonconforming. // diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-convn.cc --- a/liboctave/oct-convn.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-convn.cc Thu Jan 20 17:24:59 2011 -0500 @@ -34,7 +34,7 @@ // 2d convolution with a matrix kernel. template -static void +static void convolve_2d (const T *a, octave_idx_type ma, octave_idx_type na, const R *b, octave_idx_type mb, octave_idx_type nb, T *c, bool inner); @@ -101,7 +101,7 @@ } } -// Arbitrary convolutor. +// Arbitrary convolutor. // The 2nd array is assumed to be the smaller one. template static MArray diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-env.cc --- a/liboctave/oct-env.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-env.cc Thu Jan 20 17:24:59 2011 -0500 @@ -34,7 +34,7 @@ octave_env::do_polite_directory_format octave_env::pathname_backup -*/ +*/ #ifdef HAVE_CONFIG_H #include diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-fftw.cc --- a/liboctave/oct-fftw.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-fftw.cc Thu Jan 20 17:24:59 2011 -0500 @@ -64,7 +64,7 @@ simd_align[0] = simd_align[1] = false; inplace[0] = inplace[1] = false; n[0] = n[1] = dim_vector (); - + // If we have a system wide wisdom file, import it. fftw_import_system_wisdom (); } @@ -96,7 +96,7 @@ const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, - octave_idx_type dist, + octave_idx_type dist, const Complex *in, Complex *out) { int which = (dir == FFTW_FORWARD) ? 0 : 1; @@ -110,7 +110,7 @@ // change the alignment. if (plan[which] == 0 || d[which] != dist || s[which] != stride - || r[which] != rank || h[which] != howmany + || r[which] != rank || h[which] != howmany || ioinplace != inplace[which] || ((ioalign != simd_align[which]) ? !ioalign : false)) create_new_plan = true; @@ -149,7 +149,7 @@ int plan_flags = 0; bool plan_destroys_in = true; - switch (meth) + switch (meth) { case UNKNOWN: case ESTIMATE: @@ -189,7 +189,7 @@ // Create matrix with the same size and 16-byte alignment as input OCTAVE_LOCAL_BUFFER (Complex, itmp, nn * howmany + 32); itmp = reinterpret_cast - (((reinterpret_cast(itmp) + 15) & ~ 0xF) + + (((reinterpret_cast(itmp) + 15) & ~ 0xF) + ((reinterpret_cast (in)) & 0xF)); *cur_plan_p = @@ -213,12 +213,12 @@ return *cur_plan_p; } - + fftw_plan -octave_fftw_planner::do_create_plan (const int rank, const dim_vector dims, +octave_fftw_planner::do_create_plan (const int rank, const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, - octave_idx_type dist, + octave_idx_type dist, const double *in, Complex *out) { fftw_plan *cur_plan_p = &rplan; @@ -266,7 +266,7 @@ int plan_flags = 0; bool plan_destroys_in = true; - switch (meth) + switch (meth) { case UNKNOWN: case ESTIMATE: @@ -306,7 +306,7 @@ // Create matrix with the same size and 16-byte alignment as input OCTAVE_LOCAL_BUFFER (double, itmp, nn + 32); itmp = reinterpret_cast - (((reinterpret_cast(itmp) + 15) & ~ 0xF) + + (((reinterpret_cast(itmp) + 15) & ~ 0xF) + ((reinterpret_cast (in)) & 0xF)); *cur_plan_p = @@ -344,7 +344,7 @@ || _meth == PATIENT || _meth == EXHAUSTIVE || _meth == HYBRID) { - if (meth != _meth) + if (meth != _meth) { meth = _meth; if (rplan) @@ -372,7 +372,7 @@ simd_align[0] = simd_align[1] = false; inplace[0] = inplace[1] = false; n[0] = n[1] = dim_vector (); - + // If we have a system wide wisdom file, import it. fftwf_import_system_wisdom (); } @@ -401,7 +401,7 @@ const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, - octave_idx_type dist, + octave_idx_type dist, const FloatComplex *in, FloatComplex *out) { @@ -416,7 +416,7 @@ // change the alignment. if (plan[which] == 0 || d[which] != dist || s[which] != stride - || r[which] != rank || h[which] != howmany + || r[which] != rank || h[which] != howmany || ioinplace != inplace[which] || ((ioalign != simd_align[which]) ? !ioalign : false)) create_new_plan = true; @@ -455,7 +455,7 @@ int plan_flags = 0; bool plan_destroys_in = true; - switch (meth) + switch (meth) { case UNKNOWN: case ESTIMATE: @@ -495,7 +495,7 @@ // Create matrix with the same size and 16-byte alignment as input OCTAVE_LOCAL_BUFFER (FloatComplex, itmp, nn * howmany + 32); itmp = reinterpret_cast - (((reinterpret_cast(itmp) + 15) & ~ 0xF) + + (((reinterpret_cast(itmp) + 15) & ~ 0xF) + ((reinterpret_cast (in)) & 0xF)); *cur_plan_p = @@ -519,13 +519,13 @@ return *cur_plan_p; } - + fftwf_plan octave_float_fftw_planner::do_create_plan (const int rank, - const dim_vector dims, + const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, - octave_idx_type dist, + octave_idx_type dist, const float *in, FloatComplex *out) { fftwf_plan *cur_plan_p = &rplan; @@ -573,7 +573,7 @@ int plan_flags = 0; bool plan_destroys_in = true; - switch (meth) + switch (meth) { case UNKNOWN: case ESTIMATE: @@ -613,7 +613,7 @@ // Create matrix with the same size and 16-byte alignment as input OCTAVE_LOCAL_BUFFER (float, itmp, nn + 32); itmp = reinterpret_cast - (((reinterpret_cast(itmp) + 15) & ~ 0xF) + + (((reinterpret_cast(itmp) + 15) & ~ 0xF) + ((reinterpret_cast (in)) & 0xF)); *cur_plan_p = @@ -651,7 +651,7 @@ || _meth == PATIENT || _meth == EXHAUSTIVE || _meth == HYBRID) { - if (meth != _meth) + if (meth != _meth) { meth = _meth; if (rplan) @@ -728,11 +728,11 @@ size_t kstep = dv(0); size_t nel = dv.numel (); - for (int inner = 2; inner < dv.length (); inner++) + for (int inner = 2; inner < dv.length (); inner++) { size_t jmax = jstart * dv(inner); for (size_t i = 0; i < nel; i+=jmax) - for (size_t j = jstart, jj = jmax-jstart; j < jj; + for (size_t j = jstart, jj = jmax-jstart; j < jj; j+=jstart, jj-=jstart) for (size_t k = 0; k < jstart; k+= kstep) for (size_t l = nc/2+1; l < nc; l++) @@ -748,7 +748,7 @@ } int -octave_fftw::fft (const double *in, Complex *out, size_t npts, +octave_fftw::fft (const double *in, Complex *out, size_t npts, size_t nsamples, octave_idx_type stride, octave_idx_type dist) { dist = (dist < 0 ? npts : dist); @@ -768,7 +768,7 @@ } int -octave_fftw::fft (const Complex *in, Complex *out, size_t npts, +octave_fftw::fft (const Complex *in, Complex *out, size_t npts, size_t nsamples, octave_idx_type stride, octave_idx_type dist) { dist = (dist < 0 ? npts : dist); @@ -778,7 +778,7 @@ nsamples, stride, dist, in, out); - fftw_execute_dft (plan, + fftw_execute_dft (plan, reinterpret_cast (const_cast(in)), reinterpret_cast (out)); @@ -786,7 +786,7 @@ } int -octave_fftw::ifft (const Complex *in, Complex *out, size_t npts, +octave_fftw::ifft (const Complex *in, Complex *out, size_t npts, size_t nsamples, octave_idx_type stride, octave_idx_type dist) { dist = (dist < 0 ? npts : dist); @@ -796,7 +796,7 @@ nsamples, stride, dist, in, out); - fftw_execute_dft (plan, + fftw_execute_dft (plan, reinterpret_cast (const_cast(in)), reinterpret_cast (out)); @@ -809,7 +809,7 @@ } int -octave_fftw::fftNd (const double *in, Complex *out, const int rank, +octave_fftw::fftNd (const double *in, Complex *out, const int rank, const dim_vector &dv) { octave_idx_type dist = 1; @@ -819,8 +819,8 @@ // Fool with the position of the start of the output matrix, so that // creating other half of the matrix won't cause cache problems. - octave_idx_type offset = (dv.numel () / dv(0)) * ((dv(0) - 1) / 2); - + octave_idx_type offset = (dv.numel () / dv(0)) * ((dv(0) - 1) / 2); + fftw_plan plan = octave_fftw_planner::create_plan (rank, dv, 1, 1, dist, in, out + offset); @@ -835,7 +835,7 @@ } int -octave_fftw::fftNd (const Complex *in, Complex *out, const int rank, +octave_fftw::fftNd (const Complex *in, Complex *out, const int rank, const dim_vector &dv) { octave_idx_type dist = 1; @@ -845,7 +845,7 @@ fftw_plan plan = octave_fftw_planner::create_plan (FFTW_FORWARD, rank, dv, 1, 1, dist, in, out); - fftw_execute_dft (plan, + fftw_execute_dft (plan, reinterpret_cast (const_cast(in)), reinterpret_cast (out)); @@ -853,7 +853,7 @@ } int -octave_fftw::ifftNd (const Complex *in, Complex *out, const int rank, +octave_fftw::ifftNd (const Complex *in, Complex *out, const int rank, const dim_vector &dv) { octave_idx_type dist = 1; @@ -863,7 +863,7 @@ fftw_plan plan = octave_fftw_planner::create_plan (FFTW_BACKWARD, rank, dv, 1, 1, dist, in, out); - fftw_execute_dft (plan, + fftw_execute_dft (plan, reinterpret_cast (const_cast(in)), reinterpret_cast (out)); @@ -876,7 +876,7 @@ } int -octave_fftw::fft (const float *in, FloatComplex *out, size_t npts, +octave_fftw::fft (const float *in, FloatComplex *out, size_t npts, size_t nsamples, octave_idx_type stride, octave_idx_type dist) { dist = (dist < 0 ? npts : dist); @@ -897,7 +897,7 @@ } int -octave_fftw::fft (const FloatComplex *in, FloatComplex *out, size_t npts, +octave_fftw::fft (const FloatComplex *in, FloatComplex *out, size_t npts, size_t nsamples, octave_idx_type stride, octave_idx_type dist) { dist = (dist < 0 ? npts : dist); @@ -908,7 +908,7 @@ stride, dist, in, out); - fftwf_execute_dft (plan, + fftwf_execute_dft (plan, reinterpret_cast (const_cast(in)), reinterpret_cast (out)); @@ -916,7 +916,7 @@ } int -octave_fftw::ifft (const FloatComplex *in, FloatComplex *out, size_t npts, +octave_fftw::ifft (const FloatComplex *in, FloatComplex *out, size_t npts, size_t nsamples, octave_idx_type stride, octave_idx_type dist) { dist = (dist < 0 ? npts : dist); @@ -927,7 +927,7 @@ stride, dist, in, out); - fftwf_execute_dft (plan, + fftwf_execute_dft (plan, reinterpret_cast (const_cast(in)), reinterpret_cast (out)); @@ -940,7 +940,7 @@ } int -octave_fftw::fftNd (const float *in, FloatComplex *out, const int rank, +octave_fftw::fftNd (const float *in, FloatComplex *out, const int rank, const dim_vector &dv) { octave_idx_type dist = 1; @@ -950,8 +950,8 @@ // Fool with the position of the start of the output matrix, so that // creating other half of the matrix won't cause cache problems. - octave_idx_type offset = (dv.numel () / dv(0)) * ((dv(0) - 1) / 2); - + octave_idx_type offset = (dv.numel () / dv(0)) * ((dv(0) - 1) / 2); + fftwf_plan plan = octave_float_fftw_planner::create_plan (rank, dv, 1, 1, dist, in, out + offset); @@ -967,7 +967,7 @@ } int -octave_fftw::fftNd (const FloatComplex *in, FloatComplex *out, const int rank, +octave_fftw::fftNd (const FloatComplex *in, FloatComplex *out, const int rank, const dim_vector &dv) { octave_idx_type dist = 1; @@ -978,7 +978,7 @@ rank, dv, 1, 1, dist, in, out); - fftwf_execute_dft (plan, + fftwf_execute_dft (plan, reinterpret_cast (const_cast(in)), reinterpret_cast (out)); @@ -986,7 +986,7 @@ } int -octave_fftw::ifftNd (const FloatComplex *in, FloatComplex *out, const int rank, +octave_fftw::ifftNd (const FloatComplex *in, FloatComplex *out, const int rank, const dim_vector &dv) { octave_idx_type dist = 1; @@ -997,7 +997,7 @@ rank, dv, 1, 1, dist, in, out); - fftwf_execute_dft (plan, + fftwf_execute_dft (plan, reinterpret_cast (const_cast(in)), reinterpret_cast (out)); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-fftw.h --- a/liboctave/oct-fftw.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-fftw.h Thu Jan 20 17:24:59 2011 -0500 @@ -59,7 +59,7 @@ static bool instance_ok (void); static fftw_plan - create_plan (int dir, const int rank, const dim_vector dims, + create_plan (int dir, const int rank, const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, const Complex *in, Complex *out) @@ -73,7 +73,7 @@ } static fftw_plan - create_plan (const int rank, const dim_vector dims, + create_plan (const int rank, const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, const double *in, Complex *out) { @@ -103,13 +103,13 @@ static octave_fftw_planner *instance; fftw_plan - do_create_plan (int dir, const int rank, const dim_vector dims, + do_create_plan (int dir, const int rank, const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, const Complex *in, Complex *out); fftw_plan - do_create_plan (const int rank, const dim_vector dims, + do_create_plan (const int rank, const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, const double *in, Complex *out); @@ -186,9 +186,9 @@ }; static bool instance_ok (void); - + static fftwf_plan - create_plan (int dir, const int rank, const dim_vector dims, + create_plan (int dir, const int rank, const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, const FloatComplex *in, FloatComplex *out) @@ -202,7 +202,7 @@ } static fftwf_plan - create_plan (const int rank, const dim_vector dims, + create_plan (const int rank, const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, const float *in, FloatComplex *out) { @@ -232,13 +232,13 @@ static octave_float_fftw_planner *instance; fftwf_plan - do_create_plan (int dir, const int rank, const dim_vector dims, + do_create_plan (int dir, const int rank, const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, const FloatComplex *in, FloatComplex *out); fftwf_plan - do_create_plan (const int rank, const dim_vector dims, + do_create_plan (const int rank, const dim_vector dims, octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, const float *in, FloatComplex *out); @@ -298,30 +298,30 @@ { public: - static int fft (const double *in, Complex *out, size_t npts, + static int fft (const double *in, Complex *out, size_t npts, size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); - static int fft (const Complex *in, Complex *out, size_t npts, + static int fft (const Complex *in, Complex *out, size_t npts, size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); static int ifft (const Complex *in, Complex *out, size_t npts, size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); static int fftNd (const double*, Complex*, const int, const dim_vector &); - static int fftNd (const Complex*, Complex*, const int, + static int fftNd (const Complex*, Complex*, const int, const dim_vector &); - static int ifftNd (const Complex*, Complex*, const int, + static int ifftNd (const Complex*, Complex*, const int, const dim_vector &); - static int fft (const float *in, FloatComplex *out, size_t npts, + static int fft (const float *in, FloatComplex *out, size_t npts, size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); - static int fft (const FloatComplex *in, FloatComplex *out, size_t npts, + static int fft (const FloatComplex *in, FloatComplex *out, size_t npts, size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); static int ifft (const FloatComplex *in, FloatComplex *out, size_t npts, size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); static int fftNd (const float*, FloatComplex*, const int, const dim_vector &); - static int fftNd (const FloatComplex*, FloatComplex*, const int, + static int fftNd (const FloatComplex*, FloatComplex*, const int, const dim_vector &); - static int ifftNd (const FloatComplex*, FloatComplex*, const int, + static int ifftNd (const FloatComplex*, FloatComplex*, const int, const dim_vector &); private: diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-glob.cc --- a/liboctave/oct-glob.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-glob.cc Thu Jan 20 17:24:59 2011 -0500 @@ -80,11 +80,11 @@ glob_t glob_info; #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \ - && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) - std::replace_if (xpat.begin (), xpat.end (), - std::bind2nd (std::equal_to (), '\\'), - '/'); -#endif + && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) + std::replace_if (xpat.begin (), xpat.end (), + std::bind2nd (std::equal_to (), '\\'), + '/'); +#endif int err = gnulib::glob (xpat.c_str (), GLOB_NOSORT, 0, &glob_info); @@ -106,19 +106,19 @@ retval.resize (k+n); for (int j = 0; j < n; j++) - { - std::string tmp = matches[j]; + { + std::string tmp = matches[j]; #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \ - && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) - std::replace_if (tmp.begin (), tmp.end (), - std::bind2nd (std::equal_to (), - '/'), - '\\'); -#endif + && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) + std::replace_if (tmp.begin (), tmp.end (), + std::bind2nd (std::equal_to (), + '/'), + '\\'); +#endif - retval[k++] = tmp; - } + retval[k++] = tmp; + } } gnulib::globfree (&glob_info); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-group.h --- a/liboctave/oct-group.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-group.h Thu Jan 20 17:24:59 2011 -0500 @@ -41,7 +41,7 @@ octave_group (const octave_group& gr) : gr_name (gr.gr_name), gr_passwd (gr.gr_passwd), - gr_gid (gr.gr_gid), gr_mem (gr.gr_mem), valid (gr.valid) + gr_gid (gr.gr_gid), gr_mem (gr.gr_mem), valid (gr.valid) { } octave_group& operator = (const octave_group& gr) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-inttypes.cc --- a/liboctave/oct-inttypes.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-inttypes.cc Thu Jan 20 17:24:59 2011 -0500 @@ -1,7 +1,7 @@ /* Copyright (C) 2004-2011 John W. Eaton -Copyright (C) 2008-2009 Jaroslav Hajek +Copyright (C) 2008-2009 Jaroslav Hajek This file is part of Octave. @@ -35,7 +35,7 @@ template const octave_int octave_int::one (static_cast (1)); -// define type names. +// define type names. #define DECLARE_OCTAVE_INT_TYPENAME(TYPE, TYPENAME) \ template <> \ OCTAVE_API const char * \ @@ -54,8 +54,8 @@ // Define comparison operators -template -bool +template +bool octave_int_cmp_op::emulate_mop (uint64_t x, double y) { static const double xxup = std::numeric_limits::max (); @@ -74,8 +74,8 @@ } } -template -bool +template +bool octave_int_cmp_op::emulate_mop (int64_t x, double y) { static const double xxup = std::numeric_limits::max (); @@ -121,16 +121,16 @@ DEFINE_REVERTED_OPERATOR(le,ge); DEFINE_REVERTED_OPERATOR(ge,le); -template -bool +template +bool octave_int_cmp_op::emulate_mop (double x, uint64_t y) { typedef typename rev_op::op rop; return mop (y, x); } -template -bool +template +bool octave_int_cmp_op::emulate_mop (double x, int64_t y) { typedef typename rev_op::op rop; @@ -141,20 +141,20 @@ // Define handlers for int64 multiplication template <> -uint64_t +uint64_t octave_int_arith_base::mul (uint64_t x, uint64_t y) -{ +{ // Get upper words uint64_t ux = x >> 32, uy = y >> 32; uint64_t res; if (ux) { - if (uy) + if (uy) goto overflow; else { uint64_t ly = static_cast (y), uxly = ux*ly; - if (uxly >> 32) + if (uxly >> 32) goto overflow; uxly <<= 32; // never overflows uint64_t lx = static_cast (x), lxly = lx*ly; @@ -164,7 +164,7 @@ else if (uy) { uint64_t lx = static_cast (x), uylx = uy*lx; - if (uylx >> 32) + if (uylx >> 32) goto overflow; uylx <<= 32; // never overflows uint64_t ly = static_cast (y), lylx = ly*lx; @@ -184,13 +184,13 @@ } template <> -int64_t +int64_t octave_int_arith_base::mul (int64_t x, int64_t y) -{ +{ // The signed case is far worse. The problem is that // even if neither integer fits into signed 32-bit range, the result may // still be OK. Uh oh. - + // Essentially, what we do is compute sign, multiply absolute values // (as above) and impose the sign. // FIXME -- can we do something faster if we HAVE_FAST_INT_OPS? @@ -203,12 +203,12 @@ uint64_t res; if (ux) { - if (uy) + if (uy) goto overflow; else { uint64_t ly = static_cast (usy), uxly = ux*ly; - if (uxly >> 32) + if (uxly >> 32) goto overflow; uxly <<= 32; // never overflows uint64_t lx = static_cast (usx), lxly = lx*ly; @@ -220,7 +220,7 @@ else if (uy) { uint64_t lx = static_cast (usx), uylx = uy*lx; - if (uylx >> 32) + if (uylx >> 32) goto overflow; uylx <<= 32; // never overflows uint64_t ly = static_cast (usy), lylx = ly*lx; @@ -292,14 +292,14 @@ // what we do is to try to convert y/2 and add it twice. Note that if y/2 // overflows, the result must overflow as well, and that y/2 cannot be a // fractional number. - octave_int64 y2 (y / 2); + octave_int64 y2 (y / 2); return (x + y2) + y2; } } DOUBLE_INT_BINOP_DECL (+, int64) -{ - return y + x; +{ + return y + x; } INT_DOUBLE_BINOP_DECL (-, uint64) @@ -310,10 +310,10 @@ DOUBLE_INT_BINOP_DECL (-, uint64) { if (x <= static_cast (octave_uint64::max ())) - return octave_uint64(x) - y; + return octave_uint64(x) - y; else { - // Again a trick to get the corner cases right. Things like + // Again a trick to get the corner cases right. Things like // 3**2**63 - intmax('uint64') should produce the correct result, i.e. // int64(2**63) + 1. const double p2_64 = std::pow (2.0, 64); @@ -334,7 +334,7 @@ DOUBLE_INT_BINOP_DECL (-, int64) { - static const bool twosc = (std::numeric_limits::min () + static const bool twosc = (std::numeric_limits::min () < -std::numeric_limits::max ()); // In case of symmetric integers (not two's complement), this will probably // be eliminated at compile time. @@ -343,7 +343,7 @@ return octave_int64 (x + std::pow(2.0, 63)); } else - return x + (-y); + return x + (-y); } // NOTE: @@ -357,7 +357,7 @@ // Multiplies two unsigned 64-bit ints to get a 128-bit number represented // as four 32-bit words. -static void +static void umul128 (uint64_t x, uint64_t y, uint32_t w[4]) { uint64_t lx = static_cast (x), ux = x >> 32; @@ -375,7 +375,7 @@ } // Splits a double into bool sign, unsigned 64-bit mantissa and int exponent -static void +static void dblesplit (double x, bool& sign, uint64_t& mtis, int& exp) { sign = x < 0; x = fabs (x); @@ -405,7 +405,7 @@ } else if (y < 0 || xisnan (y) || xisinf (y)) { - return octave_uint64 (x.value () * y); + return octave_uint64 (x.value () * y); } else { @@ -420,7 +420,7 @@ { res += octave_uint64 (dbleget (sign, w[i], e)); e += 32; - } + } return res; } } @@ -440,7 +440,7 @@ } else if (xisnan (y) || xisinf (y)) { - return octave_int64 (x.value () * y); + return octave_int64 (x.value () * y); } else { @@ -456,7 +456,7 @@ { res += octave_int64 (dbleget (sign, w[i], e)); e += 32; - } + } return res; } } @@ -570,10 +570,10 @@ template octave_int pow (const octave_int& a, const double& b) -{ +{ return ((b >= 0 && b < std::numeric_limits::digits && b == xround (b)) ? pow (a, octave_int (static_cast (b))) - : octave_int (pow (a.double_value (), b))); + : octave_int (pow (a.double_value (), b))); } template @@ -587,7 +587,7 @@ { return ((b >= 0 && b < std::numeric_limits::digits && b == xround (b)) ? pow (a, octave_int (static_cast (b))) - : octave_int (pow (a.double_value (), static_cast (b)))); + : octave_int (pow (a.double_value (), static_cast (b)))); } #define INSTANTIATE_INTTYPE(T) \ diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-inttypes.h --- a/liboctave/oct-inttypes.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-inttypes.h Thu Jan 20 17:24:59 2011 -0500 @@ -51,7 +51,7 @@ { public: static const bool registered = false; - typedef void type; // Void shall result in a compile-time error if we + typedef void type; // Void shall result in a compile-time error if we // attempt to use it in computations. }; @@ -76,7 +76,7 @@ // Rationale: Comparators have a single static method, rel(), that returns the // result of the binary relation. They also have two static boolean fields: -// ltval, gtval determine the value of x OP y if x < y, x > y, respectively. +// ltval, gtval determine the value of x OP y if x < y, x > y, respectively. #define REGISTER_OCTAVE_CMP_OP(NM,OP) \ class NM \ { \ @@ -109,14 +109,14 @@ class prom { // Promote to int? - static const bool pint = (sizeof (T1) < sizeof (int) + static const bool pint = (sizeof (T1) < sizeof (int) && sizeof (T2) < sizeof (int)); static const bool t1sig = std::numeric_limits::is_signed; static const bool t2sig = std::numeric_limits::is_signed; - static const bool psig = + static const bool psig = (pint || (sizeof (T2) > sizeof (T1) && t2sig) || t1sig); static const int psize = - (pint ? sizeof (int) : (sizeof (T2) > sizeof (T1) + (pint ? sizeof (int) : (sizeof (T2) > sizeof (T1) ? sizeof (T2) : sizeof (T1))); public: typedef typename query_integer_type::type type; @@ -130,13 +130,13 @@ typedef typename query_integer_type::type utype; typedef typename query_integer_type::type stype; public: - static bool op (utype x, utype y) + static bool op (utype x, utype y) { return xop::op (x, y); } - static bool op (stype x, stype y) + static bool op (stype x, stype y) { return xop::op (x, y); } - static bool op (stype x, utype y) + static bool op (stype x, utype y) { return (x < 0) ? xop::ltval : xop::op (static_cast (x), y); } - static bool op (utype x, stype y) + static bool op (utype x, stype y) { return (y < 0) ? xop::gtval : xop::op (x, static_cast (y)); } }; @@ -157,10 +157,10 @@ { typedef typename prom::type PT1; typedef typename prom::type PT2; - return uiop::op (static_cast (x), + return uiop::op (static_cast (x), static_cast (y)); } - + public: // Mixed comparisons @@ -185,7 +185,7 @@ return xop::op (static_cast (x), \ static_cast (y)); \ } -#else +#else // ... otherwise, use external handlers // FIXME: We could declare directly the mop methods as external, @@ -211,7 +211,7 @@ }; // Base integer class. No data, just conversion methods and exception flags. -template +template class octave_int_base { protected: @@ -223,17 +223,17 @@ // Convert integer value. template - static T + static T truncate_int (const S& value) - { + { // An exhaustive test whether the max and/or min check can be omitted. static const bool t_is_signed = std::numeric_limits::is_signed; static const bool s_is_signed = std::numeric_limits::is_signed; static const int t_size = sizeof (T), s_size = sizeof (S); - static const bool omit_chk_min = + static const bool omit_chk_min = (! s_is_signed || (t_is_signed && t_size >= s_size)); - static const bool omit_chk_max = - (t_size > s_size || (t_size == s_size + static const bool omit_chk_max = + (t_size > s_size || (t_size == s_size && (! t_is_signed || s_is_signed))); // If the check can be omitted, substitute constant false relation. typedef octave_int_cmp_op::cf cf; @@ -258,23 +258,23 @@ private: - // Computes a real-valued threshold for a max/min check. + // Computes a real-valued threshold for a max/min check. template - static S + static S compute_threshold (S val, T orig_val) - { + { val = xround (val); // Fool optimizations (maybe redundant) // If val is even, but orig_val is odd, we're one unit off. if (orig_val % 2 && val / 2 == xround (val / 2)) // FIXME -- is this always correct? - val *= (static_cast(1) - (std::numeric_limits::epsilon () / 2)); + val *= (static_cast(1) - (std::numeric_limits::epsilon () / 2)); return val; } - + public: // Convert a real number (check NaN and non-int). template - static T + static T convert_real (const S& value) { // Compute proper thresholds. @@ -337,7 +337,7 @@ // the overflow behaviour for unsigned integers is guaranteed by C/C++, // so the following should always work. - static T + static T add (T x, T y) { T u = x + y; @@ -348,7 +348,7 @@ return u; } - static T + static T sub (T x, T y) { T u = x - y; @@ -360,19 +360,19 @@ } // Multiplication is done using promotion to wider integer type. If there is - // no suitable promotion type, this operation *MUST* be specialized. - static T + // no suitable promotion type, this operation *MUST* be specialized. + static T mul (T x, T y) { // Promotion type for multiplication (if exists). typedef typename query_integer_type<2*sizeof (T), false>::type mptype; - return truncate_int (static_cast (x) + return truncate_int (static_cast (x) * static_cast (y)); } // Division with rounding to nearest. Note that / and % are probably // computed by a single instruction. - static T + static T div (T x, T y) { if (y != 0) @@ -419,7 +419,7 @@ #else // Special handler for 64-bit integer multiply. template <> -OCTAVE_API uint64_t +OCTAVE_API uint64_t octave_int_arith_base::mul (uint64_t, uint64_t); #endif @@ -440,7 +440,7 @@ // HAVE_FAST_INT_OPS is defined, bit tricks and wraparound arithmetics are used // to avoid conditional jumps as much as possible, thus being friendly to modern // pipeline processor architectures. -// Otherwise, we fall back to a bullet-proof code that only uses assumptions +// Otherwise, we fall back to a bullet-proof code that only uses assumptions // guaranteed by the standard. template @@ -452,12 +452,12 @@ // Returns 1 for negative number, 0 otherwise. static T - signbit (T x) - { + signbit (T x) + { #ifdef HAVE_FAST_INT_OPS return static_cast (x) >> std::numeric_limits::digits; #else - return (x < 0) ? 1 : 0; + return (x < 0) ? 1 : 0; #endif } @@ -470,7 +470,7 @@ // discard the following test. T m = x >> std::numeric_limits::digits; T y = (x ^ m) - m; - if (y < 0) + if (y < 0) { y = octave_int_base::max_val (); } @@ -493,10 +493,10 @@ } static T - signum (T x) - { + signum (T x) + { // With modest optimizations, this will compile without a jump. - return ((x > 0) ? 1 : 0) - signbit (x); + return ((x > 0) ? 1 : 0) - signbit (x); } // FIXME -- we do not have an authority what signed shifts should @@ -533,7 +533,7 @@ #endif } - static T + static T add (T x, T y) { #ifdef HAVE_FAST_INT_OPS @@ -541,8 +541,8 @@ // compiler from interfering. Also, the signed operations on small types // actually return int. T u = static_cast (x) + static_cast (y); - T ux = u ^ x, uy = u ^ y; - if ((ux & uy) < 0) + T ux = u ^ x, uy = u ^ y; + if ((ux & uy) < 0) { u = octave_int_base::max_val () + signbit (~u); } @@ -574,7 +574,7 @@ } // This is very similar to addition. - static T + static T sub (T x, T y) { #ifdef HAVE_FAST_INT_OPS @@ -582,8 +582,8 @@ // compiler from interfering. Also, the signed operations on small types // actually return int. T u = static_cast (x) - static_cast (y); - T ux = u ^ x, uy = u ^ ~y; - if ((ux & uy) < 0) + T ux = u ^ x, uy = u ^ ~y; + if ((ux & uy) < 0) { u = octave_int_base::max_val () + signbit (~u); } @@ -615,18 +615,18 @@ } // Multiplication is done using promotion to wider integer type. If there is - // no suitable promotion type, this operation *MUST* be specialized. - static T + // no suitable promotion type, this operation *MUST* be specialized. + static T mul (T x, T y) { // Promotion type for multiplication (if exists). typedef typename query_integer_type<2*sizeof (T), true>::type mptype; - return truncate_int (static_cast (x) + return truncate_int (static_cast (x) * static_cast (y)); } // Division. - static T + static T div (T x, T y) { T z; @@ -650,7 +650,7 @@ { z = x / y; T w = -octave_int_abs (x % y); // Can't overflow, but std::abs (x) can! - if (w <= y - w) + if (w <= y - w) z -= 1 - (signbit (x) << 1); } } @@ -662,7 +662,7 @@ // overflow, but std::abs (x) can! T w = octave_int_abs (x % y); - if (w >= y - w) + if (w >= y - w) z += 1 - (signbit (x) << 1); } return z; @@ -713,13 +713,13 @@ #else // Special handler for 64-bit integer multiply. template <> -OCTAVE_API int64_t +OCTAVE_API int64_t octave_int_arith_base::mul (int64_t, int64_t); #endif // This class simply selects the proper arithmetics. template -class octave_int_arith +class octave_int_arith : public octave_int_arith_base::is_signed> {}; @@ -734,12 +734,12 @@ octave_int (T i) : ival (i) { } - octave_int (double d) : ival (octave_int_base::convert_real (d)) { } + octave_int (double d) : ival (octave_int_base::convert_real (d)) { } - octave_int (float d) : ival (octave_int_base::convert_real (d)) { } + octave_int (float d) : ival (octave_int_base::convert_real (d)) { } #ifdef OCTAVE_INT_USE_LONG_DOUBLE - octave_int (long double d) : ival (octave_int_base::convert_real (d)) { } + octave_int (long double d) : ival (octave_int_base::convert_real (d)) { } #endif octave_int (bool b) : ival (b) { } @@ -831,7 +831,7 @@ // The following are provided for convenience. static const octave_int zero, one; - + // Unsafe. This function exists to support the MEX interface. // You should not use it anywhere else. void *mex_get_data (void) const { return const_cast (&ival); } @@ -1074,7 +1074,7 @@ xmax (const octave_int& x, const octave_int& y) { const T xv = x.value (), yv = y.value (); - return octave_int (xv >= yv ? xv : yv); + return octave_int (xv >= yv ? xv : yv); } template @@ -1082,7 +1082,7 @@ xmin (const octave_int& x, const octave_int& y) { const T xv = x.value (), yv = y.value (); - return octave_int (xv <= yv ? xv : yv); + return octave_int (xv <= yv ? xv : yv); } #endif diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-locbuf.cc --- a/liboctave/oct-locbuf.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-locbuf.cc Thu Jan 20 17:24:59 2011 -0500 @@ -34,18 +34,18 @@ #define OCTAVE_LOCBUF_CHUNKSIZE_MB 32 #endif -// Each chunk will be at least this big. -const size_t octave_chunk_buffer::chunk_size = +// Each chunk will be at least this big. +const size_t octave_chunk_buffer::chunk_size = static_cast (OCTAVE_LOCBUF_CHUNKSIZE_MB) << 20; char *octave_chunk_buffer::top = 0, *octave_chunk_buffer::chunk = 0; size_t octave_chunk_buffer::left = 0; -octave_chunk_buffer::octave_chunk_buffer (size_t size) : cnk (0), dat (0) +octave_chunk_buffer::octave_chunk_buffer (size_t size) : cnk (0), dat (0) { // Alignment mask. The size of double or long int, whichever is greater. // All data will be aligned to this size. If it's not enough for a type, - // that type should not be declared as POD. + // that type should not be declared as POD. static const size_t align_mask = (sizeof (long) < sizeof (double) ? sizeof (double) : sizeof (long)) - 1; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-locbuf.h --- a/liboctave/oct-locbuf.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-locbuf.h Thu Jan 20 17:24:59 2011 -0500 @@ -34,10 +34,10 @@ { public: octave_local_buffer (size_t size) - : data (0) - { - if (size) - data = new T[size]; + : data (0) + { + if (size) + data = new T[size]; } ~octave_local_buffer (void) { delete [] data; } operator T *() const { return data; } @@ -174,7 +174,7 @@ octave_local_buffer _buffer_ ## buf (size); \ T *buf = _buffer_ ## buf -#endif +#endif // Yeah overloading macros would be nice. // Note: we use weird variables in the for loop to avoid warnings about diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-md5.cc --- a/liboctave/oct-md5.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-md5.cc Thu Jan 20 17:24:59 2011 -0500 @@ -46,7 +46,7 @@ return std::string (tmp, 32); } - + std::string oct_md5 (const std::string str) { @@ -56,7 +56,7 @@ return oct_md5_result_to_str (buf); } - + std::string oct_md5_file (const std::string file) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-mem.h --- a/liboctave/oct-mem.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-mem.h Thu Jan 20 17:24:59 2011 -0500 @@ -78,16 +78,16 @@ template inline bool helper_is_zero_mem (const T& value) -{ +{ typedef typename query_integer_type::type IT; // get integer type of the same size. - return *(reinterpret_cast(&value)) == 0; + return *(reinterpret_cast(&value)) == 0; } template inline bool helper_is_zero_mem (const std::complex& value) { - return (helper_is_zero_mem (value.real ()) - && helper_is_zero_mem (value.imag ())); + return (helper_is_zero_mem (value.real ()) + && helper_is_zero_mem (value.imag ())); } template @@ -124,11 +124,11 @@ // Memory allocated by octave_new should be freed by octave_delete. template inline T *no_ctor_new (size_t n) -{ +{ // Some systems let us allocate > 2GB memory even though size_t, which is either // buggy or completely cuckoo, so let's check here to stay safe. safe_size_comp (n, sizeof (T)); - return new T[n]; + return new T[n]; } template inline void no_ctor_delete (T *ptr) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-norm.cc --- a/liboctave/oct-norm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-norm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -70,7 +70,7 @@ norm_accumulator_p () {} // we need this one for Array norm_accumulator_p (R pp) : p(pp), scl(0), sum(1) {} - template + template void accum (U val) { octave_quit (); @@ -98,7 +98,7 @@ norm_accumulator_mp () {} // we need this one for Array norm_accumulator_mp (R pp) : p(pp), scl(0), sum(1) {} - template + template void accum (U val) { octave_quit (); @@ -157,10 +157,10 @@ R sum; public: norm_accumulator_1 () : sum (0) {} - template + template void accum (U val) { - sum += std::abs (val); + sum += std::abs (val); } operator R () { return sum; } }; @@ -172,7 +172,7 @@ R max; public: norm_accumulator_inf () : max (0) {} - template + template void accum (U val) { max = std::max (max, std::abs (val)); @@ -187,7 +187,7 @@ R min; public: norm_accumulator_minf () : min (octave_Inf) {} - template + template void accum (U val) { min = std::min (min, std::abs (val)); @@ -202,7 +202,7 @@ unsigned int num; public: norm_accumulator_0 () : num (0) {} - template + template void accum (U val) { if (val != static_cast (0)) ++num; @@ -241,7 +241,7 @@ void row_norms (const MArray& m, MArray& res, ACC acc) { res = MArray (dim_vector (m.rows (), 1)); - std::vector acci (m.rows (), acc); + std::vector acci (m.rows (), acc); for (octave_idx_type j = 0; j < m.columns (); j++) { for (octave_idx_type i = 0; i < m.rows (); i++) @@ -271,7 +271,7 @@ void row_norms (const MSparse& m, MArray& res, ACC acc) { res = MArray (dim_vector (m.rows (), 1)); - std::vector acci (m.rows (), acc); + std::vector acci (m.rows (), acc); for (octave_idx_type j = 0; j < m.columns (); j++) { for (octave_idx_type k = m.cidx (j); k < m.cidx (j+1); k++) @@ -318,8 +318,8 @@ // norm ([lambda, mu], p) == 1 and norm (y*lambda + col*mu, p) is maximized. // Real version. As in Higham's paper. template -static void -higham_subp (const ColVectorT& y, const ColVectorT& col, +static void +higham_subp (const ColVectorT& y, const ColVectorT& col, octave_idx_type nsamp, R p, R& lambda, R& mu) { R nrm = 0; @@ -327,7 +327,7 @@ { octave_quit (); R fi = i*M_PI/nsamp, lambda1 = cos (fi), mu1 = sin (fi); - R lmnr = std::pow (std::pow (std::abs (lambda1), p) + + R lmnr = std::pow (std::pow (std::abs (lambda1), p) + std::pow (std::abs (mu1), p), 1/p); lambda1 /= lmnr; mu1 /= lmnr; R nrm1 = vector_norm (lambda1 * y + mu1 * col, p); @@ -344,9 +344,9 @@ // extension. First, guess the magnitudes as in real version, then try to rotate lambda // to improve further. template -static void -higham_subp (const ColVectorT& y, const ColVectorT& col, - octave_idx_type nsamp, R p, +static void +higham_subp (const ColVectorT& y, const ColVectorT& col, + octave_idx_type nsamp, R p, std::complex& lambda, std::complex& mu) { typedef std::complex CR; @@ -358,7 +358,7 @@ { octave_quit (); R fi = i*M_PI/nsamp, lambda1 = cos (fi), mu1 = sin (fi); - R lmnr = std::pow (std::pow (std::abs (lambda1), p) + + R lmnr = std::pow (std::pow (std::abs (lambda1), p) + std::pow (std::abs (mu1), p), 1/p); lambda1 /= lmnr; mu1 /= lmnr; R nrm1 = vector_norm (lambda1 * lamcu * y + mu1 * col, p); @@ -426,7 +426,7 @@ x(k) = mu; y = lambda * y + mu * col; } - + // the PM part x = x / vector_norm (x, p); R q = p/(p-1); @@ -455,7 +455,7 @@ return gamma; } -// derive column vector and SVD types +// derive column vector and SVD types static const char *p_less1_gripe = "xnorm: p must be at least 1"; @@ -484,7 +484,7 @@ res = higham (m, p, sqrteps, max_norm_iter, x); } else - (*current_liboctave_error_handler) (p_less1_gripe); + (*current_liboctave_error_handler) (p_less1_gripe); return res; } @@ -505,7 +505,7 @@ res = higham (m, p, sqrteps, max_norm_iter, x); } else - (*current_liboctave_error_handler) (p_less1_gripe); + (*current_liboctave_error_handler) (p_less1_gripe); return res; } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-norm.h --- a/liboctave/oct-norm.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-norm.h Thu Jan 20 17:24:59 2011 -0500 @@ -35,7 +35,7 @@ extern OCTAVE_API RTYPE xnorm (const PREFIX##ColumnVector&, RTYPE p = 2); \ extern OCTAVE_API RTYPE xnorm (const PREFIX##RowVector&, RTYPE p = 2); \ extern OCTAVE_API RTYPE xnorm (const PREFIX##Matrix&, RTYPE p = 2); \ - extern OCTAVE_API RTYPE xfrobnorm (const PREFIX##Matrix&); + extern OCTAVE_API RTYPE xfrobnorm (const PREFIX##Matrix&); DECLARE_XNORM_FUNCS(, double) DECLARE_XNORM_FUNCS(Complex, double) diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-rand.cc --- a/liboctave/oct-rand.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-rand.cc Thu Jan 20 17:24:59 2011 -0500 @@ -107,7 +107,7 @@ { union d2i { double d; int32_t i[2]; }; union d2i u; - + oct_mach_info::float_format ff = oct_mach_info::native_float_format (); switch (ff) @@ -372,7 +372,7 @@ break; default: - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("rand: invalid distribution ID = %d", current_distribution); break; } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-rand.h --- a/liboctave/oct-rand.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-rand.h Thu Jan 20 17:24:59 2011 -0500 @@ -78,14 +78,14 @@ if (instance_ok ()) instance->do_state (s, d); } - + // Reset the current state/ static void reset (const std::string& d) { if (instance_ok ()) instance->do_reset (d); } - + // Return the current distribution. static std::string distribution (void) { @@ -194,10 +194,10 @@ // Set the current state/ void do_state (const ColumnVector &s, const std::string& d); - + // Reset the current state/ void do_reset (const std::string& d); - + // Return the current distribution. std::string do_distribution (void); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-rl-hist.c --- a/liboctave/oct-rl-hist.c Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-rl-hist.c Thu Jan 20 17:24:59 2011 -0500 @@ -103,7 +103,7 @@ if (history_control & HC_ERASEDUPS) hc_erasedups (line); - + add_history (line); return 1; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-shlib.cc --- a/liboctave/oct-shlib.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-shlib.cc Thu Jan 20 17:24:59 2011 -0500 @@ -294,7 +294,7 @@ if (mangler) sym_name = mangler (name); - + int status = shl_findsym (&library, sym_name.c_str (), TYPE_UNDEFINED, &function); } @@ -328,7 +328,7 @@ octave_w32_shlib& operator = (const octave_w32_shlib&); - HINSTANCE handle; + HINSTANCE handle; }; octave_w32_shlib::octave_w32_shlib (const std::string& f) @@ -451,7 +451,7 @@ errstr = "unspecified error"; (*current_liboctave_error_handler) - ("%s: %s", file.c_str (), errstr); + ("%s: %s", file.c_str (), errstr); } } else diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-shlib.h --- a/liboctave/oct-shlib.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-shlib.h Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ { public: - shlib_rep (void) + shlib_rep (void) : count (1), file (), tm_loaded (time_t ()), fcn_names () { } protected: @@ -89,7 +89,7 @@ protected: - void fake_reload (void); + void fake_reload (void); std::string file; octave_time tm_loaded; @@ -145,20 +145,20 @@ operator bool () const { return rep->is_open (); } - void open (const std::string& f) + void open (const std::string& f) { *this = octave_shlib (f); } void close (close_hook cl_hook = 0) - { + { if (cl_hook) rep->do_close_hook (cl_hook); - *this = octave_shlib (); + *this = octave_shlib (); } void *search (const std::string& nm, name_mangler mangler = 0) const - { - void *f = rep->search (nm, mangler); + { + void *f = rep->search (nm, mangler); if (f) rep->add_fcn_name (nm); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-sort.cc --- a/liboctave/oct-sort.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-sort.cc Thu Jan 20 17:24:59 2011 -0500 @@ -27,14 +27,14 @@ As required in the Python license the short description of the changes made are -* convert the sorting code in listobject.cc into a generic class, +* convert the sorting code in listobject.cc into a generic class, replacing PyObject* with the type of the class T. * replaced usages of malloc, free, memcpy and memmove by standard C++ new [], delete [] and std::copy and std::copy_backward. Note that replacing memmove by std::copy is possible if the destination starts before the source. If not, std::copy_backward needs to be used. - + * templatize comparison operator in most methods, provide possible dispatch * duplicate methods to avoid by-the-way indexed sorting @@ -117,20 +117,20 @@ #include "oct-locbuf.h" template -octave_sort::octave_sort (void) : +octave_sort::octave_sort (void) : compare (ascending_compare), ms (0) -{ +{ } template -octave_sort::octave_sort (compare_fcn_type comp) +octave_sort::octave_sort (compare_fcn_type comp) : compare (comp), ms (0) -{ +{ } template -octave_sort::~octave_sort () -{ +octave_sort::~octave_sort () +{ delete ms; } @@ -149,13 +149,13 @@ template template void -octave_sort::binarysort (T *data, octave_idx_type nel, +octave_sort::binarysort (T *data, octave_idx_type nel, octave_idx_type start, Comp comp) { if (start == 0) ++start; - for (; start < nel; ++start) + for (; start < nel; ++start) { /* set l to where *start belongs */ octave_idx_type l = 0, r = start; @@ -165,14 +165,14 @@ * pivot < all in [r, start). * The second is vacuously true at the start. */ - do + do { octave_idx_type p = l + ((r - l) >> 1); if (comp (pivot, data[p])) r = p; else l = p+1; - } + } while (l < r); /* The invariants still hold, so pivot >= all in [lo, l) and pivot < all in [l, start), so pivot belongs at l. Note @@ -193,13 +193,13 @@ template template void -octave_sort::binarysort (T *data, octave_idx_type *idx, octave_idx_type nel, +octave_sort::binarysort (T *data, octave_idx_type *idx, octave_idx_type nel, octave_idx_type start, Comp comp) { if (start == 0) ++start; - for (; start < nel; ++start) + for (; start < nel; ++start) { /* set l to where *start belongs */ octave_idx_type l = 0, r = start; @@ -209,14 +209,14 @@ * pivot < all in [r, start). * The second is vacuously true at the start. */ - do + do { octave_idx_type p = l + ((r - l) >> 1); if (comp (pivot, data[p])) r = p; else l = p+1; - } + } while (l < r); /* The invariants still hold, so pivot >= all in [lo, l) and pivot < all in [l, start), so pivot belongs at l. Note @@ -274,7 +274,7 @@ if (comp (*lo, *(lo-1))) { descending = true; - for (lo = lo+1; lo < hi; ++lo, ++n) + for (lo = lo+1; lo < hi; ++lo, ++n) { if (comp (*lo, *(lo-1))) ; @@ -282,9 +282,9 @@ break; } } - else + else { - for (lo = lo+1; lo < hi; ++lo, ++n) + for (lo = lo+1; lo < hi; ++lo, ++n) { if (comp (*lo, *(lo-1))) break; @@ -334,7 +334,7 @@ * a[hint + lastofs] < key <= a[hint + ofs] */ const octave_idx_type maxofs = n - hint; /* &a[n-1] is highest */ - while (ofs < maxofs) + while (ofs < maxofs) { if (comp (a[ofs], key)) { @@ -352,13 +352,13 @@ lastofs += hint; ofs += hint; } - else + else { /* key <= a[hint] -- gallop left, until * a[hint - ofs] < key <= a[hint - lastofs] */ const octave_idx_type maxofs = hint + 1; /* &a[0] is lowest */ - while (ofs < maxofs) + while (ofs < maxofs) { if (comp (*(a-ofs), key)) break; @@ -382,7 +382,7 @@ * search, with invariant a[lastofs-1] < key <= a[ofs]. */ ++lastofs; - while (lastofs < ofs) + while (lastofs < ofs) { octave_idx_type m = lastofs + ((ofs - lastofs) >> 1); @@ -428,7 +428,7 @@ * a[hint - ofs] <= key < a[hint - lastofs] */ const octave_idx_type maxofs = hint + 1; /* &a[0] is lowest */ - while (ofs < maxofs) + while (ofs < maxofs) { if (comp (key, *(a-ofs))) { @@ -447,13 +447,13 @@ lastofs = hint - ofs; ofs = hint - k; } - else + else { /* a[hint] <= key -- gallop right, until * a[hint + lastofs] <= key < a[hint + ofs] */ const octave_idx_type maxofs = n - hint; /* &a[n-1] is highest */ - while (ofs < maxofs) + while (ofs < maxofs) { if (comp (key, a[ofs])) break; @@ -476,7 +476,7 @@ * search, with invariant a[lastofs-1] <= key < a[ofs]. */ ++lastofs; - while (lastofs < ofs) + while (lastofs < ofs) { octave_idx_type m = lastofs + ((ofs - lastofs) >> 1); @@ -536,7 +536,7 @@ if (need <= alloced) return; - need = roundupsize (need); + need = roundupsize (need); /* Don't realloc! That can cost cycles to copy the old data, but * we don't care what's in the block. */ @@ -554,7 +554,7 @@ if (ia && need <= alloced) return; - need = roundupsize (need); + need = roundupsize (need); /* Don't realloc! That can cost cycles to copy the old data, but * we don't care what's in the block. */ @@ -575,7 +575,7 @@ template template int -octave_sort::merge_lo (T *pa, octave_idx_type na, +octave_sort::merge_lo (T *pa, octave_idx_type na, T *pb, octave_idx_type nb, Comp comp) { @@ -610,7 +610,7 @@ // FIXME: these loops are candidates for further optimizations. // Rather than testing everything in each cycle, it may be more - // efficient to do it in hunks. + // efficient to do it in hunks. if (comp (*pb, *pa)) { *dest++ = *pb++; @@ -710,7 +710,7 @@ template template int -octave_sort::merge_lo (T *pa, octave_idx_type *ipa, octave_idx_type na, +octave_sort::merge_lo (T *pa, octave_idx_type *ipa, octave_idx_type na, T *pb, octave_idx_type *ipb, octave_idx_type nb, Comp comp) { @@ -857,7 +857,7 @@ template template int -octave_sort::merge_hi (T *pa, octave_idx_type na, +octave_sort::merge_hi (T *pa, octave_idx_type na, T *pb, octave_idx_type nb, Comp comp) { @@ -883,7 +883,7 @@ if (nb == 1) goto CopyA; - for (;;) + for (;;) { octave_idx_type acount = 0; /* # of times A won in a row */ octave_idx_type bcount = 0; /* # of times B won in a row */ @@ -891,7 +891,7 @@ /* Do the straightforward thing until (if ever) one run * appears to win consistently. */ - for (;;) + for (;;) { if (comp (*pb, *pa)) { @@ -904,7 +904,7 @@ if (acount >= min_gallop) break; } - else + else { *dest-- = *pb--; ++bcount; @@ -923,7 +923,7 @@ * anymore. */ ++min_gallop; - do + do { min_gallop -= min_gallop > 1; ms->min_gallop = min_gallop; @@ -932,7 +932,7 @@ goto Fail; k = na - k; acount = k; - if (k) + if (k) { dest = std::copy_backward (pa+1 - k, pa+1, dest+1) - 1; pa -= k; @@ -950,7 +950,7 @@ goto Fail; k = nb - k; bcount = k; - if (k) + if (k) { dest -= k; pb -= k; @@ -994,7 +994,7 @@ template template int -octave_sort::merge_hi (T *pa, octave_idx_type *ipa, octave_idx_type na, +octave_sort::merge_hi (T *pa, octave_idx_type *ipa, octave_idx_type na, T *pb, octave_idx_type *ipb, octave_idx_type nb, Comp comp) { @@ -1024,7 +1024,7 @@ if (nb == 1) goto CopyA; - for (;;) + for (;;) { octave_idx_type acount = 0; /* # of times A won in a row */ octave_idx_type bcount = 0; /* # of times B won in a row */ @@ -1032,7 +1032,7 @@ /* Do the straightforward thing until (if ever) one run * appears to win consistently. */ - for (;;) + for (;;) { if (comp (*pb, *pa)) { @@ -1045,7 +1045,7 @@ if (acount >= min_gallop) break; } - else + else { *dest-- = *pb--; *idest-- = *ipb--; ++bcount; @@ -1064,7 +1064,7 @@ * anymore. */ ++min_gallop; - do + do { min_gallop -= min_gallop > 1; ms->min_gallop = min_gallop; @@ -1073,7 +1073,7 @@ goto Fail; k = na - k; acount = k; - if (k) + if (k) { dest = std::copy_backward (pa+1 - k, pa+1, dest+1) - 1; idest = std::copy_backward (ipa+1 - k, ipa+1, idest+1) - 1; @@ -1092,7 +1092,7 @@ goto Fail; k = nb - k; bcount = k; - if (k) + if (k) { dest -= k; idest -= k; pb -= k; ipb -= k; @@ -1263,17 +1263,17 @@ { struct s_slice *p = ms->pending; - while (ms->n > 1) + while (ms->n > 1) { octave_idx_type n = ms->n - 2; - if (n > 0 && p[n-1].len <= p[n].len + p[n+1].len) + if (n > 0 && p[n-1].len <= p[n].len + p[n+1].len) { if (p[n-1].len < p[n+1].len) --n; if (merge_at (n, data, comp) < 0) return -1; } - else if (p[n].len <= p[n+1].len) + else if (p[n].len <= p[n+1].len) { if (merge_at (n, data, comp) < 0) return -1; @@ -1292,17 +1292,17 @@ { struct s_slice *p = ms->pending; - while (ms->n > 1) + while (ms->n > 1) { octave_idx_type n = ms->n - 2; - if (n > 0 && p[n-1].len <= p[n].len + p[n+1].len) + if (n > 0 && p[n-1].len <= p[n].len + p[n+1].len) { if (p[n-1].len < p[n+1].len) --n; if (merge_at (n, data, idx, comp) < 0) return -1; } - else if (p[n].len <= p[n+1].len) + else if (p[n].len <= p[n+1].len) { if (merge_at (n, data, idx, comp) < 0) return -1; @@ -1326,7 +1326,7 @@ { struct s_slice *p = ms->pending; - while (ms->n > 1) + while (ms->n > 1) { octave_idx_type n = ms->n - 2; if (n > 0 && p[n-1].len < p[n+1].len) @@ -1345,7 +1345,7 @@ { struct s_slice *p = ms->pending; - while (ms->n > 1) + while (ms->n > 1) { octave_idx_type n = ms->n - 2; if (n > 0 && p[n-1].len < p[n+1].len) @@ -1395,14 +1395,14 @@ if (nel > 1) { - octave_idx_type nremaining = nel; + octave_idx_type nremaining = nel; octave_idx_type lo = 0; /* March over the array once, left to right, finding natural runs, * and extending short natural runs to minrun elements. */ octave_idx_type minrun = merge_compute_minrun (nremaining); - do + do { bool descending; octave_idx_type n; @@ -1414,7 +1414,7 @@ if (descending) std::reverse (data + lo, data + lo + n); /* If short, extend to min(minrun, nremaining). */ - if (n < minrun) + if (n < minrun) { const octave_idx_type force = nremaining <= minrun ? nremaining : minrun; binarysort (data + lo, force, n, comp); @@ -1443,7 +1443,7 @@ template template void -octave_sort::sort (T *data, octave_idx_type *idx, octave_idx_type nel, +octave_sort::sort (T *data, octave_idx_type *idx, octave_idx_type nel, Comp comp) { /* Re-initialize the Mergestate as this might be the second time called */ @@ -1454,14 +1454,14 @@ if (nel > 1) { - octave_idx_type nremaining = nel; + octave_idx_type nremaining = nel; octave_idx_type lo = 0; /* March over the array once, left to right, finding natural runs, * and extending short natural runs to minrun elements. */ octave_idx_type minrun = merge_compute_minrun (nremaining); - do + do { bool descending; octave_idx_type n; @@ -1476,7 +1476,7 @@ std::reverse (idx + lo, idx + lo + n); } /* If short, extend to min(minrun, nremaining). */ - if (n < minrun) + if (n < minrun) { const octave_idx_type force = nremaining <= minrun ? nremaining : minrun; binarysort (data + lo, idx + lo, force, n, comp); @@ -1511,7 +1511,7 @@ sort (data, nel, std::less ()); else #endif -#ifdef INLINE_DESCENDING_SORT +#ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) sort (data, nel, std::greater ()); else @@ -1529,7 +1529,7 @@ sort (data, idx, nel, std::less ()); else #endif -#ifdef INLINE_DESCENDING_SORT +#ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) sort (data, idx, nel, std::greater ()); else @@ -1539,7 +1539,7 @@ } template template -bool +bool octave_sort::is_sorted (const T *data, octave_idx_type nel, Comp comp) { const T *end = data + nel; @@ -1558,8 +1558,8 @@ return data == end; } -template -bool +template +bool octave_sort::is_sorted (const T *data, octave_idx_type nel) { bool retval = false; @@ -1568,7 +1568,7 @@ retval = is_sorted (data, nel, std::less ()); else #endif -#ifdef INLINE_DESCENDING_SORT +#ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) retval = is_sorted (data, nel, std::greater ()); else @@ -1589,7 +1589,7 @@ template template -void +void octave_sort::sort_rows (const T *data, octave_idx_type *idx, octave_idx_type rows, octave_idx_type cols, Comp comp) @@ -1647,7 +1647,7 @@ } template -void +void octave_sort::sort_rows (const T *data, octave_idx_type *idx, octave_idx_type rows, octave_idx_type cols) { @@ -1656,7 +1656,7 @@ sort_rows (data, idx, rows, cols, std::less ()); else #endif -#ifdef INLINE_DESCENDING_SORT +#ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) sort_rows (data, idx, rows, cols, std::greater ()); else @@ -1666,13 +1666,13 @@ } template template -bool -octave_sort::is_sorted_rows (const T *data, octave_idx_type rows, +bool +octave_sort::is_sorted_rows (const T *data, octave_idx_type rows, octave_idx_type cols, Comp comp) { if (rows <= 1 || cols == 0) return true; - + // This is a breadth-first traversal. const T *lastrow = data + rows*(cols - 1); typedef std::pair run_t; @@ -1717,13 +1717,13 @@ // The final column - use fast code. sorted = is_sorted (lo, n, comp); } - + return sorted; } template -bool -octave_sort::is_sorted_rows (const T *data, octave_idx_type rows, +bool +octave_sort::is_sorted_rows (const T *data, octave_idx_type rows, octave_idx_type cols) { bool retval = false; @@ -1733,7 +1733,7 @@ retval = is_sorted_rows (data, rows, cols, std::less ()); else #endif -#ifdef INLINE_DESCENDING_SORT +#ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) retval = is_sorted_rows (data, rows, cols, std::greater ()); else @@ -1747,7 +1747,7 @@ // The simple binary lookup. template template -octave_idx_type +octave_idx_type octave_sort::lookup (const T *data, octave_idx_type nel, const T& value, Comp comp) { @@ -1766,7 +1766,7 @@ } template -octave_idx_type +octave_idx_type octave_sort::lookup (const T *data, octave_idx_type nel, const T& value) { @@ -1777,7 +1777,7 @@ retval = lookup (data, nel, value, std::less ()); else #endif -#ifdef INLINE_DESCENDING_SORT +#ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) retval = lookup (data, nel, value, std::greater ()); else @@ -1789,7 +1789,7 @@ } template template -void +void octave_sort::lookup (const T *data, octave_idx_type nel, const T *values, octave_idx_type nvalues, octave_idx_type *idx, Comp comp) @@ -1802,7 +1802,7 @@ } template -void +void octave_sort::lookup (const T *data, octave_idx_type nel, const T* values, octave_idx_type nvalues, octave_idx_type *idx) @@ -1812,7 +1812,7 @@ lookup (data, nel, values, nvalues, idx, std::less ()); else #endif -#ifdef INLINE_DESCENDING_SORT +#ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) lookup (data, nel, values, nvalues, idx, std::greater ()); else @@ -1822,7 +1822,7 @@ } template template -void +void octave_sort::lookup_sorted (const T *data, octave_idx_type nel, const T *values, octave_idx_type nvalues, octave_idx_type *idx, bool rev, Comp comp) @@ -1874,7 +1874,7 @@ } template -void +void octave_sort::lookup_sorted (const T *data, octave_idx_type nel, const T* values, octave_idx_type nvalues, octave_idx_type *idx, bool rev) @@ -1884,7 +1884,7 @@ lookup_sorted (data, nel, values, nvalues, idx, rev, std::less ()); else #endif -#ifdef INLINE_DESCENDING_SORT +#ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) lookup_sorted (data, nel, values, nvalues, idx, rev, std::greater ()); else @@ -1894,7 +1894,7 @@ } template template -void +void octave_sort::nth_element (T *data, octave_idx_type nel, octave_idx_type lo, octave_idx_type up, Comp comp) @@ -1911,7 +1911,7 @@ if (up == lo + 2) { // Finding two subsequent elements. - std::swap (data[lo+1], + std::swap (data[lo+1], *std::min_element (data + lo + 1, data + nel, comp)); } else @@ -1920,7 +1920,7 @@ } template -void +void octave_sort::nth_element (T *data, octave_idx_type nel, octave_idx_type lo, octave_idx_type up) { @@ -1931,7 +1931,7 @@ nth_element (data, nel, lo, up, std::less ()); else #endif -#ifdef INLINE_DESCENDING_SORT +#ifdef INLINE_DESCENDING_SORT if (compare == descending_compare) nth_element (data, nel, lo, up, std::greater ()); else @@ -1941,7 +1941,7 @@ } template -bool +bool octave_sort::ascending_compare (typename ref_param::type x, typename ref_param::type y) { @@ -1949,7 +1949,7 @@ } template -bool +bool octave_sort::descending_compare (typename ref_param::type x, typename ref_param::type y) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-sort.h --- a/liboctave/oct-sort.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-sort.h Thu Jan 20 17:24:59 2011 -0500 @@ -25,7 +25,7 @@ As required in the Python license the short description of the changes made are -* convert the sorting code in listobject.cc into a generic class, +* convert the sorting code in listobject.cc into a generic class, replacing PyObject* with the type of the class T. The Python license is @@ -114,8 +114,8 @@ octave_sort (void); octave_sort (compare_fcn_type); - - ~octave_sort (void); + + ~octave_sort (void); void set_compare (compare_fcn_type comp) { compare = comp; } @@ -136,7 +136,7 @@ octave_idx_type rows, octave_idx_type cols); // Determine whether a matrix (as a contiguous block) is sorted by rows. - bool is_sorted_rows (const T *data, + bool is_sorted_rows (const T *data, octave_idx_type rows, octave_idx_type cols); // Do a binary lookup in a sorted array. @@ -155,7 +155,7 @@ octave_idx_type *idx, bool rev = false); // Rearranges the array so that the elements with indices - // lo..up-1 are in their correct place. + // lo..up-1 are in their correct place. void nth_element (T *data, octave_idx_type nel, octave_idx_type lo, octave_idx_type up = -1); @@ -174,22 +174,22 @@ // DGB: This isn't needed with mergesort in a class, but it doesn't // slow things up, and it is likely to make my life easier for any // potential backporting of changes in the Python code. - - struct s_slice + + struct s_slice { octave_idx_type base, len; }; - - struct MergeState + + struct MergeState { MergeState (void) : min_gallop (), a (0), ia (0), alloced (0), n (0) { reset (); } - - ~MergeState (void) + + ~MergeState (void) { delete [] a; delete [] ia; } - - void reset (void) + + void reset (void) { min_gallop = MIN_GALLOP; n = 0; } void getmem (octave_idx_type need); @@ -207,7 +207,7 @@ T *a; // may point to temparray below octave_idx_type *ia; octave_idx_type alloced; - + // A stack of n pending runs yet to be merged. Run #i starts at // address base[i] and extends for len[i] elements. It's always // true (so long as the indices are in bounds) that @@ -221,18 +221,18 @@ }; compare_fcn_type compare; - + MergeState *ms; - - + + template - void binarysort (T *data, octave_idx_type nel, + void binarysort (T *data, octave_idx_type nel, octave_idx_type start, Comp comp); - + template - void binarysort (T *data, octave_idx_type *idx, octave_idx_type nel, + void binarysort (T *data, octave_idx_type *idx, octave_idx_type nel, octave_idx_type start, Comp comp); - + template octave_idx_type count_run (T *lo, octave_idx_type n, bool& descending, Comp comp); @@ -245,22 +245,22 @@ Comp comp); template - int merge_lo (T *pa, octave_idx_type na, + int merge_lo (T *pa, octave_idx_type na, T *pb, octave_idx_type nb, Comp comp); template - int merge_lo (T *pa, octave_idx_type *ipa, octave_idx_type na, + int merge_lo (T *pa, octave_idx_type *ipa, octave_idx_type na, T *pb, octave_idx_type *ipb, octave_idx_type nb, Comp comp); template - int merge_hi (T *pa, octave_idx_type na, + int merge_hi (T *pa, octave_idx_type na, T *pb, octave_idx_type nb, Comp comp); template - int merge_hi (T *pa, octave_idx_type *ipa, octave_idx_type na, + int merge_hi (T *pa, octave_idx_type *ipa, octave_idx_type na, T *pb, octave_idx_type *ipb, octave_idx_type nb, Comp comp); @@ -301,7 +301,7 @@ Comp comp); template - bool is_sorted_rows (const T *data, octave_idx_type rows, + bool is_sorted_rows (const T *data, octave_idx_type rows, octave_idx_type cols, Comp comp); template diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-spparms.cc --- a/liboctave/oct-spparms.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-spparms.cc Thu Jan 20 17:24:59 2011 -0500 @@ -143,7 +143,7 @@ params(11) = 1; // umfpack params(12) = 0.001; // sym_tol } - + void octave_sparse_params::init_keys (void) { diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-spparms.h --- a/liboctave/oct-spparms.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-spparms.h Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ octave_sparse_params (void) : params (OCTAVE_SPARSE_CONTROLS_SIZE), - keys (OCTAVE_SPARSE_CONTROLS_SIZE) + keys (OCTAVE_SPARSE_CONTROLS_SIZE) { init_keys (); do_defaults (); @@ -61,7 +61,7 @@ params = a.params; keys = a.keys; } - + return *this; } @@ -72,7 +72,7 @@ static void defaults (void); static void tight (void); - + static string_vector get_keys (void); static ColumnVector get_vals (void); @@ -98,7 +98,7 @@ void do_defaults (void); void do_tight (void); - + string_vector do_get_keys (void) const { return keys; } ColumnVector do_get_vals (void) const { return params; } @@ -112,7 +112,7 @@ double do_get_bandden (void); void do_print_info (std::ostream& os, const std::string& prefix) const; - + void init_keys (void); }; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-syscalls.cc --- a/liboctave/oct-syscalls.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-syscalls.cc Thu Jan 20 17:24:59 2011 -0500 @@ -355,9 +355,9 @@ } else child_msg = "popen2 (child): file handle duplication failed -- " + child_msg; - + (*current_liboctave_error_handler)(child_msg.c_str()); - + exit(0); } else diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/oct-time.cc --- a/liboctave/oct-time.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/oct-time.cc Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ : ot_unix_time (), ot_usec () { struct tm t; - + t.tm_sec = tm.sec (); t.tm_min = tm.min (); t.tm_hour = tm.hour (); @@ -152,7 +152,7 @@ if (! fmt.empty ()) { struct tm t; - + t.tm_sec = tm_sec; t.tm_min = tm_min; t.tm_hour = tm_hour; @@ -204,7 +204,7 @@ return; struct tm *t = static_cast (p); - + tm_sec = t->tm_sec; tm_min = t->tm_min; tm_hour = t->tm_hour; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/randgamma.c --- a/liboctave/randgamma.c Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/randgamma.c Thu Jan 20 17:24:59 2011 -0500 @@ -25,7 +25,7 @@ /* -double randg(a) +double randg(a) void fill_randg(a,n,x) Generate a series of standard gamma distributions. @@ -33,7 +33,7 @@ See: Marsaglia G and Tsang W (2000), "A simple method for generating gamma variables", ACM Transactions on Mathematical Software 26(3) 363-372 -Needs the following defines: +Needs the following defines: * NAN: value to return for Not-A-Number * RUNI: uniform generator on (0,1) * RNOR: normal generator @@ -95,7 +95,7 @@ #define RNOR oct_randn() #define REXP oct_rande() -void +void oct_fill_randg (double a, octave_idx_type n, double *r) { octave_idx_type i; @@ -104,21 +104,21 @@ const double c = 1./sqrt(9.*d); /* Handle invalid cases */ - if (a <= 0 || INFINITE(a)) + if (a <= 0 || INFINITE(a)) { - for (i=0; i < n; i++) + for (i=0; i < n; i++) r[i] = NAN; return; } - for (i=0; i < n; i++) + for (i=0; i < n; i++) { double x, xsq, v, u; restart: x = RNOR; v = (1+c*x); v *= v*v; - if (v <= 0) + if (v <= 0) goto restart; /* rare, so don't bother moving up */ u = RUNI; xsq = x*x; @@ -126,15 +126,15 @@ goto restart; r[i] = d*v; } - if (a < 1) + if (a < 1) { /* Use gamma(a) = gamma(1+a)*U^(1/a) */ /* Given REXP = -log(U) then U^(1/a) = exp(-REXP/a) */ - for (i = 0; i < n; i++) + for (i = 0; i < n; i++) r[i] *= exp(-REXP/a); } } -double +double oct_randg (double a) { double ret; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/randmtzig.c --- a/liboctave/randmtzig.c Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/randmtzig.c Thu Jan 20 17:24:59 2011 -0500 @@ -20,7 +20,7 @@ */ -/* +/* A C-program for MT19937, with initialization improved 2002/2/10. Coded by Takuji Nishimura and Makoto Matsumoto. This is a faster version by taking Shawn Cokus's optimization, @@ -35,7 +35,7 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. @@ -43,14 +43,14 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -92,16 +92,16 @@ /* === Build instructions === - Compile with -DHAVE_GETTIMEOFDAY if the gettimeofday function is + Compile with -DHAVE_GETTIMEOFDAY if the gettimeofday function is available. This is not necessary if your architecture has /dev/urandom defined. Compile with -DALLBITS to disable 53-bit random numbers. This is about 50% slower than using 32-bit random numbers. - Uses implicit -Di386 or explicit -DHAVE_X86_32 to determine if CPU=x86. - You can force X86 behaviour with -DUSE_X86_32=1, or suppress it with - -DUSE_X86_32=0. You should also consider -march=i686 or similar for + Uses implicit -Di386 or explicit -DHAVE_X86_32 to determine if CPU=x86. + You can force X86 behaviour with -DUSE_X86_32=1, or suppress it with + -DUSE_X86_32=0. You should also consider -march=i686 or similar for extra performance. Check whether -DUSE_X86_32=0 is faster on 64-bit x86 architectures. @@ -156,7 +156,7 @@ #include "lo-math.h" #include "randmtzig.h" - + /* FIXME may want to suppress X86 if sizeof(long)>4 */ #if !defined(USE_X86_32) # if defined(i386) || defined(HAVE_X86_32) @@ -166,7 +166,7 @@ # endif #endif -/* ===== Mersenne Twister 32-bit generator ===== */ +/* ===== Mersenne Twister 32-bit generator ===== */ #define MT_M 397 #define MATRIX_A 0x9908b0dfUL /* constant vector a */ @@ -182,27 +182,27 @@ static int initt = 1; /* initializes state[MT_N] with a seed */ -void +void oct_init_by_int (uint32_t s) { int j; state[0] = s & 0xffffffffUL; for (j = 1; j < MT_N; j++) { - state[j] = (1812433253UL * (state[j-1] ^ (state[j-1] >> 30)) + j); + state[j] = (1812433253UL * (state[j-1] ^ (state[j-1] >> 30)) + j); /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ /* In the previous versions, MSBs of the seed affect */ /* only MSBs of the array state[]. */ /* 2002/01/09 modified by Makoto Matsumoto */ state[j] &= 0xffffffffUL; /* for >32 bit machines */ } - left = 1; + left = 1; initf = 1; } /* initialize by an array with array-length */ /* init_key is the array for initializing keys */ /* key_length is its length */ -void +void oct_init_by_array (uint32_t *init_key, int key_length) { int i, j, k; @@ -243,7 +243,7 @@ initf = 1; } -void +void oct_init_by_entropy (void) { uint32_t entropy[MT_N]; @@ -251,12 +251,12 @@ /* Look for entropy in /dev/urandom */ FILE* urandom =fopen("/dev/urandom", "rb"); - if (urandom) + if (urandom) { - while (n < MT_N) + while (n < MT_N) { unsigned char word[4]; - if (fread(word, 4, 1, urandom) != 1) + if (fread(word, 4, 1, urandom) != 1) break; entropy[n++] = word[0]+(word[1]<<8)+(word[2]<<16)+(word[3]<<24); } @@ -264,12 +264,12 @@ } /* If there isn't enough entropy, gather some from various sources */ - if (n < MT_N) + if (n < MT_N) entropy[n++] = time(NULL); /* Current time in seconds */ - if (n < MT_N) + if (n < MT_N) entropy[n++] = clock(); /* CPU time used (usec) */ #ifdef HAVE_GETTIMEOFDAY - if (n < MT_N) + if (n < MT_N) { struct timeval tv; if (gettimeofday(&tv, NULL) != -1) @@ -280,26 +280,26 @@ oct_init_by_array(entropy,n); } -void +void oct_set_state (uint32_t *save) { int i; - for (i = 0; i < MT_N; i++) + for (i = 0; i < MT_N; i++) state[i] = save[i]; left = save[MT_N]; next = state + (MT_N - left + 1); } -void +void oct_get_state (uint32_t *save) { int i; - for (i = 0; i < MT_N; i++) + for (i = 0; i < MT_N; i++) save[i] = state[i]; save[MT_N] = left; } -static void +static void next_state (void) { uint32_t *p = state; @@ -309,16 +309,16 @@ /* a default initial seed is used */ /* if (initf==0) init_by_int(5489UL); */ /* Or better yet, a random seed! */ - if (initf == 0) + if (initf == 0) oct_init_by_entropy(); left = MT_N; next = state; - - for (j = MT_N - MT_M + 1; --j; p++) + + for (j = MT_N - MT_M + 1; --j; p++) *p = p[MT_M] ^ TWIST(p[0], p[1]); - for (j = MT_M; --j; p++) + for (j = MT_M; --j; p++) *p = p[MT_M-MT_N] ^ TWIST(p[0], p[1]); *p = p[MT_M-MT_N] ^ TWIST(p[0], state[0]); @@ -330,7 +330,7 @@ { register uint32_t y; - if (--left == 0) + if (--left == 0) next_state(); y = *next++; @@ -346,7 +346,7 @@ /* Select which 32 bit generator to use */ #define randi32 randmt -static uint64_t +static uint64_t randi53 (void) { const uint32_t lo = randi32(); @@ -362,7 +362,7 @@ #endif } -static uint64_t +static uint64_t randi54 (void) { const uint32_t lo = randi32(); @@ -380,7 +380,7 @@ #if 0 // FIXME -- this doesn't seem to be used anywhere; should it be removed? -static uint64_t +static uint64_t randi64 (void) { const uint32_t lo = randi32(); @@ -402,18 +402,18 @@ static double randu32 (void) { - return ((double)randi32() + 0.5) * (1.0/4294967296.0); + return ((double)randi32() + 0.5) * (1.0/4294967296.0); /* divided by 2^32 */ } #else /* generates a random number on (0,1) with 53-bit resolution */ static double -randu53 (void) -{ +randu53 (void) +{ const uint32_t a=randi32()>>5; - const uint32_t b=randi32()>>6; + const uint32_t b=randi32()>>6; return (a*67108864.0+b+0.4) * (1.0/9007199254740992.0); -} +} #endif /* Determine mantissa for uniform doubles */ @@ -439,7 +439,7 @@ # define ZIGINT uint64_t # define EMANTISSA 9007199254740992.0 /* 53 bit mantissa */ # define ERANDI randi53() /* 53 bits for mantissa */ -# define NMANTISSA EMANTISSA +# define NMANTISSA EMANTISSA # define NRANDI randi54() /* 53 bits for mantissa + 1 bit sign */ # define RANDU randu53() #endif @@ -463,16 +463,16 @@ This code is based on the paper Marsaglia and Tsang, "The ziggurat method for generating random variables", Journ. Statistical Software. Code was presented in this paper for a Ziggurat of 127 levels and using a 32 bit -integer random number generator. This version of the code, uses the -Mersenne Twister as the integer generator and uses 256 levels in the +integer random number generator. This version of the code, uses the +Mersenne Twister as the integer generator and uses 256 levels in the Ziggurat. This has several advantages. - 1) As Marsaglia and Tsang themselves states, the more levels the few + 1) As Marsaglia and Tsang themselves states, the more levels the few times the expensive tail algorithm must be called - 2) The cycle time of the generator is determined by the integer - generator, thus the use of a Mersenne Twister for the core random + 2) The cycle time of the generator is determined by the integer + generator, thus the use of a Mersenne Twister for the core random generator makes this cycle extremely long. - 3) The license on the original code was unclear, thus rewriting the code + 3) The license on the original code was unclear, thus rewriting the code from the article means we are free of copyright issues. 4) Compile flag for full 53-bit random mantissa. @@ -485,7 +485,7 @@ terms like 2^32 in the code. As the normal distribution is defined between -Inf < x < Inf, we effectively only have 31 bit integers plus a sign. Thus in Marsaglia and Tsang, terms like 2^32 become 2^31. We use NMANTISSA for -this term. The exponential distribution is one sided so we use the +this term. The exponential distribution is one sided so we use the full 32 bits. We use EMANTISSA for this term. It appears that I'm slightly slower than the code in the article, this @@ -497,21 +497,21 @@ so I'm not going to try and optimize further. */ -static void +static void create_ziggurat_tables (void) { int i; double x, x1; - + /* Ziggurat tables for the normal distribution */ x1 = ZIGGURAT_NOR_R; wi[255] = x1 / NMANTISSA; fi[255] = exp (-0.5 * x1 * x1); - /* Index zero is special for tail strip, where Marsaglia and Tsang - * defines this as + /* Index zero is special for tail strip, where Marsaglia and Tsang + * defines this as * k_0 = 2^31 * r * f(r) / v, w_0 = 0.5^31 * v / f(r), f_0 = 1, - * where v is the area of each strip of the ziggurat. + * where v is the area of each strip of the ziggurat. */ ki[0] = (ZIGINT) (x1 * fi[255] / NOR_SECTION_AREA * NMANTISSA); wi[0] = NOR_SECTION_AREA / fi[255] / NMANTISSA; @@ -536,10 +536,10 @@ we[255] = x1 / EMANTISSA; fe[255] = exp (-x1); - /* Index zero is special for tail strip, where Marsaglia and Tsang - * defines this as + /* Index zero is special for tail strip, where Marsaglia and Tsang + * defines this as * k_0 = 2^32 * r * f(r) / v, w_0 = 0.5^32 * v / f(r), f_0 = 1, - * where v is the area of each strip of the ziggurat. + * where v is the area of each strip of the ziggurat. */ ke[0] = (ZIGINT) (x1 * fe[255] / EXP_SECTION_AREA * EMANTISSA); we[0] = EXP_SECTION_AREA / fe[255] / EMANTISSA; @@ -579,7 +579,7 @@ double oct_randn (void) { - if (initt) + if (initt) create_ziggurat_tables(); while (1) @@ -627,10 +627,10 @@ else if (idx == 0) { /* As stated in Marsaglia and Tsang - * + * * For the normal tail, the method of Marsaglia[5] provides: * generate x = -ln(U_1)/r, y = -ln(U_2), until y+y > x*x, - * then return r+x. Except that r+x is always in the positive + * then return r+x. Except that r+x is always in the positive * tail!!!! Any thing random might be used to determine the * sign, but as we already have r we might as well use it * @@ -641,7 +641,7 @@ { xx = - ZIGGURAT_NOR_INV_R * log (RANDU); yy = - log (RANDU); - } + } while ( yy+yy <= xx*xx); return (rabs&0x100 ? -ZIGGURAT_NOR_R-xx : ZIGGURAT_NOR_R+xx); } @@ -653,7 +653,7 @@ double oct_rande (void) { - if (initt) + if (initt) create_ziggurat_tables(); while (1) @@ -666,7 +666,7 @@ else if (idx == 0) { /* As stated in Marsaglia and Tsang - * + * * For the exponential tail, the method of Marsaglia[5] provides: * x = r - ln(U); */ @@ -678,26 +678,26 @@ } /* Array generators */ -void +void oct_fill_randu (octave_idx_type n, double *p) { octave_idx_type i; - for (i = 0; i < n; i++) + for (i = 0; i < n; i++) p[i] = oct_randu(); } -void +void oct_fill_randn (octave_idx_type n, double *p) { octave_idx_type i; - for (i = 0; i < n; i++) + for (i = 0; i < n; i++) p[i] = oct_randn(); } -void +void oct_fill_rande (octave_idx_type n, double *p) { octave_idx_type i; - for (i = 0; i < n; i++) + for (i = 0; i < n; i++) p[i] = oct_rande(); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/randmtzig.h --- a/liboctave/randmtzig.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/randmtzig.h Thu Jan 20 17:24:59 2011 -0500 @@ -20,7 +20,7 @@ */ -/* +/* A C-program for MT19937, with initialization improved 2002/2/10. Coded by Takuji Nishimura and Makoto Matsumoto. This is a faster version by taking Shawn Cokus's optimization, @@ -35,7 +35,7 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. @@ -43,14 +43,14 @@ notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/randpoisson.c --- a/liboctave/randpoisson.c Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/randpoisson.c Thu Jan 20 17:24:59 2011 -0500 @@ -23,7 +23,7 @@ /* Original version written by Paul Kienzle distributed as free software in the in the public domain. */ -/* Needs the following defines: +/* Needs the following defines: * NAN: value to return for Not-A-Number * RUNI: uniform generator on (0,1) * RNOR: normal generator @@ -77,7 +77,7 @@ /* ---- pprsc.c from Stadloeber's winrand --- */ /* flogfak(k) = ln(k!) */ -static double +static double flogfak (double k) { #define C0 9.18938533204672742e-01 @@ -98,10 +98,10 @@ 54.78472939811231919, 58.00360522298051994, 61.26170176100200198, 64.55753862700633106, 67.88974313718153498, 71.25703896716800901 }; - + double r, rr; - - if (k >= 30.0) + + if (k >= 30.0) { r = 1.0 / k; rr = r * r; @@ -143,13 +143,13 @@ * * ******************************************************************/ -static double +static double f (double k, double l_nu, double c_pm) { return exp(k * l_nu - flogfak(k) - c_pm); } -static double +static double pprsc (double my) { static double my_last = -1.0; @@ -158,13 +158,13 @@ f1, f2, f4, f5, p1, p2, p3, p4, p5, p6; double Dk, X, Y; double Ds, U, V, W; - + if (my != my_last) { /* set-up */ my_last = my; /* approximate deviation of reflection points k2, k4 from my - 1/2 */ Ds = sqrt(my + 0.25); - + /* mode m, reflection points k2 and k4, and points k1 and k5, */ /* which delimit the centre region of h(x) */ m = floor(my); @@ -172,11 +172,11 @@ k4 = floor(my - 0.5 + Ds); k1 = k2 + k2 - m + 1L; k5 = k4 + k4 - m; - + /* range width of the critical left and right centre region */ dl = (k2 - k1); dr = (k5 - k4); - + /* recurrence constants r(k)=p(k)/p(k-1) at k = k1, k2, k4+1, k5+1 */ r1 = my / k1; r2 = my / k2; @@ -186,17 +186,17 @@ /* reciprocal values of the scale parameters of exp. tail envelope */ ll = log(r1); /* expon. tail left */ lr = -log(r5); /* expon. tail right*/ - + /* Poisson constants, necessary for computing function values f(k) */ l_my = log(my); c_pm = m * l_my - flogfak(m); - + /* function values f(k) = p(k)/p(m) at k = k2, k4, k1, k5 */ f2 = f(k2, l_my, c_pm); f4 = f(k4, l_my, c_pm); f1 = f(k1, l_my, c_pm); f5 = f(k5, l_my, c_pm); - + /* area of the two centre and the two exponential tail regions */ /* area of the two immediate acceptance regions between k2, k4 */ p1 = f2 * (dl + 1.0); /* immed. left */ @@ -206,21 +206,21 @@ p5 = f1 / ll + p4; /* exp. tail left */ p6 = f5 / lr + p5; /* exp. tail right*/ } - + for (;;) { /* generate uniform number U -- U(0, p6) */ /* case distinction corresponding to U */ if ((U = RUNI * p6) < p2) { /* centre left */ - - /* immediate acceptance region + + /* immediate acceptance region R2 = [k2, m) *[0, f2), X = k2, ... m -1 */ if ((V = U - p1) < 0.0) return(k2 + floor(U/f2)); - /* immediate acceptance region + /* immediate acceptance region R1 = [k1, k2)*[0, f1), X = k1, ... k2-1 */ if ((W = V / dl) < f1 ) return(k1 + floor(V/f1)); - + /* computation of candidate X < k2, and its counterpart Y > k2 */ /* either squeeze-acceptance of X or acceptance-rejection of Y */ Dk = floor(dl * RUNI) + 1.0; @@ -241,13 +241,13 @@ } else if (U < p4) { /* centre right */ - /* immediate acceptance region + /* immediate acceptance region R3 = [m, k4+1)*[0, f4), X = m, ... k4 */ if ((V = U - p3) < 0.0) return(k4 - floor((U - p2)/f4)); - /* immediate acceptance region + /* immediate acceptance region R4 = [k4+1, k5+1)*[0, f5) */ if ((W = V / dr) < f5 ) return(k5 - floor(V/f5)); - + /* computation of candidate X > k4, and its counterpart Y < k4 */ /* either squeeze-acceptance of X or acceptance-rejection of Y */ Dk = floor(dr * RUNI) + 1.0; @@ -274,7 +274,7 @@ Dk = floor(1.0 - log(W)/ll); if ((X = k1 - Dk) < 0L) continue; /* 0 <= X <= k1 - 1 */ W *= (U - p4) * ll; /* W -- U(0, h(x)) */ - if (W <= f1 - Dk * (f1 - f1/r1)) + if (W <= f1 - Dk * (f1 - f1/r1)) return(X); /* quick accept of X*/ } else @@ -282,11 +282,11 @@ Dk = floor(1.0 - log(W)/lr); X = k5 + Dk; /* X >= k5 + 1 */ W *= (U - p5) * lr; /* W -- U(0, h(x)) */ - if (W <= f5 - Dk * (f5 - f5*r5)) + if (W <= f5 - Dk * (f5 - f5*r5)) return(X); /* quick accept of X*/ } } - + /* acceptance-rejection test of candidate X from the original area */ /* test, whether W <= f(k), with W = U*h(x) and U -- U(0, 1)*/ /* log f(X) = (X - m)*log(my) - log X! + log m! */ @@ -299,7 +299,7 @@ /* The remainder of the file is by Paul Kienzle */ /* Given uniform u, find x such that CDF(L,x)==u. Return x. */ -static void +static void poisson_cdf_lookup(double lambda, double *p, size_t n) { /* Table size is predicated on the maximum value of lambda @@ -308,19 +308,19 @@ * With lambda==10 and u_max = 1 - 1/(2^32+1), we * have poisson_pdf(lambda,36) < 1-u_max. If instead our * generator uses more bits of mantissa or returns a value - * in the range [0,1], then for lambda==10 we need a table - * size of 46 instead. For long doubles, the table size + * in the range [0,1], then for lambda==10 we need a table + * size of 46 instead. For long doubles, the table size * will need to be longer still. */ #define TABLESIZE 46 double t[TABLESIZE]; - + /* Precompute the table for the u up to and including 0.458. * We will almost certainly need it. */ int intlambda = (int)floor(lambda); double P; int tableidx; size_t i = n; - + t[0] = P = exp(-lambda); for (tableidx = 1; tableidx <= intlambda; tableidx++) { P = P*lambda/(double)tableidx; @@ -329,7 +329,7 @@ while (i-- > 0) { double u = RUNI; - + /* If u > 0.458 we know we can jump to floor(lambda) before * comparing (this observation is based on Stadlober's winrand * code). For lambda >= 1, this will be a win. Lambda < 1 @@ -339,7 +339,7 @@ /* We aren't using a for loop here because when we find the * right k we want to jump to the next iteration of the - * outer loop, and the continue statement will only work for + * outer loop, and the continue statement will only work for * the inner loop. */ nextk: if ( u <= t[k] ) { @@ -347,8 +347,8 @@ continue; } if (++k < tableidx) goto nextk; - - /* We only need high values of the table very rarely so we + + /* We only need high values of the table very rarely so we * don't automatically compute the entire table. */ while (tableidx < TABLESIZE) { P = P*lambda/(double)tableidx; @@ -359,7 +359,7 @@ tableidx++; if (u <= t[tableidx-1]) break; } - + /* We are assuming that the table size is big enough here. * This should be true even if RUNI is returning values in * the range [0,1] rather than [0,1). @@ -376,8 +376,8 @@ double alxm = log(lambda); double g = lambda*alxm - LGAMMA(lambda+1.0); size_t i; - - for (i = 0; i < n; i++) + + for (i = 0; i < n; i++) { double y, em, t; do { @@ -392,7 +392,7 @@ } } -/* The cutoff of L <= 1e8 in the following two functions before using +/* The cutoff of L <= 1e8 in the following two functions before using * the normal approximation is based on: * > L=1e8; x=floor(linspace(0,2*L,1000)); * > max(abs(normal_pdf(x,L,L)-poisson_pdf(x,L))) @@ -402,39 +402,39 @@ * of a large sample, so 1e8 is both small enough and large enough. */ /* Generate a set of poisson numbers with the same distribution */ -void +void oct_fill_randp (double L, octave_idx_type n, double *p) { octave_idx_type i; - if (L < 0.0 || INFINITE(L)) + if (L < 0.0 || INFINITE(L)) { - for (i=0; i -void -sparse_base_chol::sparse_base_chol_rep::drop_zeros +void +sparse_base_chol::sparse_base_chol_rep::drop_zeros (const cholmod_sparse* S) { chol_elt sik; @@ -79,7 +79,7 @@ template octave_idx_type -sparse_base_chol::sparse_base_chol_rep::init +sparse_base_chol::sparse_base_chol_rep::init (const chol_type& a, bool natural) { volatile octave_idx_type info = 0; @@ -89,7 +89,7 @@ if (a_nr != a_nc) { - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("SparseCHOL requires square matrix"); return -1; } @@ -189,7 +189,7 @@ sizeof(octave_idx_type), Lsparse->p, &n1, cm); BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - CHOLMOD_NAME(reallocate_sparse) + CHOLMOD_NAME(reallocate_sparse) (static_cast(Lsparse->p)[minor_p], Lsparse, cm); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; Lsparse->ncol = minor_p; @@ -213,14 +213,14 @@ END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; } #else - (*current_liboctave_error_handler) + (*current_liboctave_error_handler) ("Missing CHOLMOD. Sparse cholesky factorization disabled"); #endif return info; } template -chol_type +chol_type sparse_base_chol::L (void) const { #ifdef HAVE_CHOLMOD @@ -242,7 +242,7 @@ } template -p_type +p_type sparse_base_chol:: sparse_base_chol_rep::Q (void) const { @@ -265,7 +265,7 @@ } template -chol_type +chol_type sparse_base_chol::inverse (void) const { chol_type retval; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/sparse-base-chol.h --- a/liboctave/sparse-base-chol.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/sparse-base-chol.h Thu Jan 20 17:24:59 2011 -0500 @@ -48,7 +48,7 @@ init (a, natural); } - sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, + sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, const bool natural) : count (1), Lsparse (0), Common (), is_pd (false), minor_p (0), perms (), cond (0) @@ -64,9 +64,9 @@ cholmod_sparse * L (void) const { return Lsparse; } - octave_idx_type P (void) const + octave_idx_type P (void) const { - return (minor_p == static_cast(Lsparse->ncol) ? + return (minor_p == static_cast(Lsparse->ncol) ? 0 : minor_p + 1); } @@ -107,12 +107,12 @@ sparse_base_chol_rep (void) : count (1), is_pd (false), minor_p (0), perms (), cond (0) { } - sparse_base_chol_rep (const chol_type& a, + sparse_base_chol_rep (const chol_type& a, const bool natural) : count (1), is_pd (false), minor_p (0), perms (), cond (0) { init (a, natural); } - sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, + sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, const bool natural) : count (1), is_pd (false), minor_p (0), perms (), cond (0) { info = init (a, natural); } @@ -149,11 +149,11 @@ private: sparse_base_chol_rep *rep; - + public: sparse_base_chol (void) - : rep (new typename + : rep (new typename sparse_base_chol::sparse_base_chol_rep ()) { } @@ -170,7 +170,7 @@ : rep (a.rep) { rep->count++; } - virtual ~sparse_base_chol (void) + virtual ~sparse_base_chol (void) { if (--rep->count <= 0) delete rep; @@ -200,7 +200,7 @@ p_type Q (void) const { return rep->Q(); } - bool is_positive_definite (void) const + bool is_positive_definite (void) const { return rep->is_positive_definite(); } double rcond (void) const { return rep->rcond(); } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/sparse-base-lu.cc --- a/liboctave/sparse-base-lu.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/sparse-base-lu.cc Thu Jan 20 17:24:59 2011 -0500 @@ -48,8 +48,8 @@ } if (j < rcmin) { - // Note the +1 skips the 1.0 on the diagonal - for (octave_idx_type i = Lfact.cidx (j) + 1; + // Note the +1 skips the 1.0 on the diagonal + for (octave_idx_type i = Lfact.cidx (j) + 1; i < Lfact.cidx(j +1); i++) { Yout.xridx (ii) = Lfact.ridx(i); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/sparse-base-lu.h --- a/liboctave/sparse-base-lu.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/sparse-base-lu.h Thu Jan 20 17:24:59 2011 -0500 @@ -37,7 +37,7 @@ sparse_base_lu (void) : Lfact (), Ufact (), Rfact (), cond (0), P (), Q () { } - sparse_base_lu (const sparse_base_lu& a) + sparse_base_lu (const sparse_base_lu& a) : Lfact (a.Lfact), Ufact (a.Ufact), Rfact (), cond (a.cond), P (a.P), Q (a.Q) { } diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/sparse-dmsolve.cc --- a/liboctave/sparse-dmsolve.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/sparse-dmsolve.cc Thu Jan 20 17:24:59 2011 -0500 @@ -36,9 +36,9 @@ template static MSparse -dmsolve_extract (const MSparse &A, const octave_idx_type *Pinv, - const octave_idx_type *Q, octave_idx_type rst, - octave_idx_type rend, octave_idx_type cst, +dmsolve_extract (const MSparse &A, const octave_idx_type *Pinv, + const octave_idx_type *Q, octave_idx_type rst, + octave_idx_type rend, octave_idx_type cst, octave_idx_type cend, octave_idx_type maxnz = -1, bool lazy = false) { @@ -46,8 +46,8 @@ maxnz = (maxnz < 0 ? A.nnz () : maxnz); MSparse B (rend - rst, cend - cst, (nz < maxnz ? nz : maxnz)); // Some sparse functions can support lazy indexing (where elements - // in the row are in no particular order), even though octave in - // general can't. For those functions that can using it is a big + // in the row are in no particular order), even though octave in + // general can't. For those functions that can using it is a big // win here in terms of speed. if (lazy) { @@ -91,7 +91,7 @@ } sort.sort (ri + B.xcidx (j - cst), nz - B.xcidx (j - cst)); for (octave_idx_type p = B.cidx (j - cst); p < nz; p++) - B.xdata (p) = X [B.xridx (p)]; + B.xdata (p) = X [B.xridx (p)]; } B.xcidx (cend - cst) = nz ; } @@ -101,25 +101,25 @@ #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) static MSparse -dmsolve_extract (const MSparse &A, const octave_idx_type *Pinv, - const octave_idx_type *Q, octave_idx_type rst, - octave_idx_type rend, octave_idx_type cst, +dmsolve_extract (const MSparse &A, const octave_idx_type *Pinv, + const octave_idx_type *Q, octave_idx_type rst, + octave_idx_type rend, octave_idx_type cst, octave_idx_type cend, octave_idx_type maxnz, bool lazy); static MSparse -dmsolve_extract (const MSparse &A, const octave_idx_type *Pinv, - const octave_idx_type *Q, octave_idx_type rst, - octave_idx_type rend, octave_idx_type cst, +dmsolve_extract (const MSparse &A, const octave_idx_type *Pinv, + const octave_idx_type *Q, octave_idx_type rst, + octave_idx_type rend, octave_idx_type cst, octave_idx_type cend, octave_idx_type maxnz, bool lazy); #endif template static MArray -dmsolve_extract (const MArray &m, const octave_idx_type *, - const octave_idx_type *, octave_idx_type r1, - octave_idx_type r2, octave_idx_type c1, +dmsolve_extract (const MArray &m, const octave_idx_type *, + const octave_idx_type *, octave_idx_type r1, + octave_idx_type r2, octave_idx_type c1, octave_idx_type c2) { r2 -= 1; @@ -141,15 +141,15 @@ #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) static MArray -dmsolve_extract (const MArray &m, const octave_idx_type *, - const octave_idx_type *, octave_idx_type r1, - octave_idx_type r2, octave_idx_type c1, +dmsolve_extract (const MArray &m, const octave_idx_type *, + const octave_idx_type *, octave_idx_type r1, + octave_idx_type r2, octave_idx_type c1, octave_idx_type c2) static MArray -dmsolve_extract (const MArray &m, const octave_idx_type *, - const octave_idx_type *, octave_idx_type r1, - octave_idx_type r2, octave_idx_type c1, +dmsolve_extract (const MArray &m, const octave_idx_type *, + const octave_idx_type *, octave_idx_type r1, + octave_idx_type r2, octave_idx_type c1, octave_idx_type c2) #endif @@ -177,7 +177,7 @@ #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) static void -dmsolve_insert (MArray &a, const MArray &b, +dmsolve_insert (MArray &a, const MArray &b, const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); static void @@ -247,7 +247,7 @@ sort.sort (ri + a.xcidx (i), ii - a.xcidx (i)); for (octave_idx_type p = a.xcidx (i); p < ii; p++) - a.xdata (p) = X [a.xridx (p)]; + a.xdata (p) = X [a.xridx (p)]; a.xcidx(i+1) = ii; } @@ -264,7 +264,7 @@ #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) static void -dmsolve_insert (MSparse &a, const SparseMatrix &b, +dmsolve_insert (MSparse &a, const SparseMatrix &b, const octave_idx_type *Q, octave_idx_type r, octave_idx_type c); static void @@ -332,7 +332,7 @@ for (octave_idx_type i = a.cidx (j); i < nz; i++) { octave_quit (); - a.xdata (i) = X [a.xridx (i)]; + a.xdata (i) = X [a.xridx (i)]; } a.xcidx(j+1) = nz; } @@ -340,7 +340,7 @@ #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) static void -dmsolve_permute (MSparse &a, const MSparse& b, +dmsolve_permute (MSparse &a, const MSparse& b, const octave_idx_type *p); static void @@ -409,37 +409,37 @@ // Leading over-determined block if (dm->rr [2] < nr && dm->cc [3] < nc) { - ST m = dmsolve_extract (a, pinv, q, dm->rr [2], nr, dm->cc [3], nc, + ST m = dmsolve_extract (a, pinv, q, dm->rr [2], nr, dm->cc [3], nc, nnz_remaining, true); nnz_remaining -= m.nnz(); - RT mtmp = + RT mtmp = qrsolve (m, dmsolve_extract (btmp, 0, 0, dm->rr[2], b_nr, 0, b_nc), info); dmsolve_insert (retval, mtmp, q, dm->cc [3], 0); if (dm->rr [2] > 0 && !info) { - m = dmsolve_extract (a, pinv, q, 0, dm->rr [2], + m = dmsolve_extract (a, pinv, q, 0, dm->rr [2], dm->cc [3], nc, nnz_remaining, true); nnz_remaining -= m.nnz(); - RT ctmp = dmsolve_extract (btmp, 0, 0, 0, + RT ctmp = dmsolve_extract (btmp, 0, 0, 0, dm->rr[2], 0, b_nc); btmp.insert (ctmp - m * mtmp, 0, 0); } } - + // Structurally non-singular blocks // FIXME Should use fine Dulmange-Mendelsohn decomposition here. if (dm->rr [1] < dm->rr [2] && dm->cc [2] < dm->cc [3] && !info) { - ST m = dmsolve_extract (a, pinv, q, dm->rr [1], dm->rr [2], + 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(); - RT btmp2 = dmsolve_extract (btmp, 0, 0, dm->rr [1], dm->rr [2], + RT btmp2 = dmsolve_extract (btmp, 0, 0, dm->rr [1], dm->rr [2], 0, b_nc); double rcond = 0.0; MatrixType mtyp (MatrixType::Full); - RT mtmp = m.solve (mtyp, btmp2, info, rcond, - solve_singularity_warning, false); + RT mtmp = m.solve (mtyp, btmp2, info, rcond, + solve_singularity_warning, false); if (info != 0) { info = 0; @@ -461,10 +461,10 @@ // Trailing under-determined block if (dm->rr [1] > 0 && dm->cc [2] > 0 && !info) { - ST m = dmsolve_extract (a, pinv, q, 0, dm->rr [1], 0, + ST m = dmsolve_extract (a, pinv, q, 0, dm->rr [1], 0, dm->cc [2], nnz_remaining, true); - RT mtmp = - qrsolve (m, dmsolve_extract(btmp, 0, 0, 0, dm->rr [1] , 0, + RT mtmp = + qrsolve (m, dmsolve_extract(btmp, 0, 0, 0, dm->rr [1] , 0, b_nc), info); dmsolve_insert (retval, mtmp, q, 0, 0); } @@ -479,34 +479,34 @@ #if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL) extern Matrix -dmsolve (const SparseMatrix &a, const Matrix &b, +dmsolve (const SparseMatrix &a, const Matrix &b, octave_idx_type &info); extern ComplexMatrix -dmsolve (const SparseMatrix &a, const ComplexMatrix &b, +dmsolve (const SparseMatrix &a, const ComplexMatrix &b, octave_idx_type &info); extern ComplexMatrix -dmsolve (const SparseComplexMatrix &a, const Matrix &b, +dmsolve (const SparseComplexMatrix &a, const Matrix &b, octave_idx_type &info); extern ComplexMatrix -dmsolve (const SparseComplexMatrix &a, const ComplexMatrix &b, +dmsolve (const SparseComplexMatrix &a, const ComplexMatrix &b, octave_idx_type &info); extern SparseMatrix -dmsolve (const SparseMatrix &a, const SparseMatrix &b, +dmsolve (const SparseMatrix &a, const SparseMatrix &b, octave_idx_type &info); extern SparseComplexMatrix -dmsolve (const SparseMatrix &a, const SparseComplexMatrix &b, +dmsolve (const SparseMatrix &a, const SparseComplexMatrix &b, octave_idx_type &info); extern SparseComplexMatrix -dmsolve (const SparseComplexMatrix &a, const SparseMatrix &b, +dmsolve (const SparseComplexMatrix &a, const SparseMatrix &b, octave_idx_type &info); extern SparseComplexMatrix -dmsolve (const SparseComplexMatrix &a, const SparseComplexMatrix &b, +dmsolve (const SparseComplexMatrix &a, const SparseComplexMatrix &b, octave_idx_type &info); #endif diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/sparse-sort.cc --- a/liboctave/sparse-sort.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/sparse-sort.cc Thu Jan 20 17:24:59 2011 -0500 @@ -38,7 +38,7 @@ // faster than using octave_qsort. bool -octave_sparse_sidxl_comp (octave_sparse_sort_idxl* i, +octave_sparse_sidxl_comp (octave_sparse_sort_idxl* i, octave_sparse_sort_idxl* j) { octave_idx_type tmp = i->c - j->c; diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/sparse-sort.h --- a/liboctave/sparse-sort.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/sparse-sort.h Thu Jan 20 17:24:59 2011 -0500 @@ -32,7 +32,7 @@ public: octave_idx_type r; octave_idx_type c; - octave_idx_type idx; + octave_idx_type idx; }; bool octave_sparse_sidxl_comp (octave_sparse_sort_idxl* i, diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/sparse-util.h --- a/liboctave/sparse-util.h Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/sparse-util.h Thu Jan 20 17:24:59 2011 -0500 @@ -25,9 +25,9 @@ #define octave_sparse_util_h 1 // FIXME this overload is here due to API change in SuiteSparse (3.1 -> 3.2) -extern OCTAVE_API void SparseCholError (int status, char *file, +extern OCTAVE_API void SparseCholError (int status, char *file, int line, char *message); -extern OCTAVE_API void SparseCholError (int status, const char *file, +extern OCTAVE_API void SparseCholError (int status, const char *file, int line, const char *message); extern OCTAVE_API int SparseCholPrint (const char *fmt, ...); diff -r 1473d0cf86d2 -r 12df7854fa7c liboctave/tempname.c --- a/liboctave/tempname.c Thu Jan 20 17:21:27 2011 -0500 +++ b/liboctave/tempname.c Thu Jan 20 17:24:59 2011 -0500 @@ -183,7 +183,7 @@ if (! buf || strlen (buf) != (int) len) return NULL; - + if (streamptr != NULL) abort (); else if (exists (buf)) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ChangeLog --- a/src/ChangeLog Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ChangeLog Thu Jan 20 17:24:59 2011 -0500 @@ -1,3 +1,114 @@ +2011-01-20 John W. Eaton + + * DLD-FUNCTIONS/__contourc__.cc, DLD-FUNCTIONS/__delaunayn__.cc, + DLD-FUNCTIONS/__dsearchn__.cc, DLD-FUNCTIONS/__glpk__.cc, + DLD-FUNCTIONS/__init_fltk__.cc, + DLD-FUNCTIONS/__lin_interpn__.cc, + DLD-FUNCTIONS/__magick_read__.cc, + DLD-FUNCTIONS/__pchip_deriv__.cc, DLD-FUNCTIONS/__qp__.cc, + DLD-FUNCTIONS/__voronoi__.cc, DLD-FUNCTIONS/amd.cc, + DLD-FUNCTIONS/balance.cc, DLD-FUNCTIONS/besselj.cc, + DLD-FUNCTIONS/bsxfun.cc, DLD-FUNCTIONS/ccolamd.cc, + DLD-FUNCTIONS/cellfun.cc, DLD-FUNCTIONS/chol.cc, + DLD-FUNCTIONS/colamd.cc, DLD-FUNCTIONS/colloc.cc, + DLD-FUNCTIONS/convhulln.cc, DLD-FUNCTIONS/daspk.cc, + DLD-FUNCTIONS/dasrt.cc, DLD-FUNCTIONS/dassl.cc, + DLD-FUNCTIONS/det.cc, DLD-FUNCTIONS/dlmread.cc, + DLD-FUNCTIONS/dmperm.cc, DLD-FUNCTIONS/dot.cc, + DLD-FUNCTIONS/eig.cc, DLD-FUNCTIONS/eigs.cc, + DLD-FUNCTIONS/fft.cc, DLD-FUNCTIONS/fft2.cc, + DLD-FUNCTIONS/fftn.cc, DLD-FUNCTIONS/fftw.cc, + DLD-FUNCTIONS/filter.cc, DLD-FUNCTIONS/find.cc, + DLD-FUNCTIONS/gammainc.cc, DLD-FUNCTIONS/givens.cc, + DLD-FUNCTIONS/hex2num.cc, DLD-FUNCTIONS/inv.cc, + DLD-FUNCTIONS/kron.cc, DLD-FUNCTIONS/lookup.cc, + DLD-FUNCTIONS/lsode.cc, DLD-FUNCTIONS/lu.cc, + DLD-FUNCTIONS/luinc.cc, DLD-FUNCTIONS/matrix_type.cc, + DLD-FUNCTIONS/max.cc, DLD-FUNCTIONS/md5sum.cc, + DLD-FUNCTIONS/onCleanup.cc, DLD-FUNCTIONS/qr.cc, + DLD-FUNCTIONS/quad.cc, DLD-FUNCTIONS/quadcc.cc, + DLD-FUNCTIONS/qz.cc, DLD-FUNCTIONS/rand.cc, + DLD-FUNCTIONS/regexp.cc, DLD-FUNCTIONS/schur.cc, + DLD-FUNCTIONS/spparms.cc, DLD-FUNCTIONS/sqrtm.cc, + DLD-FUNCTIONS/str2double.cc, DLD-FUNCTIONS/strfind.cc, + DLD-FUNCTIONS/sub2ind.cc, DLD-FUNCTIONS/svd.cc, + DLD-FUNCTIONS/syl.cc, DLD-FUNCTIONS/symbfact.cc, + DLD-FUNCTIONS/symrcm.cc, DLD-FUNCTIONS/tril.cc, + DLD-FUNCTIONS/tsearch.cc, DLD-FUNCTIONS/typecast.cc, + DLD-FUNCTIONS/urlwrite.cc, OPERATORS/op-b-sbm.cc, + OPERATORS/op-bm-sbm.cc, OPERATORS/op-cdm-cdm.cc, + OPERATORS/op-chm.cc, OPERATORS/op-cm-cm.cc, + OPERATORS/op-cm-m.cc, OPERATORS/op-cm-scm.cc, + OPERATORS/op-cm-sm.cc, OPERATORS/op-cs-cs.cc, + OPERATORS/op-cs-scm.cc, OPERATORS/op-cs-sm.cc, + OPERATORS/op-dm-dm.cc, OPERATORS/op-dms-template.cc, + OPERATORS/op-fcdm-fcdm.cc, OPERATORS/op-fcm-fcm.cc, + OPERATORS/op-fcm-fcs.cc, OPERATORS/op-fcm-fm.cc, + OPERATORS/op-fcm-fs.cc, OPERATORS/op-fcs-fcm.cc, + OPERATORS/op-fcs-fcs.cc, OPERATORS/op-fcs-fm.cc, + OPERATORS/op-fcs-fs.cc, OPERATORS/op-fdm-fdm.cc, + OPERATORS/op-fm-fcm.cc, OPERATORS/op-fm-fcs.cc, + OPERATORS/op-fm-fm.cc, OPERATORS/op-fm-fs.cc, + OPERATORS/op-fs-fcm.cc, OPERATORS/op-fs-fcs.cc, + OPERATORS/op-fs-fm.cc, OPERATORS/op-int-concat.cc, + OPERATORS/op-m-cm.cc, OPERATORS/op-m-m.cc, + OPERATORS/op-m-scm.cc, OPERATORS/op-m-sm.cc, + OPERATORS/op-pm-pm.cc, OPERATORS/op-pm-scm.cc, + OPERATORS/op-pm-sm.cc, OPERATORS/op-pm-template.cc, + OPERATORS/op-range.cc, OPERATORS/op-s-scm.cc, + OPERATORS/op-sbm-b.cc, OPERATORS/op-sbm-bm.cc, + OPERATORS/op-sbm-sbm.cc, OPERATORS/op-scm-cm.cc, + OPERATORS/op-scm-cs.cc, OPERATORS/op-scm-m.cc, + OPERATORS/op-scm-s.cc, OPERATORS/op-scm-scm.cc, + OPERATORS/op-scm-sm.cc, OPERATORS/op-sm-cm.cc, + OPERATORS/op-sm-cs.cc, OPERATORS/op-sm-m.cc, + OPERATORS/op-sm-s.cc, OPERATORS/op-sm-scm.cc, + OPERATORS/op-sm-sm.cc, OPERATORS/op-str-str.cc, + OPERATORS/op-ui64-ui64.cc, bitfcns.cc, c-file-ptr-stream.cc, + c-file-ptr-stream.h, comment-list.h, data.cc, debug.cc, debug.h, + defun-int.h, defun.cc, dynamic-ld.cc, error.cc, file-io.cc, + gl-render.cc, gl-render.h, gl2ps-renderer.cc, gl2ps-renderer.h, + gl2ps.c, gl2ps.h, graphics.cc, graphics.h.in, help.cc, input.cc, + lex.h, lex.ll, load-path.cc, load-path.h, load-save.cc, + load-save.h, ls-ascii-helper.cc, ls-hdf5.cc, ls-hdf5.h, + ls-mat-ascii.cc, ls-mat4.cc, ls-mat4.h, ls-mat5.cc, + ls-oct-ascii.cc, ls-oct-ascii.h, ls-oct-binary.cc, mappers.cc, + mex.cc, mex.h, mexproto.h, mxarray.h.in, oct-hist.cc, + oct-lvalue.cc, oct-lvalue.h, oct-map.cc, oct-map.h, oct-obj.cc, + oct-obj.h, oct-parse.yy, oct-procbuf.cc, oct-stream.cc, + oct-stream.h, octave.cc, ov-base-diag.cc, ov-base-diag.h, + ov-base-int.cc, ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, + ov-base-scalar.cc, ov-base-scalar.h, ov-base-sparse.cc, + ov-base-sparse.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, + ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc, + ov-bool.h, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc, + ov-class.cc, ov-class.h, ov-complex.cc, ov-complex.h, + ov-cx-diag.cc, ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, + ov-cx-sparse.cc, ov-cx-sparse.h, ov-dld-fcn.h, ov-fcn-handle.cc, + ov-fcn-handle.h, ov-fcn-inline.cc, ov-fcn-inline.h, ov-fcn.h, + ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h, + ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, + ov-flt-cx-mat.h, ov-flt-re-diag.cc, ov-flt-re-diag.h, + ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-intx.h, ov-lazy-idx.cc, + ov-lazy-idx.h, ov-null-mat.cc, ov-null-mat.h, ov-perm.cc, + ov-perm.h, ov-range.cc, ov-range.h, ov-re-diag.cc, ov-re-diag.h, + ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h, + ov-scalar.cc, ov-scalar.h, ov-str-mat.cc, ov-str-mat.h, + ov-struct.cc, ov-struct.h, ov-type-conv.h, ov-typeinfo.cc, + ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, pager.cc, + pr-output.cc, procstream.h, pt-arg-list.cc, pt-assign.h, + pt-binop.cc, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cell.cc, + pt-colon.cc, pt-const.cc, pt-decl.cc, pt-eval.cc, + pt-fcn-handle.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-mat.cc, + pt-mat.h, pt-pr-code.cc, pt-select.cc, pt-select.h, pt-stmt.cc, + pt-unop.cc, pt-unop.h, sighandlers.cc, sighandlers.h, + sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, + sparse.cc, strfns.cc, symtab.cc, symtab.h, syscalls.cc, + sysdep.cc, toplev.cc, toplev.h, txt-eng-ft.cc, txt-eng-ft.h, + txt-eng.h, unwind-prot.h, utils.cc, utils.h, variables.cc, + variables.h, xdiv.cc, xdiv.h, xnorm.cc, xpow.cc, zfstream.cc, + zfstream.h: Strip trailing whitespace. + 2011-01-20 John W. Eaton * gl-render.cc, DLD-FUNCTIONS/__init_fltk__.cc, diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/__contourc__.cc --- a/src/DLD-FUNCTIONS/__contourc__.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/__contourc__.cc Thu Jan 20 17:24:59 2011 -0500 @@ -194,7 +194,7 @@ next_r = r; if (stop_edge == 0) - next_r--; + next_r--; else if (stop_edge == 1) next_c++; else if (stop_edge == 2) diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/__delaunayn__.cc --- a/src/DLD-FUNCTIONS/__delaunayn__.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/__delaunayn__.cc Thu Jan 20 17:24:59 2011 -0500 @@ -33,7 +33,7 @@ 6. June 2006: Changes by Alexander Barth - * triangulate non-simplicial facets + * triangulate non-simplicial facets * allow options to be specified as cell array of strings * change the default options (for compatibility with matlab) */ @@ -99,12 +99,12 @@ { // keep default options } - else if (args(1).is_string ()) + else if (args(1).is_string ()) { // option string is directly provided options = args(1).string_value (); } - else if (args(1).is_cell ()) + else if (args(1).is_cell ()) { options = ""; @@ -112,7 +112,7 @@ for (octave_idx_type i = 0; i < c.numel (); i++) { - if (! c.elem(i).is_string ()) + if (! c.elem(i).is_string ()) { error ("__delaunayn__: all options must be strings"); return retval; @@ -121,16 +121,16 @@ options = options + c.elem(i).string_value () + " "; } } - else + else { error ("__delaunayn__: OPT argument must be a string, cell array of strings, or empty"); return retval; } - } + } //octave_stdout << "options " << options << std::endl; - if (n > dim + 1) + if (n > dim + 1) { p = p.transpose (); double *pt_array = p.fortran_vec (); @@ -149,7 +149,7 @@ if (! qh_new_qhull (dim, n, pt_array, ismalloc, flags, outfile, errfile)) { // triangulate non-simplicial facets - qh_triangulate (); + qh_triangulate (); facetT *facet; vertexT *vertex, **vertexp; @@ -161,7 +161,7 @@ nf++; // Double check - if (! facet->simplicial) + if (! facet->simplicial) { error ("__delaunayn__: Qhull returned non-simplicial facets -- try delaunayn with different options"); break; @@ -172,7 +172,7 @@ FORALLfacets { - if (! facet->upperdelaunay) + if (! facet->upperdelaunay) { octave_idx_type j = 0; @@ -209,12 +209,12 @@ else error ("__delaunayn__: qhull failed."); } - else if (n == dim + 1) + else if (n == dim + 1) { // one should check if nx points span a simplex // I will look at this later. RowVector vec (n); - for (octave_idx_type i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) vec(i) = i + 1.0; retval(0) = vec; diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/__dsearchn__.cc --- a/src/DLD-FUNCTIONS/__dsearchn__.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/__dsearchn__.cc Thu Jan 20 17:24:59 2011 -0500 @@ -96,7 +96,7 @@ OCTAVE_QUIT; } - *pdist++ = d0; + *pdist++ = d0; pidx++; pxi += n; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/__glpk__.cc --- a/src/DLD-FUNCTIONS/__glpk__.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/__glpk__.cc Thu Jan 20 17:24:59 2011 -0500 @@ -264,7 +264,7 @@ typx = LPX_DB; break; } - + lpx_set_row_bnds (lp, i+1, typx, b[i], b[i]); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/__init_fltk__.cc --- a/src/DLD-FUNCTIONS/__init_fltk__.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/__init_fltk__.cc Thu Jan 20 17:24:59 2011 -0500 @@ -98,7 +98,7 @@ ~OpenGL_fltk (void) { } - void zoom (bool z) + void zoom (bool z) { in_zoom = z; if (! in_zoom) @@ -107,7 +107,7 @@ bool zoom (void) { return in_zoom; } void set_zoom_box (const Matrix& zb) { zoom_box = zb; } - + void print (const int fid, const std::string& term) { print_fid = fid; @@ -120,7 +120,7 @@ setup_viewport (ww, hh); redraw (); } - + private: double number; opengl_renderer renderer; @@ -170,7 +170,7 @@ glVertex2d (zoom_box(2), h () - zoom_box(1)); glVertex2d (zoom_box(0), h () - zoom_box(1)); } - + void overlay (void) { glPushMatrix (); @@ -228,7 +228,7 @@ { static_cast (data)->execute_callback (); } - + class fltk_uimenu { @@ -302,11 +302,11 @@ else menupath.clear (); continue; - } + } // Menu item? std::string itempath = menupath; if (!itempath.empty ()) - itempath += "/"; + itempath += "/"; itempath += m->label (); if (itempath.compare (findname) == 0) @@ -315,7 +315,7 @@ } return (-1); } - + Matrix find_uimenu_children (uimenu::properties& uimenup) const { Matrix uimenu_childs = uimenup.get_all_children (); @@ -329,18 +329,18 @@ Matrix retval = do_find_uimenu_children (uimenu_childs); return retval; } - + Matrix do_find_uimenu_children (Matrix uimenu_childs) const { octave_idx_type k = 0; - - + + Matrix pos = Matrix (uimenu_childs.numel (), 1); - + for (octave_idx_type ii = 0; ii < uimenu_childs.numel (); ii++) { graphics_object kidgo = gh_manager::get_object (uimenu_childs (ii)); - + if (kidgo.valid_object() && kidgo.isa ("uimenu")) { uimenu_childs(k) = uimenu_childs(ii); @@ -348,8 +348,8 @@ dynamic_cast (kidgo.get_properties ()).get_position (); } } - - uimenu_childs.resize (k, 1); + + uimenu_childs.resize (k, 1); pos.resize (k, 1); Matrix retval = Matrix (k, 1); // Don't know if this is the best method to sort. @@ -357,10 +357,10 @@ Array sidx = pos.sort_rows_idx (DESCENDING); for (octave_idx_type ii = 0; ii < k; ii++) retval(ii) = uimenu_childs (sidx(ii)); - + return retval; } - + void delete_entry(uimenu::properties& uimenup) { std::string fltk_label = uimenup.get_fltk_label (); @@ -404,7 +404,7 @@ } } } - + void update_enable (uimenu::properties& uimenup) { std::string fltk_label = uimenup.get_fltk_label (); @@ -449,7 +449,7 @@ int curr_idx = find_index_by_name(fltk_label.c_str ()); for (idx = curr_idx - 1; idx >= 0; idx--) - { + { Fl_Menu_Item* item = const_cast(&menubar->menu () [idx]); itemflags = item->flags; if (item->label () != NULL) @@ -484,7 +484,7 @@ } } } - + void add_entry (uimenu::properties& uimenup) { @@ -494,19 +494,19 @@ { bool item_added = false; do - { + { const Fl_Menu_Item* item = menubar->find_item(fltk_label.c_str ()); - + if (item == NULL) { Matrix uimenu_ch = find_uimenu_children (uimenup); int len = uimenu_ch.numel (); int flags = 0; - if (len > 0) + if (len > 0) flags = FL_SUBMENU; if ((len == 0) && (uimenup.is_checked ())) flags += FL_MENU_TOGGLE + FL_MENU_VALUE; - menubar->add(fltk_label.c_str (), 0, 0, 0, flags); + menubar->add(fltk_label.c_str (), 0, 0, 0, flags); item_added = true; } else @@ -532,14 +532,14 @@ while (!item_added); uimenup.set_fltk_label (fltk_label); } - } + } void add_to_menu (uimenu::properties& uimenup) { Matrix kids = find_uimenu_children (uimenup); int len = kids.length (); std::string fltk_label = uimenup.get_fltk_label (); - + add_entry (uimenup); update_foregroundcolor (uimenup); update_callback (uimenup); @@ -547,7 +547,7 @@ update_enable (uimenup); update_visible (uimenup); update_seperator (uimenup); - + for (octave_idx_type ii = 0; ii < len; ii++) { graphics_object kgo = gh_manager::get_object (kids (len - (ii + 1))); @@ -563,7 +563,7 @@ { Matrix kids = find_uimenu_children (figp); int len = kids.length (); - menubar->clear (); + menubar->clear (); for (octave_idx_type ii = 0; ii < len; ii++) { graphics_object kgo = gh_manager::get_object (kids (len - (ii + 1))); @@ -581,7 +581,7 @@ { Matrix kids; std::string type = prop.get_type (); - kids = find_uimenu_children (prop); + kids = find_uimenu_children (prop); int len = kids.length (); for (octave_idx_type ii = 0; ii < len; ii++) @@ -605,7 +605,7 @@ { delete menubar; } - + private: Fl_Menu_Bar* menubar; }; @@ -623,18 +623,18 @@ begin (); { - + uimenu = new fltk_uimenu(0, 0, ww, menu_h); uimenu->hide (); - + canvas = new OpenGL_fltk (0, 0, ww , hh - status_h, number ()); - bottom = new - Fl_Box (0, - hh - status_h, - ww, + bottom = new + Fl_Box (0, + hh - status_h, + ww, status_h); bottom->box(FL_FLAT_BOX); @@ -766,7 +766,7 @@ uimenu->show (); mark_modified (); } - + void hide_menubar (void) { int dm = menu_h; @@ -777,13 +777,13 @@ canvas->w (), canvas->h () + dm); uimenu->hide (); - mark_modified (); + mark_modified (); } - + void uimenu_update(graphics_handle gh, int id) { graphics_object uimenu_obj = gh_manager::get_object (gh); - + if (uimenu_obj.valid_object () && uimenu_obj.isa ("uimenu")) { uimenu::properties& uimenup = @@ -792,7 +792,7 @@ graphics_object fig = uimenu_obj.get_ancestor("figure"); figure::properties& figp = dynamic_cast (fig.get_properties ()); - + switch(id) { case base_properties::ID_BEINGDELETED: @@ -826,12 +826,12 @@ uimenu->update_seperator (uimenup); break; } - + if (uimenu->items_to_show ()) show_menubar (); else hide_menubar (); - + mark_modified(); } } @@ -841,12 +841,12 @@ canvas->show (); canvas->make_current (); } - + void hide_canvas (void) { canvas->hide (); } - + void mark_modified (void) { damage (FL_DAMAGE_ALL); @@ -909,10 +909,10 @@ if (widg == togglegrid) toggle_grid (); - + if (widg == panzoom) gui_mode = pan_zoom; - + if (widg == rotate && ndim == 3) gui_mode = rotate_zoom; @@ -944,18 +944,18 @@ octave_value_list args; if (fp.get_currentaxes ().ok ()) args(0) = fp.get_currentaxes ().as_octave_value (); - + feval ("grid", args); mark_modified (); } - - void pixel2pos + + void pixel2pos (graphics_handle ax, int px, int py, double& xx, double& yy) const { pixel2pos ( gh_manager::get_object (ax), px, py, xx, yy); } - void pixel2pos + void pixel2pos (graphics_object ax, int px, int py, double& xx, double& yy) const { if (ax && ax.isa ("axes")) @@ -995,7 +995,7 @@ } return fp.get_currentaxes (); } - + void pixel2status (graphics_handle ax, int px0, int py0, int px1 = -1, int py1 = -1) { @@ -1025,7 +1025,7 @@ { if (ax && ax.isa ("axes")) { - axes::properties& ap = + axes::properties& ap = dynamic_cast (ax.get_properties ()); std::stringstream cbuf; cbuf.precision (4); @@ -1033,12 +1033,12 @@ Matrix v (1,2,0); v = ap.get("view").matrix_value(); cbuf << "[azimuth: " << v(0) << ", elevation: " << v(1) << "]"; - + status->value (cbuf.str ().c_str ()); status->redraw (); } } - + void set_currentpoint (int px, int py) { if (!fp.is_beingdeleted ()) @@ -1054,9 +1054,9 @@ { if (ax.valid_object ()) { - axes::properties& ap = + axes::properties& ap = dynamic_cast (ax.get_properties ()); - + double xx, yy; pixel2pos (ax, px, py, xx, yy); @@ -1101,7 +1101,7 @@ Cell modifier2cell () { string_vector mod; - + if (shift & FL_SHIFT) mod.append (std::string ("shift")); if (shift & FL_CTRL) @@ -1157,7 +1157,7 @@ shift |= key2shift (key); int key_a = key2ascii (key); - if (key_a && fp.get_keypressfcn ().is_defined ()) + if (key_a && fp.get_keypressfcn ().is_defined ()) { Octave_map evt; evt.assign ("Character", octave_value (key_a)); @@ -1217,7 +1217,7 @@ py0 = Fl::event_y (); set_currentpoint (Fl::event_x (), Fl::event_y ()); - + gh = pixel2axes_or_ca (px0, py0); if (gh.ok ()) @@ -1225,7 +1225,7 @@ ax0 = gh_manager::get_object (gh); set_axes_currentpoint (ax0, px0, py0); } - + fp.execute_windowbuttondownfcn (); if (Fl::event_button () == 1 || Fl::event_button () == 3) @@ -1239,7 +1239,7 @@ set_currentpoint (Fl::event_x (), Fl::event_y ()); fp.execute_windowbuttonmotionfcn (); } - + if (Fl::event_button () == 1) { if (ax0 && ax0.isa ("axes")) @@ -1248,14 +1248,14 @@ pixel2status (ax0, px0, py0, Fl::event_x (), Fl::event_y ()); else view2status (ax0); - axes::properties& ap = + axes::properties& ap = dynamic_cast (ax0.get_properties ()); - + double x0, y0, x1, y1; Matrix pos = fp.get_position ().matrix_value (); pixel2pos (ax0, px0, py0, x0, y0); pixel2pos (ax0, Fl::event_x (), Fl::event_y (), x1, y1); - + if (gui_mode == pan_zoom) ap.translate_view (x0 - x1, y0 - y1); else if (gui_mode == rotate_zoom) @@ -1289,22 +1289,22 @@ case FL_MOUSEWHEEL: { - graphics_object ax = - gh_manager::get_object (pixel2axes_or_ca (Fl::event_x (), - Fl::event_y ())); + graphics_object ax = + gh_manager::get_object (pixel2axes_or_ca (Fl::event_x (), + Fl::event_y ())); if (ax && ax.isa ("axes")) { - axes::properties& ap = + axes::properties& ap = dynamic_cast (ax.get_properties ()); - + // Determine if we're zooming in or out. - const double factor = + const double factor = (Fl::event_dy () > 0) ? 1.0 + wheel_zoom_speed : 1.0 - wheel_zoom_speed; - + // Get the point we're zooming about. double x1, y1; pixel2pos (ax, Fl::event_x (), Fl::event_y (), x1, y1); - + ap.zoom_about_point (x1, y1, factor, false); mark_modified (); } @@ -1317,7 +1317,7 @@ set_currentpoint (Fl::event_x (), Fl::event_y ()); fp.execute_windowbuttonupfcn (); } - + if (Fl::event_button () == 1) { if ( Fl::event_clicks () == 1) @@ -1478,19 +1478,19 @@ if (instance_ok ()) instance->do_print (hnd2idx(gh), fid, term); } - + static void uimenu_update (const graphics_handle& figh, const graphics_handle& uimenuh, const int id) { if (instance_ok ()) instance->do_uimenu_update (hnd2idx(figh), uimenuh, id); } - + static void update_canvas (const graphics_handle& gh, const graphics_handle& ca) { if (instance_ok ()) instance->do_update_canvas (hnd2idx(gh), ca); } - + static void toggle_menubar_visibility (int fig_idx, bool menubar_is_figure) { if (instance_ok ()) @@ -1501,7 +1501,7 @@ { toggle_menubar_visibility (str2idx (fig_idx_str), menubar_is_figure); } - + private: static figure_manager *instance; @@ -1575,11 +1575,11 @@ win->second->show_menubar (); else win->second->hide_menubar (); - + win->second->redraw (); } } - + void do_mark_modified (int idx) { wm_iterator win; @@ -1629,7 +1629,7 @@ win->second->uimenu_update (gh, id); } } - + void do_update_canvas (int idx, graphics_handle ca) { wm_iterator win; @@ -1641,8 +1641,8 @@ win->second->hide_canvas (); } } - - + + // FIXME -- default size should be configurable. void default_size (int& x, int& y, int& w, int& h) { @@ -1773,7 +1773,7 @@ { uimenu::properties& uimenup = dynamic_cast (uimenu_obj.get_properties ()); - std::string fltk_label = uimenup.get_label (); + std::string fltk_label = uimenup.get_label (); graphics_object go = gh_manager::get_object (uimenu_obj.get_parent ()); if (go.isa ("uimenu")) fltk_label = dynamic_cast (go.get_properties ()).get_fltk_label () @@ -1783,22 +1783,22 @@ ; else error("unexpected parent object\n"); - + uimenup.set_fltk_label(fltk_label); } } - + void update (const graphics_object& go, int id) { if (go.isa ("figure")) { octave_value ov = go.get (caseless_str ("__plot_stream__")); - + if (! ov.is_empty ()) { const figure::properties& fp = dynamic_cast (go.get_properties ()); - + switch (id) { case base_properties::ID_VISIBLE: @@ -1821,7 +1821,7 @@ { if (id == uimenu::properties::ID_LABEL) uimenu_set_fltk_label (go); - + graphics_object fig = go.get_ancestor("figure"); figure_manager::uimenu_update(fig.get_handle (), go.get_handle (), id); } @@ -1837,8 +1837,8 @@ void print_figure (const graphics_object& go, const std::string& term, const std::string& file, bool /*mono*/, - const std::string& /*debug_file*/) const - { + const std::string& /*debug_file*/) const + { int fid; std::istringstream istr (file); if (istr >> fid) @@ -1882,7 +1882,7 @@ graphics_toolkit::register_toolkit (new fltk_graphics_toolkit); toolkit_registered = true; - + octave_value_list args; args(0) = "__fltk_redraw__"; feval ("add_input_event_hook", args, 0); @@ -1927,7 +1927,7 @@ } octave_value retval; - return retval; + return retval; } DEFUN_DLD (__fltk_maxtime__, args, ,"") @@ -1991,10 +1991,10 @@ mode_str = "3d"; else mode_str = "none"; - - + + bool failed = false; - + if (args.length () == 1) { if (args(0).is_string ()) @@ -2013,11 +2013,11 @@ else failed = true; } - + if (failed) error ("MODE must be one of the strings: ""2D"", ""3D"", or ""None""."); - - + + return octave_value(mode_str); } @@ -2035,22 +2035,22 @@ // args(0) ... FileFilter in fltk format // args(1) ... Title // args(2) ... Default Filename - // args(3) ... PostionValue [x,y] + // args(3) ... PostionValue [x,y] // args(4) ... SelectValue "on"/"off"/"dir"/"create" - + std::string file_filter, title, default_name, multi; if (args(0).is_string ()) file_filter = args(0).string_value(); - + if (args(1).is_string ()) title = args(1).string_value(); - + if (args(2).is_string ()) default_name = args(2).string_value(); - + if (args(3).is_real_matrix ()) Matrix pos = args(3).matrix_value(); - + int multi_type = Fl_File_Chooser::SINGLE; std::string flabel = "Filename:"; if (args(4).is_string ()) @@ -2066,49 +2066,49 @@ else if (multi == "create") multi_type = Fl_File_Chooser::CREATE; } - - Fl_File_Chooser::filename_label = flabel.c_str (); + + Fl_File_Chooser::filename_label = flabel.c_str (); Fl_File_Chooser *fc = new Fl_File_Chooser(default_name.c_str (), file_filter.c_str (), multi_type, title.c_str ()); fc->preview(0); - + if (multi_type == Fl_File_Chooser::CREATE) fc->ok_label("Save"); - + fc->show(); while (fc->shown ()) { Fl::wait (); } octave_value_list fargs, retval; - + retval(0) = octave_value(0); retval(1) = octave_value(0); retval(2) = octave_value(0); - + if (fc->value() != NULL) { int file_count = fc->count (); std::string fname; std::string sep = file_ops::dir_sep_str (); std::size_t idx; - + if ((file_count == 1) && (multi_type != Fl_File_Chooser::DIRECTORY)) { - fname = fc->value (); + fname = fc->value (); idx = fname.find_last_of(sep); retval(0) = fname.substr(idx + 1); } - else + else { Cell file_cell = Cell(file_count, 1); for (octave_idx_type n = 1; n <= file_count; n++) { - fname = fc->value (n); + fname = fc->value (n); idx = fname.find_last_of(sep); file_cell(n - 1) = fname.substr(idx + 1); } retval(0) = file_cell; } - + if (multi_type == Fl_File_Chooser::DIRECTORY) retval(0) = std::string(fc->value ()); else @@ -2117,7 +2117,7 @@ retval(2) = fc->filter_value(); } } - + return retval; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/__lin_interpn__.cc --- a/src/DLD-FUNCTIONS/__lin_interpn__.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/__lin_interpn__.cc Thu Jan 20 17:24:59 2011 -0500 @@ -200,7 +200,7 @@ OCTAVE_LOCAL_BUFFER (const T *, x, n); OCTAVE_LOCAL_BUFFER (octave_idx_type, scale, n); - + const T *v = V.data (); T *vi = Vi.fortran_vec (); octave_idx_type Ni = Vi.numel (); @@ -319,7 +319,7 @@ retval = lin_interpn (n, X, V, Y); } - else + else { OCTAVE_LOCAL_BUFFER (NDArray, X, n); OCTAVE_LOCAL_BUFFER (NDArray, Y, n); @@ -349,7 +349,7 @@ return retval; } } - + retval = lin_interpn (n, X, V, Y); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/__magick_read__.cc --- a/src/DLD-FUNCTIONS/__magick_read__.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/__magick_read__.cc Thu Jan 20 17:24:59 2011 -0500 @@ -428,7 +428,7 @@ if (args.length () == 2 && args(1).is_real_type ()) frameidx = args(1).int_vector_value(); - else if (args.length () == 3 && args(1).is_string () + else if (args.length () == 3 && args(1).is_string () && args(1).string_value() == "frames") { if (args(2).is_string () && args(2).string_value() == "all") @@ -499,7 +499,7 @@ i++; depth = 1 << i; } - + switch (depth) { case 1: @@ -1023,8 +1023,8 @@ // Read the file. std::vector imvec; Magick::readImages (&imvec, args(0).string_value ()); - int nframes = imvec.size (); - + int nframes = imvec.size (); + // Create the right size for the output. static const char *fields[] = @@ -1082,11 +1082,11 @@ for (int frame = 0; frame < nframes; frame++) { Magick::Image im = imvec[frame]; - + // Add file name and timestamp. info.contents ("Filename")(frame,0) = filename; info.contents ("FileModDate")(frame,0) = filetime; - + // Annoying CamelCase naming is for Matlab compatibility. GET_PARAM (fileSize, "FileSize") GET_PARAM (rows, "Height") diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/__pchip_deriv__.cc --- a/src/DLD-FUNCTIONS/__pchip_deriv__.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/__pchip_deriv__.cc Thu Jan 20 17:24:59 2011 -0500 @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 2002-2011 Kai Habel Copyright (C) 2008-2009 Jaroslav Hajek @@ -88,7 +88,7 @@ for (octave_idx_type i = (rows ? nyr : nyc); i > 0; i--) { - F77_FUNC (pchim, PCHIM) (nx, xvec.data (), + F77_FUNC (pchim, PCHIM) (nx, xvec.data (), yvec, dvec, incfd, &ierr); yvec += inc; @@ -128,7 +128,7 @@ for (octave_idx_type i = (rows ? nyr : nyc); i > 0; i--) { - F77_FUNC (dpchim, DPCHIM) (nx, xvec.data (), + F77_FUNC (dpchim, DPCHIM) (nx, xvec.data (), yvec, dvec, incfd, &ierr); yvec += inc; diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/__qp__.cc --- a/src/DLD-FUNCTIONS/__qp__.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/__qp__.cc Thu Jan 20 17:24:59 2011 -0500 @@ -257,7 +257,7 @@ { info = 0; - // Computing the step pz. + // Computing the step pz. if (dimZ > 0) { // Using the Cholesky factorization to invert rH diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/__voronoi__.cc --- a/src/DLD-FUNCTIONS/__voronoi__.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/__voronoi__.cc Thu Jan 20 17:24:59 2011 -0500 @@ -67,7 +67,7 @@ retval(0) = 0.0; int nargin = args.length (); - if (nargin < 1 || nargin > 2) + if (nargin < 1 || nargin > 2) { print_usage (); return retval; @@ -75,9 +75,9 @@ const char *options; - if (nargin == 2) + if (nargin == 2) { - if (! args (1).is_string ()) + if (! args (1).is_string ()) { error ("__voronoi__: OPTIONS argument must be a string"); return retval; @@ -97,7 +97,7 @@ double *pt_array = p.fortran_vec (); //double pt_array[dim * np]; - //for (int i = 0; i < np; i++) + //for (int i = 0; i < np; i++) // { // for (int j = 0; j < dim; j++) // { @@ -118,27 +118,27 @@ FILE *outfile = 0; FILE *errfile = stderr; - if (! qh_new_qhull (dim, np, pt_array, ismalloc, flags, outfile, errfile)) + if (! qh_new_qhull (dim, np, pt_array, ismalloc, flags, outfile, errfile)) { facetT *facet; vertexT *vertex; octave_idx_type i = 0, n = 1, k = 0, m = 0, fidx = 0, j = 0, r = 0; OCTAVE_LOCAL_BUFFER (octave_idx_type, ni, np); - - for (i = 0; i < np; i++) + + for (i = 0; i < np; i++) ni[i] = 0; qh_setvoronoi_all (); bool infinity_seen = false; facetT *neighbor, **neighborp; coordT *voronoi_vertex; - FORALLfacets + FORALLfacets { facet->seen = false; } - FORALLvertices + FORALLvertices { if (qh hull_dim == 3) qh_order_vertexneighbors (vertex); @@ -169,13 +169,13 @@ v(0,d) = octave_Inf; boolMatrix AtInf (np, 1); - for (i = 0; i < np; i++) + for (i = 0; i < np; i++) AtInf(i) = false; octave_value_list F (np, octave_value ()); k = 0; i = 0; - FORALLfacets + FORALLfacets { facet->seen = false; } @@ -198,8 +198,8 @@ facet_list(m++) = 1; AtInf(j) = true; } - } - else + } + else { if (! neighbor->seen) { diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/amd.cc --- a/src/DLD-FUNCTIONS/amd.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/amd.cc Thu Jan 20 17:24:59 2011 -0500 @@ -122,7 +122,7 @@ sm = SparseMatrix (real (args(0).complex_matrix_value ())); else sm = SparseMatrix (args(0).matrix_value ()); - + n_row = sm.rows (); n_col = sm.cols (); ridx = sm.xridx (); @@ -139,7 +139,7 @@ if (nargin > 1) { octave_scalar_map arg1 = args(1).scalar_map_value (); - + if (!error_state) { octave_value tmp; @@ -163,7 +163,7 @@ double *Info = xinfo.fortran_vec (); // FIXME -- how can we manage the memory allocation of - // amd in a cleaner manner? + // amd in a cleaner manner? amd_malloc = malloc; amd_free = free; amd_calloc = calloc; diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/balance.cc --- a/src/DLD-FUNCTIONS/balance.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/balance.cc Thu Jan 20 17:24:59 2011 -0500 @@ -110,10 +110,10 @@ return retval; } - bool isfloat = args(0).is_single_type () || - (! AEPcase && args(1).is_single_type()); + bool isfloat = args(0).is_single_type () || + (! AEPcase && args(1).is_single_type()); - bool complex_case = (args(0).is_complex_type () || + bool complex_case = (args(0).is_complex_type () || (! AEPcase && args(1).is_complex_type ())); // Extract argument 1 parameter for both AEP and GEP. @@ -142,7 +142,7 @@ // Treat AEP/GEP cases. if (AEPcase) - { + { // Algebraic eigenvalue problem. bool noperm = false, noscal = false; if (nargin > 1) diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/besselj.cc --- a/src/DLD-FUNCTIONS/besselj.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/besselj.cc Thu Jan 20 17:24:59 2011 -0500 @@ -163,7 +163,7 @@ if (! error_state) { - FloatComplexColumnVector cx = + FloatComplexColumnVector cx = x_arg.float_complex_column_vector_value (); if (! error_state) @@ -217,9 +217,9 @@ { Array ierr; octave_value result; - + DO_BESSEL (type, alpha, x, scaled, ierr, result); - + if (nargout > 1) retval(1) = NDArray (ierr); @@ -298,7 +298,7 @@ if (! error_state) { - ComplexColumnVector cx = + ComplexColumnVector cx = x_arg.complex_column_vector_value (); if (! error_state) @@ -352,9 +352,9 @@ { Array ierr; octave_value result; - + DO_BESSEL (type, alpha, x, scaled, ierr, result); - + if (nargout > 1) retval(1) = NDArray (ierr); @@ -587,7 +587,7 @@ { if (kind < 0 || kind > 3) error ("airy: expecting K = 0, 1, 2, or 3"); - } + } else error ("airy: expecting integer value for K"); } @@ -660,31 +660,31 @@ %! ix = 0.2220184483766341752692212604; %! kx = 0.9410016167388185767085460540; %! -%!assert(besselj(alpha,x), jx, 100*eps) +%!assert(besselj(alpha,x), jx, 100*eps) %!assert(bessely(alpha,x), yx, 100*eps) %!assert(besseli(alpha,x), ix, 100*eps) -%!assert(besselk(alpha,x), kx, 100*eps) +%!assert(besselk(alpha,x), kx, 100*eps) %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) %! -%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) %! -%!assert(besselj(-alpha,x), jx, 100*eps) +%!assert(besselj(-alpha,x), jx, 100*eps) %!assert(bessely(-alpha,x), yx, 100*eps) %!assert(besseli(-alpha,x), ix, 100*eps) -%!assert(besselk(-alpha,x), kx, 100*eps) +%!assert(besselk(-alpha,x), kx, 100*eps) %!assert(besselh(-alpha,1,x), jx + I*yx, 100*eps) %!assert(besselh(-alpha,2,x), jx - I*yx, 100*eps) %! -%!assert(besselj(-alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(-alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(-alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(-alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) %! @@ -692,17 +692,17 @@ %! yx = -1.193199310178553861283790424 + 0.3421822624810469647226182835*I; %! kx = 0.9410016167388185767085460540 - 0.6974915263814386815610060884*I; %! -%!assert(besselj(alpha,x), jx, 100*eps) +%!assert(besselj(alpha,x), jx, 100*eps) %!assert(bessely(alpha,x), yx, 100*eps) %!assert(besseli(alpha,x), ix, 100*eps) -%!assert(besselk(alpha,x), kx, 100*eps) +%!assert(besselk(alpha,x), kx, 100*eps) %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) %! -%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) %! @@ -713,31 +713,31 @@ %! ix = 0.4743704087780355895548240179; %! kx = 0.2682271463934492027663765197; %! -%!assert(besselj(alpha,x), jx, 100*eps) +%!assert(besselj(alpha,x), jx, 100*eps) %!assert(bessely(alpha,x), yx, 100*eps) %!assert(besseli(alpha,x), ix, 100*eps) -%!assert(besselk(alpha,x), kx, 100*eps) +%!assert(besselk(alpha,x), kx, 100*eps) %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) %! -%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) %! -%!assert(besselj(-alpha,x), -jx, 100*eps) +%!assert(besselj(-alpha,x), -jx, 100*eps) %!assert(bessely(-alpha,x), -yx, 100*eps) %!assert(besseli(-alpha,x), ix, 100*eps) -%!assert(besselk(-alpha,x), kx, 100*eps) +%!assert(besselk(-alpha,x), kx, 100*eps) %!assert(besselh(-alpha,1,x), -(jx + I*yx), 100*eps) %!assert(besselh(-alpha,2,x), -(jx - I*yx), 100*eps) %! -%!assert(besselj(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(-alpha,x,1), -yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(-alpha,1,x,1), -(jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(-alpha,2,x,1), -(jx - I*yx)*exp(I*x), 100*eps) %! @@ -747,17 +747,17 @@ %! ix = -ix; %! kx = -0.2682271463934492027663765197 - 1.490278591297463775542004240*I; %! -%!assert(besselj(alpha,x), jx, 100*eps) +%!assert(besselj(alpha,x), jx, 100*eps) %!assert(bessely(alpha,x), yx, 100*eps) %!assert(besseli(alpha,x), ix, 100*eps) -%!assert(besselk(alpha,x), kx, 100*eps) +%!assert(besselk(alpha,x), kx, 100*eps) %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) %! -%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) %! @@ -769,33 +769,33 @@ %! ix = 0.3930540878794826310979363668; %! kx = 0.2844099013460621170288192503; %! -%!assert(besselj(alpha,x), jx, 100*eps) +%!assert(besselj(alpha,x), jx, 100*eps) %!assert(bessely(alpha,x), yx, 100*eps) %!assert(besseli(alpha,x), ix, 100*eps) -%!assert(besselk(alpha,x), kx, 100*eps) +%!assert(besselk(alpha,x), kx, 100*eps) %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) %! -%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) %! %! nix = 0.2119931212254662995364461998; %! -%!assert(besselj(-alpha,x), yx, 100*eps) +%!assert(besselj(-alpha,x), yx, 100*eps) %!assert(bessely(-alpha,x), -jx, 100*eps) %!assert(besseli(-alpha,x), nix, 100*eps) -%!assert(besselk(-alpha,x), kx, 100*eps) +%!assert(besselk(-alpha,x), kx, 100*eps) %!assert(besselh(-alpha,1,x), -I*(jx + I*yx), 100*eps) %!assert(besselh(-alpha,2,x), I*(jx - I*yx), 100*eps) %! -%!assert(besselj(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(-alpha,x,1), nix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(-alpha,1,x,1), -I*(jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(-alpha,2,x,1), I*(jx - I*yx)*exp(I*x), 100*eps) %! @@ -805,17 +805,17 @@ %! ix *= -I; %! kx = -0.9504059335995575096509874508*I; %! -%!assert(besselj(alpha,x), jx, 100*eps) +%!assert(besselj(alpha,x), jx, 100*eps) %!assert(bessely(alpha,x), yx, 100*eps) %!assert(besseli(alpha,x), ix, 100*eps) -%!assert(besselk(alpha,x), kx, 100*eps) +%!assert(besselk(alpha,x), kx, 100*eps) %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) %! -%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) %! @@ -827,31 +827,31 @@ %! ix = -0.6717801680341515541002273932 - 0.2314623443930774099910228553*I; %! kx = -0.01108009888623253515463783379 + 0.2245218229358191588208084197*I; %! -%!assert(besselj(alpha,x), jx, 100*eps) +%!assert(besselj(alpha,x), jx, 100*eps) %!assert(bessely(alpha,x), yx, 100*eps) %!assert(besseli(alpha,x), ix, 100*eps) -%!assert(besselk(alpha,x), kx, 100*eps) +%!assert(besselk(alpha,x), kx, 100*eps) %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) %! -%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) %! -%!assert(besselj(-alpha,x), jx, 100*eps) +%!assert(besselj(-alpha,x), jx, 100*eps) %!assert(bessely(-alpha,x), yx, 100*eps) %!assert(besseli(-alpha,x), ix, 100*eps) -%!assert(besselk(-alpha,x), kx, 100*eps) +%!assert(besselk(-alpha,x), kx, 100*eps) %!assert(besselh(-alpha,1,x), jx + I*yx, 100*eps) %!assert(besselh(-alpha,2,x), jx - I*yx, 100*eps) %! -%!assert(besselj(-alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(-alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(-alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(-alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) %! @@ -863,31 +863,31 @@ %! ix = -0.6182064685486998097516365709 + 0.4677561094683470065767989920*I; %! kx = -0.1568585587733540007867882337 - 0.05185853709490846050505141321*I; %! -%!assert(besselj(alpha,x), jx, 100*eps) +%!assert(besselj(alpha,x), jx, 100*eps) %!assert(bessely(alpha,x), yx, 100*eps) %!assert(besseli(alpha,x), ix, 100*eps) -%!assert(besselk(alpha,x), kx, 100*eps) +%!assert(besselk(alpha,x), kx, 100*eps) %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) %! -%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) %! -%!assert(besselj(-alpha,x), -jx, 100*eps) +%!assert(besselj(-alpha,x), -jx, 100*eps) %!assert(bessely(-alpha,x), -yx, 100*eps) %!assert(besseli(-alpha,x), ix, 100*eps) -%!assert(besselk(-alpha,x), kx, 100*eps) +%!assert(besselk(-alpha,x), kx, 100*eps) %!assert(besselh(-alpha,1,x), -(jx + I*yx), 100*eps) %!assert(besselh(-alpha,2,x), -(jx - I*yx), 100*eps) %! -%!assert(besselj(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(-alpha,x,1), -yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(-alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(-alpha,1,x,1), -(jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(-alpha,2,x,1), -(jx - I*yx)*exp(I*x), 100*eps) %! @@ -899,33 +899,33 @@ %! ix = 0.2100873577220057189038160913 - 0.6551765604618246531254970926*I; %! kx = 0.1757147290513239935341488069 + 0.08772348296883849205562558311*I; %! -%!assert(besselj(alpha,x), jx, 100*eps) +%!assert(besselj(alpha,x), jx, 100*eps) %!assert(bessely(alpha,x), yx, 100*eps) %!assert(besseli(alpha,x), ix, 100*eps) -%!assert(besselk(alpha,x), kx, 100*eps) +%!assert(besselk(alpha,x), kx, 100*eps) %!assert(besselh(alpha,1,x), jx + I*yx, 100*eps) %!assert(besselh(alpha,2,x), jx - I*yx, 100*eps) %! -%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(alpha,x,1), jx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(alpha,x,1), ix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(alpha,1,x,1), (jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(alpha,2,x,1), (jx - I*yx)*exp(I*x), 100*eps) %! %! nix = 0.09822388691172060573913739253 - 0.7110230642207380127317227407*I; %! -%!assert(besselj(-alpha,x), yx, 100*eps) +%!assert(besselj(-alpha,x), yx, 100*eps) %!assert(bessely(-alpha,x), -jx, 100*eps) %!assert(besseli(-alpha,x), nix, 100*eps) -%!assert(besselk(-alpha,x), kx, 100*eps) +%!assert(besselk(-alpha,x), kx, 100*eps) %!assert(besselh(-alpha,1,x), -I*(jx + I*yx), 100*eps) %!assert(besselh(-alpha,2,x), I*(jx - I*yx), 100*eps) %! -%!assert(besselj(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) +%!assert(besselj(-alpha,x,1), yx*exp(-abs(imag(x))), 100*eps) %!assert(bessely(-alpha,x,1), -jx*exp(-abs(imag(x))), 100*eps) %!assert(besseli(-alpha,x,1), nix*exp(-abs(real(x))), 100*eps) -%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) +%!assert(besselk(-alpha,x,1), kx*exp(x), 100*eps) %!assert(besselh(-alpha,1,x,1), -I*(jx + I*yx)*exp(-I*x), 100*eps) %!assert(besselh(-alpha,2,x,1), I*(jx - I*yx)*exp(I*x), 100*eps) */ diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/bsxfun.cc --- a/src/DLD-FUNCTIONS/bsxfun.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/bsxfun.cc Thu Jan 20 17:24:59 2011 -0500 @@ -61,7 +61,7 @@ bsxfun_num_builtin_ops = bsxfun_builtin_unknown }; -const char *bsxfun_builtin_names[] = +const char *bsxfun_builtin_names[] = { "plus", "minus", @@ -80,7 +80,7 @@ "power" }; -static bsxfun_builtin_op +static bsxfun_builtin_op bsxfun_builtin_lookup (const std::string& name) { for (int i = 0; i < bsxfun_num_builtin_ops; i++) @@ -94,8 +94,8 @@ // Static table of handlers. bsxfun_handler bsxfun_handler_table[bsxfun_num_builtin_ops][btyp_num_types]; -template -static octave_value +template +static octave_value bsxfun_forward_op (const octave_value& x, const octave_value& y) { NDA xa = octave_value_extract (x); @@ -103,8 +103,8 @@ return octave_value (bsxfun_op (xa, ya)); } -template -static octave_value +template +static octave_value bsxfun_forward_rel (const octave_value& x, const octave_value& y) { NDA xa = octave_value_extract (x); @@ -167,9 +167,9 @@ REGISTER_OP_HANDLER (bsxfun_builtin_or, btyp_bool, boolNDArray, bsxfun_or); // Register power handlers. - bsxfun_handler_table[bsxfun_builtin_power][btyp_double] = + bsxfun_handler_table[bsxfun_builtin_power][btyp_double] = do_bsxfun_real_pow; - bsxfun_handler_table[bsxfun_builtin_power][btyp_float] = + bsxfun_handler_table[bsxfun_builtin_power][btyp_float] = do_bsxfun_real_pow; REGISTER_OP_HANDLER (bsxfun_builtin_power, btyp_complex, ComplexNDArray, bsxfun_pow); @@ -221,7 +221,7 @@ } static bool -maybe_update_column (octave_value& Ac, const octave_value& A, +maybe_update_column (octave_value& Ac, const octave_value& A, const dim_vector& dva, const dim_vector& dvc, octave_idx_type i, octave_value_list &idx) { @@ -345,7 +345,7 @@ const octave_value A = args (1); const octave_value B = args (2); - if (func.is_builtin_function () + if (func.is_builtin_function () || (func.is_function_handle () && ! A.is_object () && ! B.is_object ())) { // This may break if the default behavior is overriden. But if you override @@ -368,7 +368,7 @@ dim_vector dvb = B.dims (); octave_idx_type ndb = dvb.length (); octave_idx_type nd = nda; - + if (nda > ndb) dvb.resize (nda, 1); else if (nda < ndb) @@ -389,7 +389,7 @@ // Find the size of the output dim_vector dvc; dvc.resize (nd); - + for (octave_idx_type i = 0; i < nd; i++) dvc (i) = (dva (i) < 1 ? dva (i) : (dvb (i) < 1 ? dvb (i) : (dva (i) > dvb (i) ? dva (i) : dvb (i)))); @@ -399,14 +399,14 @@ octave_value_list inputs; inputs (0) = A; inputs (1) = B; - retval = func.do_multi_index_op (1, inputs); + retval = func.do_multi_index_op (1, inputs); } else if (dvc.numel () < 1) { octave_value_list inputs; inputs (0) = A.resize (dvc); inputs (1) = B.resize (dvc); - retval = func.do_multi_index_op (1, inputs); + retval = func.do_multi_index_op (1, inputs); } else { @@ -448,8 +448,8 @@ if (maybe_update_column (Bc, B, dvb, dvc, i, idxB)) inputs (1) = Bc; - - octave_value_list tmp = func.do_multi_index_op (1, inputs); + + octave_value_list tmp = func.do_multi_index_op (1, inputs); if (error_state) break; @@ -479,7 +479,7 @@ else { have_ComplexNDArray = true; - result_ComplexNDArray = + result_ComplexNDArray = tmp(0).complex_array_value (); result_ComplexNDArray.resize (dvc); } @@ -495,7 +495,7 @@ else { have_ComplexNDArray = true; - result_ComplexNDArray = + result_ComplexNDArray = tmp(0).complex_array_value (); result_ComplexNDArray.resize (dvc); } @@ -519,7 +519,7 @@ else { update_index (ra_idx, dvc, i); - + if (have_FloatNDArray || have_FloatComplexNDArray) { @@ -539,34 +539,34 @@ } else if (tmp(0).is_double_type ()) { - if (tmp(0).is_complex_type () && + if (tmp(0).is_complex_type () && have_FloatNDArray) { - result_ComplexNDArray = + result_ComplexNDArray = ComplexNDArray (result_FloatNDArray); - result_ComplexNDArray.insert + result_ComplexNDArray.insert (tmp(0).complex_array_value(), ra_idx); have_FloatComplexNDArray = false; have_ComplexNDArray = true; } else { - result_NDArray = + result_NDArray = NDArray (result_FloatNDArray); - result_NDArray.insert + result_NDArray.insert (tmp(0).array_value(), ra_idx); have_FloatNDArray = false; have_NDArray = true; } } else if (tmp(0).is_real_type ()) - result_FloatNDArray.insert + result_FloatNDArray.insert (tmp(0).float_array_value(), ra_idx); else { - result_FloatComplexNDArray = + result_FloatComplexNDArray = FloatComplexNDArray (result_FloatNDArray); - result_FloatComplexNDArray.insert + result_FloatComplexNDArray.insert (tmp(0).float_complex_array_value(), ra_idx); have_FloatNDArray = false; have_FloatComplexNDArray = true; @@ -581,13 +581,13 @@ 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 = + result_ComplexNDArray = ComplexNDArray (result_NDArray); - result_ComplexNDArray.insert + result_ComplexNDArray.insert (tmp(0).complex_array_value(), ra_idx); have_NDArray = false; have_ComplexNDArray = true; @@ -646,7 +646,7 @@ } } } - } + } return retval; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/ccolamd.cc --- a/src/DLD-FUNCTIONS/ccolamd.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/ccolamd.cc Thu Jan 20 17:24:59 2011 -0500 @@ -148,13 +148,13 @@ int nargin = args.length (); int spumoni = 0; - + if (nargout > 2 || nargin < 1 || nargin > 3) usage ("ccolamd: incorrect number of input and/or output arguments"); else { // Get knobs - OCTAVE_LOCAL_BUFFER (double, knobs, CCOLAMD_KNOBS); + OCTAVE_LOCAL_BUFFER (double, knobs, CCOLAMD_KNOBS); CCOLAMD_NAME (_set_defaults) (knobs); // Check for user-passed knobs @@ -163,22 +163,22 @@ NDArray User_knobs = args(1).array_value (); int nel_User_knobs = User_knobs.length (); - if (nel_User_knobs > 0) + if (nel_User_knobs > 0) knobs [CCOLAMD_LU] = (User_knobs (0) != 0); - if (nel_User_knobs > 1) + if (nel_User_knobs > 1) knobs [CCOLAMD_DENSE_ROW] = User_knobs (1); - if (nel_User_knobs > 2) + if (nel_User_knobs > 2) knobs [CCOLAMD_DENSE_COL] = User_knobs (2); - if (nel_User_knobs > 3) + if (nel_User_knobs > 3) knobs [CCOLAMD_AGGRESSIVE] = (User_knobs (3) != 0); - if (nel_User_knobs > 4) + if (nel_User_knobs > 4) spumoni = (User_knobs (4) != 0); // print knob settings if spumoni is set if (spumoni) { octave_stdout << "\nccolamd version " << CCOLAMD_MAIN_VERSION << "." - << CCOLAMD_SUB_VERSION << ", " << CCOLAMD_DATE + << CCOLAMD_SUB_VERSION << ", " << CCOLAMD_DATE << ":\nknobs(1): " << User_knobs (0) << ", order for "; if ( knobs [CCOLAMD_LU] != 0) octave_stdout << "lu(A)\n"; @@ -186,7 +186,7 @@ octave_stdout << "chol(A'*A)\n"; if (knobs [CCOLAMD_DENSE_ROW] >= 0) - octave_stdout << "knobs(2): " << User_knobs (1) + octave_stdout << "knobs(2): " << User_knobs (1) << ", rows with > max(16," << knobs [CCOLAMD_DENSE_ROW] << "*sqrt(size(A,2)))" << " entries removed\n"; @@ -195,7 +195,7 @@ << ", no dense rows removed\n"; if (knobs [CCOLAMD_DENSE_COL] >= 0) - octave_stdout << "knobs(3): " << User_knobs (2) + octave_stdout << "knobs(3): " << User_knobs (2) << ", cols with > max(16," << knobs [CCOLAMD_DENSE_COL] << "*sqrt(size(A)))" << " entries removed\n"; @@ -204,17 +204,17 @@ << ", no dense columns removed\n"; if (knobs [CCOLAMD_AGGRESSIVE] != 0) - octave_stdout << "knobs(4): " << User_knobs(3) + octave_stdout << "knobs(4): " << User_knobs(3) << ", aggressive absorption: yes"; else - octave_stdout << "knobs(4): " << User_knobs(3) + octave_stdout << "knobs(4): " << User_knobs(3) << ", aggressive absorption: no"; - - octave_stdout << "knobs(5): " << User_knobs (4) + + octave_stdout << "knobs(5): " << User_knobs (4) << ", statistics and knobs printed\n"; } } - + octave_idx_type n_row, n_col, nnz; octave_idx_type *ridx, *cidx; SparseComplexMatrix scm; @@ -276,7 +276,7 @@ for (octave_idx_type i = 0; i < cslen; i++) // convert cmember from 1-based to 0-based cmember[i] = static_cast(in_cmember(i) - 1); - + if (cslen != n_col) error ("ccolamd: CMEMBER must be of length equal to #cols of A"); else @@ -318,11 +318,11 @@ out_stats (i) = stats [i] ; retval(1) = out_stats; - // fix stats (5) and (6), for 1-based information on - // jumbled matrix. note that this correction doesn't + // fix stats (5) and (6), for 1-based information on + // jumbled matrix. note that this correction doesn't // occur if symamd returns FALSE - out_stats (CCOLAMD_INFO1) ++ ; - out_stats (CCOLAMD_INFO2) ++ ; + out_stats (CCOLAMD_INFO1) ++ ; + out_stats (CCOLAMD_INFO2) ++ ; } } @@ -403,7 +403,7 @@ int nargin = args.length (); int spumoni = 0; - + if (nargout > 2 || nargin < 1 || nargin > 3) usage ("ccolamd: incorrect number of input and/or output arguments"); else @@ -417,12 +417,12 @@ { NDArray User_knobs = args(1).array_value (); int nel_User_knobs = User_knobs.length (); - - if (nel_User_knobs > 0) + + if (nel_User_knobs > 0) knobs [CCOLAMD_DENSE_ROW] = User_knobs (0); - if (nel_User_knobs > 0) + if (nel_User_knobs > 0) knobs [CCOLAMD_AGGRESSIVE] = User_knobs (1); - if (nel_User_knobs > 1) + if (nel_User_knobs > 1) spumoni = static_cast (User_knobs (2)); // print knob settings if spumoni is set @@ -432,7 +432,7 @@ << CCOLAMD_SUB_VERSION << ", " << CCOLAMD_DATE << "\n"; if (knobs [CCOLAMD_DENSE_ROW] >= 0) - octave_stdout << "knobs(1): " << User_knobs (0) + octave_stdout << "knobs(1): " << User_knobs (0) << ", rows/cols with > max(16," << knobs [CCOLAMD_DENSE_ROW] << "*sqrt(size(A,2)))" << " entries removed\n"; @@ -441,18 +441,18 @@ << ", no dense rows/cols removed\n"; if (knobs [CCOLAMD_AGGRESSIVE] != 0) - octave_stdout << "knobs(2): " << User_knobs(1) + octave_stdout << "knobs(2): " << User_knobs(1) << ", aggressive absorption: yes"; else - octave_stdout << "knobs(2): " << User_knobs(1) + octave_stdout << "knobs(2): " << User_knobs(1) << ", aggressive absorption: no"; - + - octave_stdout << "knobs(3): " << User_knobs (2) + octave_stdout << "knobs(3): " << User_knobs (2) << ", statistics and knobs printed\n"; } } - + octave_idx_type n_row, n_col, nnz; octave_idx_type *ridx, *cidx; SparseMatrix sm; @@ -485,7 +485,7 @@ sm = SparseMatrix (real (args(0).complex_matrix_value ())); else sm = SparseMatrix (args(0).matrix_value ()); - + n_row = sm.rows (); n_col = sm.cols (); nnz = sm.nnz (); @@ -511,11 +511,11 @@ for (octave_idx_type i = 0; i < cslen; i++) // convert cmember from 1-based to 0-based cmember[i] = static_cast(in_cmember(i) - 1); - + if (cslen != n_col) error ("csymamd: CMEMBER must be of length equal to #cols of A"); else - if (!CSYMAMD_NAME () (n_col, ridx, cidx, perm, knobs, stats, + if (!CSYMAMD_NAME () (n_col, ridx, cidx, perm, knobs, stats, &calloc, &free, cmember, -1)) { CSYMAMD_NAME (_report) (stats) ; @@ -525,7 +525,7 @@ } else { - if (!CSYMAMD_NAME () (n_col, ridx, cidx, perm, knobs, stats, + if (!CSYMAMD_NAME () (n_col, ridx, cidx, perm, knobs, stats, &calloc, &free, 0, -1)) { CSYMAMD_NAME (_report) (stats) ; @@ -549,11 +549,11 @@ out_stats (i) = stats [i] ; retval(1) = out_stats; - // fix stats (5) and (6), for 1-based information on - // jumbled matrix. note that this correction doesn't + // fix stats (5) and (6), for 1-based information on + // jumbled matrix. note that this correction doesn't // occur if symamd returns FALSE - out_stats (CCOLAMD_INFO1) ++ ; - out_stats (CCOLAMD_INFO2) ++ ; + out_stats (CCOLAMD_INFO1) ++ ; + out_stats (CCOLAMD_INFO2) ++ ; } // print stats if spumoni > 0 @@ -568,11 +568,11 @@ out_stats (i) = stats [i] ; retval(1) = out_stats; - // fix stats (5) and (6), for 1-based information on - // jumbled matrix. note that this correction doesn't + // fix stats (5) and (6), for 1-based information on + // jumbled matrix. note that this correction doesn't // occur if symamd returns FALSE - out_stats (CCOLAMD_INFO1) ++ ; - out_stats (CCOLAMD_INFO2) ++ ; + out_stats (CCOLAMD_INFO1) ++ ; + out_stats (CCOLAMD_INFO2) ++ ; } } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/cellfun.cc --- a/src/DLD-FUNCTIONS/cellfun.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/cellfun.cc Thu Jan 20 17:24:59 2011 -0500 @@ -58,7 +58,7 @@ #include "ov-uint32.h" #include "ov-uint64.h" -static octave_value_list +static octave_value_list get_output_list (octave_idx_type count, octave_idx_type nargout, const octave_value_list& inputlist, octave_value& func, @@ -227,7 +227,7 @@ return retval; } - + if (func.is_string ()) { const Cell f_args = args(1).cell_value (); @@ -237,7 +237,7 @@ std::string name = func.string_value (); if (name == "isempty") - { + { boolNDArray result (f_args.dims ()); for (octave_idx_type count = 0; count < k ; count++) result(count) = f_args.elem(count).is_empty (); @@ -327,7 +327,7 @@ std::string fname = "function y = "; fname.append (fcn_name); fname.append ("(x) y = "); - octave_function *ptr_func = extract_function (args(0), "cellfun", + octave_function *ptr_func = extract_function (args(0), "cellfun", fcn_name, fname, "; endfunction"); if (ptr_func && ! error_state) func = octave_value (ptr_func, true); @@ -357,14 +357,14 @@ { std::string arg = args(nargin-2).string_value(); - std::transform (arg.begin (), arg.end (), + std::transform (arg.begin (), arg.end (), arg.begin (), tolower); if (arg == "uniformoutput") uniform_output = args(nargin-1).bool_value(); else if (arg == "errorhandler") { - if (args(nargin-1).is_function_handle () || + if (args(nargin-1).is_function_handle () || args(nargin-1).is_inline_function ()) { error_handler = args(nargin-1); @@ -387,7 +387,7 @@ } else { - error ("cellfun: unrecognized parameter %s", + error ("cellfun: unrecognized parameter %s", arg.c_str()); break; } @@ -978,7 +978,7 @@ @end example\n\ \n\ @seealso{mat2cell}\n\ -@end deftypefn") +@end deftypefn") { int nargin = args.length(); octave_value retval; @@ -1053,7 +1053,7 @@ */ -static bool +static bool mat2cell_mismatch (const dim_vector& dv, const Array *d, int nd) { @@ -1077,7 +1077,7 @@ } template -static void +static void prepare_idx (container *idx, int idim, int nd, const Array* d) { @@ -1252,7 +1252,7 @@ } OCTAVE_LOCAL_BUFFER_INIT (octave_idx_type, ridx, nd, 0); - octave_value_list ra_idx (std::max (nd, a.ndims ()), + octave_value_list ra_idx (std::max (nd, a.ndims ()), octave_value::magic_colon_t); for (octave_idx_type j = 0; j < retval.numel (); j++) @@ -1409,16 +1409,16 @@ // FIXME: it would be nice to allow ranges being handled without a conversion. template -static Cell -do_cellslices_nda (const NDA& array, - const Array& lb, +static Cell +do_cellslices_nda (const NDA& array, + const Array& lb, const Array& ub, int dim = -1) { octave_idx_type n = lb.length (); Cell retval (1, n); - if (array.is_vector () && (dim == -1 - || (dim == 0 && array.columns () == 1) + if (array.is_vector () && (dim == -1 + || (dim == 0 && array.columns () == 1) || (dim == 1 && array.rows () == 1))) { for (octave_idx_type i = 0; i < n && ! error_state; i++) diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/chol.cc --- a/src/DLD-FUNCTIONS/chol.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/chol.cc Thu Jan 20 17:24:59 2011 -0500 @@ -48,7 +48,7 @@ static octave_value get_chol_r (const CHOLT& fact) { - return octave_value (fact.chol_matrix (), + return octave_value (fact.chol_matrix (), MatrixType (MatrixType::Upper)); } @@ -56,7 +56,7 @@ static octave_value get_chol_l (const CHOLT& fact) { - return octave_value (fact.chol_matrix ().transpose (), + return octave_value (fact.chol_matrix ().transpose (), MatrixType (MatrixType::Lower)); } @@ -138,7 +138,7 @@ bool LLt = false; bool vecout = false; - if (nargin < 1 || nargin > 3 || nargout > 3 + if (nargin < 1 || nargin > 3 || nargout > 3 || (! args(0).is_sparse_type () && nargout > 2)) { print_usage (); @@ -168,7 +168,7 @@ if (! error_state) { octave_value arg = args(0); - + octave_idx_type nr = arg.rows (); octave_idx_type nc = arg.columns (); bool natural = (nargout != 3); @@ -226,7 +226,7 @@ else retval(2) = fact.Q(); } - + if (nargout > 1 || info == 0) { retval(1) = fact.P(); @@ -364,7 +364,7 @@ if (nargin == 1) { octave_value arg = args(0); - + octave_idx_type nr = arg.rows (); octave_idx_type nc = arg.columns (); @@ -517,7 +517,7 @@ if (nargin == 1) { octave_value arg = args(0); - + octave_idx_type nr = arg.rows (); octave_idx_type nc = arg.columns (); @@ -741,7 +741,7 @@ %! -0.131721 0.738529 0.019851 -0.140295 ; %! 0.124120 0.019851 0.354879 -0.059472 ; %! -0.061673 -0.140295 -0.059472 0.600939 ]; -%! +%! %! u = [ 0.98950 ; %! 0.39844 ; %! 0.63484 ; @@ -750,7 +750,7 @@ %! -0.1662088 + 0.0315341i 0.6760061 + 0.0000000i 0.0011452 - 0.0475528i 0.0145967 + 0.0247641i ; %! 0.0107873 - 0.0236411i 0.0011452 + 0.0475528i 0.6263149 - 0.0000000i -0.1585837 - 0.0719763i ; %! -0.0276775 + 0.0186073i 0.0145967 - 0.0247641i -0.1585837 + 0.0719763i 0.6034234 - 0.0000000i ]; -%! +%! %! uc = [ 0.54267 + 0.91519i ; %! 0.99647 + 0.43141i ; %! 0.83760 + 0.68977i ; @@ -760,53 +760,53 @@ %!test %! R = chol(A); -%! +%! %! R1 = cholupdate(R,u); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - R'*R - u*u',Inf) < 1e1*eps) -%! +%! %! R1 = cholupdate(R1,u,"-"); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1 - R,Inf) < 1e1*eps) -%! +%! %!test %! R = chol(Ac); -%! +%! %! R1 = cholupdate(R,uc); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - R'*R - uc*uc',Inf) < 1e1*eps) -%! +%! %! R1 = cholupdate(R1,uc,"-"); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1 - R,Inf) < 1e1*eps) %!test %! R = chol(single(A)); -%! +%! %! R1 = cholupdate(R,single(u)); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - R'*R - single(u*u'),Inf) < 1e1*eps('single')) -%! +%! %! R1 = cholupdate(R1,single(u),"-"); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1 - R,Inf) < 2e1*eps('single')) -%! +%! %!test %! R = chol(single(Ac)); -%! +%! %! R1 = cholupdate(R,single(uc)); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - R'*R - single(uc*uc'),Inf) < 1e1*eps('single')) -%! +%! %! R1 = cholupdate(R1,single(uc),"-"); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1 - R,Inf) < 2e1*eps('single')) */ @@ -943,13 +943,13 @@ %! 0.45266 ]; %! %! R = chol(A); -%! +%! %! j = 3; p = [1:j-1, j+1:5]; %! R1 = cholinsert(R,j,u2); A1 = R1'*R1; -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(A1(p,p) - A,Inf) < 1e1*eps) -%! +%! %!test %! u2 = [ 0.35080 + 0.04298i; %! 0.63930 + 0.23778i; @@ -958,13 +958,13 @@ %! 0.45266 + 0.50020i]; %! %! R = chol(Ac); -%! +%! %! j = 3; p = [1:j-1, j+1:5]; %! R1 = cholinsert(R,j,u2); A1 = R1'*R1; -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(A1(p,p) - Ac,Inf) < 1e1*eps) -%! +%! %!test %! u2 = single ([ 0.35080 ; @@ -974,13 +974,13 @@ %! 0.45266 ]); %! %! R = chol(single(A)); -%! +%! %! j = 3; p = [1:j-1, j+1:5]; %! R1 = cholinsert(R,j,u2); A1 = R1'*R1; -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(A1(p,p) - A,Inf) < 1e1*eps('single')) -%! +%! %!test %! u2 = single ([ 0.35080 + 0.04298i; %! 0.63930 + 0.23778i; @@ -989,13 +989,13 @@ %! 0.45266 + 0.50020i]); %! %! R = chol(single(Ac)); -%! +%! %! j = 3; p = [1:j-1, j+1:5]; %! R1 = cholinsert(R,j,u2); A1 = R1'*R1; -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(A1(p,p) - single(Ac),Inf) < 2e1*eps('single')) -%! +%! */ DEFUN_DLD (choldelete, args, , @@ -1096,37 +1096,37 @@ /* %!test %! R = chol(A); -%! +%! %! j = 3; p = [1:j-1,j+1:4]; %! R1 = choldelete(R,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - A(p,p),Inf) < 1e1*eps) -%! +%! %!test %! R = chol(Ac); -%! +%! %! j = 3; p = [1:j-1,j+1:4]; %! R1 = choldelete(R,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - Ac(p,p),Inf) < 1e1*eps) %!test %! R = chol(single(A)); -%! +%! %! j = 3; p = [1:j-1,j+1:4]; %! R1 = choldelete(R,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - single(A(p,p)),Inf) < 1e1*eps('single')) -%! +%! %!test %! R = chol(single(Ac)); -%! +%! %! j = 3; p = [1:j-1,j+1:4]; %! R1 = choldelete(R,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - single(Ac(p,p)),Inf) < 1e1*eps('single')) */ @@ -1170,7 +1170,7 @@ if (j > 0 && j <= n+1 && i > 0 && i <= n+1) { - if (argr.is_single_type () && argi.is_single_type () && + if (argr.is_single_type () && argi.is_single_type () && argj.is_single_type ()) { if (argr.is_real_type ()) @@ -1237,61 +1237,61 @@ /* %!test %! R = chol(A); -%! +%! %! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4]; %! R1 = cholshift(R,i,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - A(p,p),Inf) < 1e1*eps) -%! +%! %! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4]; %! R1 = cholshift(R,i,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - A(p,p),Inf) < 1e1*eps) -%! +%! %!test %! R = chol(Ac); -%! +%! %! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4]; %! R1 = cholshift(R,i,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - Ac(p,p),Inf) < 1e1*eps) -%! +%! %! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4]; %! R1 = cholshift(R,i,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - Ac(p,p),Inf) < 1e1*eps) %!test %! R = chol(single(A)); -%! +%! %! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4]; %! R1 = cholshift(R,i,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - single(A(p,p)),Inf) < 1e1*eps('single')) -%! +%! %! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4]; %! R1 = cholshift(R,i,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - single(A(p,p)),Inf) < 1e1*eps('single')) -%! +%! %!test %! R = chol(single(Ac)); -%! +%! %! i = 1; j = 3; p = [1:i-1, shift(i:j,-1), j+1:4]; %! R1 = cholshift(R,i,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - single(Ac(p,p)),Inf) < 1e1*eps('single')) -%! +%! %! j = 1; i = 3; p = [1:j-1, shift(j:i,+1), i+1:4]; %! R1 = cholshift(R,i,j); -%! +%! %! assert(norm(triu(R1)-R1,Inf) == 0) %! assert(norm(R1'*R1 - single(Ac(p,p)),Inf) < 1e1*eps('single')) */ diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/colamd.cc --- a/src/DLD-FUNCTIONS/colamd.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/colamd.cc Thu Jan 20 17:24:59 2011 -0500 @@ -52,10 +52,10 @@ #define SYMAMD_NAME(name) symamd ## name #endif -// The symmetric column elimination tree code take from the Davis LDL code. +// The symmetric column elimination tree code take from the Davis LDL code. // Copyright given elsewhere in this file. static void -symetree (const octave_idx_type *ridx, const octave_idx_type *cidx, +symetree (const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *Parent, octave_idx_type *P, octave_idx_type n) { OCTAVE_LOCAL_BUFFER (octave_idx_type, Flag, n); @@ -68,8 +68,8 @@ for (octave_idx_type k = 0 ; k < n ; k++) { // L(k,:) pattern: all nodes reachable in etree from nz in A(0:k-1,k) - Parent [k] = n ; // parent of k is not yet known - Flag [k] = k ; // mark node k as visited + Parent [k] = n ; // parent of k is not yet known + Flag [k] = k ; // mark node k as visited octave_idx_type kk = (P) ? (P [k]) : (k) ; // kth original, or permuted, column octave_idx_type p2 = cidx [kk+1] ; for (octave_idx_type p = cidx [kk] ; p < p2 ; p++) @@ -78,7 +78,7 @@ octave_idx_type i = (Pinv) ? (Pinv [ridx [p]]) : (ridx [p]) ; if (i < k) { - // follow path from i to root of etree, stop at flagged node + // follow path from i to root of etree, stop at flagged node for ( ; Flag [i] != k ; i = Parent [i]) { // find parent of i if not yet determined @@ -110,7 +110,7 @@ find (octave_idx_type i, octave_idx_type *pp) { register octave_idx_type p, gp; - + p = pp[i]; gp = pp[p]; @@ -126,8 +126,8 @@ } static octave_idx_type -etdfs (octave_idx_type v, octave_idx_type *first_kid, - octave_idx_type *next_kid, octave_idx_type *post, +etdfs (octave_idx_type v, octave_idx_type *first_kid, + octave_idx_type *next_kid, octave_idx_type *post, octave_idx_type postnum) { for (octave_idx_type w = first_kid[v]; w != -1; w = next_kid[w]) @@ -150,7 +150,7 @@ for (octave_idx_type v = 0; v <= n; first_kid[v++] = -1) /* do nothing */; - for (octave_idx_type v = n-1; v >= 0; v--) + for (octave_idx_type v = n-1; v >= 0; v--) { octave_idx_type dad = parent[v]; next_kid[v] = first_kid[dad]; @@ -163,7 +163,7 @@ static void coletree (const octave_idx_type *ridx, const octave_idx_type *colbeg, - octave_idx_type *colend, octave_idx_type *parent, + octave_idx_type *colend, octave_idx_type *parent, octave_idx_type nr, octave_idx_type nc) { OCTAVE_LOCAL_BUFFER (octave_idx_type, root, nc); @@ -174,8 +174,8 @@ for (octave_idx_type row = 0; row < nr; firstcol[row++] = nc) /* do nothing */; - for (octave_idx_type col = 0; col < nc; col++) - for (octave_idx_type p = colbeg[col]; p < colend[col]; p++) + for (octave_idx_type col = 0; col < nc; col++) + for (octave_idx_type p = colbeg[col]; p < colend[col]; p++) { octave_idx_type row = ridx[p]; if (firstcol[row] > col) @@ -186,19 +186,19 @@ // except use (firstcol[r],c) in place of an edge (r,c) of A. // Thus each row clique in A'*A is replaced by a star // centered at its first vertex, which has the same fill. - for (octave_idx_type col = 0; col < nc; col++) + for (octave_idx_type col = 0; col < nc; col++) { octave_idx_type cset = make_set (col, pp); root[cset] = col; - parent[col] = nc; - for (octave_idx_type p = colbeg[col]; p < colend[col]; p++) + parent[col] = nc; + for (octave_idx_type p = colbeg[col]; p < colend[col]; p++) { octave_idx_type row = firstcol[ridx[p]]; - if (row >= col) + if (row >= col) continue; octave_idx_type rset = find (row, pp); octave_idx_type rroot = root[rset]; - if (rroot != col) + if (rroot != col) { parent[rroot] = col; cset = link (cset, rset, pp); @@ -283,13 +283,13 @@ int nargin = args.length (); int spumoni = 0; - + if (nargout > 2 || nargin < 1 || nargin > 2) print_usage (); else { // Get knobs - OCTAVE_LOCAL_BUFFER (double, knobs, COLAMD_KNOBS); + OCTAVE_LOCAL_BUFFER (double, knobs, COLAMD_KNOBS); COLAMD_NAME (_set_defaults) (knobs); // Check for user-passed knobs @@ -297,12 +297,12 @@ { NDArray User_knobs = args(1).array_value (); int nel_User_knobs = User_knobs.length (); - - if (nel_User_knobs > 0) + + if (nel_User_knobs > 0) knobs [COLAMD_DENSE_ROW] = User_knobs (0); - if (nel_User_knobs > 1) + if (nel_User_knobs > 1) knobs [COLAMD_DENSE_COL] = User_knobs (1) ; - if (nel_User_knobs > 2) + if (nel_User_knobs > 2) spumoni = static_cast (User_knobs (2)); // print knob settings if spumoni is set @@ -313,7 +313,7 @@ << COLAMD_SUB_VERSION << ", " << COLAMD_DATE << ":\n"; if (knobs [COLAMD_DENSE_ROW] >= 0) - octave_stdout << "knobs(1): " << User_knobs (0) + octave_stdout << "knobs(1): " << User_knobs (0) << ", rows with > max(16," << knobs [COLAMD_DENSE_ROW] << "*sqrt(size(A,2)))" << " entries removed\n"; @@ -322,7 +322,7 @@ << ", only completely dense rows removed\n"; if (knobs [COLAMD_DENSE_COL] >= 0) - octave_stdout << "knobs(2): " << User_knobs (1) + octave_stdout << "knobs(2): " << User_knobs (1) << ", cols with > max(16," << knobs [COLAMD_DENSE_COL] << "*sqrt(size(A)))" << " entries removed\n"; @@ -330,12 +330,12 @@ octave_stdout << "knobs(2): " << User_knobs (1) << ", only completely dense columns removed\n"; - octave_stdout << "knobs(3): " << User_knobs (2) + octave_stdout << "knobs(3): " << User_knobs (2) << ", statistics and knobs printed\n"; } } - + octave_idx_type n_row, n_col, nnz; octave_idx_type *ridx, *cidx; SparseComplexMatrix scm; @@ -431,11 +431,11 @@ out_stats (i) = stats [i] ; retval(1) = out_stats; - // fix stats (5) and (6), for 1-based information on - // jumbled matrix. note that this correction doesn't + // fix stats (5) and (6), for 1-based information on + // jumbled matrix. note that this correction doesn't // occur if symamd returns FALSE - out_stats (COLAMD_INFO1) ++ ; - out_stats (COLAMD_INFO2) ++ ; + out_stats (COLAMD_INFO1) ++ ; + out_stats (COLAMD_INFO2) ++ ; } } @@ -518,7 +518,7 @@ int nargin = args.length (); int spumoni = 0; - + if (nargout > 2 || nargin < 1 || nargin > 2) print_usage (); else @@ -532,18 +532,18 @@ { NDArray User_knobs = args(1).array_value (); int nel_User_knobs = User_knobs.length (); - - if (nel_User_knobs > 0) + + if (nel_User_knobs > 0) knobs [COLAMD_DENSE_ROW] = User_knobs (COLAMD_DENSE_ROW); - if (nel_User_knobs > 1) + if (nel_User_knobs > 1) spumoni = static_cast (User_knobs (1)); } // print knob settings if spumoni is set if (spumoni > 0) - octave_stdout << "symamd: dense row/col fraction: " + octave_stdout << "symamd: dense row/col fraction: " << knobs [COLAMD_DENSE_ROW] << std::endl; - + octave_idx_type n_row, n_col, nnz; octave_idx_type *ridx, *cidx; SparseMatrix sm; @@ -576,7 +576,7 @@ sm = SparseMatrix (real (args(0).complex_matrix_value ())); else sm = SparseMatrix (args(0).matrix_value ()); - + n_row = sm.rows (); n_col = sm.cols (); nnz = sm.nnz (); @@ -627,11 +627,11 @@ out_stats (i) = stats [i] ; retval(1) = out_stats; - // fix stats (5) and (6), for 1-based information on - // jumbled matrix. note that this correction doesn't + // fix stats (5) and (6), for 1-based information on + // jumbled matrix. note that this correction doesn't // occur if symamd returns FALSE - out_stats (COLAMD_INFO1) ++ ; - out_stats (COLAMD_INFO2) ++ ; + out_stats (COLAMD_INFO1) ++ ; + out_stats (COLAMD_INFO2) ++ ; } } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/colloc.cc --- a/src/DLD-FUNCTIONS/colloc.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/colloc.cc Thu Jan 20 17:24:59 2011 -0500 @@ -122,7 +122,7 @@ error ("colloc: the total number of roots must be positive"); return retval; } - + CollocWt wts (ncol, left, right); ColumnVector r = wts.roots (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/convhulln.cc --- a/src/DLD-FUNCTIONS/convhulln.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/convhulln.cc Thu Jan 20 17:24:59 2011 -0500 @@ -73,15 +73,15 @@ std::string options; int nargin = args.length (); - if (nargin < 1 || nargin > 2) + if (nargin < 1 || nargin > 2) { print_usage (); return retval; } - if (nargin == 2) + if (nargin == 2) { - if (args (1).is_string ()) + if (args (1).is_string ()) options = args(1).string_value (); else if (args(1).is_cell ()) { @@ -133,7 +133,7 @@ strcpy (flags, buf_string.c_str ()); - if (! qh_new_qhull (dim, n, pt_array, ismalloc, flags, 0, stderr)) + if (! qh_new_qhull (dim, n, pt_array, ismalloc, flags, 0, stderr)) { // If you want some debugging information replace the NULL // pointer with stdout @@ -146,28 +146,28 @@ Matrix idx (nf, dim); octave_idx_type j, i = 0; - FORALLfacets + FORALLfacets { j = 0; if (! facet->simplicial) // should never happen with QJ error ("convhulln: non-simplicial facet"); - if (dim == 3) + if (dim == 3) { vertices = qh_facet3vertex (facet); FOREACHvertex_ (vertices) idx(i, j++) = 1 + qh_pointid(vertex->point); qh_settempfree (&vertices); - } - else + } + else { - if (facet->toporient ^ qh_ORIENTclock) + if (facet->toporient ^ qh_ORIENTclock) { FOREACHvertex_ (facet->vertices) idx(i, j++) = 1 + qh_pointid(vertex->point); - } - else + } + else { FOREACHvertexreverse12_ (facet->vertices) idx(i, j++) = 1 + qh_pointid(vertex->point); @@ -223,7 +223,7 @@ int curlong, totlong; qh_memfreeshort (&curlong, &totlong); - if (curlong || totlong) + if (curlong || totlong) warning ("convhulln: did not free %d bytes of long memory (%d pieces)", totlong, curlong); #else diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/daspk.cc --- a/src/DLD-FUNCTIONS/daspk.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/daspk.cc Thu Jan 20 17:24:59 2011 -0500 @@ -312,7 +312,7 @@ daspk_fcn = extract_function (c(0), "daspk", fcn_name, fname, "; endfunction"); } - + if (daspk_fcn) { if (c(1).is_function_handle () || c(1).is_inline_function ()) diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/dasrt.cc --- a/src/DLD-FUNCTIONS/dasrt.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/dasrt.cc Thu Jan 20 17:24:59 2011 -0500 @@ -443,11 +443,11 @@ dasrt_f = extract_function (f_arg, "dasrt", fcn_name, fname, "; endfunction"); break; - + case 2: { string_vector tmp = args(0).all_strings (); - + if (! error_state) { fcn_name = unique_symbol_name ("__dasrt_fcn__"); @@ -456,7 +456,7 @@ fname.append (" (x, xdot, t) y = "); dasrt_f = extract_function (tmp(0), "dasrt", fcn_name, fname, "; endfunction"); - + if (dasrt_f) { jac_name = unique_symbol_name ("__dasrt_jac__"); @@ -472,21 +472,21 @@ } } break; - + default: DASRT_ABORT1 ("first arg should be a string or 2-element string array"); } } } - + if (error_state || (! dasrt_f)) DASRT_ABORT; - + DAERTFunc func (dasrt_user_f); - + argp++; - + if (args(1).is_function_handle() || args(1).is_inline_function()) { dasrt_cf = args(1).function_value(); @@ -517,7 +517,7 @@ ColumnVector stateprime (args(argp++).vector_value ()); if (error_state) - DASRT_ABORT2 + DASRT_ABORT2 ("expecting time derivative of state vector as argument %d", argp); ColumnVector out_times (args(argp++).vector_value ()); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/dassl.cc --- a/src/DLD-FUNCTIONS/dassl.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/dassl.cc Thu Jan 20 17:24:59 2011 -0500 @@ -313,7 +313,7 @@ dassl_fcn = extract_function (c(0), "dassl", fcn_name, fname, "; endfunction"); } - + if (dassl_fcn) { if (c(1).is_function_handle () || c(1).is_inline_function ()) @@ -381,7 +381,7 @@ jname.append(jac_name); jname.append (" (x, xdot, t, cj) jac = "); dassl_jac = extract_function - (tmp(1), "dassl", jac_name, jname, + (tmp(1), "dassl", jac_name, jname, "; endfunction"); if (!dassl_jac) @@ -503,18 +503,18 @@ %!function res = f (x, xdot, t) %! res = [xdot(1)+x(2); xdot(2)-x(1)]; %!test -%! +%! %! x0 = [1; 0]; %! xdot0 = [0; 1]; %! t = (0:1:10)'; -%! +%! %! tol = 100 * dassl_options ("relative tolerance"); -%! -%! +%! +%! %! [x, xdot] = dassl ("f", x0, xdot0, t); -%! +%! %! y = [cos(t), sin(t)]; -%! +%! %! assert(all (all (abs (x - y) < tol))); %% dassl-2.m @@ -531,7 +531,7 @@ %% %% x1' + 10*x1 = 0, x1(0) = 1 %% x1 + x2 = 1, x2(0) = 0 -%% +%% %% %% Solution %% @@ -540,18 +540,18 @@ %!function res = f (x, xdot, t) %! res = [xdot(1)+10*x(1); x(1)+x(2)-1]; %!test -%! +%! %! x0 = [1; 0]; %! xdot0 = [-10; 10]; %! t = (0:0.2:1)'; -%! +%! %! tol = 500 * dassl_options ("relative tolerance"); -%! -%! +%! +%! %! [x, xdot] = dassl ("f", x0, xdot0, t); -%! +%! %! y = [exp(-10*t), 1-exp(-10*t)]; -%! +%! %! assert(all (all (abs (x - y) < tol))); %!test diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/det.cc --- a/src/DLD-FUNCTIONS/det.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/det.cc Thu Jan 20 17:24:59 2011 -0500 @@ -75,7 +75,7 @@ } octave_value arg = args(0); - + octave_idx_type nr = arg.rows (); octave_idx_type nc = arg.columns (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/dlmread.cc --- a/src/DLD-FUNCTIONS/dlmread.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/dlmread.cc Thu Jan 20 17:24:59 2011 -0500 @@ -110,7 +110,7 @@ if (stat) { ch = is.peek (); - + if (ch == '.' || ch == ':') { ch = is.get (); @@ -143,13 +143,13 @@ else if (range_spec.is_real_matrix () && range_spec.numel () == 4) { ColumnVector range(range_spec.vector_value ()); - // double --> unsigned int + // double --> unsigned int rlo = static_cast (range(0)); clo = static_cast (range(1)); rup = static_cast (range(2)); cup = static_cast (range(3)); } - else + else stat = false; return stat; @@ -190,7 +190,7 @@ double empty_value = 0.0; - if (nargin > 2 && args(nargin-2).is_string () + if (nargin > 2 && args(nargin-2).is_string () && args(nargin-2).string_value () == "emptyvalue") { empty_value = args(nargin-1).double_value (); @@ -199,7 +199,7 @@ nargin -= 2; } - if (nargin < 1 || nargin > 4) + if (nargin < 1 || nargin > 4) { print_usage (); return retval; @@ -260,7 +260,7 @@ if (error_state) return retval; } - + // Take a subset if a range was given. octave_idx_type r0 = 0, c0 = 0, r1 = idx_max-1, c1 = idx_max-1; if (nargin > 2) @@ -269,8 +269,8 @@ { if (!parse_range_spec (args (2), r0, c0, r1, c1)) error ("dlmread: error parsing RANGE"); - } - else if (nargin == 4) + } + else if (nargin == 4) { r0 = args(2).idx_type_value (); c0 = args(3).idx_type_value (); @@ -314,7 +314,7 @@ // correspond to whitespace as delimter. if (!sep.length ()) { - size_t n = line.find_first_of (",:; \t", + size_t n = line.find_first_of (",:; \t", line.find_first_of ("0123456789")); if (n == std::string::npos) { @@ -390,7 +390,7 @@ c = (c > j + 1 ? c : j + 1); if (r > rmax || c > cmax) - { + { // Use resize_and_fill for the case of not-equal // length rows. rmax = 2*r; @@ -456,7 +456,7 @@ i++; } - + if (r1 >= r) r1 = r - 1; if (c1 >= c) @@ -467,7 +467,7 @@ cdata = cdata.extract (0, c0, r1, c1); else rdata = rdata.extract (0, c0, r1, c1); - + if (iscmplx) retval(0) = cdata; else @@ -480,7 +480,7 @@ /* %!shared file -%! file = tmpnam (); +%! file = tmpnam (); %! fid = fopen (file, "wt"); %! fwrite (fid, "1, 2, 3\n4, 5, 6\n7, 8, 9\n10, 11, 12"); %! fclose (fid); @@ -499,7 +499,7 @@ %! unlink (file); %!shared file -%! file = tmpnam (); +%! file = tmpnam (); %! fid = fopen (file, "wt"); %! fwrite (fid, "1, 2, 3\n4+4i, 5, 6\n7, 8, 9\n10, 11, 12"); %! fclose (fid); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/dmperm.cc --- a/src/DLD-FUNCTIONS/dmperm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/dmperm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -155,7 +155,7 @@ { int nargin = args.length(); octave_value_list retval; - + if (nargin != 1) { print_usage (); @@ -171,7 +171,7 @@ return retval; } -/* +/* %!testif HAVE_CXSPARSE %! n=20; @@ -204,7 +204,7 @@ { int nargin = args.length(); octave_value_list retval; - + if (nargin != 1) { print_usage (); @@ -220,7 +220,7 @@ return retval; } -/* +/* %!error(sprank(1,2)); %!testif HAVE_CXSPARSE diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/dot.cc --- a/src/DLD-FUNCTIONS/dot.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/dot.cc Thu Jan 20 17:24:59 2011 -0500 @@ -33,48 +33,48 @@ extern "C" { F77_RET_T - F77_FUNC (ddot3, DDOT3) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (ddot3, DDOT3) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, const double*, const double*, double*); F77_RET_T - F77_FUNC (sdot3, SDOT3) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (sdot3, SDOT3) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, const float*, const float*, float*); F77_RET_T - F77_FUNC (zdotc3, ZDOTC3) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (zdotc3, ZDOTC3) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, const Complex*, const Complex*, Complex*); F77_RET_T - F77_FUNC (cdotc3, CDOTC3) (const octave_idx_type&, const octave_idx_type&, + F77_FUNC (cdotc3, CDOTC3) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, const FloatComplex*, const FloatComplex*, FloatComplex*); F77_RET_T - F77_FUNC (dmatm3, DMATM3) (const octave_idx_type&, const octave_idx_type&, - const octave_idx_type&, const octave_idx_type&, + F77_FUNC (dmatm3, DMATM3) (const octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, const double*, const double*, double*); F77_RET_T - F77_FUNC (smatm3, SMATM3) (const octave_idx_type&, const octave_idx_type&, - const octave_idx_type&, const octave_idx_type&, + F77_FUNC (smatm3, SMATM3) (const octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, const float*, const float*, float*); F77_RET_T - F77_FUNC (zmatm3, ZMATM3) (const octave_idx_type&, const octave_idx_type&, - const octave_idx_type&, const octave_idx_type&, + F77_FUNC (zmatm3, ZMATM3) (const octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, const Complex*, const Complex*, Complex*); F77_RET_T - F77_FUNC (cmatm3, CMATM3) (const octave_idx_type&, const octave_idx_type&, - const octave_idx_type&, const octave_idx_type&, + F77_FUNC (cmatm3, CMATM3) (const octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, const FloatComplex*, const FloatComplex*, FloatComplex*); } -static void +static void get_red_dims (const dim_vector& x, const dim_vector& y, int dim, dim_vector& z, octave_idx_type& m, octave_idx_type& n, octave_idx_type& k) @@ -134,7 +134,7 @@ { dim_vector dimx = argx.dims (), dimy = argy.dims (); bool match = dimx == dimy; - if (! match && nargin == 2 + if (! match && nargin == 2 && dimx.is_vector () && dimy.is_vector ()) { // Change to column vectors. diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/eig.cc --- a/src/DLD-FUNCTIONS/eig.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/eig.cc Thu Jan 20 17:24:59 2011 -0500 @@ -219,7 +219,7 @@ else result = EIG (tmp_a, tmp_b, nargout > 1); } - else + else { ctmp_a = arg_a.complex_matrix_value (); ctmp_b = arg_b.complex_matrix_value (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/eigs.cc --- a/src/DLD-FUNCTIONS/eigs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/eigs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -418,9 +418,9 @@ } - // Note hold off reading B till later to avoid issues of double + // Note hold off reading B till later to avoid issues of double // copies of the matrix if B is full/real while A is complex.. - if (!error_state && nargin > 1 + arg_offset && + if (!error_state && nargin > 1 + arg_offset && !(args(1 + arg_offset).is_real_scalar ())) { if (args(1+arg_offset).is_complex_type ()) @@ -561,7 +561,7 @@ } } - // Mode 1 for SM mode seems unstable for some reason. + // Mode 1 for SM mode seems unstable for some reason. // Use Mode 3 instead, with sigma = 0. if (!error_state && !have_sigma && typ == "SM") have_sigma = true; @@ -576,7 +576,7 @@ if (have_a_fun) - nconv = EigsComplexNonSymmetricFunc + nconv = EigsComplexNonSymmetricFunc (eigs_complex_func, n, typ, sigma, k, p, info, eig_vec, eig_val, cresid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); else if (have_sigma) @@ -584,7 +584,7 @@ if (a_is_sparse) nconv = EigsComplexNonSymmetricMatrixShift (ascm, sigma, k, p, info, eig_vec, eig_val, bscm, permB, - cresid, octave_stdout, tol, (nargout > 1), cholB, disp, + cresid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); else nconv = EigsComplexNonSymmetricMatrixShift @@ -619,18 +619,18 @@ ComplexColumnVector eig_val; if (have_a_fun) - nconv = EigsComplexNonSymmetricFunc + nconv = EigsComplexNonSymmetricFunc (eigs_complex_func, n, typ, sigma, k, p, info, eig_vec, eig_val, cresid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); else { if (a_is_sparse) - nconv = EigsComplexNonSymmetricMatrixShift + nconv = EigsComplexNonSymmetricMatrixShift (SparseComplexMatrix (asmm), sigma, k, p, info, eig_vec, eig_val, SparseComplexMatrix (bsmm), permB, cresid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); else - nconv = EigsComplexNonSymmetricMatrixShift + nconv = EigsComplexNonSymmetricMatrixShift (ComplexMatrix (amm), sigma, k, p, info, eig_vec, eig_val, ComplexMatrix (bmm), permB, cresid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); @@ -653,19 +653,19 @@ ColumnVector eig_val; if (have_a_fun) - nconv = EigsRealSymmetricFunc + nconv = EigsRealSymmetricFunc (eigs_func, n, typ, sigmar, k, p, info, eig_vec, eig_val, - resid, octave_stdout, tol, (nargout > 1), cholB, disp, + resid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); else if (have_sigma) { if (a_is_sparse) - nconv = EigsRealSymmetricMatrixShift + nconv = EigsRealSymmetricMatrixShift (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm, permB, - resid, octave_stdout, tol, (nargout > 1), cholB, disp, + resid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); else - nconv = EigsRealSymmetricMatrixShift + nconv = EigsRealSymmetricMatrixShift (amm, sigmar, k, p, info, eig_vec, eig_val, bmm, permB, resid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); @@ -673,12 +673,12 @@ else { if (a_is_sparse) - nconv = EigsRealSymmetricMatrix + nconv = EigsRealSymmetricMatrix (asmm, typ, k, p, info, eig_vec, eig_val, bsmm, permB, resid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); else - nconv = EigsRealSymmetricMatrix + nconv = EigsRealSymmetricMatrix (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB, resid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); @@ -699,19 +699,19 @@ ComplexColumnVector eig_val; if (have_a_fun) - nconv = EigsRealNonSymmetricFunc + nconv = EigsRealNonSymmetricFunc (eigs_func, n, typ, sigmar, k, p, info, eig_vec, eig_val, - resid, octave_stdout, tol, (nargout > 1), cholB, disp, + resid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); else if (have_sigma) { if (a_is_sparse) - nconv = EigsRealNonSymmetricMatrixShift + nconv = EigsRealNonSymmetricMatrixShift (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm, permB, - resid, octave_stdout, tol, (nargout > 1), cholB, disp, + resid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); else - nconv = EigsRealNonSymmetricMatrixShift + nconv = EigsRealNonSymmetricMatrixShift (amm, sigmar, k, p, info, eig_vec, eig_val, bmm, permB, resid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); @@ -719,12 +719,12 @@ else { if (a_is_sparse) - nconv = EigsRealNonSymmetricMatrix + nconv = EigsRealNonSymmetricMatrix (asmm, typ, k, p, info, eig_vec, eig_val, bsmm, permB, resid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); else - nconv = EigsRealNonSymmetricMatrix + nconv = EigsRealNonSymmetricMatrix (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB, resid, octave_stdout, tol, (nargout > 1), cholB, disp, maxit); @@ -744,7 +744,7 @@ if (nconv <= 0) warning ("eigs: None of the %d requested eigenvalues converged", k); else if (nconv < k) - warning ("eigs: Only %d of the %d requested eigenvalues converged", + warning ("eigs: Only %d of the %d requested eigenvalues converged", nconv, k); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/fft.cc --- a/src/DLD-FUNCTIONS/fft.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/fft.cc Thu Jan 20 17:24:59 2011 -0500 @@ -56,7 +56,7 @@ dim_vector dims = arg.dims (); octave_idx_type n_points = -1; int dim = -1; - + if (nargin > 1) { if (! args(1).is_empty ()) @@ -264,11 +264,11 @@ %! t = 2*pi*(0:1:N-1)/N; %! s = cos(n*t); %! S = fft(s); -%! +%! %! answer = zeros (size(t)); %! answer(n+1) = N/2; %! answer(N-n+1) = N/2; -%! +%! %! assert(S, answer, 4*N*eps); %% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) @@ -279,11 +279,11 @@ %! n=7; %! t = 2*pi*(0:1:N-1)/N; %! s = cos(n*t); -%! +%! %! S = zeros (size(t)); %! S(n+1) = N/2; %! S(N-n+1) = N/2; -%! +%! %! assert(ifft(S), s, 4*N*eps); %% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) @@ -295,11 +295,11 @@ %! t = single (2*pi*(0:1:N-1)/N); %! s = cos(n*t); %! S = fft(s); -%! +%! %! answer = zeros (size(t),'single'); %! answer(n+1) = N/2; %! answer(N-n+1) = N/2; -%! +%! %! assert(S, answer, 4*N*eps('single')); %% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) @@ -310,11 +310,11 @@ %! n=7; %! t = 2*pi*(0:1:N-1)/N; %! s = cos(n*t); -%! +%! %! S = zeros (size(t),'single'); %! S(n+1) = N/2; %! S(N-n+1) = N/2; -%! +%! %! assert(ifft(S), s, 4*N*eps('single')); */ diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/fft2.cc --- a/src/DLD-FUNCTIONS/fft2.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/fft2.cc Thu Jan 20 17:24:59 2011 -0500 @@ -57,7 +57,7 @@ octave_value arg = args(0); dim_vector dims = arg.dims (); octave_idx_type n_rows = -1; - + if (nargin > 1) { double dval = args(1).double_value (); @@ -214,10 +214,10 @@ %!test %! M=16; %! N=8; -%! +%! %! m=5; %! n=3; -%! +%! %! x = 2*pi*(0:1:M-1)/M; %! y = 2*pi*(0:1:N-1)/N; %! sx = cos(m*x); @@ -233,20 +233,20 @@ %!test %! M=12; %! N=7; -%! +%! %! m=3; %! n=2; -%! +%! %! x = 2*pi*(0:1:M-1)/M; %! y = 2*pi*(0:1:N-1)/N; -%! +%! %! sx = cos(m*x); %! sy = cos(n*y); -%! +%! %! S = kron(fft(sx)',fft(sy)); %! answer=kron(sx',sy); %! s = ifft2(S); -%! +%! %! assert(s, answer, 30*eps); @@ -256,10 +256,10 @@ %!test %! M=16; %! N=8; -%! +%! %! m=5; %! n=3; -%! +%! %! x = 2*pi*(0:1:M-1)/M; %! y = 2*pi*(0:1:N-1)/N; %! sx = single(cos(m*x)); @@ -275,20 +275,20 @@ %!test %! M=12; %! N=7; -%! +%! %! m=3; %! n=2; -%! +%! %! x = single(2*pi*(0:1:M-1)/M); %! y = single(2*pi*(0:1:N-1)/N); -%! +%! %! sx = cos(m*x); %! sy = cos(n*y); -%! +%! %! S = kron(fft(sx)',fft(sy)); %! answer=kron(sx',sy); %! s = ifft2(S); -%! +%! %! assert(s, answer, 30*eps('single')); */ diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/fftn.cc --- a/src/DLD-FUNCTIONS/fftn.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/fftn.cc Thu Jan 20 17:24:59 2011 -0500 @@ -55,7 +55,7 @@ octave_value arg = args(0); dim_vector dims = arg.dims (); - + for (int i = 0; i < dims.length (); i++) if (dims(i) < 0) return retval; diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/fftw.cc --- a/src/DLD-FUNCTIONS/fftw.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/fftw.cc Thu Jan 20 17:24:59 2011 -0500 @@ -132,7 +132,7 @@ { // Use STL function to convert to lower case std::transform (arg0.begin (), arg0.end (), arg0.begin (), tolower); - + if (nargin == 2) { std::string arg1 = args(1).string_value (); @@ -140,7 +140,7 @@ { if (arg0 == "planner") { - std::transform (arg1.begin (), arg1.end (), + std::transform (arg1.begin (), arg1.end (), arg1.begin (), tolower); octave_fftw_planner::FftwMethod meth = octave_fftw_planner::UNKNOWN; @@ -228,7 +228,7 @@ { if (arg0 == "planner") { - octave_fftw_planner::FftwMethod meth = + octave_fftw_planner::FftwMethod meth = octave_fftw_planner::method (); if (meth == octave_fftw_planner::MEASURE) diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/filter.cc --- a/src/DLD-FUNCTIONS/filter.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/filter.cc Thu Jan 20 17:24:59 2011 -0500 @@ -54,7 +54,7 @@ template MArray -filter (MArray& b, MArray& a, MArray& x, MArray& si, +filter (MArray& b, MArray& a, MArray& x, MArray& si, int dim = 0) { MArray y; @@ -105,10 +105,10 @@ { if (i == dim) continue; - + if (x_dims(i) == 1) continue; - + if (si_dims(++si_dim) != x_dims(i)) { error ("filter: dimensionality of SI and X must agree"); @@ -221,7 +221,7 @@ } } } - + return y; } @@ -254,7 +254,7 @@ // Find first non-singleton dimension while (dim < x_dims.length () && x_dims(dim) <= 1) dim++; - + // All dimensions singleton, pick first dimension if (dim == x_dims.length ()) dim = 0; @@ -274,7 +274,7 @@ for (int i = dim; i > 0; i--) si_dims(i) = si_dims(i-1); si_dims(0) = si_len; - + MArray si (si_dims, T (0.0)); return filter (b, a, x, si, dim); @@ -409,7 +409,7 @@ dim = 0; while (dim < x_dims.length () && x_dims(dim) <= 1) dim++; - + // All dimensions singleton, pick first dimension if (dim == x_dims.length ()) dim = 0; @@ -419,7 +419,7 @@ || args(1).is_single_type () || args(2).is_single_type () || (nargin >= 4 && args(3).is_single_type ())); - + if (args(0).is_complex_type () || args(1).is_complex_type () || args(2).is_complex_type () diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/find.cc --- a/src/DLD-FUNCTIONS/find.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/find.cc Thu Jan 20 17:24:59 2011 -0500 @@ -37,7 +37,7 @@ template octave_value_list -find_nonzero_elem_idx (const Array& nda, int nargout, +find_nonzero_elem_idx (const Array& nda, int nargout, octave_idx_type n_to_find, int direction) { octave_value_list retval ((nargout == 0 ? 1 : nargout), Matrix ()); @@ -83,7 +83,7 @@ template octave_value_list -find_nonzero_elem_idx (const Sparse& v, int nargout, +find_nonzero_elem_idx (const Sparse& v, int nargout, octave_idx_type n_to_find, int direction) { octave_value_list retval ((nargout == 0 ? 1 : nargout), Matrix ()); @@ -97,7 +97,7 @@ octave_idx_type start_nc = -1; octave_idx_type end_nc = -1; octave_idx_type count; - + // Search for the range to search if (n_to_find < 0) { @@ -135,7 +135,7 @@ } } - count = (n_to_find > v.cidx(end_nc) - v.cidx(start_nc) ? + count = (n_to_find > v.cidx(end_nc) - v.cidx(start_nc) ? v.cidx(end_nc) - v.cidx(start_nc) : n_to_find); // If the original argument was a row vector, force a row vector of @@ -167,15 +167,15 @@ // Search for elements to return. Only search the region where // there are elements to be found using the count that we want // to find. - for (octave_idx_type j = start_nc, cx = 0; j < end_nc; j++) - for (octave_idx_type i = v.cidx(j); i < v.cidx(j+1); i++ ) + for (octave_idx_type j = start_nc, cx = 0; j < end_nc; j++) + for (octave_idx_type i = v.cidx(j); i < v.cidx(j+1); i++ ) { OCTAVE_QUIT; if (direction < 0 && i < nz - count) continue; i_idx(cx) = static_cast (v.ridx(i) + 1); j_idx(cx) = static_cast (j + 1); - idx(cx) = j * nr + v.ridx(i) + 1; + idx(cx) = j * nr + v.ridx(i) + 1; val(cx) = v.data(i); cx++; if (cx == count) @@ -225,7 +225,7 @@ } octave_value_list -find_nonzero_elem_idx (const PermMatrix& v, int nargout, +find_nonzero_elem_idx (const PermMatrix& v, int nargout, octave_idx_type n_to_find, int direction) { // There are far fewer special cases to handle for a PermMatrix. @@ -233,7 +233,7 @@ octave_idx_type nc = v.cols(); octave_idx_type start_nc, end_nc, count; - + // Determine the range to search. if (n_to_find < 0 || n_to_find >= nc) { @@ -268,7 +268,7 @@ const octave_idx_type* p = v.data (); if (v.is_col_perm ()) { - for (octave_idx_type k = 0; k < count; k++) + for (octave_idx_type k = 0; k < count; k++) { OCTAVE_QUIT; const octave_idx_type j = start_nc + k; @@ -280,7 +280,7 @@ } else { - for (octave_idx_type k = 0; k < count; k++) + for (octave_idx_type k = 0; k < count; k++) { OCTAVE_QUIT; const octave_idx_type i = start_nc + k; @@ -455,13 +455,13 @@ SparseBoolMatrix v = arg.sparse_bool_matrix_value (); if (! error_state) - retval = find_nonzero_elem_idx (v, nargout, + retval = find_nonzero_elem_idx (v, nargout, n_to_find, direction); } else if (nargout <= 1 && n_to_find == -1 && direction == 1) { // This case is equivalent to extracting indices from a logical - // matrix. Try to reuse the possibly cached index vector. + // matrix. Try to reuse the possibly cached index vector. retval(0) = arg.index_vector ().unmask (); } else @@ -469,7 +469,7 @@ boolNDArray v = arg.bool_array_value (); if (! error_state) - retval = find_nonzero_elem_idx (v, nargout, + retval = find_nonzero_elem_idx (v, nargout, n_to_find, direction); } } @@ -505,7 +505,7 @@ SparseMatrix v = arg.sparse_matrix_value (); if (! error_state) - retval = find_nonzero_elem_idx (v, nargout, + retval = find_nonzero_elem_idx (v, nargout, n_to_find, direction); } else if (arg.is_complex_type ()) @@ -513,10 +513,10 @@ SparseComplexMatrix v = arg.sparse_complex_matrix_value (); if (! error_state) - retval = find_nonzero_elem_idx (v, nargout, + retval = find_nonzero_elem_idx (v, nargout, n_to_find, direction); } - else + else gripe_wrong_type_arg ("find", arg); } else if (arg.is_perm_matrix ()) @@ -580,7 +580,7 @@ %!test %! [i, j, v] = find ([0, 0, 2; 0, 3, 0; -1, 0, 0]); -%! +%! %! assert(i, [3; 2; 1]); %! assert(j, [1; 2; 3]); %! assert(v, [-1; 3; 2]); @@ -591,7 +591,7 @@ %!test %! [i, j, v] = find (single([0, 0, 2; 0, 3, 0; -1, 0, 0])); -%! +%! %! assert(i, [3; 2; 1]); %! assert(j, [1; 2; 3]); %! assert(v, single([-1; 3; 2])); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/gammainc.cc --- a/src/DLD-FUNCTIONS/gammainc.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/gammainc.cc Thu Jan 20 17:24:59 2011 -0500 @@ -115,7 +115,7 @@ float a = a_arg.float_value (); if (! error_state) - retval = lower ? gammainc (x, a) + retval = lower ? gammainc (x, a) : static_cast(1) - gammainc (x, a); } else @@ -123,7 +123,7 @@ FloatNDArray a = a_arg.float_array_value (); if (! error_state) - retval = lower ? gammainc (x, a) + retval = lower ? gammainc (x, a) : static_cast(1) - gammainc (x, a); } } @@ -139,7 +139,7 @@ float a = a_arg.float_value (); if (! error_state) - retval = lower ? gammainc (x, a) + retval = lower ? gammainc (x, a) : static_cast(1) - gammainc (x, a); } else @@ -147,7 +147,7 @@ FloatNDArray a = a_arg.float_array_value (); if (! error_state) - retval = lower ? gammainc (x, a) + retval = lower ? gammainc (x, a) : static_cast(1) - gammainc (x, a); } } @@ -216,7 +216,7 @@ %! v3 = gammainc(x.*x,a); %! assert(v1, v3, sqrt(eps)); -%!assert (gammainc(0:4,0.5,"upper"), 1-gammainc(0:4,0.5),1e-10) +%!assert (gammainc(0:4,0.5,"upper"), 1-gammainc(0:4,0.5),1e-10) %!test %! a = single ([.5 .5 .5 .5 .5]); @@ -225,6 +225,6 @@ %! v3 = gammainc(x.*x,a); %! assert(v1, v3, sqrt(eps('single'))); -%!assert (gammainc(single(0:4),single(0.5),"upper"), single(1)-gammainc(single(0:4),single(0.5)),single(1e-7)) +%!assert (gammainc(single(0:4),single(0.5),"upper"), single(1)-gammainc(single(0:4),single(0.5)),single(1e-7)) */ diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/givens.cc --- a/src/DLD-FUNCTIONS/givens.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/givens.cc Thu Jan 20 17:24:59 2011 -0500 @@ -92,7 +92,7 @@ case 1: retval(0) = result; break; - + case 2: retval(1) = result (0, 1); retval(0) = result (0, 0); @@ -122,7 +122,7 @@ case 1: retval(0) = result; break; - + case 2: retval(1) = result (0, 1); retval(0) = result (0, 0); @@ -155,7 +155,7 @@ case 1: retval(0) = result; break; - + case 2: retval(1) = result (0, 1); retval(0) = result (0, 0); @@ -185,7 +185,7 @@ case 1: retval(0) = result; break; - + case 2: retval(1) = result (0, 1); retval(0) = result (0, 0); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/hex2num.cc --- a/src/DLD-FUNCTIONS/hex2num.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/hex2num.cc Thu Jan 20 17:24:59 2011 -0500 @@ -167,7 +167,7 @@ for (octave_idx_type j = 0; j < 16; j++) { - unsigned char ch = + unsigned char ch = static_cast (num.ival >> ((15 - j) * 4) & 0xF); if (ch >= 10) ch += 'a' - 10; diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/inv.cc --- a/src/DLD-FUNCTIONS/inv.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/inv.cc Thu Jan 20 17:24:59 2011 -0500 @@ -216,7 +216,7 @@ volatile double xrcond = rcond; xrcond += 1.0; if (nargout < 2 && (info == -1 || xrcond == 1.0)) - warning ("inverse: matrix singular to machine precision, rcond = %g", + warning ("inverse: matrix singular to machine precision, rcond = %g", rcond); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/kron.cc --- a/src/DLD-FUNCTIONS/kron.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/kron.cc Thu Jan 20 17:24:59 2011 -0500 @@ -99,7 +99,7 @@ kron (const MSparse& A, const MSparse& B) { octave_idx_type idx = 0; - MSparse C (A.rows () * B.rows (), A.columns () * B.columns (), + MSparse C (A.rows () * B.rows (), A.columns () * B.columns (), A.nnz () * B.nnz ()); C.cidx (0) = 0; diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/lookup.cc --- a/src/DLD-FUNCTIONS/lookup.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/lookup.cc Thu Jan 20 17:24:59 2011 -0500 @@ -44,7 +44,7 @@ bool contains_char (const std::string& str, char c) { - return (str.find (c) != std::string::npos + return (str.find (c) != std::string::npos || str.find (std::toupper (c)) != std::string::npos); } @@ -68,7 +68,7 @@ static bool stri_comp_lt (const std::string& a, const std::string& b) { - return std::lexicographical_compare (a.begin (), a.end (), + return std::lexicographical_compare (a.begin (), a.end (), b.begin (), b.end (), icmp_char_lt()); } @@ -77,14 +77,14 @@ static bool stri_comp_gt (const std::string& a, const std::string& b) { - return std::lexicographical_compare (a.begin (), a.end (), + return std::lexicographical_compare (a.begin (), a.end (), b.begin (), b.end (), icmp_char_gt()); } #endif template -inline sortmode +inline sortmode get_sort_mode (const Array& array, typename octave_sort::compare_fcn_type desc_comp = octave_sort::descending_compare) @@ -97,7 +97,7 @@ } // FIXME: perhaps there should be octave_value::lookup? -// The question is, how should it behave w.r.t. the second argument's type. +// The question is, how should it behave w.r.t. the second argument's type. // We'd need a dispatch on two arguments. Hmmm... #define INT_ARRAY_LOOKUP(TYPE) \ @@ -108,7 +108,7 @@ match_idx, match_bool); template static octave_value -do_numeric_lookup (const ArrayT& array, const ArrayT& values, +do_numeric_lookup (const ArrayT& array, const ArrayT& values, bool left_inf, bool right_inf, bool match_idx, bool match_bool) { @@ -141,7 +141,7 @@ ridx.xelem (i) = (j != 0 && values(i) == array(j-1)) ? j : 0; } - retval = ridx; + retval = ridx; } else if (left_inf && right_inf) { @@ -233,7 +233,7 @@ the rightmost subinterval shall be extended to infinity (i.e., all indices\n\ at most n-1).\n\ @end table\n\ -@end deftypefn") +@end deftypefn") { octave_value retval; @@ -282,12 +282,12 @@ if (error_state) return retval; - if (num_case) + if (num_case) { // In the case of a complex array, absolute values will be used for compatibility // (though it's not too meaningful). - + if (table.is_complex_type ()) table = table.abs (); @@ -347,7 +347,7 @@ retval = match; } - else if (match_idx) + else if (match_idx) { NDArray ridx (idx.dims ()); if (match_idx) @@ -369,7 +369,7 @@ return retval; -} +} /* %!assert (lookup(1:3, 0.5), 0) # value before table diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/lsode.cc --- a/src/DLD-FUNCTIONS/lsode.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/lsode.cc Thu Jan 20 17:24:59 2011 -0500 @@ -139,7 +139,7 @@ #define LSODE_ABORT() \ return retval - + #define LSODE_ABORT1(msg) \ do \ { \ @@ -313,7 +313,7 @@ lsode_fcn = extract_function (c(0), "lsode", fcn_name, fname, "; endfunction"); } - + if (lsode_fcn) { if (c(1).is_function_handle () || c(1).is_inline_function ()) @@ -495,46 +495,46 @@ %!function xdot = f (x, t) %! xdot = [-x(2); x(1)]; %!test -%! +%! %! x0 = [1; 0]; %! xdot0 = [0; 1]; %! t = (0:1:10)'; -%! +%! %! tol = 500 * lsode_options ("relative tolerance"); -%! -%! +%! +%! %! x = lsode ("f", x0, t); -%! +%! %! y = [cos(t), sin(t)]; -%! +%! %! assert(all (all (abs (x - y) < tol))); %!function xdotdot = f (x, t) %! xdotdot = [x(2); -x(1)]; %!test -%! +%! %! x0 = [1; 0]; %! t = [0; 2*pi]; %! tol = 100 * dassl_options ("relative tolerance"); -%! +%! %! x = lsode ("f", x0, t); -%! +%! %! y = [1, 0; 1, 0]; -%! +%! %! assert(all (all (abs (x - y) < tol))); %!function xdot = f (x, t) %! xdot = x; %!test -%! +%! %! x0 = 1; %! t = [0; 1]; %! tol = 100 * dassl_options ("relative tolerance"); -%! +%! %! x = lsode ("f", x0, t); -%! +%! %! y = [1; e]; -%! +%! %! assert(all (all (abs (x - y) < tol))); %!test diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/lu.cc --- a/src/DLD-FUNCTIONS/lu.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/lu.cc Thu Jan 20 17:24:59 2011 -0500 @@ -144,7 +144,7 @@ bool issparse = (nargin > 0 && args(0).is_sparse_type ()); bool scale = (nargout == 5); - if (nargin < 1 || (issparse && (nargin > 3 || nargout > 5)) + if (nargin < 1 || (issparse && (nargin > 3 || nargout > 5)) || (!issparse && (nargin > 2 || nargout > 3))) { print_usage (); @@ -231,11 +231,11 @@ { PermMatrix P = fact.Pr_mat (); SparseMatrix L = P.transpose () * fact.L (); - retval(1) = octave_value (fact.U (), + retval(1) = octave_value (fact.U (), MatrixType (MatrixType::Upper)); - retval(0) = octave_value (L, - MatrixType (MatrixType::Permuted_Lower, + retval(0) = octave_value (L, + MatrixType (MatrixType::Permuted_Lower, nr, fact.row_perm ())); } } @@ -250,9 +250,9 @@ else retval(2) = fact.Pr_mat (); - retval(1) = octave_value (fact.U (), + retval(1) = octave_value (fact.U (), MatrixType (MatrixType::Upper)); - retval(0) = octave_value (fact.L (), + retval(0) = octave_value (fact.L (), MatrixType (MatrixType::Lower)); } break; @@ -275,9 +275,9 @@ retval(3) = fact.Pc_mat (); retval(2) = fact.Pr_mat (); } - retval(1) = octave_value (fact.U (), + retval(1) = octave_value (fact.U (), MatrixType (MatrixType::Upper)); - retval(0) = octave_value (fact.L (), + retval(0) = octave_value (fact.L (), MatrixType (MatrixType::Lower)); } break; @@ -301,11 +301,11 @@ { PermMatrix P = fact.Pr_mat (); SparseComplexMatrix L = P.transpose () * fact.L (); - retval(1) = octave_value (fact.U (), + retval(1) = octave_value (fact.U (), MatrixType (MatrixType::Upper)); - retval(0) = octave_value (L, - MatrixType (MatrixType::Permuted_Lower, + retval(0) = octave_value (L, + MatrixType (MatrixType::Permuted_Lower, nr, fact.row_perm ())); } } @@ -320,9 +320,9 @@ else retval(2) = fact.Pr_mat (); - retval(1) = octave_value (fact.U (), + retval(1) = octave_value (fact.U (), MatrixType (MatrixType::Upper)); - retval(0) = octave_value (fact.L (), + retval(0) = octave_value (fact.L (), MatrixType (MatrixType::Lower)); } break; @@ -345,9 +345,9 @@ retval(3) = fact.Pc_mat (); retval(2) = fact.Pr_mat (); } - retval(1) = octave_value (fact.U (), + retval(1) = octave_value (fact.U (), MatrixType (MatrixType::Upper)); - retval(0) = octave_value (fact.L (), + retval(0) = octave_value (fact.L (), MatrixType (MatrixType::Lower)); } break; @@ -657,25 +657,25 @@ octave_value argx = args(2 + pivoted); octave_value argy = args(3 + pivoted); - if (argl.is_numeric_type () && argu.is_numeric_type () + if (argl.is_numeric_type () && argu.is_numeric_type () && argx.is_numeric_type () && argy.is_numeric_type () && (! pivoted || argp.is_perm_matrix ())) { if (check_lu_dims (argl, argu, argp)) { - PermMatrix P = (pivoted - ? argp.perm_matrix_value () + PermMatrix P = (pivoted + ? argp.perm_matrix_value () : PermMatrix::eye (argl.rows ())); - if (argl.is_real_type () - && argu.is_real_type () - && argx.is_real_type () + if (argl.is_real_type () + && argu.is_real_type () + && argx.is_real_type () && argy.is_real_type ()) { // all real case - if (argl.is_single_type () - || argu.is_single_type () - || argx.is_single_type () + if (argl.is_single_type () + || argu.is_single_type () + || argx.is_single_type () || argy.is_single_type ()) { FloatMatrix L = argl.float_matrix_value (); @@ -716,9 +716,9 @@ else { // complex case - if (argl.is_single_type () - || argu.is_single_type () - || argx.is_single_type () + if (argl.is_single_type () + || argu.is_single_type () + || argx.is_single_type () || argy.is_single_type ()) { FloatComplexMatrix L = argl.float_complex_matrix_value (); @@ -731,7 +731,7 @@ fact.update_piv (x, y); else fact.update (x, y); - + if (pivoted) retval(2) = fact.P (); retval(1) = get_lu_u (fact); @@ -749,7 +749,7 @@ fact.update_piv (x, y); else fact.update (x, y); - + if (pivoted) retval(2) = fact.P (); retval(1) = get_lu_u (fact); @@ -774,10 +774,10 @@ %! 0.265712 0.268003 0.238409; %! 0.669966 0.743851 0.445057 ]; %! -%! u = [0.85082; -%! 0.76426; -%! 0.42883; -%! 0.53010; +%! u = [0.85082; +%! 0.76426; +%! 0.42883; +%! 0.53010; %! 0.80683 ]; %! %! v = [0.98810; @@ -807,7 +807,7 @@ %! assert(norm(vec(tril(L)-L),Inf) == 0) %! assert(norm(vec(triu(U)-U),Inf) == 0) %! assert(norm(vec(P'*L*U - A - u*v.'),Inf) < norm(A)*1e1*eps) -%! +%! %!testif HAVE_QRUPDATE_LUU %! [L,U,P] = lu(Ac); %! [L,U] = luupdate(L,U,P*uc,vc); @@ -821,7 +821,7 @@ %! assert(norm(vec(tril(L)-L),Inf) == 0) %! assert(norm(vec(triu(U)-U),Inf) == 0) %! assert(norm(vec(P'*L*U - single(A) - single(u)*single(v).'),Inf) < norm(single(A))*1e1*eps('single')) -%! +%! %!testif HAVE_QRUPDATE_LUU %! [L,U,P] = lu(single(Ac)); %! [L,U] = luupdate(L,U,P*single(uc),single(vc)); @@ -835,7 +835,7 @@ %! assert(norm(vec(tril(L)-L),Inf) == 0) %! assert(norm(vec(triu(U)-U),Inf) == 0) %! assert(norm(vec(P'*L*U - A - u*v.'),Inf) < norm(A)*1e1*eps) -%! +%! %!testif HAVE_QRUPDATE_LUU %! [L,U,P] = lu(Ac); %! [L,U,P] = luupdate(L,U,P,uc,vc); @@ -849,7 +849,7 @@ %! assert(norm(vec(tril(L)-L),Inf) == 0) %! assert(norm(vec(triu(U)-U),Inf) == 0) %! assert(norm(vec(P'*L*U - single(A) - single(u)*single(v).'),Inf) < norm(single(A))*1e1*eps('single')) -%! +%! %!testif HAVE_QRUPDATE_LUU %! [L,U,P] = lu(single(Ac)); %! [L,U,P] = luupdate(L,U,P,single(uc),single(vc)); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/luinc.cc --- a/src/DLD-FUNCTIONS/luinc.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/luinc.cc Thu Jan 20 17:24:59 2011 -0500 @@ -192,7 +192,7 @@ if (!error_state) { - if (args(0).type_name () == "sparse matrix") + if (args(0).type_name () == "sparse matrix") { SparseMatrix sm = args(0).sparse_matrix_value (); octave_idx_type sm_nr = sm.rows (); @@ -219,8 +219,8 @@ SparseMatrix L = P.transpose () * fact.L (); retval(1) = octave_value (fact.U (), MatrixType (MatrixType::Upper)); - retval(0) = octave_value (L, MatrixType - (MatrixType::Permuted_Lower, + retval(0) = octave_value (L, MatrixType + (MatrixType::Permuted_Lower, sm_nr, fact.row_perm ())); } } @@ -273,9 +273,9 @@ } } } - else if (args(0).type_name () == "sparse complex matrix") + else if (args(0).type_name () == "sparse complex matrix") { - SparseComplexMatrix sm = + SparseComplexMatrix sm = args(0).sparse_complex_matrix_value (); octave_idx_type sm_nr = sm.rows (); octave_idx_type sm_nc = sm.cols (); @@ -292,7 +292,7 @@ case 1: case 2: { - SparseComplexLU fact (sm, Qinit, thresh, false, true, + SparseComplexLU fact (sm, Qinit, thresh, false, true, droptol, milu, udiag); @@ -302,8 +302,8 @@ SparseComplexMatrix L = P.transpose () * fact.L (); retval(1) = octave_value (fact.U (), MatrixType (MatrixType::Upper)); - retval(0) = octave_value (L, MatrixType - (MatrixType::Permuted_Lower, + retval(0) = octave_value (L, MatrixType + (MatrixType::Permuted_Lower, sm_nr, fact.row_perm ())); } } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/matrix_type.cc --- a/src/DLD-FUNCTIONS/matrix_type.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/matrix_type.cc Thu Jan 20 17:24:59 2011 -0500 @@ -142,13 +142,13 @@ { MatrixType mattyp; - if (args(0).is_complex_type ()) + if (args(0).is_complex_type ()) { mattyp = args(0).matrix_type (); if (mattyp.is_unknown () && autocomp ) { - SparseComplexMatrix m = + SparseComplexMatrix m = args(0).sparse_complex_matrix_value (); if (!error_state) { @@ -218,7 +218,7 @@ octave_idx_type nl = 0; octave_idx_type nu = 0; - + if (error_state) error ("matrix_type: TYPE must be a string"); else @@ -252,7 +252,7 @@ mattyp.mark_as_tridiagonal (); else mattyp.mark_as_banded (nu, nl); - + if (str_typ == "banded positive definite") mattyp.mark_as_symmetric (); } @@ -276,7 +276,7 @@ { if (nargin == 3 && (str_typ == "upper" || str_typ == "lower")) { - const ColumnVector perm = + const ColumnVector perm = ColumnVector (args (2).vector_value ()); if (error_state) @@ -285,7 +285,7 @@ { octave_idx_type len = perm.length (); dim_vector dv = args(0).dims (); - + if (len != dv(0)) error ("matrix_type: Invalid permutation vector PERM"); else @@ -293,7 +293,7 @@ OCTAVE_LOCAL_BUFFER (octave_idx_type, p, len); for (octave_idx_type i = 0; i < len; i++) - p[i] = static_cast (perm (i)) - 1; + p[i] = static_cast (perm (i)) - 1; if (str_typ == "upper") mattyp.mark_as_permuted (len, p); @@ -310,11 +310,11 @@ { // Set the matrix type if (args(0).is_complex_type ()) - retval = - octave_value (args(0).sparse_complex_matrix_value (), + retval = + octave_value (args(0).sparse_complex_matrix_value (), mattyp); else - retval = octave_value (args(0).sparse_matrix_value (), + retval = octave_value (args(0).sparse_matrix_value (), mattyp); } } @@ -440,10 +440,10 @@ if (! error_state) { - if (nargin == 3 && (str_typ == "upper" + if (nargin == 3 && (str_typ == "upper" || str_typ == "lower")) { - const ColumnVector perm = + const ColumnVector perm = ColumnVector (args (2).vector_value ()); if (error_state) @@ -452,7 +452,7 @@ { octave_idx_type len = perm.length (); dim_vector dv = args(0).dims (); - + if (len != dv(0)) error ("matrix_type: Invalid permutation vector PERM"); else @@ -460,7 +460,7 @@ OCTAVE_LOCAL_BUFFER (octave_idx_type, p, len); for (octave_idx_type i = 0; i < len; i++) - p[i] = static_cast (perm (i)) - 1; + p[i] = static_cast (perm (i)) - 1; if (str_typ == "upper") mattyp.mark_as_permuted (len, p); @@ -478,23 +478,23 @@ if (args(0).is_single_type ()) { if (args(0).is_complex_type()) - retval = octave_value - (args(0).float_complex_matrix_value (), + retval = octave_value + (args(0).float_complex_matrix_value (), mattyp); else - retval = octave_value - (args(0).float_matrix_value (), + retval = octave_value + (args(0).float_matrix_value (), mattyp); } else { if (args(0).is_complex_type()) - retval = octave_value - (args(0).complex_matrix_value (), + retval = octave_value + (args(0).complex_matrix_value (), mattyp); else - retval = octave_value - (args(0).matrix_value (), + retval = octave_value + (args(0).matrix_value (), mattyp); } } @@ -510,10 +510,10 @@ /* ## FIXME -## Disable tests for lower under-determined and upper over-determined +## Disable tests for lower under-determined and upper over-determined ## matrices as this detection is disabled in MatrixType due to issues ## of non minimum norm solution being found. - + %!assert(matrix_type(speye(10,10)),"Diagonal"); %!assert(matrix_type(speye(10,10)([2:10,1],:)),"Permuted Diagonal"); %!assert(matrix_type([[speye(10,10);sparse(1,10)],[1;sparse(9,1);1]]),"Upper"); @@ -598,7 +598,7 @@ %!assert(matrix_type(triu(ones(10,10),-1)),"Full"); %!assert(matrix_type(tril(ones(10,10))),"Lower"); %!assert(matrix_type(tril(ones(10,10),1)),"Full"); -%!assert(matrix_type(10*eye(10,10) + ones(10,10)), "Positive Definite"); +%!assert(matrix_type(10*eye(10,10) + ones(10,10)), "Positive Definite"); %!assert(matrix_type(ones(11,10)),"Rectangular") %!test %! a = matrix_type(ones(10,10),"Singular"); @@ -608,7 +608,7 @@ %!assert(matrix_type(triu(1i*ones(10,10),-1)),"Full"); %!assert(matrix_type(tril(1i*ones(10,10))),"Lower"); %!assert(matrix_type(tril(1i*ones(10,10),1)),"Full"); -%!assert(matrix_type(10*eye(10,10) + 1i*triu(ones(10,10),1) -1i*tril(ones(10,10),-1)), "Positive Definite"); +%!assert(matrix_type(10*eye(10,10) + 1i*triu(ones(10,10),1) -1i*tril(ones(10,10),-1)), "Positive Definite"); %!assert(matrix_type(ones(11,10)),"Rectangular") %!test %! a = matrix_type(ones(10,10),"Singular"); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/max.cc --- a/src/DLD-FUNCTIONS/max.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/max.cc Thu Jan 20 17:24:59 2011 -0500 @@ -257,7 +257,7 @@ { case btyp_double: { - if ((argx.is_sparse_type () + if ((argx.is_sparse_type () && (argy.is_sparse_type () || argy.is_scalar_type ())) || (argy.is_sparse_type () && argx.is_scalar_type ())) retval = do_minmax_bin_op (argx, argy, ismin); @@ -267,7 +267,7 @@ } case btyp_complex: { - if ((argx.is_sparse_type () + if ((argx.is_sparse_type () && (argy.is_sparse_type () || argy.is_scalar_type ())) || (argy.is_sparse_type () && argx.is_scalar_type ())) retval = do_minmax_bin_op (argx, argy, ismin); @@ -432,12 +432,12 @@ return do_minmax_body (args, nargout, false); } -/* +/* %% test/octave.test/arith/max-1.m %!assert (max ([1, 4, 2, 3]) == 4); %!assert (max ([1; -10; 5; -2]) == 5); - + %% test/octave.test/arith/max-2.m %!assert(all (max ([4, i 4.999; -2, 2, 3+4i]) == [4, 2, 3+4i])); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/md5sum.cc --- a/src/DLD-FUNCTIONS/md5sum.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/md5sum.cc Thu Jan 20 17:24:59 2011 -0500 @@ -57,7 +57,7 @@ if (nargin == 2) have_str = args(1).bool_value(); - + if (!error_state) { if (have_str) diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/onCleanup.cc --- a/src/DLD-FUNCTIONS/onCleanup.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/onCleanup.cc Thu Jan 20 17:24:59 2011 -0500 @@ -43,11 +43,11 @@ octave_oncleanup (void) : fcn () { } octave_oncleanup (const octave_value& fcn); - octave_base_value *clone (void) const - { + octave_base_value *clone (void) const + { if (fcn.is_defined ()) gripe_internal (); - return empty_clone (); + return empty_clone (); } octave_base_value *empty_clone (void) const { return new octave_oncleanup (); } @@ -71,7 +71,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) @@ -136,7 +136,7 @@ // Disallow quit(). frame.protect_var (quit_allowed); quit_allowed = false; - + // Clear errors. frame.protect_var (error_state); error_state = 0; @@ -172,7 +172,7 @@ } } -octave_scalar_map +octave_scalar_map octave_oncleanup::scalar_map_value (void) const { octave_scalar_map retval; @@ -180,27 +180,27 @@ return retval; } -static void +static void warn_save_load (void) { warning ("onCleanup: load and save not supported"); } -bool +bool octave_oncleanup::save_ascii (std::ostream& /* os */) { warn_save_load (); return true; } -bool +bool octave_oncleanup::load_ascii (std::istream& /* is */) { warn_save_load (); return true; } -bool +bool octave_oncleanup::save_binary (std::ostream& /* os */, bool& /* save_as_floats */) { warn_save_load (); @@ -208,8 +208,8 @@ } -bool -octave_oncleanup::load_binary (std::istream& /* is */, bool /* swap */, +bool +octave_oncleanup::load_binary (std::istream& /* is */, bool /* swap */, oct_mach_info::float_format /* fmt */) { warn_save_load (); @@ -217,15 +217,15 @@ } #if defined (HAVE_HDF5) -bool -octave_oncleanup::save_hdf5 (hid_t /* loc_id */, const char * /* name */, +bool +octave_oncleanup::save_hdf5 (hid_t /* loc_id */, const char * /* name */, bool /* save_as_floats */) { warn_save_load (); return true; } -bool +bool octave_oncleanup::load_hdf5 (hid_t /* loc_id */, const char * /* name */) { warn_save_load (); @@ -233,14 +233,14 @@ } #endif -void +void octave_oncleanup::print (std::ostream& os, bool pr_as_read_syntax) const { print_raw (os, pr_as_read_syntax); newline (os); } -void +void octave_oncleanup::print_raw (std::ostream& os, bool pr_as_read_syntax) const { os << "onCleanup ("; diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/qr.cc --- a/src/DLD-FUNCTIONS/qr.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/qr.cc Thu Jan 20 17:24:59 2011 -0500 @@ -234,7 +234,7 @@ if (have_b > 0 && args(have_b).is_complex_type ()) is_cmplx = true; } - + if (!error_state) { if (have_b && nargout < 2) @@ -457,41 +457,41 @@ %!test %! a = [0, 2, 1; 2, 1, 2]; -%! +%! %! [q, r] = qr (a); -%! +%! %! [qe, re] = qr (a, 0); -%! +%! %! assert (q * r, a, sqrt (eps)); %! assert (qe * re, a, sqrt (eps)); %!test %! a = [0, 2, 1; 2, 1, 2]; -%! +%! %! [q, r, p] = qr (a); # not giving right dimensions. FIXME -%! +%! %! [qe, re, pe] = qr (a, 0); -%! +%! %! assert (q * r, a * p, sqrt (eps)); %! assert (qe * re, a(:, pe), sqrt (eps)); %!test %! a = [0, 2; 2, 1; 1, 2]; -%! +%! %! [q, r] = qr (a); -%! +%! %! [qe, re] = qr (a, 0); -%! +%! %! assert (q * r, a, sqrt (eps)); %! assert (qe * re, a, sqrt (eps)); %!test %! a = [0, 2; 2, 1; 1, 2]; -%! +%! %! [q, r, p] = qr (a); -%! +%! %! [qe, re, pe] = qr (a, 0); -%! +%! %! assert (q * r, a * p, sqrt (eps)); %! assert (qe * re, a(:, pe), sqrt (eps)); @@ -517,48 +517,48 @@ %! endif %! endif %!test -%! +%! %! t = ones (24, 1); %! j = 1; -%! +%! %! if false # eliminate big matrix tests %! a = rand(5000,20); %! [q,r]=qr(a,0); t(j++) = testqr(q,r,a); %! [q,r]=qr(a',0); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a,0); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a',0); t(j++) = testqr(q,r,a',p); -%! +%! %! a = a+1i*eps; %! [q,r]=qr(a,0); t(j++) = testqr(q,r,a); %! [q,r]=qr(a',0); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a,0); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a',0); t(j++) = testqr(q,r,a',p); %! endif -%! +%! %! a = [ ones(1,15); sqrt(eps)*eye(15) ]; %! [q,r]=qr(a); t(j++) = testqr(q,r,a); %! [q,r]=qr(a'); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a'); t(j++) = testqr(q,r,a',p); -%! +%! %! a = a+1i*eps; %! [q,r]=qr(a); t(j++) = testqr(q,r,a); %! [q,r]=qr(a'); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a'); t(j++) = testqr(q,r,a',p); -%! +%! %! a = [ ones(1,15); sqrt(eps)*eye(15) ]; %! [q,r]=qr(a,0); t(j++) = testqr(q,r,a); %! [q,r]=qr(a',0); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a,0); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a',0); t(j++) = testqr(q,r,a',p); -%! +%! %! a = a+1i*eps; %! [q,r]=qr(a,0); t(j++) = testqr(q,r,a); %! [q,r]=qr(a',0); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a,0); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a',0); t(j++) = testqr(q,r,a',p); -%! +%! %! a = [ %! 611 196 -192 407 -8 -52 -49 29 %! 196 899 113 -192 -71 -43 -8 -44 @@ -570,46 +570,46 @@ %! 29 -44 52 -23 208 208 -911 99 %! ]; %! [q,r] = qr(a); -%! +%! %! assert(all (t) && norm(q*r-a) < 5000*eps); %!test %! a = single ([0, 2, 1; 2, 1, 2]); -%! +%! %! [q, r] = qr (a); -%! +%! %! [qe, re] = qr (a, 0); -%! +%! %! assert (q * r, a, sqrt (eps ('single'))); %! assert (qe * re, a, sqrt (eps ('single'))); %!test %! a = single([0, 2, 1; 2, 1, 2]); -%! +%! %! [q, r, p] = qr (a); # not giving right dimensions. FIXME -%! +%! %! [qe, re, pe] = qr (a, 0); -%! +%! %! assert (q * r, a * p, sqrt (eps('single'))); %! assert (qe * re, a(:, pe), sqrt (eps('single'))); %!test %! a = single([0, 2; 2, 1; 1, 2]); -%! +%! %! [q, r] = qr (a); -%! +%! %! [qe, re] = qr (a, 0); -%! +%! %! assert (q * r, a, sqrt (eps('single'))); %! assert (qe * re, a, sqrt (eps('single'))); %!test %! a = single([0, 2; 2, 1; 1, 2]); -%! +%! %! [q, r, p] = qr (a); -%! +%! %! [qe, re, pe] = qr (a, 0); -%! +%! %! assert (q * r, a * p, sqrt (eps('single'))); %! assert (qe * re, a(:, pe), sqrt (eps('single'))); @@ -617,48 +617,48 @@ %!error qr ([1, 2; 3, 4], 0, 2); %!test -%! +%! %! t = ones (24, 1); %! j = 1; -%! +%! %! if false # eliminate big matrix tests %! a = rand(5000,20); %! [q,r]=qr(a,0); t(j++) = testqr(q,r,a); %! [q,r]=qr(a',0); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a,0); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a',0); t(j++) = testqr(q,r,a',p); -%! +%! %! a = a+1i*eps('single'); %! [q,r]=qr(a,0); t(j++) = testqr(q,r,a); %! [q,r]=qr(a',0); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a,0); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a',0); t(j++) = testqr(q,r,a',p); %! endif -%! +%! %! a = [ ones(1,15); sqrt(eps('single'))*eye(15) ]; %! [q,r]=qr(a); t(j++) = testqr(q,r,a); %! [q,r]=qr(a'); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a'); t(j++) = testqr(q,r,a',p); -%! +%! %! a = a+1i*eps('single'); %! [q,r]=qr(a); t(j++) = testqr(q,r,a); %! [q,r]=qr(a'); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a'); t(j++) = testqr(q,r,a',p); -%! +%! %! a = [ ones(1,15); sqrt(eps('single'))*eye(15) ]; %! [q,r]=qr(a,0); t(j++) = testqr(q,r,a); %! [q,r]=qr(a',0); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a,0); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a',0); t(j++) = testqr(q,r,a',p); -%! +%! %! a = a+1i*eps('single'); %! [q,r]=qr(a,0); t(j++) = testqr(q,r,a); %! [q,r]=qr(a',0); t(j++) = testqr(q,r,a'); %! [q,r,p]=qr(a,0); t(j++) = testqr(q,r,a,p); %! [q,r,p]=qr(a',0); t(j++) = testqr(q,r,a',p); -%! +%! %! a = [ %! 611 196 -192 407 -8 -52 -49 29 %! 196 899 113 -192 -71 -43 -8 -44 @@ -670,7 +670,7 @@ %! 29 -44 52 -23 208 208 -911 99 %! ]; %! [q,r] = qr(a); -%! +%! %! assert(all (t) && norm(q*r-a) < 5000*eps('single')); %% The deactivated tests below can't be tested till rectangular back-subs is @@ -759,10 +759,10 @@ && (m == k || (allow_ecf && k == n && k < m))); } -static +static bool check_index (const octave_value& i, bool vector_allowed = false) { - return ((i.is_real_type () || i.is_integer_type ()) + return ((i.is_real_type () || i.is_integer_type ()) && (i.is_scalar_type () || vector_allowed)); } @@ -798,20 +798,20 @@ octave_value argu = args(2); octave_value argv = args(3); - if (argq.is_numeric_type () && argr.is_numeric_type () + if (argq.is_numeric_type () && argr.is_numeric_type () && argu.is_numeric_type () && argv.is_numeric_type ()) { if (check_qr_dims (argq, argr, true)) { - if (argq.is_real_type () - && argr.is_real_type () - && argu.is_real_type () + if (argq.is_real_type () + && argr.is_real_type () + && argu.is_real_type () && argv.is_real_type ()) { // all real case - if (argq.is_single_type () - || argr.is_single_type () - || argu.is_single_type () + if (argq.is_single_type () + || argr.is_single_type () + || argu.is_single_type () || argv.is_single_type ()) { FloatMatrix Q = argq.float_matrix_value (); @@ -842,9 +842,9 @@ else { // complex case - if (argq.is_single_type () - || argr.is_single_type () - || argu.is_single_type () + if (argq.is_single_type () + || argr.is_single_type () + || argu.is_single_type () || argv.is_single_type ()) { FloatComplexMatrix Q = argq.float_complex_matrix_value (); @@ -854,7 +854,7 @@ FloatComplexQR fact (Q, R); fact.update (u, v); - + retval(1) = get_qr_r (fact); retval(0) = fact.Q (); } @@ -867,7 +867,7 @@ ComplexQR fact (Q, R); fact.update (u, v); - + retval(1) = get_qr_r (fact); retval(0) = fact.Q (); } @@ -889,10 +889,10 @@ %! 0.265712 0.268003 0.238409; %! 0.669966 0.743851 0.445057 ]; %! -%! u = [0.85082; -%! 0.76426; -%! 0.42883; -%! 0.53010; +%! u = [0.85082; +%! 0.76426; +%! 0.42883; +%! 0.53010; %! 0.80683 ]; %! %! v = [0.98810; @@ -922,7 +922,7 @@ %! assert(norm(vec(Q'*Q - eye(5)),Inf) < 1e1*eps) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - A - u*v'),Inf) < norm(A)*1e1*eps) -%! +%! %!test %! [Q,R] = qr(Ac); %! [Q,R] = qrupdate(Q,R,uc,vc); @@ -936,7 +936,7 @@ %! assert(norm(vec(Q'*Q - eye(5,'single')),Inf) < 1e1*eps('single')) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - single(A) - single(u)*single(v)'),Inf) < norm(single(A))*1e1*eps('single')) -%! +%! %!test %! [Q,R] = qr(single(Ac)); %! [Q,R] = qrupdate(Q,R,single(uc),single(vc)); @@ -982,12 +982,12 @@ print_usage (); return retval; } - + octave_value argq = args(0); octave_value argr = args(1); octave_value argj = args(2); octave_value argx = args(3); - + if (argq.is_numeric_type () && argr.is_numeric_type () && argx.is_numeric_type () && (nargin < 5 || args(4).is_string ())) @@ -997,7 +997,7 @@ bool col = orient == "col"; if (col || orient == "row") - if (check_qr_dims (argq, argr, col) + if (check_qr_dims (argq, argr, col) && (col || argx.rows () == 1)) { if (check_index (argj, col)) @@ -1007,13 +1007,13 @@ octave_idx_type one = 1; - if (argq.is_real_type () - && argr.is_real_type () + if (argq.is_real_type () + && argr.is_real_type () && argx.is_real_type ()) { // real case - if (argq.is_single_type () - || argr.is_single_type () + if (argq.is_single_type () + || argr.is_single_type () || argx.is_single_type ()) { FloatMatrix Q = argq.float_matrix_value (); @@ -1022,9 +1022,9 @@ FloatQR fact (Q, R); - if (col) + if (col) fact.insert_col (x, j-one); - else + else fact.insert_row (x.row (0), j(0)-one); retval(1) = get_qr_r (fact); @@ -1039,9 +1039,9 @@ QR fact (Q, R); - if (col) + if (col) fact.insert_col (x, j-one); - else + else fact.insert_row (x.row (0), j(0)-one); retval(1) = get_qr_r (fact); @@ -1052,8 +1052,8 @@ else { // complex case - if (argq.is_single_type () - || argr.is_single_type () + if (argq.is_single_type () + || argr.is_single_type () || argx.is_single_type ()) { FloatComplexMatrix Q = argq.float_complex_matrix_value (); @@ -1062,9 +1062,9 @@ FloatComplexQR fact (Q, R); - if (col) + if (col) fact.insert_col (x, j-one); - else + else fact.insert_row (x.row (0), j(0)-one); retval(1) = get_qr_r (fact); @@ -1078,9 +1078,9 @@ ComplexQR fact (Q, R); - if (col) + if (col) fact.insert_col (x, j-one); - else + else fact.insert_row (x.row (0), j(0)-one); retval(1) = get_qr_r (fact); @@ -1235,9 +1235,9 @@ FloatQR fact (Q, R); - if (col) + if (col) fact.delete_col (j-one); - else + else fact.delete_row (j(0)-one); retval(1) = get_qr_r (fact); @@ -1250,9 +1250,9 @@ QR fact (Q, R); - if (col) + if (col) fact.delete_col (j-one); - else + else fact.delete_row (j(0)-one); retval(1) = get_qr_r (fact); @@ -1270,9 +1270,9 @@ FloatComplexQR fact (Q, R); - if (col) + if (col) fact.delete_col (j-one); - else + else fact.delete_row (j(0)-one); retval(1) = get_qr_r (fact); @@ -1285,9 +1285,9 @@ ComplexQR fact (Q, R); - if (col) + if (col) fact.delete_col (j-one); - else + else fact.delete_row (j(0)-one); retval(1) = get_qr_r (fact); @@ -1309,7 +1309,7 @@ return retval; } - + /* %!test %! AA = [0.091364 0.613038 0.027504 0.999083; @@ -1323,7 +1323,7 @@ %! assert(norm(vec(Q'*Q - eye(5)),Inf) < 16*eps) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - [AA(:,1:2) AA(:,4)]),Inf) < norm(AA)*1e1*eps) -%! +%! %!test %! AA = [0.364554 + 0.993117i 0.669818 + 0.510234i 0.426568 + 0.041337i 0.847051 + 0.233291i; %! 0.049600 + 0.242783i 0.448946 + 0.484022i 0.141155 + 0.074420i 0.446746 + 0.392706i; @@ -1349,7 +1349,7 @@ %! assert(norm(vec(Q'*Q - eye(4)),Inf) < 1e1*eps) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - [AA(1:2,:);AA(4:5,:)]),Inf) < norm(AA)*1e1*eps) -%! +%! %!test %! AA = [0.364554 + 0.993117i 0.669818 + 0.510234i 0.426568 + 0.041337i 0.847051 + 0.233291i; %! 0.049600 + 0.242783i 0.448946 + 0.484022i 0.141155 + 0.074420i 0.446746 + 0.392706i; @@ -1375,7 +1375,7 @@ %! assert(norm(vec(Q'*Q - eye(5,'single')),Inf) < 1e1*eps('single')) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - [AA(:,1:2) AA(:,4)]),Inf) < norm(AA)*1e1*eps('single')) -%! +%! %!test %! AA = single([0.364554 + 0.993117i 0.669818 + 0.510234i 0.426568 + 0.041337i 0.847051 + 0.233291i; %! 0.049600 + 0.242783i 0.448946 + 0.484022i 0.141155 + 0.074420i 0.446746 + 0.392706i; @@ -1414,7 +1414,7 @@ %! assert(norm(vec(Q'*Q - eye(4,'single')),Inf) < 1e1*eps('single')) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - [AA(1:2,:);AA(4:5,:)]),Inf) < norm(AA)*1e1*eps('single')) -%! +%! %!test %! AA = single([0.364554 + 0.993117i 0.669818 + 0.510234i 0.426568 + 0.041337i 0.847051 + 0.233291i; %! 0.049600 + 0.242783i 0.448946 + 0.484022i 0.141155 + 0.074420i 0.446746 + 0.392706i; @@ -1466,11 +1466,11 @@ octave_idx_type i = argi.int_value (); octave_idx_type j = argj.int_value (); - if (argq.is_real_type () + if (argq.is_real_type () && argr.is_real_type ()) { // all real case - if (argq.is_single_type () + if (argq.is_single_type () && argr.is_single_type ()) { FloatMatrix Q = argq.float_matrix_value (); @@ -1497,7 +1497,7 @@ else { // complex case - if (argq.is_single_type () + if (argq.is_single_type () && argr.is_single_type ()) { FloatComplexMatrix Q = argq.float_complex_matrix_value (); @@ -1505,7 +1505,7 @@ FloatComplexQR fact (Q, R); fact.shift_cols (i-1, j-1); - + retval(1) = get_qr_r (fact); retval(0) = fact.Q (); } @@ -1516,7 +1516,7 @@ ComplexQR fact (Q, R); fact.shift_cols (i-1, j-1); - + retval(1) = get_qr_r (fact); retval(0) = fact.Q (); } @@ -1543,7 +1543,7 @@ %! assert(norm(vec(Q'*Q - eye(3)),Inf) < 1e1*eps) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - AA(:,p)),Inf) < norm(AA)*1e1*eps) -%! +%! %! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5]; %! %! [Q,R] = qr(AA); @@ -1551,7 +1551,7 @@ %! assert(norm(vec(Q'*Q - eye(3)),Inf) < 1e1*eps) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - AA(:,p)),Inf) < norm(AA)*1e1*eps) -%! +%! %!test %! AA = Ac.'; %! i = 2; j = 4; p = [1:i-1, shift(i:j,-1), j+1:5]; @@ -1561,7 +1561,7 @@ %! assert(norm(vec(Q'*Q - eye(3)),Inf) < 1e1*eps) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - AA(:,p)),Inf) < norm(AA)*1e1*eps) -%! +%! %! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5]; %! %! [Q,R] = qr(AA); @@ -1580,7 +1580,7 @@ %! assert(norm(vec(Q'*Q - eye(3,'single')),Inf) < 1e1*eps('single')) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - AA(:,p)),Inf) < norm(AA)*1e1*eps('single')) -%! +%! %! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5]; %! %! [Q,R] = qr(AA); @@ -1588,7 +1588,7 @@ %! assert(norm(vec(Q'*Q - eye(3,'single')),Inf) < 1e1*eps('single')) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - AA(:,p)),Inf) < norm(AA)*1e1*eps('single')) -%! +%! %!test %! AA = single(Ac).'; %! i = 2; j = 4; p = [1:i-1, shift(i:j,-1), j+1:5]; @@ -1598,7 +1598,7 @@ %! assert(norm(vec(Q'*Q - eye(3,'single')),Inf) < 1e1*eps('single')) %! assert(norm(vec(triu(R)-R),Inf) == 0) %! assert(norm(vec(Q*R - AA(:,p)),Inf) < norm(AA)*1e1*eps('single')) -%! +%! %! j = 2; i = 4; p = [1:j-1, shift(j:i,+1), i+1:5]; %! %! [Q,R] = qr(AA); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/quad.cc --- a/src/DLD-FUNCTIONS/quad.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/quad.cc Thu Jan 20 17:24:59 2011 -0500 @@ -326,7 +326,7 @@ case 3: if (indefinite) { - FloatIndefQuad iq (quad_float_user_function, bound, + FloatIndefQuad iq (quad_float_user_function, bound, indef_type); iq.set_options (quad_opts); val = iq.float_integrate (ier, nfun, abserr); @@ -478,15 +478,15 @@ /* -%!function y = f (x) +%!function y = f (x) %! y = x + 1; %!test %! [v, ier, nfun, err] = quad ("f", 0, 5); -%! assert(ier == 0 && abs (v - 17.5) < sqrt (eps) && nfun > 0 && +%! assert(ier == 0 && abs (v - 17.5) < sqrt (eps) && nfun > 0 && %! err < sqrt (eps)) %!test %! [v, ier, nfun, err] = quad ("f", single(0), single(5)); -%! assert(ier == 0 && abs (v - 17.5) < sqrt (eps ("single")) && nfun > 0 && +%! assert(ier == 0 && abs (v - 17.5) < sqrt (eps ("single")) && nfun > 0 && %! err < sqrt (eps ("single"))) %!function y = f (x) diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/quadcc.cc --- a/src/DLD-FUNCTIONS/quadcc.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/quadcc.cc Thu Jan 20 17:24:59 2011 -0500 @@ -1477,7 +1477,7 @@ /* The actual integration routine. */ -DEFUN_DLD (quadcc, args, nargout, +DEFUN_DLD (quadcc, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Function File} {[@var{int}, @var{err}, @var{nr_points}] =} quadcc (@var{f}, @var{a}, @var{b}, @var{tol})\n\ @deftypefnx {Function File} {[@var{int}, @var{err}, @var{nr_points}] =} quadcc (@var{f}, @var{a}, @var{b}, @var{tol}, @var{sing})\n\ @@ -2038,8 +2038,8 @@ /* Compute the local integral. */ ivl->igral = h * w * ivl->c[0]; - - + + /* Generate the interval on the right */ ivr = &(ivals[heap[nivals++]]); ivr->a = m; @@ -2136,8 +2136,8 @@ /* Compute the local integral. */ ivr->igral = h * w * ivr->c[0]; - - + + /* Fix-up the heap: we now have one interval on top that we don't need any more and two new, unsorted ones at the bottom. */ diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/qz.cc --- a/src/DLD-FUNCTIONS/qz.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/qz.cc Thu Jan 20 17:24:59 2011 -0500 @@ -82,7 +82,7 @@ octave_idx_type& IHI, double* LSCALE, double* RSCALE, double* WORK, octave_idx_type& INFO - F77_CHAR_ARG_LEN_DECL); + F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (dggbak, DGGBAK) (F77_CONST_CHAR_ARG_DECL, @@ -162,8 +162,8 @@ Complex* A, const octave_idx_type& LDA, Complex* B, const octave_idx_type& LDB, Complex* ALPHA, Complex* BETA, Complex* CQ, - const octave_idx_type& LDQ, - Complex* CZ, const octave_idx_type& LDZ, + const octave_idx_type& LDQ, + Complex* CZ, const octave_idx_type& LDZ, Complex* WORK, const octave_idx_type& LWORK, double* RWORK, octave_idx_type& INFO F77_CHAR_ARG_LEN_DECL @@ -624,7 +624,7 @@ #endif static char qz_job; - qz_job = (nargout < 2 ? 'E' : 'S'); + qz_job = (nargout < 2 ? 'E' : 'S'); if (complex_case) { @@ -647,24 +647,24 @@ F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - ComplexRowVector cwork (1 * nn); + ComplexRowVector cwork (1 * nn); F77_XFCN (zhgeqz, ZHGEQZ, (F77_CONST_CHAR_ARG2 (&qz_job, 1), F77_CONST_CHAR_ARG2 (&compq, 1), F77_CONST_CHAR_ARG2 (&compz, 1), - nn, ilo, ihi, - caa.fortran_vec (), nn, - cbb.fortran_vec (),nn, - xalpha.fortran_vec (), xbeta.fortran_vec (), + nn, ilo, ihi, + caa.fortran_vec (), nn, + cbb.fortran_vec (),nn, + xalpha.fortran_vec (), xbeta.fortran_vec (), CQ.fortran_vec (), nn, - CZ.fortran_vec (), nn, + CZ.fortran_vec (), nn, cwork.fortran_vec (), nn, rwork.fortran_vec (), info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1) - F77_CHAR_ARG_LEN (1))); + F77_CHAR_ARG_LEN (1))); - if (compq == 'V') + if (compq == 'V') { // Left eigenvector. F77_XFCN (zggbak, ZGGBAK, @@ -674,7 +674,7 @@ nn, CQ.fortran_vec (), nn, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - } + } // Right eigenvector. if (compz == 'V') @@ -686,7 +686,7 @@ nn, CZ.fortran_vec (), nn, info F77_CHAR_ARG_LEN (1) F77_CHAR_ARG_LEN (1))); - } + } } else @@ -1072,7 +1072,7 @@ nn, CVL.fortran_vec (), nn, CVR.fortran_vec (), nn, nn, m, cwork2.fortran_vec (), rwork2.fortran_vec (), info F77_CHAR_ARG_LEN (1) - F77_CHAR_ARG_LEN (1))); + F77_CHAR_ARG_LEN (1))); } else { @@ -1197,7 +1197,7 @@ std::cout << std::endl << "qz: retval(0) = caa = " <0.); %*** Please report this!!! *** %! assert(mean(x),0.5,0.0024); %! assert(var(x),1/48,0.0632); -%! assert(skewness(x),0,0.012); +%! assert(skewness(x),0,0.012); %! assert(kurtosis(x),-6/5,0.0094); %! endif %!test @@ -480,7 +480,7 @@ %! assert(min(x)>0.); %*** Please report this!!! *** %! assert(mean(x),0.5,0.0024); %! assert(var(x),1/48,0.0632); -%! assert(skewness(x),0,0.012); +%! assert(skewness(x),0,0.012); %! assert(kurtosis(x),-6/5,0.0094); %! endif */ @@ -1034,7 +1034,7 @@ if (nargin == 1 || nargin == 2) { octave_idx_type n, m; - + if (nargin == 2) m = args(1).idx_type_value (true); else @@ -1085,7 +1085,7 @@ rvec[i] = ivec[i] + 1; // Now create an array object with a cached idx_vector. - retval = new octave_matrix (r, idx_vector (idx)); + retval = new octave_matrix (r, idx_vector (idx)); } } else diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/regexp.cc --- a/src/DLD-FUNCTIONS/regexp.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/regexp.cc Thu Jan 20 17:24:59 2011 -0500 @@ -51,7 +51,7 @@ #include #endif -// Define the maximum number of retries for a pattern that +// Define the maximum number of retries for a pattern that // possibly results in an infinite recursion. #define PCRE_MATCHLIMIT_MAX 10 @@ -64,12 +64,12 @@ class regexp_elem { public: - regexp_elem (const string_vector& _named_token, const Cell& _t, - const std::string& _m, const Matrix& _te, double _s, + regexp_elem (const string_vector& _named_token, const Cell& _t, + const std::string& _m, const Matrix& _te, double _s, double _e) : named_token (_named_token), t (_t), m (_m), te (_te), s (_s), e (_e) { } - regexp_elem (const regexp_elem &a) : named_token (a.named_token), t (a.t), + regexp_elem (const regexp_elem &a) : named_token (a.named_token), t (a.t), m (a.m), te (a.te), s (a.s), e (a.e) { } @@ -87,12 +87,12 @@ static bool lookbehind_warned = false; static int -octregexp_list (const octave_value_list &args, const std::string &nm, - bool case_insensitive, std::list &lst, +octregexp_list (const octave_value_list &args, const std::string &nm, + bool case_insensitive, std::list &lst, string_vector &named, int &nopts, bool &once) { int sz = 0; -#if defined (HAVE_REGEX) || defined (HAVE_PCRE) +#if defined (HAVE_REGEX) || defined (HAVE_PCRE) int nargin = args.length(); bool lineanchors = false; bool dotexceptnewline = false; @@ -102,7 +102,7 @@ once = false; std::string buffer = args(0).string_value (); - size_t max_length = (buffer.length () > MAXLOOKBEHIND ? + size_t max_length = (buffer.length () > MAXLOOKBEHIND ? MAXLOOKBEHIND: buffer.length ()); if (error_state) @@ -199,7 +199,7 @@ // named tokens "(?...)" are only treated with PCRE not regex. #if HAVE_PCRE - + size_t pos = 0; size_t new_pos; int nnames = 0; @@ -209,14 +209,14 @@ while ((new_pos = pattern.find ("(?",pos)) != std::string::npos) { - if (pattern.at (new_pos + 2) == '<' && + if (pattern.at (new_pos + 2) == '<' && !(pattern.at (new_pos + 3) == '=' || pattern.at (new_pos + 3) == '!')) { // The syntax of named tokens in pcre is "(?P...)" while - // we need a syntax "(?...)", so fix that here. Also an - // expression like - // "(?\w+)\s+(?\w+)|(?\w+),\s+(?\w+)" + // we need a syntax "(?...)", so fix that here. Also an + // expression like + // "(?\w+)\s+(?\w+)|(?\w+),\s+(?\w+)" // should be perfectly legal, while pcre does not allow the same // named token name on both sides of the alternative. Also fix // that here by replacing name tokens by dummy names, and dealing @@ -230,7 +230,7 @@ break; } - std::string tmp_name = + std::string tmp_name = pattern.substr(new_pos+3,tmp_pos-new_pos-3); bool found = false; @@ -262,10 +262,10 @@ } else if (pattern.at (new_pos + 2) == '<') { - // Find lookbehind operators of arbitrary length (ie like - // "(?<=[a-z]*)") and replace with a maximum length operator - // as PCRE can not yet handle arbitrary length lookahead - // operators. Use the string length as the maximum length to + // Find lookbehind operators of arbitrary length (ie like + // "(?<=[a-z]*)") and replace with a maximum length operator + // as PCRE can not yet handle arbitrary length lookahead + // operators. Use the string length as the maximum length to // avoid issues. int brackets = 1; @@ -314,7 +314,7 @@ { buf << pattern.substr(new_pos, tmp_pos3 - new_pos) << "{" << i << "}"; - buf << pattern.substr(tmp_pos3 + 1, + buf << pattern.substr(tmp_pos3 + 1, tmp_pos1 - tmp_pos3 - 1); if (i != max_length) buf << "|"; @@ -350,10 +350,10 @@ (lineanchors ? PCRE_MULTILINE : 0) | (freespacing ? PCRE_EXTENDED : 0), &err, &erroffset, 0); - + if (re == 0) { - error("%s: %s at position %d of expression", nm.c_str(), + error("%s: %s at position %d of expression", nm.c_str(), err, erroffset); return 0; } @@ -384,8 +384,8 @@ { OCTAVE_QUIT; - int matches = pcre_exec(re, 0, buffer.c_str(), - buffer.length(), idx, + int matches = pcre_exec(re, 0, buffer.c_str(), + buffer.length(), idx, (idx ? PCRE_NOTBOL : 0), ovector, (subpatterns+1)*3); @@ -404,8 +404,8 @@ OCTAVE_QUIT; pe.match_limit *= 10; - matches = pcre_exec(re, &pe, buffer.c_str(), - buffer.length(), idx, + matches = pcre_exec(re, &pe, buffer.c_str(), + buffer.length(), idx, (idx ? PCRE_NOTBOL : 0), ovector, (subpatterns+1)*3); } @@ -445,7 +445,7 @@ e = double (ovector[1]); const char **listptr; - int status = pcre_get_substring_list(buffer.c_str(), ovector, + int status = pcre_get_substring_list(buffer.c_str(), ovector, matches, &listptr); if (status == PCRE_ERROR_NOMEMORY) @@ -467,9 +467,9 @@ || ovector[2*i-1] != ovector[2*i+1]) { if (namecount > 0) - named_tokens(named_idx(i-pos_offset-1)) = - std::string(*(listptr+nidx[i-pos_offset-1])); - cell_t(pos_match++) = + named_tokens(named_idx(i-pos_offset-1)) = + std::string(*(listptr+nidx[i-pos_offset-1])); + cell_t(pos_match++) = std::string(*(listptr+i)); } else @@ -495,14 +495,14 @@ pcre_free(re); #else regex_t compiled; - int err=regcomp(&compiled, pattern.c_str(), REG_EXTENDED | + int err=regcomp(&compiled, pattern.c_str(), REG_EXTENDED | (case_insensitive ? REG_ICASE : 0)); if (err) { int len = regerror(err, &compiled, 0, 0); OCTAVE_LOCAL_BUFFER (char, errmsg, len); regerror(err, &compiled, errmsg, len); - error("%s: %s in pattern (%s)", nm.c_str(), errmsg, + error("%s: %s in pattern (%s)", nm.c_str(), errmsg, pattern.c_str()); regfree(&compiled); return 0; @@ -516,14 +516,14 @@ while(true) { - OCTAVE_QUIT; + OCTAVE_QUIT; - if (regexec(&compiled, buffer.c_str() + idx, subexpr, - match, (idx ? REG_NOTBOL : 0)) == 0) + if (regexec(&compiled, buffer.c_str() + idx, subexpr, + match, (idx ? REG_NOTBOL : 0)) == 0) { // Count actual matches int matches = 0; - while (matches < subexpr && match[matches].rm_so >= 0) + while (matches < subexpr && match[matches].rm_so >= 0) matches++; if (matches == 0 || match[0].rm_eo == 0) @@ -538,12 +538,12 @@ te(i-1,1) = double (match[i].rm_eo+idx); } - m = buffer.substr (match[0].rm_so+idx, + m = buffer.substr (match[0].rm_so+idx, match[0].rm_eo-match[0].rm_so); Cell cell_t (dim_vector(1,matches-1)); for (int i = 1; i < matches; i++) - cell_t(i-1) = buffer.substr (match[i].rm_so+idx, + cell_t(i-1) = buffer.substr (match[i].rm_so+idx, match[i].rm_eo-match[i].rm_so); t = cell_t; @@ -686,7 +686,7 @@ OCTAVE_LOCAL_BUFFER (int, arg_used, 6); for (int j = 0; j < 6; j++) arg_used[j] = false; - + for (int j = 2; j < nargin; j++) { int k = 0; @@ -765,7 +765,7 @@ for (octave_idx_type i = 0; i < cellstr.numel (); i++) { new_args(0) = cellstr(i); - octave_value_list tmp = octregexp (new_args, nargout, nm, + octave_value_list tmp = octregexp (new_args, nargout, nm, case_insensitive); if (error_state) @@ -785,7 +785,7 @@ for (octave_idx_type i = 0; i < cellpat.numel (); i++) { new_args(1) = cellpat(i); - octave_value_list tmp = octregexp (new_args, nargout, nm, + octave_value_list tmp = octregexp (new_args, nargout, nm, case_insensitive); if (error_state) @@ -810,7 +810,7 @@ new_args(0) = cellstr(i); new_args(1) = cellpat(i); - octave_value_list tmp = octregexp (new_args, nargout, nm, + octave_value_list tmp = octregexp (new_args, nargout, nm, case_insensitive); if (error_state) @@ -1436,41 +1436,41 @@ if (error_state) return retval; const std::string replacement = args(2).string_value (); if (error_state) return retval; - + // Pack options excluding 'tokenize' and various output // reordering strings into regexp arg list octave_value_list regexpargs(nargin-1,octave_value()); regexpargs(0) = args(0); regexpargs(1) = args(1); int len=2; - for (int i = 3; i < nargin; i++) + for (int i = 3; i < nargin; i++) { const std::string opt = args(i).string_value(); if (opt != "tokenize" && opt != "start" && opt != "end" && opt != "tokenextents" && opt != "match" && opt != "tokens" - && opt != "names" && opt != "warnings") + && opt != "names" && opt != "warnings") { regexpargs(len++) = args(i); } } regexpargs.resize(len); - + // Identify replacement tokens; build a vector of group numbers in - // the replacement string so that we can quickly calculate the size + // the replacement string so that we can quickly calculate the size // of the replacement. int tokens = 0; - for (size_t i=1; i < replacement.size(); i++) + for (size_t i=1; i < replacement.size(); i++) { - if (replacement[i-1]=='$' && isdigit(replacement[i])) + if (replacement[i-1]=='$' && isdigit(replacement[i])) { tokens++, i++; } } std::vector token(tokens); int kk = 0; - for (size_t i = 1; i < replacement.size(); i++) + for (size_t i = 1; i < replacement.size(); i++) { - if (replacement[i-1]=='$' && isdigit(replacement[i])) + if (replacement[i-1]=='$' && isdigit(replacement[i])) { token[kk++] = replacement[i]-'0'; i++; @@ -1479,7 +1479,7 @@ // Perform replacement std::string rep; - if (tokens > 0) + if (tokens > 0) { std::list lst; string_vector named; @@ -1499,65 +1499,65 @@ const size_t replen = replacement.size() - 2*tokens; int delta = 0; const_iterator p = lst.begin(); - for (int i = 0; i < sz; i++) + for (int i = 0; i < sz; i++) { OCTAVE_QUIT; const Matrix pairs(p->te); size_t pairlen = 0; - for (int j = 0; j < tokens; j++) + for (int j = 0; j < tokens; j++) { - if (token[j] == 0) + if (token[j] == 0) pairlen += static_cast(p->e - p->s) + 1; - else if (token[j] <= pairs.rows()) - pairlen += static_cast(pairs(token[j]-1,1) - + else if (token[j] <= pairs.rows()) + pairlen += static_cast(pairs(token[j]-1,1) - pairs(token[j]-1,0)) + 1; } - delta += static_cast(replen + pairlen) - + delta += static_cast(replen + pairlen) - static_cast(p->e - p->s + 1); p++; } - + // Build replacement string rep.reserve(buffer.size()+delta); size_t from = 0; p = lst.begin(); - for (int i=0; i < sz; i++) + for (int i=0; i < sz; i++) { OCTAVE_QUIT; const Matrix pairs(p->te); rep.append(&buffer[from], static_cast(p->s - 1) - from); from = static_cast(p->e - 1) + 1; - for (size_t j = 1; j < replacement.size(); j++) + for (size_t j = 1; j < replacement.size(); j++) { - if (replacement[j-1]=='$' && isdigit(replacement[j])) + if (replacement[j-1]=='$' && isdigit(replacement[j])) { int k = replacement[j]-'0'; - if (k == 0) - { + if (k == 0) + { // replace with entire match rep.append(&buffer[static_cast(p->e - 1)], static_cast(p->e - p->s) + 1); - } - else if (k <= pairs.rows()) + } + else if (k <= pairs.rows()) { // replace with group capture rep.append(&buffer[static_cast(pairs(k-1,0)-1)], - static_cast(pairs(k-1,1) - + static_cast(pairs(k-1,1) - pairs(k-1,0))+1); } - else + else { // replace with nothing } j++; - } - else + } + else { rep.append(1,replacement[j-1]); } - if (j+1 == replacement.size()) + if (j+1 == replacement.size()) { rep.append(1,replacement[j]); } @@ -1565,8 +1565,8 @@ p++; } rep.append(&buffer[from],buffer.size()-from); - } - else + } + else { std::list lst; string_vector named; @@ -1586,10 +1586,10 @@ const size_t replen = replacement.size(); int delta = 0; const_iterator p = lst.begin(); - for (int i = 0; i < sz; i++) + for (int i = 0; i < sz; i++) { OCTAVE_QUIT; - delta += static_cast(replen) - + delta += static_cast(replen) - static_cast(p->e - p->s + 1); p++; } @@ -1598,7 +1598,7 @@ rep.reserve(buffer.size()+delta); size_t from = 0; p = lst.begin(); - for (int i=0; i < sz; i++) + for (int i=0; i < sz; i++) { OCTAVE_QUIT; rep.append(&buffer[from], static_cast(p->s - 1) - from); @@ -1608,7 +1608,7 @@ } rep.append(&buffer[from],buffer.size()-from); } - + retval = rep; return retval; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/schur.cc --- a/src/DLD-FUNCTIONS/schur.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/schur.cc Thu Jan 20 17:24:59 2011 -0500 @@ -242,7 +242,7 @@ if (nargin == 2) { - ord = args(1).string_value (); + ord = args(1).string_value (); if (error_state) { @@ -309,7 +309,7 @@ if (! error_state) { - + if (nargout == 0 || nargout == 1) { FloatComplexSCHUR result (ctmp, ord, false); @@ -351,7 +351,7 @@ if (! error_state) { - + if (nargout == 0 || nargout == 1) { ComplexSCHUR result (ctmp, ord, false); @@ -366,8 +366,8 @@ } } } - - return retval; + + return retval; } /* diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/spparms.cc --- a/src/DLD-FUNCTIONS/spparms.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/spparms.cc Thu Jan 20 17:24:59 2011 -0500 @@ -117,7 +117,7 @@ retval (1) = octave_sparse_params::get_vals (); } else - error ("spparms: too many output arguments"); + error ("spparms: too many output arguments"); } else if (nargin == 1) { @@ -158,7 +158,7 @@ if (args(0).is_string ()) { std::string str = args(0).string_value (); - + double val = args(1).double_value (); if (error_state) diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/sqrtm.cc --- a/src/DLD-FUNCTIONS/sqrtm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/sqrtm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -49,7 +49,7 @@ bool singular = false; - /* + /* * the following code is equivalent to this triple loop: * * n = rows (T); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/str2double.cc --- a/src/DLD-FUNCTIONS/str2double.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/str2double.cc Thu Jan 20 17:24:59 2011 -0500 @@ -38,7 +38,7 @@ #include "gripes.h" #include "utils.h" -static inline bool +static inline bool is_imag_unit (int c) { return c == 'i' || c == 'j'; } @@ -69,7 +69,7 @@ num = octave_NA; is.peek (); // Sets eof bit. } - else + else { char c2 = is.get (); if (c1 == 'a' && c2 == 'N') diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/strfind.cc --- a/src/DLD-FUNCTIONS/strfind.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/strfind.cc Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ // This is the quick search algorithm, as described at // http://www-igm.univ-mlv.fr/~lecroq/string/node19.html -static void +static void qs_preprocess (const Array& needle, octave_idx_type table[TABSIZE]) { @@ -57,7 +57,7 @@ } -static Array +static Array qs_search (const Array& needle, const Array& haystack, const octave_idx_type table[TABSIZE], @@ -107,7 +107,7 @@ if (overlaps) { - while (j < n - m) + while (j < n - m) { if (std::equal (x, x + m, y + j)) accum.push_back (j); @@ -116,7 +116,7 @@ } else { - while (j < n - m) + while (j < n - m) { if (std::equal (x, x + m, y + j)) { @@ -136,7 +136,7 @@ octave_idx_type one = 1; Array result (dim_vector (std::min (one, nmatch), nmatch)); octave_idx_type k = 0; - for (std::deque::const_iterator iter = accum.begin (); + for (std::deque::const_iterator iter = accum.begin (); iter != accum.end (); iter++) { result.xelem (k++) = *iter; @@ -207,8 +207,8 @@ qs_preprocess (needle, table); if (argstr.is_string ()) - retval = octave_value (qs_search (needle, argstr.char_array_value (), - table, overlaps), + retval = octave_value (qs_search (needle, argstr.char_array_value (), + table, overlaps), true, true); else if (argstr.is_cell ()) { @@ -220,8 +220,8 @@ { octave_value argse = argsc(i); if (argse.is_string ()) - retc(i) = octave_value (qs_search (needle, argse.char_array_value (), - table, overlaps), + retc(i) = octave_value (qs_search (needle, argse.char_array_value (), + table, overlaps), true, true); else { @@ -262,7 +262,7 @@ static Array qs_replace (const Array& str, const Array& pat, - const Array& rep, + const Array& rep, const octave_idx_type table[TABSIZE], bool overlaps = true) { diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/sub2ind.cc --- a/src/DLD-FUNCTIONS/sub2ind.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/sub2ind.cc Thu Jan 20 17:24:59 2011 -0500 @@ -32,7 +32,7 @@ #include "oct-obj.h" -static dim_vector +static dim_vector get_dim_vector (const octave_value& val, const char *name) { RowVector dimsv = val.row_vector_value (false, true); @@ -203,7 +203,7 @@ if (nargout > dv.length ()) dv = dv.redim (nargout); - Array idxa = ind2sub (dv, idx); + Array idxa = ind2sub (dv, idx); retval = Array (idxa); } } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/svd.cc --- a/src/DLD-FUNCTIONS/svd.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/svd.cc Thu Jan 20 17:24:59 2011 -0500 @@ -206,7 +206,7 @@ { if (tmp.any_element_is_inf_or_nan ()) { - error ("svd: cannot take SVD of matrix containing Inf or NaN values"); + error ("svd: cannot take SVD of matrix containing Inf or NaN values"); return retval; } @@ -234,7 +234,7 @@ { if (ctmp.any_element_is_inf_or_nan ()) { - error ("svd: cannot take SVD of matrix containing Inf or NaN values"); + error ("svd: cannot take SVD of matrix containing Inf or NaN values"); return retval; } @@ -265,7 +265,7 @@ { if (tmp.any_element_is_inf_or_nan ()) { - error ("svd: cannot take SVD of matrix containing Inf or NaN values"); + error ("svd: cannot take SVD of matrix containing Inf or NaN values"); return retval; } @@ -293,7 +293,7 @@ { if (ctmp.any_element_is_inf_or_nan ()) { - error ("svd: cannot take SVD of matrix containing Inf or NaN values"); + error ("svd: cannot take SVD of matrix containing Inf or NaN values"); return retval; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/syl.cc --- a/src/DLD-FUNCTIONS/syl.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/syl.cc Thu Jan 20 17:24:59 2011 -0500 @@ -108,7 +108,7 @@ gripe_nonconformant (); return retval; } - + // Dimensions look o.k., let's solve the problem. if (isfloat) { diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/symbfact.cc --- a/src/DLD-FUNCTIONS/symbfact.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/symbfact.cc Thu Jan 20 17:24:59 2011 -0500 @@ -271,7 +271,7 @@ octave_idx_type lnz = 0 ; for (octave_idx_type j = 0 ; j < n ; j++) lnz += ColCount [j] ; - + // allocate the output matrix L (pattern-only) SparseBoolMatrix L (n, n, lnz); @@ -292,7 +292,7 @@ W [j] = L.xcidx(j); // get workspace for computing one row of L - cholmod_sparse *R = cholmod_allocate_sparse (n, 1, n, false, true, + cholmod_sparse *R = cholmod_allocate_sparse (n, 1, n, false, true, 0, CHOLMOD_PATTERN, cm); octave_idx_type *Rp = static_cast(R->p); octave_idx_type *Ri = static_cast(R->i); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/symrcm.cc --- a/src/DLD-FUNCTIONS/symrcm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/symrcm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -83,16 +83,16 @@ // Enqueue operation (adds a node "o" at the tail) -inline static void +inline static void Q_enq (CMK_Node *Q, octave_idx_type N, octave_idx_type& qt, const CMK_Node& o) -{ +{ Q[qt] = o; qt = (qt + 1) % (N + 1); } // Dequeue operation (removes a node from the head) -inline static CMK_Node +inline static CMK_Node Q_deq (CMK_Node * Q, octave_idx_type N, octave_idx_type& qh) { CMK_Node r = Q[qh]; @@ -115,7 +115,7 @@ // Builds a min-heap (the root contains the smallest element). A is an array // with the graph's nodes, i is a starting position, size is the length of A. -static void +static void H_heapify_min (CMK_Node *A, octave_idx_type i, octave_idx_type size) { octave_idx_type j = i; @@ -140,21 +140,21 @@ A[smallest] = tmp; j = smallest; } - else + else break; } } // Heap operation insert. Running time is O(log(n)) -static void +static void H_insert (CMK_Node *H, octave_idx_type& h, const CMK_Node& o) { octave_idx_type i = h++; H[i] = o; - if (i == 0) + if (i == 0) return; do { @@ -167,7 +167,7 @@ i = p; } - else + else break; } while (i > 0); @@ -176,12 +176,12 @@ // Heap operation remove-min. Removes the smalles element in O(1) and // reorganizes the heap optionally in O(log(n)) -inline static CMK_Node +inline static CMK_Node H_remove_min (CMK_Node *H, octave_idx_type& h, int reorg/*=1*/) { CMK_Node r = H[0]; H[0] = H[--h]; - if (reorg) + if (reorg) H_heapify_min(H, 0, h); return r; } @@ -192,10 +192,10 @@ // Helper function for the Cuthill-McKee algorithm. Tries to determine a // pseudo-peripheral node of the graph as starting node. -static octave_idx_type -find_starting_node (octave_idx_type N, const octave_idx_type *ridx, - const octave_idx_type *cidx, const octave_idx_type *ridx2, - const octave_idx_type *cidx2, octave_idx_type *D, +static octave_idx_type +find_starting_node (octave_idx_type N, const octave_idx_type *ridx, + const octave_idx_type *cidx, const octave_idx_type *ridx2, + const octave_idx_type *cidx2, octave_idx_type *D, octave_idx_type start) { CMK_Node w; @@ -327,16 +327,16 @@ } // Calculates the node's degrees. This means counting the non-zero elements -// in the symmetric matrix' rows. This works for non-symmetric matrices +// in the symmetric matrix' rows. This works for non-symmetric matrices // as well. -static octave_idx_type -calc_degrees (octave_idx_type N, const octave_idx_type *ridx, +static octave_idx_type +calc_degrees (octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *D) { octave_idx_type max_deg = 0; - for (octave_idx_type i = 0; i < N; i++) + for (octave_idx_type i = 0; i < N; i++) D[i] = 0; for (octave_idx_type j = 0; j < N; j++) @@ -347,7 +347,7 @@ octave_idx_type k = ridx[i]; // there is a non-zero element (k,j) D[k]++; - if (D[k] > max_deg) + if (D[k] > max_deg) max_deg = D[k]; // if there is no element (j,k) there is one in // the symmetric matrix: @@ -371,7 +371,7 @@ { // A(j,k) == 0 D[j]++; - if (D[j] > max_deg) + if (D[j] > max_deg) max_deg = D[j]; } } @@ -383,8 +383,8 @@ // Transpose of the structure of a square sparse matrix static void -transpose (octave_idx_type N, const octave_idx_type *ridx, - const octave_idx_type *cidx, octave_idx_type *ridx2, +transpose (octave_idx_type N, const octave_idx_type *ridx, + const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2) { octave_idx_type nz = cidx[N]; @@ -451,7 +451,7 @@ octave_value arg = args(0); - // the parameter of the matrix is converted into a sparse matrix + // the parameter of the matrix is converted into a sparse matrix //(if necessary) octave_idx_type *cidx; octave_idx_type *ridx; @@ -511,7 +511,7 @@ // the return value corresponds to the identity permutation if (max_deg == 0) { - for (octave_idx_type i = 0; i < N; i++) + for (octave_idx_type i = 0; i < N; i++) P(i) = i; return octave_value (P); } @@ -535,7 +535,7 @@ // mark all nodes as unvisited; with the exception of the nodes // that have degree==0 and build a CC of the graph. - + boolNDArray btmp (dim_vector (1, N), false); bool *visit = btmp.fortran_vec (); @@ -544,12 +544,12 @@ // locate an unvisited starting node of the graph octave_idx_type i; for (i = 0; i < N; i++) - if (! visit[i]) + if (! visit[i]) break; // locate a probably better starting node v.id = find_starting_node (N, ridx, cidx, ridx2, cidx2, D, i); - + // mark the node as visited and enqueue it (a starting node // for the BFS). Since the node will be a root of a spanning // tree, its dist is 0. @@ -567,7 +567,7 @@ octave_idx_type level = 0; // the root is the first/only node on level 0 octave_idx_type level_N = 1; - + while (! Q_empty (Q, N, qh, qt)) { v = Q_deq (Q, N, qh); @@ -578,7 +578,7 @@ // for computing the inverse permutation P where // A(inv(P),inv(P)) or P'*A*P is banded // P(i) = c; - + // for computing permutation P where // A(P(i),P(j)) or P*A*P' is banded P(c) = i; @@ -657,7 +657,7 @@ // locate a neighbor of i with minimal degree in O(log(N)) v = H_remove_min(S, s, 1); - + // entered the BFS a new level? if (v.dist > level) { @@ -667,7 +667,7 @@ // maximum number of nodes per level" if (Bsub < level_N) Bsub = level_N; - + level = v.dist; // v is the first node on the new level level_N = 1; @@ -678,11 +678,11 @@ // this level: level_N++; } - + // enqueue v in O(1) Q_enq (Q, N, qt, v); } - + // synchronize the bandwidth with level_N once again: if (Bsub < level_N) Bsub = level_N; diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/tril.cc --- a/src/DLD-FUNCTIONS/tril.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/tril.cc Thu Jan 20 17:24:59 2011 -0500 @@ -39,7 +39,7 @@ // The bulk of the work. template -static Array +static Array do_tril (const Array& a, octave_idx_type k, bool pack) { octave_idx_type nr = a.rows (), nc = a.columns (); @@ -48,7 +48,7 @@ if (pack) { - octave_idx_type j1 = std::min (std::max (zero, k), nc); + octave_idx_type j1 = std::min (std::max (zero, k), nc); octave_idx_type j2 = std::min (std::max (zero, nr + k), nc); octave_idx_type n = j1 * nr + ((j2 - j1) * (nr-(j1-k) + nr-(j2-1-k))) / 2; Array r (dim_vector (n, 1)); @@ -80,7 +80,7 @@ } template -static Array +static Array do_triu (const Array& a, octave_idx_type k, bool pack) { octave_idx_type nr = a.rows (), nc = a.columns (); @@ -89,7 +89,7 @@ if (pack) { - octave_idx_type j1 = std::min (std::max (zero, k), nc); + octave_idx_type j1 = std::min (std::max (zero, k), nc); octave_idx_type j2 = std::min (std::max (zero, nr + k), nc); octave_idx_type n = ((j2 - j1) * ((j1+1-k) + (j2-k))) / 2 + (nc - j2) * nr; Array r (dim_vector (n, 1)); @@ -124,7 +124,7 @@ // FIXME: optimizations possible. "pack" support missing. template -static Sparse +static Sparse do_tril (const Sparse& a, octave_idx_type k, bool pack) { if (pack) // FIXME @@ -146,7 +146,7 @@ } template -static Sparse +static Sparse do_triu (const Sparse& a, octave_idx_type k, bool pack) { if (pack) // FIXME @@ -201,7 +201,7 @@ if (nargin == 2) { k = args(1).int_value (true); - + if (error_state) return retval; } @@ -262,7 +262,7 @@ if (pack) // FIXME { - error ("%s: \"pack\" not implemented for class %s", + error ("%s: \"pack\" not implemented for class %s", name.c_str (), arg.class_name ().c_str ()); return octave_value (); } @@ -277,7 +277,7 @@ // matrix size. This would not be necessary if the // octave_value resize function allowed a fill_value. // It also allows odd attributes in some user types - // to be handled. With a fill_value ot should be replaced + // to be handled. With a fill_value ot should be replaced // with // // octave_value_list ov_idx; @@ -410,7 +410,7 @@ %!test %! a = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12]; -%! +%! %! l0 = [1, 0, 0; 4, 5, 0; 7, 8, 9; 10, 11, 12]; %! l1 = [1, 2, 0; 4, 5, 6; 7, 8, 9; 10, 11, 12]; %! l2 = [1, 2, 3; 4, 5, 6; 7, 8, 9; 10, 11, 12]; @@ -418,7 +418,7 @@ %! lm2 = [0, 0, 0; 0, 0, 0; 7, 0, 0; 10, 11, 0]; %! lm3 = [0, 0, 0; 0, 0, 0; 0, 0, 0; 10, 0, 0]; %! lm4 = [0, 0, 0; 0, 0, 0; 0, 0, 0; 0, 0, 0]; -%! +%! %! assert((tril (a, -4) == lm4 && tril (a, -3) == lm3 %! && tril (a, -2) == lm2 && tril (a, -1) == lm1 %! && tril (a) == l0 && tril (a, 1) == l1 && tril (a, 2) == l2)); diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/tsearch.cc --- a/src/DLD-FUNCTIONS/tsearch.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/tsearch.cc Thu Jan 20 17:24:59 2011 -0500 @@ -40,17 +40,17 @@ inline double max (double a, double b, double c) { - if (a < b) + if (a < b) return (b < c ? c : b); - else + else return (a < c ? c : a); } inline double min (double a, double b, double c) { - if (a > b) + if (a > b) return (b > c ? c : b); - else + else return (a > c ? c : a); } @@ -58,8 +58,8 @@ // for large data set the algorithm is very slow // one should presort (how?) either the elements of the points of evaluation -// to cut down the time needed to decide which triangle contains the -// given point +// to cut down the time needed to decide which triangle contains the +// given point // e.g., build up a neighbouring triangle structure and use a simplex-like // method to traverse it @@ -83,7 +83,7 @@ print_usage (); return retval; } - + const ColumnVector x (args(0).vector_value ()); const ColumnVector y (args(1).vector_value ()); const Matrix elem (args(2).matrix_value ()); @@ -99,7 +99,7 @@ ColumnVector maxx (nelem); ColumnVector miny (nelem); ColumnVector maxy (nelem); - for (octave_idx_type k = 0; k < nelem; k++) + for (octave_idx_type k = 0; k < nelem; k++) { minx(k) = min (REF (x, k, 0), REF (x, k, 1), REF (x, k, 2)) - eps; maxx(k) = max (REF (x, k, 0), REF (x, k, 1), REF (x, k, 2)) + eps; @@ -114,28 +114,28 @@ double a11 = 0.0, a12 = 0.0, a21 = 0.0, a22 = 0.0, det = 0.0; octave_idx_type k = nelem; // k is a counter of elements - for (octave_idx_type kp = 0; kp < np; kp++) + for (octave_idx_type kp = 0; kp < np; kp++) { - const double xt = xi(kp); + const double xt = xi(kp); const double yt = yi(kp); - + // check if last triangle contains the next point - if (k < nelem) - { + if (k < nelem) + { const double dx1 = xt - x0; const double dx2 = yt - y0; const double c1 = (a22 * dx1 - a21 * dx2) / det; const double c2 = (-a12 * dx1 + a11 * dx2) / det; - if (c1 >= -eps && c2 >= -eps && (c1 + c2) <= (1 + eps)) + if (c1 >= -eps && c2 >= -eps && (c1 + c2) <= (1 + eps)) { values(kp) = double(k+1); continue; } } - + // it doesn't, so go through all elements - for (k = 0; k < nelem; k++) - { + for (k = 0; k < nelem; k++) + { OCTAVE_QUIT; if (xt >= minx(k) && xt <= maxx(k) && yt >= miny(k) && yt <= maxy(k)) { @@ -147,13 +147,13 @@ a21 = REF (x, k, 2) - x0; a22 = REF (y, k, 2) - y0; det = a11 * a22 - a21 * a12; - + // solve the system const double dx1 = xt - x0; const double dx2 = yt - y0; const double c1 = (a22 * dx1 - a21 * dx2) / det; const double c2 = (-a12 * dx1 + a11 * dx2) / det; - if ((c1 >= -eps) && (c2 >= -eps) && ((c1 + c2) <= (1 + eps))) + if ((c1 >= -eps) && (c2 >= -eps) && ((c1 + c2) <= (1 + eps))) { values(kp) = double(k+1); break; @@ -161,13 +161,13 @@ } //endif # examine this element closely } //endfor # each element - if (k == nelem) + if (k == nelem) values(kp) = lo_ieee_nan_value (); - + } //endfor # kp - + retval(0) = values; - + return retval; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/typecast.cc --- a/src/DLD-FUNCTIONS/typecast.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/typecast.cc Thu Jan 20 17:24:59 2011 -0500 @@ -45,7 +45,7 @@ } template -static void +static void get_data_and_bytesize (const ArrayType& array, const void *& data, octave_idx_type& byte_size, diff -r 1473d0cf86d2 -r 12df7854fa7c src/DLD-FUNCTIONS/urlwrite.cc --- a/src/DLD-FUNCTIONS/urlwrite.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/DLD-FUNCTIONS/urlwrite.cc Thu Jan 20 17:24:59 2011 -0500 @@ -55,7 +55,7 @@ #include #include -static int +static int write_data (void *buffer, size_t size, size_t nmemb, void *streamp) { std::ostream& stream = *(static_cast (streamp)); @@ -74,7 +74,7 @@ return (stream.fail () ? 0 : size * nmemb); } -static size_t +static size_t throw_away (void *, size_t size, size_t nmemb, void *) { return static_cast(size * nmemb); @@ -153,7 +153,7 @@ // No copying! curl_handle_rep (const curl_handle_rep& ov); - + curl_handle_rep& operator = (const curl_handle_rep&); }; @@ -169,12 +169,12 @@ error ("%s", curl_easy_strerror (res)); \ } - curl_handle (void) : rep (new curl_handle_rep ()) - { + curl_handle (void) : rep (new curl_handle_rep ()) + { rep->valid = false; } - curl_handle (const std::string& _host, const std::string& user, + curl_handle (const std::string& _host, const std::string& user, const std::string& passwd) : rep (new curl_handle_rep ()) { @@ -189,7 +189,7 @@ perform (); } - curl_handle (const std::string& url, const std::string& method, + curl_handle (const std::string& url, const std::string& method, const Cell& param, std::ostream& os, bool& retval) : rep (new curl_handle_rep ()) { @@ -200,7 +200,7 @@ setopt (CURLOPT_NOBODY, 0); // Don't need to store the parameters here as we can't change - // the URL after the handle is created + // the URL after the handle is created std::string query_string = form_query_string (param); if (method == "get") @@ -254,7 +254,7 @@ CURLcode errnum; curl_easy_getinfo (rep->handle(), CURLINFO_OS_ERRNO, &errnum); - + return std::string (curl_easy_strerror (errnum)); } @@ -272,13 +272,13 @@ { setopt (CURLOPT_TRANSFERTEXT, 1); rep->ascii = true; - } + } void binary (void) const { setopt (CURLOPT_TRANSFERTEXT, 0); rep->ascii = false; - } + } bool is_ascii (void) const { @@ -438,14 +438,14 @@ return retval; } - void get_fileinfo (const std::string& filename, double& filesize, + void get_fileinfo (const std::string& filename, double& filesize, time_t& filetime, bool& fileisdir) const { std::string path = pwd(); std::string url = "ftp://" + rep->host + "/" + path + "/" + filename; setopt (CURLOPT_URL, url.c_str()); - setopt (CURLOPT_FILETIME, 1); + setopt (CURLOPT_FILETIME, 1); setopt (CURLOPT_HEADERFUNCTION, throw_away); setopt (CURLOPT_WRITEFUNCTION, throw_away); @@ -468,7 +468,7 @@ curl_easy_getinfo(rep->handle (), CURLINFO_FILETIME, &ft); filetime = ft; double fs; - curl_easy_getinfo(rep->handle (), + curl_easy_getinfo(rep->handle (), CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fs); filesize = fs; } @@ -476,7 +476,7 @@ setopt (CURLOPT_WRITEFUNCTION, write_data); setopt (CURLOPT_HEADERFUNCTION, 0); - setopt (CURLOPT_FILETIME, 0); + setopt (CURLOPT_FILETIME, 0); url = "ftp://" + rep->host; setopt (CURLOPT_URL, url.c_str()); @@ -534,9 +534,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; @@ -553,8 +553,8 @@ return query.str (); } - void init (const std::string& user, const std::string& passwd, - std::istream& is, std::ostream& os) + void init (const std::string& user, const std::string& passwd, + std::istream& is, std::ostream& os) { // No data transfer by default setopt (CURLOPT_NOBODY, 1); @@ -608,8 +608,8 @@ { curl_global_init(CURL_GLOBAL_DEFAULT); } - - ~curl_handles (void) + + ~curl_handles (void) { // Remove the elements of the map explicitly as they should // be deleted before the call to curl_global_cleanup @@ -629,7 +629,7 @@ std::string key (const_iterator p) const { return p->first; } - curl_handle& contents (const std::string& k) + curl_handle& contents (const std::string& k) { return map[k]; } @@ -984,17 +984,17 @@ { handle = args(0).string_value (); host = args(1).string_value (); - + if (nargin > 1) user = args(2).string_value (); if (nargin > 2) passwd = args(3).string_value (); - + if (!error_state) { handles.contents (handle) = curl_handle (host, user, passwd); - + if (error_state) handles.del (handle); } @@ -1111,7 +1111,7 @@ flds(2) = "bytes"; flds(3) = "isdir"; flds(4) = "datenum"; - retval = octave_map (flds); + retval = octave_map (flds); } else { @@ -1120,7 +1120,7 @@ Cell filesize (dim_vector (n, 1)); Cell fileisdir (dim_vector (n, 1)); Cell filedatenum (dim_vector (n, 1)); - + st.assign ("name", Cell (sv)); for (octave_idx_type i = 0; i < n; i++) @@ -1128,7 +1128,7 @@ time_t ftime; bool fisdir; double fsize; - + curl.get_fileinfo (sv(i), fsize, ftime, fisdir); fileisdir (i) = fisdir; @@ -1420,7 +1420,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); @@ -1431,7 +1431,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); @@ -1452,7 +1452,7 @@ if (! fs.exists ()) { - error ("__ftp__mput: file ""%s"" does not exist", + error ("__ftp__mput: file ""%s"" does not exist", realfile.c_str ()); break; } @@ -1467,12 +1467,12 @@ 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 ()) { - error ("__ftp_mput__: unable to open file ""%s""", + error ("__ftp_mput__: unable to open file ""%s""", realfile.c_str ()); break; } @@ -1489,7 +1489,7 @@ } } else - error ("__ftp_mput__: can not read the directory ""%s""", + error ("__ftp_mput__: can not read the directory ""%s""", realdir.c_str()); } @@ -1545,7 +1545,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 ()) @@ -1578,19 +1578,19 @@ #ifdef HAVE_CURL static void -getallfiles (const curl_handle& curl, const std::string& dir, +getallfiles (const curl_handle& curl, const std::string& dir, const std::string& target) { std::string sep = file_ops::dir_sep_str (); file_stat fs (dir); if (!fs || !fs.is_dir ()) - { + { std::string msg; int status = octave_mkdir (dir, 0777, msg); if (status < 0) - error ("__ftp_mget__: can't create directory %s%s%s. %s", + error ("__ftp_mget__: can't create directory %s%s%s. %s", target.c_str(), sep.c_str(), dir.c_str(), msg.c_str()); } @@ -1611,7 +1611,7 @@ time_t ftime; bool fisdir; double fsize; - + curl.get_fileinfo (sv(i), fsize, ftime, fisdir); if (fisdir) @@ -1619,8 +1619,8 @@ else { std::string realfile = target + dir + sep + sv(i); - std::ofstream ofile (realfile.c_str(), - std::ios::out | + std::ofstream ofile (realfile.c_str(), + std::ios::out | std::ios::binary); if (! ofile.is_open ()) @@ -1690,7 +1690,7 @@ time_t ftime; bool fisdir; double fsize; - + curl.get_fileinfo (sv(i), fsize, ftime, fisdir); if (fisdir) @@ -1698,7 +1698,7 @@ else { std::ofstream ofile ((target + sv(i)).c_str(), - std::ios::out | + std::ios::out | std::ios::binary); if (! ofile.is_open ()) diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-b-sbm.cc --- a/src/OPERATORS/op-b-sbm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-b-sbm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -49,7 +49,7 @@ { CAST_BINOP_ARGS (octave_bool&, const octave_sparse_bool_matrix&); SparseBoolMatrix tmp (1, 1, v1.bool_value ()); - return octave_value (tmp. concat (v2.sparse_bool_matrix_value (), + return octave_value (tmp. concat (v2.sparse_bool_matrix_value (), ra_idx)); } @@ -71,7 +71,7 @@ { CAST_CONV_ARG (const octave_bool&); - return new octave_sparse_bool_matrix + return new octave_sparse_bool_matrix (SparseBoolMatrix (1, 1, v.bool_value ())); } @@ -88,7 +88,7 @@ INSTALL_CATOP (octave_bool, octave_sparse_matrix, b_sm); INSTALL_CATOP (octave_scalar, octave_sparse_bool_matrix, s_sbm); - INSTALL_ASSIGNCONV (octave_bool, octave_sparse_bool_matrix, + INSTALL_ASSIGNCONV (octave_bool, octave_sparse_bool_matrix, octave_bool_matrix); INSTALL_WIDENOP (octave_bool, octave_sparse_bool_matrix, sparse_bool_matrix_conv); diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-bm-sbm.cc --- a/src/OPERATORS/op-bm-sbm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-bm-sbm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -51,7 +51,7 @@ { CAST_BINOP_ARGS (octave_bool_matrix&, const octave_sparse_bool_matrix&); SparseBoolMatrix tmp (v1.bool_matrix_value ()); - return octave_value (tmp. concat (v2.sparse_bool_matrix_value (), + return octave_value (tmp. concat (v2.sparse_bool_matrix_value (), ra_idx)); } @@ -64,7 +64,7 @@ DEFCATOP (bm_sm, bool_matrix, sparse_matrix) { - CAST_BINOP_ARGS (octave_bool_matrix&, const octave_sparse_matrix&); + CAST_BINOP_ARGS (octave_bool_matrix&, const octave_sparse_matrix&); SparseMatrix tmp (v1.matrix_value ()); return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx)); } @@ -72,7 +72,7 @@ DEFCONV (sparse_bool_matrix_conv, bool_matrix, sparse_bool_matrix) { CAST_CONV_ARG (const octave_bool_matrix&); - return new octave_sparse_bool_matrix + return new octave_sparse_bool_matrix (SparseBoolMatrix (v.bool_matrix_value ())); } @@ -84,20 +84,20 @@ INSTALL_BINOP (op_eq, octave_bool_matrix, octave_sparse_bool_matrix, eq); INSTALL_BINOP (op_ne, octave_bool_matrix, octave_sparse_bool_matrix, ne); - INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_sparse_bool_matrix, + INSTALL_BINOP (op_el_and, octave_bool_matrix, octave_sparse_bool_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_sparse_bool_matrix, + INSTALL_BINOP (op_el_or, octave_bool_matrix, octave_sparse_bool_matrix, el_or); INSTALL_CATOP (octave_bool_matrix, octave_sparse_bool_matrix, bm_sbm); INSTALL_CATOP (octave_bool_matrix, octave_sparse_matrix, bm_sm); INSTALL_CATOP (octave_matrix, octave_sparse_bool_matrix, m_sbm); - INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_sparse_bool_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_bool_matrix, octave_sparse_bool_matrix, assign) - INSTALL_ASSIGNCONV (octave_bool_matrix, octave_sparse_bool_matrix, + INSTALL_ASSIGNCONV (octave_bool_matrix, octave_sparse_bool_matrix, octave_bool_matrix); - INSTALL_WIDENOP (octave_bool_matrix, octave_sparse_bool_matrix, + INSTALL_WIDENOP (octave_bool_matrix, octave_sparse_bool_matrix, sparse_bool_matrix_conv); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-cdm-cdm.cc --- a/src/OPERATORS/op-cdm-cdm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-cdm-cdm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -61,15 +61,15 @@ DEFBINOP (div, complex_diag_matrix, complex_diag_matrix) { CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_complex_diag_matrix&); - - return xdiv (v1.complex_diag_matrix_value (), + + return xdiv (v1.complex_diag_matrix_value (), v2.complex_diag_matrix_value ()); } DEFBINOP (ldiv, complex_diag_matrix, complex_diag_matrix) { CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_complex_diag_matrix&); - + return xleftdiv (v1.complex_diag_matrix_value (), v2.complex_diag_matrix_value ()); } @@ -103,7 +103,7 @@ INSTALL_BINOP (op_ldiv, octave_complex_diag_matrix, octave_complex_diag_matrix, ldiv); INSTALL_CONVOP (octave_complex_diag_matrix, octave_complex_matrix, complex_diag_matrix_to_complex_matrix); - INSTALL_CONVOP (octave_complex_diag_matrix, octave_float_complex_diag_matrix, + INSTALL_CONVOP (octave_complex_diag_matrix, octave_float_complex_diag_matrix, complex_diag_matrix_to_float_complex_diag_matrix); INSTALL_ASSIGNCONV (octave_complex_diag_matrix, octave_complex_matrix, octave_complex_matrix); INSTALL_WIDENOP (octave_complex_diag_matrix, octave_complex_matrix, complex_diag_matrix_to_complex_matrix); diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-chm.cc --- a/src/OPERATORS/op-chm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-chm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -44,7 +44,7 @@ return octave_value (v.matrix_value().transpose ()); } -DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array, +DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array, concat) DEFCATOP (chm_s, char_matrix, scalar) diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-cm-cm.cc --- a/src/OPERATORS/op-cm-cm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-cm-cm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -82,8 +82,8 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); MatrixType typ = v2.matrix_type (); - - ComplexMatrix ret = xdiv (v1.complex_matrix_value (), + + ComplexMatrix ret = xdiv (v1.complex_matrix_value (), v2.complex_matrix_value (), typ); v2.matrix_type (typ); @@ -100,8 +100,8 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); MatrixType typ = v1.matrix_type (); - - ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), + + ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), v2.complex_matrix_value (), typ); v1.matrix_type (typ); @@ -111,7 +111,7 @@ DEFBINOP (trans_mul, complex_matrix, complex_matrix) { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - return octave_value(xgemm (v1.complex_matrix_value (), + return octave_value(xgemm (v1.complex_matrix_value (), v2.complex_matrix_value (), blas_trans, blas_no_trans)); } @@ -119,7 +119,7 @@ DEFBINOP (mul_trans, complex_matrix, complex_matrix) { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - return octave_value(xgemm (v1.complex_matrix_value (), + return octave_value(xgemm (v1.complex_matrix_value (), v2.complex_matrix_value (), blas_no_trans, blas_trans)); } @@ -127,7 +127,7 @@ DEFBINOP (herm_mul, complex_matrix, complex_matrix) { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - return octave_value(xgemm (v1.complex_matrix_value (), + return octave_value(xgemm (v1.complex_matrix_value (), v2.complex_matrix_value (), blas_conj_trans, blas_no_trans)); } @@ -135,7 +135,7 @@ DEFBINOP (mul_herm, complex_matrix, complex_matrix) { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); - return octave_value(xgemm (v1.complex_matrix_value (), + return octave_value(xgemm (v1.complex_matrix_value (), v2.complex_matrix_value (), blas_no_trans, blas_conj_trans)); } @@ -144,8 +144,8 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); MatrixType typ = v1.matrix_type (); - - ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), + + ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), v2.complex_matrix_value (), typ, blas_trans); v1.matrix_type (typ); @@ -156,8 +156,8 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_complex_matrix&); MatrixType typ = v1.matrix_type (); - - ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), + + ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), v2.complex_matrix_value (), typ, blas_conj_trans); v1.matrix_type (typ); @@ -255,6 +255,6 @@ INSTALL_ASSIGNOP (op_el_mul_eq, octave_complex_matrix, octave_complex_matrix, assign_el_mul); INSTALL_ASSIGNOP (op_el_div_eq, octave_complex_matrix, octave_complex_matrix, assign_el_div); - INSTALL_CONVOP (octave_complex_matrix, octave_float_complex_matrix, + INSTALL_CONVOP (octave_complex_matrix, octave_float_complex_matrix, complex_matrix_to_float_complex_matrix); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-cm-m.cc --- a/src/OPERATORS/op-cm-m.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-cm-m.cc Thu Jan 20 17:24:59 2011 -0500 @@ -61,8 +61,8 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&); MatrixType typ = v2.matrix_type (); - - ComplexMatrix ret = xdiv (v1.complex_matrix_value (), + + ComplexMatrix ret = xdiv (v1.complex_matrix_value (), v2.matrix_value (), typ); v2.matrix_type (typ); @@ -80,8 +80,8 @@ { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_matrix&); MatrixType typ = v1.matrix_type (); - - ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), + + ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), v2.matrix_value (), typ); v1.matrix_type (typ); diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-cm-scm.cc --- a/src/OPERATORS/op-cm-scm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-cm-scm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -64,7 +64,7 @@ { MatrixType typ = v2.matrix_type (); - ComplexMatrix ret = xdiv (v1.complex_matrix_value (), + ComplexMatrix ret = xdiv (v1.complex_matrix_value (), v2.sparse_complex_matrix_value (), typ); v2.matrix_type (typ); @@ -80,11 +80,11 @@ DEFBINOP (ldiv, complex_matrix, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_complex_matrix&, + CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_complex_matrix&); MatrixType typ = v1.matrix_type (); - - ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), + + ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), v2.complex_matrix_value (), typ); v1.matrix_type (typ); @@ -106,20 +106,20 @@ DEFBINOP (el_pow, complex_matrix, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_complex_matrix&, + CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_complex_matrix&); - - return octave_value + + return octave_value (elem_xpow (SparseComplexMatrix (v1.complex_matrix_value ()), v2.sparse_complex_matrix_value ())); } DEFBINOP (el_ldiv, sparse_complex_matrix, matrix) { - CAST_BINOP_ARGS (const octave_complex_matrix&, + CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_complex_matrix&); - return octave_value (quotient (v2.sparse_complex_matrix_value (), + return octave_value (quotient (v2.sparse_complex_matrix_value (), v1.complex_matrix_value ())); } @@ -128,76 +128,76 @@ DEFCATOP (cm_scm, complex_matrix, sparse_complex_matrix) { - CAST_BINOP_ARGS (octave_complex_matrix&, + CAST_BINOP_ARGS (octave_complex_matrix&, const octave_sparse_complex_matrix&); SparseComplexMatrix tmp (v1.complex_matrix_value ()); - return octave_value (tmp. concat (v2.sparse_complex_matrix_value (), + return octave_value (tmp. concat (v2.sparse_complex_matrix_value (), ra_idx)); } -DEFCONV (sparse_complex_matrix_conv, complex_matrix, +DEFCONV (sparse_complex_matrix_conv, complex_matrix, sparse_complex_matrix) { CAST_CONV_ARG (const octave_complex_matrix&); - return new octave_sparse_complex_matrix + return new octave_sparse_complex_matrix (SparseComplexMatrix (v.complex_matrix_value ())); } -DEFNDASSIGNOP_FN (assign, complex_matrix, sparse_complex_matrix, +DEFNDASSIGNOP_FN (assign, complex_matrix, sparse_complex_matrix, complex_array, assign) void install_cm_scm_ops (void) { - INSTALL_BINOP (op_add, octave_complex_matrix, + INSTALL_BINOP (op_add, octave_complex_matrix, octave_sparse_complex_matrix, add); - INSTALL_BINOP (op_sub, octave_complex_matrix, + INSTALL_BINOP (op_sub, octave_complex_matrix, octave_sparse_complex_matrix, sub); - INSTALL_BINOP (op_mul, octave_complex_matrix, + INSTALL_BINOP (op_mul, octave_complex_matrix, octave_sparse_complex_matrix, mul); - INSTALL_BINOP (op_div, octave_complex_matrix, + INSTALL_BINOP (op_div, octave_complex_matrix, octave_sparse_complex_matrix, div); - INSTALL_BINOP (op_pow, octave_complex_matrix, + INSTALL_BINOP (op_pow, octave_complex_matrix, octave_sparse_complex_matrix, pow); - INSTALL_BINOP (op_ldiv, octave_complex_matrix, + INSTALL_BINOP (op_ldiv, octave_complex_matrix, octave_sparse_complex_matrix, ldiv); - INSTALL_BINOP (op_mul_trans, octave_complex_matrix, + INSTALL_BINOP (op_mul_trans, octave_complex_matrix, octave_sparse_complex_matrix, mul_trans); - INSTALL_BINOP (op_mul_herm, octave_complex_matrix, + INSTALL_BINOP (op_mul_herm, octave_complex_matrix, octave_sparse_complex_matrix, mul_herm); - INSTALL_BINOP (op_lt, octave_complex_matrix, + INSTALL_BINOP (op_lt, octave_complex_matrix, octave_sparse_complex_matrix, lt); - INSTALL_BINOP (op_le, octave_complex_matrix, + INSTALL_BINOP (op_le, octave_complex_matrix, octave_sparse_complex_matrix, le); - INSTALL_BINOP (op_eq, octave_complex_matrix, + INSTALL_BINOP (op_eq, octave_complex_matrix, octave_sparse_complex_matrix, eq); - INSTALL_BINOP (op_ge, octave_complex_matrix, + INSTALL_BINOP (op_ge, octave_complex_matrix, octave_sparse_complex_matrix, ge); - INSTALL_BINOP (op_gt, octave_complex_matrix, + INSTALL_BINOP (op_gt, octave_complex_matrix, octave_sparse_complex_matrix, gt); - INSTALL_BINOP (op_ne, octave_complex_matrix, + INSTALL_BINOP (op_ne, octave_complex_matrix, octave_sparse_complex_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_complex_matrix, + INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_sparse_complex_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_complex_matrix, + INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_sparse_complex_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_complex_matrix, + INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_sparse_complex_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, + INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_sparse_complex_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_complex_matrix, + INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_sparse_complex_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_complex_matrix, + INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_sparse_complex_matrix, el_or); - INSTALL_CATOP (octave_complex_matrix, + INSTALL_CATOP (octave_complex_matrix, octave_sparse_complex_matrix, cm_scm); - INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_sparse_complex_matrix, assign) - INSTALL_ASSIGNCONV (octave_complex_matrix, octave_sparse_complex_matrix, + INSTALL_ASSIGNCONV (octave_complex_matrix, octave_sparse_complex_matrix, octave_complex_matrix); - INSTALL_WIDENOP (octave_complex_matrix, octave_sparse_complex_matrix, + INSTALL_WIDENOP (octave_complex_matrix, octave_sparse_complex_matrix, sparse_complex_matrix_conv); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-cm-sm.cc --- a/src/OPERATORS/op-cm-sm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-cm-sm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -49,7 +49,7 @@ DEFBINOP (div, complex_matrix, sparse_matrix) { CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_matrix&); - + if (v2.rows() == 1 && v2.columns() == 1) { double d = v2.scalar_value (); @@ -63,7 +63,7 @@ { MatrixType typ = v2.matrix_type (); - ComplexMatrix ret = xdiv (v1.complex_matrix_value (), + ComplexMatrix ret = xdiv (v1.complex_matrix_value (), v2.sparse_matrix_value (), typ); v2.matrix_type (typ); @@ -79,11 +79,11 @@ DEFBINOP (ldiv, complex_matrix, sparse_matrix) { - CAST_BINOP_ARGS (const octave_complex_matrix&, + CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_matrix&); MatrixType typ = v1.matrix_type (); - - ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), + + ComplexMatrix ret = xleftdiv (v1.complex_matrix_value (), v2.matrix_value (), typ); v1.matrix_type (typ); @@ -102,17 +102,17 @@ DEFBINOP (el_pow, complex_matrix, sparse_matrix) { - CAST_BINOP_ARGS (const octave_complex_matrix&, + CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_matrix&); - - return octave_value + + return octave_value (elem_xpow ( SparseComplexMatrix (v1.complex_matrix_value ()), v2.sparse_matrix_value ())); } DEFBINOP (el_ldiv, complex_matrix, sparse_matrix) { - CAST_BINOP_ARGS (const octave_complex_matrix&, + CAST_BINOP_ARGS (const octave_complex_matrix&, const octave_sparse_matrix&); return octave_value (quotient (v2.sparse_matrix_value (), v1.complex_matrix_value ())); @@ -145,24 +145,24 @@ INSTALL_BINOP (op_ge, octave_complex_matrix, octave_sparse_matrix, ge); INSTALL_BINOP (op_gt, octave_complex_matrix, octave_sparse_matrix, gt); INSTALL_BINOP (op_ne, octave_complex_matrix, octave_sparse_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_mul, octave_complex_matrix, octave_sparse_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_div, octave_complex_matrix, octave_sparse_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_pow, octave_complex_matrix, octave_sparse_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_ldiv, octave_complex_matrix, octave_sparse_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_and, octave_complex_matrix, octave_sparse_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_or, octave_complex_matrix, octave_sparse_matrix, el_or); INSTALL_CATOP (octave_complex_matrix, octave_sparse_matrix, cm_sm); - INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_sparse_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_sparse_matrix, assign); - INSTALL_ASSIGNCONV (octave_complex_matrix, octave_sparse_matrix, + INSTALL_ASSIGNCONV (octave_complex_matrix, octave_sparse_matrix, octave_complex_matrix) } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-cs-cs.cc --- a/src/OPERATORS/op-cs-cs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-cs-cs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -192,6 +192,6 @@ INSTALL_ASSIGNCONV (octave_complex, octave_null_str, octave_complex_matrix); INSTALL_ASSIGNCONV (octave_complex, octave_null_sq_str, octave_complex_matrix); - INSTALL_CONVOP (octave_complex, octave_float_complex_matrix, + INSTALL_CONVOP (octave_complex, octave_float_complex_matrix, complex_to_float_complex); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-cs-scm.cc --- a/src/OPERATORS/op-cs-scm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-cs-scm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -70,7 +70,7 @@ DEFBINOP (pow, complex, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_complex&, + CAST_BINOP_ARGS (const octave_complex&, const octave_sparse_complex_matrix&); return xpow (v1.complex_value (), v2.complex_matrix_value ()); } @@ -121,7 +121,7 @@ { CAST_BINOP_ARGS (octave_complex&, const octave_sparse_complex_matrix&); SparseComplexMatrix tmp (1, 1, v1.complex_value ()); - return octave_value (tmp. concat (v2.sparse_complex_matrix_value (), + return octave_value (tmp. concat (v2.sparse_complex_matrix_value (), ra_idx)); } @@ -129,7 +129,7 @@ { CAST_CONV_ARG (const octave_complex&); - return new octave_sparse_complex_matrix + return new octave_sparse_complex_matrix (SparseComplexMatrix (v.complex_matrix_value ())); } @@ -141,7 +141,7 @@ INSTALL_BINOP (op_mul, octave_complex, octave_sparse_complex_matrix, mul); INSTALL_BINOP (op_div, octave_complex, octave_sparse_complex_matrix, div); INSTALL_BINOP (op_pow, octave_complex, octave_sparse_complex_matrix, pow); - INSTALL_BINOP (op_ldiv, octave_complex, octave_sparse_complex_matrix, + INSTALL_BINOP (op_ldiv, octave_complex, octave_sparse_complex_matrix, ldiv); INSTALL_BINOP (op_lt, octave_complex, octave_sparse_complex_matrix, lt); INSTALL_BINOP (op_le, octave_complex, octave_sparse_complex_matrix, le); @@ -149,24 +149,24 @@ INSTALL_BINOP (op_ge, octave_complex, octave_sparse_complex_matrix, ge); INSTALL_BINOP (op_gt, octave_complex, octave_sparse_complex_matrix, gt); INSTALL_BINOP (op_ne, octave_complex, octave_sparse_complex_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_complex, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_mul, octave_complex, octave_sparse_complex_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_complex, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_div, octave_complex, octave_sparse_complex_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_complex, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_pow, octave_complex, octave_sparse_complex_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_complex, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_ldiv, octave_complex, octave_sparse_complex_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_complex, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_and, octave_complex, octave_sparse_complex_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_complex, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_or, octave_complex, octave_sparse_complex_matrix, el_or); INSTALL_CATOP (octave_complex, octave_sparse_complex_matrix, cs_scm); - INSTALL_ASSIGNCONV (octave_complex, octave_sparse_complex_matrix, + INSTALL_ASSIGNCONV (octave_complex, octave_sparse_complex_matrix, octave_complex_matrix); - INSTALL_WIDENOP (octave_complex, octave_sparse_complex_matrix, + INSTALL_WIDENOP (octave_complex, octave_sparse_complex_matrix, sparse_complex_matrix_conv); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-cs-sm.cc --- a/src/OPERATORS/op-cs-sm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-cs-sm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -131,7 +131,7 @@ { CAST_CONV_ARG (const octave_complex&); - return new octave_sparse_matrix + return new octave_sparse_matrix (SparseMatrix (v.matrix_value ())); } @@ -159,7 +159,7 @@ INSTALL_CATOP (octave_complex, octave_sparse_matrix, cs_sm); - INSTALL_ASSIGNCONV (octave_complex, octave_sparse_matrix, + INSTALL_ASSIGNCONV (octave_complex, octave_sparse_matrix, octave_complex_matrix); INSTALL_WIDENOP (octave_complex, octave_sparse_matrix, sparse_matrix_conv); diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-dm-dm.cc --- a/src/OPERATORS/op-dm-dm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-dm-dm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -55,15 +55,15 @@ DEFBINOP (div, diag_matrix, diag_matrix) { CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_diag_matrix&); - - return xdiv (v1.diag_matrix_value (), + + return xdiv (v1.diag_matrix_value (), v2.diag_matrix_value ()); } DEFBINOP (ldiv, diag_matrix, diag_matrix) { CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_diag_matrix&); - + return xleftdiv (v1.diag_matrix_value (), v2.diag_matrix_value ()); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-dms-template.cc --- a/src/OPERATORS/op-dms-template.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-dms-template.cc Thu Jan 20 17:24:59 2011 -0500 @@ -49,7 +49,7 @@ #define SCALAR_VALUE CONCAT2(SCALARV, _value) template -static T +static T gripe_if_zero (T x) { if (x == T ()) diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fcdm-fcdm.cc --- a/src/OPERATORS/op-fcdm-fcdm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fcdm-fcdm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -61,15 +61,15 @@ DEFBINOP (div, float_complex_diag_matrix, float_complex_diag_matrix) { CAST_BINOP_ARGS (const octave_float_complex_diag_matrix&, const octave_float_complex_diag_matrix&); - - return xdiv (v1.float_complex_diag_matrix_value (), + + return xdiv (v1.float_complex_diag_matrix_value (), v2.float_complex_diag_matrix_value ()); } DEFBINOP (ldiv, float_complex_diag_matrix, float_complex_diag_matrix) { CAST_BINOP_ARGS (const octave_float_complex_diag_matrix&, const octave_float_complex_diag_matrix&); - + return xleftdiv (v1.float_complex_diag_matrix_value (), v2.float_complex_diag_matrix_value ()); } @@ -102,11 +102,11 @@ INSTALL_BINOP (op_div, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, div); INSTALL_BINOP (op_ldiv, octave_float_complex_diag_matrix, octave_float_complex_diag_matrix, ldiv); - INSTALL_CONVOP (octave_float_complex_diag_matrix, octave_complex_diag_matrix, + INSTALL_CONVOP (octave_float_complex_diag_matrix, octave_complex_diag_matrix, float_complex_diag_matrix_to_complex_diag_matrix); - INSTALL_CONVOP (octave_float_complex_diag_matrix, octave_float_complex_matrix, + INSTALL_CONVOP (octave_float_complex_diag_matrix, octave_float_complex_matrix, float_complex_diag_matrix_to_float_complex_matrix); INSTALL_ASSIGNCONV (octave_float_complex_diag_matrix, octave_float_complex_matrix, octave_float_complex_matrix); - INSTALL_WIDENOP (octave_float_complex_diag_matrix, octave_complex_diag_matrix, + INSTALL_WIDENOP (octave_float_complex_diag_matrix, octave_complex_diag_matrix, float_complex_diag_matrix_to_complex_diag_matrix); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fcm-fcm.cc --- a/src/OPERATORS/op-fcm-fcm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fcm-fcm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -73,20 +73,20 @@ // complex matrix by complex matrix ops. -DEFNDBINOP_OP (add, float_complex_matrix, float_complex_matrix, +DEFNDBINOP_OP (add, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, +) -DEFNDBINOP_OP (sub, float_complex_matrix, float_complex_matrix, +DEFNDBINOP_OP (sub, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, -) DEFBINOP_OP (mul, float_complex_matrix, float_complex_matrix, *) DEFBINOP (div, float_complex_matrix, float_complex_matrix) { - CAST_BINOP_ARGS (const octave_float_complex_matrix&, + CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&); MatrixType typ = v2.matrix_type (); - - FloatComplexMatrix ret = xdiv (v1.float_complex_matrix_value (), + + FloatComplexMatrix ret = xdiv (v1.float_complex_matrix_value (), v2.float_complex_matrix_value (), typ); v2.matrix_type (typ); @@ -101,11 +101,11 @@ DEFBINOP (ldiv, float_complex_matrix, float_complex_matrix) { - CAST_BINOP_ARGS (const octave_float_complex_matrix&, + CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&); MatrixType typ = v1.matrix_type (); - - FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (), + + FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (), v2.float_complex_matrix_value (), typ); v1.matrix_type (typ); @@ -115,7 +115,7 @@ DEFBINOP (trans_mul, float_complex_matrix, float_complex_matrix) { CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&); - return octave_value(xgemm (v1.float_complex_matrix_value (), + return octave_value(xgemm (v1.float_complex_matrix_value (), v2.float_complex_matrix_value (), blas_trans, blas_no_trans)); } @@ -123,7 +123,7 @@ DEFBINOP (mul_trans, float_complex_matrix, float_complex_matrix) { CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&); - return octave_value(xgemm (v1.float_complex_matrix_value (), + return octave_value(xgemm (v1.float_complex_matrix_value (), v2.float_complex_matrix_value (), blas_no_trans, blas_trans)); } @@ -131,7 +131,7 @@ DEFBINOP (herm_mul, float_complex_matrix, float_complex_matrix) { CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&); - return octave_value(xgemm (v1.float_complex_matrix_value (), + return octave_value(xgemm (v1.float_complex_matrix_value (), v2.float_complex_matrix_value (), blas_conj_trans, blas_no_trans)); } @@ -139,18 +139,18 @@ DEFBINOP (mul_herm, float_complex_matrix, float_complex_matrix) { CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&); - return octave_value(xgemm (v1.float_complex_matrix_value (), + return octave_value(xgemm (v1.float_complex_matrix_value (), v2.float_complex_matrix_value (), blas_no_trans, blas_conj_trans)); } DEFBINOP (trans_ldiv, float_complex_matrix, float_complex_matrix) { - CAST_BINOP_ARGS (const octave_float_complex_matrix&, + CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&); MatrixType typ = v1.matrix_type (); - - FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (), + + FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (), v2.float_complex_matrix_value (), typ, blas_trans); v1.matrix_type (typ); @@ -159,35 +159,35 @@ DEFBINOP (herm_ldiv, float_complex_matrix, float_complex_matrix) { - CAST_BINOP_ARGS (const octave_float_complex_matrix&, + CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex_matrix&); MatrixType typ = v1.matrix_type (); - - FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (), + + FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (), v2.float_complex_matrix_value (), typ, blas_conj_trans); v1.matrix_type (typ); return ret; } -DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_complex_matrix, +DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, mx_el_lt) -DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_complex_matrix, +DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, mx_el_le) -DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_complex_matrix, +DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, mx_el_eq) -DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_complex_matrix, +DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, mx_el_ge) -DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_complex_matrix, +DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, mx_el_gt) -DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_complex_matrix, +DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, mx_el_ne) -DEFNDBINOP_FN (el_mul, float_complex_matrix, float_complex_matrix, +DEFNDBINOP_FN (el_mul, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, product) -DEFNDBINOP_FN (el_div, float_complex_matrix, float_complex_matrix, +DEFNDBINOP_FN (el_div, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, quotient) -DEFNDBINOP_FN (el_pow, float_complex_matrix, float_complex_matrix, +DEFNDBINOP_FN (el_pow, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, elem_xpow) DEFBINOP (el_ldiv, float_complex_matrix, float_complex_matrix) @@ -198,30 +198,30 @@ return octave_value (quotient (v2.float_complex_array_value (), v1.float_complex_array_value ())); } -DEFNDBINOP_FN (el_and, float_complex_matrix, float_complex_matrix, +DEFNDBINOP_FN (el_and, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, mx_el_and) -DEFNDBINOP_FN (el_or, float_complex_matrix, float_complex_matrix, +DEFNDBINOP_FN (el_or, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, mx_el_or) -DEFNDCATOP_FN (fcm_fcm, float_complex_matrix, float_complex_matrix, +DEFNDCATOP_FN (fcm_fcm, float_complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, concat) -DEFNDCATOP_FN (cm_fcm, complex_matrix, float_complex_matrix, +DEFNDCATOP_FN (cm_fcm, complex_matrix, float_complex_matrix, float_complex_array, float_complex_array, concat) -DEFNDCATOP_FN (fcm_cm, float_complex_matrix, complex_matrix, +DEFNDCATOP_FN (fcm_cm, float_complex_matrix, complex_matrix, float_complex_array, float_complex_array, concat) -DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_complex_matrix, +DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_complex_matrix, float_complex_array, assign) -DEFNDASSIGNOP_FN (dbl_assign, float_complex_matrix, complex_matrix, +DEFNDASSIGNOP_FN (dbl_assign, float_complex_matrix, complex_matrix, float_complex_array, assign) DEFNULLASSIGNOP_FN (null_assign, float_complex_matrix, delete_elements) -DEFNDASSIGNOP_OP (assign_add, float_complex_matrix, +DEFNDASSIGNOP_OP (assign_add, float_complex_matrix, float_complex_matrix, float_complex_array, +=) -DEFNDASSIGNOP_OP (assign_sub, float_complex_matrix, +DEFNDASSIGNOP_OP (assign_sub, float_complex_matrix, float_complex_matrix, float_complex_array, -=) DEFNDASSIGNOP_FNOP (assign_el_mul, float_complex_matrix, float_complex_matrix, float_complex_array, product_eq) @@ -248,73 +248,73 @@ INSTALL_NCUNOP (op_decr, octave_float_complex_matrix, decr); INSTALL_NCUNOP (op_uminus, octave_float_complex_matrix, changesign); - INSTALL_BINOP (op_add, octave_float_complex_matrix, + INSTALL_BINOP (op_add, octave_float_complex_matrix, octave_float_complex_matrix, add); - INSTALL_BINOP (op_sub, octave_float_complex_matrix, + INSTALL_BINOP (op_sub, octave_float_complex_matrix, octave_float_complex_matrix, sub); - INSTALL_BINOP (op_mul, octave_float_complex_matrix, + INSTALL_BINOP (op_mul, octave_float_complex_matrix, octave_float_complex_matrix, mul); - INSTALL_BINOP (op_div, octave_float_complex_matrix, + INSTALL_BINOP (op_div, octave_float_complex_matrix, octave_float_complex_matrix, div); - INSTALL_BINOP (op_pow, octave_float_complex_matrix, + INSTALL_BINOP (op_pow, octave_float_complex_matrix, octave_float_complex_matrix, pow); - INSTALL_BINOP (op_ldiv, octave_float_complex_matrix, + INSTALL_BINOP (op_ldiv, octave_float_complex_matrix, octave_float_complex_matrix, ldiv); - INSTALL_BINOP (op_trans_mul, octave_float_complex_matrix, + INSTALL_BINOP (op_trans_mul, octave_float_complex_matrix, octave_float_complex_matrix, trans_mul); - INSTALL_BINOP (op_mul_trans, octave_float_complex_matrix, + INSTALL_BINOP (op_mul_trans, octave_float_complex_matrix, octave_float_complex_matrix, mul_trans); - INSTALL_BINOP (op_herm_mul, octave_float_complex_matrix, + INSTALL_BINOP (op_herm_mul, octave_float_complex_matrix, octave_float_complex_matrix, herm_mul); - INSTALL_BINOP (op_mul_herm, octave_float_complex_matrix, + INSTALL_BINOP (op_mul_herm, octave_float_complex_matrix, octave_float_complex_matrix, mul_herm); - INSTALL_BINOP (op_trans_ldiv, octave_float_complex_matrix, + INSTALL_BINOP (op_trans_ldiv, octave_float_complex_matrix, octave_float_complex_matrix, trans_ldiv); - INSTALL_BINOP (op_herm_ldiv, octave_float_complex_matrix, + INSTALL_BINOP (op_herm_ldiv, octave_float_complex_matrix, octave_float_complex_matrix, herm_ldiv); - INSTALL_BINOP (op_lt, octave_float_complex_matrix, + INSTALL_BINOP (op_lt, octave_float_complex_matrix, octave_float_complex_matrix, lt); - INSTALL_BINOP (op_le, octave_float_complex_matrix, + INSTALL_BINOP (op_le, octave_float_complex_matrix, octave_float_complex_matrix, le); - INSTALL_BINOP (op_eq, octave_float_complex_matrix, + INSTALL_BINOP (op_eq, octave_float_complex_matrix, octave_float_complex_matrix, eq); - INSTALL_BINOP (op_ge, octave_float_complex_matrix, + INSTALL_BINOP (op_ge, octave_float_complex_matrix, octave_float_complex_matrix, ge); - INSTALL_BINOP (op_gt, octave_float_complex_matrix, + INSTALL_BINOP (op_gt, octave_float_complex_matrix, octave_float_complex_matrix, gt); - INSTALL_BINOP (op_ne, octave_float_complex_matrix, + INSTALL_BINOP (op_ne, octave_float_complex_matrix, octave_float_complex_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_float_complex_matrix, + INSTALL_BINOP (op_el_mul, octave_float_complex_matrix, octave_float_complex_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_float_complex_matrix, + INSTALL_BINOP (op_el_div, octave_float_complex_matrix, octave_float_complex_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_float_complex_matrix, + INSTALL_BINOP (op_el_pow, octave_float_complex_matrix, octave_float_complex_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix, + INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix, octave_float_complex_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_float_complex_matrix, + INSTALL_BINOP (op_el_and, octave_float_complex_matrix, octave_float_complex_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_float_complex_matrix, + INSTALL_BINOP (op_el_or, octave_float_complex_matrix, octave_float_complex_matrix, el_or); - INSTALL_CATOP (octave_float_complex_matrix, + INSTALL_CATOP (octave_float_complex_matrix, octave_float_complex_matrix, fcm_fcm); - INSTALL_CATOP (octave_complex_matrix, + INSTALL_CATOP (octave_complex_matrix, octave_float_complex_matrix, cm_fcm); - INSTALL_CATOP (octave_float_complex_matrix, + INSTALL_CATOP (octave_float_complex_matrix, octave_complex_matrix, fcm_cm); - INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_float_complex_matrix, assign); - INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_complex_matrix, dbl_assign); - INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_null_matrix, null_assign); - INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_null_str, null_assign); - INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_null_sq_str, null_assign); INSTALL_ASSIGNOP (op_add_eq, octave_float_complex_matrix, @@ -326,6 +326,6 @@ INSTALL_ASSIGNOP (op_el_div_eq, octave_float_complex_matrix, octave_float_complex_matrix, assign_el_div); - INSTALL_CONVOP (octave_float_complex_matrix, octave_complex_matrix, + INSTALL_CONVOP (octave_float_complex_matrix, octave_complex_matrix, float_complex_matrix_to_complex_matrix); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fcm-fcs.cc --- a/src/OPERATORS/op-fcm-fcs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fcm-fcs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -38,16 +38,16 @@ // complex matrix by complex scalar ops. -DEFNDBINOP_OP (add, float_complex_matrix, float_complex, +DEFNDBINOP_OP (add, float_complex_matrix, float_complex, float_complex_array, float_complex, +) -DEFNDBINOP_OP (sub, float_complex_matrix, float_complex, +DEFNDBINOP_OP (sub, float_complex_matrix, float_complex, float_complex_array, float_complex, -) -DEFNDBINOP_OP (mul, float_complex_matrix, float_complex, +DEFNDBINOP_OP (mul, float_complex_matrix, float_complex, float_complex_array, float_complex, *) DEFBINOP (div, float_complex_matrix, float_complex) { - CAST_BINOP_ARGS (const octave_float_complex_matrix&, + CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex&); FloatComplex d = v2.float_complex_value (); @@ -62,7 +62,7 @@ DEFBINOP (ldiv, float_complex_matrix, float_complex) { - CAST_BINOP_ARGS (const octave_float_complex_matrix&, + CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex&); FloatComplexMatrix m1 = v1.float_complex_matrix_value (); @@ -74,25 +74,25 @@ return ret; } -DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_complex, float_complex_array, float_complex, mx_el_lt) -DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_complex, float_complex_array, float_complex, mx_el_le) -DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_complex, float_complex_array, float_complex, mx_el_eq) -DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_complex, float_complex_array, float_complex, mx_el_ge) -DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_complex, float_complex_array, float_complex, mx_el_gt) -DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_complex, float_complex_array, float_complex, mx_el_ne) -DEFNDBINOP_OP (el_mul, float_complex_matrix, float_complex, +DEFNDBINOP_OP (el_mul, float_complex_matrix, float_complex, float_complex_array, float_complex, *) DEFBINOP (el_div, float_complex_matrix, float_complex) { - CAST_BINOP_ARGS (const octave_float_complex_matrix&, + CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex&); FloatComplex d = v2.float_complex_value (); @@ -103,34 +103,34 @@ return octave_value (v1.float_complex_array_value () / d); } -DEFNDBINOP_FN (el_pow, float_complex_matrix, float_complex, +DEFNDBINOP_FN (el_pow, float_complex_matrix, float_complex, float_complex_array, float_complex, elem_xpow) DEFBINOP (el_ldiv, float_complex_matrix, float_complex) { - CAST_BINOP_ARGS (const octave_float_complex_matrix&, + CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_complex&); return x_el_div (v2.float_complex_value (), v1.float_complex_array_value ()); } -DEFNDBINOP_FN (el_and, float_complex_matrix, float_complex, +DEFNDBINOP_FN (el_and, float_complex_matrix, float_complex, float_complex_array, float_complex, mx_el_and) -DEFNDBINOP_FN (el_or, float_complex_matrix, float_complex, +DEFNDBINOP_FN (el_or, float_complex_matrix, float_complex, float_complex_array, float_complex, mx_el_or) -DEFNDCATOP_FN (fcm_fcs, float_complex_matrix, float_complex, +DEFNDCATOP_FN (fcm_fcs, float_complex_matrix, float_complex, float_complex_array, float_complex_array, concat) -DEFNDCATOP_FN (cm_fcs, complex_matrix, float_complex, +DEFNDCATOP_FN (cm_fcs, complex_matrix, float_complex, float_complex_array, float_complex_array, concat) -DEFNDCATOP_FN (fcm_cs, float_complex_matrix, complex, +DEFNDCATOP_FN (fcm_cs, float_complex_matrix, complex, float_complex_array, float_complex_array, concat) -DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_complex, +DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_complex, float_complex, assign) -DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_complex, +DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_complex, complex, assign) DEFNDASSIGNOP_OP (assign_add, float_complex_matrix, float_complex_scalar, @@ -145,17 +145,17 @@ void install_fcm_fcs_ops (void) { - INSTALL_BINOP (op_add, octave_float_complex_matrix, + INSTALL_BINOP (op_add, octave_float_complex_matrix, octave_float_complex, add); - INSTALL_BINOP (op_sub, octave_float_complex_matrix, + INSTALL_BINOP (op_sub, octave_float_complex_matrix, octave_float_complex, sub); - INSTALL_BINOP (op_mul, octave_float_complex_matrix, + INSTALL_BINOP (op_mul, octave_float_complex_matrix, octave_float_complex, mul); - INSTALL_BINOP (op_div, octave_float_complex_matrix, + INSTALL_BINOP (op_div, octave_float_complex_matrix, octave_float_complex, div); - INSTALL_BINOP (op_pow, octave_float_complex_matrix, + INSTALL_BINOP (op_pow, octave_float_complex_matrix, octave_float_complex, pow); - INSTALL_BINOP (op_ldiv, octave_float_complex_matrix, + INSTALL_BINOP (op_ldiv, octave_float_complex_matrix, octave_float_complex, ldiv); INSTALL_BINOP (op_lt, octave_float_complex_matrix, octave_float_complex, lt); INSTALL_BINOP (op_le, octave_float_complex_matrix, octave_float_complex, le); @@ -163,26 +163,26 @@ INSTALL_BINOP (op_ge, octave_float_complex_matrix, octave_float_complex, ge); INSTALL_BINOP (op_gt, octave_float_complex_matrix, octave_float_complex, gt); INSTALL_BINOP (op_ne, octave_float_complex_matrix, octave_float_complex, ne); - INSTALL_BINOP (op_el_mul, octave_float_complex_matrix, + INSTALL_BINOP (op_el_mul, octave_float_complex_matrix, octave_float_complex, el_mul); - INSTALL_BINOP (op_el_div, octave_float_complex_matrix, + INSTALL_BINOP (op_el_div, octave_float_complex_matrix, octave_float_complex, el_div); - INSTALL_BINOP (op_el_pow, octave_float_complex_matrix, + INSTALL_BINOP (op_el_pow, octave_float_complex_matrix, octave_float_complex, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix, + INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix, octave_float_complex, el_ldiv); - INSTALL_BINOP (op_el_and, octave_float_complex_matrix, + INSTALL_BINOP (op_el_and, octave_float_complex_matrix, octave_float_complex, el_and); - INSTALL_BINOP (op_el_or, octave_float_complex_matrix, + INSTALL_BINOP (op_el_or, octave_float_complex_matrix, octave_float_complex, el_or); INSTALL_CATOP (octave_float_complex_matrix, octave_float_complex, fcm_fcs); INSTALL_CATOP (octave_complex_matrix, octave_float_complex, cm_fcs); INSTALL_CATOP (octave_float_complex_matrix, octave_complex, fcm_cs); - INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_float_complex, assign); - INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_float_complex, dbl_assign); INSTALL_ASSIGNOP (op_add_eq, octave_float_complex_matrix, diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fcm-fm.cc --- a/src/OPERATORS/op-fcm-fm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fcm-fm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -61,11 +61,11 @@ DEFBINOP (div, float_complex_matrix, float_matrix) { - CAST_BINOP_ARGS (const octave_float_complex_matrix&, + CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_matrix&); MatrixType typ = v2.matrix_type (); - - FloatComplexMatrix ret = xdiv (v1.float_complex_matrix_value (), + + FloatComplexMatrix ret = xdiv (v1.float_complex_matrix_value (), v2.float_matrix_value (), typ); v2.matrix_type (typ); @@ -81,62 +81,62 @@ DEFBINOP (ldiv, float_complex_matrix, float_matrix) { - CAST_BINOP_ARGS (const octave_float_complex_matrix&, + CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_matrix&); MatrixType typ = v1.matrix_type (); - - FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (), + + FloatComplexMatrix ret = xleftdiv (v1.float_complex_matrix_value (), v2.float_matrix_value (), typ); v1.matrix_type (typ); return ret; } -DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_matrix, +DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_matrix, float_complex_array, float_array, mx_el_lt) -DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_matrix, +DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_matrix, float_complex_array, float_array, mx_el_le) -DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_matrix, +DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_matrix, float_complex_array, float_array, mx_el_eq) -DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_matrix, +DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_matrix, float_complex_array, float_array, mx_el_ge) -DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_matrix, +DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_matrix, float_complex_array, float_array, mx_el_gt) -DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_matrix, +DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_matrix, float_complex_array, float_array, mx_el_ne) -DEFNDBINOP_FN (el_mul, float_complex_matrix, float_matrix, +DEFNDBINOP_FN (el_mul, float_complex_matrix, float_matrix, float_complex_array, float_array, product) -DEFNDBINOP_FN (el_div, float_complex_matrix, float_matrix, +DEFNDBINOP_FN (el_div, float_complex_matrix, float_matrix, float_complex_array, float_array, quotient) -DEFNDBINOP_FN (el_pow, float_complex_matrix, float_matrix, +DEFNDBINOP_FN (el_pow, float_complex_matrix, float_matrix, float_complex_array, float_array, elem_xpow) DEFBINOP (el_ldiv, float_complex_matrix, float_matrix) { - CAST_BINOP_ARGS (const octave_float_complex_matrix&, + CAST_BINOP_ARGS (const octave_float_complex_matrix&, const octave_float_matrix&); return quotient (v2.float_array_value (), v1.float_complex_array_value ()); } -DEFNDBINOP_FN (el_and, float_complex_matrix, float_matrix, +DEFNDBINOP_FN (el_and, float_complex_matrix, float_matrix, float_complex_array, float_array, mx_el_and) -DEFNDBINOP_FN (el_or, float_complex_matrix, float_matrix, +DEFNDBINOP_FN (el_or, float_complex_matrix, float_matrix, float_complex_array, float_array, mx_el_or) -DEFNDCATOP_FN (fcm_fm, float_complex_matrix, float_matrix, +DEFNDCATOP_FN (fcm_fm, float_complex_matrix, float_matrix, float_complex_array, float_array, concat) -DEFNDCATOP_FN (cm_fm, complex_matrix, float_matrix, +DEFNDCATOP_FN (cm_fm, complex_matrix, float_matrix, float_complex_array, float_array, concat) -DEFNDCATOP_FN (fcm_m, float_complex_matrix, matrix, +DEFNDCATOP_FN (fcm_m, float_complex_matrix, matrix, float_complex_array, float_array, concat) -DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_matrix, +DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_matrix, float_complex_array, assign) -DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_matrix, +DEFNDASSIGNOP_FN (dbl_assign, complex_matrix, float_matrix, complex_array, assign) void @@ -147,7 +147,7 @@ INSTALL_BINOP (op_mul, octave_float_complex_matrix, octave_float_matrix, mul); INSTALL_BINOP (op_div, octave_float_complex_matrix, octave_float_matrix, div); INSTALL_BINOP (op_pow, octave_float_complex_matrix, octave_float_matrix, pow); - INSTALL_BINOP (op_ldiv, octave_float_complex_matrix, + INSTALL_BINOP (op_ldiv, octave_float_complex_matrix, octave_float_matrix, ldiv); INSTALL_BINOP (op_lt, octave_float_complex_matrix, octave_float_matrix, lt); INSTALL_BINOP (op_le, octave_float_complex_matrix, octave_float_matrix, le); @@ -155,29 +155,29 @@ INSTALL_BINOP (op_ge, octave_float_complex_matrix, octave_float_matrix, ge); INSTALL_BINOP (op_gt, octave_float_complex_matrix, octave_float_matrix, gt); INSTALL_BINOP (op_ne, octave_float_complex_matrix, octave_float_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_float_complex_matrix, + INSTALL_BINOP (op_el_mul, octave_float_complex_matrix, octave_float_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_float_complex_matrix, + INSTALL_BINOP (op_el_div, octave_float_complex_matrix, octave_float_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_float_complex_matrix, + INSTALL_BINOP (op_el_pow, octave_float_complex_matrix, octave_float_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix, + INSTALL_BINOP (op_el_ldiv, octave_float_complex_matrix, octave_float_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_float_complex_matrix, + INSTALL_BINOP (op_el_and, octave_float_complex_matrix, octave_float_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_float_complex_matrix, + INSTALL_BINOP (op_el_or, octave_float_complex_matrix, octave_float_matrix, el_or); - INSTALL_BINOP (op_mul_trans, octave_float_complex_matrix, + INSTALL_BINOP (op_mul_trans, octave_float_complex_matrix, octave_float_matrix, mul_trans); - INSTALL_BINOP (op_mul_herm, octave_float_complex_matrix, + INSTALL_BINOP (op_mul_herm, octave_float_complex_matrix, octave_float_matrix, mul_trans); INSTALL_CATOP (octave_float_complex_matrix, octave_float_matrix, fcm_fm); INSTALL_CATOP (octave_complex_matrix, octave_float_matrix, cm_fm); INSTALL_CATOP (octave_float_complex_matrix, octave_matrix, fcm_m); - INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_float_matrix, assign); - INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_float_matrix, dbl_assign); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fcm-fs.cc --- a/src/OPERATORS/op-fcm-fs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fcm-fs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -74,20 +74,20 @@ return ret; } -DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_scalar, float_complex_array, +DEFNDCMPLXCMPOP_FN (lt, float_complex_matrix, float_scalar, float_complex_array, float_scalar, mx_el_lt) -DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_scalar, float_complex_array, +DEFNDCMPLXCMPOP_FN (le, float_complex_matrix, float_scalar, float_complex_array, float_scalar, mx_el_le) -DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_scalar, float_complex_array, +DEFNDCMPLXCMPOP_FN (eq, float_complex_matrix, float_scalar, float_complex_array, float_scalar, mx_el_eq) -DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_scalar, float_complex_array, +DEFNDCMPLXCMPOP_FN (ge, float_complex_matrix, float_scalar, float_complex_array, float_scalar, mx_el_ge) -DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_scalar, float_complex_array, +DEFNDCMPLXCMPOP_FN (gt, float_complex_matrix, float_scalar, float_complex_array, float_scalar, mx_el_gt) -DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_scalar, float_complex_array, +DEFNDCMPLXCMPOP_FN (ne, float_complex_matrix, float_scalar, float_complex_array, float_scalar, mx_el_ne) -DEFNDBINOP_OP (el_mul, float_complex_matrix, float_scalar, float_complex_array, +DEFNDBINOP_OP (el_mul, float_complex_matrix, float_scalar, float_complex_array, float_scalar, *) DEFBINOP (el_div, float_complex_matrix, float) @@ -102,7 +102,7 @@ return octave_value (v1.float_complex_array_value () / d); } -DEFNDBINOP_FN (el_pow, float_complex_matrix, float_scalar, float_complex_array, +DEFNDBINOP_FN (el_pow, float_complex_matrix, float_scalar, float_complex_array, float_scalar, elem_xpow) DEFBINOP (el_ldiv, float_complex_matrix, float) @@ -112,18 +112,18 @@ return x_el_div (v2.float_value (), v1.float_complex_array_value ()); } -DEFNDBINOP_FN (el_and, float_complex_matrix, float_scalar, float_complex_array, +DEFNDBINOP_FN (el_and, float_complex_matrix, float_scalar, float_complex_array, float_scalar, mx_el_and) -DEFNDBINOP_FN (el_or, float_complex_matrix, float_scalar, float_complex_array, +DEFNDBINOP_FN (el_or, float_complex_matrix, float_scalar, float_complex_array, float_scalar, mx_el_or) -DEFNDCATOP_FN (fcm_fs, float_complex_matrix, float_scalar, float_complex_array, +DEFNDCATOP_FN (fcm_fs, float_complex_matrix, float_scalar, float_complex_array, float_array, concat) -DEFNDCATOP_FN (cm_fs, complex_matrix, float_scalar, float_complex_array, +DEFNDCATOP_FN (cm_fs, complex_matrix, float_scalar, float_complex_array, float_array, concat) -DEFNDCATOP_FN (fcm_s, float_complex_matrix, scalar, float_complex_array, +DEFNDCATOP_FN (fcm_s, float_complex_matrix, scalar, float_complex_array, float_array, concat) DEFNDASSIGNOP_FN (assign, float_complex_matrix, float_scalar, float_complex_array, assign) @@ -160,9 +160,9 @@ INSTALL_CATOP (octave_complex_matrix, octave_float_scalar, cm_fs); INSTALL_CATOP (octave_float_complex_matrix, octave_scalar, fcm_s); - INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_float_complex_matrix, octave_float_scalar, assign); - INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_complex_matrix, octave_float_scalar, dbl_assign); INSTALL_ASSIGNOP (op_mul_eq, octave_float_complex_matrix, diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fcs-fcm.cc --- a/src/OPERATORS/op-fcs-fcm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fcs-fcm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -70,24 +70,24 @@ return octave_value (v2.float_complex_array_value () / d); } -DEFNDCMPLXCMPOP_FN (lt, float_complex, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (lt, float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_lt) -DEFNDCMPLXCMPOP_FN (le, float_complex, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (le, float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_le) -DEFNDCMPLXCMPOP_FN (eq, float_complex, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (eq, float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_eq) -DEFNDCMPLXCMPOP_FN (ge, float_complex, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (ge, float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_ge) -DEFNDCMPLXCMPOP_FN (gt, float_complex, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (gt, float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_gt) -DEFNDCMPLXCMPOP_FN (ne, float_complex, float_complex_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (ne, float_complex, float_complex_matrix, float_complex, float_complex_array, mx_el_ne) -DEFNDBINOP_OP (el_mul, float_complex, float_complex_matrix, float_complex, +DEFNDBINOP_OP (el_mul, float_complex, float_complex_matrix, float_complex, float_complex_array, *) -DEFNDBINOP_FN (el_div, float_complex, float_complex_matrix, float_complex, +DEFNDBINOP_FN (el_div, float_complex, float_complex_matrix, float_complex, float_complex_array, x_el_div) -DEFNDBINOP_FN (el_pow, float_complex, float_complex_matrix, float_complex, +DEFNDBINOP_FN (el_pow, float_complex, float_complex_matrix, float_complex, float_complex_array, elem_xpow) DEFBINOP (el_ldiv, float_complex, float_complex_matrix) diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fcs-fcs.cc --- a/src/OPERATORS/op-fcs-fcs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fcs-fcs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -132,7 +132,7 @@ { CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&); - return (v1.float_complex_value () != static_cast(0.0) && + return (v1.float_complex_value () != static_cast(0.0) && v2.float_complex_value () != static_cast(0.0)); } @@ -140,17 +140,17 @@ { CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_complex&); - return (v1.float_complex_value () != static_cast(0.0) || + return (v1.float_complex_value () != static_cast(0.0) || v2.float_complex_value () != static_cast(0.0)); } -DEFNDCATOP_FN (fcs_fcs, float_complex, float_complex, float_complex_array, +DEFNDCATOP_FN (fcs_fcs, float_complex, float_complex, float_complex_array, float_complex_array, concat) -DEFNDCATOP_FN (cs_fcs, complex, float_complex, float_complex_array, +DEFNDCATOP_FN (cs_fcs, complex, float_complex, float_complex_array, float_complex_array, concat) -DEFNDCATOP_FN (fcs_cs, float_complex, complex, float_complex_array, +DEFNDCATOP_FN (fcs_cs, float_complex, complex, float_complex_array, float_complex_array, concat) CONVDECL (float_complex_to_complex) @@ -203,6 +203,6 @@ INSTALL_ASSIGNCONV (octave_float_complex, octave_null_str, octave_float_complex_matrix); INSTALL_ASSIGNCONV (octave_float_complex, octave_null_sq_str, octave_float_complex_matrix); - INSTALL_CONVOP (octave_float_complex, octave_complex_matrix, + INSTALL_CONVOP (octave_float_complex, octave_complex_matrix, float_complex_to_complex); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fcs-fm.cc --- a/src/OPERATORS/op-fcs-fm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fcs-fm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -77,24 +77,24 @@ return octave_value (v2.float_array_value () / d); } -DEFNDCMPLXCMPOP_FN (lt, float_complex, float_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (lt, float_complex, float_matrix, float_complex, float_array, mx_el_lt) -DEFNDCMPLXCMPOP_FN (le, float_complex, float_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (le, float_complex, float_matrix, float_complex, float_array, mx_el_le) -DEFNDCMPLXCMPOP_FN (eq, float_complex, float_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (eq, float_complex, float_matrix, float_complex, float_array, mx_el_eq) -DEFNDCMPLXCMPOP_FN (ge, float_complex, float_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (ge, float_complex, float_matrix, float_complex, float_array, mx_el_ge) -DEFNDCMPLXCMPOP_FN (gt, float_complex, float_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (gt, float_complex, float_matrix, float_complex, float_array, mx_el_gt) -DEFNDCMPLXCMPOP_FN (ne, float_complex, float_matrix, float_complex, +DEFNDCMPLXCMPOP_FN (ne, float_complex, float_matrix, float_complex, float_array, mx_el_ne) -DEFNDBINOP_OP (el_mul, float_complex, float_matrix, float_complex, +DEFNDBINOP_OP (el_mul, float_complex, float_matrix, float_complex, float_array, *) -DEFNDBINOP_FN (el_div, float_complex, float_matrix, float_complex, +DEFNDBINOP_FN (el_div, float_complex, float_matrix, float_complex, float_array, x_el_div) -DEFNDBINOP_FN (el_pow, float_complex, float_matrix, float_complex, +DEFNDBINOP_FN (el_pow, float_complex, float_matrix, float_complex, float_array, elem_xpow) DEFBINOP (el_ldiv, float_complex, float_matrix) @@ -109,18 +109,18 @@ return octave_value (v2.float_array_value () / d); } -DEFNDBINOP_FN (el_and, float_complex, float_matrix, float_complex, +DEFNDBINOP_FN (el_and, float_complex, float_matrix, float_complex, float_array, mx_el_and) -DEFNDBINOP_FN (el_or, float_complex, float_matrix, float_complex, +DEFNDBINOP_FN (el_or, float_complex, float_matrix, float_complex, float_array, mx_el_or) -DEFNDCATOP_FN (fcs_fm, float_complex, float_matrix, float_complex_array, +DEFNDCATOP_FN (fcs_fm, float_complex, float_matrix, float_complex_array, float_array, concat) -DEFNDCATOP_FN (cs_fm, complex, float_matrix, float_complex_array, +DEFNDCATOP_FN (cs_fm, complex, float_matrix, float_complex_array, float_array, concat) -DEFNDCATOP_FN (fcs_m, float_complex, matrix, float_complex_array, +DEFNDCATOP_FN (fcs_m, float_complex, matrix, float_complex_array, float_array, concat) void @@ -149,8 +149,8 @@ INSTALL_CATOP (octave_complex, octave_float_matrix, cs_fm); INSTALL_CATOP (octave_float_complex, octave_matrix, fcs_m); - INSTALL_ASSIGNCONV (octave_float_complex, octave_float_matrix, + INSTALL_ASSIGNCONV (octave_float_complex, octave_float_matrix, octave_float_complex_matrix); - INSTALL_ASSIGNCONV (octave_complex, octave_float_matrix, + INSTALL_ASSIGNCONV (octave_complex, octave_float_matrix, octave_complex_matrix); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fcs-fs.cc --- a/src/OPERATORS/op-fcs-fs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fcs-fs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -109,7 +109,7 @@ { CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&); - return (v1.float_complex_value () != static_cast(0.0) && + return (v1.float_complex_value () != static_cast(0.0) && v2.float_value ()); } @@ -117,17 +117,17 @@ { CAST_BINOP_ARGS (const octave_float_complex&, const octave_float_scalar&); - return (v1.float_complex_value () != static_cast(0.0) || + return (v1.float_complex_value () != static_cast(0.0) || v2.float_value ()); } -DEFNDCATOP_FN (fcs_fs, float_complex, float_scalar, float_complex_array, +DEFNDCATOP_FN (fcs_fs, float_complex, float_scalar, float_complex_array, float_array, concat) -DEFNDCATOP_FN (cs_fs, complex, float_scalar, float_complex_array, +DEFNDCATOP_FN (cs_fs, complex, float_scalar, float_complex_array, float_array, concat) -DEFNDCATOP_FN (fcs_s, float_complex, scalar, float_complex_array, +DEFNDCATOP_FN (fcs_s, float_complex, scalar, float_complex_array, float_array, concat) void @@ -156,8 +156,8 @@ INSTALL_CATOP (octave_complex, octave_float_scalar, cs_fs); INSTALL_CATOP (octave_float_complex, octave_scalar, fcs_s); - INSTALL_ASSIGNCONV (octave_float_complex, octave_float_scalar, + INSTALL_ASSIGNCONV (octave_float_complex, octave_float_scalar, octave_float_complex_matrix); - INSTALL_ASSIGNCONV (octave_complex, octave_float_scalar, + INSTALL_ASSIGNCONV (octave_complex, octave_float_scalar, octave_complex_matrix); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fdm-fdm.cc --- a/src/OPERATORS/op-fdm-fdm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fdm-fdm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -55,15 +55,15 @@ DEFBINOP (div, float_diag_matrix, float_diag_matrix) { CAST_BINOP_ARGS (const octave_float_diag_matrix&, const octave_float_diag_matrix&); - - return xdiv (v1.float_diag_matrix_value (), + + return xdiv (v1.float_diag_matrix_value (), v2.float_diag_matrix_value ()); } DEFBINOP (ldiv, float_diag_matrix, float_diag_matrix) { CAST_BINOP_ARGS (const octave_float_diag_matrix&, const octave_float_diag_matrix&); - + return xleftdiv (v1.float_diag_matrix_value (), v2.float_diag_matrix_value ()); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fm-fcm.cc --- a/src/OPERATORS/op-fm-fcm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fm-fcm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -43,9 +43,9 @@ // matrix by complex matrix ops. -DEFNDBINOP_OP (add, float_matrix, float_complex_matrix, float_array, +DEFNDBINOP_OP (add, float_matrix, float_complex_matrix, float_array, float_complex_array, +) -DEFNDBINOP_OP (sub, float_matrix, float_complex_matrix, float_array, +DEFNDBINOP_OP (sub, float_matrix, float_complex_matrix, float_array, float_complex_array, -) DEFBINOP_OP (mul, float_matrix, float_complex_matrix, *) @@ -63,11 +63,11 @@ DEFBINOP (div, float_matrix, float_complex_matrix) { - CAST_BINOP_ARGS (const octave_float_matrix&, + CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex_matrix&); MatrixType typ = v2.matrix_type (); - - FloatComplexMatrix ret = xdiv (v1.float_matrix_value (), + + FloatComplexMatrix ret = xdiv (v1.float_matrix_value (), v2.float_complex_matrix_value (), typ); v2.matrix_type (typ); @@ -82,11 +82,11 @@ DEFBINOP (ldiv, float_matrix, float_complex_matrix) { - CAST_BINOP_ARGS (const octave_float_matrix&, + CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex_matrix&); MatrixType typ = v1.matrix_type (); - - FloatComplexMatrix ret = xleftdiv (v1.float_matrix_value (), + + FloatComplexMatrix ret = xleftdiv (v1.float_matrix_value (), v2.float_complex_matrix_value (), typ); v1.matrix_type (typ); @@ -95,57 +95,57 @@ DEFBINOP (trans_ldiv, float_matrix, float_complex_matrix) { - CAST_BINOP_ARGS (const octave_float_matrix&, + CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex_matrix&); MatrixType typ = v1.matrix_type (); - - FloatComplexMatrix ret = xleftdiv (v1.float_matrix_value (), + + FloatComplexMatrix ret = xleftdiv (v1.float_matrix_value (), v2.float_complex_matrix_value (), typ, blas_trans); v1.matrix_type (typ); return ret; } -DEFNDCMPLXCMPOP_FN (lt, float_matrix, float_complex_matrix, float_array, +DEFNDCMPLXCMPOP_FN (lt, float_matrix, float_complex_matrix, float_array, float_complex_array, mx_el_lt) -DEFNDCMPLXCMPOP_FN (le, float_matrix, float_complex_matrix, float_array, +DEFNDCMPLXCMPOP_FN (le, float_matrix, float_complex_matrix, float_array, float_complex_array, mx_el_le) -DEFNDCMPLXCMPOP_FN (eq, float_matrix, float_complex_matrix, float_array, +DEFNDCMPLXCMPOP_FN (eq, float_matrix, float_complex_matrix, float_array, float_complex_array, mx_el_eq) -DEFNDCMPLXCMPOP_FN (ge, float_matrix, float_complex_matrix, float_array, +DEFNDCMPLXCMPOP_FN (ge, float_matrix, float_complex_matrix, float_array, float_complex_array, mx_el_ge) -DEFNDCMPLXCMPOP_FN (gt, float_matrix, float_complex_matrix, float_array, +DEFNDCMPLXCMPOP_FN (gt, float_matrix, float_complex_matrix, float_array, float_complex_array, mx_el_gt) -DEFNDCMPLXCMPOP_FN (ne, float_matrix, float_complex_matrix, float_array, +DEFNDCMPLXCMPOP_FN (ne, float_matrix, float_complex_matrix, float_array, float_complex_array, mx_el_ne) -DEFNDBINOP_FN (el_mul, float_matrix, float_complex_matrix, float_array, +DEFNDBINOP_FN (el_mul, float_matrix, float_complex_matrix, float_array, float_complex_array, product) -DEFNDBINOP_FN (el_div, float_matrix, float_complex_matrix, float_array, +DEFNDBINOP_FN (el_div, float_matrix, float_complex_matrix, float_array, float_complex_array, quotient) -DEFNDBINOP_FN (el_pow, float_matrix, float_complex_matrix, float_array, +DEFNDBINOP_FN (el_pow, float_matrix, float_complex_matrix, float_array, float_complex_array, elem_xpow) DEFBINOP (el_ldiv, float_matrix, float_complex_matrix) { - CAST_BINOP_ARGS (const octave_float_matrix&, + CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_complex_matrix&); return quotient (v2.float_complex_array_value (), v1.float_array_value ()); } -DEFNDBINOP_FN (el_and, float_matrix, float_complex_matrix, float_array, +DEFNDBINOP_FN (el_and, float_matrix, float_complex_matrix, float_array, float_complex_array, mx_el_and) -DEFNDBINOP_FN (el_or, float_matrix, float_complex_matrix, float_array, +DEFNDBINOP_FN (el_or, float_matrix, float_complex_matrix, float_array, float_complex_array, mx_el_or) -DEFNDCATOP_FN (fm_fcm, float_matrix, float_complex_matrix, float_array, +DEFNDCATOP_FN (fm_fcm, float_matrix, float_complex_matrix, float_array, float_complex_array, concat) -DEFNDCATOP_FN (m_fcm, matrix, float_complex_matrix, float_array, +DEFNDCATOP_FN (m_fcm, matrix, float_complex_matrix, float_array, float_complex_array, concat) -DEFNDCATOP_FN (fm_cm, float_matrix, complex_matrix, float_array, +DEFNDCATOP_FN (fm_cm, float_matrix, complex_matrix, float_array, float_complex_array, concat) DEFCONV (float_complex_matrix_conv, float_matrix, float_complex_matrix) @@ -163,7 +163,7 @@ INSTALL_BINOP (op_mul, octave_float_matrix, octave_float_complex_matrix, mul); INSTALL_BINOP (op_div, octave_float_matrix, octave_float_complex_matrix, div); INSTALL_BINOP (op_pow, octave_float_matrix, octave_float_complex_matrix, pow); - INSTALL_BINOP (op_ldiv, octave_float_matrix, + INSTALL_BINOP (op_ldiv, octave_float_matrix, octave_float_complex_matrix, ldiv); INSTALL_BINOP (op_lt, octave_float_matrix, octave_float_complex_matrix, lt); INSTALL_BINOP (op_le, octave_float_matrix, octave_float_complex_matrix, le); @@ -171,36 +171,36 @@ INSTALL_BINOP (op_ge, octave_float_matrix, octave_float_complex_matrix, ge); INSTALL_BINOP (op_gt, octave_float_matrix, octave_float_complex_matrix, gt); INSTALL_BINOP (op_ne, octave_float_matrix, octave_float_complex_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_float_matrix, + INSTALL_BINOP (op_el_mul, octave_float_matrix, octave_float_complex_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_float_matrix, + INSTALL_BINOP (op_el_div, octave_float_matrix, octave_float_complex_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_float_matrix, + INSTALL_BINOP (op_el_pow, octave_float_matrix, octave_float_complex_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_float_matrix, + INSTALL_BINOP (op_el_ldiv, octave_float_matrix, octave_float_complex_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_float_matrix, + INSTALL_BINOP (op_el_and, octave_float_matrix, octave_float_complex_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_float_matrix, + INSTALL_BINOP (op_el_or, octave_float_matrix, octave_float_complex_matrix, el_or); - INSTALL_BINOP (op_trans_mul, octave_float_matrix, + INSTALL_BINOP (op_trans_mul, octave_float_matrix, octave_float_complex_matrix, trans_mul); - INSTALL_BINOP (op_herm_mul, octave_float_matrix, + INSTALL_BINOP (op_herm_mul, octave_float_matrix, octave_float_complex_matrix, trans_mul); - INSTALL_BINOP (op_trans_ldiv, octave_float_matrix, + INSTALL_BINOP (op_trans_ldiv, octave_float_matrix, octave_float_complex_matrix, trans_ldiv); - INSTALL_BINOP (op_herm_ldiv, octave_float_matrix, + INSTALL_BINOP (op_herm_ldiv, octave_float_matrix, octave_float_complex_matrix, trans_ldiv); INSTALL_CATOP (octave_float_matrix, octave_float_complex_matrix, fm_fcm); INSTALL_CATOP (octave_matrix, octave_float_complex_matrix, m_fcm); INSTALL_CATOP (octave_float_matrix, octave_complex_matrix, fm_cm); - INSTALL_ASSIGNCONV (octave_float_matrix, octave_float_complex_matrix, + INSTALL_ASSIGNCONV (octave_float_matrix, octave_float_complex_matrix, octave_float_complex_matrix); - INSTALL_ASSIGNCONV (octave_matrix, octave_float_complex_matrix, + INSTALL_ASSIGNCONV (octave_matrix, octave_float_complex_matrix, octave_complex_matrix); - INSTALL_WIDENOP (octave_float_matrix, octave_float_complex_matrix, + INSTALL_WIDENOP (octave_float_matrix, octave_float_complex_matrix, float_complex_matrix_conv); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fm-fcs.cc --- a/src/OPERATORS/op-fm-fcs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fm-fcs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -77,20 +77,20 @@ return ret; } -DEFNDCMPLXCMPOP_FN (lt, float_matrix, float_complex, float_array, +DEFNDCMPLXCMPOP_FN (lt, float_matrix, float_complex, float_array, float_complex, mx_el_lt) -DEFNDCMPLXCMPOP_FN (le, float_matrix, float_complex, float_array, +DEFNDCMPLXCMPOP_FN (le, float_matrix, float_complex, float_array, float_complex, mx_el_le) -DEFNDCMPLXCMPOP_FN (eq, float_matrix, float_complex, float_array, +DEFNDCMPLXCMPOP_FN (eq, float_matrix, float_complex, float_array, float_complex, mx_el_eq) -DEFNDCMPLXCMPOP_FN (ge, float_matrix, float_complex, float_array, +DEFNDCMPLXCMPOP_FN (ge, float_matrix, float_complex, float_array, float_complex, mx_el_ge) -DEFNDCMPLXCMPOP_FN (gt, float_matrix, float_complex, float_array, +DEFNDCMPLXCMPOP_FN (gt, float_matrix, float_complex, float_array, float_complex, mx_el_gt) -DEFNDCMPLXCMPOP_FN (ne, float_matrix, float_complex, float_array, +DEFNDCMPLXCMPOP_FN (ne, float_matrix, float_complex, float_array, float_complex, mx_el_ne) -DEFNDBINOP_OP (el_mul, float_matrix, float_complex, float_array, +DEFNDBINOP_OP (el_mul, float_matrix, float_complex, float_array, float_complex, *) DEFBINOP (el_div, float_matrix, float_complex) @@ -105,7 +105,7 @@ return octave_value (v1.float_array_value () / d); } -DEFNDBINOP_FN (el_pow, float_matrix, float_complex, float_array, +DEFNDBINOP_FN (el_pow, float_matrix, float_complex, float_array, float_complex, elem_xpow) DEFBINOP (el_ldiv, float_matrix, flaot_complex) @@ -115,18 +115,18 @@ return x_el_div (v2.float_complex_value (), v1.float_array_value ()); } -DEFNDBINOP_FN (el_and, float_matrix, float_complex, float_array, +DEFNDBINOP_FN (el_and, float_matrix, float_complex, float_array, float_complex, mx_el_and) -DEFNDBINOP_FN (el_or, float_matrix, float_complex, float_array, +DEFNDBINOP_FN (el_or, float_matrix, float_complex, float_array, float_complex, mx_el_or) -DEFNDCATOP_FN (fm_fcs, float_matrix, float_complex, float_array, +DEFNDCATOP_FN (fm_fcs, float_matrix, float_complex, float_array, float_complex_array, concat) -DEFNDCATOP_FN (m_fcs, matrix, float_complex, float_array, +DEFNDCATOP_FN (m_fcs, matrix, float_complex, float_array, float_complex_array, concat) -DEFNDCATOP_FN (fm_cs, float_matrix, complex, float_array, +DEFNDCATOP_FN (fm_cs, float_matrix, complex, float_array, float_complex_array, concat) void @@ -155,8 +155,8 @@ INSTALL_CATOP (octave_matrix, octave_float_complex, m_fcs); INSTALL_CATOP (octave_float_matrix, octave_complex, fm_cs); - INSTALL_ASSIGNCONV (octave_float_matrix, octave_float_complex, + INSTALL_ASSIGNCONV (octave_float_matrix, octave_float_complex, octave_float_complex_matrix); - INSTALL_ASSIGNCONV (octave_matrix, octave_float_complex, + INSTALL_ASSIGNCONV (octave_matrix, octave_float_complex, octave_complex_matrix); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fm-fm.cc --- a/src/OPERATORS/op-fm-fm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fm-fm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -69,8 +69,8 @@ { CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&); MatrixType typ = v2.matrix_type (); - - FloatMatrix ret = xdiv (v1.float_matrix_value (), + + FloatMatrix ret = xdiv (v1.float_matrix_value (), v2.float_matrix_value (), typ); v2.matrix_type (typ); @@ -87,8 +87,8 @@ { CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&); MatrixType typ = v1.matrix_type (); - - FloatMatrix ret = xleftdiv (v1.float_matrix_value (), + + FloatMatrix ret = xleftdiv (v1.float_matrix_value (), v2.float_matrix_value (), typ); v1.matrix_type (typ); @@ -98,7 +98,7 @@ DEFBINOP (trans_mul, float_matrix, float_matrix) { CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&); - return octave_value(xgemm (v1.float_matrix_value (), + return octave_value(xgemm (v1.float_matrix_value (), v2.float_matrix_value (), blas_trans, blas_no_trans)); } @@ -106,7 +106,7 @@ DEFBINOP (mul_trans, float_matrix, float_matrix) { CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&); - return octave_value(xgemm (v1.float_matrix_value (), + return octave_value(xgemm (v1.float_matrix_value (), v2.float_matrix_value (), blas_no_trans, blas_trans)); } @@ -115,58 +115,58 @@ { CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&); MatrixType typ = v1.matrix_type (); - - FloatMatrix ret = xleftdiv (v1.float_matrix_value (), + + FloatMatrix ret = xleftdiv (v1.float_matrix_value (), v2.float_matrix_value (), typ, blas_trans); v1.matrix_type (typ); return ret; } -DEFNDBINOP_FN (lt, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (lt, float_matrix, float_matrix, float_array, float_array, mx_el_lt) -DEFNDBINOP_FN (le, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (le, float_matrix, float_matrix, float_array, float_array, mx_el_le) -DEFNDBINOP_FN (eq, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (eq, float_matrix, float_matrix, float_array, float_array, mx_el_eq) -DEFNDBINOP_FN (ge, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (ge, float_matrix, float_matrix, float_array, float_array, mx_el_ge) -DEFNDBINOP_FN (gt, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (gt, float_matrix, float_matrix, float_array, float_array, mx_el_gt) -DEFNDBINOP_FN (ne, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (ne, float_matrix, float_matrix, float_array, float_array, mx_el_ne) -DEFNDBINOP_FN (el_mul, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (el_mul, float_matrix, float_matrix, float_array, float_array, product) -DEFNDBINOP_FN (el_div, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (el_div, float_matrix, float_matrix, float_array, float_array, quotient) -DEFNDBINOP_FN (el_pow, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (el_pow, float_matrix, float_matrix, float_array, float_array, elem_xpow) DEFBINOP (el_ldiv, float_matrix, float_matrix) { CAST_BINOP_ARGS (const octave_float_matrix&, const octave_float_matrix&); - return octave_value (quotient (v2.float_array_value (), + return octave_value (quotient (v2.float_array_value (), v1.float_array_value ())); } -DEFNDBINOP_FN (el_and, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (el_and, float_matrix, float_matrix, float_array, float_array, mx_el_and) -DEFNDBINOP_FN (el_or, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (el_or, float_matrix, float_matrix, float_array, float_array, mx_el_or) -DEFNDBINOP_FN (el_not_and, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (el_not_and, float_matrix, float_matrix, float_array, float_array, mx_el_not_and) -DEFNDBINOP_FN (el_not_or, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (el_not_or, float_matrix, float_matrix, float_array, float_array, mx_el_not_or) -DEFNDBINOP_FN (el_and_not, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (el_and_not, float_matrix, float_matrix, float_array, float_array, mx_el_and_not) -DEFNDBINOP_FN (el_or_not, float_matrix, float_matrix, float_array, +DEFNDBINOP_FN (el_or_not, float_matrix, float_matrix, float_array, float_array, mx_el_or_not) -DEFNDCATOP_FN (fm_fm, float_matrix, float_matrix, float_array, +DEFNDCATOP_FN (fm_fm, float_matrix, float_matrix, float_array, float_array, concat) DEFNDCATOP_FN (m_fm, matrix, float_matrix, float_array, float_array, concat) @@ -237,9 +237,9 @@ INSTALL_CATOP (octave_matrix, octave_float_matrix, m_fm); INSTALL_CATOP (octave_float_matrix, octave_matrix, fm_m); - INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_float_matrix, assign); - INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_float_matrix, dbl_assign); INSTALL_ASSIGNOP (op_asn_eq, octave_float_matrix, octave_null_matrix, null_assign); diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fm-fs.cc --- a/src/OPERATORS/op-fm-fs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fm-fs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -69,17 +69,17 @@ return ret; } -DEFNDBINOP_FN (lt, float_matrix, float_scalar, float_array, +DEFNDBINOP_FN (lt, float_matrix, float_scalar, float_array, float_scalar, mx_el_lt) -DEFNDBINOP_FN (le, float_matrix, float_scalar, float_array, +DEFNDBINOP_FN (le, float_matrix, float_scalar, float_array, float_scalar, mx_el_le) -DEFNDBINOP_FN (eq, float_matrix, float_scalar, float_array, +DEFNDBINOP_FN (eq, float_matrix, float_scalar, float_array, float_scalar, mx_el_eq) -DEFNDBINOP_FN (ge, float_matrix, float_scalar, float_array, +DEFNDBINOP_FN (ge, float_matrix, float_scalar, float_array, float_scalar, mx_el_ge) -DEFNDBINOP_FN (gt, float_matrix, float_scalar, float_array, +DEFNDBINOP_FN (gt, float_matrix, float_scalar, float_array, float_scalar, mx_el_gt) -DEFNDBINOP_FN (ne, float_matrix, float_scalar, float_array, +DEFNDBINOP_FN (ne, float_matrix, float_scalar, float_array, float_scalar, mx_el_ne) DEFNDBINOP_OP (el_mul, float_matrix, float_scalar, float_array, float_scalar, *) @@ -96,7 +96,7 @@ return octave_value (v1.float_array_value () / d); } -DEFNDBINOP_FN (el_pow, float_matrix, float_scalar, float_array, +DEFNDBINOP_FN (el_pow, float_matrix, float_scalar, float_array, float_scalar, elem_xpow) DEFBINOP (el_ldiv, float_matrix, float) @@ -106,12 +106,12 @@ return x_el_div (v2.float_value (), v1.float_array_value ()); } -DEFNDBINOP_FN (el_and, float_matrix, float_scalar, float_array, +DEFNDBINOP_FN (el_and, float_matrix, float_scalar, float_array, float_scalar, mx_el_and) -DEFNDBINOP_FN (el_or, float_matrix, float_scalar, float_array, +DEFNDBINOP_FN (el_or, float_matrix, float_scalar, float_array, float_scalar, mx_el_or) -DEFNDCATOP_FN (fm_fs, float_matrix, float_scalar, float_array, +DEFNDCATOP_FN (fm_fs, float_matrix, float_scalar, float_array, float_array, concat) DEFNDCATOP_FN (m_fs, matrix, float_scalar, float_array, float_array, concat) diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fs-fcm.cc --- a/src/OPERATORS/op-fs-fcm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fs-fcm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -44,16 +44,16 @@ // scalar by complex matrix ops. -DEFNDBINOP_OP (add, float_scalar, float_complex_matrix, float_scalar, +DEFNDBINOP_OP (add, float_scalar, float_complex_matrix, float_scalar, float_complex_array, +) -DEFNDBINOP_OP (sub, float_scalar, float_complex_matrix, float_scalar, +DEFNDBINOP_OP (sub, float_scalar, float_complex_matrix, float_scalar, float_complex_array, -) -DEFNDBINOP_OP (mul, float_scalar, float_complex_matrix, float_scalar, +DEFNDBINOP_OP (mul, float_scalar, float_complex_matrix, float_scalar, float_complex_array, *) DEFBINOP (div, float_scalar, float_complex_matrix) { - CAST_BINOP_ARGS (const octave_float_scalar&, + CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex_matrix&); FloatMatrix m1 = v1.float_matrix_value (); @@ -70,7 +70,7 @@ DEFBINOP (ldiv, float_scalar, float_complex_matrix) { - CAST_BINOP_ARGS (const octave_float_scalar&, + CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex_matrix&); float d = v1.float_value (); @@ -81,29 +81,29 @@ return octave_value (v2.float_complex_array_value () / d); } -DEFNDCMPLXCMPOP_FN (lt, float_scalar, float_complex_matrix, float_scalar, +DEFNDCMPLXCMPOP_FN (lt, float_scalar, float_complex_matrix, float_scalar, float_complex_array, mx_el_lt) -DEFNDCMPLXCMPOP_FN (le, float_scalar, float_complex_matrix, float_scalar, +DEFNDCMPLXCMPOP_FN (le, float_scalar, float_complex_matrix, float_scalar, float_complex_array, mx_el_le) -DEFNDCMPLXCMPOP_FN (eq, float_scalar, float_complex_matrix, float_scalar, +DEFNDCMPLXCMPOP_FN (eq, float_scalar, float_complex_matrix, float_scalar, float_complex_array, mx_el_eq) -DEFNDCMPLXCMPOP_FN (ge, float_scalar, float_complex_matrix, float_scalar, +DEFNDCMPLXCMPOP_FN (ge, float_scalar, float_complex_matrix, float_scalar, float_complex_array, mx_el_ge) -DEFNDCMPLXCMPOP_FN (gt, float_scalar, float_complex_matrix, float_scalar, +DEFNDCMPLXCMPOP_FN (gt, float_scalar, float_complex_matrix, float_scalar, float_complex_array, mx_el_gt) -DEFNDCMPLXCMPOP_FN (ne, float_scalar, float_complex_matrix, float_scalar, +DEFNDCMPLXCMPOP_FN (ne, float_scalar, float_complex_matrix, float_scalar, float_complex_array, mx_el_ne) -DEFNDBINOP_OP (el_mul, float_scalar, float_complex_matrix, float_scalar, +DEFNDBINOP_OP (el_mul, float_scalar, float_complex_matrix, float_scalar, float_complex_array, *) -DEFNDBINOP_FN (el_div, float_scalar, float_complex_matrix, float_scalar, +DEFNDBINOP_FN (el_div, float_scalar, float_complex_matrix, float_scalar, float_complex_array, x_el_div) -DEFNDBINOP_FN (el_pow, float_scalar, float_complex_matrix, float_scalar, +DEFNDBINOP_FN (el_pow, float_scalar, float_complex_matrix, float_scalar, float_complex_array, elem_xpow) DEFBINOP (el_ldiv, float_scalar, float_complex_matrix) { - CAST_BINOP_ARGS (const octave_float_scalar&, + CAST_BINOP_ARGS (const octave_float_scalar&, const octave_float_complex_matrix&); float d = v1.float_value (); @@ -114,18 +114,18 @@ return octave_value (v2.float_complex_array_value () / d); } -DEFNDBINOP_FN (el_and, float_scalar, float_complex_matrix, float_scalar, +DEFNDBINOP_FN (el_and, float_scalar, float_complex_matrix, float_scalar, float_complex_array, mx_el_and) -DEFNDBINOP_FN (el_or, float_scalar, float_complex_matrix, float_scalar, +DEFNDBINOP_FN (el_or, float_scalar, float_complex_matrix, float_scalar, float_complex_array, mx_el_or) -DEFNDCATOP_FN (fs_fcm, float_scalar, float_complex_matrix, float_array, +DEFNDCATOP_FN (fs_fcm, float_scalar, float_complex_matrix, float_array, float_complex_array, concat) -DEFNDCATOP_FN (s_fcm, scalar, float_complex_matrix, float_array, +DEFNDCATOP_FN (s_fcm, scalar, float_complex_matrix, float_array, float_complex_array, concat) -DEFNDCATOP_FN (fs_cm, float_scalar, complex_matrix, float_array, +DEFNDCATOP_FN (fs_cm, float_scalar, complex_matrix, float_array, float_complex_array, concat) DEFCONV (float_complex_matrix_conv, float_scalar, float_complex_matrix) @@ -143,7 +143,7 @@ INSTALL_BINOP (op_mul, octave_float_scalar, octave_float_complex_matrix, mul); INSTALL_BINOP (op_div, octave_float_scalar, octave_float_complex_matrix, div); INSTALL_BINOP (op_pow, octave_float_scalar, octave_float_complex_matrix, pow); - INSTALL_BINOP (op_ldiv, octave_float_scalar, + INSTALL_BINOP (op_ldiv, octave_float_scalar, octave_float_complex_matrix, ldiv); INSTALL_BINOP (op_lt, octave_float_scalar, octave_float_complex_matrix, lt); INSTALL_BINOP (op_le, octave_float_scalar, octave_float_complex_matrix, le); @@ -151,28 +151,28 @@ INSTALL_BINOP (op_ge, octave_float_scalar, octave_float_complex_matrix, ge); INSTALL_BINOP (op_gt, octave_float_scalar, octave_float_complex_matrix, gt); INSTALL_BINOP (op_ne, octave_float_scalar, octave_float_complex_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_float_scalar, + INSTALL_BINOP (op_el_mul, octave_float_scalar, octave_float_complex_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_float_scalar, + INSTALL_BINOP (op_el_div, octave_float_scalar, octave_float_complex_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_float_scalar, + INSTALL_BINOP (op_el_pow, octave_float_scalar, octave_float_complex_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_float_scalar, + INSTALL_BINOP (op_el_ldiv, octave_float_scalar, octave_float_complex_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_float_scalar, + INSTALL_BINOP (op_el_and, octave_float_scalar, octave_float_complex_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_float_scalar, + INSTALL_BINOP (op_el_or, octave_float_scalar, octave_float_complex_matrix, el_or); INSTALL_CATOP (octave_float_scalar, octave_float_complex_matrix, fs_fcm); INSTALL_CATOP (octave_scalar, octave_float_complex_matrix, s_fcm); INSTALL_CATOP (octave_float_scalar, octave_complex_matrix, fs_cm); - INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_complex_matrix, + INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_complex_matrix, octave_float_complex_matrix); - INSTALL_ASSIGNCONV (octave_scalar, octave_float_complex_matrix, + INSTALL_ASSIGNCONV (octave_scalar, octave_float_complex_matrix, octave_complex_matrix); - INSTALL_WIDENOP (octave_float_scalar, octave_float_complex_matrix, + INSTALL_WIDENOP (octave_float_scalar, octave_float_complex_matrix, float_complex_matrix_conv); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fs-fcs.cc --- a/src/OPERATORS/op-fs-fcs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fs-fcs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -119,13 +119,13 @@ return octave_value (v1.float_scalar_value () || (v2.float_complex_value () != static_cast(0.0))); } -DEFNDCATOP_FN (fs_fcs, float_scalar, float_complex, float_array, +DEFNDCATOP_FN (fs_fcs, float_scalar, float_complex, float_array, float_complex_array, concat) -DEFNDCATOP_FN (s_fcs, scalar, float_complex, float_array, +DEFNDCATOP_FN (s_fcs, scalar, float_complex, float_array, float_complex_array, concat) -DEFNDCATOP_FN (fs_cs, float_scalar, complex, float_array, +DEFNDCATOP_FN (fs_cs, float_scalar, complex, float_array, float_complex_array, concat) void @@ -154,8 +154,8 @@ INSTALL_CATOP (octave_scalar, octave_float_complex, s_fcs); INSTALL_CATOP (octave_float_scalar, octave_complex, fs_cs); - INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_complex, + INSTALL_ASSIGNCONV (octave_float_scalar, octave_float_complex, octave_float_complex_matrix); - INSTALL_ASSIGNCONV (octave_scalar, octave_float_complex, + INSTALL_ASSIGNCONV (octave_scalar, octave_float_complex, octave_complex_matrix); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-fs-fm.cc --- a/src/OPERATORS/op-fs-fm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-fs-fm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -70,24 +70,24 @@ return octave_value (v2.float_array_value () / d); } -DEFNDBINOP_FN (lt, float_scalar, float_matrix, float_scalar, +DEFNDBINOP_FN (lt, float_scalar, float_matrix, float_scalar, float_array, mx_el_lt) -DEFNDBINOP_FN (le, float_scalar, float_matrix, float_scalar, +DEFNDBINOP_FN (le, float_scalar, float_matrix, float_scalar, float_array, mx_el_le) -DEFNDBINOP_FN (eq, float_scalar, float_matrix, float_scalar, +DEFNDBINOP_FN (eq, float_scalar, float_matrix, float_scalar, float_array, mx_el_eq) -DEFNDBINOP_FN (ge, float_scalar, float_matrix, float_scalar, +DEFNDBINOP_FN (ge, float_scalar, float_matrix, float_scalar, float_array, mx_el_ge) -DEFNDBINOP_FN (gt, float_scalar, float_matrix, float_scalar, +DEFNDBINOP_FN (gt, float_scalar, float_matrix, float_scalar, float_array, mx_el_gt) -DEFNDBINOP_FN (ne, float_scalar, float_matrix, float_scalar, +DEFNDBINOP_FN (ne, float_scalar, float_matrix, float_scalar, float_array, mx_el_ne) -DEFNDBINOP_OP (el_mul, float_scalar, float_matrix, float_scalar, +DEFNDBINOP_OP (el_mul, float_scalar, float_matrix, float_scalar, float_array, *) -DEFNDBINOP_FN (el_div, float_scalar, float_matrix, float_scalar, +DEFNDBINOP_FN (el_div, float_scalar, float_matrix, float_scalar, float_array, x_el_div) -DEFNDBINOP_FN (el_pow, float_scalar, float_matrix, float_scalar, +DEFNDBINOP_FN (el_pow, float_scalar, float_matrix, float_scalar, float_array, elem_xpow) DEFBINOP (el_ldiv, float_scalar, float_matrix) @@ -102,12 +102,12 @@ return octave_value (v2.float_array_value () / d); } -DEFNDBINOP_FN (el_and, float_scalar, float_matrix, float_scalar, +DEFNDBINOP_FN (el_and, float_scalar, float_matrix, float_scalar, float_array, mx_el_and) -DEFNDBINOP_FN (el_or, float_scalar, float_matrix, float_scalar, +DEFNDBINOP_FN (el_or, float_scalar, float_matrix, float_scalar, float_array, mx_el_or) -DEFNDCATOP_FN (fs_fm, float_scalar, float_matrix, float_array, +DEFNDCATOP_FN (fs_fm, float_scalar, float_matrix, float_array, float_array, concat) DEFNDCATOP_FN (s_fm, scalar, float_matrix, float_array, float_array, concat) diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-int-concat.cc --- a/src/OPERATORS/op-int-concat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-int-concat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -135,7 +135,7 @@ OCTAVE_DOUBLE_INT_CONCAT_FN (int16) OCTAVE_DOUBLE_INT_CONCAT_FN (int32) OCTAVE_DOUBLE_INT_CONCAT_FN (int64) - + OCTAVE_DOUBLE_INT_CONCAT_FN (uint8) OCTAVE_DOUBLE_INT_CONCAT_FN (uint16) OCTAVE_DOUBLE_INT_CONCAT_FN (uint32) @@ -155,7 +155,7 @@ OCTAVE_FLOAT_INT_CONCAT_FN (int16) OCTAVE_FLOAT_INT_CONCAT_FN (int32) OCTAVE_FLOAT_INT_CONCAT_FN (int64) - + OCTAVE_FLOAT_INT_CONCAT_FN (uint8) OCTAVE_FLOAT_INT_CONCAT_FN (uint16) OCTAVE_FLOAT_INT_CONCAT_FN (uint32) @@ -175,7 +175,7 @@ OCTAVE_CHAR_INT_CONCAT_FN (int16) OCTAVE_CHAR_INT_CONCAT_FN (int32) OCTAVE_CHAR_INT_CONCAT_FN (int64) - + OCTAVE_CHAR_INT_CONCAT_FN (uint8) OCTAVE_CHAR_INT_CONCAT_FN (uint16) OCTAVE_CHAR_INT_CONCAT_FN (uint32) diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-m-cm.cc --- a/src/OPERATORS/op-m-cm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-m-cm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -63,8 +63,8 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); MatrixType typ = v2.matrix_type (); - - ComplexMatrix ret = xdiv (v1.matrix_value (), + + ComplexMatrix ret = xdiv (v1.matrix_value (), v2.complex_matrix_value (), typ); v2.matrix_type (typ); @@ -81,8 +81,8 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); MatrixType typ = v1.matrix_type (); - - ComplexMatrix ret = xleftdiv (v1.matrix_value (), + + ComplexMatrix ret = xleftdiv (v1.matrix_value (), v2.complex_matrix_value (), typ); v1.matrix_type (typ); @@ -93,8 +93,8 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_complex_matrix&); MatrixType typ = v1.matrix_type (); - - ComplexMatrix ret = xleftdiv (v1.matrix_value (), + + ComplexMatrix ret = xleftdiv (v1.matrix_value (), v2.complex_matrix_value (), typ, blas_trans); v1.matrix_type (typ); diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-m-m.cc --- a/src/OPERATORS/op-m-m.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-m-m.cc Thu Jan 20 17:24:59 2011 -0500 @@ -69,7 +69,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); MatrixType typ = v2.matrix_type (); - + Matrix ret = xdiv (v1.matrix_value (), v2.matrix_value (), typ); v2.matrix_type (typ); @@ -86,7 +86,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); MatrixType typ = v1.matrix_type (); - + Matrix ret = xleftdiv (v1.matrix_value (), v2.matrix_value (), typ); v1.matrix_type (typ); @@ -111,7 +111,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_matrix&); MatrixType typ = v1.matrix_type (); - + Matrix ret = xleftdiv (v1.matrix_value (), v2.matrix_value (), typ, blas_trans); v1.matrix_type (typ); diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-m-scm.cc --- a/src/OPERATORS/op-m-scm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-m-scm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -64,7 +64,7 @@ { MatrixType typ = v2.matrix_type (); - ComplexMatrix ret = xdiv (v1.matrix_value (), + ComplexMatrix ret = xdiv (v1.matrix_value (), v2.sparse_complex_matrix_value (), typ); v2.matrix_type (typ); @@ -80,11 +80,11 @@ DEFBINOP (ldiv, matrix, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_matrix&, + CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_complex_matrix&); MatrixType typ = v1.matrix_type (); - - ComplexMatrix ret = xleftdiv (v1.matrix_value (), + + ComplexMatrix ret = xleftdiv (v1.matrix_value (), v2.complex_matrix_value (), typ); v1.matrix_type (typ); @@ -103,19 +103,19 @@ DEFBINOP (el_pow, matrix, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_matrix&, + CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_complex_matrix&); - - return octave_value + + return octave_value (elem_xpow (SparseMatrix (v1.matrix_value ()), v2.sparse_complex_matrix_value ())); } DEFBINOP (el_ldiv, matrix, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_matrix&, + CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_complex_matrix&); - return octave_value + return octave_value (quotient (v2.sparse_complex_matrix_value (), v1.matrix_value ())); } @@ -126,14 +126,14 @@ { CAST_BINOP_ARGS (octave_matrix&, const octave_sparse_complex_matrix&); SparseMatrix tmp (v1.matrix_value ()); - return octave_value (tmp. concat (v2.sparse_complex_matrix_value (), + return octave_value (tmp. concat (v2.sparse_complex_matrix_value (), ra_idx)); } DEFCONV (sparse_complex_matrix_conv, matrix, sparse_complex_matrix) { CAST_CONV_ARG (const octave_matrix&); - return new octave_sparse_complex_matrix + return new octave_sparse_complex_matrix (SparseComplexMatrix (v.complex_matrix_value ())); } @@ -152,24 +152,24 @@ INSTALL_BINOP (op_ge, octave_matrix, octave_sparse_complex_matrix, ge); INSTALL_BINOP (op_gt, octave_matrix, octave_sparse_complex_matrix, gt); INSTALL_BINOP (op_ne, octave_matrix, octave_sparse_complex_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_mul, octave_matrix, octave_sparse_complex_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_div, octave_matrix, octave_sparse_complex_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_pow, octave_matrix, octave_sparse_complex_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_ldiv, octave_matrix, octave_sparse_complex_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_and, octave_matrix, octave_sparse_complex_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_or, octave_matrix, octave_sparse_complex_matrix, el_or); INSTALL_CATOP (octave_matrix, octave_sparse_complex_matrix, m_scm); - INSTALL_ASSIGNCONV (octave_matrix, octave_sparse_complex_matrix, + INSTALL_ASSIGNCONV (octave_matrix, octave_sparse_complex_matrix, octave_complex_matrix); - INSTALL_WIDENOP (octave_matrix, octave_sparse_complex_matrix, + INSTALL_WIDENOP (octave_matrix, octave_sparse_complex_matrix, sparse_complex_matrix_conv); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-m-sm.cc --- a/src/OPERATORS/op-m-sm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-m-sm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -80,7 +80,7 @@ { CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&); MatrixType typ = v1.matrix_type (); - + Matrix ret = xleftdiv (v1.matrix_value (), v2.matrix_value (), typ); v1.matrix_type (typ); @@ -102,16 +102,16 @@ DEFBINOP (el_pow, matrix, sparse_matrix) { CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&); - - return octave_value (elem_xpow (SparseMatrix (v1.matrix_value ()), + + return octave_value (elem_xpow (SparseMatrix (v1.matrix_value ()), v2.sparse_matrix_value ())); } DEFBINOP (el_ldiv, matrix, sparse_matrix) { CAST_BINOP_ARGS (const octave_matrix&, const octave_sparse_matrix&); - - return octave_value + + return octave_value (quotient (v2.sparse_matrix_value (), v1.matrix_value ())); } @@ -162,6 +162,6 @@ INSTALL_ASSIGNOP (op_asn_eq, octave_matrix, octave_sparse_matrix, assign) INSTALL_ASSIGNCONV (octave_matrix, octave_sparse_matrix, octave_matrix) - INSTALL_WIDENOP (octave_matrix, octave_sparse_matrix, + INSTALL_WIDENOP (octave_matrix, octave_sparse_matrix, sparse_matrix_conv); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-pm-pm.cc --- a/src/OPERATORS/op-pm-pm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-pm-pm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -45,14 +45,14 @@ DEFBINOP (div, perm_matrix, perm_matrix) { CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&); - + return (v1.perm_matrix_value () * v2.perm_matrix_value ().inverse ()); } DEFBINOP (ldiv, perm_matrix, perm_matrix) { CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_perm_matrix&); - + return (v1.perm_matrix_value ().inverse () * v2.perm_matrix_value ()); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-pm-scm.cc --- a/src/OPERATORS/op-pm-scm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-pm-scm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -55,7 +55,7 @@ { CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_complex_matrix&); - return v1.perm_matrix_value ().inverse () * v2.sparse_complex_matrix_value (); + return v1.perm_matrix_value ().inverse () * v2.sparse_complex_matrix_value (); } // sparse matrix by diagonal matrix ops diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-pm-sm.cc --- a/src/OPERATORS/op-pm-sm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-pm-sm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -55,7 +55,7 @@ { CAST_BINOP_ARGS (const octave_perm_matrix&, const octave_sparse_matrix&); - return v1.perm_matrix_value ().inverse () * v2.sparse_matrix_value (); + return v1.perm_matrix_value ().inverse () * v2.sparse_matrix_value (); } // sparse matrix by diagonal matrix ops diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-pm-template.cc --- a/src/OPERATORS/op-pm-template.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-pm-template.cc Thu Jan 20 17:24:59 2011 -0500 @@ -58,7 +58,7 @@ { CAST_BINOP_ARGS (const OCTAVE_LMATRIX&, const OCTAVE_RMATRIX&); - return v1.perm_matrix_value ().inverse () * v2.RMATRIX_VALUE (); + return v1.perm_matrix_value ().inverse () * v2.RMATRIX_VALUE (); } #else DEFBINOP (div, LMATRIX, RMATRIX) diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-range.cc --- a/src/OPERATORS/op-range.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-range.cc Thu Jan 20 17:24:59 2011 -0500 @@ -131,12 +131,12 @@ // FIXME -- this would be unneccessary if // octave_base_value::numeric_assign always tried converting lhs // before rhs. - + INSTALL_ASSIGNCONV (octave_range, octave_null_matrix, octave_matrix); INSTALL_ASSIGNCONV (octave_range, octave_null_str, octave_matrix); INSTALL_ASSIGNCONV (octave_range, octave_null_sq_str, octave_matrix); // However, this should probably be here just in case we need it. - + INSTALL_WIDENOP (octave_range, octave_matrix, range_to_matrix); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-s-scm.cc --- a/src/OPERATORS/op-s-scm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-s-scm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -73,14 +73,14 @@ DEFBINOP (pow, scalar, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_scalar&, + CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_complex_matrix&); return xpow (v1.scalar_value (), v2.complex_matrix_value ()); } DEFBINOP (ldiv, scalar, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_scalar&, + CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_complex_matrix&); double d = v1.double_value (); @@ -107,7 +107,7 @@ DEFBINOP (el_ldiv, scalar, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_scalar&, + CAST_BINOP_ARGS (const octave_scalar&, const octave_sparse_complex_matrix&); double d = v1.double_value (); @@ -136,7 +136,7 @@ { CAST_CONV_ARG (const octave_scalar&); - return new octave_sparse_complex_matrix + return new octave_sparse_complex_matrix (SparseComplexMatrix (v.complex_matrix_value ())); } @@ -155,24 +155,24 @@ INSTALL_BINOP (op_ge, octave_scalar, octave_sparse_complex_matrix, ge); INSTALL_BINOP (op_gt, octave_scalar, octave_sparse_complex_matrix, gt); INSTALL_BINOP (op_ne, octave_scalar, octave_sparse_complex_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_scalar, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_mul, octave_scalar, octave_sparse_complex_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_scalar, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_div, octave_scalar, octave_sparse_complex_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_scalar, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_pow, octave_scalar, octave_sparse_complex_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_ldiv, octave_scalar, octave_sparse_complex_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_scalar, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_and, octave_scalar, octave_sparse_complex_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_scalar, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_or, octave_scalar, octave_sparse_complex_matrix, el_or); INSTALL_CATOP (octave_scalar, octave_sparse_complex_matrix, s_scm); - INSTALL_ASSIGNCONV (octave_scalar, octave_sparse_complex_matrix, + INSTALL_ASSIGNCONV (octave_scalar, octave_sparse_complex_matrix, octave_complex_matrix); - INSTALL_WIDENOP (octave_scalar, octave_sparse_complex_matrix, + INSTALL_WIDENOP (octave_scalar, octave_sparse_complex_matrix, sparse_complex_matrix_conv); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-sbm-b.cc --- a/src/OPERATORS/op-sbm-b.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-sbm-b.cc Thu Jan 20 17:24:59 2011 -0500 @@ -46,8 +46,8 @@ DEFCATOP (sbm_b, sparse_bool_matrix, bool) { - CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool&); - + CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool&); + SparseBoolMatrix tmp (1, 1, v2.bool_value ()); return octave_value (v1.sparse_bool_matrix_value (). concat (tmp, ra_idx)); } @@ -55,15 +55,15 @@ DEFCATOP (sm_b, sparse_matrix, bool) { CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_bool&); - + SparseMatrix tmp (1, 1, v2.scalar_value ()); return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx)); } DEFCATOP (sbm_s, sparse_bool_matrix, scalar) { - CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_scalar&); - + CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_scalar&); + SparseMatrix tmp (1, 1, v2.scalar_value ()); return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx)); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-sbm-bm.cc --- a/src/OPERATORS/op-sbm-bm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-sbm-bm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -49,8 +49,8 @@ DEFCATOP (sbm_bm, sparse_bool_matrix, bool_matrix) { - CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool_matrix&); - + CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_bool_matrix&); + SparseBoolMatrix tmp (v2.bool_matrix_value ()); return octave_value (v1.sparse_bool_matrix_value (). concat (tmp, ra_idx)); } @@ -58,15 +58,15 @@ DEFCATOP (sbm_m, sparse_bool_matrix, matrix) { CAST_BINOP_ARGS (octave_sparse_bool_matrix&, const octave_matrix&); - + SparseMatrix tmp (v2.matrix_value ()); return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx)); } DEFCATOP (sm_bm, sparse_matrix, bool_matrix) { - CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_bool_matrix&); - + CAST_BINOP_ARGS (octave_sparse_matrix&, const octave_bool_matrix&); + SparseMatrix tmp (v2.matrix_value ()); return octave_value (v1.sparse_matrix_value (). concat (tmp, ra_idx)); } @@ -85,15 +85,15 @@ INSTALL_BINOP (op_eq, octave_sparse_bool_matrix, octave_bool_matrix, eq); INSTALL_BINOP (op_ne, octave_sparse_bool_matrix, octave_bool_matrix, ne); - INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, octave_bool_matrix, + INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, octave_bool_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, octave_bool_matrix, + INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, octave_bool_matrix, el_or); INSTALL_CATOP (octave_sparse_bool_matrix, octave_bool_matrix, sbm_bm); INSTALL_CATOP (octave_sparse_matrix, octave_bool_matrix, sm_bm); INSTALL_CATOP (octave_sparse_bool_matrix, octave_matrix, sbm_m); - INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, octave_bool_matrix, assign); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-sbm-sbm.cc --- a/src/OPERATORS/op-sbm-sbm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-sbm-sbm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -65,14 +65,14 @@ DEFBINOP_FN (el_and, sparse_bool_matrix, sparse_bool_matrix, mx_el_and) DEFBINOP_FN (el_or, sparse_bool_matrix, sparse_bool_matrix, mx_el_or) -DEFNDCATOP_FN (sbm_sbm, sparse_bool_matrix, sparse_bool_matrix, +DEFNDCATOP_FN (sbm_sbm, sparse_bool_matrix, sparse_bool_matrix, sparse_bool_matrix, sparse_bool_matrix, concat) -DEFNDCATOP_FN (sbm_sm, sparse_bool_matrix, sparse_matrix, sparse_matrix, +DEFNDCATOP_FN (sbm_sm, sparse_bool_matrix, sparse_matrix, sparse_matrix, sparse_matrix, concat) -DEFNDCATOP_FN (sm_sbm, sparse_matrix, sparse_bool_matrix, sparse_matrix, +DEFNDCATOP_FN (sm_sbm, sparse_matrix, sparse_bool_matrix, sparse_matrix, sparse_matrix, concat) -DEFASSIGNOP_FN (assign, sparse_bool_matrix, sparse_bool_matrix, +DEFASSIGNOP_FN (assign, sparse_bool_matrix, sparse_bool_matrix, assign) CONVDECL (bool_matrix_to_double_matrix) @@ -91,24 +91,24 @@ INSTALL_UNOP (op_transpose, octave_sparse_bool_matrix, transpose); INSTALL_UNOP (op_hermitian, octave_sparse_bool_matrix, transpose); - INSTALL_BINOP (op_eq, octave_sparse_bool_matrix, + INSTALL_BINOP (op_eq, octave_sparse_bool_matrix, octave_sparse_bool_matrix, eq); - INSTALL_BINOP (op_ne, octave_sparse_bool_matrix, + INSTALL_BINOP (op_ne, octave_sparse_bool_matrix, octave_sparse_bool_matrix, ne); - INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, + INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix, octave_sparse_bool_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, + INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix, octave_sparse_bool_matrix, el_or); - INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_bool_matrix, + INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_bool_matrix, sbm_sbm); INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_matrix, sbm_sm); INSTALL_CATOP (octave_sparse_matrix, octave_sparse_bool_matrix, sm_sbm); - INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, - octave_sparse_bool_matrix, assign); + INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix, + octave_sparse_bool_matrix, assign); - INSTALL_CONVOP (octave_sparse_bool_matrix, octave_sparse_matrix, + INSTALL_CONVOP (octave_sparse_bool_matrix, octave_sparse_matrix, bool_matrix_to_double_matrix); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-scm-cm.cc --- a/src/OPERATORS/op-scm-cm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-scm-cm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -48,11 +48,11 @@ DEFBINOP (div, sparse_complex_matrix, complex_matrix) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_matrix&); MatrixType typ = v2.matrix_type (); - - ComplexMatrix ret = xdiv (v1.complex_matrix_value (), + + ComplexMatrix ret = xdiv (v1.complex_matrix_value (), v2.complex_matrix_value (), typ); v2.matrix_type (typ); @@ -82,7 +82,7 @@ { MatrixType typ = v1.matrix_type (); - ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), + ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), v2.complex_matrix_value (), typ); v1.matrix_type (typ); @@ -105,20 +105,20 @@ DEFBINOP (el_pow, sparse_complex_matrix, complex_matrix) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_matrix&); - - return octave_value - (elem_xpow (v1.sparse_complex_matrix_value (), SparseComplexMatrix + + return octave_value + (elem_xpow (v1.sparse_complex_matrix_value (), SparseComplexMatrix (v2.complex_matrix_value ()))); } DEFBINOP (el_ldiv, sparse_complex_matrix, matrix) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_matrix&); - return octave_value (quotient (v2.complex_matrix_value (), + return octave_value (quotient (v2.complex_matrix_value (), v1.sparse_complex_matrix_value ())); } @@ -127,7 +127,7 @@ DEFCATOP (scm_cm, sparse_complex_matrix, complex_matrix) { - CAST_BINOP_ARGS (octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (octave_sparse_complex_matrix&, const octave_complex_matrix&); SparseComplexMatrix tmp (v2.complex_matrix_value ()); return octave_value @@ -147,48 +147,48 @@ void install_scm_cm_ops (void) { - INSTALL_BINOP (op_add, octave_sparse_complex_matrix, + INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_complex_matrix, add); - INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, + INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_complex_matrix, sub); - INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, + INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_complex_matrix, mul); - INSTALL_BINOP (op_div, octave_sparse_complex_matrix, + INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_complex_matrix, div); - INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, + INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_complex_matrix, pow); - INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, + INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_complex_matrix, ldiv); - INSTALL_BINOP (op_trans_mul, octave_sparse_complex_matrix, + INSTALL_BINOP (op_trans_mul, octave_sparse_complex_matrix, octave_complex_matrix, trans_mul); - INSTALL_BINOP (op_herm_mul, octave_sparse_complex_matrix, + INSTALL_BINOP (op_herm_mul, octave_sparse_complex_matrix, octave_complex_matrix, herm_mul); - INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, + INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_complex_matrix, lt); - INSTALL_BINOP (op_le, octave_sparse_complex_matrix, + INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_complex_matrix, le); - INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, + INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_complex_matrix, eq); - INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, + INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_complex_matrix, ge); - INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, + INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_complex_matrix, gt); - INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, + INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_complex_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_complex_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_complex_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_complex_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_complex_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_complex_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_complex_matrix, el_or); - INSTALL_CATOP (octave_sparse_complex_matrix, + INSTALL_CATOP (octave_sparse_complex_matrix, octave_complex_matrix, scm_cm); INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-scm-cs.cc --- a/src/OPERATORS/op-scm-cs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-scm-cs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -46,7 +46,7 @@ DEFBINOP (div, sparse_complex_matrix, complex) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex&); Complex d = v2.complex_value (); @@ -62,7 +62,7 @@ DEFBINOP (pow, sparse_complex_matrix, complex) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex&); return xpow (v1.complex_matrix_value (), v2.complex_value ()); } @@ -102,7 +102,7 @@ DEFBINOP (el_div, sparse_complex_matrix, complex) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex&); octave_value retval; @@ -121,7 +121,7 @@ DEFBINOP (el_ldiv, sparse_complex_matrix, complex) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex&); return octave_value @@ -156,7 +156,7 @@ INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_complex, mul); INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_complex, div); INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_complex, pow); - INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_complex, + INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_complex, ldiv); INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_complex, lt); INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_complex, le); @@ -164,17 +164,17 @@ INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_complex, ge); INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_complex, gt); INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_complex, ne); - INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_complex, + INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_complex, el_mul); - INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_complex, + INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_complex, el_div); - INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_complex, + INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_complex, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_complex, + INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_complex, el_ldiv); - INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_complex, + INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_complex, el_and); - INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_complex, + INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_complex, el_or); INSTALL_CATOP (octave_sparse_complex_matrix, octave_complex, scm_cs); diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-scm-m.cc --- a/src/OPERATORS/op-scm-m.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-scm-m.cc Thu Jan 20 17:24:59 2011 -0500 @@ -49,11 +49,11 @@ DEFBINOP (div, sparse_complex_matrix, matrix) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_matrix&); MatrixType typ = v2.matrix_type (); - - ComplexMatrix ret = xdiv (v1.complex_matrix_value (), + + ComplexMatrix ret = xdiv (v1.complex_matrix_value (), v2.matrix_value (), typ); v2.matrix_type (typ); @@ -69,7 +69,7 @@ DEFBINOP (ldiv, sparse_complex_matrix, matrix) { CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_matrix&); - + if (v1.rows() == 1 && v1.columns() == 1) { Complex d = v1.complex_value (); @@ -83,7 +83,7 @@ { MatrixType typ = v1.matrix_type (); - ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), + ComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), v2.matrix_value (), typ); v1.matrix_type (typ); @@ -103,17 +103,17 @@ DEFBINOP (el_pow, sparse_complex_matrix, matrix) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_matrix&); - - return octave_value - (elem_xpow (v1.sparse_complex_matrix_value (), SparseMatrix + + return octave_value + (elem_xpow (v1.sparse_complex_matrix_value (), SparseMatrix (v2.matrix_value ()))); } DEFBINOP (el_ldiv, sparse_complex_matrix, matrix) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_matrix&); return octave_value @@ -155,21 +155,21 @@ INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_matrix, ge); INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_matrix, gt); INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_matrix, + INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_matrix, + INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_matrix, + INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_matrix, + INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_matrix, + INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_matrix, + INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_matrix, el_or); INSTALL_CATOP (octave_sparse_complex_matrix, octave_matrix, scm_m); - INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_matrix, assign); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-scm-s.cc --- a/src/OPERATORS/op-scm-s.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-scm-s.cc Thu Jan 20 17:24:59 2011 -0500 @@ -49,7 +49,7 @@ DEFBINOP (div, sparse_complex_matrix, scalar) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_scalar&); double d = v2.double_value (); @@ -65,7 +65,7 @@ DEFBINOP (pow, sparse_complex_matrix, scalar) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_scalar&); double tmp = v2.scalar_value (); @@ -110,7 +110,7 @@ DEFBINOP (el_div, sparse_complex_matrix, scalar) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_scalar&); double d = v2.double_value (); @@ -169,21 +169,21 @@ INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_scalar, ge); INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_scalar, gt); INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_scalar, ne); - INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_scalar, + INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_scalar, el_mul); - INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_scalar, + INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_scalar, el_div); - INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_scalar, + INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_scalar, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_scalar, + INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_scalar, el_ldiv); - INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_scalar, + INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_scalar, el_and); - INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_scalar, + INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_scalar, el_or); INSTALL_CATOP (octave_sparse_complex_matrix, octave_scalar, scm_s); - INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_scalar, + INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_scalar, assign); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-scm-scm.cc --- a/src/OPERATORS/op-scm-scm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-scm-scm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -59,7 +59,7 @@ DEFUNOP (transpose, sparse_complex_matrix) { CAST_UNOP_ARG (const octave_sparse_complex_matrix&); - return octave_value + return octave_value (v.sparse_complex_matrix_value().transpose (), v.matrix_type ().transpose ()); } @@ -67,7 +67,7 @@ DEFUNOP (hermitian, sparse_complex_matrix) { CAST_UNOP_ARG (const octave_sparse_complex_matrix&); - return octave_value + return octave_value (v.sparse_complex_matrix_value().hermitian (), v.matrix_type ().transpose ()); } @@ -97,9 +97,9 @@ DEFBINOP (div, sparse_complex_matrix, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_complex_matrix&); - + if (v2.rows() == 1 && v2.columns() == 1) { Complex d = v2.complex_value (); @@ -112,9 +112,9 @@ else { MatrixType typ = v2.matrix_type (); - SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (), + SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (), v2.sparse_complex_matrix_value (), typ); - + v2.matrix_type (typ); return ret; } @@ -128,7 +128,7 @@ DEFBINOP (ldiv, sparse_complex_matrix, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_complex_matrix&); if (v1.rows() == 1 && v1.columns() == 1) @@ -144,8 +144,8 @@ { MatrixType typ = v1.matrix_type (); - SparseComplexMatrix ret = - xleftdiv (v1.sparse_complex_matrix_value (), + SparseComplexMatrix ret = + xleftdiv (v1.sparse_complex_matrix_value (), v2.sparse_complex_matrix_value (), typ); v1.matrix_type (typ); @@ -166,10 +166,10 @@ DEFBINOP (el_ldiv, sparse_complex_matrix, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_complex_matrix&); - return octave_value (quotient (v2.sparse_complex_matrix_value (), + return octave_value (quotient (v2.sparse_complex_matrix_value (), v1.sparse_complex_matrix_value ())); } @@ -196,53 +196,53 @@ INSTALL_NCUNOP (op_decr, octave_sparse_complex_matrix, decr); #endif - INSTALL_BINOP (op_add, octave_sparse_complex_matrix, + INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_sparse_complex_matrix, add); - INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, + INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_sparse_complex_matrix, sub); - INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, + INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_sparse_complex_matrix, mul); - INSTALL_BINOP (op_div, octave_sparse_complex_matrix, + INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_sparse_complex_matrix, div); - INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, + INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_sparse_complex_matrix, pow); - INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, + INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_sparse_complex_matrix, ldiv); - INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, + INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_sparse_complex_matrix, lt); - INSTALL_BINOP (op_le, octave_sparse_complex_matrix, + INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_sparse_complex_matrix, le); - INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, + INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_sparse_complex_matrix, eq); - INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, + INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_sparse_complex_matrix, ge); - INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, + INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_sparse_complex_matrix, gt); - INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, + INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_sparse_complex_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_sparse_complex_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_sparse_complex_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_sparse_complex_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_sparse_complex_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_sparse_complex_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_sparse_complex_matrix, el_or); - INSTALL_CATOP (octave_sparse_complex_matrix, + INSTALL_CATOP (octave_sparse_complex_matrix, octave_sparse_complex_matrix, scm_scm); - INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_sparse_complex_matrix, assign); - INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_null_matrix, null_assign); - INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_null_str, null_assign); - INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_null_sq_str, null_assign); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-scm-sm.cc --- a/src/OPERATORS/op-scm-sm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-scm-sm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -61,9 +61,9 @@ else { MatrixType typ = v2.matrix_type (); - SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (), + SparseComplexMatrix ret = xdiv (v1.sparse_complex_matrix_value (), v2.sparse_matrix_value (), typ); - + v2.matrix_type (typ); return ret; } @@ -92,7 +92,7 @@ { MatrixType typ = v1.matrix_type (); - SparseComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), + SparseComplexMatrix ret = xleftdiv (v1.sparse_complex_matrix_value (), v2.sparse_matrix_value (), typ); v1.matrix_type (typ); @@ -113,7 +113,7 @@ DEFBINOP (el_ldiv, sparse_complex_matrix, sparse_matrix) { - CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, + CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_sparse_matrix&); return octave_value @@ -142,33 +142,33 @@ pow); INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_sparse_matrix, ldiv); - INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_sparse_matrix, lt); - INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_sparse_matrix, le); - INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_sparse_matrix, eq); - INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_sparse_matrix, ge); - INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_sparse_matrix, gt); - INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_sparse_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix, octave_sparse_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix, octave_sparse_matrix, el_div); INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix, octave_sparse_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix, octave_sparse_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix, octave_sparse_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, + INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix, octave_sparse_matrix, el_or); INSTALL_CATOP (octave_sparse_complex_matrix, octave_sparse_matrix, scm_sm); - INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix, octave_sparse_matrix, assign); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-sm-cm.cc --- a/src/OPERATORS/op-sm-cm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-sm-cm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -48,11 +48,11 @@ DEFBINOP (div, sparse_matrix, complex_matrix) { - CAST_BINOP_ARGS (const octave_sparse_matrix&, + CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_matrix&); MatrixType typ = v2.matrix_type (); - - ComplexMatrix ret = xdiv (v1.matrix_value (), + + ComplexMatrix ret = xdiv (v1.matrix_value (), v2.complex_matrix_value (), typ); v2.matrix_type (typ); @@ -82,7 +82,7 @@ { MatrixType typ = v1.matrix_type (); - ComplexMatrix ret = xleftdiv (v1.sparse_matrix_value (), + ComplexMatrix ret = xleftdiv (v1.sparse_matrix_value (), v2.complex_matrix_value (), typ); v1.matrix_type (typ); @@ -102,20 +102,20 @@ DEFBINOP (el_pow, sparse_matrix, complex_matrix) { - CAST_BINOP_ARGS (const octave_sparse_matrix&, + CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_matrix&); - - return octave_value - (elem_xpow (v1.sparse_matrix_value (), SparseComplexMatrix + + return octave_value + (elem_xpow (v1.sparse_matrix_value (), SparseComplexMatrix (v2.complex_matrix_value ()))); } DEFBINOP (el_ldiv, sparse_matrix, complex_matrix) { - CAST_BINOP_ARGS (const octave_sparse_matrix&, + CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_matrix&); - return octave_value + return octave_value (quotient (v2.complex_matrix_value (), v1.sparse_matrix_value ())); } @@ -150,24 +150,24 @@ INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_complex_matrix, ge); INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_complex_matrix, gt); INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_complex_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_complex_matrix, + INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_complex_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_complex_matrix, + INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_complex_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_complex_matrix, + INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_complex_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_complex_matrix, + INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_complex_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_complex_matrix, + INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_complex_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_complex_matrix, + INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_complex_matrix, el_or); INSTALL_CATOP (octave_sparse_matrix, octave_complex_matrix, sm_cm); - INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_complex_matrix, + INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_complex_matrix, octave_sparse_complex_matrix); - INSTALL_WIDENOP (octave_sparse_matrix, octave_complex_matrix, + INSTALL_WIDENOP (octave_sparse_matrix, octave_complex_matrix, sparse_complex_matrix_conv); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-sm-cs.cc --- a/src/OPERATORS/op-sm-cs.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-sm-cs.cc Thu Jan 20 17:24:59 2011 -0500 @@ -121,7 +121,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex&); - return octave_value (x_el_div (v2.complex_value (), + return octave_value (x_el_div (v2.complex_value (), v1.sparse_matrix_value ())); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-sm-m.cc --- a/src/OPERATORS/op-sm-m.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-sm-m.cc Thu Jan 20 17:24:59 2011 -0500 @@ -50,7 +50,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&); MatrixType typ = v2.matrix_type (); - + Matrix ret = xdiv (v1.matrix_value (), v2.matrix_value (), typ); v2.matrix_type (typ); @@ -80,7 +80,7 @@ { MatrixType typ = v1.matrix_type (); - Matrix ret = xleftdiv (v1.sparse_matrix_value (), + Matrix ret = xleftdiv (v1.sparse_matrix_value (), v2.matrix_value (), typ); v1.matrix_type (typ); @@ -103,15 +103,15 @@ DEFBINOP (el_pow, sparse_matrix, matrix) { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&); - - return octave_value (elem_xpow (v1.sparse_matrix_value (), + + return octave_value (elem_xpow (v1.sparse_matrix_value (), SparseMatrix (v2.matrix_value ()))); } DEFBINOP (el_ldiv, sparse_matrix, matrix) { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_matrix&); - + return octave_value (quotient (v2.matrix_value (), v1.sparse_matrix_value ())); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-sm-s.cc --- a/src/OPERATORS/op-sm-s.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-sm-s.cc Thu Jan 20 17:24:59 2011 -0500 @@ -123,7 +123,7 @@ { CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_scalar&); - return octave_value + return octave_value (x_el_div (v2.complex_value (), v1.sparse_matrix_value ())); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-sm-scm.cc --- a/src/OPERATORS/op-sm-scm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-sm-scm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -61,9 +61,9 @@ else { MatrixType typ = v2.matrix_type (); - SparseComplexMatrix ret = xdiv (v1.sparse_matrix_value (), + SparseComplexMatrix ret = xdiv (v1.sparse_matrix_value (), v2.sparse_complex_matrix_value (), typ); - + v2.matrix_type (typ); return ret; } @@ -92,8 +92,8 @@ { MatrixType typ = v1.matrix_type (); - SparseComplexMatrix ret = - xleftdiv (v1.sparse_matrix_value (), + SparseComplexMatrix ret = + xleftdiv (v1.sparse_matrix_value (), v2.sparse_complex_matrix_value (), typ); v1.matrix_type (typ); @@ -114,7 +114,7 @@ DEFBINOP (el_ldiv, sparse_matrix, sparse_complex_matrix) { - CAST_BINOP_ARGS (const octave_sparse_matrix&, + CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_sparse_complex_matrix&); return octave_value @@ -147,36 +147,36 @@ pow); INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_sparse_complex_matrix, ldiv); - INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_sparse_complex_matrix, lt); - INSTALL_BINOP (op_le, octave_sparse_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_le, octave_sparse_matrix, octave_sparse_complex_matrix, le); - INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_sparse_complex_matrix, eq); - INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_sparse_complex_matrix, ge); - INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_sparse_complex_matrix, gt); - INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_sparse_complex_matrix, + INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_sparse_complex_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_sparse_matrix, + INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_sparse_complex_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_sparse_matrix, + INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_sparse_complex_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_sparse_matrix, + INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_sparse_complex_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, + INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_sparse_complex_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_sparse_matrix, + INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_sparse_complex_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_sparse_matrix, + INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_sparse_complex_matrix, el_or); INSTALL_CATOP (octave_sparse_matrix, octave_sparse_complex_matrix, sm_scm); - INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_sparse_complex_matrix, + INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_sparse_complex_matrix, octave_sparse_complex_matrix); - INSTALL_WIDENOP (octave_sparse_matrix, octave_sparse_complex_matrix, + INSTALL_WIDENOP (octave_sparse_matrix, octave_sparse_complex_matrix, sparse_complex_matrix_conv); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-sm-sm.cc --- a/src/OPERATORS/op-sm-sm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-sm-sm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -84,9 +84,9 @@ else { MatrixType typ = v2.matrix_type (); - SparseMatrix ret = xdiv (v1.sparse_matrix_value (), + SparseMatrix ret = xdiv (v1.sparse_matrix_value (), v2.sparse_matrix_value (), typ); - + v2.matrix_type (typ); return ret; } @@ -115,7 +115,7 @@ { MatrixType typ = v1.matrix_type (); - SparseMatrix ret = xleftdiv (v1.sparse_matrix_value (), + SparseMatrix ret = xleftdiv (v1.sparse_matrix_value (), v2.sparse_matrix_value (), typ); v1.matrix_type (typ); @@ -172,22 +172,22 @@ INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_sparse_matrix, ge); INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_sparse_matrix, gt); INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_sparse_matrix, ne); - INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_mul, octave_sparse_matrix, octave_sparse_matrix, el_mul); - INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_div, octave_sparse_matrix, octave_sparse_matrix, el_div); - INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_pow, octave_sparse_matrix, octave_sparse_matrix, el_pow); - INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, octave_sparse_matrix, el_ldiv); - INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_and, octave_sparse_matrix, octave_sparse_matrix, el_and); - INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_sparse_matrix, + INSTALL_BINOP (op_el_or, octave_sparse_matrix, octave_sparse_matrix, el_or); INSTALL_CATOP (octave_sparse_matrix, octave_sparse_matrix, sm_sm); - INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_sparse_matrix, + INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_sparse_matrix, assign); INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_matrix, octave_null_matrix, null_assign); diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-str-str.cc --- a/src/OPERATORS/op-str-str.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-str-str.cc Thu Jan 20 17:24:59 2011 -0500 @@ -109,27 +109,27 @@ INSTALL_BINOP (op_lt, octave_char_matrix_str, octave_char_matrix_sq_str, lt); INSTALL_BINOP (op_lt, octave_char_matrix_sq_str, octave_char_matrix_str, lt); INSTALL_BINOP (op_lt, octave_char_matrix_sq_str, octave_char_matrix_sq_str, lt); - + INSTALL_BINOP (op_le, octave_char_matrix_str, octave_char_matrix_str, le); INSTALL_BINOP (op_le, octave_char_matrix_str, octave_char_matrix_sq_str, le); INSTALL_BINOP (op_le, octave_char_matrix_sq_str, octave_char_matrix_str, le); INSTALL_BINOP (op_le, octave_char_matrix_sq_str, octave_char_matrix_sq_str, le); - + INSTALL_BINOP (op_eq, octave_char_matrix_str, octave_char_matrix_str, eq); INSTALL_BINOP (op_eq, octave_char_matrix_str, octave_char_matrix_sq_str, eq); INSTALL_BINOP (op_eq, octave_char_matrix_sq_str, octave_char_matrix_str, eq); INSTALL_BINOP (op_eq, octave_char_matrix_sq_str, octave_char_matrix_sq_str, eq); - + INSTALL_BINOP (op_ge, octave_char_matrix_str, octave_char_matrix_str, ge); INSTALL_BINOP (op_ge, octave_char_matrix_str, octave_char_matrix_sq_str, ge); INSTALL_BINOP (op_ge, octave_char_matrix_sq_str, octave_char_matrix_str, ge); INSTALL_BINOP (op_ge, octave_char_matrix_sq_str, octave_char_matrix_sq_str, ge); - + INSTALL_BINOP (op_gt, octave_char_matrix_str, octave_char_matrix_str, gt); INSTALL_BINOP (op_gt, octave_char_matrix_str, octave_char_matrix_sq_str, gt); INSTALL_BINOP (op_gt, octave_char_matrix_sq_str, octave_char_matrix_str, gt); INSTALL_BINOP (op_gt, octave_char_matrix_sq_str, octave_char_matrix_sq_str, gt); - + INSTALL_BINOP (op_ne, octave_char_matrix_str, octave_char_matrix_str, ne); INSTALL_BINOP (op_ne, octave_char_matrix_str, octave_char_matrix_sq_str, ne); INSTALL_BINOP (op_ne, octave_char_matrix_sq_str, octave_char_matrix_str, ne); diff -r 1473d0cf86d2 -r 12df7854fa7c src/OPERATORS/op-ui64-ui64.cc --- a/src/OPERATORS/op-ui64-ui64.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/OPERATORS/op-ui64-ui64.cc Thu Jan 20 17:24:59 2011 -0500 @@ -114,7 +114,7 @@ install_ui64_ui64_ops (void) { OCTAVE_INSTALL_INT_OPS (uint64); - + OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi8, uint64_, int8_); OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mui8, uint64_, uint8_); OCTAVE_INSTALL_MS_INT_ASSIGN_OPS (mi16, uint64_, int16_); diff -r 1473d0cf86d2 -r 12df7854fa7c src/bitfcns.cc --- a/src/bitfcns.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/bitfcns.cc Thu Jan 20 17:24:59 2011 -0500 @@ -444,7 +444,7 @@ if (nargin == 2 || nargin == 3) { int nbits = 64; - + NDArray n = args(1).array_value (); if (error_state) @@ -460,7 +460,7 @@ else { nbits = args(2).int_value (); - + if (error_state) error ("bitshift: expecting integer as third argument"); else if (nbits < 0) diff -r 1473d0cf86d2 -r 12df7854fa7c src/c-file-ptr-stream.cc --- a/src/c-file-ptr-stream.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/c-file-ptr-stream.cc Thu Jan 20 17:24:59 2011 -0500 @@ -92,7 +92,7 @@ c_file_ptr_buf::pbackfail (int_type c) { #if defined (CXX_ISO_COMPLIANT_LIBRARY) - return (c != traits_type::eof () && f) ? ungetc (c, f) : + return (c != traits_type::eof () && f) ? ungetc (c, f) : traits_type::not_eof (c); #else return (c != EOF && f) ? ungetc (c, f) : EOF; @@ -149,7 +149,7 @@ c_file_ptr_buf::seekpos (std::streampos /* offset */, std::ios::openmode) { // FIXME -#if 0 +#if 0 if (f) { fseek (f, offset, SEEK_SET); @@ -252,7 +252,7 @@ c_zfile_ptr_buf::pbackfail (int_type c) { #if defined (CXX_ISO_COMPLIANT_LIBRARY) - return (c != traits_type::eof () && f) ? gzungetc (c, f) : + return (c != traits_type::eof () && f) ? gzungetc (c, f) : traits_type::not_eof (c); #else return (c != EOF && f) ? gzungetc (c, f) : EOF; @@ -300,7 +300,7 @@ c_zfile_ptr_buf::seekpos (std::streampos /* offset */, std::ios::openmode) { // FIXME -#if 0 +#if 0 if (f) { gzseek (f, offset, SEEK_SET); diff -r 1473d0cf86d2 -r 12df7854fa7c src/c-file-ptr-stream.h --- a/src/c-file-ptr-stream.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/c-file-ptr-stream.h Thu Jan 20 17:24:59 2011 -0500 @@ -62,7 +62,7 @@ std::streampos seekoff (std::streamoff, std::ios::seekdir, std::ios::openmode = std::ios::in | std::ios::out); - + std::streampos seekpos (std::streampos, std::ios::openmode = std::ios::in | std::ios::out); @@ -169,7 +169,7 @@ std::streampos seekoff (std::streamoff, std::ios::seekdir, std::ios::openmode = std::ios::in | std::ios::out); - + std::streampos seekpos (std::streampos, std::ios::openmode = std::ios::in | std::ios::out); diff -r 1473d0cf86d2 -r 12df7854fa7c src/comment-list.h --- a/src/comment-list.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/comment-list.h Thu Jan 20 17:24:59 2011 -0500 @@ -104,7 +104,7 @@ octave_comment_buffer (void) : comment_list (new octave_comment_list ()) { } - + static bool instance_ok (void); static void append diff -r 1473d0cf86d2 -r 12df7854fa7c src/data.cc --- a/src/data.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/data.cc Thu Jan 20 17:24:59 2011 -0500 @@ -231,7 +231,7 @@ bool a1_scalar = args(1).is_scalar_type (); if (a0_scalar && a1_scalar) retval = atan2 (args(0).scalar_value (), args(1).scalar_value ()); - else if ((a0_scalar || args(0).is_sparse_type ()) + else if ((a0_scalar || args(0).is_sparse_type ()) && (a1_scalar || args(1).is_sparse_type ())) { SparseMatrix m0 = args(0).sparse_matrix_value (); @@ -315,7 +315,7 @@ bool a1_scalar = arg1.is_scalar_type (); if (a0_scalar && a1_scalar) retval = hypot (arg0.scalar_value (), arg1.scalar_value ()); - else if ((a0_scalar || arg0.is_sparse_type ()) + else if ((a0_scalar || arg0.is_sparse_type ()) && (a1_scalar || arg1.is_sparse_type ())) { SparseMatrix m0 = arg0.sparse_matrix_value (); @@ -384,7 +384,7 @@ */ template -void +void map_2_xlog2 (const Array& x, Array& f, Array& e) { f = Array(x.dims ()); @@ -560,7 +560,7 @@ } } else - error ("rem: cannot combine %s and %d", + error ("rem: cannot combine %s and %d", args(0).class_name ().c_str (), args(1).class_name ().c_str ()); } else if (args(0).is_single_type () || args(1).is_single_type ()) @@ -580,7 +580,7 @@ bool a1_scalar = args(1).is_scalar_type (); if (a0_scalar && a1_scalar) retval = xrem (args(0).scalar_value (), args(1).scalar_value ()); - else if ((a0_scalar || args(0).is_sparse_type ()) + else if ((a0_scalar || args(0).is_sparse_type ()) && (a1_scalar || args(1).is_sparse_type ())) { SparseMatrix m0 = args(0).sparse_matrix_value (); @@ -693,7 +693,7 @@ } } else - error ("mod: cannot combine %s and %d", + error ("mod: cannot combine %s and %d", args(0).class_name ().c_str (), args(1).class_name ().c_str ()); } else if (args(0).is_single_type () || args(1).is_single_type ()) @@ -713,7 +713,7 @@ bool a1_scalar = args(1).is_scalar_type (); if (a0_scalar && a1_scalar) retval = xmod (args(0).scalar_value (), args(1).scalar_value ()); - else if ((a0_scalar || args(0).is_sparse_type ()) + else if ((a0_scalar || args(0).is_sparse_type ()) && (a1_scalar || args(1).is_sparse_type ())) { SparseMatrix m0 = args(0).sparse_matrix_value (); @@ -755,7 +755,7 @@ %!assert (mod([-5, 5; 0, 3], [0, 0 ; 0, 0]), [-5, 5; 0, 3]); ## mixed scalar/matrix tests -%!assert (mod([-5, 5; 0, 3], 0), [-5, 5; 0, 3]); +%!assert (mod([-5, 5; 0, 3], 0), [-5, 5; 0, 3]); %!assert (mod([-5, 5; 0, 3], 3), [1, 2; 0, 0]); %!assert (mod(-5,[0,0; 0,0]), [-5, -5; -5, -5]); %!assert (mod(-5,[3,0; 3,1]), [1, -5; 1, 0]); @@ -1256,7 +1256,7 @@ octave_idx_type k = args(1).int_value (); if (error_state) - error ("diag: invalid second argument"); + error ("diag: invalid second argument"); else retval = args(0).diag(k); } @@ -1386,7 +1386,7 @@ } template -static void +static void single_type_concat (Array& result, const octave_value_list& args, int dim) @@ -1430,7 +1430,7 @@ } template -static void +static void single_type_concat (Sparse& result, const octave_value_list& args, int dim) @@ -1451,7 +1451,7 @@ // Dispatcher. template -static TYPE +static TYPE do_single_type_concat (const octave_value_list& args, int dim) { TYPE result; @@ -1462,7 +1462,7 @@ } template -static void +static void single_type_concat_map (octave_map& result, const octave_value_list& args, int dim) @@ -1499,7 +1499,7 @@ { octave_value retval; - int n_args = args.length (); + int n_args = args.length (); if (n_args == 0) retval = Matrix (); @@ -1517,7 +1517,7 @@ for (int i = 1; i < args.length (); i++) { - result_type = + result_type = get_concat_class (result_type, args(i).class_name ()); if (all_sq_strings_p && ! args(i).is_sq_string ()) @@ -1533,7 +1533,7 @@ if (result_type == "double") { if (any_sparse_p) - { + { if (all_real_p) retval = do_single_type_concat (args, dim); else @@ -1608,7 +1608,7 @@ { if (! (dv.*concat_rule) (args(i).dims (), dim)) { - // Dimensions do not match. + // Dimensions do not match. error ("cat: dimension mismatch"); return retval; } @@ -1618,12 +1618,12 @@ // of the first argument, resize it to be empty and then resize // it to be full. This is done since it means that there is no // recopying of data, as would happen if we used a single resize. - // It should be noted that resize operation is also significantly + // It should be noted that resize operation is also significantly // slower than the do_cat_op function, so it makes sense to have // an empty matrix and copy all data. // // We might also start with a empty octave_value using - // tmp = octave_value_typeinfo::lookup_type + // tmp = octave_value_typeinfo::lookup_type // (args(1).type_name()); // and then directly resize. However, for some types there might // be some additional setup needed, and so this should be avoided. @@ -1656,7 +1656,7 @@ break; } else - ra_idx (dim) += (dim < dv_tmp.length () ? + ra_idx (dim) += (dim < dv_tmp.length () ? dv_tmp (dim) : 1); } retval = tmp; @@ -1774,7 +1774,7 @@ %! assert (cat (2, cast (1, t1), cast ([2, 3], t2)), cast ([1, 2, 3], tr)); %! assert (cat (2, cast ([1, 2], t1), cast (3, t2)), cast ([1, 2, 3], tr)); %! assert (cat (2, cast ([1, 2], t1), cast ([3, 4], t2)), cast ([1, 2, 3, 4], tr)); -%! +%! %! assert ([cast(1, t1); cast(2, t2)], cast ([1; 2], tr)); %! assert ([cast(1, t1); cast([2; 3], t2)], cast ([1; 2; 3], tr)); %! assert ([cast([1; 2], t1); cast(3, t2)], cast ([1; 2; 3], tr)); @@ -1793,7 +1793,7 @@ %! assert (cat (2, cast (1i, t1), cast ([2, 3], t2)), cast ([1i, 2, 3], tr)); %! assert (cat (2, cast ([1i, 2], t1), cast (3, t2)), cast ([1i, 2, 3], tr)); %! assert (cat (2, cast ([1i, 2], t1), cast ([3, 4], t2)), cast ([1i, 2, 3, 4], tr)); -%! +%! %! assert ([cast(1i, t1); cast(2, t2)], cast ([1i; 2], tr)); %! assert ([cast(1i, t1); cast([2; 3], t2)], cast ([1i; 2; 3], tr)); %! assert ([cast([1i; 2], t1); cast(3, t2)], cast ([1i; 2; 3], tr)); @@ -1811,7 +1811,7 @@ %! assert (cat (2, cast (1, t1), cast ([2i, 3], t2)), cast ([1, 2i, 3], tr)); %! assert (cat (2, cast ([1, 2], t1), cast (3i, t2)), cast ([1, 2, 3i], tr)); %! assert (cat (2, cast ([1, 2], t1), cast ([3i, 4], t2)), cast ([1, 2, 3i, 4], tr)); -%! +%! %! assert ([cast(1, t1); cast(2i, t2)], cast ([1; 2i], tr)); %! assert ([cast(1, t1); cast([2i; 3], t2)], cast ([1; 2i; 3], tr)); %! assert ([cast([1; 2], t1); cast(3i, t2)], cast ([1; 2; 3i], tr)); @@ -1829,7 +1829,7 @@ %! assert (cat (2, cast (1i, t1), cast ([2i, 3], t2)), cast ([1i, 2i, 3], tr)); %! assert (cat (2, cast ([1i, 2], t1), cast (3i, t2)), cast ([1i, 2, 3i], tr)); %! assert (cat (2, cast ([1i, 2], t1), cast ([3i, 4], t2)), cast ([1i, 2, 3i, 4], tr)); -%! +%! %! assert ([cast(1i, t1); cast(2i, t2)], cast ([1i; 2i], tr)); %! assert ([cast(1i, t1); cast([2i; 3], t2)], cast ([1i; 2i; 3], tr)); %! assert ([cast([1i; 2], t1); cast(3i, t2)], cast ([1i; 2; 3i], tr)); @@ -2113,7 +2113,7 @@ { if (nd <= dv.length ()) retval(0) = dv(nd-1); - else + else retval(0) = 1; } else @@ -2688,10 +2688,10 @@ for (octave_idx_type j = 0; j < nc; j++) { octave_idx_type off = j * nr; - for (octave_idx_type i = im_val.cidx(j); + for (octave_idx_type i = im_val.cidx(j); i < im_val.cidx(j + 1); i++) - result.data (im_val.ridx(i) + off) = - result.data (im_val.ridx(i) + off) + + result.data (im_val.ridx(i) + off) = + result.data (im_val.ridx(i) + off) + Complex (0, im_val.data (i)); } } @@ -2711,10 +2711,10 @@ for (octave_idx_type j = 0; j < nc; j++) { octave_idx_type off = j * nr; - for (octave_idx_type i = re_val.cidx(j); + for (octave_idx_type i = re_val.cidx(j); i < re_val.cidx(j + 1); i++) - result.data (re_val.ridx(i) + off) = - result.data (re_val.ridx(i) + off) + + result.data (re_val.ridx(i) + off) = + result.data (re_val.ridx(i) + off) + re_val.data (i); } } @@ -2724,7 +2724,7 @@ { if (re_val.dims () == im_val.dims ()) { - SparseComplexMatrix result = SparseComplexMatrix(re_val) + SparseComplexMatrix result = SparseComplexMatrix(re_val) + Complex(0, 1) * SparseComplexMatrix (im_val); retval = octave_value (new octave_sparse_complex_matrix (result)); } @@ -3008,7 +3008,7 @@ oct_data_conv::data_type dt = oct_data_conv::dt_double; dim_vector dims (1, 1); - + if (nargin > 0 && args(nargin-1).is_string ()) { std::string nm = args(nargin-1).string_value (); @@ -3124,7 +3124,7 @@ } static octave_value -fill_matrix (const octave_value_list& args, double val, float fval, +fill_matrix (const octave_value_list& args, double val, float fval, const char *fcn) { octave_value retval; @@ -3134,7 +3134,7 @@ oct_data_conv::data_type dt = oct_data_conv::dt_double; dim_vector dims (1, 1); - + if (nargin > 0 && args(nargin-1).is_string ()) { std::string nm = args(nargin-1).string_value (); @@ -3214,7 +3214,7 @@ oct_data_conv::data_type dt = oct_data_conv::dt_double; dim_vector dims (1, 1); - + if (nargin > 0 && args(nargin-1).is_string ()) { std::string nm = args(nargin-1).string_value (); @@ -3295,7 +3295,7 @@ oct_data_conv::data_type dt = oct_data_conv::dt_double; dim_vector dims (1, 1); - + if (nargin > 0 && args(nargin-1).is_string ()) { std::string nm = args(nargin-1).string_value (); @@ -3373,7 +3373,7 @@ int nargin = args.length (); dim_vector dims (1, 1); - + switch (nargin) { case 0: @@ -3542,7 +3542,7 @@ @seealso{isinf}\n\ @end deftypefn") { - return fill_matrix (args, lo_ieee_inf_value (), + return fill_matrix (args, lo_ieee_inf_value (), lo_ieee_float_inf_value (), "Inf"); } @@ -3600,13 +3600,13 @@ @seealso{isnan}\n\ @end deftypefn") { - return fill_matrix (args, lo_ieee_nan_value (), + return fill_matrix (args, lo_ieee_nan_value (), lo_ieee_float_nan_value (), "NaN"); } DEFALIAS (nan, NaN); -/* +/* %!assert(NaN (3), [NaN, NaN, NaN; NaN, NaN, NaN; NaN, NaN, NaN]); %!assert(NaN (2, 3), [NaN, NaN, NaN; NaN, NaN, NaN]); %!assert(NaN (3, 2), [NaN, NaN; NaN, NaN; NaN, NaN]); @@ -3702,19 +3702,19 @@ { val = ::fabsf(val); if (xisnan (val) || xisinf (val)) - retval = fill_matrix (octave_value ("single"), - lo_ieee_nan_value (), + retval = fill_matrix (octave_value ("single"), + lo_ieee_nan_value (), lo_ieee_float_nan_value (), "eps"); else if (val < FLT_MIN) - retval = fill_matrix (octave_value ("single"), 0e0, + retval = fill_matrix (octave_value ("single"), 0e0, powf (2.0, -149e0), "eps"); else { int expon; frexpf (val, &expon); - val = std::pow (static_cast (2.0), + val = std::pow (static_cast (2.0), static_cast (expon - 24)); - retval = fill_matrix (octave_value ("single"), DBL_EPSILON, + retval = fill_matrix (octave_value ("single"), DBL_EPSILON, val, "eps"); } } @@ -3727,8 +3727,8 @@ { val = ::fabs(val); if (xisnan (val) || xisinf (val)) - retval = fill_matrix (octave_value_list (), - lo_ieee_nan_value (), + retval = fill_matrix (octave_value_list (), + lo_ieee_nan_value (), lo_ieee_float_nan_value (), "eps"); else if (val < DBL_MIN) retval = fill_matrix (octave_value_list (), @@ -3737,9 +3737,9 @@ { int expon; frexp (val, &expon); - val = std::pow (static_cast (2.0), + val = std::pow (static_cast (2.0), static_cast (expon - 53)); - retval = fill_matrix (octave_value_list (), val, + retval = fill_matrix (octave_value_list (), val, FLT_EPSILON, "eps"); } } @@ -3939,7 +3939,7 @@ @seealso{isna}\n\ @end deftypefn") { - return fill_matrix (args, lo_ieee_na_value (), + return fill_matrix (args, lo_ieee_na_value (), lo_ieee_float_na_value (), "NA"); } @@ -4212,7 +4212,7 @@ */ template -static octave_value +static octave_value do_linspace (const octave_value& base, const octave_value& limit, octave_idx_type n) { @@ -4299,7 +4299,7 @@ retval = do_linspace (arg_1, arg_2, npoints); else retval = do_linspace (arg_1, arg_2, npoints); - + } else { @@ -4480,7 +4480,7 @@ { new_dims = dim_vector::alloc (nargin-1); int empty_dim = -1; - + for (int i = 1; i < nargin; i++) { if (args(i).is_empty ()) @@ -4520,7 +4520,7 @@ { octave_idx_type a_nel = args(0).numel (); octave_idx_type size_empty_dim = a_nel / nel; - + if (a_nel != size_empty_dim * nel) error ("reshape: size is not divisible by the product of known dimensions (= %d)", nel); else @@ -4641,7 +4641,7 @@ if (args.length () == 1) retval = args(0).squeeze (); else - print_usage (); + print_usage (); return retval; } @@ -4659,7 +4659,7 @@ if (args.length () == 1) retval = args(0).full_value (); else - print_usage (); + print_usage (); return retval; } @@ -5299,7 +5299,7 @@ retval = static_cast (1e6 * tmp); else tic_toc_timestamp = tmp; - + return retval; } @@ -5333,7 +5333,7 @@ else octave_stdout << "Elapsed time is " << tmp << " seconds.\n"; } - + return retval; } @@ -5670,7 +5670,7 @@ %!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 2, "descend"), sparse ([NaN, Inf, 2, -1, 1i, 0, 0])) %!shared a -%! a = randn (10, 10); +%! a = randn (10, 10); %! a (a < 0) = 0; %! a = 1i * a; %!assert (sort (sparse (a)), sparse (sort (a))) @@ -5850,7 +5850,7 @@ if (error_state) return retval; } - + octave_value arg = args(0); if (by_rows) @@ -5992,7 +5992,7 @@ } template -static NDT +static NDT do_accumarray_sum (const idx_vector& idx, const NDT& vals, octave_idx_type n = -1) { @@ -6060,11 +6060,11 @@ else print_usage (); - return retval; + return retval; } template -static NDT +static NDT do_accumarray_minmax (const idx_vector& idx, const NDT& vals, octave_idx_type n, bool ismin, const typename NDT::element_type& zero_val) @@ -6078,7 +6078,7 @@ NDT retval (dim_vector (n, 1), zero_val); // Pick minimizer or maximizer. - void (MArray::*op) (const idx_vector&, const MArray&) = + void (MArray::*op) (const idx_vector&, const MArray&) = ismin ? (&MArray::idx_min) : (&MArray::idx_max); octave_idx_type l = idx.length (n); @@ -6154,7 +6154,7 @@ else print_usage (); - return retval; + return retval; } DEFUN (__accumarray_min__, args, , @@ -6176,7 +6176,7 @@ } template -static NDT +static NDT do_accumdim_sum (const idx_vector& idx, const NDT& vals, int dim = -1, octave_idx_type n = -1) { @@ -6244,7 +6244,7 @@ else print_usage (); - return retval; + return retval; } template @@ -6257,7 +6257,7 @@ NDT retval (dv); bool tscl = tval.numel () == 1, fscl = fval.numel () == 1; - + if ((! tscl && tval.dims () != dv) || (! fscl && fval.dims () != dv)) error ("merge: dimensions mismatch"); @@ -6398,7 +6398,7 @@ MAKE_INT_BRANCH (uint64) else - error ("merge: cannot merge %s with %s with array mask", + error ("merge: cannot merge %s with %s with array mask", tval.class_name ().c_str (), fval.class_name ().c_str ()); } @@ -6620,7 +6620,7 @@ */ template -static Array +static Array do_repelems (const Array& src, const Array& rep) { Array retval; diff -r 1473d0cf86d2 -r 12df7854fa7c src/debug.cc --- a/src/debug.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/debug.cc Thu Jan 20 17:24:59 2011 -0500 @@ -185,7 +185,7 @@ } static void -parse_dbfunction_params (const char *who, const octave_value_list& args, +parse_dbfunction_params (const char *who, const octave_value_list& args, std::string& symbol_name, bp_table::intmap& lines) { int nargin = args.length (); @@ -232,10 +232,10 @@ else { const NDArray arg = args(i).array_value (); - + if (error_state) break; - + for (octave_idx_type j = 0; j < arg.nelem (); j++) { int line = static_cast (arg.elem (j)); @@ -243,15 +243,15 @@ break; lines[list_idx++] = line; } - + if (error_state) break; } - } + } } bp_table::intmap -bp_table::do_add_breakpoint (const std::string& fname, +bp_table::do_add_breakpoint (const std::string& fname, const bp_table::intmap& line) { intmap retval; @@ -293,8 +293,8 @@ } -int -bp_table::do_remove_breakpoint (const std::string& fname, +int +bp_table::do_remove_breakpoint (const std::string& fname, const bp_table::intmap& line) { int retval = 0; @@ -350,13 +350,13 @@ bp_table::intmap -bp_table::do_remove_all_breakpoints_in_file (const std::string& fname, +bp_table::do_remove_all_breakpoints_in_file (const std::string& fname, bool silent) { intmap retval; octave_user_code *dbg_fcn = get_user_code (fname); - + if (dbg_fcn) { tree_statement_list *cmds = dbg_fcn->body (); @@ -387,7 +387,7 @@ return retval; } -void +void bp_table::do_remove_all_breakpoints (void) { for (const_bp_set_iterator it = bp_set.begin (); it != bp_set.end (); it++) @@ -397,8 +397,8 @@ tree_evaluator::debug_mode = bp_table::have_breakpoints () || Vdebugging; } -std::string -do_find_bkpt_list (octave_value_list slist, +std::string +do_find_bkpt_list (octave_value_list slist, std::string match) { std::string retval; @@ -435,15 +435,15 @@ if (cmds) { octave_value_list bkpts = cmds->list_breakpoints (); - octave_idx_type len = bkpts.length (); + octave_idx_type len = bkpts.length (); if (len > 0) { bp_table::intmap bkpts_vec; - + for (int i = 0; i < len; i++) bkpts_vec[i] = bkpts (i).double_value (); - + std::string symbol_name = f->name (); retval[symbol_name] = bkpts_vec; @@ -457,7 +457,7 @@ } static octave_value -intmap_to_ov (const bp_table::intmap& line) +intmap_to_ov (const bp_table::intmap& line) { int idx = 0; @@ -535,7 +535,7 @@ bp_table::intmap lines; parse_dbfunction_params ("dbclear", args, symbol_name, lines); - + if (! error_state) bp_table::remove_breakpoint (symbol_name, lines); @@ -596,7 +596,7 @@ for (bp_table::fname_line_map_iterator it = bp_list.begin (); it != bp_list.end (); it++) - { + { octave_stdout << "breakpoint in " << it->first << " at line(s) "; bp_table::intmap m = it->second; @@ -701,10 +701,10 @@ { char ch; int line = 1; - + if (line >= start && line <= end) os << line << "\t"; - + while (fs.get (ch)) { if (line >= start && line <= end) @@ -777,7 +777,7 @@ int start = atoi (start_str.c_str ()); int end = atoi (end_str.c_str ()); - + if (std::min (start, end) <= 0) error ("dbtype: start and end lines must be >= 1\n"); @@ -809,7 +809,7 @@ start = atoi (start_str.c_str ()); end = atoi (end_str.c_str ()); - + } else { @@ -819,7 +819,7 @@ if (std::min (start, end) <= 0) error ("dbtype: start and end lines must be >= 1\n"); - + if (start <= end) do_dbtype (octave_stdout, dbg_fcn->name (), start, end); else @@ -1010,7 +1010,7 @@ if (Vdebugging) { int nargin = args.length (); - + if (nargin > 1) print_usage (); else if (nargin == 1) diff -r 1473d0cf86d2 -r 12df7854fa7c src/debug.h --- a/src/debug.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/debug.h Thu Jan 20 17:24:59 2011 -0500 @@ -67,12 +67,12 @@ ::error ("unable to create breakpoint table!"); retval = false; } - + return retval; } // Add a breakpoint at the nearest executable line. - static intmap add_breakpoint (const std::string& fname = "", + static intmap add_breakpoint (const std::string& fname = "", const intmap& lines = intmap ()) { return instance_ok () @@ -80,7 +80,7 @@ } // Remove a breakpoint from a line in file. - static int remove_breakpoint (const std::string& fname = "", + static int remove_breakpoint (const std::string& fname = "", const intmap& lines = intmap ()) { return instance_ok () @@ -94,14 +94,14 @@ return instance_ok () ? instance->do_remove_all_breakpoints_in_file (fname, silent) : intmap (); } - + // Remove all the breakpoints registered with octave. static void remove_all_breakpoints (void) { if (instance_ok ()) instance->do_remove_all_breakpoints (); } - + // Return all breakpoints. Each element of the map is a vector // containing the breakpoints corresponding to a given function name. static fname_line_map @@ -131,7 +131,7 @@ int do_remove_breakpoint (const std::string&, const intmap& lines); - intmap do_remove_all_breakpoints_in_file (const std::string& fname, + intmap do_remove_all_breakpoints_in_file (const std::string& fname, bool silent); void do_remove_all_breakpoints (void); diff -r 1473d0cf86d2 -r 12df7854fa7c src/defun-int.h --- a/src/defun-int.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/defun-int.h Thu Jan 20 17:24:59 2011 -0500 @@ -44,7 +44,7 @@ extern OCTINTERP_API void install_dld_function (octave_dld_function::fcn f, const std::string& name, - const octave_shlib& shl, const std::string& doc, + const octave_shlib& shl, const std::string& doc, bool relative = false); extern OCTINTERP_API void diff -r 1473d0cf86d2 -r 12df7854fa7c src/defun.cc --- a/src/defun.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/defun.cc Thu Jan 20 17:24:59 2011 -0500 @@ -127,7 +127,7 @@ get_current_shlib (void) { octave_shlib retval; - + octave_function *curr_fcn = octave_call_stack::current (); if (curr_fcn) { diff -r 1473d0cf86d2 -r 12df7854fa7c src/dynamic-ld.cc --- a/src/dynamic-ld.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/dynamic-ld.cc Thu Jan 20 17:24:59 2011 -0500 @@ -386,7 +386,7 @@ ::error ("%s is not a valid shared library", file_name.c_str ()); } - + return retval; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/error.cc --- a/src/error.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/error.cc Thu Jan 20 17:24:59 2011 -0500 @@ -66,7 +66,7 @@ // TRUE means that Octave will print a verbose warning. Currently unused. static bool Vverbose_warning; -// TRUE means that Octave will print no warnings, but lastwarn will be +// TRUE means that Octave will print no warnings, but lastwarn will be //updated static bool Vquiet_warning = false; @@ -800,7 +800,7 @@ { tstr = arg.string_value (); msg = tstr.c_str (); - + if (! msg) return retval; } @@ -920,7 +920,7 @@ if (l > 0) { if (c > 0) - pr_where_1 ("error: near line %d, column %d", + pr_where_1 ("error: near line %d, column %d", l, c); else pr_where_1 ("error: near line %d", l); @@ -931,7 +931,7 @@ if (l > 0) { if (c > 0) - pr_where_1 ("error: called from `%s' near line %d, column %d", + pr_where_1 ("error: called from `%s' near line %d, column %d", nm.c_str (), l, c); else pr_where_1 ("error: called from `%d' near line %d", nm.c_str (), l); @@ -945,7 +945,7 @@ if (l > 0) { if (c > 0) - pr_where_1 ("error: in file %s near line %d, column %d", + pr_where_1 ("error: in file %s near line %d, column %d", file.c_str (), l, c); else pr_where_1 ("error: in file %s near line %d", file.c_str (), l); @@ -956,7 +956,7 @@ if (l > 0) { if (c > 0) - pr_where_1 ("error: called from `%s' in file %s near line %d, column %d", + pr_where_1 ("error: called from `%s' in file %s near line %d, column %d", nm.c_str (), file.c_str (), l, c); else pr_where_1 ("error: called from `%d' in file %s near line %d", nm.c_str (), file.c_str (), l); @@ -1315,7 +1315,7 @@ octave_idx_type nel = ident.numel (); bool found = false; - + std::string val; for (octave_idx_type i = 0; i < nel; i++) @@ -1564,47 +1564,47 @@ if (! error_state && new_err.contains ("message")) { - const std::string tmp = + const std::string tmp = new_err.getfield("message").string_value (); new_error_message = tmp; } if (! error_state && new_err.contains ("identifier")) { - const std::string tmp = + const std::string tmp = new_err.getfield("identifier").string_value (); new_error_id = tmp; } if (! error_state && new_err.contains ("stack")) { - octave_scalar_map new_err_stack = + octave_scalar_map new_err_stack = new_err.getfield("identifier").scalar_map_value (); if (! error_state && new_err_stack.contains ("file")) { - const std::string tmp = + const std::string tmp = new_err_stack.getfield("file").string_value (); new_error_file = tmp; } if (! error_state && new_err_stack.contains ("name")) { - const std::string tmp = + const std::string tmp = new_err_stack.getfield("name").string_value (); new_error_name = tmp; } if (! error_state && new_err_stack.contains ("line")) { - const int tmp = + const int tmp = new_err_stack.getfield("line").nint_value (); new_error_line = tmp; } - + if (! error_state && new_err_stack.contains ("column")) { - const int tmp = + const int tmp = new_err_stack.getfield("column").nint_value (); new_error_column = tmp; } @@ -1631,7 +1631,7 @@ else print_usage (); - return retval; + return retval; } DEFUN (lasterr, args, nargout, @@ -1678,7 +1678,7 @@ else print_usage (); - return retval; + return retval; } // For backward compatibility. @@ -1725,7 +1725,7 @@ else print_usage (); - return retval; + return retval; } DEFUN (usage, args, , diff -r 1473d0cf86d2 -r 12df7854fa7c src/file-io.cc --- a/src/file-io.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/file-io.cc Thu Jan 20 17:24:59 2011 -0500 @@ -470,7 +470,7 @@ } } } - + if (! fs.is_dir ()) { std::string tmode = mode; @@ -866,7 +866,7 @@ octave_stream os; int fmt_n = 0; - if (args(0).is_string ()) + if (args(0).is_string ()) { os = octave_stream_list::lookup (1, who); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/gl-render.cc --- a/src/gl-render.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/gl-render.cc Thu Jan 20 17:24:59 2011 -0500 @@ -63,9 +63,9 @@ class texture_rep { public: - texture_rep (void) + texture_rep (void) : id (), w (), h (), tw (), th (), tx (), ty (), - valid (false), count (1) + valid (false), count (1) { } texture_rep (GLuint id_arg, int w_arg, int h_arg, int tw_arg, int th_arg) @@ -131,7 +131,7 @@ void tex_coord (double q, double r) const { rep->tex_coord (q, r); } - + bool is_valid (void) const { return rep->valid; } }; @@ -305,20 +305,20 @@ private: static void CALLBACK tess_begin (GLenum type, void *t) { reinterpret_cast (t)->begin (type); } - + static void CALLBACK tess_end (void *t) { reinterpret_cast (t)->end (); } - + static void CALLBACK tess_vertex (void *v, void *t) { reinterpret_cast (t)->vertex (v); } - + static void CALLBACK tess_combine (GLdouble c[3], void *v[4], GLfloat w[4], void **out, void *t) { reinterpret_cast (t)->combine (c, v, w, out); } - + static void CALLBACK tess_edge_flag (GLboolean flag, void *t) { reinterpret_cast (t)->edge_flag (flag); } - + static void CALLBACK tess_error (GLenum err, void *t) { reinterpret_cast (t)->error (err); } @@ -346,7 +346,7 @@ // reference counter int count; - vertex_data_rep (void) + vertex_data_rep (void) : coords (), color (), normal (), alpha (), ambient (), diffuse (), specular (), specular_exp (),count (1) { } @@ -442,7 +442,7 @@ //printf("patch_tesselator::vertex (%g, %g, %g)\n", v->coords(0), v->coords(1), v->coords(2)); // FIXME: why did I need to keep the first vertex of the face - // in JHandles? I think it's related to the fact that the + // in JHandles? I think it's related to the fact that the // tessellation process might re-order the vertices, such that // the first one you get here might not be the first one of the face; // but I can't figure out the actual reason. @@ -540,7 +540,7 @@ { if (! go.valid_object ()) return; - + const base_properties& props = go.get_properties (); if (go.isa ("figure")) @@ -613,7 +613,7 @@ Matrix x_zlim = props.get_transform_zlim (); Matrix x_mat1 = props.get_opengl_matrix_1 (); Matrix x_mat2 = props.get_opengl_matrix_2 (); - + xZ1 = x_zlim(0)-(x_zlim(1)-x_zlim(0))/2; xZ2 = x_zlim(1)+(x_zlim(1)-x_zlim(0))/2; @@ -640,13 +640,13 @@ // store axes transformation data xform = props.get_transform (); - + // draw axes object GLboolean antialias; glGetBooleanv (GL_LINE_SMOOTH, &antialias); glDisable (GL_LINE_SMOOTH); - + Matrix xlim = xform.xscale (props.get_xlim ().matrix_value ()); Matrix ylim = xform.yscale (props.get_ylim ().matrix_value ()); Matrix zlim = xform.zscale (props.get_zlim ().matrix_value ()); @@ -1027,7 +1027,7 @@ // drawn after axes object, for correct rendering? Matrix b = render_text (xticklabels(i), tickpos(i,0), tickpos(i,1), tickpos(i,2), - halign, valign); + halign, valign); wmax = std::max (wmax, static_cast (b(2))); hmax = std::max (hmax, static_cast (b(3))); @@ -1058,7 +1058,7 @@ glEnd (); set_linestyle ("-", true); } - + // minor tick marks if (do_xminortick) { @@ -1170,7 +1170,7 @@ } // Y grid - + if (ystate != AXE_DEPTH_DIR && visible) { bool do_ygrid = (props.is_ygrid () && (gridstyle != "none")); @@ -1277,7 +1277,7 @@ // drawn after axes object, for correct rendering? Matrix b = render_text (yticklabels(i), tickpos(i,0), tickpos(i,1), tickpos(i,2), - halign, valign); + halign, valign); wmax = std::max (wmax, static_cast (b(2))); hmax = std::max (hmax, static_cast (b(3))); @@ -1418,7 +1418,7 @@ { gh_manager::get_object (props.get_ylabel ()).set ("visible", "off"); } - + // Z Grid if (zstate != AXE_DEPTH_DIR && visible) @@ -1565,7 +1565,7 @@ // drawn after axes object, for correct rendering? Matrix b = render_text (zticklabels(i), tickpos(i,0), tickpos(i,1), tickpos(i,2), - halign, valign); + halign, valign); wmax = std::max (wmax, static_cast (b(2))); hmax = std::max (hmax, static_cast (b(3))); @@ -1765,7 +1765,7 @@ text::properties& title_props = reinterpret_cast (gh_manager::get_object (props.get_title ()).get_properties ()); - + if (! title_props.get_string ().empty () && title_props.positionmode_is("auto")) { ColumnVector p = xform.untransform (bbox(0)+bbox(2)/2, (bbox(1)-10), @@ -1921,7 +1921,7 @@ if (flag) glEnd (); } - + set_linewidth (0.5); set_linestyle ("-"); } @@ -1957,7 +1957,7 @@ end_marker (); } - + set_clipping (props.is_clipping ()); } @@ -2114,7 +2114,7 @@ for (int k = 0; k < 3; k++) cb[k] *= as; glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); - + for (int k = 0; k < 3; k++) cb[k] = ds * c(j-1, i-1, k); glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); @@ -2143,7 +2143,7 @@ for (int k = 0; k < 3; k++) cb[k] *= as; glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); - + for (int k = 0; k < 3; k++) cb[k] = ds * c(j-1, i, k); glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); @@ -2159,7 +2159,7 @@ } glVertex3d (x(j1,i), y(j-1,i2), z(j-1,i)); - + // Vertex 3 if (fc_mode == 3) tex.tex_coord (double (i) / (zc-1), double (j) / (zr-1)); @@ -2174,7 +2174,7 @@ for (int k = 0; k < 3; k++) cb[k] *= as; glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); - + for (int k = 0; k < 3; k++) cb[k] = ds * c(j, i, k); glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); @@ -2203,7 +2203,7 @@ for (int k = 0; k < 3; k++) cb[k] *= as; glMaterialfv (LIGHT_MODE, GL_AMBIENT, cb); - + for (int k = 0; k < 3; k++) cb[k] = ds * c(j, i-1, k); glMaterialfv (LIGHT_MODE, GL_DIFFUSE, cb); @@ -2396,7 +2396,7 @@ glNormal3d (n(j,i-1,0)/d, n(j,i-1,1)/d, n(j,i-1,2)/d); } glVertex3d (x(j2,i-1), y(j,i1), z(j,i-1)); - + // Vertex 2 if (ec_mode == 2) { @@ -2423,7 +2423,7 @@ glNormal3d (n(j,i,0)/d, n(j,i,1)/d, n(j,i,2)/d); } glVertex3d (x(j2,i), y(j,i2), z(j,i)); - + glEnd (); } } @@ -2479,7 +2479,7 @@ { if (y_mat) i1 = i; - + for (int j = 0; j < zr; j++) { if (clip(j,i)) @@ -2526,14 +2526,14 @@ bool has_facecolor = false; bool has_facealpha = false; - int fc_mode = ((props.facecolor_is("none") + int fc_mode = ((props.facecolor_is("none") || props.facecolor_is_rgb ()) ? 0 : (props.facecolor_is("flat") ? 1 : 2)); int fl_mode = (props.facelighting_is ("none") ? 0 : (props.facelighting_is ("flat") ? 1 : 2)); int fa_mode = (props.facealpha_is_double () ? 0 : (props.facealpha_is ("flat") ? 1 : 2)); - int ec_mode = ((props.edgecolor_is("none") + int ec_mode = ((props.edgecolor_is("none") || props.edgecolor_is_rgb ()) ? 0 : (props.edgecolor_is("flat") ? 1 : 2)); int el_mode = (props.edgelighting_is ("none") ? 0 : @@ -2543,7 +2543,7 @@ Matrix fcolor = props.get_facecolor_rgb (); Matrix ecolor = props.get_edgecolor_rgb (); - + float as = props.get_ambientstrength (); float ds = props.get_diffusestrength (); float ss = props.get_specularstrength (); @@ -2580,7 +2580,7 @@ if (c.rows () == 1) { // Single color specifications, we can simplify a little bit - + if (fc_mode > 0) { fcolor = c; @@ -2691,7 +2691,7 @@ for (int j = 0; j < count_f(i); j++) { vertex_data::vertex_data_rep *vv = vdata[i+j*fr].get_rep (); - + tess.add_vertex (vv->coords.fortran_vec (), vv); } @@ -2886,14 +2886,14 @@ dim_vector dv (cdata.dims ()); int h = dv(0), w = dv(1); bool ok = true; - + Matrix x = props.get_xdata ().matrix_value (); Matrix y = props.get_ydata ().matrix_value (); - if (w > 1 && x(1) == x(0)) + if (w > 1 && x(1) == x(0)) x(1) = x(1) + (w-1); - if (h > 1 && y(1) == y(0)) + if (h > 1 && y(1) == y(0)) y(1) = y(1) + (h-1); const ColumnVector p0 = xform.transform (x(0), y(0), 0); @@ -2904,7 +2904,7 @@ // image pixel size in normalized units float nor_dx, nor_dy; - if (w > 1) + if (w > 1) { pix_dx = (p1(0) - p0(0))/(w-1); nor_dx = (x(1) - x(0))/(w-1); @@ -2957,10 +2957,10 @@ GLfloat vp[4]; glGetFloatv(GL_VIEWPORT, vp); // FIXME -- actually add the code to do it! - + } - if (i0 >= i1 || j0 >= j1) + if (i0 >= i1 || j0 >= j1) return; glPixelZoom (pix_dx, -pix_dy); @@ -3034,7 +3034,7 @@ warning ("opengl_texture::draw: invalid image data type (expected double, uint16, or uint8)"); } } - else + else { ok = false; warning ("opengl_texture::draw: invalid image size (expected n*m*3 or n*m)"); @@ -3213,7 +3213,7 @@ const Matrix& lc, const Matrix& fc) { ColumnVector tmp = xform.transform (x, y, z, false); - + glLoadIdentity (); glTranslated (tmp(0), tmp(1), -tmp(2)); @@ -3357,7 +3357,7 @@ double ang; double r; double dr = 1.0 - sin(M_PI/10)/sin(3*M_PI/10)*1.02; - + glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); for (int i = 0; i < 2*5; i++) { @@ -3373,7 +3373,7 @@ double ang; double r; double dr = 1.0 - 0.5/sin(M_PI/3)*1.02; - + glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); for (int i = 0; i < 2*6; i++) { diff -r 1473d0cf86d2 -r 12df7854fa7c src/gl-render.h --- a/src/gl-render.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/gl-render.h Thu Jan 20 17:24:59 2011 -0500 @@ -51,10 +51,10 @@ opengl_renderer (void) : toolkit (), xform (), xmin (), xmax (), ymin (), ymax (), zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), filled_marker_id (), - camera_pos (), camera_dir () + camera_pos (), camera_dir () #if HAVE_FREETYPE , text_renderer () -#endif +#endif { } virtual ~opengl_renderer (void) { } @@ -114,14 +114,14 @@ double x, double y, double z, int halign, int valign, double rotation = 0.0); - virtual void draw_pixels (GLsizei w, GLsizei h, GLenum format, + virtual void draw_pixels (GLsizei w, GLsizei h, GLenum format, GLenum type, const GLvoid *data); private: - opengl_renderer (const opengl_renderer&) + opengl_renderer (const opengl_renderer&) : toolkit (), xform (), xmin (), xmax (), ymin (), ymax (), zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), filled_marker_id (), - camera_pos (), camera_dir () + camera_pos (), camera_dir () #if HAVE_FREETYPE , text_renderer () #endif diff -r 1473d0cf86d2 -r 12df7854fa7c src/gl2ps-renderer.cc --- a/src/gl2ps-renderer.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/gl2ps-renderer.cc Thu Jan 20 17:24:59 2011 -0500 @@ -34,12 +34,12 @@ #include "gl2ps-renderer.h" #include "gl2ps.h" -void -glps_renderer::draw (const graphics_object& go) +void +glps_renderer::draw (const graphics_object& go) { static bool in_draw = false; - - if (!in_draw) + + if (!in_draw) { in_draw = true; @@ -56,7 +56,7 @@ else if (term.find ("ps") != std::string::npos) gl2ps_term = GL2PS_PS; else if (term.find ("pgf") != std::string::npos) gl2ps_term = GL2PS_PGF; else if (term.find ("tex") != std::string::npos) gl2ps_term = GL2PS_TEX; - else + else { error ("gl2ps-renderer:: Unknown terminal"); return; @@ -66,13 +66,13 @@ if (term.find ("notxt") != std::string::npos) gl2ps_text = GL2PS_NO_TEXT; while (state == GL2PS_OVERFLOW) - { + { buffsize += 1024*1024; gl2psBeginPage ("glps_renderer figure", "Octave", viewport, gl2ps_term, GL2PS_BSP_SORT, (GL2PS_SILENT | GL2PS_SIMPLE_LINE_OFFSET | GL2PS_NO_BLENDING | GL2PS_OCCLUSION_CULL - | GL2PS_BEST_ROOT | gl2ps_text), + | GL2PS_BEST_ROOT | gl2ps_text), GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp, "" ); @@ -85,7 +85,7 @@ in_draw = 0; } else - opengl_renderer::draw (go); + opengl_renderer::draw (go); } int @@ -122,7 +122,7 @@ return gl2psa; } -Matrix +Matrix glps_renderer::render_text (const std::string& txt, double x, double y, double z, int ha, int va, double rotation) @@ -159,7 +159,7 @@ fontname = "Symbol"; else if (fn == "zapfdingbats") fontname = "ZapfDingbats"; - else + else fontname = "Helvetica"; // FIXME -- add support for bold and italic @@ -173,17 +173,17 @@ for (int i = 0; i < 3*w*h; i++) a[i] = data[i]; - + gl2psDrawPixels (w, h, 0, 0, format, GL_FLOAT, a); } -void +void glps_renderer::draw_pixels (GLsizei w, GLsizei h, GLenum format, GLenum type, const GLvoid *data) { - if (type == GL_UNSIGNED_SHORT) + if (type == GL_UNSIGNED_SHORT) ::draw_pixels (w, h, format, static_cast (data)); - else if (type == GL_UNSIGNED_BYTE) + else if (type == GL_UNSIGNED_BYTE) ::draw_pixels (w, h, format, static_cast (data)); else gl2psDrawPixels (w, h, 0, 0, format, type, data); @@ -205,7 +205,7 @@ halign = 1; else if (props.horizontalalignment_is ("right")) halign = 2; - + if (props.verticalalignment_is ("top")) valign = 2; else if (props.verticalalignment_is ("baseline")) diff -r 1473d0cf86d2 -r 12df7854fa7c src/gl2ps-renderer.h --- a/src/gl2ps-renderer.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/gl2ps-renderer.h Thu Jan 20 17:24:59 2011 -0500 @@ -26,13 +26,13 @@ #include "gl-render.h" #include "gl2ps.h" -class +class OCTINTERP_API glps_renderer : public opengl_renderer { public: - glps_renderer (const int _fid, const std::string& _term) - : opengl_renderer () , fid (_fid), term (_term), + glps_renderer (const int _fid, const std::string& _term) + : opengl_renderer () , fid (_fid), term (_term), fontsize (), fontname () { } ~glps_renderer (void) { } @@ -49,7 +49,7 @@ virtual void set_font (const base_properties& props); virtual void draw_text (const text::properties& props); - virtual void draw_pixels (GLsizei w, GLsizei h, GLenum format, + virtual void draw_pixels (GLsizei w, GLsizei h, GLenum format, GLenum type, const GLvoid *data); virtual void set_linestyle (const std::string& s, bool use_stipple) diff -r 1473d0cf86d2 -r 12df7854fa7c src/gl2ps.c --- a/src/gl2ps.c Thu Jan 20 17:21:27 2011 -0500 +++ b/src/gl2ps.c Thu Jan 20 17:24:59 2011 -0500 @@ -50,7 +50,7 @@ #include #endif -/********************************************************************* +/********************************************************************* * * Private definitions, data structures and prototypes * @@ -228,7 +228,7 @@ GLboolean zerosurfacearea; GL2PSbsptree2d *imagetree; GL2PSprimitive *primitivetoadd; - + /* PDF-specific */ int streamlength; GL2PSlist *pdfprimlist, *pdfgrouplist; @@ -266,7 +266,7 @@ static GLint gl2psPrintPrimitives(void); -/********************************************************************* +/********************************************************************* * * Utility routines * @@ -283,7 +283,7 @@ case GL2PS_ERROR : fprintf(stderr, "GL2PS error: "); break; } va_start(args, fmt); - vfprintf(stderr, fmt, args); + vfprintf(stderr, fmt, args); va_end(args); fprintf(stderr, "\n"); } @@ -360,16 +360,16 @@ static int gl2psAllocCompress(unsigned int srcsize) { gl2psFreeCompress(); - + if(!gl2ps->compress || !srcsize) return GL2PS_ERROR; - + gl2ps->compress->srcLen = srcsize; gl2ps->compress->destLen = (int)ceil(1.001 * gl2ps->compress->srcLen + 12); gl2ps->compress->src = (Bytef*)gl2psMalloc(gl2ps->compress->srcLen); gl2ps->compress->start = gl2ps->compress->src; gl2ps->compress->dest = (Bytef*)gl2psMalloc(gl2ps->compress->destLen); - + return GL2PS_SUCCESS; } @@ -377,18 +377,18 @@ { if(!gl2ps->compress || !srcsize) return NULL; - + if(srcsize < gl2ps->compress->srcLen) return gl2ps->compress->start; - + gl2ps->compress->srcLen = srcsize; gl2ps->compress->destLen = (int)ceil(1.001 * gl2ps->compress->srcLen + 12); - gl2ps->compress->src = (Bytef*)gl2psRealloc(gl2ps->compress->src, + gl2ps->compress->src = (Bytef*)gl2psRealloc(gl2ps->compress->src, gl2ps->compress->srcLen); gl2ps->compress->start = gl2ps->compress->src; - gl2ps->compress->dest = (Bytef*)gl2psRealloc(gl2ps->compress->dest, + gl2ps->compress->dest = (Bytef*)gl2psRealloc(gl2ps->compress->dest, gl2ps->compress->destLen); - + return gl2ps->compress->start; } @@ -407,8 +407,8 @@ { /* For compatibility with older zlib versions, we use compress(...) instead of compress2(..., Z_BEST_COMPRESSION) */ - return compress(gl2ps->compress->dest, &gl2ps->compress->destLen, - gl2ps->compress->start, gl2ps->compress->srcLen); + return compress(gl2ps->compress->dest, &gl2ps->compress->destLen, + gl2ps->compress->start, gl2ps->compress->srcLen); } #endif @@ -456,7 +456,7 @@ /* add the gzip file header */ fwrite(tmp, 10, 1, gl2ps->stream); } -#endif +#endif } static void gl2psPrintGzipFooter() @@ -477,7 +477,7 @@ n += 4; /* DICTID */ } /* write the data, without the zlib header and footer */ - fwrite(gl2ps->compress->dest+n, gl2ps->compress->destLen-(n+4), + fwrite(gl2ps->compress->dest+n, gl2ps->compress->destLen-(n+4), 1, gl2ps->stream); /* add the gzip file footer */ crc = crc32(0L, gl2ps->compress->start, gl2ps->compress->srcLen); @@ -496,7 +496,7 @@ gl2psFree(gl2ps->compress); gl2ps->compress = NULL; } -#endif +#endif } /* The list handling routines */ @@ -545,7 +545,7 @@ static void gl2psListDelete(GL2PSlist *list) { - if(!list) return; + if(!list) return; gl2psFree(list->array); gl2psFree(list); } @@ -618,7 +618,7 @@ static void gl2psEncodeBase64Block(unsigned char in[3], unsigned char out[4], int len) { - static const char cb64[] = + static const char cb64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; out[0] = cb64[ in[0] >> 2 ]; @@ -671,7 +671,7 @@ return GL_FALSE; return GL_TRUE; } - + static GLboolean gl2psVertsSameColor(const GL2PSprimitive *prim) { int i; @@ -690,20 +690,20 @@ int i; if(n < 2) return GL_TRUE; - + for(i = 1; i < n; i++){ if(fabs(rgba[0][0] - rgba[i][0]) > threshold[0] || fabs(rgba[0][1] - rgba[i][1]) > threshold[1] || fabs(rgba[0][2] - rgba[i][2]) > threshold[2]) return GL_FALSE; } - + return GL_TRUE; } static void gl2psSetLastColor(GL2PSrgba rgba) { - int i; + int i; for(i = 0; i < 3; ++i){ gl2ps->lastrgba[i] = rgba[i]; } @@ -712,13 +712,13 @@ static GLfloat gl2psGetRGB(GL2PSimage *im, GLuint x, GLuint y, GLfloat *red, GLfloat *green, GLfloat *blue) { - + GLsizei width = im->width; GLsizei height = im->height; GLfloat *pixels = im->pixels; GLfloat *pimag; - /* OpenGL image is from down to up, PS image is up to down */ + /* OpenGL image is from down to up, PS image is up to down */ switch(im->format){ case GL_RGBA: pimag = pixels + 4 * (width * (height - 1 - y) + x); @@ -741,7 +741,7 @@ { int size; GL2PSimage *image = (GL2PSimage*)gl2psMalloc(sizeof(GL2PSimage)); - + image->width = im->width; image->height = im->height; image->format = im->format; @@ -761,7 +761,7 @@ image->pixels = (GLfloat*)gl2psMalloc(size); memcpy(image->pixels, im->pixels, size); - + return image; } @@ -783,7 +783,7 @@ { unsigned int i; GL2PSlist *png = (GL2PSlist*)png_get_io_ptr(png_ptr); - for(i = 0; i < length; i++) + for(i = 0; i < length; i++) gl2psListAdd(png, &data[i]); } @@ -801,21 +801,21 @@ if(!(png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL))) return; - + if(!(info_ptr = png_create_info_struct(png_ptr))){ png_destroy_write_struct(&png_ptr, NULL); return; } - + if(setjmp(png_jmpbuf(png_ptr))) { png_destroy_write_struct(&png_ptr, &info_ptr); return; } - + png_set_write_fn(png_ptr, (void *)png, gl2psUserWritePNG, gl2psUserFlushPNG); png_set_compression_level(png_ptr, Z_DEFAULT_COMPRESSION); - png_set_IHDR(png_ptr, info_ptr, pixmap->width, pixmap->height, 8, - PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, + png_set_IHDR(png_ptr, info_ptr, pixmap->width, pixmap->height, 8, + PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); png_write_info(png_ptr, info_ptr); @@ -839,7 +839,7 @@ /* Helper routines for text strings */ -static GLint gl2psAddText(GLint type, const char *str, const char *fontname, +static GLint gl2psAddText(GLint type, const char *str, const char *fontname, GLshort fontsize, GLint alignment, GLfloat angle) { GLfloat pos[4]; @@ -871,7 +871,7 @@ glGetFloatv(GL_CURRENT_RASTER_COLOR, prim->verts[0].rgba); prim->data.text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring)); prim->data.text->str = (char*)gl2psMalloc((strlen(str)+1)*sizeof(char)); - strcpy(prim->data.text->str, str); + strcpy(prim->data.text->str, str); prim->data.text->fontname = (char*)gl2psMalloc((strlen(fontname)+1)*sizeof(char)); strcpy(prim->data.text->fontname, fontname); prim->data.text->fontsize = fontsize; @@ -880,7 +880,7 @@ gl2psListAdd(gl2ps->auxprimitives, &prim); glPassThrough(GL2PS_TEXT_TOKEN); - + return GL2PS_SUCCESS; } @@ -888,13 +888,13 @@ { GL2PSstring *text = (GL2PSstring*)gl2psMalloc(sizeof(GL2PSstring)); text->str = (char*)gl2psMalloc((strlen(t->str)+1)*sizeof(char)); - strcpy(text->str, t->str); + strcpy(text->str, t->str); text->fontname = (char*)gl2psMalloc((strlen(t->fontname)+1)*sizeof(char)); strcpy(text->fontname, t->fontname); text->fontsize = t->fontsize; text->alignment = t->alignment; text->angle = t->angle; - + return text; } @@ -914,7 +914,7 @@ /* returns TRUE if gl2ps supports the argument combination: only two blending modes have been implemented so far */ - if( (sfactor == GL_SRC_ALPHA && dfactor == GL_ONE_MINUS_SRC_ALPHA) || + if( (sfactor == GL_SRC_ALPHA && dfactor == GL_ONE_MINUS_SRC_ALPHA) || (sfactor == GL_ONE && dfactor == GL_ZERO) ) return GL_TRUE; return GL_FALSE; @@ -934,7 +934,7 @@ v->rgba[3] = 1.0F; return; } - + switch(gl2ps->blendfunc[0]){ case GL_ONE: v->rgba[3] = 1.0F; @@ -955,9 +955,9 @@ a remarkable amount of PDF handling code inside this file depends on it if activated */ /* - t->prop = T_CONST_COLOR; + t->prop = T_CONST_COLOR; for(i = 0; i < 3; ++i){ - if(!GL2PS_ZERO(t->vertex[0].rgba[i] - t->vertex[1].rgba[i]) || + if(!GL2PS_ZERO(t->vertex[0].rgba[i] - t->vertex[1].rgba[i]) || !GL2PS_ZERO(t->vertex[1].rgba[i] - t->vertex[2].rgba[i])){ t->prop = T_VAR_COLOR; break; @@ -965,7 +965,7 @@ } */ - if(!GL2PS_ZERO(t->vertex[0].rgba[3] - t->vertex[1].rgba[3]) || + if(!GL2PS_ZERO(t->vertex[0].rgba[3] - t->vertex[1].rgba[3]) || !GL2PS_ZERO(t->vertex[1].rgba[3] - t->vertex[2].rgba[3])){ t->prop |= T_VAR_ALPHA; } @@ -1008,7 +1008,7 @@ } prim = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); - + prim->type = p->type; prim->numverts = p->numverts; prim->boundary = p->boundary; @@ -1044,17 +1044,17 @@ return GL_TRUE; } -/********************************************************************* +/********************************************************************* * - * 3D sorting routines + * 3D sorting routines * *********************************************************************/ static GLfloat gl2psComparePointPlane(GL2PSxyz point, GL2PSplane plane) { - return (plane[0] * point[0] + - plane[1] * point[1] + - plane[2] * point[2] + + return (plane[0] * point[0] + + plane[1] * point[1] + + plane[2] * point[2] + plane[3]); } @@ -1101,13 +1101,13 @@ switch(prim->type){ case GL2PS_TRIANGLE : case GL2PS_QUADRANGLE : - v[0] = prim->verts[1].xyz[0] - prim->verts[0].xyz[0]; - v[1] = prim->verts[1].xyz[1] - prim->verts[0].xyz[1]; - v[2] = prim->verts[1].xyz[2] - prim->verts[0].xyz[2]; - w[0] = prim->verts[2].xyz[0] - prim->verts[0].xyz[0]; - w[1] = prim->verts[2].xyz[1] - prim->verts[0].xyz[1]; - w[2] = prim->verts[2].xyz[2] - prim->verts[0].xyz[2]; - if((GL2PS_ZERO(v[0]) && GL2PS_ZERO(v[1]) && GL2PS_ZERO(v[2])) || + v[0] = prim->verts[1].xyz[0] - prim->verts[0].xyz[0]; + v[1] = prim->verts[1].xyz[1] - prim->verts[0].xyz[1]; + v[2] = prim->verts[1].xyz[2] - prim->verts[0].xyz[2]; + w[0] = prim->verts[2].xyz[0] - prim->verts[0].xyz[0]; + w[1] = prim->verts[2].xyz[1] - prim->verts[0].xyz[1]; + w[2] = prim->verts[2].xyz[2] - prim->verts[0].xyz[2]; + if((GL2PS_ZERO(v[0]) && GL2PS_ZERO(v[1]) && GL2PS_ZERO(v[2])) || (GL2PS_ZERO(w[0]) && GL2PS_ZERO(w[1]) && GL2PS_ZERO(w[2]))){ plane[0] = plane[1] = 0.0F; plane[2] = 1.0F; @@ -1115,16 +1115,16 @@ } else{ gl2psGetNormal(v, w, plane); - plane[3] = - - plane[0] * prim->verts[0].xyz[0] - - plane[1] * prim->verts[0].xyz[1] + plane[3] = + - plane[0] * prim->verts[0].xyz[0] + - plane[1] * prim->verts[0].xyz[1] - plane[2] * prim->verts[0].xyz[2]; } break; case GL2PS_LINE : - v[0] = prim->verts[1].xyz[0] - prim->verts[0].xyz[0]; - v[1] = prim->verts[1].xyz[1] - prim->verts[0].xyz[1]; - v[2] = prim->verts[1].xyz[2] - prim->verts[0].xyz[2]; + v[0] = prim->verts[1].xyz[0] - prim->verts[0].xyz[0]; + v[1] = prim->verts[1].xyz[1] - prim->verts[0].xyz[1]; + v[2] = prim->verts[1].xyz[2] - prim->verts[0].xyz[2]; if(GL2PS_ZERO(v[0]) && GL2PS_ZERO(v[1]) && GL2PS_ZERO(v[2])){ plane[0] = plane[1] = 0.0F; plane[2] = 1.0F; @@ -1135,9 +1135,9 @@ else if(GL2PS_ZERO(v[1])) w[1] = 1.0F; else w[2] = 1.0F; gl2psGetNormal(v, w, plane); - plane[3] = - - plane[0] * prim->verts[0].xyz[0] - - plane[1] * prim->verts[0].xyz[1] + plane[3] = + - plane[0] * prim->verts[0].xyz[0] + - plane[1] * prim->verts[0].xyz[1] - plane[2] * prim->verts[0].xyz[2]; } break; @@ -1172,11 +1172,11 @@ sect = -gl2psComparePointPlane(a->xyz, plane) / psca; else sect = 0.0F; - + c->xyz[0] = a->xyz[0] + v[0] * sect; c->xyz[1] = a->xyz[1] + v[1] * sect; c->xyz[2] = a->xyz[2] + v[2] * sect; - + c->rgba[0] = (1 - sect) * a->rgba[0] + sect * b->rgba[0]; c->rgba[1] = (1 - sect) * a->rgba[1] + sect * b->rgba[1]; c->rgba[2] = (1 - sect) * a->rgba[2] + sect * b->rgba[2]; @@ -1199,10 +1199,10 @@ numverts = 4; } switch(numverts){ - case 1 : child->type = GL2PS_POINT; break; - case 2 : child->type = GL2PS_LINE; break; - case 3 : child->type = GL2PS_TRIANGLE; break; - case 4 : child->type = GL2PS_QUADRANGLE; break; + case 1 : child->type = GL2PS_POINT; break; + case 2 : child->type = GL2PS_LINE; break; + case 3 : child->type = GL2PS_TRIANGLE; break; + case 4 : child->type = GL2PS_QUADRANGLE; break; default: child->type = GL2PS_NO_TYPE; break; } } @@ -1221,13 +1221,13 @@ child->verts[i] = parent->verts[index0[i]]; } else{ - gl2psCutEdge(&parent->verts[index0[i]], &parent->verts[index1[i]], + gl2psCutEdge(&parent->verts[index0[i]], &parent->verts[index1[i]], plane, &child->verts[i]); } } } -static void gl2psAddIndex(GLshort *index0, GLshort *index1, GLshort *nb, +static void gl2psAddIndex(GLshort *index0, GLshort *index1, GLshort *nb, GLshort i, GLshort j) { GLint k; @@ -1250,9 +1250,9 @@ { GLint type = GL2PS_COINCIDENT; GLshort i, j; - GLfloat d[5]; - - for(i = 0; i < prim->numverts; i++){ + GLfloat d[5]; + + for(i = 0; i < prim->numverts; i++){ d[i] = gl2psComparePointPlane(prim->verts[i].xyz, plane); } @@ -1264,11 +1264,11 @@ j = gl2psGetIndex(i, prim->numverts); if(d[j] > GL2PS_EPSILON){ if(type == GL2PS_COINCIDENT) type = GL2PS_IN_BACK_OF; - else if(type != GL2PS_IN_BACK_OF) return 1; + else if(type != GL2PS_IN_BACK_OF) return 1; if(d[i] < -GL2PS_EPSILON) return 1; } else if(d[j] < -GL2PS_EPSILON){ - if(type == GL2PS_COINCIDENT) type = GL2PS_IN_FRONT_OF; + if(type == GL2PS_COINCIDENT) type = GL2PS_IN_FRONT_OF; else if(type != GL2PS_IN_FRONT_OF) return 1; if(d[i] > GL2PS_EPSILON) return 1; } @@ -1277,16 +1277,16 @@ return 0; } -static GLint gl2psSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane, +static GLint gl2psSplitPrimitive(GL2PSprimitive *prim, GL2PSplane plane, GL2PSprimitive **front, GL2PSprimitive **back) { GLshort i, j, in = 0, out = 0, in0[5], in1[5], out0[5], out1[5]; GLint type; - GLfloat d[5]; + GLfloat d[5]; type = GL2PS_COINCIDENT; - for(i = 0; i < prim->numverts; i++){ + for(i = 0; i < prim->numverts; i++){ d[i] = gl2psComparePointPlane(prim->verts[i].xyz, plane); } @@ -1301,7 +1301,7 @@ j = gl2psGetIndex(i, prim->numverts); if(d[j] > GL2PS_EPSILON){ if(type == GL2PS_COINCIDENT) type = GL2PS_IN_BACK_OF; - else if(type != GL2PS_IN_BACK_OF) type = GL2PS_SPANNING; + else if(type != GL2PS_IN_BACK_OF) type = GL2PS_SPANNING; if(d[i] < -GL2PS_EPSILON){ gl2psAddIndex(in0, in1, &in, i, j); gl2psAddIndex(out0, out1, &out, i, j); @@ -1310,7 +1310,7 @@ gl2psAddIndex(out0, out1, &out, j, -1); } else if(d[j] < -GL2PS_EPSILON){ - if(type == GL2PS_COINCIDENT) type = GL2PS_IN_FRONT_OF; + if(type == GL2PS_COINCIDENT) type = GL2PS_IN_FRONT_OF; else if(type != GL2PS_IN_FRONT_OF) type = GL2PS_SPANNING; if(d[i] > GL2PS_EPSILON){ gl2psAddIndex(in0, in1, &in, i, j); @@ -1337,7 +1337,7 @@ return type; } -static void gl2psDivideQuad(GL2PSprimitive *quad, +static void gl2psDivideQuad(GL2PSprimitive *quad, GL2PSprimitive **t1, GL2PSprimitive **t2) { *t1 = (GL2PSprimitive*)gl2psMalloc(sizeof(GL2PSprimitive)); @@ -1366,17 +1366,17 @@ GL2PSprimitive *q, *w; GLfloat dq = 0.0F, dw = 0.0F, diff; int i; - + q = *(GL2PSprimitive**)a; w = *(GL2PSprimitive**)b; for(i = 0; i < q->numverts; i++){ - dq += q->verts[i].xyz[2]; + dq += q->verts[i].xyz[2]; } dq /= (GLfloat)q->numverts; for(i = 0; i < w->numverts; i++){ - dw += w->verts[i].xyz[2]; + dw += w->verts[i].xyz[2]; } dw /= (GLfloat)w->numverts; @@ -1427,7 +1427,7 @@ for(j = 0; j < gl2psListNbr(primitives); j++){ if(j != i){ prim2 = *(GL2PSprimitive**)gl2psListPointer(primitives, j); - count += gl2psTestSplitPrimitive(prim2, plane); + count += gl2psTestSplitPrimitive(prim2, plane); } if(count > best) break; } @@ -1461,7 +1461,7 @@ static void gl2psFreePrimitive(void *data) { GL2PSprimitive *q; - + q = *(GL2PSprimitive**)data; gl2psFree(q->verts); if(q->type == GL2PS_TEXT || q->type == GL2PS_SPECIAL){ @@ -1486,7 +1486,7 @@ gl2psListAdd(list, &t2); gl2psFreePrimitive(&prim); } - + } static void gl2psFreeBspTree(GL2PSbsptree **tree) @@ -1598,7 +1598,7 @@ } gl2psTraverseBspTree(tree->front, eye, epsilon, compare, action, inverse); } - else if(GL_TRUE == compare(-epsilon, result)){ + else if(GL_TRUE == compare(-epsilon, result)){ gl2psTraverseBspTree(tree->front, eye, epsilon, compare, action, inverse); if(inverse){ gl2psListActionInverse(tree->primitives, action); @@ -1666,18 +1666,18 @@ else if(prim->offset && (prim->type == GL2PS_TRIANGLE)){ factor = gl2ps->offset[0]; units = gl2ps->offset[1]; - area = - (prim->verts[1].xyz[0] - prim->verts[0].xyz[0]) * - (prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) - - (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) * + area = + (prim->verts[1].xyz[0] - prim->verts[0].xyz[0]) * + (prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) - + (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) * (prim->verts[1].xyz[1] - prim->verts[0].xyz[1]); if(!GL2PS_ZERO(area)){ - dZdX = + dZdX = ((prim->verts[2].xyz[1] - prim->verts[1].xyz[1]) * (prim->verts[1].xyz[2] - prim->verts[0].xyz[2]) - (prim->verts[1].xyz[1] - prim->verts[0].xyz[1]) * (prim->verts[2].xyz[2] - prim->verts[1].xyz[2])) / area; - dZdY = + dZdY = ((prim->verts[1].xyz[0] - prim->verts[0].xyz[0]) * (prim->verts[2].xyz[2] - prim->verts[1].xyz[2]) - (prim->verts[2].xyz[0] - prim->verts[1].xyz[0]) * @@ -1695,15 +1695,15 @@ } } -/********************************************************************* +/********************************************************************* * - * 2D sorting routines (for occlusion culling) + * 2D sorting routines (for occlusion culling) * *********************************************************************/ static GLint gl2psGetPlaneFromPoints(GL2PSxyz a, GL2PSxyz b, GL2PSplane plane) { - GLfloat n; + GLfloat n; plane[0] = b[1] - a[1]; plane[1] = a[0] - b[0]; @@ -1712,7 +1712,7 @@ if(!GL2PS_ZERO(n)){ plane[0] /= n; plane[1] /= n; - plane[3] = -plane[0]*a[0]-plane[1]*a[1]; + plane[3] = -plane[0]*a[0]-plane[1]*a[1]; return 1; } else{ @@ -1897,8 +1897,8 @@ } static void gl2psSplitPrimitive2D(GL2PSprimitive *prim, - GL2PSplane plane, - GL2PSprimitive **front, + GL2PSplane plane, + GL2PSprimitive **front, GL2PSprimitive **back) { /* cur will hold the position of the current vertex @@ -1907,10 +1907,10 @@ v1 and v2 represent the current and previous vertices, respectively flag is set if the current vertex should be checked against the plane */ GLint cur = -1, prev = -1, i, v1 = 0, v2 = 0, flag = 1, prev0 = -1; - + /* list of vertices that will go in front and back primitive */ GL2PSvertex *front_list = NULL, *back_list = NULL; - + /* number of vertices in front and back list */ GLshort front_count = 0, back_count = 0; @@ -1927,7 +1927,7 @@ if(i == 0){ prev0 = cur; } - } + } if(((prev == -1) || (prev == cur) || (prev == 0) || (cur == 0)) && (i < prim->numverts)){ if(cur == GL2PS_POINT_INFRONT){ @@ -1982,12 +1982,12 @@ { GLint ret = 0; GL2PSprimitive *frontprim = NULL, *backprim = NULL; - + /* FIXME: until we consider the actual extent of text strings and pixmaps, never cull them. Otherwise the whole string/pixmap gets culled as soon as the reference point is hidden */ - if(prim->type == GL2PS_PIXMAP || - prim->type == GL2PS_TEXT || + if(prim->type == GL2PS_PIXMAP || + prim->type == GL2PS_TEXT || prim->type == GL2PS_SPECIAL){ return 1; } @@ -2001,7 +2001,7 @@ else{ switch(gl2psCheckPrimitive(prim, (*tree)->plane)){ case GL2PS_IN_BACK_OF: return gl2psAddInBspImageTree(prim, &(*tree)->back); - case GL2PS_IN_FRONT_OF: + case GL2PS_IN_FRONT_OF: if((*tree)->front != NULL) return gl2psAddInBspImageTree(prim, &(*tree)->front); else return 0; case GL2PS_SPANNING: @@ -2136,14 +2136,14 @@ gl2psBuildPolygonBoundary(tree->front); } -/********************************************************************* +/********************************************************************* * * Feedback buffer parser * *********************************************************************/ -static void gl2psAddPolyPrimitive(GLshort type, GLshort numverts, - GL2PSvertex *verts, GLint offset, +static void gl2psAddPolyPrimitive(GLshort type, GLshort numverts, + GL2PSvertex *verts, GLint offset, GLushort pattern, GLint factor, GLfloat width, char boundary) { @@ -2210,7 +2210,7 @@ while(used > 0){ if(GL_TRUE == boundary) gl2ps->boundary = GL_TRUE; - + switch((GLint)*current){ case GL_POINT_TOKEN : current ++; @@ -2218,7 +2218,7 @@ i = gl2psGetVertex(&vertices[0], current); current += i; used -= i; - gl2psAddPolyPrimitive(GL2PS_POINT, 1, vertices, 0, + gl2psAddPolyPrimitive(GL2PS_POINT, 1, vertices, 0, pattern, factor, psize, 0); break; case GL_LINE_TOKEN : @@ -2231,7 +2231,7 @@ i = gl2psGetVertex(&vertices[1], current); current += i; used -= i; - gl2psAddPolyPrimitive(GL2PS_LINE, 2, vertices, 0, + gl2psAddPolyPrimitive(GL2PS_LINE, 2, vertices, 0, pattern, factor, lwidth, 0); break; case GL_POLYGON_TOKEN : @@ -2262,7 +2262,7 @@ else v ++; } - break; + break; case GL_BITMAP_TOKEN : case GL_DRAW_PIXEL_TOKEN : case GL_COPY_PIXEL_TOKEN : @@ -2271,7 +2271,7 @@ i = gl2psGetVertex(&vertices[0], current); current += i; used -= i; - break; + break; case GL_PASS_THROUGH_TOKEN : switch((GLint)current[1]){ case GL2PS_BEGIN_OFFSET_TOKEN : offset = 1; break; @@ -2281,32 +2281,32 @@ case GL2PS_END_STIPPLE_TOKEN : pattern = factor = 0; break; case GL2PS_BEGIN_BLEND_TOKEN : gl2ps->blending = GL_TRUE; break; case GL2PS_END_BLEND_TOKEN : gl2ps->blending = GL_FALSE; break; - case GL2PS_BEGIN_STIPPLE_TOKEN : + case GL2PS_BEGIN_STIPPLE_TOKEN : current += 2; - used -= 2; - pattern = (GLushort)current[1]; + used -= 2; + pattern = (GLushort)current[1]; current += 2; - used -= 2; - factor = (GLint)current[1]; + used -= 2; + factor = (GLint)current[1]; break; - case GL2PS_SRC_BLEND_TOKEN : - current += 2; - used -= 2; + case GL2PS_SRC_BLEND_TOKEN : + current += 2; + used -= 2; gl2ps->blendfunc[0] = (GLint)current[1]; break; - case GL2PS_DST_BLEND_TOKEN : - current += 2; - used -= 2; + case GL2PS_DST_BLEND_TOKEN : + current += 2; + used -= 2; gl2ps->blendfunc[1] = (GLint)current[1]; break; - case GL2PS_POINT_SIZE_TOKEN : - current += 2; - used -= 2; + case GL2PS_POINT_SIZE_TOKEN : + current += 2; + used -= 2; psize = current[1]; break; - case GL2PS_LINE_WIDTH_TOKEN : - current += 2; - used -= 2; + case GL2PS_LINE_WIDTH_TOKEN : + current += 2; + used -= 2; lwidth = current[1]; break; case GL2PS_IMAGEMAP_TOKEN : @@ -2320,7 +2320,7 @@ prim->pattern = 0; prim->factor = 0; prim->width = 1; - + node = (GL2PSimagemap*)gl2psMalloc(sizeof(GL2PSimagemap)); node->image = (GL2PSimage*)gl2psMalloc(sizeof(GL2PSimage)); node->image->type = 0; @@ -2328,18 +2328,18 @@ node->image->zoom_x = 1.0F; node->image->zoom_y = 1.0F; node->next = NULL; - + if(gl2ps->imagemap_head == NULL) gl2ps->imagemap_head = node; else gl2ps->imagemap_tail->next = node; gl2ps->imagemap_tail = node; prim->data.image = node->image; - + current += 2; used -= 2; i = gl2psGetVertex(&prim->verts[0], ¤t[1]); current += i; used -= i; - + node->image->width = (GLint)current[2]; current += 2; used -= 2; node->image->height = (GLint)current[2]; @@ -2359,12 +2359,12 @@ sizeoffloat = sizeof(GLfloat); v = 2 * sizeoffloat; - vtot = node->image->height + node->image->height * + vtot = node->image->height + node->image->height * ((node->image->width - 1) / 8); node->image->pixels = (GLfloat*)gl2psMalloc(v + vtot); node->image->pixels[0] = prim->verts[0].xyz[0]; node->image->pixels[1] = prim->verts[0].xyz[1]; - + for(i = 0; i < vtot; i += sizeoffloat){ current += 2; used -= 2; if((vtot - i) >= 4) @@ -2378,15 +2378,15 @@ case GL2PS_DRAW_PIXELS_TOKEN : case GL2PS_TEXT_TOKEN : if(auxindex < gl2psListNbr(gl2ps->auxprimitives)) - gl2psListAdd(gl2ps->primitives, + gl2psListAdd(gl2ps->primitives, gl2psListPointer(gl2ps->auxprimitives, auxindex++)); else gl2psMsg(GL2PS_ERROR, "Wrong number of auxiliary tokens in buffer"); break; } - current += 2; - used -= 2; - break; + current += 2; + used -= 2; + break; default : gl2psMsg(GL2PS_WARNING, "Unknown token in buffer"); current ++; @@ -2398,7 +2398,7 @@ gl2psListReset(gl2ps->auxprimitives); } -/********************************************************************* +/********************************************************************* * * PostScript routines * @@ -2428,17 +2428,17 @@ if((width <= 0) || (height <= 0)) return; gl2psPrintf("gsave\n"); - gl2psPrintf("%.2f %.2f translate\n", x, y); + gl2psPrintf("%.2f %.2f translate\n", x, y); gl2psPrintf("%.2f %.2f scale\n", width * im->zoom_x, height * im->zoom_y); if(greyscale){ /* greyscale */ - gl2psPrintf("/picstr %d string def\n", width); - gl2psPrintf("%d %d %d\n", width, height, 8); - gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); + gl2psPrintf("/picstr %d string def\n", width); + gl2psPrintf("%d %d %d\n", width, height, 8); + gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); gl2psPrintf("{ currentfile picstr readhexstring pop }\n"); gl2psPrintf("image\n"); for(row = 0; row < height; row++){ - for(col = 0; col < width; col++){ + for(col = 0; col < width; col++){ gl2psGetRGB(im, col, row, &dr, &dg, &db); fgrey = (0.30F * dr + 0.59F * dg + 0.11F * db); grey = (unsigned char)(255. * fgrey); @@ -2446,8 +2446,8 @@ } gl2psPrintf("\n"); } - nbhex = width * height * 2; - gl2psPrintf("%%%% nbhex digit :%d\n", nbhex); + nbhex = width * height * 2; + gl2psPrintf("%%%% nbhex digit :%d\n", nbhex); } else if(nbit == 2){ /* color, 2 bits for r and g and b; rgbs following each other */ nrgb = width * 3; @@ -2468,7 +2468,7 @@ if(icase == 1) { if(col < width) { gl2psGetRGB(im, col, row, &dr, &dg, &db); - } + } else { dr = dg = db = 0; } @@ -2481,7 +2481,7 @@ b = (b<<2) + blue; if(col < width) { gl2psGetRGB(im, col, row, &dr, &dg, &db); - } + } else { dr = dg = db = 0; } @@ -2493,7 +2493,7 @@ gl2psWriteByte(b); b = 0; icase++; - } + } else if(icase == 2) { b = green; b = (b<<2) + blue; @@ -2512,7 +2512,7 @@ gl2psWriteByte(b); b = 0; icase++; - } + } else if(icase == 3) { b = blue; if(col < width) { @@ -2540,7 +2540,7 @@ nrgb = width * 3; nbits = nrgb * nbit; nbyte = nbits / 8; - if((nbyte * 8) != nbits) nbyte++; + if((nbyte * 8) != nbits) nbyte++; gl2psPrintf("/rgbstr %d string def\n", nbyte); gl2psPrintf("%d %d %d\n", width, height, nbit); gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); @@ -2554,7 +2554,7 @@ if(icase == 1) { if(col < width) { gl2psGetRGB(im, col, row, &dr, &dg, &db); - } + } else { dr = dg = db = 0; } @@ -2563,12 +2563,12 @@ green = (unsigned char)(15. * dg); gl2psPrintf("%x%x", red, green); icase++; - } + } else if(icase == 2) { blue = (unsigned char)(15. * db); if(col < width) { gl2psGetRGB(im, col, row, &dr, &dg, &db); - } + } else { dr = dg = db = 0; } @@ -2591,7 +2591,7 @@ nbyte = width * 3; gl2psPrintf("/rgbstr %d string def\n", nbyte); gl2psPrintf("%d %d %d\n", width, height, 8); - gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); + gl2psPrintf("[ %d 0 0 -%d 0 %d ]\n", width, height, height); gl2psPrintf("{ currentfile rgbstr readhexstring pop }\n"); gl2psPrintf("false 3\n"); gl2psPrintf("colorimage\n"); @@ -2608,7 +2608,7 @@ gl2psPrintf("\n"); } } - + gl2psPrintf("grestore\n"); } @@ -2616,14 +2616,14 @@ GLsizei width, GLsizei height, const unsigned char *imagemap){ int i, size; - + if((width <= 0) || (height <= 0)) return; - + size = height + height * (width - 1) / 8; - + gl2psPrintf("gsave\n"); gl2psPrintf("%.2f %.2f translate\n", x, y); - gl2psPrintf("%d %d scale\n%d %d\ntrue\n", width, height,width, height); + gl2psPrintf("%d %d scale\n%d %d\ntrue\n", width, height,width, height); gl2psPrintf("[ %d 0 0 -%d 0 %d ] {<", width, height); for(i = 0; i < size; i++){ gl2psWriteByte(*imagemap); @@ -2657,7 +2657,7 @@ "%%%%LanguageLevel: 3\n" "%%%%DocumentData: Clean7Bit\n" "%%%%Pages: 1\n", - gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, + gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, gl2ps->producer, ctime(&now)); @@ -2666,18 +2666,18 @@ "%%%%DocumentMedia: Default %d %d 0 () ()\n", (gl2ps->options & GL2PS_LANDSCAPE) ? "Landscape" : "Portrait", (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[3] : - (int)gl2ps->viewport[2], - (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[2] : + (int)gl2ps->viewport[2], + (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[2] : (int)gl2ps->viewport[3]); } gl2psPrintf("%%%%BoundingBox: %d %d %d %d\n" "%%%%EndComments\n", - (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[1] : + (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[1] : (int)gl2ps->viewport[0], (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[0] : (int)gl2ps->viewport[1], - (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[3] : + (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[3] : (int)gl2ps->viewport[2], (gl2ps->options & GL2PS_LANDSCAPE) ? (int)gl2ps->viewport[2] : (int)gl2ps->viewport[3]); @@ -2725,7 +2725,7 @@ /* rotated text routines: same nameanem with R appended */ gl2psPrintf("/FCT { FC translate 0 0 } BD\n" - "/SR { gsave FCT moveto rotate show grestore } BD\n" + "/SR { gsave FCT moveto rotate show grestore } BD\n" "/SBCR{ gsave FCT moveto rotate SW -2 div 0 rmoveto show grestore } BD\n" "/SBRR{ gsave FCT moveto rotate SW neg 0 rmoveto show grestore } BD\n" "/SCLR{ gsave FCT moveto rotate 0 SH -2 div rmoveto show grestore} BD\n"); @@ -2740,7 +2740,7 @@ "/L { lineto } BD\n" "/LE { lineto stroke } BD\n" "/T { newpath moveto lineto lineto closepath fill } BD\n"); - + /* Smooth-shaded triangle with PostScript level 3 shfill operator: x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STshfill */ @@ -2794,11 +2794,11 @@ " 4 index 10 index add 0.5 mul\n" /* g12 = (g1+g2)/2 */ " 4 index 10 index add 0.5 mul\n" /* b12 = (b1+b2)/2 */ " 5 copy 5 copy 40 5 roll 25 5 roll 15 5 roll 25 5 roll\n"); - + /* stack = (V3) (V13) (V23) (V13) (V12) (V23) (V13) (V1) (V12) (V23) (V12) (V2) */ gl2psPrintf(" STnoshfill STnoshfill STnoshfill STnoshfill } BD\n"); - + /* Gouraud shaded triangle using recursive subdivision until the difference between corner colors does not exceed the thresholds: x3 y3 r3 g3 b3 x2 y2 r2 g2 b2 x1 y1 r1 g1 b1 STnoshfill */ @@ -2832,7 +2832,7 @@ " ifelse }\n" " ifelse }\n" " ifelse } BD\n"); - + gl2psPrintf("tryPS3shading\n" "{ /shfill where\n" " { /ST { STshfill } BD }\n" @@ -2849,7 +2849,7 @@ "%%%%EndSetup\n" "%%%%Page: 1 1\n" "%%%%BeginPageSetup\n"); - + if(gl2ps->options & GL2PS_LANDSCAPE){ gl2psPrintf("%d 0 translate 90 rotate\n", (int)gl2ps->viewport[3]); @@ -2859,14 +2859,14 @@ "mark\n" "gsave\n" "1.0 1.0 scale\n"); - + if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ gl2psPrintf("%g %g %g C\n" "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n" "closepath fill\n", - gl2ps->bgcolor[0], gl2ps->bgcolor[1], gl2ps->bgcolor[2], - (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], - (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3], + gl2ps->bgcolor[0], gl2ps->bgcolor[1], gl2ps->bgcolor[2], + (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], + (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3], (int)gl2ps->viewport[0], (int)gl2ps->viewport[3]); } } @@ -2896,7 +2896,7 @@ } } -static void gl2psParseStipplePattern(GLushort pattern, GLint factor, +static void gl2psParseStipplePattern(GLushort pattern, GLint factor, int *nb, int array[10]) { int i, n; @@ -2936,10 +2936,10 @@ if(pattern == gl2ps->lastpattern && factor == gl2ps->lastfactor) return 0; - + gl2ps->lastpattern = pattern; gl2ps->lastfactor = factor; - + if(!pattern || !factor){ /* solid line */ len += gl2psPrintf("[] 0 %s\n", str); @@ -2953,7 +2953,7 @@ } len += gl2psPrintf("] 0 %s\n", str); } - + return len; } @@ -2976,7 +2976,7 @@ switch(prim->type){ case GL2PS_POINT : gl2psPrintPostScriptColor(prim->verts[0].rgba); - gl2psPrintf("%g %g %g P\n", + gl2psPrintf("%g %g %g P\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1], 0.5 * prim->width); break; case GL2PS_LINE : @@ -3139,14 +3139,14 @@ gl2psPrintf("%g %g %g C\n" "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n" "closepath fill\n", - rgba[0], rgba[1], rgba[2], + rgba[0], rgba[1], rgba[2], x, y, x+w, y, x+w, y+h, x, y+h); } - + gl2psPrintf("newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto\n" "closepath clip\n", x, y, x+w, y, x+w, y+h, x, y+h); - + } static GLint gl2psPrintPostScriptEndViewport(void) @@ -3188,7 +3188,7 @@ "Encapsulated Postscript" }; -/********************************************************************* +/********************************************************************* * * LaTeX routines * @@ -3216,7 +3216,7 @@ time(&now); - fprintf(gl2ps->stream, + fprintf(gl2ps->stream, "%% Title: %s\n" "%% Creator: GL2PS %d.%d.%d%s, %s\n" "%% For: %s\n" @@ -3225,7 +3225,7 @@ GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, gl2ps->producer, ctime(&now)); - fprintf(gl2ps->stream, + fprintf(gl2ps->stream, "\\setlength{\\unitlength}{1pt}\n" "\\begin{picture}(0,0)\n" "\\includegraphics{%s}\n" @@ -3243,7 +3243,7 @@ switch(prim->type){ case GL2PS_TEXT : - fprintf(gl2ps->stream, "\\fontsize{%d}{0}\n\\selectfont", + fprintf(gl2ps->stream, "\\fontsize{%d}{0}\n\\selectfont", prim->data.text->fontsize); fprintf(gl2ps->stream, "\\put(%g,%g)", prim->verts[0].xyz[0], prim->verts[0].xyz[1]); @@ -3307,7 +3307,7 @@ static void gl2psPrintTeXBeginViewport(GLint viewport[4]) { glRenderMode(GL_FEEDBACK); - + if(gl2ps->header){ gl2psPrintTeXHeader(); gl2ps->header = GL_FALSE; @@ -3336,7 +3336,7 @@ "LaTeX text" }; -/********************************************************************* +/********************************************************************* * * PDF routines * @@ -3372,7 +3372,7 @@ static int gl2psPrintPDFFillColor(GL2PSrgba rgba) { int i, offs = 0; - + for(i = 0; i < 3; ++i){ if(GL2PS_ZERO(rgba[i])) offs += gl2psPrintf("%.0f ", 0.); @@ -3398,14 +3398,14 @@ static void gl2psPutPDFText(GL2PSstring *text, int cnt, GLfloat x, GLfloat y) { GLfloat rad, crad, srad; - + if(text->angle == 0.0F){ gl2ps->streamlength += gl2psPrintf ("BT\n" "/F%d %d Tf\n" "%f %f Td\n" "(%s) Tj\n" - "ET\n", + "ET\n", cnt, text->fontsize, x, y, text->str); } else{ @@ -3434,23 +3434,23 @@ static void gl2psPDFstacksInit(void) { - gl2ps->objects_stack = 7 /* FIXED_XREF_ENTRIES */ + 1; - gl2ps->extgs_stack = 0; - gl2ps->font_stack = 0; - gl2ps->im_stack = 0; - gl2ps->trgroupobjects_stack = 0; - gl2ps->shader_stack = 0; - gl2ps->mshader_stack = 0; + gl2ps->objects_stack = 7 /* FIXED_XREF_ENTRIES */ + 1; + gl2ps->extgs_stack = 0; + gl2ps->font_stack = 0; + gl2ps->im_stack = 0; + gl2ps->trgroupobjects_stack = 0; + gl2ps->shader_stack = 0; + gl2ps->mshader_stack = 0; } static void gl2psPDFgroupObjectInit(GL2PSpdfgroup *gro) { if(!gro) return; - + gro->ptrlist = NULL; - gro->fontno = gro->gsno = gro->imno = gro->maskshno = gro->shno - = gro->trgroupno = gro->fontobjno = gro->imobjno = gro->shobjno + gro->fontno = gro->gsno = gro->imno = gro->maskshno = gro->shno + = gro->trgroupno = gro->fontobjno = gro->imobjno = gro->shobjno = gro->maskshobjno = gro->gsobjno = gro->trgroupobjno = -1; } @@ -3475,7 +3475,7 @@ gl2ps->pdfgrouplist = gl2psListCreate(500, 500, sizeof(GL2PSpdfgroup)); gl2psInitTriangle(&lastt); - for(i = 0; i < gl2psListNbr(gl2ps->pdfprimlist); ++i){ + for(i = 0; i < gl2psListNbr(gl2ps->pdfprimlist); ++i){ p = *(GL2PSprimitive**)gl2psListPointer(gl2ps->pdfprimlist, i); switch(p->type){ case GL2PS_PIXMAP: @@ -3493,7 +3493,7 @@ gl2psListAdd(gl2ps->pdfgrouplist, &gro); break; case GL2PS_LINE: - if(lasttype != p->type || lastwidth != p->width || + if(lasttype != p->type || lastwidth != p->width || lastpattern != p->pattern || lastfactor != p->factor || !gl2psSameColor(p->verts[0].rgba, lastrgba)){ gl2psPDFgroupObjectInit(&gro); @@ -3512,7 +3512,7 @@ lastrgba[2] = p->verts[0].rgba[2]; break; case GL2PS_POINT: - if(lasttype != p->type || lastwidth != p->width || + if(lasttype != p->type || lastwidth != p->width || !gl2psSameColor(p->verts[0].rgba, lastrgba)){ gl2psPDFgroupObjectInit(&gro); gro.ptrlist = gl2psListCreate(1,2,sizeof(GL2PSprimitive*)); @@ -3529,10 +3529,10 @@ break; case GL2PS_TRIANGLE: gl2psFillTriangleFromPrimitive(&tmpt, p, GL_TRUE); - lastTriangleWasNotSimpleWithSameColor = + lastTriangleWasNotSimpleWithSameColor = !(tmpt.prop & T_CONST_COLOR && tmpt.prop & T_ALPHA_1) || !gl2psSameColor(tmpt.vertex[0].rgba, lastt.vertex[0].rgba); - if(lasttype == p->type && tmpt.prop == lastt.prop && + if(lasttype == p->type && tmpt.prop == lastt.prop && lastTriangleWasNotSimpleWithSameColor){ /* TODO Check here for last alpha */ gl2psListAdd(gro.ptrlist, &p); @@ -3547,7 +3547,7 @@ break; default: break; - } + } lasttype = p->type; } } @@ -3556,7 +3556,7 @@ { GL2PStriangle t; GL2PSprimitive *prim = NULL; - + if(!gro) return; @@ -3569,35 +3569,35 @@ return; gl2psFillTriangleFromPrimitive(&t, prim, GL_TRUE); - - if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_LESS_1){ - gro->gsno = gl2ps->extgs_stack++; + + if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_LESS_1){ + gro->gsno = gl2ps->extgs_stack++; gro->gsobjno = gl2ps->objects_stack ++; } - else if(t.prop & T_CONST_COLOR && t.prop & T_VAR_ALPHA){ + else if(t.prop & T_CONST_COLOR && t.prop & T_VAR_ALPHA){ gro->gsno = gl2ps->extgs_stack++; gro->gsobjno = gl2ps->objects_stack++; - gro->trgroupno = gl2ps->trgroupobjects_stack++; + gro->trgroupno = gl2ps->trgroupobjects_stack++; gro->trgroupobjno = gl2ps->objects_stack++; gro->maskshno = gl2ps->mshader_stack++; gro->maskshobjno = gl2ps->objects_stack++; } - else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_1){ + else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_1){ gro->shno = gl2ps->shader_stack++; gro->shobjno = gl2ps->objects_stack++; } - else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_LESS_1){ + else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_LESS_1){ gro->gsno = gl2ps->extgs_stack++; gro->gsobjno = gl2ps->objects_stack++; - gro->shno = gl2ps->shader_stack++; + gro->shno = gl2ps->shader_stack++; gro->shobjno = gl2ps->objects_stack++; } - else if(t.prop & T_VAR_COLOR && t.prop & T_VAR_ALPHA){ + else if(t.prop & T_VAR_COLOR && t.prop & T_VAR_ALPHA){ gro->gsno = gl2ps->extgs_stack++; gro->gsobjno = gl2ps->objects_stack++; - gro->shno = gl2ps->shader_stack++; + gro->shno = gl2ps->shader_stack++; gro->shobjno = gl2ps->objects_stack++; - gro->trgroupno = gl2ps->trgroupobjects_stack++; + gro->trgroupno = gl2ps->trgroupobjects_stack++; gro->trgroupobjno = gl2ps->objects_stack++; gro->maskshno = gl2ps->mshader_stack++; gro->maskshobjno = gl2ps->objects_stack++; @@ -3630,14 +3630,14 @@ gl2ps->streamlength += gl2psPrintf("1 J\n"); gl2ps->streamlength += gl2psPrintPDFLineWidth(prim->width); gl2ps->streamlength += gl2psPrintPDFStrokeColor(prim->verts[0].rgba); - for(j = 0; j <= lastel; ++j){ + for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2ps->streamlength += gl2psPrintf("%f %f m %f %f l\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1], prim->verts[0].xyz[0], prim->verts[0].xyz[1]); } - gl2ps->streamlength += gl2psPrintf("S\n"); + gl2ps->streamlength += gl2psPrintf("S\n"); gl2ps->streamlength += gl2psPrintf("0 J\n"); break; case GL2PS_LINE: @@ -3648,10 +3648,10 @@ gl2ps->streamlength += gl2psPrintPDFStrokeColor(prim->verts[0].rgba); gl2ps->streamlength += gl2psPrintPostScriptDash(prim->pattern, prim->factor, "d"); /* start new path */ - gl2ps->streamlength += - gl2psPrintf("%f %f m\n", + gl2ps->streamlength += + gl2psPrintf("%f %f m\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1]); - + for(j = 1; j <= lastel; ++j){ prev = prim; prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); @@ -3659,38 +3659,38 @@ /* the starting point of the new segment does not match the end point of the previous line, so we end the current path and start a new one */ - gl2ps->streamlength += - gl2psPrintf("%f %f l\n", + gl2ps->streamlength += + gl2psPrintf("%f %f l\n", prev->verts[1].xyz[0], prev->verts[1].xyz[1]); - gl2ps->streamlength += - gl2psPrintf("%f %f m\n", + gl2ps->streamlength += + gl2psPrintf("%f %f m\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1]); } else{ /* the two segements are connected, so we just append to the current path */ - gl2ps->streamlength += + gl2ps->streamlength += gl2psPrintf("%f %f l\n", prim->verts[0].xyz[0], prim->verts[0].xyz[1]); } } /* end last path */ - gl2ps->streamlength += - gl2psPrintf("%f %f l\n", + gl2ps->streamlength += + gl2psPrintf("%f %f l\n", prim->verts[1].xyz[0], prim->verts[1].xyz[1]); gl2ps->streamlength += gl2psPrintf("S\n"); break; case GL2PS_TRIANGLE: gl2psFillTriangleFromPrimitive(&t, prim, GL_TRUE); gl2psSortOutTrianglePDFgroup(gro); - + /* No alpha and const color: Simple PDF draw orders */ - if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_1){ - gl2ps->streamlength += gl2psPrintPDFFillColor(t.vertex[0].rgba); - for(j = 0; j <= lastel; ++j){ + if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_1){ + gl2ps->streamlength += gl2psPrintPDFFillColor(t.vertex[0].rgba); + for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE); - gl2ps->streamlength + gl2ps->streamlength += gl2psPrintf("%f %f m\n" "%f %f l\n" "%f %f l\n" @@ -3700,17 +3700,17 @@ t.vertex[2].xyz[0], t.vertex[2].xyz[1]); } } - /* Const alpha < 1 and const color: Simple PDF draw orders + /* Const alpha < 1 and const color: Simple PDF draw orders and an extra extended Graphics State for the alpha const */ - else if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_LESS_1){ + else if(t.prop & T_CONST_COLOR && t.prop & T_ALPHA_LESS_1){ gl2ps->streamlength += gl2psPrintf("q\n" "/GS%d gs\n", gro->gsno); gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba); - for(j = 0; j <= lastel; ++j){ + for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE); - gl2ps->streamlength + gl2ps->streamlength += gl2psPrintf("%f %f m\n" "%f %f l\n" "%f %f l\n" @@ -3721,19 +3721,19 @@ } gl2ps->streamlength += gl2psPrintf("Q\n"); } - /* Variable alpha and const color: Simple PDF draw orders - and an extra extended Graphics State + Xobject + Shader + /* Variable alpha and const color: Simple PDF draw orders + and an extra extended Graphics State + Xobject + Shader object for the alpha mask */ - else if(t.prop & T_CONST_COLOR && t.prop & T_VAR_ALPHA){ + else if(t.prop & T_CONST_COLOR && t.prop & T_VAR_ALPHA){ gl2ps->streamlength += gl2psPrintf("q\n" "/GS%d gs\n" "/TrG%d Do\n", gro->gsno, gro->trgroupno); gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba); - for(j = 0; j <= lastel; ++j){ + for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2psFillTriangleFromPrimitive(&t, prim, GL_FALSE); - gl2ps->streamlength + gl2ps->streamlength += gl2psPrintf("%f %f m\n" "%f %f l\n" "%f %f l\n" @@ -3746,23 +3746,23 @@ } /* Variable color and no alpha: Shader Object for the colored triangle(s) */ - else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_1){ + else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_1){ gl2ps->streamlength += gl2psPrintf("/Sh%d sh\n", gro->shno); } - /* Variable color and const alpha < 1: Shader Object for the - colored triangle(s) and an extra extended Graphics State + /* Variable color and const alpha < 1: Shader Object for the + colored triangle(s) and an extra extended Graphics State for the alpha const */ - else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_LESS_1){ + else if(t.prop & T_VAR_COLOR && t.prop & T_ALPHA_LESS_1){ gl2ps->streamlength += gl2psPrintf("q\n" "/GS%d gs\n" "/Sh%d sh\n" "Q\n", gro->gsno, gro->shno); } - /* Variable alpha and color: Shader Object for the colored - triangle(s) and an extra extended Graphics State + /* Variable alpha and color: Shader Object for the colored + triangle(s) and an extra extended Graphics State + Xobject + Shader object for the alpha mask */ - else if(t.prop & T_VAR_COLOR && t.prop & T_VAR_ALPHA){ + else if(t.prop & T_VAR_COLOR && t.prop & T_VAR_ALPHA){ gl2ps->streamlength += gl2psPrintf("q\n" "/GS%d gs\n" "/TrG%d Do\n" @@ -3774,12 +3774,12 @@ case GL2PS_PIXMAP: for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); - gl2psPutPDFImage(prim->data.image, gro->imno, prim->verts[0].xyz[0], + gl2psPutPDFImage(prim->data.image, gro->imno, prim->verts[0].xyz[0], prim->verts[0].xyz[1]); } break; case GL2PS_TEXT: - for(j = 0; j <= lastel; ++j){ + for(j = 0; j <= lastel; ++j){ prim = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2ps->streamlength += gl2psPrintPDFFillColor(prim->verts[0].rgba); gl2psPutPDFText(prim->data.text, gro->fontno, prim->verts[0].xyz[0], @@ -3788,7 +3788,7 @@ break; default: break; - } + } } } @@ -3801,15 +3801,15 @@ int i; offs += fprintf(gl2ps->stream, - "/ExtGState\n" + "/ExtGState\n" "<<\n" "/GSa 7 0 R\n"); - for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ - gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); if(gro->gsno >= 0) offs += fprintf(gl2ps->stream, "/GS%d %d 0 R\n", gro->gsno, gro->gsobjno); } - offs += fprintf(gl2ps->stream, ">>\n"); + offs += fprintf(gl2ps->stream, ">>\n"); return offs; } @@ -3824,14 +3824,14 @@ offs += fprintf(gl2ps->stream, "/Shading\n" "<<\n"); - for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ - gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); if(gro->shno >= 0) offs += fprintf(gl2ps->stream, "/Sh%d %d 0 R\n", gro->shno, gro->shobjno); if(gro->maskshno >= 0) offs += fprintf(gl2ps->stream, "/TrSh%d %d 0 R\n", gro->maskshno, gro->maskshobjno); } - offs += fprintf(gl2ps->stream,">>\n"); + offs += fprintf(gl2ps->stream,">>\n"); return offs; } @@ -3848,8 +3848,8 @@ "/XObject\n" "<<\n"); - for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ - gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); if(!gl2psListNbr(gro->ptrlist)) continue; p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0); @@ -3881,8 +3881,8 @@ offs += fprintf(gl2ps->stream, "/Font\n<<\n"); - for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ - gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); if(gro->fontno < 0) continue; gro->fontobjno = gl2ps->objects_stack++; @@ -3897,11 +3897,11 @@ { int i; GL2PSpdfgroup *gro = NULL; - + if(!gl2ps->pdfgrouplist) return; - for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist,i); gl2psListDelete(gro->ptrlist); } @@ -3917,10 +3917,10 @@ int offs; time_t now; struct tm *newtime; - + time(&now); newtime = gmtime(&now); - + offs = fprintf(gl2ps->stream, "1 0 obj\n" "<<\n" @@ -3930,20 +3930,20 @@ gl2ps->title, GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION, GL2PS_EXTRA_VERSION, GL2PS_COPYRIGHT, gl2ps->producer); - + if(!newtime){ - offs += fprintf(gl2ps->stream, + offs += fprintf(gl2ps->stream, ">>\n" "endobj\n"); return offs; } - - offs += fprintf(gl2ps->stream, + + offs += fprintf(gl2ps->stream, "/CreationDate (D:%d%02d%02d%02d%02d%02d)\n" ">>\n" "endobj\n", - newtime->tm_year+1900, - newtime->tm_mon+1, + newtime->tm_year+1900, + newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, @@ -3955,7 +3955,7 @@ static int gl2psPrintPDFCatalog(void) { - return fprintf(gl2ps->stream, + return fprintf(gl2ps->stream, "2 0 obj\n" "<<\n" "/Type /Catalog\n" @@ -3966,9 +3966,9 @@ static int gl2psPrintPDFPages(void) { - return fprintf(gl2ps->stream, + return fprintf(gl2ps->stream, "3 0 obj\n" - "<<\n" + "<<\n" "/Type /Pages\n" "/Kids [6 0 R]\n" "/Count 1\n" @@ -3981,13 +3981,13 @@ static int gl2psOpenPDFDataStream(void) { int offs = 0; - - offs += fprintf(gl2ps->stream, + + offs += fprintf(gl2ps->stream, "4 0 obj\n" - "<<\n" + "<<\n" "/Length 5 0 R\n" ); offs += gl2psPrintPDFCompressorType(); - offs += fprintf(gl2ps->stream, + offs += fprintf(gl2ps->stream, ">>\n" "stream\n"); return offs; @@ -4000,13 +4000,13 @@ int offs; offs = gl2psPrintf("/GSa gs\n"); - + if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ offs += gl2psPrintPDFFillColor(gl2ps->bgcolor); offs += gl2psPrintf("%d %d %d %d re\n", (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); - offs += gl2psPrintf("f\n"); + offs += gl2psPrintf("f\n"); } return offs; } @@ -4019,26 +4019,26 @@ gl2ps->pdfprimlist = gl2psListCreate(500, 500, sizeof(GL2PSprimitive*)); gl2psPDFstacksInit(); - gl2ps->xreflist = (int*)gl2psMalloc(sizeof(int) * gl2ps->objects_stack); + gl2ps->xreflist = (int*)gl2psMalloc(sizeof(int) * gl2ps->objects_stack); #if defined(GL2PS_HAVE_ZLIB) if(gl2ps->options & GL2PS_COMPRESS){ gl2psSetupCompress(); } -#endif +#endif gl2ps->xreflist[0] = 0; offs += fprintf(gl2ps->stream, "%%PDF-1.4\n"); gl2ps->xreflist[1] = offs; - + offs += gl2psPrintPDFInfo(); gl2ps->xreflist[2] = offs; - + offs += gl2psPrintPDFCatalog(); gl2ps->xreflist[3] = offs; - + offs += gl2psPrintPDFPages(); gl2ps->xreflist[4] = offs; - + offs += gl2psOpenPDFDataStream(); gl2ps->xreflist[5] = offs; /* finished in gl2psPrintPDFFooter */ gl2ps->streamlength = gl2psOpenPDFDataStreamWritePreface(); @@ -4050,7 +4050,7 @@ { GL2PSprimitive *prim = *(GL2PSprimitive**)data; - if((gl2ps->options & GL2PS_OCCLUSION_CULL) && prim->culled) + if((gl2ps->options & GL2PS_OCCLUSION_CULL) && prim->culled) return; prim = gl2psCopyPrimitive(prim); /* deep copy */ @@ -4062,7 +4062,7 @@ static int gl2psClosePDFDataStream(void) { int offs = 0; - + #if defined(GL2PS_HAVE_ZLIB) if(gl2ps->options & GL2PS_COMPRESS){ if(Z_OK != gl2psDeflate()) @@ -4070,13 +4070,13 @@ else fwrite(gl2ps->compress->dest, gl2ps->compress->destLen, 1, gl2ps->stream); gl2ps->streamlength += gl2ps->compress->destLen; - + offs += gl2ps->streamlength; gl2psFreeCompress(); } -#endif - - offs += fprintf(gl2ps->stream, +#endif + + offs += fprintf(gl2ps->stream, "endstream\n" "endobj\n"); return offs; @@ -4097,27 +4097,27 @@ static int gl2psPrintPDFOpenPage(void) { int offs; - + /* Write fixed part */ - - offs = fprintf(gl2ps->stream, + + offs = fprintf(gl2ps->stream, "6 0 obj\n" - "<<\n" + "<<\n" "/Type /Page\n" "/Parent 3 0 R\n" "/MediaBox [%d %d %d %d]\n", (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); - + if(gl2ps->options & GL2PS_LANDSCAPE) offs += fprintf(gl2ps->stream, "/Rotate -90\n"); - + offs += fprintf(gl2ps->stream, "/Contents 4 0 R\n" - "/Resources\n" - "<<\n" + "/Resources\n" + "<<\n" "/ProcSet [/PDF /Text /ImageB /ImageC] %%/ImageI\n"); - + return offs; /* End fixed part, proceeds in gl2psPDFgroupListWriteVariableResources() */ @@ -4126,19 +4126,19 @@ static int gl2psPDFgroupListWriteVariableResources(void) { int offs = 0; - + /* a) Graphics States for shader alpha masks*/ - offs += gl2psPDFgroupListWriteGStateResources(); - - /* b) Shader and shader masks */ - offs += gl2psPDFgroupListWriteShaderResources(); - + offs += gl2psPDFgroupListWriteGStateResources(); + + /* b) Shader and shader masks */ + offs += gl2psPDFgroupListWriteShaderResources(); + /* c) XObjects (Images & Shader Masks) */ offs += gl2psPDFgroupListWriteXObjectResources(); - + /* d) Fonts */ offs += gl2psPDFgroupListWriteFontResources(); - + /* End resources and page */ offs += fprintf(gl2ps->stream, ">>\n" @@ -4169,10 +4169,10 @@ /* Put vertex' edge flag (8bit) and coordinates (32bit) in shader stream */ -static int gl2psPrintPDFShaderStreamDataCoord(GL2PSvertex *vertex, - size_t (*action)(unsigned long data, - size_t size), - GLfloat dx, GLfloat dy, +static int gl2psPrintPDFShaderStreamDataCoord(GL2PSvertex *vertex, + size_t (*action)(unsigned long data, + size_t size), + GLfloat dx, GLfloat dy, GLfloat xmin, GLfloat ymin) { int offs = 0; @@ -4188,7 +4188,7 @@ /* The Shader stream in PDF requires to be in a 'big-endian' order */ - + if(GL2PS_ZERO(dx * dy)){ offs += (*action)(0, 4); offs += (*action)(0, 4); @@ -4201,7 +4201,7 @@ diff = 0.0F; imap = (unsigned long)(diff * dmax); offs += (*action)(imap, 4); - + diff = (vertex->xyz[1] - ymin) / dy; if(diff > 1) diff = 1.0F; @@ -4210,14 +4210,14 @@ imap = (unsigned long)(diff * dmax); offs += (*action)(imap, 4); } - + return offs; } /* Put vertex' rgb value (8bit for every component) in shader stream */ static int gl2psPrintPDFShaderStreamDataRGB(GL2PSvertex *vertex, - size_t (*action)(unsigned long data, + size_t (*action)(unsigned long data, size_t size)) { int offs = 0; @@ -4229,20 +4229,20 @@ imap = (unsigned long)((vertex->rgba[0]) * dmax); offs += (*action)(imap, 1); - + imap = (unsigned long)((vertex->rgba[1]) * dmax); offs += (*action)(imap, 1); - + imap = (unsigned long)((vertex->rgba[2]) * dmax); offs += (*action)(imap, 1); - + return offs; } /* Put vertex' alpha (8/16bit) in shader stream */ -static int gl2psPrintPDFShaderStreamDataAlpha(GL2PSvertex *vertex, - size_t (*action)(unsigned long data, +static int gl2psPrintPDFShaderStreamDataAlpha(GL2PSvertex *vertex, + size_t (*action)(unsigned long data, size_t size), int sigbyte) { @@ -4255,48 +4255,48 @@ if(sigbyte != 8 && sigbyte != 16) sigbyte = 8; - + sigbyte /= 8; - + imap = (unsigned long)((vertex->rgba[3]) * dmax); - + offs += (*action)(imap, sigbyte); - + return offs; } /* Put a triangles raw data in shader stream */ -static int gl2psPrintPDFShaderStreamData(GL2PStriangle *triangle, - GLfloat dx, GLfloat dy, +static int gl2psPrintPDFShaderStreamData(GL2PStriangle *triangle, + GLfloat dx, GLfloat dy, GLfloat xmin, GLfloat ymin, - size_t (*action)(unsigned long data, + size_t (*action)(unsigned long data, size_t size), int gray) { int i, offs = 0; GL2PSvertex v; - + if(gray && gray != 8 && gray != 16) gray = 8; - + for(i = 0; i < 3; ++i){ offs += gl2psPrintPDFShaderStreamDataCoord(&triangle->vertex[i], action, dx, dy, xmin, ymin); - if(gray){ + if(gray){ v = triangle->vertex[i]; - offs += gl2psPrintPDFShaderStreamDataAlpha(&v, action, gray); + offs += gl2psPrintPDFShaderStreamDataAlpha(&v, action, gray); } else{ offs += gl2psPrintPDFShaderStreamDataRGB(&triangle->vertex[i], action); } } - + return offs; } -static void gl2psPDFRectHull(GLfloat *xmin, GLfloat *xmax, - GLfloat *ymin, GLfloat *ymax, +static void gl2psPDFRectHull(GLfloat *xmin, GLfloat *xmax, + GLfloat *ymin, GLfloat *ymax, GL2PStriangle *triangles, int cnt) { int i, j; @@ -4305,7 +4305,7 @@ *xmax = triangles[0].vertex[0].xyz[0]; *ymin = triangles[0].vertex[0].xyz[1]; *ymax = triangles[0].vertex[0].xyz[1]; - + for(i = 0; i < cnt; ++i){ for(j = 0; j < 3; ++j){ if(*xmin > triangles[i].vertex[j].xyz[0]) @@ -4320,17 +4320,17 @@ } } -/* Writes shaded triangle +/* Writes shaded triangle gray == 0 means write RGB triangles gray == 8 8bit-grayscale (for alpha masks) gray == 16 16bit-grayscale (for alpha masks) */ -static int gl2psPrintPDFShader(int obj, GL2PStriangle *triangles, +static int gl2psPrintPDFShader(int obj, GL2PStriangle *triangles, int size, int gray) { int i, offs = 0, vertexbytes, done = 0; GLfloat xmin, xmax, ymin, ymax; - + switch(gray){ case 0: vertexbytes = 1+4+4+1+1+1; @@ -4346,9 +4346,9 @@ vertexbytes = 1+4+4+1; break; } - + gl2psPDFRectHull(&xmin, &xmax, &ymin, &ymax, triangles, size); - + offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<< " @@ -4359,18 +4359,18 @@ "/BitsPerFlag 8 " "/Decode [%f %f %f %f 0 1 %s] ", obj, - (gray) ? "/DeviceGray" : "/DeviceRGB", + (gray) ? "/DeviceGray" : "/DeviceRGB", (gray) ? gray : 8, xmin, xmax, ymin, ymax, (gray) ? "" : "0 1 0 1"); - + #if defined(GL2PS_HAVE_ZLIB) if(gl2ps->options & GL2PS_COMPRESS){ gl2psAllocCompress(vertexbytes * size * 3); for(i = 0; i < size; ++i) gl2psPrintPDFShaderStreamData(&triangles[i], - xmax-xmin, ymax-ymin, xmin, ymin, + xmax-xmin, ymax-ymin, xmin, ymin, gl2psWriteBigEndianCompress, gray); if(Z_OK == gl2psDeflate() && 23 + gl2ps->compress->destLen < gl2ps->compress->srcLen){ @@ -4380,8 +4380,8 @@ ">>\n" "stream\n", (int)gl2ps->compress->destLen); - offs += gl2ps->compress->destLen * fwrite(gl2ps->compress->dest, - gl2ps->compress->destLen, + offs += gl2ps->compress->destLen * fwrite(gl2ps->compress->dest, + gl2ps->compress->destLen, 1, gl2ps->stream); done = 1; } @@ -4402,11 +4402,11 @@ xmax-xmin, ymax-ymin, xmin, ymin, gl2psWriteBigEndian, gray); } - + offs += fprintf(gl2ps->stream, "\nendstream\n" "endobj\n"); - + return offs; } @@ -4415,7 +4415,7 @@ static int gl2psPrintPDFShaderMask(int obj, int childobj) { int offs = 0, len; - + offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<<\n" @@ -4427,11 +4427,11 @@ obj, (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], (int)gl2ps->viewport[2], (int)gl2ps->viewport[3]); - - len = (childobj>0) + + len = (childobj>0) ? strlen("/TrSh sh\n") + (int)log10((double)childobj)+1 - : strlen("/TrSh0 sh\n"); - + : strlen("/TrSh0 sh\n"); + offs += fprintf(gl2ps->stream, "/Length %d\n" ">>\n" @@ -4443,7 +4443,7 @@ offs += fprintf(gl2ps->stream, "endstream\n" "endobj\n"); - + return offs; } @@ -4454,16 +4454,16 @@ static int gl2psPrintPDFShaderExtGS(int obj, int childobj) { int offs = 0; - + offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<<\n", obj); - + offs += fprintf(gl2ps->stream, "/SMask << /S /Alpha /G %d 0 R >> ", childobj); - + offs += fprintf(gl2ps->stream, ">>\n" "endobj\n"); @@ -4475,7 +4475,7 @@ static int gl2psPrintPDFShaderSimpleExtGS(int obj, GLfloat alpha) { int offs = 0; - + offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<<\n" @@ -4489,8 +4489,8 @@ /* Similar groups of functions for pixmaps and text */ static int gl2psPrintPDFPixmapStreamData(GL2PSimage *im, - size_t (*action)(unsigned long data, - size_t size), + size_t (*action)(unsigned long data, + size_t size), int gray) { int x, y, shift; @@ -4503,7 +4503,7 @@ gray = 8; gray /= 8; - + shift = (sizeof(unsigned long) - 1) * 8; for(y = 0; y < im->height; ++y){ @@ -4534,10 +4534,10 @@ if(gray && gray !=8 && gray != 16) gray = 8; - + if(gray) - sigbytes = gray / 8; - + sigbytes = gray / 8; + offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<<\n" @@ -4555,13 +4555,13 @@ "/SMask %d 0 R\n", childobj); } - + #if defined(GL2PS_HAVE_ZLIB) if(gl2ps->options & GL2PS_COMPRESS){ gl2psAllocCompress((int)(im->width * im->height * sigbytes)); - + gl2psPrintPDFPixmapStreamData(im, gl2psWriteBigEndianCompress, gray); - + if(Z_OK == gl2psDeflate() && 23 + gl2ps->compress->destLen < gl2ps->compress->srcLen){ offs += gl2psPrintPDFCompressorType(); offs += fprintf(gl2ps->stream, @@ -4576,7 +4576,7 @@ gl2psFreeCompress(); } #endif - + if(!done){ /* no compression, or too long after compression, or compress error -> write non-compressed entry */ @@ -4587,18 +4587,18 @@ (int)(im->width * im->height * sigbytes)); offs += gl2psPrintPDFPixmapStreamData(im, gl2psWriteBigEndian, gray); } - + offs += fprintf(gl2ps->stream, "\nendstream\n" "endobj\n"); - + return offs; } static int gl2psPrintPDFText(int obj, GL2PSstring *s, int fontnumber) { int offs = 0; - + offs += fprintf(gl2ps->stream, "%d 0 obj\n" "<<\n" @@ -4626,9 +4626,9 @@ if(!gl2ps->pdfgrouplist) return offs; - - for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ - gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); + + for(i = 0; i < gl2psListNbr(gl2ps->pdfgrouplist); ++i){ + gro = (GL2PSpdfgroup*)gl2psListPointer(gl2ps->pdfgrouplist, i); if(!gl2psListNbr(gro->ptrlist)) continue; p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, 0); @@ -4640,7 +4640,7 @@ case GL2PS_TRIANGLE: size = gl2psListNbr(gro->ptrlist); triangles = (GL2PStriangle*)gl2psMalloc(sizeof(GL2PStriangle) * size); - for(j = 0; j < size; ++j){ + for(j = 0; j < size; ++j){ p = *(GL2PSprimitive**)gl2psListPointer(gro->ptrlist, j); gl2psFillTriangleFromPrimitive(&triangles[j], p, GL_TRUE); } @@ -4682,7 +4682,7 @@ break; default: break; - } + } } return offs; } @@ -4693,29 +4693,29 @@ static void gl2psPrintPDFFooter(void) { - int i, offs; + int i, offs; gl2psPDFgroupListInit(); gl2psPDFgroupListWriteMainStream(); - - offs = gl2ps->xreflist[5] + gl2ps->streamlength; + + offs = gl2ps->xreflist[5] + gl2ps->streamlength; offs += gl2psClosePDFDataStream(); gl2ps->xreflist[5] = offs; - + offs += gl2psPrintPDFDataStreamLength(gl2ps->streamlength); gl2ps->xreflist[6] = offs; gl2ps->streamlength = 0; - + offs += gl2psPrintPDFOpenPage(); offs += gl2psPDFgroupListWriteVariableResources(); gl2ps->xreflist = (int*)gl2psRealloc(gl2ps->xreflist, sizeof(int) * (gl2ps->objects_stack + 1)); gl2ps->xreflist[7] = offs; - + offs += gl2psPrintPDFGSObject(); gl2ps->xreflist[8] = offs; - - gl2ps->xreflist[gl2ps->objects_stack] = + + gl2ps->xreflist[gl2ps->objects_stack] = gl2psPDFgroupListWriteObjects(gl2ps->xreflist[8]); /* Start cross reference table. The file has to been opened in @@ -4724,13 +4724,13 @@ "xref\n" "0 %d\n" "%010d 65535 f \n", gl2ps->objects_stack, 0); - + for(i = 1; i < gl2ps->objects_stack; ++i) fprintf(gl2ps->stream, "%010d 00000 n \n", gl2ps->xreflist[i]); - + fprintf(gl2ps->stream, "trailer\n" - "<<\n" + "<<\n" "/Size %d\n" "/Info 1 0 R\n" "/Root 2 0 R\n" @@ -4738,13 +4738,13 @@ "startxref\n%d\n" "%%%%EOF\n", gl2ps->objects_stack, gl2ps->xreflist[gl2ps->objects_stack]); - - /* Free auxiliary lists and arrays */ + + /* Free auxiliary lists and arrays */ gl2psFree(gl2ps->xreflist); gl2psListAction(gl2ps->pdfprimlist, gl2psFreePrimitive); gl2psListDelete(gl2ps->pdfprimlist); gl2psPDFgroupListDelete(); - + #if defined(GL2PS_HAVE_ZLIB) if(gl2ps->options & GL2PS_COMPRESS){ gl2psFreeCompress(); @@ -4762,16 +4762,16 @@ GLint index; GLfloat rgba[4]; int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3]; - + glRenderMode(GL_FEEDBACK); - + if(gl2ps->header){ gl2psPrintPDFHeader(); gl2ps->header = GL_FALSE; } offs += gl2psPrintf("q\n"); - + if(gl2ps->options & GL2PS_DRAW_BACKGROUND){ if(gl2ps->colormode == GL_RGBA || gl2ps->colorsize == 0){ glGetFloatv(GL_COLOR_CLEAR_VALUE, rgba); @@ -4791,18 +4791,18 @@ } else{ offs += gl2psPrintf("%d %d %d %d re\n" - "W\n" + "W\n" "n\n", - x, y, w, h); - } - + x, y, w, h); + } + gl2ps->streamlength += offs; } static GLint gl2psPrintPDFEndViewport(void) { GLint res; - + res = gl2psPrintPrimitives(); gl2ps->streamlength += gl2psPrintf("Q\n"); return res; @@ -4825,13 +4825,13 @@ "Portable Document Format" }; -/********************************************************************* +/********************************************************************* * * SVG routines * *********************************************************************/ -static void gl2psSVGGetCoordsAndColors(int n, GL2PSvertex *verts, +static void gl2psSVGGetCoordsAndColors(int n, GL2PSvertex *verts, GL2PSxyz *xyz, GL2PSrgba *rgba) { int i, j; @@ -4861,9 +4861,9 @@ int x, y, width, height; char col[32]; time_t now; - + time(&now); - + if (gl2ps->options & GL2PS_LANDSCAPE){ x = (int)gl2ps->viewport[1]; y = (int)gl2ps->viewport[0]; @@ -4876,10 +4876,10 @@ width = (int)gl2ps->viewport[2]; height = (int)gl2ps->viewport[3]; } - + /* Compressed SVG files (.svgz) are simply gzipped SVG files */ gl2psPrintGzipHeader(); - + gl2psPrintf("\n"); gl2psPrintf("options & GL2PS_DRAW_BACKGROUND){ gl2psSVGGetColorString(gl2ps->bgcolor, col); gl2psPrintf("\n", col, - (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], - (int)gl2ps->viewport[2], (int)gl2ps->viewport[1], - (int)gl2ps->viewport[2], (int)gl2ps->viewport[3], + (int)gl2ps->viewport[0], (int)gl2ps->viewport[1], + (int)gl2ps->viewport[2], (int)gl2ps->viewport[1], + (int)gl2ps->viewport[2], (int)gl2ps->viewport[3], (int)gl2ps->viewport[0], (int)gl2ps->viewport[3]); } @@ -4924,52 +4924,52 @@ gl2psSVGGetColorString(rgba[0], col); gl2psPrintf("\n", xyz[0][0], xyz[0][1], + gl2psPrintf("points=\"%g,%g %g,%g %g,%g\"/>\n", xyz[0][0], xyz[0][1], xyz[1][0], xyz[1][1], xyz[2][0], xyz[2][1]); } else{ /* subdivide into 4 subtriangles */ for(i = 0; i < 3; i++){ - xyz2[0][i] = xyz[0][i]; + xyz2[0][i] = xyz[0][i]; xyz2[1][i] = 0.5F * (xyz[0][i] + xyz[1][i]); xyz2[2][i] = 0.5F * (xyz[0][i] + xyz[2][i]); } for(i = 0; i < 4; i++){ - rgba2[0][i] = rgba[0][i]; + rgba2[0][i] = rgba[0][i]; rgba2[1][i] = 0.5F * (rgba[0][i] + rgba[1][i]); rgba2[2][i] = 0.5F * (rgba[0][i] + rgba[2][i]); } gl2psPrintSVGSmoothTriangle(xyz2, rgba2); for(i = 0; i < 3; i++){ xyz2[0][i] = 0.5F * (xyz[0][i] + xyz[1][i]); - xyz2[1][i] = xyz[1][i]; + xyz2[1][i] = xyz[1][i]; xyz2[2][i] = 0.5F * (xyz[1][i] + xyz[2][i]); } for(i = 0; i < 4; i++){ rgba2[0][i] = 0.5F * (rgba[0][i] + rgba[1][i]); - rgba2[1][i] = rgba[1][i]; + rgba2[1][i] = rgba[1][i]; rgba2[2][i] = 0.5F * (rgba[1][i] + rgba[2][i]); } gl2psPrintSVGSmoothTriangle(xyz2, rgba2); for(i = 0; i < 3; i++){ xyz2[0][i] = 0.5F * (xyz[0][i] + xyz[2][i]); - xyz2[1][i] = xyz[2][i]; + xyz2[1][i] = xyz[2][i]; xyz2[2][i] = 0.5F * (xyz[1][i] + xyz[2][i]); } for(i = 0; i < 4; i++){ rgba2[0][i] = 0.5F * (rgba[0][i] + rgba[2][i]); - rgba2[1][i] = rgba[2][i]; + rgba2[1][i] = rgba[2][i]; rgba2[2][i] = 0.5F * (rgba[1][i] + rgba[2][i]); } gl2psPrintSVGSmoothTriangle(xyz2, rgba2); for(i = 0; i < 3; i++){ xyz2[0][i] = 0.5F * (xyz[0][i] + xyz[1][i]); - xyz2[1][i] = 0.5F * (xyz[1][i] + xyz[2][i]); + xyz2[1][i] = 0.5F * (xyz[1][i] + xyz[2][i]); xyz2[2][i] = 0.5F * (xyz[0][i] + xyz[2][i]); } for(i = 0; i < 4; i++){ rgba2[0][i] = 0.5F * (rgba[0][i] + rgba[1][i]); - rgba2[1][i] = 0.5F * (rgba[1][i] + rgba[2][i]); + rgba2[1][i] = 0.5F * (rgba[1][i] + rgba[2][i]); rgba2[2][i] = 0.5F * (rgba[0][i] + rgba[2][i]); } gl2psPrintSVGSmoothTriangle(xyz2, rgba2); @@ -4995,7 +4995,7 @@ { int i; if(gl2ps->lastvertex.rgba[0] >= 0.){ - gl2psPrintf("%g,%g\"/>\n", gl2ps->lastvertex.xyz[0], + gl2psPrintf("%g,%g\"/>\n", gl2ps->lastvertex.xyz[0], gl2ps->viewport[3] - gl2ps->lastvertex.xyz[1]); for(i = 0; i < 3; i++) gl2ps->lastvertex.xyz[i] = -1.; @@ -5017,7 +5017,7 @@ file), we need to encode the pixmap into PNG in memory, then encode it into base64. */ - png = gl2psListCreate(pixmap->width * pixmap->height * 3, 1000, + png = gl2psListCreate(pixmap->width * pixmap->height * 3, 1000, sizeof(unsigned char)); gl2psConvertPixmapToPNG(pixmap, png); gl2psListEncodeBase64(png); @@ -5086,7 +5086,7 @@ gl2ps->lastfactor = prim->factor; if(newline){ gl2psSVGGetColorString(rgba[0], col); - gl2psPrintf("width); if(rgba[0][3] < 1.0F) gl2psPrintf("stroke-opacity=\"%g\" ", rgba[0][3]); gl2psPrintSVGDash(prim->pattern, prim->factor); @@ -5186,8 +5186,8 @@ static void gl2psPrintSVGFooter(void) { gl2psPrintf("\n"); - gl2psPrintf("\n"); - + gl2psPrintf("\n"); + gl2psPrintGzipFooter(); } @@ -5199,7 +5199,7 @@ int x = viewport[0], y = viewport[1], w = viewport[2], h = viewport[3]; glRenderMode(GL_FEEDBACK); - + if(gl2ps->header){ gl2psPrintSVGHeader(); gl2ps->header = GL_FALSE; @@ -5217,18 +5217,18 @@ rgba[3] = 1.0F; } gl2psSVGGetColorString(rgba, col); - gl2psPrintf("\n", col, - x, gl2ps->viewport[3] - y, - x + w, gl2ps->viewport[3] - y, - x + w, gl2ps->viewport[3] - (y + h), + gl2psPrintf("\n", col, + x, gl2ps->viewport[3] - y, + x + w, gl2ps->viewport[3] - y, + x + w, gl2ps->viewport[3] - (y + h), x, gl2ps->viewport[3] - (y + h)); } gl2psPrintf("\n", x, y, w, h); - gl2psPrintf(" \n", - x, gl2ps->viewport[3] - y, - x + w, gl2ps->viewport[3] - y, - x + w, gl2ps->viewport[3] - (y + h), + gl2psPrintf(" \n", + x, gl2ps->viewport[3] - y, + x + w, gl2ps->viewport[3] - y, + x + w, gl2ps->viewport[3] - (y + h), x, gl2ps->viewport[3] - (y + h)); gl2psPrintf("\n"); gl2psPrintf("\n", x, y, w, h); @@ -5282,7 +5282,7 @@ time(&now); - fprintf(gl2ps->stream, + fprintf(gl2ps->stream, "%% Title: %s\n" "%% Creator: GL2PS %d.%d.%d%s, %s\n" "%% For: %s\n" @@ -5336,7 +5336,7 @@ case GL2PS_TEXT_T : return "north"; case GL2PS_TEXT_TL : return "north west"; case GL2PS_TEXT_TR : return "north east"; - case GL2PS_TEXT_BL : + case GL2PS_TEXT_BL : default : return "south west"; } } @@ -5351,7 +5351,7 @@ case GL2PS_POINT : /* Points in openGL are rectangular */ gl2psPrintPGFColor(prim->verts[0].rgba); - fprintf(gl2ps->stream, + fprintf(gl2ps->stream, "\\pgfpathrectangle{\\pgfpoint{%fpt}{%fpt}}" "{\\pgfpoint{%fpt}{%fpt}}\n\\pgfusepath{fill}\n", prim->verts[0].xyz[0]-0.5*prim->width, @@ -5365,7 +5365,7 @@ fprintf(gl2ps->stream, "\\pgfsetlinewidth{%fpt}\n", gl2ps->lastlinewidth); } gl2psPrintPGFDash(prim->pattern, prim->factor); - fprintf(gl2ps->stream, + fprintf(gl2ps->stream, "\\pgfpathmoveto{\\pgfpoint{%fpt}{%fpt}}\n" "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n" "\\pgfusepath{stroke}\n", @@ -5378,7 +5378,7 @@ fprintf(gl2ps->stream, "\\pgfsetlinewidth{0.01pt}\n"); } gl2psPrintPGFColor(prim->verts[0].rgba); - fprintf(gl2ps->stream, + fprintf(gl2ps->stream, "\\pgfpathmoveto{\\pgfpoint{%fpt}{%fpt}}\n" "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n" "\\pgflineto{\\pgfpoint{%fpt}{%fpt}}\n" @@ -5447,14 +5447,14 @@ rgba[3] = 1.0F; } gl2psPrintPGFColor(rgba); - fprintf(gl2ps->stream, + fprintf(gl2ps->stream, "\\pgfpathrectangle{\\pgfpoint{%dpt}{%dpt}}" "{\\pgfpoint{%dpt}{%dpt}}\n" "\\pgfusepath{fill}\n", x, y, w, h); } - - fprintf(gl2ps->stream, + + fprintf(gl2ps->stream, "\\pgfpathrectangle{\\pgfpoint{%dpt}{%dpt}}" "{\\pgfpoint{%dpt}{%dpt}}\n" "\\pgfusepath{clip}\n", @@ -5486,7 +5486,7 @@ "PGF Latex Graphics" }; -/********************************************************************* +/********************************************************************* * * General primitive printing routine * @@ -5521,7 +5521,7 @@ if(prim->verts[i].xyz[1] > gl2ps->viewport[3]) gl2ps->viewport[3] = (GLint)(prim->verts[i].xyz[1] + 0.5F); } -} +} static GLint gl2psPrintPrimitives(void) { @@ -5542,7 +5542,7 @@ gl2psRescaleAndOffset(); if(gl2ps->header){ - if(gl2psListNbr(gl2ps->primitives) && + if(gl2psListNbr(gl2ps->primitives) && (gl2ps->options & GL2PS_TIGHT_BOUNDING_BOX)){ gl2ps->viewport[0] = gl2ps->viewport[1] = 100000; gl2ps->viewport[2] = gl2ps->viewport[3] = -100000; @@ -5584,7 +5584,7 @@ gl2psAddInImageTree, 1); gl2psFreeBspImageTree(&gl2ps->imagetree); } - gl2psTraverseBspTree(root, eye, GL2PS_EPSILON, gl2psGreater, + gl2psTraverseBspTree(root, eye, GL2PS_EPSILON, gl2psGreater, gl2psbackends[gl2ps->format]->printPrimitive, 0); gl2psFreeBspTree(&root); /* reallocate the primitive list (it's been deleted by @@ -5597,13 +5597,13 @@ return GL2PS_SUCCESS; } -/********************************************************************* +/********************************************************************* * * Public routines * *********************************************************************/ -GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, +GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, GLint viewport[4], GLint format, GLint sort, GLint options, GLint colormode, GLint colorsize, GL2PSrgba *colormap, @@ -5671,7 +5671,7 @@ if(!gl2ps->viewport[2] || !gl2ps->viewport[3]){ gl2psMsg(GL2PS_ERROR, "Incorrect viewport (x=%d, y=%d, width=%d, height=%d)", - gl2ps->viewport[0], gl2ps->viewport[1], + gl2ps->viewport[0], gl2ps->viewport[1], gl2ps->viewport[2], gl2ps->viewport[3]); gl2psFree(gl2ps); gl2ps = NULL; @@ -5695,11 +5695,11 @@ gl2ps->lastfactor = 0; gl2ps->imagetree = NULL; gl2ps->primitivetoadd = NULL; - gl2ps->zerosurfacearea = GL_FALSE; + gl2ps->zerosurfacearea = GL_FALSE; gl2ps->pdfprimlist = NULL; gl2ps->pdfgrouplist = NULL; gl2ps->xreflist = NULL; - + /* get default blending mode from current OpenGL state (enabled by default for SVG) */ gl2ps->blending = (gl2ps->format == GL2PS_SVG) ? GL_TRUE : glIsEnabled(GL_BLEND); @@ -5742,7 +5742,7 @@ gl2ps->title = (char*)gl2psMalloc((strlen(title)+1)*sizeof(char)); strcpy(gl2ps->title, title); } - + if(!producer){ gl2ps->producer = (char*)gl2psMalloc(sizeof(char)); gl2ps->producer[0] = '\0'; @@ -5751,7 +5751,7 @@ gl2ps->producer = (char*)gl2psMalloc((strlen(producer)+1)*sizeof(char)); strcpy(gl2ps->producer, producer); } - + if(!filename){ gl2ps->filename = (char*)gl2psMalloc(sizeof(char)); gl2ps->filename[0] = '\0'; @@ -5765,7 +5765,7 @@ gl2ps->auxprimitives = gl2psListCreate(100, 100, sizeof(GL2PSprimitive*)); gl2ps->feedback = (GLfloat*)gl2psMalloc(gl2ps->buffersize * sizeof(GLfloat)); glFeedbackBuffer(gl2ps->buffersize, GL_3D_COLOR, gl2ps->feedback); - glRenderMode(GL_FEEDBACK); + glRenderMode(GL_FEEDBACK); return GL2PS_SUCCESS; } @@ -5780,7 +5780,7 @@ if(res != GL2PS_OVERFLOW) (gl2psbackends[gl2ps->format]->printFooter)(); - + fflush(gl2ps->stream); gl2psListDelete(gl2ps->primitives); @@ -5802,7 +5802,7 @@ if(!gl2ps) return GL2PS_UNINITIALIZED; (gl2psbackends[gl2ps->format]->beginViewport)(viewport); - + return GL2PS_SUCCESS; } @@ -5820,7 +5820,7 @@ return res; } -GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, +GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, GLshort fontsize, GLint alignment, GLfloat angle) { return gl2psAddText(GL2PS_TEXT, str, fontname, fontsize, alignment, angle); @@ -5838,7 +5838,7 @@ GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, GLint xorig, GLint yorig, - GLenum format, GLenum type, + GLenum format, GLenum type, const void *pixels) { int size, i; @@ -5899,7 +5899,7 @@ prim->data.image->pixels[i] = *piv; if(!((i + 1) % 3)) ++piv; - } + } } else{ size = height * width * 4; @@ -5926,11 +5926,11 @@ const unsigned char *imagemap){ int size, i; int sizeoffloat = sizeof(GLfloat); - + if(!gl2ps || !imagemap) return GL2PS_UNINITIALIZED; if((width <= 0) || (height <= 0)) return GL2PS_ERROR; - + size = height + height * ((width - 1) / 8); glPassThrough(GL2PS_IMAGEMAP_TOKEN); glBegin(GL_POINTS); @@ -6010,7 +6010,7 @@ glPassThrough(GL2PS_POINT_SIZE_TOKEN); glPassThrough(value); - + return GL2PS_SUCCESS; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/gl2ps.h --- a/src/gl2ps.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/gl2ps.h Thu Jan 20 17:24:59 2011 -0500 @@ -139,9 +139,9 @@ #define GL2PS_BLEND 4 /* Text alignment (o=raster position; default mode is BL): - +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o - | o | o | | o | | | | | | | | | | | | - +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+ + +---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o + | o | o | | o | | | | | | | | | | | | + +---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+ C CL CR B BL BR T TL TR */ #define GL2PS_TEXT_C 1 @@ -160,10 +160,10 @@ extern "C" { #endif -GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, +GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, GLint viewport[4], GLint format, GLint sort, GLint options, GLint colormode, - GLint colorsize, GL2PSrgba *colormap, + GLint colorsize, GL2PSrgba *colormap, GLint nr, GLint ng, GLint nb, GLint buffersize, FILE *stream, const char *filename); GL2PSDLL_API GLint gl2psEndPage(void); @@ -171,9 +171,9 @@ GL2PSDLL_API GLint gl2psGetOptions(GLint *options); GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]); GL2PSDLL_API GLint gl2psEndViewport(void); -GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, +GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname, GLshort fontsize); -GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, +GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname, GLshort fontsize, GLint align, GLfloat angle); GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str); GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height, diff -r 1473d0cf86d2 -r 12df7854fa7c src/graphics.cc --- a/src/graphics.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/graphics.cc Thu Jan 20 17:24:59 2011 -0500 @@ -337,7 +337,7 @@ double f = 0.0; - // FIXME -- this assumes the system font is Helvetica 10pt + // FIXME -- this assumes the system font is Helvetica 10pt // (for which "x" requires 6x12 pixels at 74.951 pixels/inch) f = 12.0 * res / 74.951; @@ -666,7 +666,7 @@ { double e = double (data[i]); - // Don't need to test for NaN here as NaN>x and NaNx and NaN (go.get_properties ()); @@ -1220,11 +1220,11 @@ p != children_list.end (); p++) retval(k++) = *p; } - + return retval; } -void +void children_property::do_delete_children (bool clear) { for (children_list_iterator p = children_list.begin (); @@ -1422,7 +1422,7 @@ error ("addproperty: unsupported type for dynamic property (= %s)", type.c_str ()); } - + return retval; } @@ -1603,7 +1603,7 @@ m.assign (prefix + q->first, q->second); } - return m; + return m; } graphics_handle::graphics_handle (const octave_value& a) @@ -1862,7 +1862,7 @@ if (p != handle_map.end ()) { base_properties& bp = p->second.get_properties (); - + bp.set_beingdeleted (true); bp.delete_children (); @@ -1876,7 +1876,7 @@ if (toolkit) toolkit.finalize (p->second); - // Note: this will be valid only for first explicitly + // Note: this will be valid only for first explicitly // deleted object. All its children will then have an // unknown graphics toolkit. @@ -1941,7 +1941,7 @@ if (h.ok ()) { graphics_object obj = gh_manager::get_object (h); - + graphics_handle parent_h = obj.get_parent (); graphics_object parent_obj = gh_manager::get_object (parent_h); @@ -2280,7 +2280,7 @@ } void -base_properties::delete_listener (const caseless_str& nm, +base_properties::delete_listener (const caseless_str& nm, const octave_value& v, listener_mode mode) { property p = get_property (nm); @@ -2477,7 +2477,7 @@ if (valid_object ()) { octave_map m = get ().map_value (); - + for (octave_map::const_iterator pa = m.begin (); pa != m.end (); pa++) { if (pa->first != "children") @@ -2486,7 +2486,7 @@ if (p.ok () && ! p.is_hidden ()) { - retval += "\n\t" + std::string (pa->first) + ": "; + retval += "\n\t" + std::string (pa->first) + ": "; if (p.is_radio ()) retval += p.values_as_string (); } @@ -2509,7 +2509,7 @@ if (valid_object ()) { octave_scalar_map m = get ().scalar_map_value (); - + for (octave_scalar_map::const_iterator pa = m.begin (); pa != m.end (); pa++) { @@ -2650,7 +2650,7 @@ graphics_handle cf = gh_manager::current_figure (); xset (0, "currentfigure", cf.value ()); - + base_properties::remove_child (gh); } @@ -2667,7 +2667,7 @@ { const property_list::pval_map_type pval_map = p->second; std::string prefix = p->first; - + for (property_list::pval_map_const_iterator q = pval_map.begin (); q != pval_map.end (); q++) @@ -2676,8 +2676,8 @@ if (prefix == "axes" && (s == "position" || s == "units")) new_defaults.set (prefix + s, q->second); - else if (prefix == "figure" && (s == "position" || s == "units" - || s == "windowstyle" + else if (prefix == "figure" && (s == "position" || s == "units" + || s == "windowstyle" || s == "paperunits")) new_defaults.set (prefix + s, q->second); } @@ -2853,14 +2853,14 @@ static Matrix papersize_from_type (const caseless_str punits, const caseless_str typ) -{ +{ Matrix ret (1, 2, 1.0); if (! punits.compare ("normalized")) { double in2units; double mm2units; - + if (punits.compare ("inches")) { in2units = 1.0; @@ -3003,7 +3003,7 @@ ret (1) = 43.0 * in2units; } } - + return ret; } @@ -3012,7 +3012,7 @@ { Matrix pos = get_paperposition ().matrix_value (); Matrix sz = get_papersize ().matrix_value (); - + pos (0) = pos (0) / sz(0); pos (1) = pos (1) / sz(1); pos (2) = pos (2) / sz(0); @@ -3063,7 +3063,7 @@ caseless_str typ = get_papertype (); if (! typ.compare ("")) - // Call papersize.set rather than set_papersize to avoid loops between + // Call papersize.set rather than set_papersize to avoid loops between // update_papersize and update_papertype papersize.set (octave_value (papersize_from_type (get_paperunits (), typ))); } @@ -3202,7 +3202,7 @@ xset (ylabel.handle_value (), "rotationmode", "auto"); xset (zlabel.handle_value (), "visible", "off"); - + xset (xlabel.handle_value (), "clipping", "off"); xset (ylabel.handle_value (), "clipping", "off"); xset (zlabel.handle_value (), "clipping", "off"); @@ -3214,7 +3214,7 @@ adopt (title.handle_value ()); } -void +void axes::properties::sync_positions (void) { #if 0 @@ -3350,11 +3350,11 @@ xlim = tlim; ylim = tlim; zlim = tlim; - + Matrix cl (1, 2, 0); cl(1) = 1; clim = cl; - + xlimmode = "auto"; ylimmode = "auto"; zlimmode = "auto"; @@ -3471,7 +3471,7 @@ xset (ylabel.handle_value (), "rotationmode", "auto"); xset (zlabel.handle_value (), "visible", "off"); - + xset (xlabel.handle_value (), "clipping", "off"); xset (ylabel.handle_value (), "clipping", "off"); xset (zlabel.handle_value (), "clipping", "off"); @@ -3687,9 +3687,9 @@ double xo = xlimits(xd > 0 ? 0 : 1); double yo = ylimits(yd > 0 ? 0 : 1); double zo = zlimits(zd > 0 ? 0 : 1); - + Matrix pb = get_plotboxaspectratio ().matrix_value (); - + bool autocam = (camerapositionmode_is ("auto") && cameratargetmode_is ("auto") && cameraupvectormode_is ("auto") @@ -3700,7 +3700,7 @@ ColumnVector c_eye (xform_vector ()); ColumnVector c_center (xform_vector ()); ColumnVector c_upv (xform_vector ()); - + if (cameratargetmode_is ("auto")) { c_center(0) = (xlimits(0)+xlimits(1))/2; @@ -3711,7 +3711,7 @@ } else c_center = cam2xform (get_cameratarget ().matrix_value ()); - + if (camerapositionmode_is ("auto")) { Matrix tview = get_view ().matrix_value (); @@ -3762,7 +3762,7 @@ Matrix x_viewport = xform_matrix (); Matrix x_normrender = xform_matrix (); Matrix x_pre = xform_matrix (); - + x_render = xform_matrix (); x_render_inv = xform_matrix (); @@ -3774,7 +3774,7 @@ xform (c_eye, x_pre); xform (c_center, x_pre); - scale (c_upv, pb(0)/(xlimits(1)-xlimits(0)), pb(1)/(ylimits(1)-ylimits(0)), + scale (c_upv, pb(0)/(xlimits(1)-xlimits(0)), pb(1)/(ylimits(1)-ylimits(0)), pb(2)/(zlimits(1)-zlimits(0))); translate (c_center, -c_eye(0), -c_eye(1), -c_eye(2)); @@ -4365,7 +4365,7 @@ return retval; } -void +void axes::properties::calc_ticks_and_lims (array_property& lims, array_property& ticks, bool limmode_is_auto, bool is_logscale) @@ -4378,7 +4378,7 @@ double lo = (lims.get ().matrix_value ()) (0); double hi = (lims.get ().matrix_value ()) (1); // FIXME should this be checked for somewhere else? (i.e. set{x,y,z}lim) - if (hi < lo) + if (hi < lo) { double tmp = hi; hi = lo; @@ -4404,7 +4404,7 @@ tmp_lims(0) = tick_sep * i1; tmp_lims(1) = tick_sep * i2; - if (is_logscale) + if (is_logscale) { tmp_lims(0) = std::pow (10.,tmp_lims(0)); tmp_lims(1) = std::pow (10.,tmp_lims(1)); @@ -4419,9 +4419,9 @@ i1 = static_cast (std::ceil (lo / tick_sep)); i2 = static_cast (gnulib::floor (hi / tick_sep)); } - + Matrix tmp_ticks (1, i2-i1+1); - for (int i = 0; i <= i2-i1; i++) + for (int i = 0; i <= i2-i1; i++) { tmp_ticks (i) = tick_sep * (i+i1); if (is_logscale) @@ -4484,7 +4484,7 @@ } } break; - + case 'z': for (octave_idx_type i = 0; i < n; i++) { @@ -4498,7 +4498,7 @@ } } break; - + case 'c': for (octave_idx_type i = 0; i < n; i++) { @@ -4512,7 +4512,7 @@ } } break; - + case 'a': for (octave_idx_type i = 0; i < n; i++) { @@ -4542,7 +4542,7 @@ return; Matrix kids = Matrix (1, 1, h.value ()); - + double min_val = octave_Inf; double max_val = -octave_Inf; double min_pos = octave_Inf; @@ -4583,7 +4583,7 @@ FIX_LIMITS ; get_children_limits (min_val, max_val, min_pos, kids, 'x'); - + limits = xproperties.get_axis_limits (min_val, max_val, min_pos, xproperties.xscale_is ("log")); @@ -4749,7 +4749,7 @@ if (xproperties.xlimmode_is ("auto")) { get_children_limits (min_val, max_val, min_pos, kids, 'x'); - + limits = xproperties.get_axis_limits (min_val, max_val, min_pos, xproperties.xscale_is ("log")); @@ -4885,7 +4885,7 @@ else if (x > upper) { return upper; } else - { return x; } + { return x; } } void @@ -4895,7 +4895,7 @@ // FIXME: Do we need error checking here? Matrix xlims = get_xlim ().matrix_value (); Matrix ylims = get_ylim ().matrix_value (); - + // Get children axes limits Matrix kids = get_children (); double minx = octave_Inf; @@ -4907,13 +4907,13 @@ double maxy = -octave_Inf; double min_pos_y = octave_Inf; get_children_limits (miny, maxy, min_pos_y, kids, 'y'); - + // Perform the zooming xlims (0) = x + factor * (xlims (0) - x); xlims (1) = x + factor * (xlims (1) - x); ylims (0) = y + factor * (ylims (0) - y); ylims (1) = y + factor * (ylims (1) - y); - + zoom (xlims, ylims, push_to_zoom_stack); } @@ -4927,7 +4927,7 @@ zoom_stack.push_front (ylimmode.get ()); zoom_stack.push_front (ylim.get ()); } - + xlim = xl; xlimmode = "manual"; ylim = yl; @@ -4944,24 +4944,24 @@ // FIXME: Do we need error checking here? Matrix xlims = get_xlim ().matrix_value (); Matrix ylims = get_ylim ().matrix_value (); - + // Get children axes limits Matrix kids = get_children (); double minx = octave_Inf; double maxx = -octave_Inf; double min_pos_x = octave_Inf; get_children_limits (minx, maxx, min_pos_x, kids, 'x'); - + double miny = octave_Inf; double maxy = -octave_Inf; double min_pos_y = octave_Inf; get_children_limits (miny, maxy, min_pos_y, kids, 'y'); - + xlims (0) += delta_x; xlims (1) += delta_x; ylims (0) += delta_y; ylims (1) += delta_y; - + zoom (xlims, ylims, false); } @@ -5091,7 +5091,7 @@ halign = 1; else if (horizontalalignment_is ("right")) halign = 2; - + if (verticalalignment_is ("top")) valign = 2; else if (verticalalignment_is ("baseline")) @@ -5256,7 +5256,7 @@ // --------------------------------------------------------------------- -void +void hggroup::properties::update_limits (void) const { graphics_object obj = gh_manager::get_object (__myhandle__); @@ -5271,7 +5271,7 @@ } } -void +void hggroup::properties::update_limits (const graphics_handle& h) const { graphics_object obj = gh_manager::get_object (__myhandle__); @@ -5296,7 +5296,7 @@ return; Matrix kids = Matrix (1, 1, h.value ()); - + double min_val = octave_Inf; double max_val = -octave_Inf; double min_pos = octave_Inf; @@ -5412,7 +5412,7 @@ if (axis_type == "xlim" || axis_type == "xliminclude") { get_children_limits (min_val, max_val, min_pos, kids, 'x'); - + update_type = 'x'; } else if (axis_type == "ylim" || axis_type == "yliminclude") @@ -5520,7 +5520,7 @@ base_graphics_object *go = 0; go = make_graphics_object_from_type (go_name, h, p); - + if (go) { graphics_object obj (go); @@ -5555,7 +5555,7 @@ graphics_toolkit toolkit = go->get_toolkit (); if (toolkit) toolkit.initialize (obj); - + return h; } @@ -5731,7 +5731,7 @@ if (true) { gh_manager::autolock guard; - + callback_objects.push_front (get_object (h)); xset_gcbo (h); } @@ -5773,7 +5773,7 @@ if (fcn && ! error_state) feval (fcn, args); - + END_INTERRUPT_WITH_EXCEPTIONS; } @@ -5858,7 +5858,7 @@ if (callback_objects.empty () || force) { e = event_queue.front (); - + event_queue.pop_front (); } else @@ -5954,7 +5954,7 @@ if (! error_state) { // loop over graphics objects - for (octave_idx_type n = 0; n < hcv.length (); n++) + for (octave_idx_type n = 0; n < hcv.length (); n++) gh_manager::get_object (hcv(n)).reset_default_properties (); } } @@ -6013,7 +6013,7 @@ bool request_drawnow = false; // loop over graphics objects - for (octave_idx_type n = 0; n < hcv.length (); n++) + for (octave_idx_type n = 0; n < hcv.length (); n++) { graphics_object obj = gh_manager::get_object (hcv(n)); @@ -6522,7 +6522,7 @@ if (! h.ok ()) { - error ("delete: invalid graphics object (= %g)", + error ("delete: invalid graphics object (= %g)", vals.elem (i)); break; } @@ -6543,17 +6543,17 @@ { graphics_handle parent_h = obj.get_parent (); - graphics_object parent_obj = + graphics_object parent_obj = gh_manager::get_object (parent_h); // NOTE: free the handle before removing it from its - // parent's children, such that the object's + // parent's children, such that the object's // state is correct when the deletefcn callback // is executed gh_manager::free (h); - // A callback function might have already deleted + // A callback function might have already deleted // the parent if (parent_obj.valid_object ()) parent_obj.remove_child (h); @@ -6716,7 +6716,7 @@ { image::properties& ip = dynamic_cast (fobj.get_properties ()); - + Matrix dp = Matrix (1, 2, 0); dp(0, 0) = ip.pixel_xsize (); dp(0, 1) = ip.pixel_ysize (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/graphics.h.in --- a/src/graphics.h.in Thu Jan 20 17:21:27 2011 -0500 +++ b/src/graphics.h.in Thu Jan 20 17:24:59 2011 -0500 @@ -177,7 +177,7 @@ error ("invalid axis scale"); return d; } - + virtual double unscale (double d) const { error ("invalid axis scale"); @@ -351,7 +351,7 @@ // Sets property value, notifies graphics toolkit. // If do_run is true, runs associated listeners. bool set (const octave_value& v, bool do_run = true); - + virtual octave_value get (void) const { error ("get: invalid property \"%s\"", name.c_str ()); @@ -383,7 +383,7 @@ l.resize (l.length () + 1, v); } - void delete_listener (const octave_value& v = octave_value (), + void delete_listener (const octave_value& v = octave_value (), listener_mode mode = POSTSET) { octave_value_list& l = listeners[mode]; @@ -496,10 +496,10 @@ enum desired_enum { string_t, cell_t }; string_array_property (const std::string& s, const graphics_handle& h, - const std::string& val = "", const char& sep = '|', + const std::string& val = "", const char& sep = '|', const desired_enum& typ = string_t) : base_property (s, h), desired_type (typ), separator (sep) - { + { size_t pos = 0; while (true) @@ -518,11 +518,11 @@ } } - string_array_property (const std::string& s, const graphics_handle& h, - const Cell& c, const char& sep = '|', + string_array_property (const std::string& s, const graphics_handle& h, + const Cell& c, const char& sep = '|', const desired_enum& typ = string_t) : base_property (s, h), desired_type (typ), separator (sep) - { + { if (c.is_cellstr ()) { string_vector strings (c.numel ()); @@ -542,15 +542,15 @@ separator (p.separator), str (p.str) { } octave_value get (void) const - { + { if (desired_type == string_t) return octave_value (string_value ()); else return octave_value (cell_value ()); } - std::string string_value (void) const - { + std::string string_value (void) const + { std::string s; for (octave_idx_type i = 0; i < str.length (); i++) @@ -692,7 +692,7 @@ return retval; } - + bool contains (const std::string& val) { return (possible_vals.find (val) != possible_vals.end ()); @@ -701,7 +701,7 @@ std::string values_as_string (void) const; Cell values_as_cell (void) const; - + octave_idx_type nelem (void) const { return possible_vals.size (); } private: @@ -738,7 +738,7 @@ std::string values_as_string (void) const { return vals.values_as_string (); } Cell values_as_cell (void) const { return vals.values_as_cell (); } - + bool is (const caseless_str& v) const { return v.compare (current_val); } @@ -753,7 +753,7 @@ base_property* clone (void) const { return new radio_property (*this); } protected: - bool do_set (const octave_value& newval) + bool do_set (const octave_value& newval) { if (newval.is_string ()) { @@ -770,7 +770,7 @@ error ("set: invalid value for radio property \"%s\" (value = %s)", get_name ().c_str (), s.c_str ()); } - else + else error ("set: invalid value for radio property \"%s\"", get_name ().c_str ()); return false; @@ -877,7 +877,7 @@ current_type (radio_t), color_val (color_values ()), radio_val (v), current_val (radio_val.default_value ()) { } - + color_property (const std::string& nm, const graphics_handle& h, const color_property& v) : base_property (nm, h), @@ -934,7 +934,7 @@ std::string values_as_string (void) const { return radio_val.values_as_string (); } Cell values_as_cell (void) const { return radio_val.values_as_cell (); } - + protected: OCTINTERP_API bool do_set (const octave_value& newval); @@ -1115,7 +1115,7 @@ Matrix get_limits (void) const { Matrix m (1, 3); - + m(0) = min_val (); m(1) = max_val (); m(2) = min_pos (); @@ -1135,7 +1135,7 @@ p->type_constraints = type_constraints; p->size_constraints = size_constraints; - + return p; } @@ -1157,7 +1157,7 @@ else error ("invalid value for array property \"%s\"", get_name ().c_str ()); - + return false; } @@ -1277,7 +1277,7 @@ : radio_property (p) { } bool is_on (void) const { return is ("on"); } - + bool_property& operator = (const octave_value& val) { set (val); @@ -1371,13 +1371,13 @@ class children_property : public base_property { -public: +public: children_property (void) : base_property ("", graphics_handle ()) { do_init_children (Matrix ()); } - + children_property (const std::string& nm, const graphics_handle& h, const Matrix &val) : base_property (nm, h) @@ -1386,7 +1386,7 @@ } children_property (const children_property& p) - : base_property (p) + : base_property (p) { do_init_children (p.children_list); } @@ -1403,17 +1403,17 @@ { return do_remove_child (val); } - + void adopt (const double &val) { do_adopt_child (val); } - + Matrix get_children (void) const { return do_get_children (false); } - + Matrix get_hidden (void) const { return do_get_children (true); @@ -1423,17 +1423,17 @@ { return do_get_all_children (); } - + octave_value get (void) const { return octave_value (get_children ()); } - + void delete_children (bool clear = false) { do_delete_children (clear); } - + private: typedef std::list::iterator children_list_iterator; typedef std::list::const_iterator const_children_list_iterator; @@ -1512,7 +1512,7 @@ { Matrix retval (children_list.size (), 1); octave_idx_type i = 0; - + for (const_children_list_iterator p = children_list.begin (); p != children_list.end (); p++) retval(i++) = *p; @@ -1537,7 +1537,7 @@ { children_list.push_front (val); } - + void do_delete_children (bool clear); }; @@ -1560,7 +1560,7 @@ OCTINTERP_API void execute (const octave_value& data = octave_value ()) const; bool is_defined (void) const - { + { return (callback.is_defined () && ! callback.is_empty ()); } @@ -1668,7 +1668,7 @@ { if (rep && --rep->count <= 0) delete rep; - + rep = p.rep; rep->count++; @@ -1678,7 +1678,7 @@ void add_listener (const octave_value& v, listener_mode mode = POSTSET) { rep->add_listener (v, mode); } - void delete_listener (const octave_value& v = octave_value (), + void delete_listener (const octave_value& v = octave_value (), listener_mode mode = POSTSET) { rep->delete_listener (v, mode); } @@ -1708,7 +1708,7 @@ const bool_property& as_bool_property (void) const { return *(dynamic_cast (rep)); } - + const handle_property& as_handle_property (void) const { return *(dynamic_cast (rep)); } */ @@ -1724,7 +1724,7 @@ public: typedef std::map pval_map_type; typedef std::map plist_map_type; - + typedef pval_map_type::iterator pval_map_iterator; typedef pval_map_type::const_iterator pval_map_const_iterator; @@ -1801,7 +1801,7 @@ gripe_invalid ("get_screen_resolution"); return 72.0; } - + virtual Matrix get_screen_size (void) const { gripe_invalid ("get_screen_size"); @@ -1815,7 +1815,7 @@ { gripe_invalid ("base_graphics_toolkit::update"); } void update (const graphics_handle&, int); - + // Callback function executed when the given graphics object is // created. This allows the graphics toolkit to do toolkit-specific // initializations for a newly created object. @@ -1891,7 +1891,7 @@ void redraw_figure (const graphics_object& go) const { rep->redraw_figure (go); } - + void print_figure (const graphics_object& go, const std::string& term, const std::string& file, bool mono, const std::string& debug_file = "") const @@ -1909,26 +1909,26 @@ // Notifies graphics toolkit that object't property has changed. void update (const graphics_object& go, int id) { rep->update (go, id); } - + void update (const graphics_handle& h, int id) { rep->update (h, id); } // Notifies graphics toolkit that new object was created. void initialize (const graphics_object& go) { rep->initialize (go); } - + void initialize (const graphics_handle& h) { rep->initialize (h); } - + // Notifies graphics toolkit that object was destroyed. // This is called only for explicitly deleted object. Children are // deleted implicitly and graphics toolkit isn't notified. void finalize (const graphics_object& go) { rep->finalize (go); } - + void finalize (const graphics_handle& h) { rep->finalize (h); } - + OCTINTERP_API static graphics_toolkit default_toolkit (void); static void register_toolkit (const graphics_toolkit& b) @@ -1952,7 +1952,7 @@ Cell m (1 , available_toolkits.size ()); const_available_toolkits_iterator p; int i; - + for (i = 0, p = available_toolkits.begin (); p != available_toolkits.end (); p++, i++) m(i) = p->first; @@ -2029,7 +2029,7 @@ } bool is_modified (void) const { return is___modified__ (); } - + virtual void remove_child (const graphics_handle& h) { if (children.remove_child (h.value ())) @@ -2063,9 +2063,9 @@ { return children.get_children (); } - - Matrix get_all_children (void) const - { + + Matrix get_all_children (void) const + { return children.get_all (); } @@ -2092,7 +2092,7 @@ { children.delete_children (clear); } - + static property_list::pval_map_type factory_defaults (void); // FIXME -- these functions should be generated automatically by the @@ -2123,7 +2123,7 @@ protected: std::set dynamic_properties; - + void set_dynamic (const caseless_str& pname, const octave_value& val); octave_value get_dynamic (const caseless_str& pname) const; @@ -2159,7 +2159,7 @@ END_PROPERTIES protected: - struct cmp_caseless_str + struct cmp_caseless_str { bool operator () (const caseless_str &a, const caseless_str &b) const { @@ -2177,7 +2177,7 @@ protected: void insert_static_property (const std::string& name, base_property& p) { insert_property (name, property (&p, true)); } - + virtual void init (void) { } }; @@ -2556,34 +2556,34 @@ octave_value get_ylim (void) const { return get_properties ().get_ylim (); } - + octave_value get_zlim (void) const { return get_properties ().get_zlim (); } - + octave_value get_clim (void) const { return get_properties ().get_clim (); } - + octave_value get_alim (void) const { return get_properties ().get_alim (); } bool is_xliminclude (void) const { return get_properties ().is_xliminclude (); } - + bool is_yliminclude (void) const { return get_properties ().is_yliminclude (); } - + bool is_zliminclude (void) const { return get_properties ().is_zliminclude (); } - + bool is_climinclude (void) const { return get_properties ().is_climinclude (); } - + bool is_aliminclude (void) const { return get_properties ().is_aliminclude (); } bool is_handle_visible (void) const { return get_properties ().is_handle_visible (); } - + graphics_toolkit get_toolkit (void) const { return rep->get_toolkit (); } void add_property_listener (const std::string& nm, const octave_value& v, @@ -2610,7 +2610,7 @@ { public: void remove_child (const graphics_handle& h); - + // See the genprops.awk script for an explanation of the // properties declarations. @@ -2766,11 +2766,11 @@ return toolkit; } - void set_toolkit (const graphics_toolkit& b) - { + void set_toolkit (const graphics_toolkit& b) + { if (toolkit) toolkit.finalize (__myhandle__); - toolkit = b; + toolkit = b; __graphics_toolkit__ = b.get_name (); __plot_stream__ = Matrix (); mark_modified (); @@ -2865,7 +2865,7 @@ callback_property buttondownfcn , Matrix () string_property __graphics_toolkit__ s , "gnuplot" END_PROPERTIES - + protected: void init (void) { @@ -2893,7 +2893,7 @@ ~figure (void) { - xproperties.delete_children (); + xproperties.delete_children (); } void override_defaults (base_graphics_object& obj) @@ -2993,10 +2993,10 @@ ColumnVector transform (double x, double y, double z, bool use_scale = true) const; - + ColumnVector untransform (double x, double y, double z, bool use_scale = true) const; - + ColumnVector untransform (double x, double y, bool use_scale = true) const { return untransform (x, y, (zlim(0)+zlim(1))/2, use_scale); } @@ -3293,7 +3293,7 @@ void calc_ticklabels (const array_property& ticks, any_property& labels, bool is_logscale); void fix_limits (array_property& lims) { - if (lims.get ().is_empty ()) + if (lims.get ().is_empty ()) return; Matrix l = lims.get ().matrix_value (); @@ -3309,11 +3309,11 @@ l(1) += 0.5; lims = l; } - } + } public: Matrix get_axis_limits (double xmin, double xmax, double min_pos, bool logscale); - + void update_xlim (bool do_clr_zoom = true) { if (xtickmode.is ("auto")) @@ -3351,7 +3351,7 @@ zoom_stack.clear (); } - + }; private: @@ -3479,7 +3479,7 @@ Matrix compute_ylim (void) const; void update_xdata (void) { set_xlim (compute_xlim ()); } - + void update_ydata (void) { set_ylim (compute_ylim ()); } void update_zdata (void) @@ -3684,13 +3684,13 @@ private: void update_xdata (void) - { + { Matrix limits = xdata.get_limits (); float dp = pixel_xsize (); limits(0) = limits(0) - dp; limits(1) = limits(1) + dp; - set_xlim (limits); + set_xlim (limits); } void update_ydata (void) @@ -3700,7 +3700,7 @@ limits(0) = limits(0) - dp; limits(1) = limits(1) + dp; - set_ylim (limits); + set_ylim (limits); } void update_cdata (void) @@ -3768,7 +3768,7 @@ { public: octave_value get_color_data (void) const; - + bool is_climinclude (void) const { return (climinclude.is_on () && cdatamapping.is ("scaled")); } std::string get_climinclude (void) const @@ -3848,7 +3848,7 @@ void update_xdata (void) { set_xlim (xdata.get_limits ()); } void update_ydata (void) { set_ylim (ydata.get_limits ()); } void update_zdata (void) { set_zlim (zdata.get_limits ()); } - + void update_cdata (void) { if (cdatamapping_is ("scaled")) @@ -3975,7 +3975,7 @@ update_normals (); set_xlim (xdata.get_limits ()); } - + void update_ydata (void) { update_normals (); @@ -4159,7 +4159,7 @@ const base_properties& get_properties (void) const { return xproperties; } bool valid_object (void) const { return true; } - + }; // --------------------------------------------------------------------- @@ -4526,7 +4526,7 @@ } void do_lock (void) { graphics_lock.lock (); } - + void do_unlock (void) { graphics_lock.unlock (); } void do_execute_callback (const graphics_handle& h, const octave_value& cb, diff -r 1473d0cf86d2 -r 12df7854fa7c src/help.cc --- a/src/help.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/help.cc Thu Jan 20 17:24:59 2011 -0500 @@ -295,14 +295,14 @@ @deftypefn {Keyword} {} end_try_catch\n\ Mark the end of an @code{try-catch} block.\n\ @seealso{try, catch}\n\ -@end deftypefn"), +@end deftypefn"), pair_type ("end_unwind_protect", "-*- texinfo -*-\n\ @deftypefn {Keyword} {} end_unwind_protect\n\ Mark the end of an unwind_protect block.\n\ @seealso{unwind_protect}\n\ -@end deftypefn"), +@end deftypefn"), pair_type ("endfor", "-*- texinfo -*-\n\ @@ -474,7 +474,7 @@ recommended to use the lasterr function to re-throw the error after cleanup\n\ is completed).\n\ @seealso{catch,unwind_protect}\n\ -@end deftypefn"), +@end deftypefn"), pair_type ("until", "-*- texinfo -*-\n\ @@ -495,14 +495,14 @@ unwind_protect_cleanup will be run with or without an error in the\n\ unwind_protect block).\n\ @seealso{unwind_protect_cleanup,try}\n\ -@end deftypefn"), +@end deftypefn"), pair_type ("unwind_protect_cleanup", "-*- texinfo -*-\n\ @deftypefn {Keyword} {} unwind_protect_cleanup\n\ Begin the cleanup section of an unwind_protect block.\n\ @seealso{unwind_protect}\n\ -@end deftypefn"), +@end deftypefn"), pair_type ("varargin", "-*- texinfo -*-\n\ @@ -592,7 +592,7 @@ const size_t p1 = msg.find ('\n'); std::string t = msg.substr (0, p1); const size_t p2 = t.find ("= 0) @@ -758,7 +758,7 @@ COUNT_TOK_AND_RETURN (METAQUERY); } - } + } %{ // Function handles and superclass references @@ -776,7 +776,7 @@ lexer_flags.at_beginning_of_statement = false; COUNT_TOK_AND_RETURN ('@'); - + } %{ @@ -810,7 +810,7 @@ %{ // Single quote can either be the beginning of a string or a transpose -// operator. +// operator. %} "'" { @@ -846,7 +846,7 @@ %{ // Gobble comments. -%} +%} {CCHAR} { LEXER_DEBUG ("{CCHAR}"); @@ -1510,22 +1510,22 @@ yylval.tok_val = new token (token::while_end, l, c); lexer_flags.at_beginning_of_statement = true; break; - + case endclassdef_kw: yylval.tok_val = new token (token::classdef_end, l, c); lexer_flags.at_beginning_of_statement = true; break; - + case endevents_kw: yylval.tok_val = new token (token::events_end, l, c); lexer_flags.at_beginning_of_statement = true; break; - + case endmethods_kw: yylval.tok_val = new token (token::methods_end, l, c); lexer_flags.at_beginning_of_statement = true; break; - + case endproperties_kw: yylval.tok_val = new token (token::properties_end, l, c); lexer_flags.at_beginning_of_statement = true; @@ -1555,7 +1555,7 @@ break; case get_kw: - case set_kw: + case set_kw: // 'get' and 'set' are keywords in classdef method // declarations. if (! lexer_flags.maybe_classdef_get_set_method) @@ -1574,7 +1574,7 @@ case classdef_kw: // 'classdef' is always a keyword. promptflag--; - break; + break; case function_kw: promptflag--; @@ -1807,7 +1807,7 @@ at_bol = false; begin_comment = false; } - } + } if (in_comment) { @@ -1879,7 +1879,7 @@ int getc (void) { return ::text_yyinput (); } int ungetc (int c) { ::xunput (c, buf); return 0; } - + private: char *buf; }; @@ -2567,11 +2567,11 @@ c = text_yyinput (); if (c == delim) { - buf << static_cast (c); + buf << static_cast (c); } else { - std::string s; + std::string s; xunput (c, yytext); if (delim == '\'') @@ -3074,19 +3074,19 @@ { eat_continuation (); - std::string pkg; - std::string meth = strip_trailing_whitespace (yytext); + std::string pkg; + std::string meth = strip_trailing_whitespace (yytext); size_t pos = meth.find ("@"); std::string cls = meth.substr (pos).substr (1); - meth = meth.substr (0, pos - 1); - + meth = meth.substr (0, pos - 1); + pos = cls.find ("."); if (pos != std::string::npos) - { + { pkg = cls.substr (pos).substr (1); cls = cls.substr (0, pos - 1); } - + int kw_token = (is_keyword_token (meth) || is_keyword_token (cls) || is_keyword_token (pkg)); if (kw_token) @@ -3094,17 +3094,17 @@ error ("method, class and package names may not be keywords"); return LEXICAL_ERROR; } - + yylval.tok_val = new token (meth.empty () ? 0 : &(symbol_table::insert (meth)), cls.empty () ? 0 : &(symbol_table::insert (cls)), pkg.empty () ? 0 : &(symbol_table::insert (pkg)), - input_line_number, current_input_column); + input_line_number, current_input_column); token_stack.push (yylval.tok_val); - + lexer_flags.convert_spaces_to_comma = true; current_input_column += yyleng; - + return SUPERCLASSREF; } @@ -3116,30 +3116,30 @@ std::string pkg; std::string cls = strip_trailing_whitespace (yytext).substr (1); size_t pos = cls.find ("."); - + if (pos != std::string::npos) - { + { pkg = cls.substr (pos).substr (1); cls = cls.substr (0, pos - 1); } - + int kw_token = is_keyword_token (cls) || is_keyword_token (pkg); if (kw_token) { error ("class and package names may not be keywords"); return LEXICAL_ERROR; } - + yylval.tok_val = new token (cls.empty () ? 0 : &(symbol_table::insert (cls)), pkg.empty () ? 0 : &(symbol_table::insert (pkg)), input_line_number, current_input_column); token_stack.push (yylval.tok_val); - + lexer_flags.convert_spaces_to_comma = true; current_input_column += yyleng; - + return METAQUERY; } @@ -3289,7 +3289,7 @@ // transformation of the end keyword... if (tok == "end") - tok = "__end__"; + tok = "__end__"; yylval.tok_val = new token (&(symbol_table::insert (tok)), input_line_number, current_input_column); @@ -3338,7 +3338,7 @@ parsed_function_name.pop (); parsing_class_method = false; - + // Not initially defining a class with classdef. maybe_classdef_get_set_method = false; parsing_classdef = false; @@ -3371,7 +3371,7 @@ at_beginning_of_statement = true; // No need to do comma insert or convert spaces to comma at - // beginning of input. + // beginning of input. convert_spaces_to_comma = true; do_comma_insert = false; diff -r 1473d0cf86d2 -r 12df7854fa7c src/load-path.cc --- a/src/load-path.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/load-path.cc Thu Jan 20 17:24:59 2011 -0500 @@ -941,14 +941,14 @@ error ("%s: %s: invalid type code = %d", who, fcn.c_str (), type); return retval; -} +} std::string load_path::do_find_fcn (const std::string& fcn, std::string& dir_name, int type) const { std::string retval; - + // update (); if (fcn.length () > 0 && fcn[0] == '@') @@ -1767,7 +1767,7 @@ std::string fcn_path = file_ops::concat (dir_name, fname); warning_with_id ("Octave:shadowed-function", - "function %s shadows a core library function", + "function %s shadows a core library function", fcn_path.c_str ()); } } @@ -1775,7 +1775,7 @@ { std::string fcn_path = file_ops::concat (dir_name, fname); warning_with_id ("Octave:shadowed-function", - "function %s shadows a built-in function", + "function %s shadows a built-in function", fcn_path.c_str ()); } @@ -1883,7 +1883,7 @@ retval = dirname; string_vector dirlist = dir.read (); - + octave_idx_type len = dirlist.length (); for (octave_idx_type i = 0; i < len; i++) diff -r 1473d0cf86d2 -r 12df7854fa7c src/load-path.h --- a/src/load-path.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/load-path.h Thu Jan 20 17:24:59 2011 -0500 @@ -310,7 +310,7 @@ : dir_name (di.dir_name), abs_dir_name (di.abs_dir_name), is_relative (di.is_relative), dir_mtime (di.dir_mtime), - dir_time_last_checked (di.dir_time_last_checked), + dir_time_last_checked (di.dir_time_last_checked), all_files (di.all_files), fcn_files (di.fcn_files), private_file_map (di.private_file_map), method_file_map (di.method_file_map) { } diff -r 1473d0cf86d2 -r 12df7854fa7c src/load-save.cc --- a/src/load-save.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/load-save.cc Thu Jan 20 17:24:59 2011 -0500 @@ -191,7 +191,7 @@ error ("load: unable to read read binary file"); return -1; } - + char tmp = 0; is.read (&tmp, 1); @@ -216,13 +216,13 @@ std::ifstream file (fname.c_str ()); OCTAVE_LOCAL_BUFFER (unsigned char, magic, 2); - if (file.read (reinterpret_cast (magic), 2) && magic[0] == 0x1f && + if (file.read (reinterpret_cast (magic), 2) && magic[0] == 0x1f && magic[1] == 0x8b) retval = true; file.close (); return retval; -} +} #endif static load_save_format @@ -277,7 +277,7 @@ } static load_save_format -get_file_format (const std::string& fname, const std::string& orig_fname, +get_file_format (const std::string& fname, const std::string& orig_fname, bool &use_zlib) { load_save_format retval = LS_UNKNOWN; @@ -290,14 +290,14 @@ std::ifstream file (fname.c_str ()); use_zlib = false; - + if (file) { retval = get_file_format (file, orig_fname); file.close (); #ifdef HAVE_ZLIB - if (retval == LS_UNKNOWN && check_gzip_magic (fname)) + if (retval == LS_UNKNOWN && check_gzip_magic (fname)) { gzifstream gzfile (fname.c_str ()); use_zlib = true; @@ -511,7 +511,7 @@ size_t dot_pos = fname.rfind ("."); size_t sep_pos = fname.find_last_of (file_ops::dir_sep_chars ()); - + if (dot_pos == std::string::npos || (sep_pos != std::string::npos && dot_pos < sep_pos)) { @@ -526,7 +526,7 @@ else { file_stat fs (fname); - + if (! (fs.exists () && fs.is_reg ())) { fname = ""; @@ -819,7 +819,7 @@ return retval; } } - else if (format == LS_MAT5_BINARY + else if (format == LS_MAT5_BINARY || format == LS_MAT7_BINARY) { if (read_mat5_binary_file_header (file, swap, false, orig_fname) < 0) @@ -853,7 +853,7 @@ return retval; } } - else if (format == LS_MAT5_BINARY + else if (format == LS_MAT5_BINARY || format == LS_MAT7_BINARY) { if (read_mat5_binary_file_header (file, swap, false, orig_fname) < 0) @@ -875,7 +875,7 @@ } } } - + return retval; } @@ -935,7 +935,7 @@ break; case LS_MAT_ASCII: - if (! save_mat_ascii_data (os, tc, fmt.opts & LS_MAT_ASCII_LONG ? 16 : 8, + if (! save_mat_ascii_data (os, tc, fmt.opts & LS_MAT_ASCII_LONG ? 16 : 8, fmt.opts & LS_MAT_ASCII_TABS)) warning ("save: unable to save %s in ASCII format", name.c_str ()); break; @@ -991,7 +991,7 @@ load_save_format fmt, bool save_as_floats) { glob_match pat (pattern); - + size_t saved = 0; for (octave_scalar_map::const_iterator p = m.begin (); p != m.end (); p++) @@ -1080,14 +1080,14 @@ error ("save: octave executable was not linked with HDF5 library"); #endif /* ! HAVE_HDF5 */ } - else if (argv[i] == "-mat-binary" || argv[i] == "-mat" + else if (argv[i] == "-mat-binary" || argv[i] == "-mat" || argv[i] == "-m" || argv[i] == "-6" || argv[i] == "-v6" || argv[i] == "-V6") { format = LS_MAT5_BINARY; } #ifdef HAVE_ZLIB - else if (argv[i] == "-mat7-binary" || argv[i] == "-7" + else if (argv[i] == "-mat7-binary" || argv[i] == "-7" || argv[i] == "-v7" || argv[i] == "-V7") { format = LS_MAT7_BINARY; @@ -1142,21 +1142,21 @@ } static string_vector -parse_save_options (const std::string &arg, load_save_format &format, - bool &append, bool &save_as_floats, +parse_save_options (const std::string &arg, load_save_format &format, + bool &append, bool &save_as_floats, bool &use_zlib) { std::istringstream is (arg); std::string str; string_vector argv; - + while (! is.eof ()) { is >> str; argv.append (str); } - return parse_save_options (argv, format, append, save_as_floats, + return parse_save_options (argv, format, append, save_as_floats, use_zlib); } @@ -1256,7 +1256,7 @@ } else if (argv[argv_idx] == "-struct") { - if (++argv_idx >= argc) + if (++argv_idx >= argc) { error ("save: missing struct name"); return; @@ -1272,7 +1272,7 @@ octave_value struct_var = symbol_table::varref (struct_name); - if (! struct_var.is_map () || struct_var.numel () != 1) + if (! struct_var.is_map () || struct_var.numel () != 1) { error ("save: `%s' is not a scalar structure", struct_name.c_str ()); @@ -1282,14 +1282,14 @@ ++argv_idx; - if (argv_idx < argc) + if (argv_idx < argc) { for (int i = argv_idx; i < argc; i++) { if (! save_fields (os, struct_var_map, argv[i], fmt, save_as_floats)) { - warning ("save: no such field `%s.%s'", + warning ("save: no such field `%s.%s'", struct_name.c_str (), argv[i].c_str ()); } } @@ -1369,9 +1369,9 @@ bool use_zlib = false; - parse_save_options (Voctave_core_file_options, format, append, + parse_save_options (Voctave_core_file_options, format, append, save_as_floats, use_zlib); - + std::ios::openmode mode = std::ios::out; // Matlab v7 files are always compressed @@ -1426,7 +1426,7 @@ #endif { std::ofstream file (fname, mode); - + if (file) { dump_octave_core (file, fname, format, save_as_floats); @@ -1595,11 +1595,11 @@ bool use_zlib = false; // get default options - parse_save_options (Vdefault_save_options, format, append, save_as_floats, + parse_save_options (Vdefault_save_options, format, append, save_as_floats, use_zlib); // override from command line - argv = parse_save_options (argv, format, append, save_as_floats, + argv = parse_save_options (argv, format, append, save_as_floats, use_zlib); argc = argv.length (); int i = 0; @@ -1636,7 +1636,7 @@ // FIXME -- should things intended for the screen end up // in a octave_value (string)? - + save_vars (argv, i, argc, octave_stdout, format, save_as_floats, true); } @@ -1681,7 +1681,7 @@ return retval; } - bool write_header_info = ! (append && + bool write_header_info = ! (append && H5Fis_hdf5 (fname.c_str ()) > 0); hdf5_ofstream hdf5_file (fname.c_str (), mode); @@ -1728,7 +1728,7 @@ #endif { std::ofstream file (fname.c_str (), mode); - + if (file) { bool write_header_info = ! file.tellp (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/load-save.h --- a/src/load-save.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/load-save.h Thu Jan 20 17:24:59 2011 -0500 @@ -53,7 +53,7 @@ LS_MAT_BINARY_V5 = 1, LS_MAT_BINARY_V7, // zero means no option. - LS_NO_OPTION = 0 + LS_NO_OPTION = 0 }; class load_save_format diff -r 1473d0cf86d2 -r 12df7854fa7c src/ls-ascii-helper.cc --- a/src/ls-ascii-helper.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ls-ascii-helper.cc Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ { if (! is) return; - + while (is) { char c = is.peek (); @@ -56,7 +56,7 @@ // Eat the CR or LF character. char d; is.get (d); - + // Make sure that for binary-mode opened ascii files // containing CRLF line endings we skip the LF after CR. if (c == '\r' && is.peek () == '\n') @@ -65,7 +65,7 @@ is.get (d); } } - + // Newline was found, and read from stream if // keep_newline == true, so exit loop. break; @@ -90,7 +90,7 @@ { if (! is) return; - + // Check whether IS currently points to newline character. char c = is.peek (); @@ -102,7 +102,7 @@ // Eat the CR or LF character. char d; is.get (d); - + // Make sure that for binary-mode opened ascii files // containing CRLF line endings we skip the LF after CR. if (c == '\r' && is.peek () == '\n') @@ -110,7 +110,7 @@ // Yes, LF following CR, eat it. is.get (d); } - + // Peek into next character. c = is.peek (); @@ -130,9 +130,9 @@ { if (! is) return std::string (); - + std::ostringstream buf; - + while (is) { char c = is.peek (); @@ -145,7 +145,7 @@ // Eat the CR or LF character. char d; is.get (d); - + // Make sure that for binary-mode opened ascii files // containing CRLF line endings we skip the LF after // CR. @@ -156,7 +156,7 @@ is.get (d); } } - + // Newline was found, and read from stream if // keep_newline == true, so exit loop. break; @@ -170,6 +170,6 @@ buf << d; } } - + return buf.str (); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ls-hdf5.cc --- a/src/ls-hdf5.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ls-hdf5.cc Thu Jan 20 17:24:59 2011 -0500 @@ -97,7 +97,7 @@ // integer and floating-point binary data: #define HAVE_HDF5_INT2FLOAT_CONVERSIONS 0 -// Given two compound types t1 and t2, determine whether they +// Given two compound types t1 and t2, determine whether they // are compatible for reading/writing. This function only // works for non-nested types composed of simple elements (ints, floats...), // which is all we need it for @@ -169,7 +169,7 @@ } bool -hdf5_get_scalar_attr (hid_t loc_id, hid_t type_id, +hdf5_get_scalar_attr (hid_t loc_id, hid_t type_id, const char *attr_name, void *buf) { bool retval = false; @@ -219,8 +219,8 @@ // The following subroutines creates an HDF5 representations of the way // we will store Octave complex types (pairs of floating-point numbers). -// NUM_TYPE is the HDF5 numeric type to use for storage (e.g. -// H5T_NATIVE_DOUBLE to save as 'double'). Note that any necessary +// NUM_TYPE is the HDF5 numeric type to use for storage (e.g. +// H5T_NATIVE_DOUBLE to save as 'double'). Note that any necessary // conversions are handled automatically by HDF5. hid_t @@ -266,7 +266,7 @@ vname = make_valid_identifier (vname); // check again (in case vname was null, empty, or some such thing): - ident_valid = valid_identifier (vname); + ident_valid = valid_identifier (vname); } H5Gget_objinfo (group_id, name, 1, &info); @@ -305,7 +305,7 @@ if (type_class_id != H5T_STRING) goto done; - + space_id = H5Dget_space (data_id); hsize_t rank = H5Sget_simple_extent_ndims (space_id); @@ -322,7 +322,7 @@ hid_t st_id = H5Tcopy (H5T_C_S1); H5Tset_size (st_id, slen); - if (H5Dread (data_id, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, + if (H5Dread (data_id, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, typ) < 0) goto done; @@ -348,7 +348,7 @@ d->tc = octave_value_typeinfo::lookup_type ("list"); else d->tc = octave_value_typeinfo::lookup_type ("struct"); - + // check for OCTAVE_GLOBAL attribute: d->global = hdf5_check_attr (subgroup_id, "OCTAVE_GLOBAL"); @@ -374,7 +374,7 @@ } type_id = H5Dget_type (data_id); - + type_class_id = H5Tget_class (type_id); if (type_class_id == H5T_FLOAT) @@ -382,7 +382,7 @@ space_id = H5Dget_space (data_id); hsize_t rank = H5Sget_simple_extent_ndims (space_id); - + if (rank == 0) d->tc = octave_value_typeinfo::lookup_type ("scalar"); else @@ -395,15 +395,15 @@ // What integer type do we really have.. std::string int_typ; #ifdef HAVE_H5T_GET_NATIVE_TYPE - // FIXME test this code and activated with an autoconf + // FIXME test this code and activated with an autoconf // test!! It is also incorrect for 64-bit indexing!! - + switch (H5Tget_native_type (type_id, H5T_DIR_ASCEND)) { case H5T_NATIVE_CHAR: int_typ = "int8 "; break; - + case H5T_NATIVE_SHORT: int_typ = "int16 "; break; @@ -433,7 +433,7 @@ case H5T_NATIVE_ULLONG: int_typ = "uint64 "; break; - } + } #else hid_t int_sign = H5Tget_sign (type_id); @@ -469,7 +469,7 @@ break; default: - warning ("load: can't read `%s' (unknown datatype)", + warning ("load: can't read `%s' (unknown datatype)", name); int_typ = ""; break; @@ -485,7 +485,7 @@ space_id = H5Dget_space (data_id); hsize_t rank = H5Sget_simple_extent_ndims (space_id); - + if (rank == 0) int_typ.append ("scalar"); else @@ -506,7 +506,7 @@ // read complex matrix or scalar variable space_id = H5Dget_space (data_id); hsize_t rank = H5Sget_simple_extent_ndims (space_id); - + if (rank == 0) d->tc = octave_value_typeinfo::lookup_type ("complex scalar"); else @@ -526,7 +526,7 @@ warning ("load: can't read `%s' (unknown datatype)", name); retval = 0; // unknown datatype; skip } - + // check for OCTAVE_GLOBAL attribute: d->global = hdf5_check_attr (data_id, "OCTAVE_GLOBAL"); @@ -547,7 +547,7 @@ done: if (retval < 0) error ("load: error while reading hdf5 item %s", name); - + if (retval > 0) { // get documentation string, if any: @@ -579,7 +579,7 @@ // the name of the variable, or NULL if none were found or there was // and error. std::string -read_hdf5_data (std::istream& is, const std::string& /* filename */, +read_hdf5_data (std::istream& is, const std::string& /* filename */, bool& global, octave_value& tc, std::string& doc) { std::string retval; @@ -593,9 +593,9 @@ hsize_t num_obj = 0; #if HAVE_HDF5_18 - hid_t group_id = H5Gopen (hs.file_id, "/", H5P_DEFAULT); + hid_t group_id = H5Gopen (hs.file_id, "/", H5P_DEFAULT); #else - hid_t group_id = H5Gopen (hs.file_id, "/"); + hid_t group_id = H5Gopen (hs.file_id, "/"); #endif H5Gget_num_objs (group_id, &num_obj); H5Gclose (group_id); @@ -634,7 +634,7 @@ if (as_id >= 0) { #if HAVE_HDF5_18 - hid_t a_id = H5Acreate (loc_id, attr_name, H5T_NATIVE_UCHAR, + hid_t a_id = H5Acreate (loc_id, attr_name, H5T_NATIVE_UCHAR, as_id, H5P_DEFAULT, H5P_DEFAULT); #else hid_t a_id = H5Acreate (loc_id, attr_name, @@ -670,7 +670,7 @@ if (as_id >= 0) { #if HAVE_HDF5_18 - hid_t a_id = H5Acreate (loc_id, attr_name, type_id, + hid_t a_id = H5Acreate (loc_id, attr_name, type_id, as_id, H5P_DEFAULT, H5P_DEFAULT); #else hid_t a_id = H5Acreate (loc_id, attr_name, @@ -718,10 +718,10 @@ space_hid = H5Screate_simple (1, &sz, 0); if (space_hid < 0) return space_hid; #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif if (data_hid < 0) @@ -729,7 +729,7 @@ H5Sclose (space_hid); return data_hid; } - + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, dims) >= 0; @@ -738,7 +738,7 @@ if (retval >= 0) retval = hdf5_add_attr (loc_id, "OCTAVE_EMPTY_MATRIX"); - + return (retval == 0 ? 1 : retval); } @@ -764,7 +764,7 @@ OCTAVE_LOCAL_BUFFER (octave_idx_type, dims, hdims); - retval = H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + retval = H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, dims); if (retval >= 0) { @@ -836,7 +836,7 @@ // FIXME: diagonal & permutation matrices currently don't know how to save // themselves, so we convert them first to normal matrices using A = A(:,:). // This is a temporary hack. - if (val.is_diag_matrix () || val.is_perm_matrix () + if (val.is_diag_matrix () || val.is_perm_matrix () || val.type_id () == octave_lazy_index::static_type_id ()) val = val.full_value (); @@ -864,7 +864,7 @@ #else data_type_id = H5Dcreate (data_id, "type", type_id, space_id, H5P_DEFAULT); #endif - if (data_type_id < 0 || H5Dwrite (data_type_id, type_id, H5S_ALL, H5S_ALL, + if (data_type_id < 0 || H5Dwrite (data_type_id, type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, t.c_str ()) < 0) goto error_cleanup; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ls-hdf5.h --- a/src/ls-hdf5.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ls-hdf5.h Thu Jan 20 17:24:59 2011 -0500 @@ -57,7 +57,7 @@ if (mode & std::ios::app && H5Fis_hdf5 (name) > 0) file_id = H5Fopen (name, H5F_ACC_RDWR, H5P_DEFAULT); else - file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT, + file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); } if (file_id < 0) @@ -67,7 +67,7 @@ } void close () - { + { if (file_id >= 0) { if (H5Fclose (file_id) < 0) @@ -87,7 +87,7 @@ if (mode & std::ios::app && H5Fis_hdf5 (name) > 0) file_id = H5Fopen (name, H5F_ACC_RDWR, H5P_DEFAULT); else - file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT, + file_id = H5Fcreate (name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); } if (file_id < 0) @@ -199,7 +199,7 @@ extern OCTINTERP_API herr_t -hdf5_add_scalar_attr (hid_t loc_id, hid_t type_id, +hdf5_add_scalar_attr (hid_t loc_id, hid_t type_id, const char *attr_name, void *buf); #ifdef IDX_TYPE_LONG diff -r 1473d0cf86d2 -r 12df7854fa7c src/ls-mat-ascii.cc --- a/src/ls-mat-ascii.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ls-mat-ascii.cc Thu Jan 20 17:24:59 2011 -0500 @@ -149,7 +149,7 @@ { beg = buf.find_first_not_of (", \t", end); - if (beg == std::string::npos || (buf[beg] == '\r' && + if (beg == std::string::npos || (buf[beg] == '\r' && beg == buf.length () - 1)) { // We had a line with trailing spaces and @@ -360,7 +360,7 @@ for (octave_idx_type j = 0; j < m.cols (); j++) { // Omit leading tabs. - if (j != 0) os << '\t'; + if (j != 0) os << '\t'; octave_write_double (os, m (i, j)); } os << "\n"; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ls-mat4.cc --- a/src/ls-mat4.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ls-mat4.cc Thu Jan 20 17:24:59 2011 -0500 @@ -109,7 +109,7 @@ } int -read_mat_file_header (std::istream& is, bool& swap, int32_t& mopt, +read_mat_file_header (std::istream& is, bool& swap, int32_t& mopt, int32_t& nr, int32_t& nc, int32_t& imag, int32_t& len, int quiet) @@ -358,7 +358,7 @@ data.xelem(i) = Complex (dtmp[i], ctmp[i]); read_mat_binary_data (is, ctmp, prec, 1, swap, flt_fmt); - SparseComplexMatrix smc = SparseComplexMatrix (data, r, c, + SparseComplexMatrix smc = SparseComplexMatrix (data, r, c, nr_new, nc_new); tc = order ? smc.transpose () : smc; @@ -435,12 +435,12 @@ return retval; } -// Save the data from TC along with the corresponding NAME on stream OS +// Save the data from TC along with the corresponding NAME on stream OS // in the MatLab version 4 binary format. bool save_mat_binary_data (std::ostream& os, const octave_value& tc, - const std::string& name) + const std::string& name) { int32_t mopt = 0; @@ -452,7 +452,7 @@ mopt += 1000 * float_format_to_mopt_digit (flt_fmt); os.write (reinterpret_cast (&mopt), 4); - + octave_idx_type len; int32_t nr = tc.rows (); @@ -498,14 +498,14 @@ octave_idx_type nrow = chm.rows (); octave_idx_type ncol = chm.cols (); - + OCTAVE_LOCAL_BUFFER (double, buf, ncol*nrow); - + for (octave_idx_type i = 0; i < nrow; i++) { std::string tstr = chm.row_as_string (i); const char *s = tstr.data (); - + for (octave_idx_type j = 0; j < ncol; j++) buf[j*nrow+i] = static_cast (*s++ & 0x00FF); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ls-mat4.h --- a/src/ls-mat4.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ls-mat4.h Thu Jan 20 17:24:59 2011 -0500 @@ -30,7 +30,7 @@ float_format_to_mopt_digit (oct_mach_info::float_format flt_fmt); extern int -read_mat_file_header (std::istream& is, bool& swap, int32_t& mopt, +read_mat_file_header (std::istream& is, bool& swap, int32_t& mopt, int32_t& nr, int32_t& nc, int32_t& imag, int32_t& len, int quiet = 0); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ls-mat5.cc --- a/src/ls-mat5.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ls-mat5.cc Thu Jan 20 17:24:59 2011 -0500 @@ -125,7 +125,7 @@ octave_idx_type count, bool swap, mat5_data_type type, oct_mach_info::float_format flt_fmt) { - + switch (type) { case miINT8: @@ -190,7 +190,7 @@ octave_idx_type count, bool swap, mat5_data_type type, oct_mach_info::float_format flt_fmt) { - + switch (type) { case miINT8: @@ -424,8 +424,8 @@ else \ tc = re; \ } - -// Read one element tag from stream IS, + +// Read one element tag from stream IS, // place the type code in TYPE and the byte count in BYTES // return nonzero on error static int @@ -529,7 +529,7 @@ // This will fail with an error Z_MEM_ERROR uLongf destLen = 8; OCTAVE_LOCAL_BUFFER (unsigned int, tmp, 2); - if (uncompress (reinterpret_cast (tmp), &destLen, + if (uncompress (reinterpret_cast (tmp), &destLen, reinterpret_cast (inbuf), element_length) != Z_MEM_ERROR) { @@ -538,7 +538,7 @@ swap_bytes<4> (tmp, 2); destLen = tmp[1] + 8; - std::string outbuf (destLen, ' '); + std::string outbuf (destLen, ' '); // FIXME -- find a way to avoid casting away const here! @@ -590,7 +590,7 @@ else { std::istringstream gz_is (outbuf); - retval = read_mat5_binary_element (gz_is, filename, + retval = read_mat5_binary_element (gz_is, filename, swap, global, tc); } } @@ -636,11 +636,11 @@ logicalvar = (flags & 0x0200) != 0; // boolean ? arrayclass = static_cast (flags & 0xff); - + int32_t tmp_nzmax; read_int (is, swap, tmp_nzmax); // max number of non-zero in sparse nzmax = tmp_nzmax; - + // dimensions array subelement if (arrayclass != MAT_FILE_WORKSPACE_CLASS) { @@ -689,7 +689,7 @@ { if (! is.read (name, len )) goto data_read_error; - + is.seekg (tmp_pos + static_cast (PAD (len))); } @@ -753,7 +753,7 @@ // row indices std::streampos tmp_pos; - + if (read_mat5_tag (is, swap, type, len)) { error ("load: reading sparse row data for `%s'", retval.c_str ()); @@ -824,7 +824,7 @@ if (imag) { NDArray im (dim_vector (static_cast (nnz), 1)); - + if (read_mat5_tag (is, swap, type, len)) { error ("load: reading sparse matrix data for `%s'", retval.c_str ()); @@ -876,7 +876,7 @@ tc = make_fcn_handle (fname); else { - std::string mroot = + std::string mroot = m0.contents("matlabroot")(0).string_value(); if ((fpath.length () >= mroot.length ()) && @@ -889,10 +889,10 @@ // or Matlab other than the running version. In that // case we replace with the same function in the // running version of Octave? - + // First check if just replacing matlabroot is enough - std::string str = OCTAVE_EXEC_PREFIX + - fpath.substr (mroot.length ()); + std::string str = OCTAVE_EXEC_PREFIX + + fpath.substr (mroot.length ()); file_stat fs (str); if (fs.exists ()) @@ -904,7 +904,7 @@ octave_function *fcn = load_fcn_from_file (str, dir_name, "", fname); - + if (fcn) { octave_value tmp (fcn); @@ -941,7 +941,7 @@ } else { - warning ("load: can't find the file %s", + warning ("load: can't find the file %s", fpath.c_str()); goto skip_ahead; } @@ -965,7 +965,7 @@ } else { - warning ("load: can't find the file %s", + warning ("load: can't find the file %s", fpath.c_str()); goto skip_ahead; } @@ -1003,8 +1003,8 @@ if (m2.nfields() > 0) { octave_value tmp; - - for (Octave_map::iterator p0 = m2.begin() ; + + for (Octave_map::iterator p0 = m2.begin() ; p0 != m2.end(); p0++) { std::string key = m2.key(p0); @@ -1013,14 +1013,14 @@ symbol_table::varref (key, local_scope, 0) = val; } } - + int parse_status; - octave_value anon_fcn_handle = + octave_value anon_fcn_handle = eval_string (fname.substr (4), true, parse_status); if (parse_status == 0) { - octave_fcn_handle *fh = + octave_fcn_handle *fh = anon_fcn_handle.fcn_handle_value (); if (fh) @@ -1072,7 +1072,7 @@ if (! is.read (elname, fn_len)) goto data_read_error; - is.seekg (tmp_pos + + is.seekg (tmp_pos + static_cast (PAD (fn_len))); } @@ -1097,7 +1097,7 @@ { octave_value fieldtc; read_mat5_binary_element (is, filename, swap, global, - fieldtc); + fieldtc); if (! is || error_state) goto data_read_error; @@ -1133,7 +1133,7 @@ { if (! is.read (name, len )) goto data_read_error; - + is.seekg (tmp_pos + static_cast (PAD (len))); } @@ -1199,7 +1199,7 @@ { octave_value fieldtc; read_mat5_binary_element (is, filename, swap, global, - fieldtc); + fieldtc); elt[i](j) = fieldtc; } } @@ -1218,7 +1218,7 @@ { // inline is not an object in Octave but rather an // overload of a function handle. Special case. - tc = + tc = new octave_fcn_inline (m.contents("expr")(0).string_value(), m.contents("args")(0).string_value()); } @@ -1230,8 +1230,8 @@ if (! cls->reconstruct_parents ()) warning ("load: unable to reconstruct object inheritance"); - tc = cls; - if (load_path::find_method (classname, "loadobj") != + tc = cls; + if (load_path::find_method (classname, "loadobj") != std::string()) { octave_value_list tmp = feval ("loadobj", tc, 1); @@ -1265,7 +1265,7 @@ uint8NDArray in = tc.uint8_array_value (); octave_idx_type nel = in.numel (); boolNDArray out (dims); - + for (octave_idx_type i = 0; i < nel; i++) out (i) = in(i).bool_value (); @@ -1302,11 +1302,11 @@ case MAT_FILE_SINGLE_CLASS: { FloatNDArray re (dims); - + // real data subelement std::streampos tmp_pos; - + if (read_mat5_tag (is, swap, type, len)) { error ("load: reading matrix data for `%s'", retval.c_str ()); @@ -1331,7 +1331,7 @@ // imaginary data subelement FloatNDArray im (dims); - + if (read_mat5_tag (is, swap, type, len)) { error ("load: reading matrix data for `%s'", retval.c_str ()); @@ -1368,11 +1368,11 @@ default: { NDArray re (dims); - + // real data subelement std::streampos tmp_pos; - + if (read_mat5_tag (is, swap, type, len)) { error ("load: reading matrix data for `%s'", retval.c_str ()); @@ -1399,7 +1399,7 @@ // variable and convert it. boolNDArray out (dims); - + for (octave_idx_type i = 0; i < n; i++) out (i) = static_cast (re (i)); @@ -1410,7 +1410,7 @@ // imaginary data subelement NDArray im (dims); - + if (read_mat5_tag (is, swap, type, len)) { error ("load: reading matrix data for `%s'", retval.c_str ()); @@ -1468,7 +1468,7 @@ if (a > 0x7f) utf8_multi_byte = true; } - + if (utf8_multi_byte) { warning ("load: can not read multi-byte encoded UTF8 characters."); @@ -1509,7 +1509,7 @@ } int -read_mat5_binary_file_header (std::istream& is, bool& swap, bool quiet, +read_mat5_binary_file_header (std::istream& is, bool& swap, bool quiet, const std::string& filename) { int16_t version=0, magic=0; @@ -1585,7 +1585,7 @@ return 0; } -static int +static int write_mat5_tag (std::ostream& is, int type, octave_idx_type bytes) { int32_t temp; @@ -1624,7 +1624,7 @@ // write out the numeric values in M to OS, // preceded by the appropriate tag. -static void +static void write_mat5_array (std::ostream& os, const NDArray& m, bool save_as_floats) { save_type st = LS_DOUBLE; @@ -1671,15 +1671,15 @@ case LS_U_CHAR: MAT5_DO_WRITE (uint8_t, data, nel, os); break; - + case LS_U_SHORT: MAT5_DO_WRITE (uint16_t, data, nel, os); break; - + case LS_U_INT: MAT5_DO_WRITE (uint32_t, data, nel, os); break; - + case LS_U_LONG: MAT5_DO_WRITE (uint64_t, data, nel, os); break; @@ -1687,7 +1687,7 @@ case LS_CHAR: MAT5_DO_WRITE (int8_t, data, nel, os); break; - + case LS_SHORT: MAT5_DO_WRITE (int16_t, data, nel, os); break; @@ -1721,7 +1721,7 @@ } } -static void +static void write_mat5_array (std::ostream& os, const FloatNDArray& m, bool) { save_type st = LS_FLOAT; @@ -1757,15 +1757,15 @@ case LS_U_CHAR: MAT5_DO_WRITE (uint8_t, data, nel, os); break; - + case LS_U_SHORT: MAT5_DO_WRITE (uint16_t, data, nel, os); break; - + case LS_U_INT: MAT5_DO_WRITE (uint32_t, data, nel, os); break; - + case LS_U_LONG: MAT5_DO_WRITE (uint64_t, data, nel, os); break; @@ -1773,7 +1773,7 @@ case LS_CHAR: MAT5_DO_WRITE (int8_t, data, nel, os); break; - + case LS_SHORT: MAT5_DO_WRITE (int16_t, data, nel, os); break; @@ -1808,7 +1808,7 @@ } template -void +void write_mat5_integer_data (std::ostream& os, const T *m, int size, octave_idx_type nel) { @@ -1893,13 +1893,13 @@ int size, octave_idx_type nel); template void -write_mat5_integer_data (std::ostream& os, const int *m, +write_mat5_integer_data (std::ostream& os, const int *m, int size, octave_idx_type nel); // Write out cell element values in the cell array to OS, preceded by // the appropriate tag. -static bool +static bool write_mat5_cell_array (std::ostream& os, const Cell& cell, bool mark_as_global, bool save_as_floats) { @@ -2091,7 +2091,7 @@ } int -save_mat5_element_length (const octave_value& tc, const std::string& name, +save_mat5_element_length (const octave_value& tc, const std::string& name, bool save_as_floats, bool mat7_format) { size_t max_namelen = (mat7_format ? 63 : 31); @@ -2103,7 +2103,7 @@ ret += PAD (len > max_namelen ? max_namelen : len); ret += PAD (4 * tc.ndims ()); - + if (tc.is_string ()) { charNDArray chm = tc.char_array_value (); @@ -2186,10 +2186,10 @@ octave_idx_type nel = cell.numel (); for (int i = 0; i < nel; i++) - ret += 8 + + ret += 8 + save_mat5_element_length (cell (i), "", save_as_floats, mat7_format); } - else if (tc.is_complex_scalar () || tc.is_complex_matrix ()) + else if (tc.is_complex_scalar () || tc.is_complex_matrix ()) { if (tc.is_single_type ()) { @@ -2198,13 +2198,13 @@ save_as_floats); } else - { + { const ComplexNDArray m = tc.complex_array_value (); ret += save_mat5_array_length (m.fortran_vec (), m.numel (), 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 ()) { int fieldcnt = 0; const Octave_map m = tc.map_value (); @@ -2233,7 +2233,7 @@ { const Cell elts = m.contents (i); - ret += 8 + save_mat5_element_length (elts(j), "", + ret += 8 + save_mat5_element_length (elts(j), "", save_as_floats, mat7_format); } } @@ -2273,7 +2273,7 @@ save_mat5_binary_element (std::ostream& os, const octave_value& tc, const std::string& name, bool mark_as_global, bool mat7_format, - bool save_as_floats, bool compressing) + bool save_as_floats, bool compressing) { int32_t flags = 0; int32_t nnz_32 = 0; @@ -2341,18 +2341,18 @@ if (ret) { - // destLen must be at least 0.1% larger than source buffer + // destLen must be at least 0.1% larger than source buffer // + 12 bytes. Reality is it must be larger again than that. std::string buf_str = buf.str (); uLongf srcLen = buf_str.length (); - uLongf destLen = srcLen * 101 / 100 + 12; + uLongf destLen = srcLen * 101 / 100 + 12; OCTAVE_LOCAL_BUFFER (char, out_buf, destLen); - if (compress (reinterpret_cast (out_buf), &destLen, + if (compress (reinterpret_cast (out_buf), &destLen, reinterpret_cast (buf_str.c_str ()), srcLen) == Z_OK) { write_mat5_tag (os, miCOMPRESSED, - static_cast (destLen)); + static_cast (destLen)); os.write (out_buf, destLen); } @@ -2367,9 +2367,9 @@ } #endif - write_mat5_tag (os, miMATRIX, save_mat5_element_length + write_mat5_tag (os, miMATRIX, save_mat5_element_length (tc, name, save_as_floats, mat7_format)); - + // array flags subelement write_mat5_tag (os, miUINT32, 8); @@ -2410,7 +2410,7 @@ else flags |= MAT_FILE_DOUBLE_CLASS; } - else if (tc.is_map ()) + else if (tc.is_map ()) flags |= MAT_FILE_STRUCT_CLASS; else if (tc.is_cell ()) flags |= MAT_FILE_CELL_CLASS; @@ -2472,7 +2472,7 @@ buf[i] = *s++ & 0x00FF; os.write (reinterpret_cast (buf), len); - + if (paddedlength > len) { static char padbuf[9]="\x00\x00\x00\x00\x00\x00\x00\x00"; @@ -2597,7 +2597,7 @@ if (! write_mat5_cell_array (os, cell, mark_as_global, save_as_floats)) goto error_cleanup; } - else if (tc.is_complex_scalar () || tc.is_complex_matrix ()) + else if (tc.is_complex_scalar () || tc.is_complex_matrix ()) { if (tc.is_single_type ()) { @@ -2614,7 +2614,7 @@ 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 ()) { @@ -2692,7 +2692,7 @@ { bool retval2 = save_mat5_binary_element (os, elts[i][j], "", mark_as_global, - false, + false, save_as_floats); if (! retval2) goto error_cleanup; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ls-oct-ascii.cc --- a/src/ls-oct-ascii.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ls-oct-ascii.cc Thu Jan 20 17:24:59 2011 -0500 @@ -91,7 +91,7 @@ if (c == '%' || c == '#') { std::ostringstream buf; - + while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#')) ; // Skip whitespace and comment characters. @@ -300,7 +300,7 @@ // Save the data from TC along with the corresponding NAME, and global // flag MARK_AS_GLOBAL on stream OS in the plain text format described // above for load_ascii_data. If NAME is empty, the name: line is not -// generated. PRECISION specifies the number of decimal digits to print. +// generated. PRECISION specifies the number of decimal digits to print. // // Assumes ranges and strings cannot contain Inf or NaN values. // diff -r 1473d0cf86d2 -r 12df7854fa7c src/ls-oct-ascii.h --- a/src/ls-oct-ascii.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ls-oct-ascii.h Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ #endif extern OCTINTERP_API std::string -extract_keyword (std::istream& is, const char *keyword, +extract_keyword (std::istream& is, const char *keyword, const bool next_only = false); extern OCTINTERP_API std::string @@ -70,7 +70,7 @@ template bool -extract_keyword (std::istream& is, const char *keyword, T& value, +extract_keyword (std::istream& is, const char *keyword, T& value, const bool next_only = false) { bool status = false; @@ -117,7 +117,7 @@ template bool -extract_keyword (std::istream& is, const std::string& kw, T& value, +extract_keyword (std::istream& is, const std::string& kw, T& value, const bool next_only = false) { return extract_keyword (is, kw.c_str (), value, next_only); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ls-oct-binary.cc --- a/src/ls-oct-binary.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ls-oct-binary.cc Thu Jan 20 17:24:59 2011 -0500 @@ -80,7 +80,7 @@ // ------ ---- ----- // magic number string 10 // -// float format integer 1 +// float format integer 1 // // // Data (one set for each item): @@ -252,7 +252,7 @@ goto data_read_error; break; } - + if (!tc.load_binary (is, swap, fmt)) { data_read_error: @@ -269,7 +269,7 @@ bool save_binary_data (std::ostream& os, const octave_value& tc, const std::string& name, const std::string& doc, - bool mark_as_global, bool save_as_floats) + bool mark_as_global, bool save_as_floats) { int32_t name_len = name.length (); @@ -296,7 +296,7 @@ os.write (reinterpret_cast (&len), 4); const char *btmp = typ.data (); os.write (btmp, len); - + // The octave_value of tc is const. Make a copy... octave_value val = tc; diff -r 1473d0cf86d2 -r 12df7854fa7c src/mappers.cc --- a/src/mappers.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/mappers.cc Thu Jan 20 17:24:59 2011 -0500 @@ -412,7 +412,7 @@ %% double precision %!assert(ceil ([2, 1.1, -1.1, -1]), [2, 2, -1, -1]); -%% compelx double precison +%% compelx double precison %!assert(ceil ([2+2i, 1.1+1.1i, -1.1-1.1i, -1-i]), [2+2i, 2+2i, -1-i, -1-i]); %% single precision @@ -1806,7 +1806,7 @@ DEFALIAS (lower, tolower); /* - + %!error tolower(); %!error lower(); %!assert(tolower("OCTAVE"), "octave"); @@ -1852,7 +1852,7 @@ DEFALIAS (upper, toupper); /* - + %!error toupper(); %!error upper(); %!assert(toupper("octave"), "OCTAVE"); diff -r 1473d0cf86d2 -r 12df7854fa7c src/mex.cc --- a/src/mex.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/mex.cc Thu Jan 20 17:24:59 2011 -0500 @@ -384,7 +384,7 @@ mwSize get_m (void) const { return val.rows (); } - mwSize get_n (void) const + mwSize get_n (void) const { mwSize n = 1; @@ -670,7 +670,7 @@ case mxUINT64_CLASS: return 8; case mxFUNCTION_CLASS: return 0; default: return 0; - } + } } bool mutation_needed (void) const { return mutate_flag; } @@ -1050,7 +1050,7 @@ case mxUINT64_CLASS: return 8; case mxFUNCTION_CLASS: return 0; default: return 0; - } + } } protected: @@ -1156,7 +1156,7 @@ pi (0) { mxChar *cpr = static_cast (pr); - + mwSize *dv = get_dimensions (); mwSize nc = dv[1]; @@ -1172,7 +1172,7 @@ for (size_t i = tmp_len; i < nc; i++) cpr[m*i+j] = static_cast (' '); - } + } } mxArray_number *dup (void) const { return new mxArray_number (*this); } @@ -1453,7 +1453,7 @@ default: panic_impossible (); - } + } return retval; } @@ -2172,17 +2172,17 @@ if (ptr) { v = gnulib::realloc (ptr, n); - + std::set::iterator p = memlist.find (ptr); - + if (v && p != memlist.end ()) { memlist.erase (p); memlist.insert (v); } - + p = global_memlist.find (ptr); - + if (v && p != global_memlist.end ()) { global_memlist.erase (p); @@ -2511,7 +2511,7 @@ { return mex_context ? mex_context->mark_array (ptr) : ptr; } - + // Constructors. mxArray * mxCreateCellArray (mwSize ndims, const mwSize *dims) @@ -2821,7 +2821,7 @@ maybe_unmark (const_cast (dims))), ndims); } - + // Data extractors. double * mxGetPr (const mxArray *ptr) @@ -3027,7 +3027,7 @@ { return ptr->array_to_string (); } - + mwIndex mxCalcSingleSubscript (const mxArray *ptr, mwSize nsubs, mwIndex *subs) { @@ -3460,7 +3460,7 @@ int mexSet (double handle, const char *property, mxArray *val) { - bool ret = + bool ret = set_property_in_handle (handle, property, mxArray::as_octave_value (val), "mexSet"); return (ret ? 0 : 1); diff -r 1473d0cf86d2 -r 12df7854fa7c src/mex.h --- a/src/mex.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/mex.h Thu Jan 20 17:24:59 2011 -0500 @@ -73,7 +73,7 @@ #else void mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray *prhs[]); #endif - + #include "mexproto.h" /* V4 floating point routines renamed in V5. */ @@ -83,7 +83,7 @@ #define mexGetEps mxGetEps #define mexGetInf mxGetInf #define mexGetNaN mxGetNan - + #define mexGetGlobal(nm) mexGetArray (nm, "global") #define mexGetMatrix(nm) mexGetArray (nm, "caller") #define mexGetMatrixPtr(nm) mexGetArrayPtr (nm, "caller") @@ -93,7 +93,7 @@ #define mexPutMatrix(ptr) mexPutVariable ("caller", "", ptr) #define mexPutArray(ptr, space) mexPutVariable (space, "", ptr) - + #define mxCreateFull mxCreateDoubleMatrix #define mxCreateScalarDouble mxCreateDoubleScalar diff -r 1473d0cf86d2 -r 12df7854fa7c src/mexproto.h --- a/src/mexproto.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/mexproto.h Thu Jan 20 17:24:59 2011 -0500 @@ -83,7 +83,7 @@ extern OCTINTERP_API void mexWarnMsgTxt (const char *s); extern OCTINTERP_API void mexWarnMsgIdAndTxt (const char *id, const char *s, ...); extern OCTINTERP_API int mexPrintf (const char *fmt, ...); - + extern OCTINTERP_API mxArray *mexGetVariable (const char *space, const char *name); extern OCTINTERP_API const mxArray *mexGetVariablePtr (const char *space, const char *name); @@ -109,13 +109,13 @@ extern OCTINTERP_API double mxGetEps (void); extern OCTINTERP_API double mxGetInf (void); extern OCTINTERP_API double mxGetNaN (void); - + /* Memory management. */ extern OCTINTERP_API void *mxCalloc (size_t n, size_t size); extern OCTINTERP_API void *mxMalloc (size_t n); extern OCTINTERP_API void *mxRealloc (void *ptr, size_t size); extern OCTINTERP_API void mxFree (void *ptr); - + /* Constructors. */ extern OCTINTERP_API mxArray *mxCreateCellArray (mwSize ndims, const mwSize *dims); extern OCTINTERP_API mxArray *mxCreateCellMatrix (mwSize m, mwSize n); @@ -184,7 +184,7 @@ extern OCTINTERP_API void mxSetM (mxArray *ptr, mwSize M); extern OCTINTERP_API void mxSetN (mxArray *ptr, mwSize N); extern OCTINTERP_API void mxSetDimensions (mxArray *ptr, const mwSize *dims, mwSize ndims); - + /* Data extractors. */ extern OCTINTERP_API double *mxGetPi (const mxArray *ptr); extern OCTINTERP_API double *mxGetPr (const mxArray *ptr); @@ -238,7 +238,7 @@ extern OCTINTERP_API int mxGetString (const mxArray *ptr, char *buf, mwSize buflen); extern OCTINTERP_API char *mxArrayToString (const mxArray *ptr); - + /* Miscellaneous. */ #ifdef NDEBUG #define mxAssert(expr, msg) \ diff -r 1473d0cf86d2 -r 12df7854fa7c src/mxarray.h.in --- a/src/mxarray.h.in Thu Jan 20 17:21:27 2011 -0500 +++ b/src/mxarray.h.in Thu Jan 20 17:24:59 2011 -0500 @@ -80,7 +80,7 @@ /* typedef Uint16 mxChar; */ typedef char mxChar; -/* +/* * FIXME? Mathworks says these should be size_t on 64-bit system and when * mex is used with the -largearraydims flag, but why do that? Its better * to conform to the same indexing as the rest of Octave diff -r 1473d0cf86d2 -r 12df7854fa7c src/oct-hist.cc --- a/src/oct-hist.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/oct-hist.cc Thu Jan 20 17:24:59 2011 -0500 @@ -153,7 +153,7 @@ // // Arg of -w FILENAME means write file, arg of -r FILENAME // means read file, arg of -q means don't number lines. Arg of N -// means only display that many items. +// means only display that many items. static void do_history (int argc, const string_vector& argv) @@ -328,7 +328,7 @@ std::string tmp = line; int len = tmp.length (); - + if (len > 0 && tmp[len-1] == '\n') tmp.resize (len - 1); @@ -339,7 +339,7 @@ static std::string mk_tmp_hist_file (int argc, const string_vector& argv, - int insert_curr, const char *warn_for) + int insert_curr, const char *warn_for) { std::string retval; diff -r 1473d0cf86d2 -r 12df7854fa7c src/oct-lvalue.cc --- a/src/oct-lvalue.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/oct-lvalue.cc Thu Jan 20 17:24:59 2011 -0500 @@ -85,7 +85,7 @@ { octave_value_list t = val->subsref (type, idx, 1); if (t.length () > 0) - retval = t(0); + retval = t(0); } } } diff -r 1473d0cf86d2 -r 12df7854fa7c src/oct-lvalue.h --- a/src/oct-lvalue.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/oct-lvalue.h Thu Jan 20 17:24:59 2011 -0500 @@ -37,12 +37,12 @@ public: octave_lvalue (octave_value *v = 0) - : val (v), type (), idx (), nel (1) + : val (v), type (), idx (), nel (1) { } octave_lvalue (const octave_lvalue& vr) - : val (vr.val), type (vr.type), idx (vr.idx), nel (vr.nel) - { + : val (vr.val), type (vr.type), idx (vr.idx), nel (vr.nel) + { } octave_lvalue& operator = (const octave_lvalue& vr) @@ -68,10 +68,10 @@ bool is_map (void) const { return val && val->is_map (); } - void define (const octave_value& v) - { + void define (const octave_value& v) + { if (val) - *val = v; + *val = v; } void assign (octave_value::assign_op, const octave_value&); diff -r 1473d0cf86d2 -r 12df7854fa7c src/oct-map.cc --- a/src/oct-map.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/oct-map.cc Thu Jan 20 17:24:59 2011 -0500 @@ -95,7 +95,7 @@ } } -void +void octave_fields::orderfields (Array& perm) { octave_idx_type n = rep->size (); @@ -111,7 +111,7 @@ } } -bool +bool octave_fields::equal_up_to_order (const octave_fields& other, octave_idx_type* perm) const { @@ -134,7 +134,7 @@ return retval; } -bool +bool octave_fields::equal_up_to_order (const octave_fields& other, Array& perm) const { @@ -182,7 +182,7 @@ xvals.erase (xvals.begin () + idx); } -octave_scalar_map +octave_scalar_map octave_scalar_map::orderfields (void) const { Array perm; @@ -230,7 +230,7 @@ return getfield (k); } -octave_value& +octave_value& octave_scalar_map::contents (const std::string& k) { octave_idx_type idx = xkeys.getfield (k); @@ -293,7 +293,7 @@ xvals.erase (xvals.begin () + idx); } -octave_map +octave_map octave_map::orderfields (void) const { Array perm; @@ -341,7 +341,7 @@ return getfield (k); } -Cell& +Cell& octave_map::contents (const std::string& k) { octave_idx_type idx = xkeys.getfield (k); @@ -350,8 +350,8 @@ return xvals[idx]; } -void -octave_map::extract_scalar (octave_scalar_map& dest, +void +octave_map::extract_scalar (octave_scalar_map& dest, octave_idx_type idx) const { octave_idx_type nf = nfields (); @@ -403,7 +403,7 @@ } bool -octave_map::fast_elem_insert (octave_idx_type n, +octave_map::fast_elem_insert (octave_idx_type n, const octave_scalar_map& rhs) { bool retval = false; @@ -438,7 +438,7 @@ octave_idx_type nf = nfields (); retval.dimensions = dimensions.squeeze (); - + for (octave_idx_type i = 0; i < nf; i++) retval.xvals[i] = xvals[i].squeeze (); @@ -635,7 +635,7 @@ template static void permute_to_correct_order (octave_idx_type n, octave_idx_type nf, - octave_idx_type idx, const map *map_list, + octave_idx_type idx, const map *map_list, map *new_map_list) { new_map_list[idx] = map_list[idx]; @@ -832,7 +832,7 @@ return retval; } -octave_map +octave_map octave_map::index (const Array& ia, bool resize_ok) const { octave_map retval (xkeys); @@ -856,7 +856,7 @@ return retval; } -octave_map +octave_map octave_map::index (const octave_value_list& idx, bool resize_ok) const { octave_idx_type n_idx = idx.length (); @@ -908,13 +908,13 @@ } // Perhaps one day these will be optimized. Right now, they just call index. -octave_map +octave_map octave_map::column (octave_idx_type k) const { return index (idx_vector::colon, k); } -octave_map +octave_map octave_map::page (octave_idx_type k) const { static Array ia (dim_vector (3, 1), idx_vector::colon); @@ -1111,7 +1111,7 @@ ref = Cell (dimensions); ref.assign (idx, rhs); - + if (! error_state && ref.dims () != dimensions) { dimensions = ref.dims (); @@ -1230,7 +1230,7 @@ error ("field name mismatch in structure concatenation"); break; } - + contents(pa).insert (rb.contents(pb), ra_idx); } } @@ -1470,7 +1470,7 @@ error ("field name mismatch in structure concatenation"); break; } - + retval.assign (key(pa), contents(pa).insert (rb.contents(pb), ra_idx)); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/oct-map.h --- a/src/oct-map.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/oct-map.h Thu Jan 20 17:24:59 2011 -0500 @@ -33,7 +33,7 @@ class string_vector; // A class holding a map field->index. Supports reference-counting. -class OCTINTERP_API +class OCTINTERP_API octave_fields { class fields_rep : public std::map @@ -80,7 +80,7 @@ octave_fields (const octave_fields& o) : rep (o.rep) { rep->count++; } - octave_fields& + octave_fields& operator = (const octave_fields& o) { o.rep->count++; @@ -102,7 +102,7 @@ std::string key (const_iterator p) const { return p->first; } octave_idx_type index (const_iterator p) const { return p->second; } - const_iterator seek (const std::string& k) const + const_iterator seek (const std::string& k) const { return rep->find (k); } // high-level methods. @@ -180,12 +180,12 @@ const_iterator seek (const std::string& k) const { return xkeys.seek (k); } - std::string key (const_iterator p) const + std::string key (const_iterator p) const { return xkeys.key (p); } octave_idx_type index (const_iterator p) const { return xkeys.index (p); } - const octave_value& contents (const_iterator p) const + const octave_value& contents (const_iterator p) const { return xvals[xkeys.index (p)]; } octave_value& contents (iterator p) @@ -201,10 +201,10 @@ octave_idx_type nfields (void) const { return xkeys.nfields (); } // check whether a field exists. - bool isfield (const std::string& name) const + bool isfield (const std::string& name) const { return xkeys.isfield (name); } - bool contains (const std::string& name) const + bool contains (const std::string& name) const { return isfield (name); } string_vector fieldnames (void) const @@ -303,12 +303,12 @@ const_iterator seek (const std::string& k) const { return xkeys.seek (k); } - std::string key (const_iterator p) const + std::string key (const_iterator p) const { return xkeys.key (p); } octave_idx_type index (const_iterator p) const { return xkeys.index (p); } - const Cell& contents (const_iterator p) const + const Cell& contents (const_iterator p) const { return xvals[xkeys.index (p)]; } Cell& contents (iterator p) @@ -324,10 +324,10 @@ octave_idx_type nfields (void) const { return xkeys.nfields (); } // check whether a field exists. - bool isfield (const std::string& name) const + bool isfield (const std::string& name) const { return xkeys.isfield (name); } - bool contains (const std::string& name) const + bool contains (const std::string& name) const { return isfield (name); } string_vector fieldnames (void) const @@ -343,7 +343,7 @@ // correct dimensions. void setfield (const std::string& key, const Cell& val); void assign (const std::string& k, const Cell& val) - { setfield (k, val); } + { setfield (k, val); } // remove a given field. do nothing if not exist. void rmfield (const std::string& key); @@ -390,9 +390,9 @@ operator () (const Array& ra_idx) const { return checkelem (ra_idx); } - octave_map squeeze (void) const; + octave_map squeeze (void) const; - octave_map permute (const Array& vec, bool inv = false) const; + octave_map permute (const Array& vec, bool inv = false) const; dim_vector dims (void) const { return dimensions; } @@ -419,7 +419,7 @@ bool resize_ok = false) const; octave_map index (const octave_value_list&, bool resize_ok = false) const; - + octave_map column (octave_idx_type k) const; octave_map page (octave_idx_type k) const; @@ -430,7 +430,7 @@ void assign (const Array& ia, const octave_map& rhs); void assign (const octave_value_list&, const octave_map& rhs); - + void assign (const octave_value_list& idx, const std::string& k, const Cell& rhs); @@ -457,11 +457,11 @@ dim_vector dimensions; void optimize_dimensions (void); - void extract_scalar (octave_scalar_map& dest, + void extract_scalar (octave_scalar_map& dest, octave_idx_type index) const; - static void do_cat (int dim, octave_idx_type n, + static void do_cat (int dim, octave_idx_type n, const octave_scalar_map *map_list, octave_map& retval); - static void do_cat (int dim, octave_idx_type n, + static void do_cat (int dim, octave_idx_type n, const octave_map *map_list, octave_map& retval); }; @@ -541,9 +541,9 @@ ~Octave_map (void) { } - Octave_map squeeze (void) const; + Octave_map squeeze (void) const; - Octave_map permute (const Array& vec, bool inv = false) const; + Octave_map permute (const Array& vec, bool inv = false) const; // This is the number of keys. octave_idx_type nfields (void) const { return map.size (); } @@ -630,7 +630,7 @@ Octave_map& assign (const std::string& k, const Cell& rhs); - Octave_map index (const octave_value_list& idx, + Octave_map index (const octave_value_list& idx, bool resize_ok = false) const; private: diff -r 1473d0cf86d2 -r 12df7854fa7c src/oct-obj.cc --- a/src/oct-obj.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/oct-obj.cc Thu Jan 20 17:24:59 2011 -0500 @@ -76,7 +76,7 @@ } elem (0) = val; - + return *this; } @@ -124,7 +124,7 @@ octave_value_list octave_value_list::splice (octave_idx_type offset, octave_idx_type rep_length, const octave_value_list& lst) const -{ +{ octave_value_list retval; octave_idx_type len = length (); @@ -187,7 +187,7 @@ if (! dv.all_ones ()) return false; } - + return true; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/oct-obj.h --- a/src/oct-obj.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/oct-obj.h Thu Jan 20 17:24:59 2011 -0500 @@ -111,8 +111,8 @@ bool empty (void) const { return length () == 0; } - void resize (octave_idx_type n, const octave_value& rfv - = Array::resize_fill_value ()) + void resize (octave_idx_type n, const octave_value& rfv + = Array::resize_fill_value ()) { data.resize (dim_vector (1, n), rfv); } @@ -127,7 +127,7 @@ octave_value_list slice (octave_idx_type offset, octave_idx_type len, bool tags = false) const - { + { octave_value_list retval (data.linear_slice (offset, offset + len)); if (tags && len > 0 && names.length () > 0) retval.names = names.linear_slice (offset, std::min (len, names.length ())); diff -r 1473d0cf86d2 -r 12df7854fa7c src/oct-parse.yy --- a/src/oct-parse.yy Thu Jan 20 17:21:27 2011 -0500 +++ b/src/oct-parse.yy Thu Jan 20 17:24:59 2011 -0500 @@ -637,10 +637,10 @@ : SUPERCLASSREF { $$ = new tree_identifier ($1->line (), $1->column ()); } ; - + meta_identifier : METAQUERY { $$ = new tree_identifier ($1->line (), $1->column ()); } - ; + ; string : DQ_STRING { $$ = make_constant (DQ_STRING, $1); } @@ -737,7 +737,7 @@ anon_fcn_handle : '@' param_list statement { $$ = make_anon_fcn_handle ($2, $3); } ; - + primary_expr : identifier { $$ = $1; } | constant @@ -1108,7 +1108,7 @@ { $1->append ($2); $$ = $1; - } + } ; case_list1 : switch_case @@ -1355,8 +1355,8 @@ { $$ = $3; - if (reading_classdef_file || lexer_flags.parsing_classdef) - lexer_flags.maybe_classdef_get_set_method = true; + if (reading_classdef_file || lexer_flags.parsing_classdef) + lexer_flags.maybe_classdef_get_set_method = true; } ; @@ -1378,7 +1378,7 @@ lexer_flags.parsed_function_name.top () = true; lexer_flags.maybe_classdef_get_set_method = false; - + $$ = $1; } | GET '.' identifier @@ -1587,7 +1587,7 @@ class_event : identifier { $$ = 0; } ; - + // ============= // Miscellaneous // ============= @@ -1717,19 +1717,19 @@ break; case token::switch_end: - error (fmt, type, "endswitch", l, c); + error (fmt, type, "endswitch", l, c); break; case token::while_end: - error (fmt, type, "endwhile", l, c); + error (fmt, type, "endwhile", l, c); break; case token::try_catch_end: - error (fmt, type, "end_try_catch", l, c); + error (fmt, type, "end_try_catch", l, c); break; case token::unwind_protect_end: - error (fmt, type, "end_unwind_protect", l, c); + error (fmt, type, "end_unwind_protect", l, c); break; default: @@ -2920,7 +2920,7 @@ if (reading_fcn_file && current_function_depth == 1 && ! parsing_subfunctions) primary_fcn_ptr = fcn; - + return fcn; } @@ -3009,7 +3009,7 @@ char type) { tree_index_expression *retval = 0; - + if (args && args->has_magic_tilde ()) { yyerror ("invalid use of empty argument (~) in index expression"); @@ -3277,7 +3277,7 @@ if (! s.empty ()) { size_t offset = s.find_first_not_of (" \t"); - + retval = (s.substr (offset, 9) == "Copyright"); } @@ -3322,7 +3322,7 @@ return ::ungetc (c, f); } - + private: FILE *f; }; @@ -3559,7 +3559,7 @@ // Do this with an unwind-protect cleanup function so that // the forced variables will be unmarked in the event of an - // interrupt. + // interrupt. symbol_table::scope_id scope = symbol_table::top_scope (); frame.add_fcn (symbol_table::unmark_forced_variables, scope); @@ -3605,7 +3605,7 @@ else if (require_file) error ("no such file, `%s'", ff.c_str ()); else if (! warn_for.empty ()) - error ("%s: unable to open file `%s'", warn_for.c_str (), ff.c_str ()); + error ("%s: unable to open file `%s'", warn_for.c_str (), ff.c_str ()); return fcn_ptr; } @@ -3671,7 +3671,7 @@ return retval; } -string_vector +string_vector autoloaded_functions (void) { string_vector names (autoload_map.size()); @@ -3759,8 +3759,8 @@ curr_fcn_file_name = nm; curr_fcn_file_full_name = file.substr (0, len - 2); - octave_function *tmpfcn = parse_fcn_file (file.substr (0, len - 2), - dispatch_type, autoloading, + octave_function *tmpfcn = parse_fcn_file (file.substr (0, len - 2), + dispatch_type, autoloading, false); retval = octave_dynamic_loader::load_mex (nm, file, fcn_file_from_relative_lookup); @@ -3978,7 +3978,7 @@ if (! error_state) frame.add_fcn (octave_call_stack::pop); - } + } if (! error_state) { @@ -4121,7 +4121,7 @@ // Evaluate an Octave function (built-in or interpreted) and return // the list of result values. NAME is the name of the function to // call. ARGS are the arguments to the function. NARGOUT is the -// number of output arguments expected. +// number of output arguments expected. octave_value_list feval (const std::string& name, const octave_value_list& args, int nargout) @@ -4244,14 +4244,14 @@ another function for the given type signature.\n\ @end deftypefn") { - octave_value_list retval; + octave_value_list retval; int nargin = args.length (); if (nargin > 0) { const std::string name (args(0).string_value ()); - + if (! error_state) { octave_value fcn = symbol_table::builtin_find (name); diff -r 1473d0cf86d2 -r 12df7854fa7c src/oct-procbuf.cc --- a/src/oct-procbuf.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/oct-procbuf.cc Thu Jan 20 17:24:59 2011 -0500 @@ -56,7 +56,7 @@ { #if defined (__CYGWIN__) || defined (__MINGW32__) || defined (_MSC_VER) - if (is_open ()) + if (is_open ()) return 0; f = octave_popen (command, (mode & std::ios::in) ? "r" : "w"); @@ -74,7 +74,7 @@ ::setvbuf (f, 0, _IOLBF, BUFSIZ); return this; - + #elif defined (HAVE_SYS_WAIT_H) int pipe_fds[2]; @@ -171,7 +171,7 @@ open_p = false; return this; - + #elif defined (HAVE_SYS_WAIT_H) if (f) diff -r 1473d0cf86d2 -r 12df7854fa7c src/oct-stream.cc --- a/src/oct-stream.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/oct-stream.cc Thu Jan 20 17:24:59 2011 -0500 @@ -240,7 +240,7 @@ { scanf_format_elt *elt = list(i); delete elt; - } + } } void @@ -668,7 +668,7 @@ { printf_format_elt *elt = list(i); delete elt; - } + } } void @@ -922,7 +922,7 @@ { ::error ("%s: unable to read from stdin while running interactively", who.c_str ()); - + return retval; } @@ -1036,7 +1036,7 @@ { ::error ("%s: unable to read from stdin while running interactively", who.c_str ()); - + return count; } @@ -1174,7 +1174,7 @@ return is; } -// Note that this specialization is only used for reading characters, not +// Note that this specialization is only used for reading characters, not // character strings. See BEGIN_S_CONVERSION for details. template<> @@ -1389,7 +1389,7 @@ do_scanf_conv (std::istream& is, const scanf_format_elt& fmt, T valptr, Matrix& mval, double *data, octave_idx_type& idx, octave_idx_type& conversion_count, octave_idx_type nr, octave_idx_type max_size, - bool discard) + bool discard) { OCTAVE_SCAN (is, fmt, valptr); @@ -1671,7 +1671,7 @@ { ::error ("%s: unable to read from stdin while running interactively", who.c_str ()); - + return retval; } @@ -2614,7 +2614,7 @@ int nsa = (elt->fw < 0) + (elt->prec < 0); int sa_1 = 0; - int sa_2 = 0; + int sa_2 = 0; if (nsa > 0) { @@ -2645,7 +2645,7 @@ { os << elt->text; retval += strlen (elt->text); - } + } else if (elt->type == 's') { std::string val = val_cache.string_value (); @@ -2735,7 +2735,7 @@ if (! elt || (val_cache.exhausted () && elt->args > 0)) break; - } + } } else invalid_operation (who, "writing"); @@ -3917,7 +3917,7 @@ if (tc_s.is_string ()) { - std::string s = tc_s.string_value (); + std::string s = tc_s.string_value (); retval = puts (s, who); } else @@ -3993,7 +3993,7 @@ if (in_mode == std::ios::in) retval = "r"; - else if (in_mode == std::ios::out + else if (in_mode == std::ios::out || in_mode == (std::ios::out | std::ios::trunc)) retval = "w"; else if (in_mode == (std::ios::out | std::ios::app)) @@ -4013,7 +4013,7 @@ retval = "ab"; else if (in_mode == (std::ios::in | std::ios::out | std::ios::binary)) retval = "r+b"; - else if (in_mode == (std::ios::in | std::ios::out | std::ios::trunc + else if (in_mode == (std::ios::in | std::ios::out | std::ios::trunc | std::ios::binary)) retval = "w+b"; else if (in_mode == (std::ios::in | std::ios::out | std::ios::ate diff -r 1473d0cf86d2 -r 12df7854fa7c src/oct-stream.h --- a/src/oct-stream.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/oct-stream.h Thu Jan 20 17:24:59 2011 -0500 @@ -167,7 +167,7 @@ void add_elt_to_list (int width, bool discard, char type, char modifier, octave_idx_type& num_elts, - const std::string& char_class = std::string ()); + const std::string& char_class = std::string ()); void process_conversion (const std::string& s, size_t& i, size_t n, int& width, bool& discard, char& type, @@ -215,7 +215,7 @@ } ~printf_format_elt (void) { delete [] text; } - + // The C-style format string. const char *text; @@ -302,12 +302,12 @@ void add_elt_to_list (int args, const std::string& flags, int fw, int prec, char type, char modifier, octave_idx_type& num_elts); - + void process_conversion (const std::string& s, size_t& i, size_t n, int& args, std::string& flags, int& fw, int& prec, char& modifier, char& type, - octave_idx_type& num_elts); - + octave_idx_type& num_elts); + void finish_conversion (const std::string& s, size_t& i, int args, const std::string& flags, int fw, int prec, char modifier, char& type, diff -r 1473d0cf86d2 -r 12df7854fa7c src/octave.cc --- a/src/octave.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/octave.cc Thu Jan 20 17:24:59 2011 -0500 @@ -113,7 +113,7 @@ static bool verbose_flag = false; // Usage message -static const char *usage_string = +static const char *usage_string = "octave [-HVdfhiqvx] [--debug] [--echo-commands] [--eval CODE]\n\ [--exec-path path] [--help] [--image-path path] [--info-file file]\n\ [--info-program prog] [--interactive] [--line-editing]\n\ @@ -484,7 +484,7 @@ octave_program_invocation_name = curr_fcn_file_name; size_t pos = curr_fcn_file_name.find_last_of (file_ops::dir_sep_chars ()); - + std::string tmp = (pos != std::string::npos) ? curr_fcn_file_name.substr (pos+1) : curr_fcn_file_name; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base-diag.cc --- a/src/ov-base-diag.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base-diag.cc Thu Jan 20 17:24:59 2011 -0500 @@ -106,7 +106,7 @@ } template -octave_value +octave_value octave_base_diag::subsasgn (const std::string& type, const std::list& idx, const octave_value& rhs) @@ -126,11 +126,11 @@ { typename DMT::element_type val; idx_vector i0 = jdx(0).index_vector (), i1 = jdx(1).index_vector (); - if (! error_state && i0(0) == i1(0) + if (! error_state && i0(0) == i1(0) && i0(0) < matrix.rows () && i1(0) < matrix.cols () && chk_valid_scalar (rhs, val)) { - matrix.dgelem (i0(0)) = val; + matrix.dgelem (i0(0)) = val; retval = this; this->count++; // invalidate cache @@ -354,25 +354,25 @@ boolNDArray octave_base_diag::bool_array_value (bool warn) const { - return to_dense ().bool_array_value (warn); + return to_dense ().bool_array_value (warn); } - + template charNDArray octave_base_diag::char_array_value (bool warn) const { - return to_dense ().char_array_value (warn); + return to_dense ().char_array_value (warn); } - + template -SparseMatrix +SparseMatrix octave_base_diag::sparse_matrix_value (bool) const { return SparseMatrix (diag_matrix_value ()); } template -SparseComplexMatrix +SparseComplexMatrix octave_base_diag::sparse_complex_matrix_value (bool) const { return SparseComplexMatrix (complex_diag_matrix_value ()); @@ -393,7 +393,7 @@ } template -bool +bool octave_base_diag::save_ascii (std::ostream& os) { os << "# rows: " << matrix.rows () << "\n" @@ -405,7 +405,7 @@ } template -bool +bool octave_base_diag::load_ascii (std::istream& is) { octave_idx_type r = 0, c = 0; @@ -418,7 +418,7 @@ MT tmp (l, 1); is >> tmp; - if (!is) + if (!is) { error ("load: failed to load diagonal matrix constant"); success = false; @@ -482,8 +482,8 @@ octave_base_diag::write (octave_stream& os, int block_size, oct_data_conv::data_type output_type, int skip, oct_mach_info::float_format flt_fmt) const -{ - return to_dense ().write (os, block_size, output_type, skip, flt_fmt); +{ + return to_dense ().write (os, block_size, output_type, skip, flt_fmt); } template diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base-diag.h --- a/src/ov-base-diag.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base-diag.h Thu Jan 20 17:24:59 2011 -0500 @@ -149,14 +149,14 @@ FloatComplexMatrix float_complex_matrix_value (bool = false) const; ComplexNDArray complex_array_value (bool = false) const; - + FloatComplexNDArray float_complex_array_value (bool = false) const; - + boolNDArray bool_array_value (bool warn = false) const; charNDArray char_array_value (bool = false) const; - - NDArray array_value (bool = false) const; + + NDArray array_value (bool = false) const; FloatNDArray float_array_value (bool = false) const; @@ -214,7 +214,7 @@ octave_value to_dense (void) const; - virtual bool chk_valid_scalar (const octave_value&, + virtual bool chk_valid_scalar (const octave_value&, typename DMT::element_type&) const = 0; private: diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base-int.cc --- a/src/ov-base-int.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base-int.cc Thu Jan 20 17:24:59 2011 -0500 @@ -194,7 +194,7 @@ } template -bool +bool octave_base_int_matrix::load_ascii (std::istream& is) { int mdims = 0; @@ -214,7 +214,7 @@ is >> tmp; - if (!is) + if (!is) { error ("load: failed to load matrix constant"); success = false; @@ -235,7 +235,7 @@ } template -bool +bool octave_base_int_matrix::save_binary (std::ostream& os, bool&) { dim_vector d = this->dims (); @@ -304,7 +304,7 @@ { int nel = dv.numel (); int bytes = nel / m.byte_size(); - for (int i = 0; i < nel; i++) + for (int i = 0; i < nel; i++) switch (bytes) { case 8: @@ -346,15 +346,15 @@ // Octave uses column-major, while HDF5 uses row-major ordering for (int i = 0; i < rank; i++) hdims[i] = dv (rank-i-1); - + space_hid = H5Screate_simple (rank, hdims, 0); if (space_hid < 0) return false; #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, H5P_DEFAULT); #endif if (data_hid < 0) @@ -393,7 +393,7 @@ hid_t space_id = H5Dget_space (data_hid); hsize_t rank = H5Sget_simple_extent_ndims (space_id); - + if (rank < 1) { H5Sclose (space_id); @@ -421,8 +421,8 @@ } T m (dv); - if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL, - H5P_DEFAULT, m.fortran_vec()) >= 0) + if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL, + H5P_DEFAULT, m.fortran_vec()) >= 0) { retval = true; this->matrix = m; @@ -485,7 +485,7 @@ } template -bool +bool octave_base_int_scalar::load_ascii (std::istream& is) { is >> this->scalar; @@ -498,7 +498,7 @@ } template -bool +bool octave_base_int_scalar::save_binary (std::ostream& os, bool&) { os.write (reinterpret_cast (&(this->scalar)), this->byte_size()); @@ -506,7 +506,7 @@ } template -bool +bool octave_base_int_scalar::load_binary (std::istream& is, bool swap, oct_mach_info::float_format) { @@ -549,13 +549,13 @@ if (space_hid < 0) return false; #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); return false; @@ -585,15 +585,15 @@ hsize_t rank = H5Sget_simple_extent_ndims (space_id); if (rank != 0) - { + { H5Dclose (data_hid); return false; } T tmp; - if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) < 0) - { + { H5Dclose (data_hid); return false; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base-int.h --- a/src/ov-base-int.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base-int.h Thu Jan 20 17:24:59 2011 -0500 @@ -73,7 +73,7 @@ bool save_binary (std::ostream& os, bool& ); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format ); #if defined (HAVE_HDF5) @@ -116,7 +116,7 @@ bool save_binary (std::ostream& os, bool& ); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format ); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base-mat.cc --- a/src/ov-base-mat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base-mat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -267,10 +267,10 @@ } template -MatrixType +MatrixType octave_base_matrix::matrix_type (const MatrixType& _typ) const -{ - delete typ; +{ + delete typ; typ = new MatrixType (_typ); return *typ; } @@ -391,11 +391,11 @@ octave_value octave_base_matrix::resize (const dim_vector& dv, bool fill) const { - MT retval (matrix); + MT retval (matrix); if (fill) retval.resize (dv, 0); else - retval.resize (dv); + retval.resize (dv); return retval; } @@ -461,7 +461,7 @@ template bool -octave_base_matrix::fast_elem_insert (octave_idx_type n, +octave_base_matrix::fast_elem_insert (octave_idx_type n, const octave_value& x) { if (n < matrix.numel ()) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base-mat.h --- a/src/ov-base-mat.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base-mat.h Thu Jan 20 17:24:59 2011 -0500 @@ -52,7 +52,7 @@ : octave_base_value (), matrix (), typ (), idx_cache () { } octave_base_matrix (const MT& m, const MatrixType& t = MatrixType ()) - : octave_base_value (), matrix (m), + : octave_base_value (), matrix (m), typ (t.is_known () ? new MatrixType(t) : 0), idx_cache () { if (matrix.ndims () == 0) @@ -60,9 +60,9 @@ } octave_base_matrix (const octave_base_matrix& m) - : octave_base_value (), matrix (m.matrix), - typ (m.typ ? new MatrixType (*m.typ) : 0), - idx_cache (m.idx_cache ? new idx_vector (*m.idx_cache) : 0) + : octave_base_value (), matrix (m.matrix), + typ (m.typ ? new MatrixType (*m.typ) : 0), + idx_cache (m.idx_cache ? new idx_vector (*m.idx_cache) : 0) { } ~octave_base_matrix (void) { clear_cached_info (); } @@ -183,7 +183,7 @@ { delete typ; typ = 0; delete idx_cache; idx_cache = 0; - } + } mutable MatrixType *typ; mutable idx_vector *idx_cache; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base-scalar.cc --- a/src/ov-base-scalar.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base-scalar.cc Thu Jan 20 17:24:59 2011 -0500 @@ -158,7 +158,7 @@ { indent (os); os << name << " = "; - return false; + return false; } template diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base-scalar.h --- a/src/ov-base-scalar.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base-scalar.h Thu Jan 20 17:24:59 2011 -0500 @@ -99,10 +99,10 @@ { return octave_value (scalar); } octave_value sort (Array &sidx, octave_idx_type, sortmode) const - { - sidx.resize (dim_vector (1, 1)); - sidx(0) = 0; - return octave_value (scalar); + { + sidx.resize (dim_vector (1, 1)); + sidx(0) = 0; + return octave_value (scalar); } sortmode is_sorted (sortmode mode = UNSORTED) const diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base-sparse.cc --- a/src/ov-base-sparse.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base-sparse.cc Thu Jan 20 17:24:59 2011 -0500 @@ -45,7 +45,7 @@ template octave_value -octave_base_sparse::do_index_op (const octave_value_list& idx, +octave_base_sparse::do_index_op (const octave_value_list& idx, bool resize_ok) { octave_value retval; @@ -116,7 +116,7 @@ } template -octave_value +octave_value octave_base_sparse::subsasgn (const std::string& type, const std::list& idx, const octave_value& rhs) @@ -163,7 +163,7 @@ } template -void +void octave_base_sparse::assign (const octave_value_list& idx, const T& rhs) { @@ -247,16 +247,16 @@ } template -octave_value +octave_value octave_base_sparse::resize (const dim_vector& dv, bool) const -{ - T retval (matrix); - retval.resize (dv); - return retval; +{ + T retval (matrix); + retval.resize (dv); + return retval; } template -bool +bool octave_base_sparse::is_true (void) const { bool retval = false; @@ -277,7 +277,7 @@ } template -bool +bool octave_base_sparse::print_as_scalar (void) const { dim_vector dv = dims (); @@ -286,7 +286,7 @@ } template -void +void octave_base_sparse::print (std::ostream& os, bool pr_as_read_syntax) const { print_raw (os, pr_as_read_syntax); @@ -294,8 +294,8 @@ } template -void -octave_base_sparse::print_info (std::ostream& os, +void +octave_base_sparse::print_info (std::ostream& os, const std::string& prefix) const { matrix.print_info (os, prefix); @@ -395,7 +395,7 @@ } template -bool +bool octave_base_sparse::load_ascii (std::istream& is) { octave_idx_type nz = 0; @@ -411,7 +411,7 @@ is >> tmp; - if (!is) + if (!is) { error ("load: failed to load matrix constant"); success = false; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base-sparse.h --- a/src/ov-base-sparse.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base-sparse.h Thu Jan 20 17:24:59 2011 -0500 @@ -48,9 +48,9 @@ octave_base_sparse : public octave_base_value { public: - + octave_base_sparse (void) - : octave_base_value (), matrix (), typ (MatrixType ()) + : octave_base_value (), matrix (), typ (MatrixType ()) { } octave_base_sparse (const T& a) : octave_base_value (), matrix (a), @@ -60,14 +60,14 @@ matrix.resize (dim_vector (0, 0)); } - octave_base_sparse (const T& a, const MatrixType& t) : octave_base_value (), + octave_base_sparse (const T& a, const MatrixType& t) : octave_base_value (), matrix (a), typ (t) { if (matrix.ndims () == 0) matrix.resize (dim_vector (0, 0)); } - octave_base_sparse (const octave_base_sparse& a) : + octave_base_sparse (const octave_base_sparse& a) : octave_base_value (), matrix (a.matrix), typ (a.typ) { } ~octave_base_sparse (void) { } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base.cc --- a/src/ov-base.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base.cc Thu Jan 20 17:24:59 2011 -0500 @@ -68,7 +68,7 @@ retval = x; else if (x <= btyp_float && y <= btyp_uint64) retval = y; - else if ((x >= btyp_int8 && x <= btyp_int64 + else if ((x >= btyp_int8 && x <= btyp_int64 && y >= btyp_int8 && y <= btyp_int64) || (x >= btyp_uint8 && x <= btyp_uint64 && y >= btyp_uint8 && y <= btyp_uint64)) @@ -77,7 +77,7 @@ return retval; } -std::string btyp_class_name[btyp_num_types] = +std::string btyp_class_name[btyp_num_types] = { "double", "single", "double", "single", "int8", "int16", "int32", "int64", @@ -329,14 +329,14 @@ return octave_value (); } -MatrixType +MatrixType octave_base_value::matrix_type (void) const { gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ()); return MatrixType (); } -MatrixType +MatrixType octave_base_value::matrix_type (const MatrixType&) const { gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ()); @@ -417,7 +417,7 @@ void octave_base_value::print_with_name (std::ostream& output_buf, - const std::string& name, + const std::string& name, bool print_padding) { bool pad_after = print_name_tag (output_buf, name); @@ -1034,28 +1034,28 @@ return retval; } -bool +bool octave_base_value::save_ascii (std::ostream&) { gripe_wrong_type_arg ("octave_base_value::save_ascii()", type_name ()); return false; } -bool +bool octave_base_value::load_ascii (std::istream&) { gripe_wrong_type_arg ("octave_base_value::load_ascii()", type_name ()); return false; } -bool +bool octave_base_value::save_binary (std::ostream&, bool&) { gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ()); return false; } -bool +bool octave_base_value::load_binary (std::istream&, bool, oct_mach_info::float_format) { @@ -1073,7 +1073,7 @@ return false; } -bool +bool octave_base_value::load_hdf5 (hid_t, const char *) { gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ()); @@ -1117,7 +1117,7 @@ } octave_value -octave_base_value::sort (Array &, +octave_base_value::sort (Array &, octave_idx_type, sortmode) const { gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ()); @@ -1153,7 +1153,7 @@ const char * octave_base_value::get_umap_name (unary_mapper_t umap) { - static const char *names[num_unary_mappers] = + static const char *names[num_unary_mappers] = { "abs", "acos", @@ -1349,7 +1349,7 @@ if (cf_rhs.type_id () >= 0 && (octave_value_typeinfo::lookup_assign_op (octave_value::op_asn_eq, t_lhs, cf_rhs.type_id ()) - || octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, + || octave_value_typeinfo::lookup_pref_assign_conv (t_lhs, cf_rhs.type_id ()) >= 0)) cf_this = 0; else if (cf_this.type_id () >= 0 @@ -1426,7 +1426,7 @@ octave_base_value::indent (std::ostream& os) const { assert (curr_print_indent_level >= 0); - + if (beginning_of_line) { // FIXME -- do we need this? @@ -1471,7 +1471,7 @@ return false; } -bool +bool octave_base_value::fast_elem_insert_self (void *, builtin_type_t) const { return false; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-base.h --- a/src/ov-base.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-base.h Thu Jan 20 17:24:59 2011 -0500 @@ -79,11 +79,11 @@ btyp_num_types = btyp_unknown }; -extern OCTINTERP_API std::string +extern OCTINTERP_API std::string btyp_class_name [btyp_num_types]; extern OCTINTERP_API string_vector -get_builtin_classes (void); +get_builtin_classes (void); inline bool btyp_isnumeric (builtin_type_t btyp) { return btyp <= btyp_uint64; } @@ -192,7 +192,7 @@ operator type_conv_fcn (void) const { return _fcn; } - octave_base_value * operator () (const octave_base_value &v) const + octave_base_value * operator () (const octave_base_value &v) const { return (*_fcn) (v); } int type_id (void) const { return _type_id; } @@ -240,7 +240,7 @@ virtual void maybe_economize (void) { } - virtual Matrix size (void); + virtual Matrix size (void); virtual octave_idx_type numel (const octave_value_list&); @@ -505,11 +505,11 @@ virtual DiagMatrix diag_matrix_value (bool = false) const; virtual FloatDiagMatrix float_diag_matrix_value (bool = false) const; - + virtual ComplexDiagMatrix complex_diag_matrix_value (bool = false) const; - + virtual FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const; - + virtual PermMatrix perm_matrix_value (void) const; virtual octave_int8 int8_scalar_value (void) const; @@ -602,7 +602,7 @@ print_name_tag (std::ostream& os, const std::string& name) const; virtual void - print_with_name (std::ostream& output_buf, const std::string& name, + print_with_name (std::ostream& output_buf, const std::string& name, bool print_padding = true); virtual void print_info (std::ostream& os, const std::string& prefix) const; @@ -613,7 +613,7 @@ virtual bool save_binary (std::ostream& os, bool& save_as_floats); - virtual bool load_binary (std::istream& is, bool swap, + virtual bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) @@ -639,9 +639,9 @@ virtual octave_value diag (octave_idx_type k = 0) const; - virtual octave_value sort (octave_idx_type dim = 0, + virtual octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const; - virtual octave_value sort (Array &sidx, + virtual octave_value sort (Array &sidx, octave_idx_type dim = 0, sortmode mode = ASCENDING) const; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-bool-mat.cc --- a/src/ov-bool-mat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-bool-mat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -182,7 +182,7 @@ current_print_indent_level ()); } -bool +bool octave_bool_matrix::save_ascii (std::ostream& os) { dim_vector d = dims (); @@ -198,7 +198,7 @@ } else { - // Keep this case, rather than use generic code above for backward + // Keep this case, rather than use generic code above for backward // compatiability. Makes load_ascii much more complex!! os << "# rows: " << rows () << "\n" << "# columns: " << columns () << "\n"; @@ -211,7 +211,7 @@ return true; } -bool +bool octave_bool_matrix::load_ascii (std::istream& is) { bool success = true; @@ -286,7 +286,7 @@ { Matrix tmp (nr, nc); is >> tmp; - if (is) + if (is) { boolMatrix btmp (nr, nc); for (octave_idx_type j = 0; j < nc; j++) @@ -324,7 +324,7 @@ return success; } -bool +bool octave_bool_matrix::save_binary (std::ostream& os, bool& /* save_as_floats */) { @@ -354,7 +354,7 @@ return true; } -bool +bool octave_bool_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format /* fmt */) { @@ -382,7 +382,7 @@ swap_bytes<4> (&di); dv(i) = di; } - + // Convert an array with a single dimension to be a row vector. // Octave should never write files like this, other software // might. @@ -433,10 +433,10 @@ space_hid = H5Screate_simple (rank, hdims, 0); if (space_hid < 0) return false; #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid, H5P_DEFAULT); #endif if (data_hid < 0) @@ -448,7 +448,7 @@ octave_idx_type nel = m.nelem (); bool *mtmp = m.fortran_vec (); OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel); - + for (octave_idx_type i = 0; i < nel; i++) htmp[i] = mtmp[i]; @@ -481,7 +481,7 @@ hid_t space_id = H5Dget_space (data_hid); hsize_t rank = H5Sget_simple_extent_ndims (space_id); - + if (rank < 1) { H5Dclose (data_hid); @@ -509,7 +509,7 @@ octave_idx_type nel = dv.numel (); OCTAVE_LOCAL_BUFFER (hbool_t, htmp, nel); - if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL, H5P_DEFAULT, htmp) >= 0) + if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL, H5P_DEFAULT, htmp) >= 0) { retval = true; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-bool-mat.h --- a/src/ov-bool-mat.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-bool-mat.h Thu Jan 20 17:24:59 2011 -0500 @@ -68,8 +68,8 @@ : octave_base_matrix (bm, t) { } octave_bool_matrix (const boolNDArray& bm, const idx_vector& cache) - : octave_base_matrix (bm) - { + : octave_base_matrix (bm) + { set_idx_cache (cache); } @@ -85,7 +85,7 @@ octave_base_value *try_narrowing_conversion (void); - idx_vector index_vector (void) const + idx_vector index_vector (void) const { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } builtin_type_t builtin_type (void) const { return btyp_bool; } @@ -163,7 +163,7 @@ charNDArray retval (dims ()); octave_idx_type nel = numel (); - + for (octave_idx_type i = 0; i < nel; i++) retval(i) = static_cast(matrix(i)); @@ -198,7 +198,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-bool-sparse.cc --- a/src/ov-bool-sparse.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-bool-sparse.cc Thu Jan 20 17:24:59 2011 -0500 @@ -160,7 +160,7 @@ return ComplexNDArray (ComplexMatrix (matrix.matrix_value ())); } -NDArray +NDArray octave_sparse_bool_matrix::array_value (bool) const { return NDArray (Matrix(matrix.matrix_value ())); @@ -180,32 +180,32 @@ return retval; } -boolMatrix +boolMatrix octave_sparse_bool_matrix::bool_matrix_value (bool) const -{ - return matrix.matrix_value (); +{ + return matrix.matrix_value (); } -boolNDArray +boolNDArray octave_sparse_bool_matrix::bool_array_value (bool) const -{ - return boolNDArray (matrix.matrix_value ()); +{ + return boolNDArray (matrix.matrix_value ()); } -SparseMatrix +SparseMatrix octave_sparse_bool_matrix::sparse_matrix_value (bool) const { return SparseMatrix (this->matrix); } -SparseComplexMatrix +SparseComplexMatrix octave_sparse_bool_matrix::sparse_complex_matrix_value (bool) const { return SparseComplexMatrix (this->matrix); } -bool +bool octave_sparse_bool_matrix::save_binary (std::ostream& os, bool&) { dim_vector d = this->dims (); @@ -221,31 +221,31 @@ int32_t itmp; // Use negative value for ndims to be consistent with other formats - itmp= -2; + itmp= -2; os.write (reinterpret_cast (&itmp), 4); - - itmp= nr; + + itmp= nr; os.write (reinterpret_cast (&itmp), 4); - + itmp= nc; os.write (reinterpret_cast (&itmp), 4); - + itmp= nz; os.write (reinterpret_cast (&itmp), 4); // add one to the printed indices to go from // zero-based to one-based arrays - for (int i = 0; i < nc+1; i++) + for (int i = 0; i < nc+1; i++) { octave_quit (); itmp = matrix.cidx(i); os.write (reinterpret_cast (&itmp), 4); } - for (int i = 0; i < nz; i++) + for (int i = 0; i < nz; i++) { octave_quit (); - itmp = matrix.ridx(i); + itmp = matrix.ridx(i); os.write (reinterpret_cast (&itmp), 4); } @@ -253,7 +253,7 @@ for (int i = 0; i < nz; i++) htmp[i] = (matrix.data (i) ? 1 : 0); - + os.write (htmp, nz); return true; @@ -293,7 +293,7 @@ static_cast (nc), static_cast (nz)); - for (int i = 0; i < nc+1; i++) + for (int i = 0; i < nc+1; i++) { octave_quit (); if (! is.read (reinterpret_cast (&tmp), 4)) @@ -303,7 +303,7 @@ m.cidx(i) = tmp; } - for (int i = 0; i < nz; i++) + for (int i = 0; i < nz; i++) { octave_quit (); if (! is.read (reinterpret_cast (&tmp), 4)) @@ -323,7 +323,7 @@ for (int i = 0; i < nz; i++) m.data(i) = (htmp[i] ? 1 : 0); - + if (! m.indices_ok ()) return false; @@ -359,7 +359,7 @@ hsize_t hdims[2]; space_hid = H5Screate_simple (0, hdims, 0); - if (space_hid < 0) + if (space_hid < 0) { H5Gclose (group_hid); return false; @@ -371,13 +371,13 @@ data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + tmp = m.rows (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0; H5Dclose (data_hid); @@ -386,7 +386,7 @@ H5Sclose (space_hid); H5Gclose (group_hid); return false; - } + } #if HAVE_HDF5_18 data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, @@ -395,13 +395,13 @@ data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + tmp = m.cols (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0; @@ -411,22 +411,22 @@ H5Sclose (space_hid); H5Gclose (group_hid); return false; - } + } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + tmp = m.nnz (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0; @@ -445,26 +445,26 @@ space_hid = H5Screate_simple (2, hdims, 0); - if (space_hid < 0) + if (space_hid < 0) { H5Gclose (group_hid); return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + octave_idx_type * itmp = m.xcidx (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) >= 0; @@ -474,7 +474,7 @@ H5Sclose (space_hid); H5Gclose (group_hid); return false; - } + } H5Sclose (space_hid); @@ -483,26 +483,26 @@ space_hid = H5Screate_simple (2, hdims, 0); - if (space_hid < 0) + if (space_hid < 0) { H5Gclose (group_hid); return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + itmp = m.xridx (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) >= 0; @@ -515,20 +515,20 @@ } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "data", H5T_NATIVE_HBOOL, space_hid, + data_hid = H5Dcreate (group_hid, "data", H5T_NATIVE_HBOOL, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "data", H5T_NATIVE_HBOOL, space_hid, + data_hid = H5Dcreate (group_hid, "data", H5T_NATIVE_HBOOL, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - OCTAVE_LOCAL_BUFFER (hbool_t, htmp, m.nnz ()); + OCTAVE_LOCAL_BUFFER (hbool_t, htmp, m.nnz ()); for (int i = 0; i < m.nnz (); i++) htmp[i] = m.xdata(i); @@ -547,7 +547,7 @@ octave_idx_type nr, nc, nz; hid_t group_hid, data_hid, space_hid; hsize_t rank; - + dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) @@ -571,14 +571,14 @@ rank = H5Sget_simple_extent_ndims (space_hid); if (rank != 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; } if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nr) < 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; @@ -595,14 +595,14 @@ rank = H5Sget_simple_extent_ndims (space_hid); if (rank != 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; } if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nc) < 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; @@ -619,14 +619,14 @@ rank = H5Sget_simple_extent_ndims (space_hid); if (rank != 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; } if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nz) < 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; @@ -669,7 +669,7 @@ } octave_idx_type *itmp = m.xcidx (); - if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0) + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0) { H5Sclose (space_hid); H5Dclose (data_hid); @@ -709,7 +709,7 @@ itmp = m.xridx (); if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, - H5P_DEFAULT, itmp) < 0) + H5P_DEFAULT, itmp) < 0) { H5Sclose (space_hid); H5Dclose (data_hid); @@ -774,7 +774,7 @@ octave_sparse_bool_matrix::as_mxArray (void) const { mwSize nz = nzmax (); - mxArray *retval = new mxArray (mxLOGICAL_CLASS, rows (), columns (), + mxArray *retval = new mxArray (mxLOGICAL_CLASS, rows (), columns (), nz, mxREAL); bool *pr = static_cast (retval->get_data ()); mwIndex *ir = retval->get_ir (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-bool-sparse.h --- a/src/ov-bool-sparse.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-bool-sparse.h Thu Jan 20 17:24:59 2011 -0500 @@ -84,7 +84,7 @@ octave_base_value *try_narrowing_conversion (void); // FIXME Adapt idx_vector to allow sparse logical indexing!! - idx_vector index_vector (void) const + idx_vector index_vector (void) const { return idx_vector (bool_array_value ()); } builtin_type_t builtin_type (void) const { return btyp_bool; } @@ -129,7 +129,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-bool.cc --- a/src/ov-bool.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-bool.cc Thu Jan 20 17:24:59 2011 -0500 @@ -83,22 +83,22 @@ return tmp.do_index_op (idx, resize_ok); } -octave_value +octave_value octave_bool::resize (const dim_vector& dv, bool fill) const -{ +{ if (fill) { - boolNDArray retval (dv, false); - if (dv.numel()) - retval(0) = scalar; - return retval; + boolNDArray retval (dv, false); + if (dv.numel()) + retval(0) = scalar; + return retval; } else { - boolNDArray retval (dv); - if (dv.numel()) - retval(0) = scalar; - return retval; + boolNDArray retval (dv); + if (dv.numel()) + retval(0) = scalar; + return retval; } } @@ -112,7 +112,7 @@ return octave_value (s, type); } -bool +bool octave_bool::save_ascii (std::ostream& os) { double d = double_value (); @@ -123,7 +123,7 @@ return true; } -bool +bool octave_bool::load_ascii (std::istream& is) { scalar = (octave_read_value (is) != 0.); @@ -137,7 +137,7 @@ return true; } -bool +bool octave_bool::save_binary (std::ostream& os, bool& /* save_as_floats */) { char tmp = (scalar ? 1 : 0); @@ -146,7 +146,7 @@ return true; } -bool +bool octave_bool::load_binary (std::istream& is, bool /* swap */, oct_mach_info::float_format /* fmt */) { @@ -170,13 +170,13 @@ space_hid = H5Screate_simple (0, dimens, 0); if (space_hid < 0) return false; #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); return false; @@ -205,15 +205,15 @@ hsize_t rank = H5Sget_simple_extent_ndims (space_id); if (rank != 0) - { + { H5Dclose (data_hid); return false; } double dtmp; - if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dtmp) < 0) - { + { H5Dclose (data_hid); return false; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-bool.h --- a/src/ov-bool.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-bool.h Thu Jan 20 17:24:59 2011 -0500 @@ -191,7 +191,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-builtin.h --- a/src/ov-builtin.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-builtin.h Thu Jan 20 17:24:59 2011 -0500 @@ -72,7 +72,7 @@ do_multi_index_op (int nargout, const octave_value_list& args); octave_value_list - do_multi_index_op (int nargout, const octave_value_list& args, + do_multi_index_op (int nargout, const octave_value_list& args, const std::list* lvalue_list); static const std::list *curr_lvalue_list; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-cell.cc --- a/src/ov-cell.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-cell.cc Thu Jan 20 17:24:59 2011 -0500 @@ -107,10 +107,10 @@ template <> bool -octave_base_matrix::fast_elem_insert (octave_idx_type n, +octave_base_matrix::fast_elem_insert (octave_idx_type n, const octave_value& x) { - const octave_cell *xrep = + const octave_cell *xrep = dynamic_cast (&x.get_rep ()); bool retval = xrep && xrep->matrix.numel () == 1 && n < matrix.numel (); @@ -313,7 +313,7 @@ tmp.make_unique (); // probably a no-op. } else - // optimization: ignore the copy still stored inside our array. + // optimization: ignore the copy still stored inside our array. tmp.make_unique (1); if (! error_state) @@ -435,7 +435,7 @@ return retval; } -bool +bool octave_cell::is_cellstr (void) const { bool retval; @@ -452,14 +452,14 @@ return retval; } -void +void octave_cell::assign (const octave_value_list& idx, const Cell& rhs) { clear_cellstr_cache (); octave_base_matrix::assign (idx, rhs); } -void +void octave_cell::assign (const octave_value_list& idx, const octave_value& rhs) { clear_cellstr_cache (); @@ -467,7 +467,7 @@ } -void +void octave_cell::delete_elements (const octave_value_list& idx) { clear_cellstr_cache (); @@ -501,7 +501,7 @@ } else error ("sort: only cell arrays of character strings may be sorted"); - + return retval; } @@ -522,11 +522,11 @@ } else error ("sort: only cell arrays of character strings may be sorted"); - + return retval; } -sortmode +sortmode octave_cell::is_sorted (sortmode mode) const { sortmode retval = UNSORTED; @@ -539,7 +539,7 @@ } else error ("issorted: not a cell array of strings"); - + return retval; } @@ -557,11 +557,11 @@ } else error ("sortrows: only cell arrays of character strings may be sorted"); - + return retval; } -sortmode +sortmode octave_cell::is_sorted_rows (sortmode mode) const { sortmode retval = UNSORTED; @@ -574,7 +574,7 @@ } else error ("issorted: not a cell array of strings"); - + return retval; } @@ -746,40 +746,40 @@ #define CELL_ELT_TAG "" -bool +bool octave_cell::save_ascii (std::ostream& os) { dim_vector d = dims (); if (d.length () > 2) { os << "# ndims: " << d.length () << "\n"; - + for (int i = 0; i < d.length (); i++) os << " " << d (i); os << "\n"; Cell tmp = cell_value (); - + for (octave_idx_type i = 0; i < d.numel (); i++) { octave_value o_val = tmp.elem (i); // Recurse to print sub-value. bool b = save_ascii_data (os, o_val, CELL_ELT_TAG, false, 0); - + if (! b) return os; } } else { - // Keep this case, rather than use generic code above for backward + // Keep this case, rather than use generic code above for backward // compatiability. Makes load_ascii much more complex!! os << "# rows: " << rows () << "\n" << "# columns: " << columns () << "\n"; Cell tmp = cell_value (); - + for (octave_idx_type j = 0; j < tmp.cols (); j++) { for (octave_idx_type i = 0; i < tmp.rows (); i++) @@ -788,11 +788,11 @@ // Recurse to print sub-value. bool b = save_ascii_data (os, o_val, CELL_ELT_TAG, false, 0); - + if (! b) return os; } - + os << "\n"; } } @@ -800,7 +800,7 @@ return true; } -bool +bool octave_cell::load_ascii (std::istream& is) { bool success = true; @@ -837,7 +837,7 @@ bool dummy; // recurse to read cell elements - std::string nm = read_ascii_data (is, std::string (), + std::string nm = read_ascii_data (is, std::string (), dummy, t2, i); if (nm == CELL_ELT_TAG) @@ -902,7 +902,7 @@ } } } - + cell_read_error: if (is) @@ -936,7 +936,7 @@ return success; } -bool +bool octave_cell::save_binary (std::ostream& os, bool& save_as_floats) { dim_vector d = dims (); @@ -951,25 +951,25 @@ di = d(i); os.write (reinterpret_cast (&di), 4); } - + Cell tmp = cell_value (); - + for (octave_idx_type i = 0; i < d.numel (); i++) { octave_value o_val = tmp.elem (i); // Recurse to print sub-value. - bool b = save_binary_data (os, o_val, CELL_ELT_TAG, "", 0, + bool b = save_binary_data (os, o_val, CELL_ELT_TAG, "", 0, save_as_floats); - + if (! b) return false; } - + return true; } -bool +bool octave_cell::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -997,7 +997,7 @@ swap_bytes<4> (&di); dv(i) = di; } - + // Convert an array with a single dimension to be a row vector. // Octave should never write files like this, other software // might. @@ -1020,7 +1020,7 @@ std::string doc; // recurse to read cell elements - std::string nm = read_binary_data (is, swap, fmt, std::string (), + std::string nm = read_binary_data (is, swap, fmt, std::string (), dummy, t2, doc); if (nm == CELL_ELT_TAG) @@ -1064,7 +1064,7 @@ if (empty) return (empty > 0); - hsize_t rank = dv.length (); + hsize_t rank = dv.length (); hid_t space_hid = -1, data_hid = -1, size_hid = -1; #if HAVE_HDF5_18 @@ -1076,12 +1076,12 @@ if (data_hid < 0) return false; - // Have to save cell array shape, since can't have a + // Have to save cell array shape, since can't have a // dataset of groups.... space_hid = H5Screate_simple (1, &rank, 0); - if (space_hid < 0) + if (space_hid < 0) { H5Gclose (data_hid); return false; @@ -1094,13 +1094,13 @@ hdims[i] = dv(rank-i-1); #if HAVE_HDF5_18 - size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid, + size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid, + size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (size_hid < 0) + if (size_hid < 0) { H5Sclose (space_hid); H5Gclose (data_hid); @@ -1175,7 +1175,7 @@ #endif hid_t space_hid = H5Dget_space (data_hid); hsize_t rank = H5Sget_simple_extent_ndims (space_hid); - if (rank != 1) + if (rank != 1) { H5Dclose (data_hid); H5Gclose (group_id); @@ -1192,8 +1192,8 @@ dv.resize (hdims[0]); OCTAVE_LOCAL_BUFFER (octave_idx_type, tmp, hdims[0]); - - if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) { H5Dclose (data_hid); @@ -1217,9 +1217,9 @@ hsize_t num_obj = 0; #if HAVE_HDF5_18 - group_id = H5Gopen (loc_id, name, H5P_DEFAULT); + group_id = H5Gopen (loc_id, name, H5P_DEFAULT); #else - group_id = H5Gopen (loc_id, name); + group_id = H5Gopen (loc_id, name); #endif H5Gget_num_objs (group_id, &num_obj); H5Gclose (group_id); @@ -1232,7 +1232,7 @@ else retval2 = H5Giterate (loc_id, name, ¤t_item, hdf5_read_next_data, &dsub); - + if (retval2 <= 0) break; @@ -1246,7 +1246,7 @@ matrix = m; retval = true; } - + return retval; } @@ -1520,7 +1520,7 @@ FORWARD_MAPPER (xtoascii); FORWARD_MAPPER (xtolower); FORWARD_MAPPER (xtoupper); - + default: return octave_base_value::map (umap); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-cell.h --- a/src/ov-cell.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-cell.h Thu Jan 20 17:24:59 2011 -0500 @@ -148,7 +148,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) @@ -163,7 +163,7 @@ // Unsafe. This function exists to support the MEX interface. // You should not use it anywhere else. - void *mex_get_data (void) const; + void *mex_get_data (void) const; private: diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-ch-mat.cc --- a/src/ov-ch-mat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-ch-mat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -40,14 +40,14 @@ template class octave_base_matrix; -idx_vector +idx_vector octave_char_matrix::index_vector (void) const -{ +{ const char *p = matrix.data (); if (numel () == 1 && *p == ':') return idx_vector (':'); else - return idx_vector (array_value (true)); + return idx_vector (array_value (true)); } double @@ -151,7 +151,7 @@ return retval; } -// The C++ standard guarantees cctype defines functions, not macros (and hence macros *CAN'T* +// The C++ standard guarantees cctype defines functions, not macros (and hence macros *CAN'T* // be defined if only cctype is included) // so there's no need to f*ck around. The exceptions are isascii and toascii, // which are not C++. @@ -188,7 +188,7 @@ STRING_MAPPER (xtolower, std::tolower, char); STRING_MAPPER (xtoupper, std::toupper, char); - default: + default: { octave_matrix m (array_value (true)); return m.map (umap); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-class.cc --- a/src/ov-class.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-class.cc Thu Jan 20 17:24:59 2011 -0500 @@ -66,7 +66,7 @@ (octave_class::t_name, "", octave_value (new octave_class ())); } -octave_class::octave_class (const octave_map& m, const std::string& id, +octave_class::octave_class (const octave_map& m, const std::string& id, const octave_value_list& parents) : octave_base_value (), map (m), c_name (id), obsolete_copies (0) { @@ -99,7 +99,7 @@ octave_base_value * octave_class::unique_clone (void) -{ +{ if (count == obsolete_copies) { // All remaining copies are obsolete. We don't actually need to clone. @@ -107,12 +107,12 @@ return this; } else - { + { // In theory, this shouldn't be happening, but it's here just in case. if (count < obsolete_copies) obsolete_copies = 0; - return clone (); + return clone (); } } @@ -465,7 +465,7 @@ // Since we're handling subsref, return the list in the first value // if it has more than one element, to be able to pass through - // rvalue1 calls. + // rvalue1 calls. if (retval.length () > 1) retval = octave_value (retval, true); } @@ -766,7 +766,7 @@ case '.': { - // Find the class in which this method resides before + // Find the class in which this method resides before // attempting to access the requested field. std::string method_class = get_current_method_class (); @@ -834,11 +834,11 @@ if (tmp(0).is_object()) error ("subsindex function must return a valid index vector"); else - // Index vector returned by subsindex is zero based + // Index vector returned by subsindex is zero based // (why this inconsistency Mathworks?), and so we must // add one to the value returned as the index_vector method // expects it to be one based. - retval = do_binary_op (octave_value::op_add, tmp (0), + retval = do_binary_op (octave_value::op_add, tmp (0), octave_value (1.0)).index_vector (); } } @@ -975,7 +975,7 @@ } void -octave_class::print_with_name (std::ostream& os, const std::string& name, +octave_class::print_with_name (std::ostream& os, const std::string& name, bool) { octave_value fcn = symbol_table::find_method ("display", class_name ()); @@ -986,7 +986,7 @@ count++; args(0) = octave_value (this); - + string_vector arg_names (1); arg_names[0] = name; @@ -1004,7 +1004,7 @@ } // Loading a class properly requires an exemplar map entry for success. -// If we don't have one, we attempt to create one by calling the constructor +// If we don't have one, we attempt to create one by calling the constructor // with no arguments. bool octave_class::reconstruct_exemplar (void) @@ -1071,7 +1071,7 @@ } } } - + if (might_have_inheritance) { octave_class::exemplar_const_iterator it @@ -1126,7 +1126,7 @@ octave_value val = map.contents (i); bool b = save_ascii_data (os, val, m.key (i), false, 0); - + if (! b) return os; @@ -1136,7 +1136,7 @@ return true; } -bool +bool octave_class::load_ascii (std::istream& is) { octave_idx_type len = 0; @@ -1174,13 +1174,13 @@ m.assign (nm, tcell); } - if (is) + if (is) { c_name = classname; reconstruct_exemplar (); map = m; - + if (! reconstruct_parents ()) warning ("load: unable to reconstruct object inheritance"); else @@ -1212,7 +1212,7 @@ else panic_impossible (); } - else + else { error ("load: failed to extract number of elements in class"); success = false; @@ -1227,7 +1227,7 @@ return success; } -bool +bool octave_class::save_binary (std::ostream& os, bool& save_as_floats) { int32_t classname_len = class_name().length (); @@ -1250,14 +1250,14 @@ int32_t len = m.nfields(); os.write (reinterpret_cast (&len), 4); - + octave_map::iterator i = m.begin (); while (i != m.end ()) { octave_value val = map.contents (i); bool b = save_binary_data (os, val, m.key (i), "", 0, save_as_floats); - + if (! b) return os; @@ -1267,7 +1267,7 @@ return true; } -bool +bool octave_class::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -1307,14 +1307,14 @@ std::string doc; // recurse to read cell elements - std::string nm = read_binary_data (is, swap, fmt, std::string (), + std::string nm = read_binary_data (is, swap, fmt, std::string (), dummy, t2, doc); if (! is) break; Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2); - + if (error_state) { error ("load: internal error loading class elements"); @@ -1324,7 +1324,7 @@ m.assign (nm, tcell); } - if (is) + if (is) { map = m; @@ -1396,7 +1396,7 @@ class_hid = H5Dcreate (group_hid, "classname", type_hid, space_hid, H5P_DEFAULT); #endif - if (class_hid < 0 || H5Dwrite (class_hid, type_hid, H5S_ALL, H5S_ALL, + if (class_hid < 0 || H5Dwrite (class_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT, c_name.c_str ()) < 0) goto error_cleanup; @@ -1426,7 +1426,7 @@ { octave_value val = map.contents (i); - bool retval2 = add_hdf5_data (data_hid, val, m.key (i), "", false, + bool retval2 = add_hdf5_data (data_hid, val, m.key (i), "", false, save_as_floats); if (! retval2) @@ -1455,7 +1455,7 @@ return true; } -bool +bool octave_class::load_hdf5 (hid_t loc_id, const char *name) { bool retval = false; @@ -1465,7 +1465,7 @@ hid_t type_hid = -1; hid_t type_class_hid = -1; hid_t space_hid = -1; - hid_t subgroup_hid = -1; + hid_t subgroup_hid = -1; hid_t st_id = -1; hdf5_callback_data dsub; @@ -1500,7 +1500,7 @@ if (type_class_hid != H5T_STRING) goto error_cleanup; - + space_hid = H5Dget_space (data_hid); rank = H5Sget_simple_extent_ndims (space_hid); @@ -1520,7 +1520,7 @@ st_id = H5Tcopy (H5T_C_S1); H5Tset_size (st_id, slen); - if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, + if (H5Dread (data_hid, st_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, classname) < 0) { H5Tclose (st_id); @@ -1528,7 +1528,7 @@ H5Gclose (group_hid); return false; } - + H5Tclose (st_id); H5Dclose (data_hid); data_hid = -1; @@ -1539,9 +1539,9 @@ reconstruct_exemplar (); #if HAVE_HDF5_18 - subgroup_hid = H5Gopen (group_hid, name, H5P_DEFAULT); + subgroup_hid = H5Gopen (group_hid, name, H5P_DEFAULT); #else - subgroup_hid = H5Gopen (group_hid, name); + subgroup_hid = H5Gopen (group_hid, name); #endif H5Gget_num_objs (subgroup_hid, &num_obj); H5Gclose (subgroup_hid); @@ -1553,7 +1553,7 @@ octave_value t2 = dsub.tc; Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2); - + if (error_state) { error ("load: internal error loading class elements"); @@ -1589,7 +1589,7 @@ retval = true; } } - + error_cleanup: if (data_hid > 0) H5Dclose (data_hid); @@ -1922,7 +1922,7 @@ } else retval = Cell (sv); - } + } } else print_usage (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-class.h --- a/src/ov-class.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-class.h Thu Jan 20 17:24:59 2011 -0500 @@ -50,20 +50,20 @@ public: octave_class (void) - : octave_base_value (), map (), c_name (), - parent_list (), obsolete_copies (0) + : octave_base_value (), map (), c_name (), + parent_list (), obsolete_copies (0) { } octave_class (const octave_map& m, const std::string& id) - : octave_base_value (), map (m), c_name (id), - parent_list (), obsolete_copies (0) + : octave_base_value (), map (m), c_name (id), + parent_list (), obsolete_copies (0) { } octave_class (const octave_class& s) : octave_base_value (s), map (s.map), c_name (s.c_name), parent_list (s.parent_list), obsolete_copies (0) { } - octave_class (const octave_map& m, const std::string& id, + octave_class (const octave_map& m, const std::string& id, const octave_value_list& parents); ~octave_class (void) { } @@ -81,7 +81,7 @@ Matrix size (void); - octave_idx_type numel (const octave_value_list&); + octave_idx_type numel (const octave_value_list&); octave_value subsref (const std::string& type, const std::list& idx) @@ -154,7 +154,7 @@ bool print_name_tag (std::ostream& os, const std::string& name) const; - void print_with_name (std::ostream& os, const std::string& name, + void print_with_name (std::ostream& os, const std::string& name, bool print_padding = true); bool reconstruct_exemplar (void); @@ -169,7 +169,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-complex.cc --- a/src/ov-complex.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-complex.cc Thu Jan 20 17:24:59 2011 -0500 @@ -220,7 +220,7 @@ return FloatComplexNDArray (dim_vector (1, 1), static_cast (scalar)); } -octave_value +octave_value octave_complex::resize (const dim_vector& dv, bool fill) const { if (fill) @@ -243,7 +243,7 @@ } } -bool +bool octave_complex::save_ascii (std::ostream& os) { Complex c = complex_value (); @@ -255,12 +255,12 @@ return true; } -bool +bool octave_complex::load_ascii (std::istream& is) { scalar = octave_read_value (is); - if (!is) + if (!is) { error ("load: failed to load complex scalar constant"); return false; @@ -270,7 +270,7 @@ } -bool +bool octave_complex::save_binary (std::ostream& os, bool& /* save_as_floats */) { char tmp = static_cast (LS_DOUBLE); @@ -281,7 +281,7 @@ return true; } -bool +bool octave_complex::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -314,18 +314,18 @@ return false; type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE); - if (type_hid < 0) + if (type_hid < 0) { H5Sclose (space_hid); return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Tclose (type_hid); @@ -333,7 +333,7 @@ } Complex tmp = complex_value (); - retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT, + retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0; H5Dclose (data_hid); @@ -366,7 +366,7 @@ hid_t space_id = H5Dget_space (data_hid); hsize_t rank = H5Sget_simple_extent_ndims (space_id); - if (rank != 0) + if (rank != 0) { H5Tclose (complex_type); H5Sclose (space_id); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-complex.h --- a/src/ov-complex.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-complex.h Thu Jan 20 17:24:59 2011 -0500 @@ -164,7 +164,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-cx-diag.cc --- a/src/ov-cx-diag.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-cx-diag.cc Thu Jan 20 17:24:59 2011 -0500 @@ -38,7 +38,7 @@ DEFINE_OCTAVE_ALLOCATOR (octave_complex_diag_matrix); -DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex_diag_matrix, +DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_complex_diag_matrix, "complex diagonal matrix", "double"); static octave_base_value * @@ -159,7 +159,7 @@ } } -bool +bool octave_complex_diag_matrix::save_binary (std::ostream& os, bool& save_as_floats) { @@ -192,7 +192,7 @@ return true; } -bool +bool octave_complex_diag_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -220,8 +220,8 @@ return true; } -bool -octave_complex_diag_matrix::chk_valid_scalar (const octave_value& val, +bool +octave_complex_diag_matrix::chk_valid_scalar (const octave_value& val, Complex& x) const { bool retval = val.is_complex_scalar () || val.is_real_scalar (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-cx-diag.h --- a/src/ov-cx-diag.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-cx-diag.h Thu Jan 20 17:24:59 2011 -0500 @@ -32,7 +32,7 @@ class OCTINTERP_API -octave_complex_diag_matrix +octave_complex_diag_matrix : public octave_base_diag { public: @@ -77,14 +77,14 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); octave_value map (unary_mapper_t umap) const; private: - bool chk_valid_scalar (const octave_value&, + bool chk_valid_scalar (const octave_value&, Complex&) const; DECLARE_OCTAVE_ALLOCATOR diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-cx-mat.cc --- a/src/ov-cx-mat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-cx-mat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -226,13 +226,13 @@ { if (matrix.any_element_is_nan ()) gripe_nan_to_logical_conversion (); - else if (warn && (! matrix.all_elements_are_real () + else if (warn && (! matrix.all_elements_are_real () || real (matrix).any_element_not_one_or_zero ())) gripe_logical_conversion (); return mx_el_ne (matrix, Complex (0.0)); } - + charNDArray octave_complex_matrix::char_array_value (bool frc_str_conv) const { @@ -245,17 +245,17 @@ { retval = charNDArray (dims ()); octave_idx_type nel = numel (); - + for (octave_idx_type i = 0; i < nel; i++) retval.elem (i) = static_cast(std::real (matrix.elem (i))); } return retval; -} +} -FloatComplexNDArray -octave_complex_matrix::float_complex_array_value (bool) const -{ +FloatComplexNDArray +octave_complex_matrix::float_complex_array_value (bool) const +{ return FloatComplexNDArray (matrix); } @@ -283,7 +283,7 @@ octave_complex_matrix::diag (octave_idx_type k) const { octave_value retval; - if (k == 0 && matrix.ndims () == 2 + if (k == 0 && matrix.ndims () == 2 && (matrix.rows () == 1 || matrix.columns () == 1)) retval = ComplexDiagMatrix (DiagArray2 (matrix)); else @@ -292,7 +292,7 @@ return retval; } -bool +bool octave_complex_matrix::save_ascii (std::ostream& os) { dim_vector d = dims (); @@ -309,7 +309,7 @@ } else { - // Keep this case, rather than use generic code above for backward + // Keep this case, rather than use generic code above for backward // compatiability. Makes load_ascii much more complex!! os << "# rows: " << rows () << "\n" << "# columns: " << columns () << "\n"; @@ -320,7 +320,7 @@ return true; } -bool +bool octave_complex_matrix::load_ascii (std::istream& is) { bool success = true; @@ -415,7 +415,7 @@ return success; } -bool +bool octave_complex_matrix::save_binary (std::ostream& os, bool& save_as_floats) { dim_vector d = dims (); @@ -457,7 +457,7 @@ return true; } -bool +bool octave_complex_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -549,7 +549,7 @@ // Octave uses column-major, while HDF5 uses row-major ordering for (int i = 0; i < rank; i++) hdims[i] = dv (rank-i-1); - + space_hid = H5Screate_simple (rank, hdims, 0); if (space_hid < 0) return false; @@ -570,7 +570,7 @@ else { double max_val, min_val; - + if (m.all_integers (max_val, min_val)) save_type_hid = save_type_to_hdf5 (get_save_type (max_val, min_val)); @@ -584,7 +584,7 @@ return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT); @@ -618,7 +618,7 @@ return retval; } -bool +bool octave_complex_matrix::load_hdf5 (hid_t loc_id, const char *name) { bool retval = false; @@ -649,7 +649,7 @@ hid_t space_id = H5Dget_space (data_hid); hsize_t rank = H5Sget_simple_extent_ndims (space_id); - + if (rank < 1) { H5Tclose (complex_type); @@ -680,7 +680,7 @@ ComplexNDArray m (dv); Complex *reim = m.fortran_vec (); if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, - reim) >= 0) + reim) >= 0) { retval = true; matrix = m; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-cx-mat.h --- a/src/ov-cx-mat.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-cx-mat.h Thu Jan 20 17:24:59 2011 -0500 @@ -128,7 +128,7 @@ boolNDArray bool_array_value (bool warn = false) const; charNDArray char_array_value (bool frc_str_conv = false) const; - + SparseMatrix sparse_matrix_value (bool = false) const; SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; @@ -147,7 +147,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-cx-sparse.cc --- a/src/ov-cx-sparse.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-cx-sparse.cc Thu Jan 20 17:24:59 2011 -0500 @@ -97,7 +97,7 @@ if (matrix.all_elements_are_real ()) retval = new octave_sparse_matrix (::real (matrix)); } - + return retval; } @@ -167,7 +167,7 @@ return matrix.matrix_value (); } -ComplexNDArray +ComplexNDArray octave_sparse_complex_matrix::complex_array_value (bool) const { return ComplexNDArray (matrix.matrix_value ()); @@ -189,7 +189,7 @@ for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = matrix.cidx(j); i < matrix.cidx(j+1); i++) - retval(matrix.ridx(i) + nr * j) = + retval(matrix.ridx(i) + nr * j) = static_cast(std::real (matrix.data (i))); } @@ -203,7 +203,7 @@ if (! force_conversion) gripe_implicit_conversion ("Octave:imag-to-real", - "complex sparse matrix", + "complex sparse matrix", "real sparse matrix"); retval = ::real (matrix); @@ -211,20 +211,20 @@ return retval; } -SparseBoolMatrix +SparseBoolMatrix octave_sparse_complex_matrix::sparse_bool_matrix_value (bool warn) const { if (matrix.any_element_is_nan ()) gripe_nan_to_logical_conversion (); - else if (warn && (! matrix.all_elements_are_real () + else if (warn && (! matrix.all_elements_are_real () || real (matrix).any_element_not_one_or_zero ())) gripe_logical_conversion (); return mx_el_ne (matrix, Complex (0.0)); } -bool -octave_sparse_complex_matrix::save_binary (std::ostream& os, +bool +octave_sparse_complex_matrix::save_binary (std::ostream& os, bool&save_as_floats) { dim_vector d = this->dims (); @@ -240,15 +240,15 @@ int32_t itmp; // Use negative value for ndims to be consistent with other formats - itmp= -2; + itmp= -2; os.write (reinterpret_cast (&itmp), 4); - - itmp= nr; + + itmp= nr; os.write (reinterpret_cast (&itmp), 4); - + itmp= nc; os.write (reinterpret_cast (&itmp), 4); - + itmp= nz; os.write (reinterpret_cast (&itmp), 4); @@ -272,17 +272,17 @@ // add one to the printed indices to go from // zero-based to one-based arrays - for (int i = 0; i < nc+1; i++) + for (int i = 0; i < nc+1; i++) { octave_quit (); itmp = matrix.cidx(i); os.write (reinterpret_cast (&itmp), 4); } - for (int i = 0; i < nz; i++) + for (int i = 0; i < nz; i++) { octave_quit (); - itmp = matrix.ridx(i); + itmp = matrix.ridx(i); os.write (reinterpret_cast (&itmp), 4); } @@ -327,7 +327,7 @@ static_cast (nc), static_cast (nz)); - for (int i = 0; i < nc+1; i++) + for (int i = 0; i < nc+1; i++) { octave_quit (); if (! is.read (reinterpret_cast (&tmp), 4)) @@ -337,7 +337,7 @@ m.cidx(i) = tmp; } - for (int i = 0; i < nz; i++) + for (int i = 0; i < nz; i++) { octave_quit (); if (! is.read (reinterpret_cast (&tmp), 4)) @@ -349,7 +349,7 @@ if (! is.read (reinterpret_cast (&ctmp), 1)) return false; - + read_doubles (is, reinterpret_cast (m.data ()), static_cast (ctmp), 2 * nz, swap, fmt); @@ -367,7 +367,7 @@ #if defined (HAVE_HDF5) bool -octave_sparse_complex_matrix::save_hdf5 (hid_t loc_id, const char *name, +octave_sparse_complex_matrix::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) { dim_vector dv = dims (); @@ -393,26 +393,26 @@ hsize_t hdims[2]; space_hid = H5Screate_simple (0, hdims, 0); - if (space_hid < 0) + if (space_hid < 0) { H5Gclose (group_hid); return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + tmp = m.rows (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0; @@ -422,22 +422,22 @@ H5Sclose (space_hid); H5Gclose (group_hid); return false; - } + } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + tmp = m.cols (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0; @@ -447,22 +447,22 @@ H5Sclose (space_hid); H5Gclose (group_hid); return false; - } + } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + tmp = m.nnz (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0; @@ -481,26 +481,26 @@ space_hid = H5Screate_simple (2, hdims, 0); - if (space_hid < 0) + if (space_hid < 0) { H5Gclose (group_hid); return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + octave_idx_type * itmp = m.xcidx (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) >= 0; @@ -510,7 +510,7 @@ H5Sclose (space_hid); H5Gclose (group_hid); return false; - } + } H5Sclose (space_hid); @@ -519,26 +519,26 @@ space_hid = H5Screate_simple (2, hdims, 0); - if (space_hid < 0) + if (space_hid < 0) { H5Gclose (group_hid); return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + itmp = m.xridx (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) >= 0; H5Dclose (data_hid); @@ -581,11 +581,11 @@ return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "data", type_hid, space_hid, + data_hid = H5Dcreate (group_hid, "data", type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "data", type_hid, space_hid, H5P_DEFAULT); -#endif +#endif if (data_hid < 0) { H5Sclose (space_hid); @@ -596,7 +596,7 @@ hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE); retval = false; - if (complex_type_hid >= 0) + if (complex_type_hid >= 0) { Complex * ctmp = m.xdata (); @@ -618,14 +618,14 @@ octave_idx_type nr, nc, nz; hid_t group_hid, data_hid, space_hid; hsize_t rank; - + dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) matrix.resize(dv); if (empty) return (empty > 0); - + #if HAVE_HDF5_18 group_hid = H5Gopen (loc_id, name, H5P_DEFAULT); #else @@ -642,14 +642,14 @@ rank = H5Sget_simple_extent_ndims (space_hid); if (rank != 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; } if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nr) < 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; @@ -666,14 +666,14 @@ rank = H5Sget_simple_extent_ndims (space_hid); if (rank != 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; } if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nc) < 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; @@ -690,14 +690,14 @@ rank = H5Sget_simple_extent_ndims (space_hid); if (rank != 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; } if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nz) < 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; @@ -740,7 +740,7 @@ } octave_idx_type *itmp = m.xcidx (); - if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0) + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0) { H5Sclose (space_hid); H5Dclose (data_hid); @@ -779,7 +779,7 @@ } itmp = m.xridx (); - if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0) + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) < 0) { H5Sclose (space_hid); H5Dclose (data_hid); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-cx-sparse.h --- a/src/ov-cx-sparse.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-cx-sparse.h Thu Jan 20 17:24:59 2011 -0500 @@ -64,18 +64,18 @@ octave_sparse_complex_matrix (const SparseComplexMatrix& m) : octave_base_sparse (m) { } - octave_sparse_complex_matrix (const SparseComplexMatrix& m, + octave_sparse_complex_matrix (const SparseComplexMatrix& m, const MatrixType &t) : octave_base_sparse (m, t) { } octave_sparse_complex_matrix (const MSparse& m) : octave_base_sparse (m) { } - octave_sparse_complex_matrix (const MSparse& m, + octave_sparse_complex_matrix (const MSparse& m, const MatrixType &t) : octave_base_sparse (m, t) { } - octave_sparse_complex_matrix (const Sparse& m, + octave_sparse_complex_matrix (const Sparse& m, const MatrixType &t) : octave_base_sparse (SparseComplexMatrix (m), t) { } @@ -137,7 +137,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-dld-fcn.h --- a/src/ov-dld-fcn.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-dld-fcn.h Thu Jan 20 17:24:59 2011 -0500 @@ -44,8 +44,8 @@ { public: - octave_dld_function (void) - : sh_lib (), t_checked (), system_fcn_file () + octave_dld_function (void) + : sh_lib (), t_checked (), system_fcn_file () { } octave_dld_function (octave_builtin::fcn ff, const octave_shlib& shl, @@ -67,7 +67,7 @@ bool is_builtin_function (void) const { return false; } bool is_dld_function (void) const { return true; } - + static octave_dld_function* create (octave_builtin::fcn ff, const octave_shlib& shl, const std::string& nm = std::string (), diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-fcn-handle.cc --- a/src/ov-fcn-handle.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-fcn-handle.cc Thu Jan 20 17:24:59 2011 -0500 @@ -131,14 +131,14 @@ } octave_value_list -octave_fcn_handle::do_multi_index_op (int nargout, +octave_fcn_handle::do_multi_index_op (int nargout, const octave_value_list& args) { return do_multi_index_op (nargout, args, 0); } octave_value_list -octave_fcn_handle::do_multi_index_op (int nargout, +octave_fcn_handle::do_multi_index_op (int nargout, const octave_value_list& args, const std::list* lvalue_list) { @@ -190,7 +190,7 @@ return retval; } -bool +bool octave_fcn_handle::is_equal_to (const octave_fcn_handle& h) const { bool retval = fcn.is_copy_of (h.fcn) && (has_overloads == h.has_overloads); @@ -210,7 +210,7 @@ } bool -octave_fcn_handle::set_fcn (const std::string &octaveroot, +octave_fcn_handle::set_fcn (const std::string &octaveroot, const std::string& fpath) { bool success = true; @@ -221,8 +221,8 @@ && OCTAVE_EXEC_PREFIX != octaveroot) { // First check if just replacing matlabroot is enough - std::string str = OCTAVE_EXEC_PREFIX + - fpath.substr (octaveroot.length ()); + std::string str = OCTAVE_EXEC_PREFIX + + fpath.substr (octaveroot.length ()); file_stat fs (str); if (fs.exists ()) @@ -445,12 +445,12 @@ if (is && success) { int parse_status; - octave_value anon_fcn_handle = + octave_value anon_fcn_handle = eval_string (buf, true, parse_status); if (parse_status == 0) { - octave_fcn_handle *fh = + octave_fcn_handle *fh = anon_fcn_handle.fcn_handle_value (); if (fh) @@ -586,7 +586,7 @@ // defines the anonymous function. symbol_table::scope_id local_scope = symbol_table::alloc_scope (); - frame.add_fcn (symbol_table::erase_scope, local_scope); + frame.add_fcn (symbol_table::erase_scope, local_scope); symbol_table::set_scope (local_scope); @@ -601,8 +601,8 @@ bool dummy; std::string doc; - std::string name = - read_binary_data (is, swap, fmt, std::string (), + std::string name = + read_binary_data (is, swap, fmt, std::string (), dummy, t2, doc); if (!is) @@ -618,7 +618,7 @@ if (is && success) { int parse_status; - octave_value anon_fcn_handle = + octave_value anon_fcn_handle = eval_string (ctmp2, true, parse_status); if (parse_status == 0) @@ -657,7 +657,7 @@ success = set_fcn (octaveroot, fpath); } - + return success; } @@ -699,7 +699,7 @@ return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "nm", type_hid, space_hid, + data_hid = H5Dcreate (group_hid, "nm", type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "nm", type_hid, space_hid, H5P_DEFAULT); @@ -762,7 +762,7 @@ { #if HAVE_HDF5_18 hid_t a_id = H5Acreate (group_hid, "SYMBOL_TABLE", - H5T_NATIVE_IDX, as_id, + H5T_NATIVE_IDX, as_id, H5P_DEFAULT, H5P_DEFAULT); #else @@ -788,7 +788,7 @@ #else data_hid = H5Gcreate (group_hid, "symbol table", 0); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Tclose (type_hid); @@ -865,7 +865,7 @@ H5Tset_size (type_hid, fpath.length () + 1); #if HAVE_HDF5_18 - a_id = H5Acreate (group_hid, "FILE", type_hid, space_hid, + a_id = H5Acreate (group_hid, "FILE", type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT); #else a_id = H5Acreate (group_hid, "FILE", type_hid, space_hid, H5P_DEFAULT); @@ -1092,9 +1092,9 @@ { hsize_t num_obj = 0; #if HAVE_HDF5_18 - data_hid = H5Gopen (group_hid, "symbol table", H5P_DEFAULT); + data_hid = H5Gopen (group_hid, "symbol table", H5P_DEFAULT); #else - data_hid = H5Gopen (group_hid, "symbol table"); + data_hid = H5Gopen (group_hid, "symbol table"); #endif H5Gget_num_objs (data_hid, &num_obj); H5Gclose (data_hid); @@ -1127,7 +1127,7 @@ if (success) { int parse_status; - octave_value anon_fcn_handle = + octave_value anon_fcn_handle = eval_string (fcn_tmp, true, parse_status); if (parse_status == 0) @@ -1250,7 +1250,7 @@ #endif -/* +/* %!test %! a = 2; @@ -1472,7 +1472,7 @@ // Here we are just looking to see if FCN is a method or constructor // for any class. - if (local_funcs && fptr + if (local_funcs && fptr && (fptr->is_subfunction () || fptr->is_private_function () || fptr->is_class_constructor ())) { @@ -1600,7 +1600,7 @@ Cell parentage (dim_vector (1, 2)); parentage.elem(0) = fh_nm; parentage.elem(1) = fcn->parent_fcn_name (); - m.setfield ("parentage", octave_value (parentage)); + m.setfield ("parentage", octave_value (parentage)); } else if (fcn->is_private_function ()) m.setfield ("type", "private"); @@ -1736,10 +1736,10 @@ %! assert (testrecursionfunc (@(x) x, 1), 8); */ -octave_fcn_binder::octave_fcn_binder (const octave_value& f, +octave_fcn_binder::octave_fcn_binder (const octave_value& f, const octave_value& root, - const octave_value_list& templ, - const std::vector& mask, + const octave_value_list& templ, + const std::vector& mask, int exp_nargin) : octave_fcn_handle (f), root_handle (root), arg_template (templ), arg_mask (mask), expected_nargin (exp_nargin) @@ -1753,15 +1753,15 @@ octave_user_function *usr_fcn = f.user_function_value (false); tree_parameter_list *param_list = usr_fcn ? usr_fcn->parameter_list () : 0; - + // Verify that the body is a single expression (always true in theory). - + tree_statement_list *cmd_list = usr_fcn ? usr_fcn->body () : 0; - tree_expression *body_expr = (cmd_list->length () == 1 + tree_expression *body_expr = (cmd_list->length () == 1 ? cmd_list->front ()->expression () : 0); - if (body_expr && body_expr->is_index_expression () + if (body_expr && body_expr->is_index_expression () && ! (param_list && param_list->takes_varargs ())) { // It's an index expression. @@ -1873,7 +1873,7 @@ assert (arg_names.size () == 1); arg_template.stash_name_tags (arg_names.front ()); - retval = new octave_fcn_binder (f, root_val, arg_template, + retval = new octave_fcn_binder (f, root_val, arg_template, arg_mask, npar); } } @@ -1887,14 +1887,14 @@ } octave_value_list -octave_fcn_binder::do_multi_index_op (int nargout, +octave_fcn_binder::do_multi_index_op (int nargout, const octave_value_list& args) { return do_multi_index_op (nargout, args, 0); } octave_value_list -octave_fcn_binder::do_multi_index_op (int nargout, +octave_fcn_binder::do_multi_index_op (int nargout, const octave_value_list& args, const std::list* lvalue_list) { diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-fcn-handle.h --- a/src/ov-fcn-handle.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-fcn-handle.h Thu Jan 20 17:24:59 2011 -0500 @@ -91,7 +91,7 @@ do_multi_index_op (int nargout, const octave_value_list& args); octave_value_list - do_multi_index_op (int nargout, const octave_value_list& args, + do_multi_index_op (int nargout, const octave_value_list& args, const std::list* lvalue_list); bool is_defined (void) const { return true; } @@ -140,7 +140,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) @@ -194,7 +194,7 @@ private: // Private ctor. octave_fcn_binder (const octave_value& f, const octave_value& root, - const octave_value_list& templ, + const octave_value_list& templ, const std::vector& mask, int exp_nargin); public: @@ -206,7 +206,7 @@ do_multi_index_op (int nargout, const octave_value_list& args); octave_value_list - do_multi_index_op (int nargout, const octave_value_list& args, + do_multi_index_op (int nargout, const octave_value_list& args, const std::list* lvalue_list); protected: diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-fcn-inline.cc --- a/src/ov-fcn-inline.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-fcn-inline.cc Thu Jan 20 17:24:59 2011 -0500 @@ -104,7 +104,7 @@ if (parent_scope < 0) parent_scope = curr_fcn->scope (); - + uf->stash_parent_fcn_scope (parent_scope); } } @@ -364,7 +364,7 @@ return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "nm", type_hid, space_hid, + data_hid = H5Dcreate (group_hid, "nm", type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else data_hid = H5Dcreate (group_hid, "nm", type_hid, space_hid, H5P_DEFAULT); @@ -673,7 +673,7 @@ bool in_string = false; std::string tmp_arg; size_t i = 0; - + while (i < fun.length ()) { bool terminate_arg = false; @@ -700,7 +700,7 @@ // Before we do anything remove trailing whitespaces. while (i < fun.length () && isspace (c)) c = fun[i++]; - + // Do we have a variable or a function? if (c != '(') terminate_arg = true; @@ -719,17 +719,17 @@ if (terminate_arg || (i == fun.length () && is_arg)) { bool have_arg = false; - + for (int j = 0; j < fargs.length (); j++) if (tmp_arg == fargs (j)) { have_arg = true; break; } - + if (! have_arg && tmp_arg != "i" && tmp_arg != "j" && - tmp_arg != "NaN" && tmp_arg != "nan" && - tmp_arg != "Inf" && tmp_arg != "inf" && + tmp_arg != "NaN" && tmp_arg != "nan" && + tmp_arg != "Inf" && tmp_arg != "inf" && tmp_arg != "NA" && tmp_arg != "pi" && tmp_arg != "eps") fargs.append (tmp_arg); @@ -933,7 +933,7 @@ if (func_is_string) retval = octave_value (new_func); else - retval = octave_value (new octave_fcn_inline + retval = octave_value (new octave_fcn_inline (new_func, old->fcn_arg_names ())); } } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-fcn-inline.h --- a/src/ov-fcn-inline.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-fcn-inline.h Thu Jan 20 17:24:59 2011 -0500 @@ -46,7 +46,7 @@ octave_fcn_inline (void) : octave_fcn_handle (), iftext (), ifargs () { } - octave_fcn_inline (const std::string& f, const string_vector& a, + octave_fcn_inline (const std::string& f, const string_vector& a, const std::string& n = std::string ()); octave_fcn_inline (const octave_fcn_inline& fi) @@ -75,7 +75,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-fcn.h --- a/src/ov-fcn.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-fcn.h Thu Jan 20 17:24:59 2011 -0500 @@ -157,7 +157,7 @@ // If this object is a class method or constructor, or a private // function inside a class directory, this is the name of the class - // to which the method belongs. + // to which the method belongs. std::string xdispatch_class; // The name of this function. diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-float.cc --- a/src/ov-float.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-float.cc Thu Jan 20 17:24:59 2011 -0500 @@ -74,7 +74,7 @@ return tmp.do_index_op (idx, resize_ok); } -octave_value +octave_value octave_float_scalar::resize (const dim_vector& dv, bool fill) const { if (fill) @@ -123,7 +123,7 @@ return retval; } -bool +bool octave_float_scalar::save_ascii (std::ostream& os) { float d = float_value (); @@ -135,7 +135,7 @@ return true; } -bool +bool octave_float_scalar::load_ascii (std::istream& is) { scalar = octave_read_value (is); @@ -148,7 +148,7 @@ return true; } -bool +bool octave_float_scalar::save_binary (std::ostream& os, bool& /* save_as_floats */) { char tmp = LS_FLOAT; @@ -159,7 +159,7 @@ return true; } -bool +bool octave_float_scalar::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -189,13 +189,13 @@ space_hid = H5Screate_simple (0, dimens, 0); if (space_hid < 0) return false; #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_FLOAT, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_FLOAT, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_FLOAT, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_FLOAT, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); return false; @@ -224,15 +224,15 @@ hsize_t rank = H5Sget_simple_extent_ndims (space_id); if (rank != 0) - { + { H5Dclose (data_hid); return false; } float dtmp; - if (H5Dread (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dtmp) < 0) - { + { H5Dclose (data_hid); return false; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-float.h --- a/src/ov-float.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-float.h Thu Jan 20 17:24:59 2011 -0500 @@ -223,7 +223,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-flt-complex.cc --- a/src/ov-flt-complex.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-flt-complex.cc Thu Jan 20 17:24:59 2011 -0500 @@ -205,7 +205,7 @@ return FloatComplexNDArray (dim_vector (1, 1), scalar); } -octave_value +octave_value octave_float_complex::resize (const dim_vector& dv, bool fill) const { if (fill) @@ -228,7 +228,7 @@ } } -bool +bool octave_float_complex::save_ascii (std::ostream& os) { FloatComplex c = float_complex_value (); @@ -240,12 +240,12 @@ return true; } -bool +bool octave_float_complex::load_ascii (std::istream& is) { scalar = octave_read_value (is); - if (!is) + if (!is) { error ("load: failed to load complex scalar constant"); return false; @@ -255,7 +255,7 @@ } -bool +bool octave_float_complex::save_binary (std::ostream& os, bool& /* save_as_floats */) { char tmp = static_cast (LS_FLOAT); @@ -266,7 +266,7 @@ return true; } -bool +bool octave_float_complex::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -299,18 +299,18 @@ return false; type_hid = hdf5_make_complex_type (H5T_NATIVE_FLOAT); - if (type_hid < 0) + if (type_hid < 0) { H5Sclose (space_hid); return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); -#else +#else data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Tclose (type_hid); @@ -318,7 +318,7 @@ } FloatComplex tmp = float_complex_value (); - retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT, + retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0; H5Dclose (data_hid); @@ -351,7 +351,7 @@ hid_t space_id = H5Dget_space (data_hid); hsize_t rank = H5Sget_simple_extent_ndims (space_id); - if (rank != 0) + if (rank != 0) { H5Tclose (complex_type); H5Sclose (space_id); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-flt-complex.h --- a/src/ov-flt-complex.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-flt-complex.h Thu Jan 20 17:24:59 2011 -0500 @@ -162,7 +162,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-flt-cx-diag.cc --- a/src/ov-flt-cx-diag.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-flt-cx-diag.cc Thu Jan 20 17:24:59 2011 -0500 @@ -37,7 +37,7 @@ DEFINE_OCTAVE_ALLOCATOR (octave_float_complex_diag_matrix); -DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex_diag_matrix, +DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_complex_diag_matrix, "float complex diagonal matrix", "single"); static octave_base_value * @@ -144,8 +144,8 @@ } -bool -octave_float_complex_diag_matrix::save_binary (std::ostream& os, +bool +octave_float_complex_diag_matrix::save_binary (std::ostream& os, bool& /* save_as_floats */) { @@ -168,7 +168,7 @@ return true; } -bool +bool octave_float_complex_diag_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -187,7 +187,7 @@ FloatComplexDiagMatrix m (r, c); FloatComplex *re = m.fortran_vec (); octave_idx_type len = m.length (); - read_floats (is, reinterpret_cast (re), + read_floats (is, reinterpret_cast (re), static_cast (tmp), 2 * len, swap, fmt); if (error_state || ! is) return false; @@ -196,8 +196,8 @@ return true; } -bool -octave_float_complex_diag_matrix::chk_valid_scalar (const octave_value& val, +bool +octave_float_complex_diag_matrix::chk_valid_scalar (const octave_value& val, FloatComplex& x) const { bool retval = val.is_complex_scalar () || val.is_real_scalar (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-flt-cx-diag.h --- a/src/ov-flt-cx-diag.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-flt-cx-diag.h Thu Jan 20 17:24:59 2011 -0500 @@ -32,7 +32,7 @@ class OCTINTERP_API -octave_float_complex_diag_matrix +octave_float_complex_diag_matrix : public octave_base_diag { public: @@ -75,14 +75,14 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); octave_value map (unary_mapper_t umap) const; private: - bool chk_valid_scalar (const octave_value&, + bool chk_valid_scalar (const octave_value&, FloatComplex&) const; DECLARE_OCTAVE_ALLOCATOR diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-flt-cx-mat.cc --- a/src/ov-flt-cx-mat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-flt-cx-mat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -215,13 +215,13 @@ { if (matrix.any_element_is_nan ()) gripe_nan_to_logical_conversion (); - else if (warn && (! matrix.all_elements_are_real () + else if (warn && (! matrix.all_elements_are_real () || real (matrix).any_element_not_one_or_zero ())) gripe_logical_conversion (); return mx_el_ne (matrix, FloatComplex (0.0)); } - + charNDArray octave_float_complex_matrix::char_array_value (bool frc_str_conv) const { @@ -234,17 +234,17 @@ { retval = charNDArray (dims ()); octave_idx_type nel = numel (); - + for (octave_idx_type i = 0; i < nel; i++) retval.elem (i) = static_cast(std::real (matrix.elem (i))); } return retval; -} +} -FloatComplexNDArray -octave_float_complex_matrix::float_complex_array_value (bool) const -{ +FloatComplexNDArray +octave_float_complex_matrix::float_complex_array_value (bool) const +{ return FloatComplexNDArray (matrix); } @@ -272,7 +272,7 @@ octave_float_complex_matrix::diag (octave_idx_type k) const { octave_value retval; - if (k == 0 && matrix.ndims () == 2 + if (k == 0 && matrix.ndims () == 2 && (matrix.rows () == 1 || matrix.columns () == 1)) retval = FloatComplexDiagMatrix (DiagArray2 (matrix)); else @@ -281,7 +281,7 @@ return retval; } -bool +bool octave_float_complex_matrix::save_ascii (std::ostream& os) { dim_vector d = dims (); @@ -298,7 +298,7 @@ } else { - // Keep this case, rather than use generic code above for backward + // Keep this case, rather than use generic code above for backward // compatiability. Makes load_ascii much more complex!! os << "# rows: " << rows () << "\n" << "# columns: " << columns () << "\n"; @@ -309,7 +309,7 @@ return true; } -bool +bool octave_float_complex_matrix::load_ascii (std::istream& is) { bool success = true; @@ -404,7 +404,7 @@ return success; } -bool +bool octave_float_complex_matrix::save_binary (std::ostream& os, bool&) { dim_vector d = dims (); @@ -435,7 +435,7 @@ return true; } -bool +bool octave_float_complex_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -526,7 +526,7 @@ // Octave uses column-major, while HDF5 uses row-major ordering for (int i = 0; i < rank; i++) hdims[i] = dv (rank-i-1); - + space_hid = H5Screate_simple (rank, hdims, 0); if (space_hid < 0) return false; @@ -537,7 +537,7 @@ else { float max_val, min_val; - + if (m.all_integers (max_val, min_val)) save_type_hid = save_type_to_hdf5 (get_save_type (max_val, min_val)); @@ -551,7 +551,7 @@ return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT); @@ -585,7 +585,7 @@ return retval; } -bool +bool octave_float_complex_matrix::load_hdf5 (hid_t loc_id, const char *name) { bool retval = false; @@ -616,7 +616,7 @@ hid_t space_id = H5Dget_space (data_hid); hsize_t rank = H5Sget_simple_extent_ndims (space_id); - + if (rank < 1) { H5Tclose (complex_type); @@ -647,7 +647,7 @@ FloatComplexNDArray m (dv); FloatComplex *reim = m.fortran_vec (); if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, - reim) >= 0) + reim) >= 0) { retval = true; matrix = m; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-flt-cx-mat.h --- a/src/ov-flt-cx-mat.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-flt-cx-mat.h Thu Jan 20 17:24:59 2011 -0500 @@ -126,7 +126,7 @@ boolNDArray bool_array_value (bool warn = false) const; charNDArray char_array_value (bool frc_str_conv = false) const; - + SparseMatrix sparse_matrix_value (bool = false) const; SparseComplexMatrix sparse_complex_matrix_value (bool = false) const; @@ -145,7 +145,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-flt-re-diag.cc --- a/src/ov-flt-re-diag.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-flt-re-diag.cc Thu Jan 20 17:24:59 2011 -0500 @@ -36,7 +36,7 @@ DEFINE_OCTAVE_ALLOCATOR (octave_float_diag_matrix); -DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_diag_matrix, +DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_float_diag_matrix, "float diagonal matrix", "single"); static octave_base_value * @@ -113,7 +113,7 @@ } } -bool +bool octave_float_diag_matrix::save_binary (std::ostream& os, bool& /* save_as_floats*/) { @@ -137,7 +137,7 @@ return true; } -bool +bool octave_float_diag_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -164,8 +164,8 @@ return true; } -bool -octave_float_diag_matrix::chk_valid_scalar (const octave_value& val, +bool +octave_float_diag_matrix::chk_valid_scalar (const octave_value& val, float& x) const { bool retval = val.is_real_scalar (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-flt-re-diag.h --- a/src/ov-flt-re-diag.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-flt-re-diag.h Thu Jan 20 17:24:59 2011 -0500 @@ -32,7 +32,7 @@ class OCTINTERP_API -octave_float_diag_matrix +octave_float_diag_matrix : public octave_base_diag { public: @@ -75,14 +75,14 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); octave_value map (unary_mapper_t umap) const; private: - bool chk_valid_scalar (const octave_value&, + bool chk_valid_scalar (const octave_value&, float&) const; DECLARE_OCTAVE_ALLOCATOR diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-flt-re-mat.cc --- a/src/ov-flt-re-mat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-flt-re-mat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -205,10 +205,10 @@ return FloatComplexNDArray (matrix); } -NDArray +NDArray octave_float_matrix::array_value (bool) const -{ - return NDArray (matrix); +{ + return NDArray (matrix); } boolNDArray @@ -221,27 +221,27 @@ return boolNDArray (matrix); } - + charNDArray octave_float_matrix::char_array_value (bool) const { charNDArray retval (dims ()); octave_idx_type nel = numel (); - + for (octave_idx_type i = 0; i < nel; i++) retval.elem (i) = static_cast(matrix.elem (i)); return retval; } - -SparseMatrix + +SparseMatrix octave_float_matrix::sparse_matrix_value (bool) const { return SparseMatrix (matrix_value ()); } -SparseComplexMatrix +SparseComplexMatrix octave_float_matrix::sparse_complex_matrix_value (bool) const { // FIXME Need a SparseComplexMatrix (Matrix) constructor to make @@ -254,7 +254,7 @@ octave_float_matrix::diag (octave_idx_type k) const { octave_value retval; - if (k == 0 && matrix.ndims () == 2 + if (k == 0 && matrix.ndims () == 2 && (matrix.rows () == 1 || matrix.columns () == 1)) retval = FloatDiagMatrix (DiagArray2 (matrix)); else @@ -312,7 +312,7 @@ return retval; } -bool +bool octave_float_matrix::save_ascii (std::ostream& os) { dim_vector d = dims (); @@ -330,7 +330,7 @@ } else { - // Keep this case, rather than use generic code above for backward + // Keep this case, rather than use generic code above for backward // compatiability. Makes load_ascii much more complex!! os << "# rows: " << rows () << "\n" << "# columns: " << columns () << "\n"; @@ -341,7 +341,7 @@ return true; } -bool +bool octave_float_matrix::load_ascii (std::istream& is) { bool success = true; @@ -418,7 +418,7 @@ else panic_impossible (); } - else + else { error ("load: failed to extract number of rows and columns"); success = false; @@ -436,7 +436,7 @@ return success; } -bool +bool octave_float_matrix::save_binary (std::ostream& os, bool&) { @@ -468,7 +468,7 @@ return true; } -bool +bool octave_float_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -557,7 +557,7 @@ // Octave uses column-major, while HDF5 uses row-major ordering for (int i = 0; i < rank; i++) hdims[i] = dv (rank-i-1); - + space_hid = H5Screate_simple (rank, hdims, 0); if (space_hid < 0) return false; @@ -576,10 +576,10 @@ } #endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */ #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, H5P_DEFAULT); #endif if (data_hid < 0) @@ -618,7 +618,7 @@ hid_t space_id = H5Dget_space (data_hid); hsize_t rank = H5Sget_simple_extent_ndims (space_id); - + if (rank < 1) { H5Sclose (space_id); @@ -647,8 +647,8 @@ FloatNDArray m (dv); float *re = m.fortran_vec (); - if (H5Dread (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, re) >= 0) + if (H5Dread (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, + H5P_DEFAULT, re) >= 0) { retval = true; matrix = m; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-flt-re-mat.h --- a/src/ov-flt-re-mat.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-flt-re-mat.h Thu Jan 20 17:24:59 2011 -0500 @@ -87,7 +87,7 @@ octave_base_value *try_narrowing_conversion (void); - idx_vector index_vector (void) const + idx_vector index_vector (void) const { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } builtin_type_t builtin_type (void) const { return btyp_float; } @@ -147,15 +147,15 @@ FloatComplexMatrix float_complex_matrix_value (bool = false) const; ComplexNDArray complex_array_value (bool = false) const; - + FloatComplexNDArray float_complex_array_value (bool = false) const; boolNDArray bool_array_value (bool warn = false) const; charNDArray char_array_value (bool = false) const; - + NDArray array_value (bool = false) const; - + FloatNDArray float_array_value (bool = false) const { return matrix; } SparseMatrix sparse_matrix_value (bool = false) const; @@ -181,7 +181,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-intx.h --- a/src/ov-intx.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-intx.h Thu Jan 20 17:24:59 2011 -0500 @@ -113,7 +113,7 @@ gripe_invalid_conversion (type_name (), "real scalar"); return retval; - + } float @@ -132,7 +132,7 @@ gripe_invalid_conversion (type_name (), "real scalar"); return retval; - + } double scalar_value (bool = false) const { return double_value (); } @@ -213,8 +213,8 @@ NDArray array_value (bool = false) const - { - NDArray retval (matrix.dims ()); + { + NDArray retval (matrix.dims ()); double *vec = retval.fortran_vec (); octave_idx_type nel = matrix.numel (); for (octave_idx_type i = 0; i < nel; i++) @@ -224,8 +224,8 @@ FloatNDArray float_array_value (bool = false) const - { - FloatNDArray retval (matrix.dims ()); + { + FloatNDArray retval (matrix.dims ()); float *vec = retval.fortran_vec (); octave_idx_type nel = matrix.numel (); for (octave_idx_type i = 0; i < nel; i++) @@ -235,8 +235,8 @@ ComplexNDArray complex_array_value (bool = false) const - { - ComplexNDArray retval (matrix.dims ()); + { + ComplexNDArray retval (matrix.dims ()); Complex *vec = retval.fortran_vec (); octave_idx_type nel = matrix.numel (); for (octave_idx_type i = 0; i < nel; i++) @@ -246,8 +246,8 @@ FloatComplexNDArray float_complex_array_value (bool = false) const - { - FloatComplexNDArray retval (matrix.dims ()); + { + FloatComplexNDArray retval (matrix.dims ()); FloatComplex *vec = retval.fortran_vec (); octave_idx_type nel = matrix.numel (); for (octave_idx_type i = 0; i < nel; i++) @@ -278,7 +278,7 @@ charNDArray retval (dims ()); octave_idx_type nel = numel (); - + char *vec = retval.fortran_vec (); for (octave_idx_type i = 0; i < nel; i++) vec[i] = matrix(i).char_value (); @@ -287,22 +287,22 @@ } // Use matrix_ref here to clear index cache. - void increment (void) - { - matrix_ref() += OCTAVE_INT_T (1); + void increment (void) + { + matrix_ref() += OCTAVE_INT_T (1); } void decrement (void) - { - matrix_ref() -= OCTAVE_INT_T (1); + { + matrix_ref() -= OCTAVE_INT_T (1); } void changesign (void) - { - matrix_ref ().changesign (); + { + matrix_ref ().changesign (); } - idx_vector index_vector (void) const + idx_vector index_vector (void) const { return idx_cache ? *idx_cache : set_idx_cache (idx_vector (matrix)); } int write (octave_stream& os, int block_size, @@ -354,7 +354,7 @@ case umap_finite: return boolNDArray (matrix.dims (), true); - default: + default: { octave_matrix m (array_value ()); return m.map (umap); @@ -405,7 +405,7 @@ octave_value tmp (new OCTAVE_VALUE_INT_MATRIX_T - (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION ())); + (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION ())); return tmp.do_index_op (idx, resize_ok); } @@ -534,23 +534,23 @@ NDArray array_value (bool = false) const - { - NDArray retval (dim_vector (1, 1)); + { + NDArray retval (dim_vector (1, 1)); retval(0) = scalar.double_value (); return retval; } FloatNDArray float_array_value (bool = false) const - { - FloatNDArray retval (dim_vector (1, 1)); + { + FloatNDArray retval (dim_vector (1, 1)); retval(0) = scalar.float_value (); return retval; } ComplexNDArray complex_array_value (bool = false) const - { + { ComplexNDArray retval (dim_vector (1, 1)); retval(0) = FloatComplex (scalar.double_value ()); return retval; @@ -558,7 +558,7 @@ FloatComplexNDArray float_complex_array_value (bool = false) const - { + { FloatComplexNDArray retval (dim_vector (1, 1)); retval(0) = FloatComplex (scalar.float_value ()); return retval; @@ -585,14 +585,14 @@ return retval; } - void increment (void) - { - scalar += OCTAVE_INT_T (1); + void increment (void) + { + scalar += OCTAVE_INT_T (1); } void decrement (void) - { - scalar -= OCTAVE_INT_T (1); + { + scalar -= OCTAVE_INT_T (1); } idx_vector index_vector (void) const { return idx_vector (scalar); } @@ -644,7 +644,7 @@ case umap_finite: return true; - default: + default: { octave_scalar m (scalar_value ()); return m.map (umap); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-lazy-idx.cc --- a/src/ov-lazy-idx.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-lazy-idx.cc Thu Jan 20 17:24:59 2011 -0500 @@ -69,14 +69,14 @@ return retval; } -octave_value +octave_value octave_lazy_index::reshape (const dim_vector& new_dims) const { return idx_vector (index.as_array ().reshape (new_dims), index.extent (0)); } -octave_value +octave_value octave_lazy_index::permute (const Array& vec, bool inv) const { // If the conversion has already been made, forward the operation. @@ -87,41 +87,41 @@ index.extent (0)); } -octave_value +octave_value octave_lazy_index::squeeze (void) const { return idx_vector (index.as_array ().squeeze (), index.extent (0)); } -octave_value +octave_value octave_lazy_index::sort (octave_idx_type dim, sortmode mode) const { const dim_vector odims = index.orig_dimensions (); // index_vector can employ a more efficient sorting algorithm. - if (mode == ASCENDING && odims.length () == 2 + if (mode == ASCENDING && odims.length () == 2 && (dim >= 0 && dim <= 1) && odims (1-dim) == 1) return index_vector ().sorted (); else - return idx_vector (index.as_array ().sort (dim, mode), + return idx_vector (index.as_array ().sort (dim, mode), index.extent (0)); } -octave_value +octave_value octave_lazy_index::sort (Array &sidx, octave_idx_type dim, sortmode mode) const { const dim_vector odims = index.orig_dimensions (); // index_vector can employ a more efficient sorting algorithm. - if (mode == ASCENDING && odims.length () == 2 + if (mode == ASCENDING && odims.length () == 2 && (dim >= 0 && dim <= 1) && odims (1-dim) == 1) return index_vector ().sorted (sidx); else - return idx_vector (index.as_array ().sort (sidx, dim, mode), + return idx_vector (index.as_array ().sort (sidx, dim, mode), index.extent (0)); } -sortmode +sortmode octave_lazy_index::is_sorted (sortmode mode) const { if (index.is_range ()) @@ -139,13 +139,13 @@ return index.as_array ().is_sorted (mode); } -Array +Array octave_lazy_index::sort_rows_idx (sortmode mode) const { return index.as_array ().sort_rows_idx (mode); } -sortmode +sortmode octave_lazy_index::is_sorted_rows (sortmode mode) const { return index.as_array ().is_sorted_rows (mode); @@ -175,17 +175,17 @@ bool octave_lazy_index::save_binary (std::ostream& os, bool& save_as_floats) { - return save_binary_data (os, make_value (), value_save_tag, + return save_binary_data (os, make_value (), value_save_tag, std::string (), false, save_as_floats); } -bool octave_lazy_index::load_binary (std::istream& is, bool swap, +bool octave_lazy_index::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { bool dummy; std::string doc; - std::string nm = read_binary_data (is, swap, fmt, std::string (), + std::string nm = read_binary_data (is, swap, fmt, std::string (), dummy, value, doc); if (nm != value_save_tag) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-lazy-idx.h --- a/src/ov-lazy-idx.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-lazy-idx.h Thu Jan 20 17:24:59 2011 -0500 @@ -38,10 +38,10 @@ : octave_base_value (), index (), value () { } octave_lazy_index (const idx_vector& idx) - : octave_base_value (), index (idx), value () { } + : octave_base_value (), index (idx), value () { } octave_lazy_index (const octave_lazy_index& i) - : octave_base_value (), index (i.index), value (i.value) { } + : octave_base_value (), index (i.index), value (i.value) { } ~octave_lazy_index (void) { } @@ -170,13 +170,13 @@ FORWARD_VALUE_QUERY1 (FloatComplexMatrix, float_complex_matrix_value) FORWARD_VALUE_QUERY1 (ComplexNDArray, complex_array_value) - + FORWARD_VALUE_QUERY1 (FloatComplexNDArray, float_complex_array_value) - + FORWARD_VALUE_QUERY1 (boolNDArray, bool_array_value) FORWARD_VALUE_QUERY1 (charNDArray, char_array_value) - + FORWARD_VALUE_QUERY1 (NDArray, array_value) FORWARD_VALUE_QUERY1 (FloatNDArray, float_array_value) @@ -200,7 +200,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); // HDF5 functions not defined. @@ -212,7 +212,7 @@ // Unsafe. This function exists to support the MEX interface. // You should not use it anywhere else. - void *mex_get_data (void) const + void *mex_get_data (void) const { return make_value ().mex_get_data (); } mxArray *as_mxArray (void) const diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-null-mat.cc --- a/src/ov-null-mat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-null-mat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -44,7 +44,7 @@ octave_base_value::type_conv_info octave_null_matrix::numeric_conversion_function (void) const { - return octave_base_value::type_conv_info (default_null_matrix_numeric_conversion_function, + return octave_base_value::type_conv_info (default_null_matrix_numeric_conversion_function, octave_matrix::static_type_id ()); } @@ -64,7 +64,7 @@ octave_base_value::type_conv_info octave_null_str::numeric_conversion_function (void) const { - return octave_base_value::type_conv_info (default_null_str_numeric_conversion_function, + return octave_base_value::type_conv_info (default_null_str_numeric_conversion_function, octave_char_matrix_str::static_type_id ()); } @@ -84,7 +84,7 @@ octave_base_value::type_conv_info octave_null_sq_str::numeric_conversion_function (void) const { - return octave_base_value::type_conv_info (default_null_sq_str_numeric_conversion_function, + return octave_base_value::type_conv_info (default_null_sq_str_numeric_conversion_function, octave_char_matrix_sq_str::static_type_id ()); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-null-mat.h --- a/src/ov-null-mat.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-null-mat.h Thu Jan 20 17:24:59 2011 -0500 @@ -56,7 +56,7 @@ // The special "" value -class +class OCTINTERP_API octave_null_str : public octave_char_matrix_str { @@ -78,7 +78,7 @@ // The special '' value -class +class OCTINTERP_API octave_null_sq_str : public octave_char_matrix_sq_str { diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-perm.cc --- a/src/ov-perm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-perm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -78,7 +78,7 @@ // This hack is to allow constructing permutation matrices using // eye(n)(p,:), eye(n)(:,q) && eye(n)(p,q) where p & q are permutation - // vectors. + // vectors. // Note that, for better consistency, eye(n)(:,:) still converts to a full // matrix. if (! error_state && nidx == 2) @@ -248,7 +248,7 @@ return to_dense ().convert_to_str_internal (pad, force, type); } -bool +bool octave_perm_matrix::save_ascii (std::ostream& os) { typedef octave_int idx_int_type; @@ -265,7 +265,7 @@ return true; } -bool +bool octave_perm_matrix::load_ascii (std::istream& is) { typedef octave_int idx_int_type; @@ -279,7 +279,7 @@ bool colp = orient == 'c'; ColumnVector tmp (n); is >> tmp; - if (!is) + if (!is) { error ("load: failed to load permutation matrix constant"); success = false; @@ -303,7 +303,7 @@ return success; } -bool +bool octave_perm_matrix::save_binary (std::ostream& os, bool&) { @@ -334,7 +334,7 @@ if (swap) { int nel = m.numel (); - for (int i = 0; i < nel; i++) + for (int i = 0; i < nel; i++) switch (sizeof (octave_idx_type)) { case 8: @@ -389,8 +389,8 @@ octave_perm_matrix::write (octave_stream& os, int block_size, oct_data_conv::data_type output_type, int skip, oct_mach_info::float_format flt_fmt) const -{ - return to_dense ().write (os, block_size, output_type, skip, flt_fmt); +{ + return to_dense ().write (os, block_size, output_type, skip, flt_fmt); } void @@ -412,7 +412,7 @@ DEFINE_OCTAVE_ALLOCATOR (octave_perm_matrix); -DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_perm_matrix, +DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_perm_matrix, "permutation matrix", "double"); static octave_base_value * diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-perm.h --- a/src/ov-perm.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-perm.h Thu Jan 20 17:24:59 2011 -0500 @@ -30,7 +30,7 @@ #include "ov-typeinfo.h" #include "oct-obj.h" -class +class OCTINTERP_API octave_perm_matrix : public octave_base_value { @@ -147,14 +147,14 @@ FloatComplexMatrix float_complex_matrix_value (bool = false) const; ComplexNDArray complex_array_value (bool = false) const; - + FloatComplexNDArray float_complex_array_value (bool = false) const; - + boolNDArray bool_array_value (bool warn = false) const; charNDArray char_array_value (bool = false) const; - - NDArray array_value (bool = false) const; + + NDArray array_value (bool = false) const; FloatNDArray float_array_value (bool = false) const; @@ -196,7 +196,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); int write (octave_stream& os, int block_size, @@ -216,7 +216,7 @@ protected: - PermMatrix matrix; + PermMatrix matrix; virtual octave_value to_dense (void) const; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-range.cc --- a/src/ov-range.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-range.cc Thu Jan 20 17:24:59 2011 -0500 @@ -213,13 +213,13 @@ charNDArray retval (dims ()); octave_idx_type nel = numel (); - + for (octave_idx_type i = 0; i < nel; i++) retval.elem (i) = static_cast(matrix.elem (i)); return retval; } - + octave_value octave_range::all (int dim) const { @@ -240,12 +240,12 @@ return m.any (dim); } -octave_value +octave_value octave_range::diag (octave_idx_type k) const -{ +{ return (k == 0 ? octave_value (DiagMatrix (DiagArray2 (range.matrix_value ()))) - : octave_value (range.diag (k))); + : octave_value (range.diag (k))); } @@ -323,15 +323,15 @@ return boolNDArray (m); } -octave_value +octave_value octave_range::resize (const dim_vector& dv, bool fill) const -{ - NDArray retval = array_value (); +{ + NDArray retval = array_value (); if (fill) retval.resize (dv, NDArray::resize_fill_value ()); else - retval.resize (dv); - return retval; + retval.resize (dv); + return retval; } octave_value @@ -373,7 +373,7 @@ newline (os); retval = true; } - + return retval; } @@ -394,7 +394,7 @@ skip_until_newline (is, false); } -bool +bool octave_range::save_ascii (std::ostream& os) { Range r = range_value (); @@ -421,7 +421,7 @@ return true; } -bool +bool octave_range::load_ascii (std::istream& is) { // # base, limit, range comment added by save (). @@ -444,7 +444,7 @@ return true; } -bool +bool octave_range::save_binary (std::ostream& os, bool& /* save_as_floats */) { char tmp = LS_DOUBLE; @@ -463,7 +463,7 @@ return true; } -bool +bool octave_range::load_binary (std::istream& is, bool swap, oct_mach_info::float_format /* fmt */) { @@ -494,9 +494,9 @@ #if defined (HAVE_HDF5) // The following subroutines creates an HDF5 representation of the way -// we will store Octave range types (triplets of floating-point numbers). -// NUM_TYPE is the HDF5 numeric type to use for storage (e.g. -// H5T_NATIVE_DOUBLE to save as 'double'). Note that any necessary +// we will store Octave range types (triplets of floating-point numbers). +// NUM_TYPE is the HDF5 numeric type to use for storage (e.g. +// H5T_NATIVE_DOUBLE to save as 'double'). Note that any necessary // conversions are handled automatically by HDF5. static hid_t @@ -523,24 +523,24 @@ if (space_hid < 0) return false; type_hid = hdf5_make_range_type (H5T_NATIVE_DOUBLE); - if (type_hid < 0) + if (type_hid < 0) { H5Sclose (space_hid); return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Tclose (type_hid); return false; } - + Range r = range_value (); double range_vals[3]; range_vals[0] = r.base (); @@ -564,7 +564,7 @@ return retval; } -bool +bool octave_range::load_hdf5 (hid_t loc_id, const char *name) { bool retval = false; @@ -597,12 +597,12 @@ } double rangevals[3]; - if (H5Dread (data_hid, range_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, + if (H5Dread (data_hid, range_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rangevals) >= 0) { retval = true; octave_idx_type nel; - if (hdf5_get_scalar_attr (data_hid, H5T_NATIVE_IDX, + if (hdf5_get_scalar_attr (data_hid, H5T_NATIVE_IDX, "OCTAVE_RANGE_NELEM", &nel)) range = Range (rangevals[0], rangevals[2], nel); else @@ -610,7 +610,7 @@ if (rangevals[2] != 0) range = Range (rangevals[0], rangevals[1], rangevals[2]); else - range = Range (rangevals[0], rangevals[2], + range = Range (rangevals[0], rangevals[2], static_cast (rangevals[1])); } } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-range.h --- a/src/ov-range.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-range.h Thu Jan 20 17:24:59 2011 -0500 @@ -71,7 +71,7 @@ } octave_range (const octave_range& r) - : octave_base_value (), range (r.range), + : octave_base_value (), range (r.range), idx_cache (r.idx_cache ? new idx_vector (*r.idx_cache) : 0) { } @@ -107,7 +107,7 @@ idx_vector index_vector (void) const; dim_vector dims (void) const - { + { octave_idx_type n = range.nelem (); return dim_vector (n > 0, n); } @@ -190,7 +190,7 @@ { return FloatMatrix (range.matrix_value ()); } charNDArray char_array_value (bool = false) const; - + // FIXME -- it would be better to have Range::intXNDArray_value // functions to avoid the intermediate conversion to a matrix // object. @@ -259,7 +259,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) @@ -301,7 +301,7 @@ void clear_cached_info (void) const { delete idx_cache; idx_cache = 0; - } + } mutable idx_vector *idx_cache; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-re-diag.cc --- a/src/ov-re-diag.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-re-diag.cc Thu Jan 20 17:24:59 2011 -0500 @@ -88,12 +88,12 @@ // This hack is to allow constructing permutation matrices using // eye(n)(p,:), eye(n)(:,q) && eye(n)(p,q) where p & q are permutation - // vectors. + // vectors. if (! resize_ok && idx.length () == 2 && matrix.is_multiple_of_identity (1)) { idx_vector idx0 = idx(0).index_vector (); idx_vector idx1 = idx(1).index_vector (); - + if (! error_state) { bool left = idx0.is_permutation (matrix.rows ()); @@ -173,7 +173,7 @@ } } -bool +bool octave_diag_matrix::save_binary (std::ostream& os, bool& save_as_floats) { @@ -206,7 +206,7 @@ return true; } -bool +bool octave_diag_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -233,8 +233,8 @@ return true; } -bool -octave_diag_matrix::chk_valid_scalar (const octave_value& val, +bool +octave_diag_matrix::chk_valid_scalar (const octave_value& val, double& x) const { bool retval = val.is_real_scalar (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-re-diag.h --- a/src/ov-re-diag.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-re-diag.h Thu Jan 20 17:24:59 2011 -0500 @@ -32,7 +32,7 @@ class OCTINTERP_API -octave_diag_matrix +octave_diag_matrix : public octave_base_diag { public: @@ -80,14 +80,14 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); octave_value map (unary_mapper_t umap) const; private: - bool chk_valid_scalar (const octave_value&, + bool chk_valid_scalar (const octave_value&, double&) const; DECLARE_OCTAVE_ALLOCATOR diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-re-mat.cc --- a/src/ov-re-mat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-re-mat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -230,27 +230,27 @@ return boolNDArray (matrix); } - + charNDArray octave_matrix::char_array_value (bool) const { charNDArray retval (dims ()); octave_idx_type nel = numel (); - + for (octave_idx_type i = 0; i < nel; i++) retval.elem (i) = static_cast(matrix.elem (i)); return retval; } - -SparseMatrix + +SparseMatrix octave_matrix::sparse_matrix_value (bool) const { return SparseMatrix (matrix.matrix_value ()); } -SparseComplexMatrix +SparseComplexMatrix octave_matrix::sparse_complex_matrix_value (bool) const { // FIXME Need a SparseComplexMatrix (Matrix) constructor to make @@ -263,7 +263,7 @@ octave_matrix::diag (octave_idx_type k) const { octave_value retval; - if (k == 0 && matrix.ndims () == 2 + if (k == 0 && matrix.ndims () == 2 && (matrix.rows () == 1 || matrix.columns () == 1)) retval = DiagMatrix (DiagArray2 (matrix)); else @@ -274,7 +274,7 @@ // We override these two functions to allow reshaping both // the matrix and the index cache. -octave_value +octave_value octave_matrix::reshape (const dim_vector& new_dims) const { if (idx_cache) @@ -287,7 +287,7 @@ return octave_base_matrix::reshape (new_dims); } -octave_value +octave_value octave_matrix::squeeze (void) const { if (idx_cache) @@ -300,7 +300,7 @@ return octave_base_matrix::squeeze (); } -octave_value +octave_value octave_matrix::sort (octave_idx_type dim, sortmode mode) const { if (idx_cache) @@ -313,7 +313,7 @@ return octave_base_matrix::sort (dim, mode); } -octave_value +octave_value octave_matrix::sort (Array &sidx, octave_idx_type dim, sortmode mode) const { @@ -327,7 +327,7 @@ return octave_base_matrix::sort (sidx, dim, mode); } -sortmode +sortmode octave_matrix::is_sorted (sortmode mode) const { if (idx_cache) @@ -339,7 +339,7 @@ else return octave_base_matrix::is_sorted (mode); } -Array +Array octave_matrix::sort_rows_idx (sortmode mode) const { if (idx_cache) @@ -352,7 +352,7 @@ return octave_base_matrix::sort_rows_idx (mode); } -sortmode +sortmode octave_matrix::is_sorted_rows (sortmode mode) const { if (idx_cache) @@ -414,7 +414,7 @@ return retval; } -bool +bool octave_matrix::save_ascii (std::ostream& os) { dim_vector d = dims (); @@ -432,7 +432,7 @@ } else { - // Keep this case, rather than use generic code above for backward + // Keep this case, rather than use generic code above for backward // compatiability. Makes load_ascii much more complex!! os << "# rows: " << rows () << "\n" << "# columns: " << columns () << "\n"; @@ -443,7 +443,7 @@ return true; } -bool +bool octave_matrix::load_ascii (std::istream& is) { bool success = true; @@ -520,7 +520,7 @@ else panic_impossible (); } - else + else { error ("load: failed to extract number of rows and columns"); success = false; @@ -538,7 +538,7 @@ return success; } -bool +bool octave_matrix::save_binary (std::ostream& os, bool& save_as_floats) { @@ -580,7 +580,7 @@ return true; } -bool +bool octave_matrix::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -669,7 +669,7 @@ // Octave uses column-major, while HDF5 uses row-major ordering for (int i = 0; i < rank; i++) hdims[i] = dv (rank-i-1); - + space_hid = H5Screate_simple (rank, hdims, 0); if (space_hid < 0) return false; @@ -697,12 +697,12 @@ = save_type_to_hdf5 (get_save_type (max_val, min_val)); } #endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */ - + #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, + data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid, H5P_DEFAULT); #endif if (data_hid < 0) @@ -741,7 +741,7 @@ hid_t space_id = H5Dget_space (data_hid); hsize_t rank = H5Sget_simple_extent_ndims (space_id); - + if (rank < 1) { H5Sclose (space_id); @@ -770,8 +770,8 @@ NDArray m (dv); double *re = m.fortran_vec (); - if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, - H5P_DEFAULT, re) >= 0) + if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, + H5P_DEFAULT, re) >= 0) { retval = true; matrix = m; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-re-mat.h --- a/src/ov-re-mat.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-re-mat.h Thu Jan 20 17:24:59 2011 -0500 @@ -80,7 +80,7 @@ octave_matrix (const octave_matrix& m) : octave_base_matrix (m) { } - octave_matrix (const Array& idx, + octave_matrix (const Array& idx, bool zero_based = false, bool cache_index = false) : octave_base_matrix (NDArray (idx, zero_based)) { @@ -90,8 +90,8 @@ } octave_matrix (const NDArray& nda, const idx_vector& cache) - : octave_base_matrix (nda) - { + : octave_base_matrix (nda) + { set_idx_cache (cache); } @@ -161,13 +161,13 @@ FloatComplexMatrix float_complex_matrix_value (bool = false) const; ComplexNDArray complex_array_value (bool = false) const; - + FloatComplexNDArray float_complex_array_value (bool = false) const; - + boolNDArray bool_array_value (bool warn = false) const; charNDArray char_array_value (bool = false) const; - + NDArray array_value (bool = false) const { return matrix; } FloatNDArray float_array_value (bool = false) const { return matrix; } @@ -209,7 +209,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-re-sparse.cc --- a/src/ov-re-sparse.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-re-sparse.cc Thu Jan 20 17:24:59 2011 -0500 @@ -165,7 +165,7 @@ return retval; } - + ComplexMatrix octave_sparse_matrix::complex_matrix_value (bool) const { @@ -178,13 +178,13 @@ return ComplexNDArray (ComplexMatrix (matrix.matrix_value ())); } -NDArray +NDArray octave_sparse_matrix::array_value (bool) const { return NDArray (matrix.matrix_value ()); } -SparseBoolMatrix +SparseBoolMatrix octave_sparse_matrix::sparse_bool_matrix_value (bool warn) const { if (matrix.any_element_is_nan ()) @@ -212,11 +212,11 @@ octave_idx_type nr = matrix.rows (); octave_idx_type nc = matrix.cols (); charNDArray chm (dv, static_cast (0)); - + bool warned = false; for (octave_idx_type j = 0; j < nc; j++) - for (octave_idx_type i = matrix.cidx(j); + for (octave_idx_type i = matrix.cidx(j); i < matrix.cidx(j+1); i++) { octave_quit (); @@ -246,7 +246,7 @@ } } - chm (matrix.ridx(i) + j * nr) = + chm (matrix.ridx(i) + j * nr) = static_cast (ival); } } @@ -257,7 +257,7 @@ return retval; } -bool +bool octave_sparse_matrix::save_binary (std::ostream& os, bool&save_as_floats) { dim_vector d = this->dims (); @@ -273,15 +273,15 @@ int32_t itmp; // Use negative value for ndims to be consistent with other formats - itmp= -2; + itmp= -2; os.write (reinterpret_cast (&itmp), 4); - - itmp= nr; + + itmp= nr; os.write (reinterpret_cast (&itmp), 4); - + itmp= nc; os.write (reinterpret_cast (&itmp), 4); - + itmp= nz; os.write (reinterpret_cast (&itmp), 4); @@ -305,17 +305,17 @@ // add one to the printed indices to go from // zero-based to one-based arrays - for (int i = 0; i < nc+1; i++) + for (int i = 0; i < nc+1; i++) { octave_quit (); itmp = matrix.cidx(i); os.write (reinterpret_cast (&itmp), 4); } - for (int i = 0; i < nz; i++) + for (int i = 0; i < nz; i++) { octave_quit (); - itmp = matrix.ridx(i); + itmp = matrix.ridx(i); os.write (reinterpret_cast (&itmp), 4); } @@ -360,7 +360,7 @@ static_cast (nc), static_cast (nz)); - for (int i = 0; i < nc+1; i++) + for (int i = 0; i < nc+1; i++) { octave_quit (); if (! is.read (reinterpret_cast (&tmp), 4)) @@ -370,7 +370,7 @@ m.xcidx(i) = tmp; } - for (int i = 0; i < nz; i++) + for (int i = 0; i < nz; i++) { octave_quit (); if (! is.read (reinterpret_cast (&tmp), 4)) @@ -382,7 +382,7 @@ if (! is.read (reinterpret_cast (&ctmp), 1)) return false; - + read_doubles (is, m.xdata (), static_cast (ctmp), nz, swap, fmt); if (error_state || ! is) @@ -399,7 +399,7 @@ #if defined (HAVE_HDF5) bool -octave_sparse_matrix::save_hdf5 (hid_t loc_id, const char *name, +octave_sparse_matrix::save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) { dim_vector dv = dims (); @@ -425,25 +425,25 @@ hsize_t hdims[2]; space_hid = H5Screate_simple (0, hdims, 0); - if (space_hid < 0) + if (space_hid < 0) { H5Gclose (group_hid); return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + tmp = m.rows (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0; @@ -453,21 +453,21 @@ H5Sclose (space_hid); H5Gclose (group_hid); return false; - } + } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + tmp = m.cols (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0; @@ -477,22 +477,22 @@ H5Sclose (space_hid); H5Gclose (group_hid); return false; - } + } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); -#else - data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, +#else + data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + tmp = m.nnz (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmp) >= 0; @@ -511,26 +511,26 @@ space_hid = H5Screate_simple (2, hdims, 0); - if (space_hid < 0) + if (space_hid < 0) { H5Gclose (group_hid); return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + octave_idx_type * itmp = m.xcidx (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) >= 0; @@ -540,7 +540,7 @@ H5Sclose (space_hid); H5Gclose (group_hid); return false; - } + } H5Sclose (space_hid); @@ -549,25 +549,25 @@ space_hid = H5Screate_simple (2, hdims, 0); - if (space_hid < 0) + if (space_hid < 0) { H5Gclose (group_hid); return false; } #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, + data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + itmp = m.xridx (); retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, itmp) >= 0; @@ -604,19 +604,19 @@ #endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */ #if HAVE_HDF5_18 - data_hid = H5Dcreate (group_hid, "data", save_type_hid, space_hid, + data_hid = H5Dcreate (group_hid, "data", save_type_hid, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (group_hid, "data", save_type_hid, space_hid, + data_hid = H5Dcreate (group_hid, "data", save_type_hid, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); H5Gclose (group_hid); return false; } - + double * dtmp = m.xdata (); retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dtmp) >= 0; @@ -633,14 +633,14 @@ octave_idx_type nr, nc, nz; hid_t group_hid, data_hid, space_hid; hsize_t rank; - + dim_vector dv; int empty = load_hdf5_empty (loc_id, name, dv); if (empty > 0) matrix.resize(dv); if (empty) return (empty > 0); - + #if HAVE_HDF5_18 group_hid = H5Gopen (loc_id, name, H5P_DEFAULT); #else @@ -657,15 +657,15 @@ rank = H5Sget_simple_extent_ndims (space_hid); if (rank != 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; } - if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nr) < 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; @@ -682,22 +682,22 @@ rank = H5Sget_simple_extent_ndims (space_hid); if (rank != 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; } - if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nc) < 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; } H5Dclose (data_hid); - + #if HAVE_HDF5_18 data_hid = H5Dopen (group_hid, "nz", H5P_DEFAULT); #else @@ -707,15 +707,15 @@ rank = H5Sget_simple_extent_ndims (space_hid); if (rank != 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; } - if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, &nz) < 0) - { + { H5Dclose (data_hid); H5Gclose (group_hid); return false; @@ -758,8 +758,8 @@ } octave_idx_type *itmp = m.xcidx (); - if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, - H5P_DEFAULT, itmp) < 0) + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, itmp) < 0) { H5Sclose (space_hid); H5Dclose (data_hid); @@ -797,8 +797,8 @@ } itmp = m.xridx (); - if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, - H5P_DEFAULT, itmp) < 0) + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, itmp) < 0) { H5Sclose (space_hid); H5Dclose (data_hid); @@ -837,7 +837,7 @@ double *dtmp = m.xdata (); bool retval = false; - if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dtmp) >= 0 && m.indices_ok ()) { diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-re-sparse.h --- a/src/ov-re-sparse.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-re-sparse.h Thu Jan 20 17:24:59 2011 -0500 @@ -70,13 +70,13 @@ octave_sparse_matrix (const MSparse& m) : octave_base_sparse (m) { } - + octave_sparse_matrix (const MSparse& m, const MatrixType& t) : octave_base_sparse (m, t) { } octave_sparse_matrix (const Sparse& m) : octave_base_sparse (SparseMatrix (m)) { } - + octave_sparse_matrix (const Sparse& m, const MatrixType& t) : octave_base_sparse (SparseMatrix (m), t) { } @@ -118,7 +118,7 @@ ComplexMatrix complex_matrix_value (bool = false) const; ComplexNDArray complex_array_value (bool = false) const; - + NDArray array_value (bool = false) const; SparseMatrix sparse_matrix_value (bool = false) const @@ -140,7 +140,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-scalar.cc --- a/src/ov-scalar.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-scalar.cc Thu Jan 20 17:24:59 2011 -0500 @@ -89,7 +89,7 @@ return tmp.do_index_op (idx, resize_ok); } -octave_value +octave_value octave_scalar::resize (const dim_vector& dv, bool fill) const { if (fill) @@ -138,7 +138,7 @@ return retval; } -bool +bool octave_scalar::save_ascii (std::ostream& os) { double d = double_value (); @@ -150,7 +150,7 @@ return true; } -bool +bool octave_scalar::load_ascii (std::istream& is) { scalar = octave_read_value (is); @@ -163,7 +163,7 @@ return true; } -bool +bool octave_scalar::save_binary (std::ostream& os, bool& /* save_as_floats */) { char tmp = LS_DOUBLE; @@ -174,7 +174,7 @@ return true; } -bool +bool octave_scalar::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -205,13 +205,13 @@ if (space_hid < 0) return false; #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_DOUBLE, space_hid, H5P_DEFAULT); #endif - if (data_hid < 0) + if (data_hid < 0) { H5Sclose (space_hid); return false; @@ -240,15 +240,15 @@ hsize_t rank = H5Sget_simple_extent_ndims (space_id); if (rank != 0) - { + { H5Dclose (data_hid); return false; } double dtmp; - if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dtmp) < 0) - { + { H5Dclose (data_hid); return false; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-scalar.h --- a/src/ov-scalar.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-scalar.h Thu Jan 20 17:24:59 2011 -0500 @@ -224,7 +224,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-str-mat.cc --- a/src/ov-str-mat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-str-mat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -138,7 +138,7 @@ return retval; } -octave_value +octave_value octave_char_matrix_str::resize (const dim_vector& dv, bool fill) const { charNDArray retval (matrix); @@ -267,7 +267,7 @@ current_print_indent_level (), true); } -bool +bool octave_char_matrix_str::save_ascii (std::ostream& os) { dim_vector d = dims (); @@ -304,7 +304,7 @@ return true; } -bool +bool octave_char_matrix_str::load_ascii (std::istream& is) { bool success = true; @@ -406,12 +406,12 @@ } else { - error ("load: failed to extract string length for element %d", + error ("load: failed to extract string length for element %d", i+1); success = false; } } - + if (! error_state) matrix = chm; } @@ -424,10 +424,10 @@ else if (kw == "length") { int len = val; - + if (len >= 0) { - // This is cruft for backward compatiability, + // This is cruft for backward compatiability, // but relatively harmless. // Use this instead of a C-style character buffer so @@ -460,7 +460,7 @@ return success; } -bool +bool octave_char_matrix_str::save_binary (std::ostream& os, bool& /* save_as_floats */) { @@ -482,7 +482,7 @@ return true; } -bool +bool octave_char_matrix_str::load_binary (std::istream& is, bool swap, oct_mach_info::float_format /* fmt */) { @@ -507,7 +507,7 @@ swap_bytes<4> (&di); dv(i) = di; } - + // Convert an array with a single dimension to be a row vector. // Octave should never write files like this, other software // might. @@ -523,7 +523,7 @@ charNDArray m(dv); char *tmp = m.fortran_vec (); is.read (tmp, dv.numel ()); - + if (error_state || ! is) return false; matrix = m; @@ -576,15 +576,15 @@ // Octave uses column-major, while HDF5 uses row-major ordering for (int i = 0; i < rank; i++) hdims[i] = dv (rank-i-1); - + space_hid = H5Screate_simple (rank, hdims, 0); if (space_hid < 0) return false; #if HAVE_HDF5_18 - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #else - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid, H5P_DEFAULT); #endif if (data_hid < 0) @@ -598,7 +598,7 @@ for (int i = 0; i < dv.numel (); ++i) s[i] = m(i); - retval = H5Dwrite (data_hid, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, + retval = H5Dwrite (data_hid, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, s) >= 0; H5Dclose (data_hid); @@ -607,7 +607,7 @@ return retval; } -bool +bool octave_char_matrix_str::load_hdf5 (hid_t loc_id, const char *name) { bool retval = false; @@ -660,8 +660,8 @@ charNDArray m (dv); char *str = m.fortran_vec (); - if (H5Dread (data_hid, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, - H5P_DEFAULT, str) >= 0) + if (H5Dread (data_hid, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, + H5P_DEFAULT, str) >= 0) { retval = true; matrix = m; @@ -704,7 +704,7 @@ } matrix = charMatrix (s); - + H5Tclose (st_id); H5Tclose (type_hid); H5Sclose (space_hid); @@ -730,7 +730,7 @@ // hdf5 string arrays store strings of all the // same physical length (I think), which is // slightly wasteful, but oh well. - + OCTAVE_LOCAL_BUFFER (char, s, elements * slen); // create datatype for (null-terminated) string diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-str-mat.h --- a/src/ov-str-mat.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-str-mat.h Thu Jan 20 17:24:59 2011 -0500 @@ -146,7 +146,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-struct.cc --- a/src/ov-struct.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-struct.cc Thu Jan 20 17:24:59 2011 -0500 @@ -83,7 +83,7 @@ retval = map.contents (p); else if (auto_add) retval = (numel () == 0) ? Cell (dim_vector (1, 1)) : Cell (dims ()); - else + else error ("structure has no member `%s'", nm.c_str ()); return retval; @@ -447,11 +447,11 @@ else gripe_failed_assignment (); } - else + else { const octave_map& cmap = const_cast (map); // cast map to const reference to avoid forced key insertion. - if (idxf.all_scalars () + if (idxf.all_scalars () || cmap.contents (key).index (idxf, true).numel () == 1) { map.assign (idxf, key, Cell (t_rhs.storable_value ())); @@ -493,7 +493,7 @@ } else { - if (t_rhs.is_null_value()) + if (t_rhs.is_null_value()) { map.delete_elements (idx.front()); @@ -677,8 +677,8 @@ return retval; } -static bool -scalar (const dim_vector& dims) +static bool +scalar (const dim_vector& dims) { return dims.length () == 2 && dims (0) == 1 && dims (1) == 1; } @@ -693,7 +693,7 @@ %!assert(struct('a',{1,2},'b',3),x) %!assert(struct('a',{1,2},'b',{3}),x) %!assert(struct('b',3,'a',{1,2}),x) -%!assert(struct('b',{3},'a',{1,2}),x) +%!assert(struct('b',{3},'a',{1,2}),x) %!test x=struct([]); %!assert(size(x),[0,0]); %!assert(isstruct(x)); @@ -731,7 +731,7 @@ octave_value val = map.contents (key); bool b = save_ascii_data (os, val, key, false, 0); - + if (! b) return os; } @@ -739,7 +739,7 @@ return true; } -bool +bool octave_struct::load_ascii (std::istream& is) { octave_idx_type len = 0; @@ -800,7 +800,7 @@ m.setfield (nm, tcell); } - if (is) + if (is) map = m; else { @@ -821,7 +821,7 @@ return success; } -bool +bool octave_struct::save_binary (std::ostream& os, bool& save_as_floats) { octave_map m = map_value (); @@ -840,7 +840,7 @@ di = d(i); os.write (reinterpret_cast (&di), 4); } - + int32_t len = nf; os.write (reinterpret_cast (&len), 4); @@ -855,7 +855,7 @@ octave_value val = map.contents (key); bool b = save_binary_data (os, val, key, "", 0, save_as_floats); - + if (! b) return os; } @@ -863,7 +863,7 @@ return true; } -bool +bool octave_struct::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -910,14 +910,14 @@ std::string doc; // recurse to read cell elements - std::string nm = read_binary_data (is, swap, fmt, std::string (), + std::string nm = read_binary_data (is, swap, fmt, std::string (), dummy, t2, doc); if (!is) break; Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2); - + if (error_state) { error ("load: internal error loading struct elements"); @@ -927,7 +927,7 @@ m.setfield (nm, tcell); } - if (is) + if (is) map = m; else { @@ -972,7 +972,7 @@ octave_value val = map.contents (key); - bool retval2 = add_hdf5_data (data_hid, val, key, "", false, + bool retval2 = add_hdf5_data (data_hid, val, key, "", false, save_as_floats); if (! retval2) @@ -984,7 +984,7 @@ return true; } -bool +bool octave_struct::load_hdf5 (hid_t loc_id, const char *name) { bool retval = false; @@ -1013,7 +1013,7 @@ octave_value t2 = dsub.tc; Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2); - + if (error_state) { error ("load: internal error loading struct elements"); @@ -1029,7 +1029,7 @@ map = m; retval = true; } - + return retval; } @@ -1078,7 +1078,7 @@ } bool -octave_struct::fast_elem_insert (octave_idx_type n, +octave_struct::fast_elem_insert (octave_idx_type n, const octave_value& x) { bool retval = false; @@ -1411,7 +1411,7 @@ octave_value val = map.contents (key); bool b = save_ascii_data (os, val, key, false, 0); - + if (! b) return os; } @@ -1452,7 +1452,7 @@ m.setfield (nm, t2); } - if (is) + if (is) map = m; else { @@ -1473,7 +1473,7 @@ return success; } -bool +bool octave_scalar_struct::save_binary (std::ostream& os, bool& save_as_floats) { octave_map m = map_value (); @@ -1494,7 +1494,7 @@ octave_value val = map.contents (key); bool b = save_binary_data (os, val, key, "", 0, save_as_floats); - + if (! b) return os; } @@ -1502,7 +1502,7 @@ return true; } -bool +bool octave_scalar_struct::load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) { @@ -1526,7 +1526,7 @@ std::string doc; // recurse to read cell elements - std::string nm = read_binary_data (is, swap, fmt, std::string (), + std::string nm = read_binary_data (is, swap, fmt, std::string (), dummy, t2, doc); if (!is) @@ -1541,7 +1541,7 @@ m.setfield (nm, t2); } - if (is) + if (is) map = m; else { @@ -1586,7 +1586,7 @@ octave_value val = map.contents (key); - bool retval2 = add_hdf5_data (data_hid, val, key, "", false, + bool retval2 = add_hdf5_data (data_hid, val, key, "", false, save_as_floats); if (! retval2) @@ -1598,7 +1598,7 @@ return true; } -bool +bool octave_scalar_struct::load_hdf5 (hid_t loc_id, const char *name) { bool retval = false; @@ -1641,7 +1641,7 @@ map = m; retval = true; } - + return retval; } @@ -1709,7 +1709,7 @@ %!assert(struct('a',{1,2},'b',3),x) %!assert(struct('a',{1,2},'b',{3}),x) %!assert(struct('b',3,'a',{1,2}),x) -%!assert(struct('b',{3},'a',{1,2}),x) +%!assert(struct('b',{3},'a',{1,2}),x) %!test x=struct([]); %!assert(size(x),[0,0]); %!assert(isstruct(x)); @@ -1773,10 +1773,10 @@ return retval; } - + // Check for "field", VALUE pairs. - for (int i = 0; i < nargin; i += 2) + for (int i = 0; i < nargin; i += 2) { if (! args(i).is_string () || i + 1 >= nargin) { @@ -1791,9 +1791,9 @@ int first_dimensioned_value = 0; - for (int i = 1; i < nargin; i += 2) + for (int i = 1; i < nargin; i += 2) { - if (args(i).is_cell ()) + if (args(i).is_cell ()) { dim_vector argdims (args(i).dims ()); @@ -1818,7 +1818,7 @@ octave_map map (dims); - for (int i = 0; i < nargin; i+= 2) + for (int i = 0; i < nargin; i+= 2) { // Get key. @@ -1835,23 +1835,23 @@ // Value may be v, { v }, or { v1, v2, ... } // In the first two cases, we need to create a cell array of - // the appropriate dimensions filled with v. In the last case, + // the appropriate dimensions filled with v. In the last case, // the cell array has already been determined to be of the // correct dimensions. - if (args(i+1).is_cell ()) + if (args(i+1).is_cell ()) { const Cell c (args(i+1).cell_value ()); if (error_state) return retval; - if (scalar (c.dims ())) + if (scalar (c.dims ())) map.setfield (key, Cell (dims, c(0))); - else + else map.setfield (key, c); } - else + else map.setfield (key, Cell (dims, args(i+1))); if (error_state) @@ -2037,7 +2037,7 @@ if (args.length () == 3) { - if (! args(0).is_cell ()) + if (! args(0).is_cell ()) error ("cell2struct: first argument must be a cell"); else if (! (args(1).is_cellstr () || args(1).is_char_matrix ())) error ("cell2struct: second argument must be a cell array of strings or a character matrix"); @@ -2049,7 +2049,7 @@ const Array fields = args(1).cellstr_value (); int dim = args(2).int_value () - 1; octave_idx_type ext = 0; - + if (dim < 0) error ("cell2struct: dim must be a valid dimension"); else diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-struct.h --- a/src/ov-struct.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-struct.h Thu Jan 20 17:24:59 2011 -0500 @@ -138,7 +138,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) @@ -259,7 +259,7 @@ bool save_binary (std::ostream& os, bool& save_as_floats); - bool load_binary (std::istream& is, bool swap, + bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt); #if defined (HAVE_HDF5) diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-type-conv.h --- a/src/ov-type-conv.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-type-conv.h Thu Jan 20 17:24:59 2011 -0500 @@ -23,7 +23,7 @@ #if !defined (octave_ov_type_conv_h) #define octave_ov_type_conv_h 1 -static +static octave_value octave_type_conv_body (const octave_value &arg, const std::string& name, int t_result) { @@ -38,7 +38,7 @@ { octave_base_value::type_conv_fcn cf1 = octave_value_typeinfo::lookup_type_conv_op (t_arg, t_result); - + if (cf1) { octave_base_value *tmp (cf1 (*(arg.internal_rep ()))); @@ -71,7 +71,7 @@ return retval; } - + #define OCTAVE_TYPE_CONV_BODY3(NAME, MATRIX_RESULT_T, SCALAR_RESULT_T) \ \ diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-typeinfo.cc --- a/src/ov-typeinfo.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-typeinfo.cc Thu Jan 20 17:24:59 2011 -0500 @@ -148,7 +148,7 @@ bool octave_value_typeinfo::register_pref_assign_conv (int t_lhs, int t_rhs, - int t_result) + int t_result) { return (instance_ok ()) ? instance->do_register_pref_assign_conv (t_lhs, t_rhs, t_result) : false; @@ -413,7 +413,7 @@ bool octave_value_typeinfo::do_register_pref_assign_conv (int t_lhs, int t_rhs, - int t_result) + int t_result) { if (lookup_pref_assign_conv (t_lhs, t_rhs) >= 0) { diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-usr-fcn.cc --- a/src/ov-usr-fcn.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-usr-fcn.cc Thu Jan 20 17:24:59 2011 -0500 @@ -83,7 +83,7 @@ octave_user_script::octave_user_script (const std::string& fnm, const std::string& nm, const std::string& ds) - : octave_user_code (nm, ds), cmd_list (0), file_name (fnm), + : octave_user_code (nm, ds), cmd_list (0), file_name (fnm), t_parsed (static_cast (0)), t_checked (static_cast (0)), call_depth (-1) @@ -462,7 +462,7 @@ octave_call_stack::backtrace_error_message (); return retval; } - + // Copy return values out. if (ret_list && ! special_expr) @@ -569,7 +569,7 @@ if (takes_varargs ()) symbol_table::varref ("varargin") = va_args.cell_value (); - + if (lvalue_list) { octave_idx_type nbh = 0; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov-usr-fcn.h --- a/src/ov-usr-fcn.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov-usr-fcn.h Thu Jan 20 17:24:59 2011 -0500 @@ -43,7 +43,7 @@ class tree_va_return_list; class tree_walker; -class +class octave_user_code : public octave_function { public: @@ -290,7 +290,7 @@ do_multi_index_op (int nargout, const octave_value_list& args); octave_value_list - do_multi_index_op (int nargout, const octave_value_list& args, + do_multi_index_op (int nargout, const octave_value_list& args, const std::list* lvalue_list); tree_parameter_list *parameter_list (void) { return param_list; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov.cc --- a/src/ov.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov.cc Thu Jan 20 17:24:59 2011 -0500 @@ -1177,7 +1177,7 @@ delete rep; rep = tmp; - } + } } octave_value @@ -1215,7 +1215,7 @@ octave_value octave_value::next_subsref (const std::string& type, const std::list& idx, - size_t skip) + size_t skip) { if (! error_state && idx.size () > skip) { @@ -1231,7 +1231,7 @@ octave_value_list octave_value::next_subsref (int nargout, const std::string& type, const std::list& idx, - size_t skip) + size_t skip) { if (! error_state && idx.size () > skip) { @@ -1247,7 +1247,7 @@ octave_value octave_value::next_subsref (bool auto_add, const std::string& type, const std::list& idx, - size_t skip) + size_t skip) { if (! error_state && idx.size () > skip) { @@ -1352,7 +1352,7 @@ else if (is_defined ()) { octave_value_typeinfo::assign_op_fcn f = 0; - + // Only attempt to operate in-place if this variable is unshared. if (rep->count == 1) { @@ -1533,7 +1533,7 @@ octave_value::column_vector_value (bool force_string_conv, bool frc_vec_conv) const { - return ColumnVector (vector_value (force_string_conv, + return ColumnVector (vector_value (force_string_conv, frc_vec_conv)); } @@ -1541,7 +1541,7 @@ octave_value::complex_column_vector_value (bool force_string_conv, bool frc_vec_conv) const { - return ComplexColumnVector (complex_vector_value (force_string_conv, + return ComplexColumnVector (complex_vector_value (force_string_conv, frc_vec_conv)); } @@ -1549,7 +1549,7 @@ octave_value::row_vector_value (bool force_string_conv, bool frc_vec_conv) const { - return RowVector (vector_value (force_string_conv, + return RowVector (vector_value (force_string_conv, frc_vec_conv)); } @@ -1557,7 +1557,7 @@ octave_value::complex_row_vector_value (bool force_string_conv, bool frc_vec_conv) const { - return ComplexRowVector (complex_vector_value (force_string_conv, + return ComplexRowVector (complex_vector_value (force_string_conv, frc_vec_conv)); } @@ -1615,7 +1615,7 @@ else retval = array_value (force_string_conv); } - else + else { const NDArray a = array_value (force_string_conv); if (! error_state) @@ -1691,7 +1691,7 @@ else retval = array_value (force_string_conv); } - else + else { const NDArray a = array_value (force_string_conv); if (! error_state) @@ -1744,7 +1744,7 @@ octave_value::float_column_vector_value (bool force_string_conv, bool frc_vec_conv) const { - return FloatColumnVector (float_vector_value (force_string_conv, + return FloatColumnVector (float_vector_value (force_string_conv, frc_vec_conv)); } @@ -1752,7 +1752,7 @@ octave_value::float_complex_column_vector_value (bool force_string_conv, bool frc_vec_conv) const { - return FloatComplexColumnVector (float_complex_vector_value (force_string_conv, + return FloatComplexColumnVector (float_complex_vector_value (force_string_conv, frc_vec_conv)); } @@ -1760,7 +1760,7 @@ octave_value::float_row_vector_value (bool force_string_conv, bool frc_vec_conv) const { - return FloatRowVector (float_vector_value (force_string_conv, + return FloatRowVector (float_vector_value (force_string_conv, frc_vec_conv)); } @@ -1768,7 +1768,7 @@ octave_value::float_complex_row_vector_value (bool force_string_conv, bool frc_vec_conv) const { - return FloatComplexRowVector (float_complex_vector_value (force_string_conv, + return FloatComplexRowVector (float_complex_vector_value (force_string_conv, frc_vec_conv)); } @@ -1800,7 +1800,7 @@ type_name (), "complex vector")); } -octave_value +octave_value octave_value::storable_value (void) const { octave_value retval = *this; @@ -1812,8 +1812,8 @@ return retval; } -void -octave_value::make_storable_value (void) +void +octave_value::make_storable_value (void) { if (is_null_value ()) { @@ -1873,7 +1873,7 @@ { gripe_library_execution_error (); } - } + } else gripe_binary_op (octave_value::binary_op_as_string (op), v1.class_name (), v2.class_name ()); @@ -2120,7 +2120,7 @@ { gripe_library_execution_error (); } - } + } else retval = decompose_binary_op (op, v1, v2); } @@ -2161,7 +2161,7 @@ } octave_value -do_cat_op (const octave_value& v1, const octave_value& v2, +do_cat_op (const octave_value& v1, const octave_value& v2, const Array& ra_idx) { octave_value retval; @@ -2364,7 +2364,7 @@ if (is_undefined ()) { std::string op_str = unary_op_as_string (op); - error ("in x%s or %sx, x must be defined first", + error ("in x%s or %sx, x must be defined first", op_str.c_str (), op_str.c_str ()); return *this; } @@ -2515,7 +2515,7 @@ return binop; } -octave_value::binary_op +octave_value::binary_op octave_value::op_eq_to_binary_op (assign_op op) { binary_op binop = unknown_binary_op; diff -r 1473d0cf86d2 -r 12df7854fa7c src/ov.h --- a/src/ov.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/ov.h Thu Jan 20 17:24:59 2011 -0500 @@ -110,9 +110,9 @@ enum compound_binary_op { // ** compound operations ** - op_trans_mul, + op_trans_mul, op_mul_trans, - op_herm_mul, + op_herm_mul, op_mul_herm, op_trans_ldiv, op_herm_ldiv, @@ -240,10 +240,10 @@ char type = '\'') GCC_ATTR_DEPRECATED; octave_value (const SparseMatrix& m, const MatrixType& t = MatrixType ()); octave_value (const Sparse& m, const MatrixType& t = MatrixType ()); - octave_value (const SparseComplexMatrix& m, + octave_value (const SparseComplexMatrix& m, const MatrixType& t = MatrixType ()); octave_value (const Sparse& m, const MatrixType& t = MatrixType ()); - octave_value (const SparseBoolMatrix& bm, + octave_value (const SparseBoolMatrix& bm, const MatrixType& t = MatrixType ()); octave_value (const Sparse& m, const MatrixType& t = MatrixType ()); octave_value (const octave_int8& i); @@ -270,7 +270,7 @@ octave_value (const Array& inda); octave_value (const uint64NDArray& inda); octave_value (const Array& inda); - octave_value (const Array& inda, + octave_value (const Array& inda, bool zero_based = false, bool cache_index = false); octave_value (const Array& cellstr); octave_value (const idx_vector& idx, bool lazy = true); @@ -636,7 +636,7 @@ { return rep->is_true (); } // Do two constants match (in a switch statement)? - + bool is_equal (const octave_value&) const; // Are the dimensions of this constant zero by zero? @@ -779,19 +779,19 @@ DiagMatrix diag_matrix_value (bool force = false) const { return rep->diag_matrix_value (force); } - + FloatDiagMatrix float_diag_matrix_value (bool force = false) const { return rep->float_diag_matrix_value (force); } - + ComplexDiagMatrix complex_diag_matrix_value (bool force = false) const { return rep->complex_diag_matrix_value (force); } - + FloatComplexDiagMatrix float_complex_diag_matrix_value (bool force = false) const { return rep->float_complex_diag_matrix_value (force); } PermMatrix perm_matrix_value (void) const { return rep->perm_matrix_value (); } - + octave_int8 int8_scalar_value (void) const { return rep->int8_scalar_value (); } @@ -946,7 +946,7 @@ // The following two hook conversions are called on any octave_value prior to // storing it to a "permanent" location, like a named variable, a cell or a - // struct component, or a return value of a function. + // struct component, or a return value of a function. octave_value storable_value (void) const; @@ -1061,10 +1061,10 @@ { return rep->diag (k); } octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const - { return rep->sort (dim, mode); } + { return rep->sort (dim, mode); } octave_value sort (Array &sidx, octave_idx_type dim = 0, sortmode mode = ASCENDING) const - { return rep->sort (sidx, dim, mode); } + { return rep->sort (sidx, dim, mode); } sortmode is_sorted (sortmode mode = UNSORTED) const { return rep->is_sorted (mode); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/pager.cc --- a/src/pager.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pager.cc Thu Jan 20 17:24:59 2011 -0500 @@ -407,7 +407,7 @@ // If there is pending output in the pager buf, it should not go // into the diary file. - + octave_stdout.set_diary_skip (); external_diary_file.open (diary_file.c_str (), std::ios::app); @@ -464,7 +464,7 @@ { write_to_diary_file = true; open_diary_file (); - } + } else if (arg == "off") { close_diary_file (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/pr-output.cc --- a/src/pr-output.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pr-output.cc Thu Jan 20 17:24:59 2011 -0500 @@ -225,8 +225,8 @@ * * ISO/IEC 14882:2003 : Programming languages -- C++. 5.6.4: ISO, IEC. 2003 . * "the binary % operator yields the remainder from the division of the first - * expression by the second. .... If both operands are nonnegative then the - * remainder is nonnegative; if not, the sign of the remainder is + * expression by the second. .... If both operands are nonnegative then the + * remainder is nonnegative; if not, the sign of the remainder is * implementation-defined". */ } @@ -241,7 +241,7 @@ /* Avoid using modulo function with negative arguments for portability. * See extended comment at calc_scale_exp */ if (logabsval < 0.0) - ex = logabsval - 2 + ((-logabsval + 2) % 3); + ex = logabsval - 2 + ((-logabsval + 2) % 3); else ex = logabsval - (logabsval % 3); } @@ -269,7 +269,7 @@ { return engineering_exponent (val); } - + double mantissa (void) const { return val / std::pow (10.0, exponent ()); @@ -288,8 +288,8 @@ if (pef.f.prec >= 0) os << std::setprecision (pef.f.prec); - std::ios::fmtflags oflags = - os.flags (static_cast + std::ios::fmtflags oflags = + os.flags (static_cast (pef.f.fmt | pef.f.up | pef.f.sp)); os << pef.mantissa (); @@ -303,7 +303,7 @@ else os << std::setw (0) << "e+"; - os << std::setw (pef.f.ex - 2) << std::setfill('0') << ex + os << std::setw (pef.f.ex - 2) << std::setfill('0') << ex << std::setfill(' '); os.flags (oflags); @@ -333,8 +333,8 @@ if (pff.f.prec >= 0) os << std::setprecision (pff.f.prec); - std::ios::fmtflags oflags = - os.flags (static_cast + std::ios::fmtflags oflags = + os.flags (static_cast (pff.f.fmt | pff.f.up | pff.f.sp)); os << pff.val; @@ -374,7 +374,7 @@ std::ostringstream buf2; buf2.flags (std::ios::fixed); - buf2 << std::setprecision (0) << static_cast(n); + buf2 << std::setprecision (0) << static_cast(n); s = buf2.str(); while (1) @@ -400,19 +400,19 @@ std::ostringstream buf; buf.flags (std::ios::fixed); - buf << std::setprecision (0) << static_cast(n) + buf << std::setprecision (0) << static_cast(n) << "/" << static_cast(d); m++; if (n < 0 && d < 0) { // Double negative, string can be two characters longer.. - if (buf.str().length() > static_cast(len + 2) && - m > 1) + if (buf.str().length() > static_cast(len + 2) && + m > 1) break; } - else if (buf.str().length() > static_cast(len) && - m > 1) + else if (buf.str().length() > static_cast(len) && + m > 1) break; s = buf.str(); @@ -425,7 +425,7 @@ lastn = - lastn; std::ostringstream buf; buf.flags (std::ios::fixed); - buf << std::setprecision (0) << static_cast(lastn) + buf << std::setprecision (0) << static_cast(lastn) << "/" << static_cast(lastd); s = buf.str(); } @@ -456,8 +456,8 @@ if (fw >= 0) os << std::setw (fw); - std::ios::fmtflags oflags = - os.flags (static_cast + std::ios::fmtflags oflags = + os.flags (static_cast (prf.f.fmt | prf.f.up | prf.f.sp)); if (fw > 0 && s.length() > static_cast(fw)) @@ -809,7 +809,7 @@ int x_min = min_abs == 0.0 ? 0 : num_digits (min_abs); - scale = (x_max == 0 || int_or_inf_or_nan) ? 1.0 + scale = (x_max == 0 || int_or_inf_or_nan) ? 1.0 : std::pow (10.0, calc_scale_exp (x_max - 1)); set_real_matrix_format (x_max, x_min, inf_or_nan, int_or_inf_or_nan, fw); @@ -1227,7 +1227,7 @@ int x_max = r_x_max > i_x_max ? r_x_max : i_x_max; int x_min = r_x_min > i_x_min ? r_x_min : i_x_min; - scale = (x_max == 0 || int_or_inf_or_nan) ? 1.0 + scale = (x_max == 0 || int_or_inf_or_nan) ? 1.0 : std::pow (10.0, calc_scale_exp (x_max - 1)); set_complex_matrix_format (x_max, x_min, r_x_max, r_x_min, inf_or_nan, @@ -1383,7 +1383,7 @@ int x_min = min_abs == 0.0 ? 0 : num_digits (min_abs); - scale = (x_max == 0 || all_ints) ? 1.0 + scale = (x_max == 0 || all_ints) ? 1.0 : std::pow (10.0, calc_scale_exp (x_max - 1)); set_range_format (x_max, x_min, all_ints, fw); @@ -1488,7 +1488,7 @@ } os.fill (ofill); - os.setf (oflags); + os.setf (oflags); } else if (bit_format) { @@ -1962,7 +1962,7 @@ // kluge. Get the true width of a number. int zero_fw; - { + { std::ostringstream tmp_oss; pr_float (tmp_oss, 0.0, fw, scale); zero_fw = tmp_oss.str ().length (); @@ -2160,7 +2160,7 @@ double scale = 1.0; set_format (cm, r_fw, i_fw, scale); int column_width = i_fw + r_fw; - column_width += (rat_format || bank_format || hex_format + column_width += (rat_format || bank_format || hex_format || bit_format) ? 2 : 7; octave_idx_type total_width = nc * column_width; octave_idx_type max_width = command_editor::terminal_cols (); @@ -2258,7 +2258,7 @@ pr_complex (os, cm(i,j), r_fw, i_fw, scale); } - if (i < nr - 1) + if (i < nr - 1) os << "\n"; } } @@ -2296,7 +2296,7 @@ double scale = 1.0; set_format (ComplexMatrix (cm.diag ()), r_fw, i_fw, scale); int column_width = i_fw + r_fw; - column_width += (rat_format || bank_format || hex_format + column_width += (rat_format || bank_format || hex_format || bit_format) ? 2 : 7; octave_idx_type total_width = nc * column_width; octave_idx_type max_width = command_editor::terminal_cols (); @@ -2373,7 +2373,7 @@ // kluge. Get the true width of a number. int zero_fw; - { + { std::ostringstream tmp_oss; pr_complex (tmp_oss, Complex (0.0), r_fw, i_fw, scale); zero_fw = tmp_oss.str ().length (); @@ -2402,7 +2402,7 @@ os << std::setw (zero_fw) << '0'; } - if (i < nr - 1) + if (i < nr - 1) os << "\n"; } } @@ -2562,44 +2562,44 @@ void octave_print_internal (std::ostream& os, bool d, bool pr_as_read_syntax) -{ - octave_print_internal (os, double (d), pr_as_read_syntax); +{ + octave_print_internal (os, double (d), pr_as_read_syntax); } // FIXME -- write single precision versions of the printing functions. void octave_print_internal (std::ostream& os, float d, bool pr_as_read_syntax) -{ - octave_print_internal (os, double (d), pr_as_read_syntax); +{ + octave_print_internal (os, double (d), pr_as_read_syntax); } void octave_print_internal (std::ostream& os, const FloatMatrix& m, bool pr_as_read_syntax, int extra_indent) -{ - octave_print_internal (os, Matrix (m), pr_as_read_syntax, extra_indent); +{ + octave_print_internal (os, Matrix (m), pr_as_read_syntax, extra_indent); } void octave_print_internal (std::ostream& os, const FloatDiagMatrix& m, bool pr_as_read_syntax, int extra_indent) -{ - octave_print_internal (os, DiagMatrix (m), pr_as_read_syntax, extra_indent); +{ + octave_print_internal (os, DiagMatrix (m), pr_as_read_syntax, extra_indent); } void octave_print_internal (std::ostream& os, const FloatNDArray& nda, bool pr_as_read_syntax, int extra_indent) { - octave_print_internal (os, NDArray (nda), pr_as_read_syntax, extra_indent); + octave_print_internal (os, NDArray (nda), pr_as_read_syntax, extra_indent); } void octave_print_internal (std::ostream& os, const FloatComplex& c, bool pr_as_read_syntax) { - octave_print_internal (os, Complex (c), pr_as_read_syntax); + octave_print_internal (os, Complex (c), pr_as_read_syntax); } void @@ -2977,7 +2977,7 @@ } os.fill (ofill); - os.setf (oflags); + os.setf (oflags); } else if (bit_format) { @@ -3213,7 +3213,7 @@ for (octave_idx_type i = 0; i < dims.numel (); i++) { - int new_digits = static_cast + int new_digits = static_cast (gnulib::floor (log10 (double (abs (nda(i).value ()))) + 1.0)); if (new_digits > digits) @@ -3304,7 +3304,7 @@ for (octave_idx_type ii = 0; ii < n_rows; ii++) { os << std::setw (extra_indent) << ""; - + for (octave_idx_type jj = col; jj < lim; jj++) { octave_quit (); @@ -3518,7 +3518,7 @@ return retval; } -/* +/* %!test %! format short %! fd = tmpfile (); @@ -3528,7 +3528,7 @@ %! endfor %! endfor %! fclose (fd); -*/ +*/ static void init_format_state (void) diff -r 1473d0cf86d2 -r 12df7854fa7c src/procstream.h --- a/src/procstream.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/procstream.h Thu Jan 20 17:24:59 2011 -0500 @@ -104,7 +104,7 @@ // oprocstream : public procstreambase, public std::ostream { public: - + oprocstream (void) : std::ostream (0), procstreambase () { } oprocstream (const std::string& name, int mode = std::ios::out) diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-arg-list.cc --- a/src/pt-arg-list.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-arg-list.cc Thu Jan 20 17:24:59 2011 -0500 @@ -168,7 +168,7 @@ && object && ! (object->is_function () || object->is_function_handle ())); - + unwind_protect frame; if (stash_object) diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-assign.h --- a/src/pt-assign.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-assign.h Thu Jan 20 17:24:59 2011 -0500 @@ -146,7 +146,7 @@ symbol_table::context_id context) const; void accept (tree_walker& tw); - + octave_value::assign_op op_type (void) const { return octave_value::op_asn_eq; } private: diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-binop.cc --- a/src/pt-binop.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-binop.cc Thu Jan 20 17:24:59 2011 -0500 @@ -38,7 +38,7 @@ static bool Vdo_braindead_shortcircuit_evaluation; // Binary expressions. - + octave_value_list tree_binary_expression::rvalue (int nargout) { @@ -158,7 +158,7 @@ } // Boolean expressions. - + octave_value_list tree_boolean_expression::rvalue (int nargout) { diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-bp.cc --- a/src/pt-bp.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-bp.cc Thu Jan 20 17:24:59 2011 -0500 @@ -237,7 +237,7 @@ take_action (*t); if (! found) - { + { tree_statement_list *stmt_lst = t->commands (); if (stmt_lst) diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-bp.h --- a/src/pt-bp.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-bp.h Thu Jan 20 17:24:59 2011 -0500 @@ -62,7 +62,7 @@ void visit_decl_elt (tree_decl_elt&); - void visit_decl_init_list (tree_decl_init_list&); + void visit_decl_init_list (tree_decl_init_list&); void visit_while_command (tree_while_command&); @@ -133,7 +133,7 @@ void visit_unwind_protect_command (tree_unwind_protect_command&); octave_value_list get_list (void) { return bp_list; } - + int get_line (void) { return line; } private: diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-cbinop.cc --- a/src/pt-cbinop.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-cbinop.cc Thu Jan 20 17:24:59 2011 -0500 @@ -35,12 +35,12 @@ // If a tree expression is a transpose or hermitian transpose, return // the argument and corresponding operator. -static octave_value::unary_op +static octave_value::unary_op strip_trans_herm (tree_expression *&exp) { if (exp->is_unary_expression ()) { - tree_unary_expression *uexp = + tree_unary_expression *uexp = dynamic_cast (exp); octave_value::unary_op op = uexp->op_type (); @@ -57,12 +57,12 @@ return octave_value::unknown_unary_op; } -static octave_value::unary_op +static octave_value::unary_op strip_not (tree_expression *&exp) { if (exp->is_unary_expression ()) { - tree_unary_expression *uexp = + tree_unary_expression *uexp = dynamic_cast (exp); octave_value::unary_op op = uexp->op_type (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-cell.cc --- a/src/pt-cell.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-cell.cc Thu Jan 20 17:24:59 2011 -0500 @@ -56,7 +56,7 @@ tree_argument_list *elt = *p; octave_value_list row = elt->convert_to_const_vector (); - + if (nr == 1) // Optimize the single row case. val = row.cell_value (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-colon.cc --- a/src/pt-colon.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-colon.cc Thu Jan 20 17:24:59 2011 -0500 @@ -112,7 +112,7 @@ { octave_value retval; - if (ov_base.is_object () || ov_limit.is_object () || + if (ov_base.is_object () || ov_limit.is_object () || ov_increment.is_object ()) { octave_value_list tmp1; @@ -125,7 +125,7 @@ if (fcn.is_defined ()) { octave_value_list tmp2 = fcn.do_multi_index_op (1, tmp1); - + if (! error_state) retval = tmp2 (0); } @@ -211,7 +211,7 @@ if (fcn.is_defined ()) { octave_value_list tmp2 = fcn.do_multi_index_op (1, tmp1); - + if (! error_state) retval = tmp2 (0); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-const.cc --- a/src/pt-const.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-const.cc Thu Jan 20 17:24:59 2011 -0500 @@ -48,7 +48,7 @@ void tree_constant::print_raw (std::ostream& os, bool pr_as_read_syntax, - bool pr_orig_text) + bool pr_orig_text) { if (pr_orig_text && ! orig_text.empty ()) os << orig_text; diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-decl.cc --- a/src/pt-decl.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-decl.cc Thu Jan 20 17:24:59 2011 -0500 @@ -95,7 +95,7 @@ new_dil->append (elt ? elt->dup (scope, context) : 0); } - + return new_dil; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-eval.cc --- a/src/pt-eval.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-eval.cc Thu Jan 20 17:24:59 2011 -0500 @@ -868,7 +868,7 @@ tree_evaluator::visit_try_catch_command (tree_try_catch_command& cmd) { unwind_protect frame; - + frame.protect_var (buffer_error_messages); frame.protect_var (Vdebug_on_error); frame.protect_var (Vdebug_on_warning); @@ -925,7 +925,7 @@ // We want to preserve the last statement indicator for possible // backtracking. - frame.add_fcn (octave_call_stack::set_statement, + frame.add_fcn (octave_call_stack::set_statement, octave_call_stack::current_statement ()); // Similarly, if we have seen a return or break statement, allow all diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-fcn-handle.cc --- a/src/pt-fcn-handle.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-fcn-handle.cc Thu Jan 20 17:24:59 2011 -0500 @@ -44,7 +44,7 @@ void tree_fcn_handle::print_raw (std::ostream& os, bool pr_as_read_syntax, - bool pr_orig_text) + bool pr_orig_text) { os << ((pr_as_read_syntax || pr_orig_text) ? "@" : "") << nm; } @@ -122,7 +122,7 @@ if (parent_scope < 0) parent_scope = curr_fcn->scope (); - + uf->stash_parent_fcn_scope (parent_scope); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-id.h --- a/src/pt-id.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-id.h Thu Jan 20 17:24:59 2011 -0500 @@ -72,7 +72,7 @@ // Try to find a definition for an identifier. Here's how: // // * If the identifier is already defined and is a function defined - // in an function file that has been modified since the last time + // in an function file that has been modified since the last time // we parsed it, parse it again. // // * If the identifier is not defined, try to find a builtin diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-idx.cc --- a/src/pt-idx.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-idx.cc Thu Jan 20 17:24:59 2011 -0500 @@ -127,7 +127,7 @@ if (elt && elt->has_magic_end ()) return true; } - + return false; } @@ -361,7 +361,7 @@ tmp = tmp_list.length () ? tmp_list(0) : octave_value (); tmpi = i; idx.clear (); - + if (tmp.is_cs_list ()) gripe_indexed_cs_list (); @@ -498,7 +498,7 @@ else tmp = Cell (); } - else if (tmp.is_zero_by_zero () + else if (tmp.is_zero_by_zero () && (tmp.is_matrix_type () || tmp.is_string ())) { tmp = Cell (); @@ -521,7 +521,7 @@ if (error_state) break; - bool autoconv = (tmp.is_zero_by_zero () + bool autoconv = (tmp.is_zero_by_zero () && (tmp.is_matrix_type () || tmp.is_string () || tmp.is_cell ())); @@ -638,7 +638,7 @@ } new_idx_expr->args = new_args; - + new_idx_expr->type = type; new_idx_expr->arg_nm = arg_nm; @@ -657,7 +657,7 @@ new_idx_expr->dyn_field = new_dyn_field; new_idx_expr->copy_base (*this); - + return new_idx_expr; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-idx.h --- a/src/pt-idx.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-idx.h Thu Jan 20 17:24:59 2011 -0500 @@ -119,7 +119,7 @@ std::string get_struct_index (std::list::const_iterator p_arg_nm, - std::list::const_iterator p_dyn_field) const; + std::list::const_iterator p_dyn_field) const; // No copying! diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-mat.cc --- a/src/pt-mat.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-mat.cc Thu Jan 20 17:24:59 2011 -0500 @@ -256,11 +256,11 @@ retval = c1; } - return retval; + return retval; } static void -eval_error (const char *msg, int l, int c, +eval_error (const char *msg, int l, int c, const dim_vector& x, const dim_vector& y) { if (l == -1 && c == -1) @@ -269,7 +269,7 @@ } else { - ::error ("%s (%s vs %s) near line %d, column %d", msg, + ::error ("%s (%s vs %s) near line %d, column %d", msg, x.str ().c_str (), y.str ().c_str (), l, c); } } @@ -545,7 +545,7 @@ dv = this_elt_dv; } - else if (all_str && dv.length () == 2 + else if (all_str && dv.length () == 2 && this_elt_dv.length () == 2) { // FIXME: this is Octave's specialty. Character matrices allow @@ -556,7 +556,7 @@ } else if (! dv.hvcat (this_elt_dv, 0)) { - eval_error ("vertical dimensions mismatch", -1, -1, + eval_error ("vertical dimensions mismatch", -1, -1, dv, this_elt_dv); return; } @@ -630,7 +630,7 @@ } template -static void +static void single_type_concat (Array& result, tm_const& tmp) { @@ -674,7 +674,7 @@ } template -static void +static void single_type_concat (Array& result, const dim_vector& dv, tm_const& tmp) @@ -728,7 +728,7 @@ } template -static void +static void single_type_concat (Sparse& result, const dim_vector& dv, tm_const& tmp) @@ -769,7 +769,7 @@ } template -static void +static void single_type_concat (octave_map& result, const dim_vector& dv, tm_const& tmp) @@ -807,7 +807,7 @@ } template -static octave_value +static octave_value do_single_type_concat (const dim_vector& dv, tm_const& tmp) { @@ -819,7 +819,7 @@ } template<> -octave_value +octave_value do_single_type_concat (const dim_vector& dv, tm_const& tmp) { @@ -885,18 +885,18 @@ octave_value_list tmp1 (row.length (), octave_value ()); int i = 0; - for (tm_row_const::iterator q = row.begin (); + for (tm_row_const::iterator q = row.begin (); q != row.end (); q++) tmp1 (i++) = *q; octave_value_list tmp2; - octave_value fcn = + octave_value fcn = symbol_table::find_function ("horzcat", tmp1); if (fcn.is_defined ()) { tmp2 = fcn.do_multi_index_op (1, tmp1); - + if (error_state) goto done; @@ -920,7 +920,7 @@ if (fcn.is_defined ()) { tmp2 = fcn.do_multi_index_op (1, tmp3); - + if (! error_state) retval = tmp2 (0); } @@ -931,7 +931,7 @@ else if (result_type == "double") { if (any_sparse_p) - { + { if (all_real_p) retval = do_single_type_concat (dv, tmp); else @@ -1019,9 +1019,9 @@ // Start with sparse matrix to avoid issues memory issues // with things like [ones(1,4),sprandn(1e8,4,1e-4)] if (all_real_p) - ctmp = octave_sparse_matrix ().resize (dv); + ctmp = octave_sparse_matrix ().resize (dv); else - ctmp = octave_sparse_complex_matrix ().resize (dv); + ctmp = octave_sparse_complex_matrix ().resize (dv); } else { @@ -1031,7 +1031,7 @@ tm_row_const row = *p; - for (tm_row_const::iterator q = row.begin (); + for (tm_row_const::iterator q = row.begin (); q != row.end (); q++) { octave_quit (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-mat.h --- a/src/pt-mat.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-mat.h Thu Jan 20 17:24:59 2011 -0500 @@ -80,13 +80,13 @@ // The character to fill with when creating string arrays. extern char Vstring_fill_char; -extern std::string +extern std::string get_concat_class (const std::string& c1, const std::string& c2); extern void maybe_warn_string_concat (bool all_dq_strings_p, bool all_sq_strings_p); -extern std::string +extern std::string get_concat_class (const std::string& c1, const std::string& c2); extern void diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-pr-code.cc --- a/src/pt-pr-code.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-pr-code.cc Thu Jan 20 17:24:59 2011 -0500 @@ -570,7 +570,7 @@ os << ")"; } break; - + case '{': { char nc = nesting.top (); @@ -590,7 +590,7 @@ os << "}"; } break; - + case '.': { string_vector nm = *p_arg_names; diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-select.cc --- a/src/pt-select.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-select.cc Thu Jan 20 17:24:59 2011 -0500 @@ -185,7 +185,7 @@ new_scl->append (elt ? elt->dup (scope, context) : 0); } - + return new_scl; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-select.h --- a/src/pt-select.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-select.h Thu Jan 20 17:24:59 2011 -0500 @@ -258,7 +258,7 @@ trail_comm (0) { } tree_switch_command (tree_expression *e, tree_switch_case_list *lst, - octave_comment_list *lc, octave_comment_list *tc, + octave_comment_list *lc, octave_comment_list *tc, int l = -1, int c = -1) : tree_command (l, c), expr (e), list (lst), lead_comm (lc), trail_comm (tc) { } diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-stmt.cc --- a/src/pt-stmt.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-stmt.cc Thu Jan 20 17:24:59 2011 -0500 @@ -156,7 +156,7 @@ { tree_breakpoint tbp (line, tree_breakpoint::set); accept (tbp); - + return tbp.get_line (); } @@ -177,7 +177,7 @@ } else { - tree_breakpoint tbp (line, tree_breakpoint::clear); + tree_breakpoint tbp (line, tree_breakpoint::clear); accept (tbp); } } diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-unop.cc --- a/src/pt-unop.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-unop.cc Thu Jan 20 17:24:59 2011 -0500 @@ -84,7 +84,7 @@ if (! error_state && val.is_defined ()) { - // Attempt to do the operation in-place if it is unshared + // Attempt to do the operation in-place if it is unshared // (a temporary expression). if (val.get_count () == 1) retval = val.do_non_const_unary_op (etype); diff -r 1473d0cf86d2 -r 12df7854fa7c src/pt-unop.h --- a/src/pt-unop.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/pt-unop.h Thu Jan 20 17:24:59 2011 -0500 @@ -60,7 +60,7 @@ tree_expression *operand (void) { return op; } std::string oper (void) const; - + octave_value::unary_op op_type (void) const { return etype; } protected: diff -r 1473d0cf86d2 -r 12df7854fa7c src/sighandlers.cc --- a/src/sighandlers.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/sighandlers.cc Thu Jan 20 17:24:59 2011 -0500 @@ -405,8 +405,8 @@ switch(sig) { - case CTRL_BREAK_EVENT: - sig_name = "Ctrl-Break"; + case CTRL_BREAK_EVENT: + sig_name = "Ctrl-Break"; break; case CTRL_C_EVENT: sig_name = "Ctrl-C"; @@ -443,7 +443,7 @@ break; } - // Return TRUE if the event was handled, or FALSE if another handler + // Return TRUE if the event was handled, or FALSE if another handler // should be called. // FIXME check that windows terminates the thread. return TRUE; @@ -467,7 +467,7 @@ #ifdef USE_W32_SIGINT // Intercept windows console control events. - // Note that the windows console signal handlers chain, so if + // Note that the windows console signal handlers chain, so if // install_signal_handlers is called more than once in the same program, // then first call the following to avoid duplicates: // diff -r 1473d0cf86d2 -r 12df7854fa7c src/sighandlers.h --- a/src/sighandlers.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/sighandlers.h Thu Jan 20 17:24:59 2011 -0500 @@ -90,7 +90,7 @@ octave_child { public: - + // Do whatever to handle event for child with PID (might not // actually be dead, could just be stopped). Return true if // the list element corresponding to PID should be removed from @@ -105,7 +105,7 @@ octave_child (const octave_child& oc) : pid (oc.pid), handler (oc.handler), have_status (oc.have_status), status (oc.status) { } - + octave_child& operator = (const octave_child& oc) { if (&oc != this) diff -r 1473d0cf86d2 -r 12df7854fa7c src/sparse-xdiv.cc --- a/src/sparse-xdiv.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/sparse-xdiv.cc Thu Jan 20 17:24:59 2011 -0500 @@ -143,7 +143,7 @@ octave_idx_type info; double rcond = 0.0; - Matrix result = btmp.solve (btyp, atmp, info, rcond, + Matrix result = btmp.solve (btyp, atmp, info, rcond, solve_singularity_warning); typ = btyp.transpose (); @@ -223,7 +223,7 @@ octave_idx_type info; double rcond = 0.0; - SparseMatrix result = btmp.solve (btyp, atmp, info, rcond, + SparseMatrix result = btmp.solve (btyp, atmp, info, rcond, solve_singularity_warning); typ = btyp.transpose (); @@ -546,7 +546,7 @@ // -*- 8 -*- SparseComplexMatrix -xleftdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, +xleftdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, MatrixType &typ) { if (! mx_leftdiv_conform (a, b)) diff -r 1473d0cf86d2 -r 12df7854fa7c src/sparse-xdiv.h --- a/src/sparse-xdiv.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/sparse-xdiv.h Thu Jan 20 17:24:59 2011 -0500 @@ -37,57 +37,57 @@ MatrixType &typ); extern ComplexMatrix xdiv (const ComplexMatrix& a, const SparseMatrix& b, MatrixType &typ); -extern ComplexMatrix xdiv (const ComplexMatrix& a, +extern ComplexMatrix xdiv (const ComplexMatrix& a, const SparseComplexMatrix& b, MatrixType &typ); extern SparseMatrix xdiv (const SparseMatrix& a, const SparseMatrix& b, MatrixType &typ); -extern SparseComplexMatrix xdiv (const SparseMatrix& a, +extern SparseComplexMatrix xdiv (const SparseMatrix& a, const SparseComplexMatrix& b, MatrixType &typ); -extern SparseComplexMatrix xdiv (const SparseComplexMatrix& a, +extern SparseComplexMatrix xdiv (const SparseComplexMatrix& a, const SparseMatrix& b, MatrixType &typ); -extern SparseComplexMatrix xdiv (const SparseComplexMatrix& a, +extern SparseComplexMatrix xdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, MatrixType &typ); -extern SparseMatrix xdiv (const SparseMatrix& a, +extern SparseMatrix xdiv (const SparseMatrix& a, const DiagMatrix& b, MatrixType &typ); -extern SparseComplexMatrix xdiv (const SparseMatrix& a, +extern SparseComplexMatrix xdiv (const SparseMatrix& a, const ComplexDiagMatrix& b, MatrixType &typ); -extern SparseComplexMatrix xdiv (const SparseComplexMatrix& a, +extern SparseComplexMatrix xdiv (const SparseComplexMatrix& a, const DiagMatrix& b, MatrixType &typ); -extern SparseComplexMatrix xdiv (const SparseComplexMatrix& a, +extern SparseComplexMatrix xdiv (const SparseComplexMatrix& a, const ComplexDiagMatrix& b, MatrixType &typ); extern Matrix x_el_div (double a, const SparseMatrix& b); extern ComplexMatrix x_el_div (double a, const SparseComplexMatrix& b); extern ComplexMatrix x_el_div (const Complex a, const SparseMatrix& b); -extern ComplexMatrix x_el_div (const Complex a, +extern ComplexMatrix x_el_div (const Complex a, const SparseComplexMatrix& b); -extern Matrix xleftdiv (const SparseMatrix& a, const Matrix& b, +extern Matrix xleftdiv (const SparseMatrix& a, const Matrix& b, MatrixType& typ); extern ComplexMatrix xleftdiv (const SparseMatrix& a, const ComplexMatrix& b, MatrixType &typ); extern ComplexMatrix xleftdiv (const SparseComplexMatrix& a, const Matrix& b, MatrixType &typ); -extern ComplexMatrix xleftdiv (const SparseComplexMatrix& a, +extern ComplexMatrix xleftdiv (const SparseComplexMatrix& a, const ComplexMatrix& b, MatrixType &typ); extern SparseMatrix xleftdiv (const SparseMatrix& a, const SparseMatrix& b, MatrixType &typ); -extern SparseComplexMatrix xleftdiv (const SparseMatrix& a, +extern SparseComplexMatrix xleftdiv (const SparseMatrix& a, const SparseComplexMatrix& b, MatrixType &typ); -extern SparseComplexMatrix xleftdiv (const SparseComplexMatrix& a, +extern SparseComplexMatrix xleftdiv (const SparseComplexMatrix& a, const SparseMatrix& b, MatrixType &typ); -extern SparseComplexMatrix xleftdiv (const SparseComplexMatrix& a, +extern SparseComplexMatrix xleftdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, MatrixType &typ); extern SparseMatrix xleftdiv (const DiagMatrix&, const SparseMatrix&, MatrixType&); -extern SparseComplexMatrix xleftdiv (const ComplexDiagMatrix&, const SparseMatrix&, +extern SparseComplexMatrix xleftdiv (const ComplexDiagMatrix&, const SparseMatrix&, MatrixType&); -extern SparseComplexMatrix xleftdiv (const DiagMatrix&, const SparseComplexMatrix&, +extern SparseComplexMatrix xleftdiv (const DiagMatrix&, const SparseComplexMatrix&, MatrixType&); -extern SparseComplexMatrix xleftdiv (const ComplexDiagMatrix&, const SparseComplexMatrix&, +extern SparseComplexMatrix xleftdiv (const ComplexDiagMatrix&, const SparseComplexMatrix&, MatrixType&); #endif diff -r 1473d0cf86d2 -r 12df7854fa7c src/sparse-xpow.cc --- a/src/sparse-xpow.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/sparse-xpow.cc Thu Jan 20 17:24:59 2011 -0500 @@ -301,7 +301,7 @@ octave_value elem_xpow (const SparseMatrix& a, double b) { - // FIXME What should a .^ 0 give?? Matlab gives a + // FIXME What should a .^ 0 give?? Matlab gives a // sparse matrix with same structure as a, which is strictly // incorrect. Keep compatiability. @@ -326,9 +326,9 @@ for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { octave_quit (); - + Complex atmp (a.data (i)); - + result (a.ridx(i), j) = std::pow (atmp, btmp); } @@ -452,7 +452,7 @@ for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { octave_quit (); - result.xelem(a.ridx(i), j) = std::pow (a.data(i), + result.xelem(a.ridx(i), j) = std::pow (a.data(i), b (a.ridx(i), j)); } } @@ -476,13 +476,13 @@ { octave_idx_type nz = a.nnz (); SparseComplexMatrix result (a); - + for (octave_idx_type i = 0; i < nz; i++) { octave_quit (); result.data (i) = std::pow (Complex (a.data (i)), b); } - + result.maybe_compress (true); retval = result; @@ -584,7 +584,7 @@ for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { octave_quit (); - result (a.ridx(i), j) = + result (a.ridx(i), j) = std::pow (a.data (i), static_cast (b)); } } @@ -596,7 +596,7 @@ octave_quit (); result (a.ridx(i), j) = std::pow (a.data (i), b); } - } + } retval = result; } @@ -605,7 +605,7 @@ octave_idx_type nz = a.nnz (); SparseComplexMatrix result (a); - + if (xisint (b)) { for (octave_idx_type i = 0; i < nz; i++) @@ -621,7 +621,7 @@ octave_quit (); result.data (i) = std::pow (a.data (i), b); } - } + } result.maybe_compress (true); @@ -657,7 +657,7 @@ Complex tmp; if (xisint (btmp)) - result.xelem(a.ridx(i), j) = std::pow (a.data (i), + result.xelem(a.ridx(i), j) = std::pow (a.data (i), static_cast (btmp)); else result.xelem(a.ridx(i), j) = std::pow (a.data (i), btmp); @@ -692,7 +692,7 @@ } result.maybe_compress (true); - + retval = result; } @@ -716,7 +716,7 @@ } SparseComplexMatrix result (nr, nc, Complex(1.0, 0.0)); - for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { diff -r 1473d0cf86d2 -r 12df7854fa7c src/sparse-xpow.h --- a/src/sparse-xpow.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/sparse-xpow.h Thu Jan 20 17:24:59 2011 -0500 @@ -39,19 +39,19 @@ extern octave_value elem_xpow (const SparseMatrix& a, double b); extern octave_value elem_xpow (const SparseMatrix& a, const SparseMatrix& b); extern octave_value elem_xpow (const SparseMatrix& a, const Complex& b); -extern octave_value elem_xpow (const SparseMatrix& a, +extern octave_value elem_xpow (const SparseMatrix& a, const SparseComplexMatrix& b); extern octave_value elem_xpow (const Complex& a, const SparseMatrix& b); -extern octave_value elem_xpow (const Complex& a, +extern octave_value elem_xpow (const Complex& a, const SparseComplexMatrix& b); extern octave_value elem_xpow (const SparseComplexMatrix& a, double b); -extern octave_value elem_xpow (const SparseComplexMatrix& a, +extern octave_value elem_xpow (const SparseComplexMatrix& a, const SparseMatrix& b); -extern octave_value elem_xpow (const SparseComplexMatrix& a, +extern octave_value elem_xpow (const SparseComplexMatrix& a, const Complex& b); -extern octave_value elem_xpow (const SparseComplexMatrix& a, +extern octave_value elem_xpow (const SparseComplexMatrix& a, const SparseComplexMatrix& b); #endif diff -r 1473d0cf86d2 -r 12df7854fa7c src/sparse.cc --- a/src/sparse.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/sparse.cc Thu Jan 20 17:24:59 2011 -0500 @@ -46,14 +46,14 @@ @deftypefn {Loadable Function} {} issparse (@var{x})\n\ Return true if @var{x} is a sparse matrix.\n\ @seealso{ismatrix}\n\ -@end deftypefn") +@end deftypefn") { - if (args.length() != 1) + if (args.length() != 1) { print_usage (); return octave_value (); } - else + else return octave_value (args(0).is_sparse_type ()); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/strfns.cc --- a/src/strfns.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/strfns.cc Thu Jan 20 17:24:59 2011 -0500 @@ -529,14 +529,14 @@ } // If both args are arrays, dimensions may be significant. -static bool +static bool strcmp_array_op (const charNDArray& s1, const charNDArray& s2, octave_idx_type) { return (s1.dims () == s2.dims () && std::equal (s1.data (), s1.data () + s1.numel (), s2.data ())); } -// Otherwise, just use strings. +// Otherwise, just use strings. static bool strcmp_str_op (const std::string& s1, const std::string& s2, octave_idx_type) @@ -618,12 +618,12 @@ %!assert (all (strcmp (y, {'foo'}) == [false; false])); */ -// Apparently, Matlab ignores the dims with strncmp. It also -static bool +// Apparently, Matlab ignores the dims with strncmp. It also +static bool strncmp_array_op (const charNDArray& s1, const charNDArray& s2, octave_idx_type n) { octave_idx_type l1 = s1.numel (), l2 = s2.numel (); - return (n > 0 && n <= l1 && n <= l2 + return (n > 0 && n <= l1 && n <= l2 && std::equal (s1.data (), s1.data () + n, s2.data ())); } @@ -634,7 +634,7 @@ strncmp_str_op (const std::string& s1, const std::string& s2, octave_idx_type n) { octave_idx_type l1 = s1.length (), l2 = s2.length (); - return (n > 0 && n <= l1 && n <= l2 + return (n > 0 && n <= l1 && n <= l2 && std::equal (s1.data (), s1.data () + n, s2.data ())); } @@ -713,7 +713,7 @@ }; // strcmpi is equivalent to strcmp in that it checks all dims. -static bool +static bool strcmpi_array_op (const charNDArray& s1, const charNDArray& s2, octave_idx_type) { return (s1.dims () == s2.dims () @@ -769,11 +769,11 @@ */ // Like strncmp. -static bool +static bool strncmpi_array_op (const charNDArray& s1, const charNDArray& s2, octave_idx_type n) { octave_idx_type l1 = s1.numel (), l2 = s2.numel (); - return (n > 0 && n <= l1 && n <= l2 + return (n > 0 && n <= l1 && n <= l2 && std::equal (s1.data (), s1.data () + n, s2.data (), icmp_char_eq ())); } @@ -783,7 +783,7 @@ strncmpi_str_op (const std::string& s1, const std::string& s2, octave_idx_type n) { octave_idx_type l1 = s1.length (), l2 = s2.length (); - return (n > 0 && n <= l1 && n <= l2 + return (n > 0 && n <= l1 && n <= l2 && std::equal (s1.data (), s1.data () + n, s2.data (), icmp_char_eq ())); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/symtab.cc --- a/src/symtab.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/symtab.cc Thu Jan 20 17:24:59 2011 -0500 @@ -2,7 +2,7 @@ Copyright (C) 1993-2011 John W. Eaton Copyright (C) 2009 VZLU Prague, a.s. - + This file is part of Octave. Octave is free software; you can redistribute it and/or modify it @@ -111,7 +111,7 @@ if (rep->finfo) retval = rep->finfo->find (args); else - { + { retval = symbol_table::find_function (name (), args); if (retval.is_defined ()) @@ -300,7 +300,7 @@ clear_breakpoints = true; } - // If the function has been replaced then clear any + // If the function has been replaced then clear any // breakpoints associated with it if (clear_breakpoints) bp_table::remove_all_breakpoints_in_file (nm, true); @@ -413,7 +413,7 @@ { retval = find_method (*it); - if (retval.is_defined ()) + if (retval.is_defined ()) { class_methods[dispatch_type] = retval; break; @@ -453,7 +453,7 @@ for (dispatch_map_const_iterator p = dispatch_map.begin (); p != dispatch_map.end (); p++) - os << " " << name << " (" << p->first << ", ...) -> " + os << " " << name << " (" << p->first << ", ...) -> " << p->second << " (" << p->first << ", ...)\n"; os << std::endl; @@ -490,10 +490,10 @@ builtin_type_t ityp = static_cast (i); builtin_type_t jtyp = static_cast (j); // FIXME: Is this really right? - bool use_j = + bool use_j = (jtyp == btyp_func_handle || ityp == btyp_bool - || (btyp_isarray (ityp) - && (! btyp_isarray (jtyp) + || (btyp_isarray (ityp) + && (! btyp_isarray (jtyp) || (btyp_isinteger (jtyp) && ! btyp_isinteger (ityp)) || ((ityp == btyp_double || ityp == btyp_complex || ityp == btyp_char) && (jtyp == btyp_float || jtyp == btyp_float_complex))))); @@ -505,7 +505,7 @@ } std::string -get_dispatch_type (const octave_value_list& args, +get_dispatch_type (const octave_value_list& args, builtin_type_t& builtin_type) { static builtin_type_t (*sup_table)[btyp_num_types] = build_sup_table (); @@ -728,7 +728,7 @@ return fcn; } - // Legacy dispatch. + // Legacy dispatch. if (! args.empty () && ! dispatch_map.empty ()) { @@ -1133,8 +1133,8 @@ } octave_value -symbol_table::find (const std::string& name, - const octave_value_list& args, +symbol_table::find (const std::string& name, + const octave_value_list& args, bool skip_variables, bool local_funcs) { @@ -1163,11 +1163,11 @@ if (! name.empty () && name[0] == '@') { // Look for a class specific function. - std::string dispatch_type = + std::string dispatch_type = name.substr (1, name.find_first_of (file_ops::dir_sep_str ()) - 1); - std::string method = - name.substr (name.find_last_of (file_ops::dir_sep_str ()) + 1, + std::string method = + name.substr (name.find_last_of (file_ops::dir_sep_str ()) + 1, std::string::npos); retval = find_method (method, dispatch_type); @@ -1304,7 +1304,7 @@ } octave_value -symbol_table::do_find (const std::string& name, +symbol_table::do_find (const std::string& name, const octave_value_list& args, bool skip_variables, bool local_funcs) @@ -1426,8 +1426,8 @@ // Clear global variables. global_table.clear (); - // Delete all possibly remaining scopes. - for (all_instances_iterator iter = all_instances.begin (); + // Delete all possibly remaining scopes. + for (all_instances_iterator iter = all_instances.begin (); iter != all_instances.end (); iter++) { scope_id scope = iter->first; diff -r 1473d0cf86d2 -r 12df7854fa7c src/symtab.h --- a/src/symtab.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/symtab.h Thu Jan 20 17:24:59 2011 -0500 @@ -2,7 +2,7 @@ Copyright (C) 1993-2011 John W. Eaton Copyright (C) 2009 VZLU Prague - + This file is part of Octave. Octave is free software; you can redistribute it and/or modify it @@ -397,7 +397,7 @@ symbol_record (const symbol_record& sr) : rep (sr.rep) - { + { rep->count++; } @@ -530,7 +530,7 @@ fcn_info_rep (const std::string& nm) : name (nm), subfunctions (), private_functions (), class_constructors (), class_methods (), dispatch_map (), - cmdline_function (), autoload_function (), function_on_path (), + cmdline_function (), autoload_function (), function_on_path (), built_in_function (), count (1) { } octave_value load_private_function (const std::string& dir_name); @@ -583,7 +583,7 @@ return p == subfunctions.end () ? std::pair () : std::pair (name, p->second); - } + } void erase_subfunction (scope_id scope) { @@ -739,7 +739,7 @@ : rep (new fcn_info_rep (nm)) { } fcn_info (const fcn_info& fi) : rep (fi.rep) - { + { rep->count++; } @@ -819,7 +819,7 @@ subfunction_defined_in_scope (scope_id scope = xcurrent_scope) const { return rep->subfunction_defined_in_scope (scope); - } + } void erase_subfunction (scope_id scope) { @@ -855,9 +855,9 @@ void clear (void) { rep->clear (); } void clear_user_function (void) { rep->clear_user_function (); } - + void clear_autoload_function (void) { rep->clear_autoload_function (); } - + void clear_mex_function (void) { rep->clear_mex_function (); } void add_dispatch (const std::string& type, const std::string& fname) @@ -1039,7 +1039,7 @@ // Find a value corresponding to the given name in the table. static octave_value - find (const std::string& name, + find (const std::string& name, const octave_value_list& args = octave_value_list (), bool skip_variables = false, bool local_funcs = true); @@ -1192,7 +1192,7 @@ } static octave_value - find_function (const std::string& name, + find_function (const std::string& name, const octave_value_list& args = octave_value_list (), bool local_funcs = true); @@ -1297,7 +1297,7 @@ static void clear_all (void) { clear_variables (); - + clear_global_pattern ("*"); clear_functions (); @@ -1454,7 +1454,7 @@ const std::string& inf_class); static bool is_superiorto (const std::string& a, const std::string& b); - + static void alias_built_in_function (const std::string& alias, const std::string& name) { @@ -1701,7 +1701,7 @@ return retval; } - static std::list regexp_variables + static std::list regexp_variables (const string_vector& patterns) { std::list retval; @@ -1824,14 +1824,14 @@ for (fcn_table_iterator p = fcn_table.begin (); p != fcn_table.end (); p++) p->second.lock_subfunction (scope); - } + } static void unlock_subfunctions (scope_id scope = xcurrent_scope) { for (fcn_table_iterator p = fcn_table.begin (); p != fcn_table.end (); p++) p->second.unlock_subfunction (scope); - } + } static void free_scope (scope_id scope) { @@ -1875,7 +1875,7 @@ assert (scope != xtop_scope && scope != xglobal_scope); symbol_table *inst = get_instance (scope); // FIXME: normally, functions should not usurp each other's scope. - // If for any incredible reason this is needed, call + // If for any incredible reason this is needed, call // set_user_function (0, scope) first. assert (inst->curr_fcn == 0 || curr_fcn == 0); inst->curr_fcn = curr_fcn; @@ -2230,7 +2230,7 @@ } - for (global_table_iterator q = global_table.begin (); + for (global_table_iterator q = global_table.begin (); q != global_table.end ();) { if (pattern.match (q->first)) diff -r 1473d0cf86d2 -r 12df7854fa7c src/syscalls.cc --- a/src/syscalls.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/syscalls.cc Thu Jan 20 17:24:59 2011 -0500 @@ -1266,7 +1266,7 @@ int status = octave_unlink (name, msg); retval(0) = status; - retval(1) = msg; + retval(1) = msg; } else error ("unlink: file name must be a string"); @@ -1333,7 +1333,7 @@ if (nargin == 1 || nargin == 2) { pid_t pid = args(0).int_value (true); - + if (! error_state) { int options = 0; diff -r 1473d0cf86d2 -r 12df7854fa7c src/sysdep.cc --- a/src/sysdep.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/sysdep.cc Thu Jan 20 17:24:59 2011 -0500 @@ -42,7 +42,7 @@ #include #elif defined (HAVE_SGTTY_H) #include -#endif +#endif #if defined (HAVE_CONIO_H) #include @@ -171,7 +171,7 @@ MSVC_init (void) { w32_set_octave_home (); - + // Init mutex to protect setjmp/longjmp and get main thread context w32_sigint_init (); @@ -189,11 +189,11 @@ bool retval = false; - // Windows native code + // Windows native code // Reference: http://msdn2.microsoft.com/en-us/library/aa363788.aspx HANDLE hfile1 = CreateFile (file1.c_str (), 0, FILE_SHARE_READ, 0, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hfile1 != INVALID_HANDLE_VALUE) { @@ -201,13 +201,13 @@ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (hfile2 != INVALID_HANDLE_VALUE) - { + { BY_HANDLE_FILE_INFORMATION hfi1; BY_HANDLE_FILE_INFORMATION hfi2; - + if (GetFileInformationByHandle (hfile1, &hfi1) && GetFileInformationByHandle (hfile2, &hfi2)) - + retval = (hfi1.dwVolumeSerialNumber == hfi2.dwVolumeSerialNumber && hfi1.nFileIndexHigh == hfi2.nFileIndexHigh && hfi1.nFileIndexLow == hfi2.nFileIndexLow); @@ -255,9 +255,9 @@ // Set terminal in raw mode. From less-177. // // Change terminal to "raw mode", or restore to "normal" mode. -// "Raw mode" means +// "Raw mode" means // 1. An outstanding read will complete on receipt of a single keystroke. -// 2. Input is not echoed. +// 2. Input is not echoed. // 3. On output, \n is mapped to \r\n. // 4. \t is NOT expanded into spaces. // 5. Signal-causing characters such as ctrl-C (interrupt), @@ -313,7 +313,7 @@ #endif s.c_cc[VMIN] = wait ? 1 : 0; s.c_cc[VTIME] = 0; - } + } else { // Restore saved modes. @@ -355,7 +355,7 @@ s.c_oflag &= ~(ONLRET); #endif s.c_cc[VMIN] = wait ? 1 : 0; - } + } else { // Restore saved modes. @@ -387,7 +387,7 @@ s.sg_flags |= CBREAK; s.sg_flags &= ~(ECHO); - } + } else { // Restore saved modes. @@ -457,7 +457,7 @@ octave_set_interrupt_handler (saved_interrupt_handler, false); int c = std::cin.get (); - + if (std::cin.fail () || std::cin.eof ()) std::cin.clear (); @@ -527,12 +527,12 @@ if (nargin == 2 || nargin == 1) { - std::string var = args(0).string_value (); + std::string var = args(0).string_value (); if (! error_state) { std::string val = (nargin == 2 - ? args(1).string_value () : std::string ()); + ? args(1).string_value () : std::string ()); if (! error_state) octave_env::putenv (var, val); diff -r 1473d0cf86d2 -r 12df7854fa7c src/toplev.cc --- a/src/toplev.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/toplev.cc Thu Jan 20 17:24:59 2011 -0500 @@ -605,7 +605,7 @@ else { if (octave_completion_matches_called) - octave_completion_matches_called = false; + octave_completion_matches_called = false; else command_editor::increment_current_command_number (); } @@ -801,7 +801,7 @@ cmd->clear (); if (wait_for_input (fid) != 1) - break; + break; } else break; @@ -939,7 +939,7 @@ #ifdef HAVE_FORK pid_t pid = fork (); - if (pid < 0) + if (pid < 0) error ("system: fork failed -- can't create child process"); else if (pid == 0) { diff -r 1473d0cf86d2 -r 12df7854fa7c src/toplev.h --- a/src/toplev.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/toplev.h Thu Jan 20 17:24:59 2011 -0500 @@ -207,7 +207,7 @@ { return instance_ok () ? instance->do_element (n) : 0; } - + // First user-defined function on the stack. static octave_user_code *caller_user_code (size_t nskip = 0) { @@ -278,7 +278,7 @@ if (instance_ok ()) instance->do_pop (); } - + static void clear (void) { if (instance_ok ()) @@ -344,7 +344,7 @@ return retval; } - octave_user_code *do_caller_user_code (size_t nskip) const; + octave_user_code *do_caller_user_code (size_t nskip) const; void do_push (octave_function *f, symbol_table::scope_id scope, symbol_table::context_id context) diff -r 1473d0cf86d2 -r 12df7854fa7c src/txt-eng-ft.cc --- a/src/txt-eng-ft.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/txt-eng-ft.cc Thu Jan 20 17:24:59 2011 -0500 @@ -174,7 +174,7 @@ if (! file.empty () && FT_New_Face (library, file.c_str (), 0, &retval)) ::warning ("ft_manager: unable to load font: %s", file.c_str ()); - + return retval; } diff -r 1473d0cf86d2 -r 12df7854fa7c src/txt-eng-ft.h --- a/src/txt-eng-ft.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/txt-eng-ft.h Thu Jan 20 17:24:59 2011 -0500 @@ -86,7 +86,7 @@ Matrix bbox; uint8NDArray pixels; int xoffset; - int yoffset; + int yoffset; int mode; uint8_t red, green, blue; }; diff -r 1473d0cf86d2 -r 12df7854fa7c src/txt-eng.h --- a/src/txt-eng.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/txt-eng.h Thu Jan 20 17:24:59 2011 -0500 @@ -133,10 +133,10 @@ (*it)->accept (*this); } } - + virtual void visit (text_subscript_element& e) { visit (dynamic_cast (e)); } - + virtual void visit (text_superscript_element& e) { visit (dynamic_cast (e)); } @@ -145,7 +145,7 @@ protected: text_processor (void) { } - virtual ~text_processor (void) { } + virtual ~text_processor (void) { } }; #define TEXT_ELEMENT_ACCEPT(cls) \ diff -r 1473d0cf86d2 -r 12df7854fa7c src/unwind-prot.h --- a/src/unwind-prot.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/unwind-prot.h Thu Jan 20 17:24:59 2011 -0500 @@ -50,7 +50,7 @@ }; // An element that merely runs a void (*)(void) function. - + class fcn_elem : public elem { public: @@ -206,13 +206,13 @@ add (new restore_var_elem (var, val)); } - operator bool (void) const - { - return head != 0; + operator bool (void) const + { + return head != 0; } - void run_top (void) - { + void run_top (void) + { if (head) { // No leak on exception! @@ -222,8 +222,8 @@ } } - void run_top (int num) - { + void run_top (int num) + { while (num-- > 0) run_top (); } @@ -238,8 +238,8 @@ } } - void discard_top (int num) - { + void discard_top (int num) + { while (num-- > 0) discard_top (); } diff -r 1473d0cf86d2 -r 12df7854fa7c src/utils.cc --- a/src/utils.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/utils.cc Thu Jan 20 17:24:59 2011 -0500 @@ -270,7 +270,7 @@ for (octave_idx_type i = 0; i < len; i++) retval[i] = octave_env::make_absolute (sv[i]); - + return retval; } @@ -410,7 +410,7 @@ std::string retval; int len = name.length (); - + if (len > 0) { if (octave_env::absolute_pathname (name)) @@ -446,7 +446,7 @@ if (dir.length () > 0) { - std::string tcontents = file_ops::concat (load_path::find_dir (dir), + std::string tcontents = file_ops::concat (load_path::find_dir (dir), std::string ("Contents.m")); file_stat fs (tcontents); @@ -467,7 +467,7 @@ std::string retval; int len = name.length (); - + if (len > 0) { if (octave_env::absolute_pathname (name)) @@ -496,7 +496,7 @@ std::string retval; int len = name.length (); - + if (len > 0) { if (octave_env::absolute_pathname (name)) @@ -781,7 +781,7 @@ retval = octave_env::make_absolute (nm); else error ("make_absolute_filename: expecting argument to be a file name"); - } + } else print_usage (); @@ -1352,7 +1352,7 @@ octave_value_list do_simple_cellfun (octave_value_list (*fun) (const octave_value_list&, int), - const char *fun_name, const octave_value_list& args, + const char *fun_name, const octave_value_list& args, int nargout) { octave_value_list new_args = args, retval; @@ -1375,7 +1375,7 @@ cells[i] = arg.cell_value (); octave_idx_type n = ccells[i].numel (); if (n == 1) - { + { iscell[i] = false; new_args(i) = ccells[i](0); } @@ -1383,7 +1383,7 @@ { numel = n; dims = ccells[i].dims (); - } + } else if (dims != ccells[i].dims ()) { error ("%s: cell arguments must have matching sizes", fun_name); diff -r 1473d0cf86d2 -r 12df7854fa7c src/utils.h --- a/src/utils.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/utils.h Thu Jan 20 17:24:59 2011 -0500 @@ -123,7 +123,7 @@ extern OCTINTERP_API octave_value_list do_simple_cellfun (octave_value_list (*fun) (const octave_value_list&, int), - const char *fun_name, const octave_value_list& args, + const char *fun_name, const octave_value_list& args, int nargout); extern OCTINTERP_API diff -r 1473d0cf86d2 -r 12df7854fa7c src/variables.cc --- a/src/variables.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/variables.cc Thu Jan 20 17:24:59 2011 -0500 @@ -164,7 +164,7 @@ if (parse_status == 0) { retval = is_valid_function (fname, warn_for, 0); - + if (! retval) { error ("%s: `%s' is not valid as a function", @@ -971,7 +971,7 @@ if (param.command == 's' && param.modifier == 'c') { int a, b; - + if (param.modifier == 'c') { a = param.first_parameter_length - param.balance; @@ -1152,7 +1152,7 @@ case 't': os << varval.type_name (); break; - + default: error ("whos_line_format: command `%c' unknown", param.command); @@ -1539,11 +1539,11 @@ { if (argv[i] == "-file") { - // FIXME. This is an inefficient manner to implement this as the + // FIXME. This is an inefficient manner to implement this as the // variables are loaded in to a temporary context and then treated. // It would be better to refecat symbol_info_list to not store the // symbol records and then use it in load-save.cc (do_load) to - // implement this option there so that the variables are never + // implement this option there so that the variables are never // stored at all. if (i == argc - 1) error ("whos: -file argument must be followed by a file name"); @@ -1569,7 +1569,7 @@ if (! error_state) { - std::string newmsg = std::string ("Variables in the file ") + + std::string newmsg = std::string ("Variables in the file ") + nm + ":\n\n"; retval = do_who (i, argv, return_list, verbose, newmsg); @@ -1602,7 +1602,7 @@ pats.resize (++npats); pats[0] = "*"; } - + symbol_info_list symbol_stats; std::list symbol_names; @@ -1885,7 +1885,7 @@ feval (fname, args, 0); } -void +void mlock (void) { octave_function *fcn = octave_call_stack::current (); @@ -1896,7 +1896,7 @@ error ("mlock: invalid use outside a function"); } -void +void munlock (const std::string& nm) { octave_value val = symbol_table::find_function (nm); @@ -2024,7 +2024,7 @@ // Deleting names from the symbol tables. static inline bool -name_matches_any_pattern (const std::string& nm, const string_vector& argv, +name_matches_any_pattern (const std::string& nm, const string_vector& argv, int argc, int idx, bool have_regexp = false) { bool retval = false; @@ -2325,7 +2325,7 @@ if (argc == 1) { do_clear_globals (argv, argc, 1); - do_clear_variables (argv, argc, 1); + do_clear_variables (argv, argc, 1); } else { diff -r 1473d0cf86d2 -r 12df7854fa7c src/variables.h --- a/src/variables.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/variables.h Thu Jan 20 17:24:59 2011 -0500 @@ -45,11 +45,11 @@ extern OCTINTERP_API octave_function * is_valid_function (const octave_value&, const std::string& = std::string (), - bool warn = false); + bool warn = false); extern OCTINTERP_API octave_function * is_valid_function (const std::string&, const std::string& = std::string (), - bool warn = false); + bool warn = false); extern OCTINTERP_API octave_function * extract_function (const octave_value& arg, const std::string& warn_for, diff -r 1473d0cf86d2 -r 12df7854fa7c src/xdiv.cc --- a/src/xdiv.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/xdiv.cc Thu Jan 20 17:24:59 2011 -0500 @@ -135,8 +135,8 @@ octave_idx_type info; double rcond = 0.0; - Matrix result - = b.solve (typ, a.transpose (), info, rcond, + Matrix result + = b.solve (typ, a.transpose (), info, rcond, solve_singularity_warning, true, blas_trans); return result.transpose (); @@ -153,7 +153,7 @@ double rcond = 0.0; ComplexMatrix result - = b.solve (typ, a.transpose (), info, rcond, + = b.solve (typ, a.transpose (), info, rcond, solve_singularity_warning, true, blas_trans); return result.transpose (); @@ -170,7 +170,7 @@ double rcond = 0.0; ComplexMatrix result - = b.solve (typ, a.transpose (), info, rcond, + = b.solve (typ, a.transpose (), info, rcond, solve_singularity_warning, true, blas_trans); return result.transpose (); @@ -187,7 +187,7 @@ double rcond = 0.0; ComplexMatrix result - = b.solve (typ, a.transpose (), info, rcond, + = b.solve (typ, a.transpose (), info, rcond, solve_singularity_warning, true, blas_trans); return result.transpose (); @@ -433,8 +433,8 @@ octave_idx_type info; float rcond = 0.0; - FloatMatrix result - = b.solve (typ, a.transpose (), info, rcond, + FloatMatrix result + = b.solve (typ, a.transpose (), info, rcond, solve_singularity_warning, true, blas_trans); return result.transpose (); @@ -450,8 +450,8 @@ octave_idx_type info; float rcond = 0.0; - FloatComplexMatrix result - = b.solve (typ, a.transpose (), info, rcond, + FloatComplexMatrix result + = b.solve (typ, a.transpose (), info, rcond, solve_singularity_warning, true, blas_trans); return result.transpose (); @@ -467,8 +467,8 @@ octave_idx_type info; float rcond = 0.0; - FloatComplexMatrix result - = b.solve (typ, a.transpose (), info, rcond, + FloatComplexMatrix result + = b.solve (typ, a.transpose (), info, rcond, solve_singularity_warning, true, blas_trans); return result.transpose (); @@ -484,8 +484,8 @@ octave_idx_type info; float rcond = 0.0; - FloatComplexMatrix result - = b.solve (typ, a.transpose (), info, rcond, + FloatComplexMatrix result + = b.solve (typ, a.transpose (), info, rcond, solve_singularity_warning, true, blas_trans); return result.transpose (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/xdiv.h --- a/src/xdiv.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/xdiv.h Thu Jan 20 17:24:59 2011 -0500 @@ -72,7 +72,7 @@ extern FloatComplexNDArray x_el_div (const FloatComplex a, const FloatNDArray& b); extern FloatComplexNDArray x_el_div (const FloatComplex a, const FloatComplexNDArray& b); -extern FloatMatrix xleftdiv (const FloatMatrix& a, const FloatMatrix& b, MatrixType &typ, +extern FloatMatrix xleftdiv (const FloatMatrix& a, const FloatMatrix& b, MatrixType &typ, blas_trans_type transt = blas_no_trans); extern FloatComplexMatrix xleftdiv (const FloatMatrix& a, const FloatComplexMatrix& b, MatrixType &typ, blas_trans_type transt = blas_no_trans); @@ -91,17 +91,17 @@ extern ComplexDiagMatrix xdiv (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b); extern FloatMatrix xdiv (const FloatMatrix& a, const FloatDiagMatrix& b); -extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, - const FloatDiagMatrix& b); -extern FloatComplexMatrix xdiv (const FloatMatrix& a, - const FloatComplexDiagMatrix& b); -extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, +extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, + const FloatDiagMatrix& b); +extern FloatComplexMatrix xdiv (const FloatMatrix& a, + const FloatComplexDiagMatrix& b); +extern FloatComplexMatrix xdiv (const FloatComplexMatrix& a, const FloatComplexDiagMatrix& b); extern FloatDiagMatrix xdiv (const FloatDiagMatrix& a, const FloatDiagMatrix& b); -extern FloatComplexDiagMatrix xdiv (const FloatComplexDiagMatrix& a, +extern FloatComplexDiagMatrix xdiv (const FloatComplexDiagMatrix& a, const FloatDiagMatrix& b); -extern FloatComplexDiagMatrix xdiv (const FloatComplexDiagMatrix& a, +extern FloatComplexDiagMatrix xdiv (const FloatComplexDiagMatrix& a, const FloatComplexDiagMatrix& b); extern Matrix xleftdiv (const DiagMatrix& a, const Matrix& b); @@ -112,18 +112,18 @@ extern ComplexDiagMatrix xleftdiv (const DiagMatrix& a, const ComplexDiagMatrix& b); extern ComplexDiagMatrix xleftdiv (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b); -extern FloatMatrix xleftdiv (const FloatDiagMatrix& a, +extern FloatMatrix xleftdiv (const FloatDiagMatrix& a, const FloatMatrix& b); -extern FloatComplexMatrix xleftdiv (const FloatDiagMatrix& a, +extern FloatComplexMatrix xleftdiv (const FloatDiagMatrix& a, const FloatComplexMatrix& b); -extern FloatComplexMatrix xleftdiv (const FloatComplexDiagMatrix& a, +extern FloatComplexMatrix xleftdiv (const FloatComplexDiagMatrix& a, const FloatComplexMatrix& b); -extern FloatDiagMatrix xleftdiv (const FloatDiagMatrix& a, +extern FloatDiagMatrix xleftdiv (const FloatDiagMatrix& a, const FloatDiagMatrix& b); -extern FloatComplexDiagMatrix xleftdiv (const FloatDiagMatrix& a, +extern FloatComplexDiagMatrix xleftdiv (const FloatDiagMatrix& a, const FloatComplexDiagMatrix& b); -extern FloatComplexDiagMatrix xleftdiv (const FloatComplexDiagMatrix& a, +extern FloatComplexDiagMatrix xleftdiv (const FloatComplexDiagMatrix& a, const FloatComplexDiagMatrix& b); #endif diff -r 1473d0cf86d2 -r 12df7854fa7c src/xnorm.cc --- a/src/xnorm.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/xnorm.cc Thu Jan 20 17:24:59 2011 -0500 @@ -59,7 +59,7 @@ else if (iscomplex) retval = xnorm (x.complex_column_vector_value (), p.double_value ()); - else + else retval = xnorm (x.column_vector_value (), p.double_value ()); } @@ -68,7 +68,7 @@ if (iscomplex) retval = xnorm (x.sparse_complex_matrix_value (), p.double_value ()); - else + else retval = xnorm (x.sparse_matrix_value (), p.double_value ()); } @@ -83,7 +83,7 @@ else if (iscomplex) retval = xnorm (x.complex_matrix_value (), p.double_value ()); - else + else retval = xnorm (x.matrix_value (), p.double_value ()); } @@ -109,7 +109,7 @@ if (iscomplex) retval = xcolnorms (x.sparse_complex_matrix_value (), p.double_value ()); - else + else retval = xcolnorms (x.sparse_matrix_value (), p.double_value ()); } @@ -124,7 +124,7 @@ else if (iscomplex) retval = xcolnorms (x.complex_matrix_value (), p.double_value ()); - else + else retval = xcolnorms (x.matrix_value (), p.double_value ()); } @@ -150,7 +150,7 @@ if (iscomplex) retval = xrownorms (x.sparse_complex_matrix_value (), p.double_value ()); - else + else retval = xrownorms (x.sparse_matrix_value (), p.double_value ()); } @@ -165,7 +165,7 @@ else if (iscomplex) retval = xrownorms (x.complex_matrix_value (), p.double_value ()); - else + else retval = xrownorms (x.matrix_value (), p.double_value ()); } @@ -190,7 +190,7 @@ { if (iscomplex) retval = xfrobnorm (x.sparse_complex_matrix_value ()); - else + else retval = xfrobnorm (x.sparse_matrix_value ()); } else @@ -201,7 +201,7 @@ retval = xfrobnorm (x.float_matrix_value ()); else if (iscomplex) retval = xfrobnorm (x.complex_matrix_value ()); - else + else retval = xfrobnorm (x.matrix_value ()); } } diff -r 1473d0cf86d2 -r 12df7854fa7c src/xpow.cc --- a/src/xpow.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/xpow.cc Thu Jan 20 17:24:59 2011 -0500 @@ -694,7 +694,7 @@ return result; } -static inline bool +static inline bool same_sign (double a, double b) { return (a >= 0 && b >= 0) || (a <= 0 && b <= 0); @@ -731,7 +731,7 @@ } retval = result; - } + } else retval = elem_xpow (a, r.matrix_value ()); @@ -754,8 +754,8 @@ for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) { - octave_quit (); - + octave_quit (); + Complex atmp (a (i, j)); result (i, j) = std::pow (atmp, b); @@ -967,7 +967,7 @@ } retval = result; - } + } else retval = elem_xpow (a, r.matrix_value ()); @@ -2113,8 +2113,8 @@ for (octave_idx_type j = 0; j < nc; j++) for (octave_idx_type i = 0; i < nr; i++) { - octave_quit (); - + octave_quit (); + FloatComplex atmp (a (i, j)); result (i, j) = std::pow (atmp, b); diff -r 1473d0cf86d2 -r 12df7854fa7c src/zfstream.cc --- a/src/zfstream.cc Thu Jan 20 17:21:27 2011 -0500 +++ b/src/zfstream.cc Thu Jan 20 17:24:59 2011 -0500 @@ -1,6 +1,6 @@ /* -Copyright (C) 2005-2011 Ludwig Schwardt, Kevin Ruland +Copyright (C) 2005-2011 Ludwig Schwardt, Kevin Ruland This file is part of Octave. @@ -46,7 +46,7 @@ // Internal buffer sizes (default and "unbuffered" versions) #define STASHED_CHARACTERS 16 -#define BIGBUFSIZE (256 * 1024 + STASHED_CHARACTERS) +#define BIGBUFSIZE (256 * 1024 + STASHED_CHARACTERS) #define SMALLBUFSIZE 1 /*****************************************************************************/ @@ -216,7 +216,7 @@ // Puts back a character to the stream in two cases. Firstly, when there // is no putback position available, and secondly when the character putback -// differs from the one in the file. We can only support the first case +// differs from the one in the file. We can only support the first case // with gzipped files. gzfilebuf::int_type gzfilebuf::pbackfail (gzfilebuf::int_type c) @@ -225,7 +225,7 @@ { if (gzseek (file, this->gptr() - this->egptr() - 1, SEEK_CUR) < 0) return traits_type::eof(); - + // Invalidates contents of the buffer enable_buffer (); @@ -461,7 +461,7 @@ // Seek functions gzfilebuf::pos_type -gzfilebuf::seekoff(off_type off, std::ios_base::seekdir way, +gzfilebuf::seekoff(off_type off, std::ios_base::seekdir way, std::ios_base::openmode) { pos_type ret = pos_type (off_type (-1)); @@ -480,7 +480,7 @@ else // Can't seek from end of a gzipped file, so this will give -1 ret = pos_type (gzseek (file, computed_off, SEEK_END)); - + if (io_mode & std::ios_base::in) // Invalidates contents of the buffer enable_buffer (); diff -r 1473d0cf86d2 -r 12df7854fa7c src/zfstream.h --- a/src/zfstream.h Thu Jan 20 17:21:27 2011 -0500 +++ b/src/zfstream.h Thu Jan 20 17:24:59 2011 -0500 @@ -1,6 +1,6 @@ /* -Copyright (C) 2005-2011 Ludwig Schwardt, Kevin Ruland +Copyright (C) 2005-2011 Ludwig Schwardt, Kevin Ruland This file is part of Octave. @@ -177,7 +177,7 @@ */ virtual pos_type seekoff(off_type off, std::ios_base::seekdir way, - std::ios_base::openmode mode = + std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out); /** @@ -186,7 +186,7 @@ * Each derived class provides its own appropriate behavior. */ virtual pos_type - seekpos(pos_type sp, std::ios_base::openmode mode = + seekpos(pos_type sp, std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out); virtual int_type