# HG changeset patch # User jwe # Date 1112976457 0 # Node ID 23b37da9fd5b67e7a8dfda2422b14244a0085ca2 # Parent eae7b40388e9ad87d423ea35a57d0df99c659cd5 [project @ 2005-04-08 16:07:35 by jwe] diff -r eae7b40388e9 -r 23b37da9fd5b ChangeLog --- a/ChangeLog Thu Apr 07 21:51:37 2005 +0000 +++ b/ChangeLog Fri Apr 08 16:07:37 2005 +0000 @@ -1,3 +1,26 @@ +2005-04-08 John W. Eaton + + * Initial merge of 64-bit changes from Clinton Chee: + + 2005-04-07 John W. Eaton + + * configure.in (--enable-64): Make default disabled. + + 2005-04-06 John W. Eaton + + * mk-opts.pl (emit_show_function, emit_set_functions, + emit_print_function): Also accept "octave_idx_type" and + "Array". + + 2005-04-01 John W. Eaton + + * Makeconf.in (USE_64_BIT_IDX_T): Substitute value. + (do-subst-config-vals): Add to list of substitutions. + + * configure.in (AC_CONFIG_FILES): Perform substitutions on + liboctave/oct-types.h too. + Handle --enable-64. + 2005-04-06 David Bateman * configure.in: Split the HDF5 and zlib detection code, so that zlib diff -r eae7b40388e9 -r 23b37da9fd5b Makeconf.in --- a/Makeconf.in Thu Apr 07 21:51:37 2005 +0000 +++ b/Makeconf.in Fri Apr 08 16:07:37 2005 +0000 @@ -190,6 +190,8 @@ UMFPACK_LIBS = @UMFPACK_LIBS@ LIBS = @LIBS@ +USE_64_BIT_IDX_T = @USE_64_BIT_IDX_T@ + # The arguments passed to configure. config_opts = @config_opts@ @@ -465,6 +467,7 @@ -e "s;%OCTAVE_CONF_SONAME_FLAGS%;\"${SONAME_FLAGS}\";" \ -e "s;%OCTAVE_CONF_STATIC_LIBS%;\"${STATIC_LIBS}\";" \ -e "s;%OCTAVE_CONF_UGLY_DEFS%;\"${UGLY_DEFS}\";" \ + -e "s;%OCTAVE_CONF_USE_64_BIT_IDX_T%;\"${USE_64_BIT_IDX_T}\";" \ -e "s;%OCTAVE_CONF_VERSION%;\"${version}\";" \ -e "s;%OCTAVE_CONF_ENABLE_DYNAMIC_LINKING%;\"${ENABLE_DYNAMIC_LINKING}\";" \ -e "s;%OCTAVE_CONF_XTRA_CFLAGS%;\"${XTRA_CFLAGS}\";" \ diff -r eae7b40388e9 -r 23b37da9fd5b configure.in --- a/configure.in Thu Apr 07 21:51:37 2005 +0000 +++ b/configure.in Fri Apr 08 16:07:37 2005 +0000 @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.470 $) +AC_REVISION($Revision: 1.471 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -144,6 +144,38 @@ AC_DEFINE(BOUNDS_CHECKING, 1, [Define to use internal bounds checking.]) fi +### If possible, use a 64-bit integer type for array dimensions and indexing. + +USE_64_BIT_IDX_T=false +OCTAVE_IDX_TYPE=int +AC_ARG_ENABLE(64, + [ --enable-64 use 64-bit integer for array dimensions and indexing], + [if test "$enableval" = yes; then USE_64_BIT_IDX_T=true; fi], []) +if $USE_64_BIT_IDX_T; then + AC_CHECK_SIZEOF(void *) + AC_CHECK_SIZEOF(int) + AC_CHECK_SIZEOF(long) + if test $ac_cv_sizeof_void_p -eq 8; then + if test $ac_cv_sizeof_int -eq 8; then + OCTAVE_IDX_TYPE=int + elif test $ac_cv_sizeof_long -eq 8; then + OCTAVE_IDX_TYPE=long + else + AC_MSG_WARN([no suitable type found for octave_idx_type so disabling 64-bit features]) + USE_64_BIT_IDX_T=false + fi + else + warn_64_bit="pointers are not 64-bits wide so disabling 64-bit features" + AC_MSG_WARN($warn_64_bit) + USE_64_BIT_IDX_T=false + fi +fi +AC_SUBST(OCTAVE_IDX_TYPE) +if $USE_64_BIT_IDX_T; then + AC_DEFINE(USE_64_BIT_IDX_T, 1, [Define if using 64-bit integers for array dimensions and indexing]) +fi +AC_SUBST(USE_64_BIT_IDX_T) + ### It seems that there are some broken inline assembly functions in ### the GNU libc. Since I'm not sure how to test whether we are using ### GNU libc, just disable them for all platforms. @@ -670,7 +702,7 @@ AC_SUBST(UMFPACK_LIBS) AC_ARG_WITH(umfpack, - [ --without-umfpack don't use UMFPACK, disable some sparse functionality], + [ --without-umfpack don't use UMFPACK, disable some sparse functionality], with_umfpack=$withval, with_umfpack=yes) if test "$with_umfpack" = "yes"; then @@ -1538,6 +1570,8 @@ #if 0 #define F77_USES_VISUAL_FORTRAN_CALLING_CONVENTION #endif + +#include "oct-types.h" ]) ### Do the substitutions in all the Makefiles. @@ -1546,13 +1580,13 @@ test/Makefile dlfcn/Makefile \ doc/Makefile doc/faq/Makefile doc/interpreter/Makefile \ doc/liboctave/Makefile doc/refcard/Makefile emacs/Makefile \ - examples/Makefile liboctave/Makefile src/Makefile \ - libcruft/Makefile libcruft/Makerules libcruft/amos/Makefile \ - libcruft/blas/Makefile libcruft/daspk/Makefile \ - libcruft/dasrt/Makefile libcruft/dassl/Makefile \ - libcruft/fftpack/Makefile libcruft/lapack/Makefile \ - libcruft/minpack/Makefile libcruft/misc/Makefile \ - libcruft/odepack/Makefile \ + examples/Makefile liboctave/Makefile liboctave/oct-types.h \ + src/Makefile libcruft/Makefile libcruft/Makerules \ + libcruft/amos/Makefile libcruft/blas/Makefile \ + libcruft/daspk/Makefile libcruft/dasrt/Makefile + libcruft/dassl/Makefile libcruft/fftpack/Makefile \ + libcruft/lapack/Makefile libcruft/minpack/Makefile \ + libcruft/misc/Makefile libcruft/odepack/Makefile \ libcruft/ordered-qz/Makefile libcruft/quadpack/Makefile \ libcruft/ranlib/Makefile libcruft/slatec-fn/Makefile \ libcruft/slatec-err/Makefile libcruft/villad/Makefile \ @@ -1594,6 +1628,7 @@ Build shared libraries: $SHARED_LIBS Dynamic Linking: $ENABLE_DYNAMIC_LINKING $DL_API_MSG Include support for GNU readline: $USE_READLINE + 64-bit array dims and indexing: $USE_64_BIT_IDX_T ]) warn_msg_printed=false @@ -1683,6 +1718,11 @@ warn_msg_printed=true fi +if test -n "$warn_64_bit"; then + AC_MSG_WARN($warn_64_bit) + warn_msg_printed=true +fi + if test -n "$warn_gnuplot"; then ## If you change this text, be sure to also change the corresponding diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Array-i.cc --- a/liboctave/Array-i.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Array-i.cc Fri Apr 08 16:07:37 2005 +0000 @@ -32,6 +32,7 @@ #include "Array.cc" INSTANTIATE_ARRAY_AND_ASSIGN (int); +INSTANTIATE_ARRAY_AND_ASSIGN (long); INSTANTIATE_ARRAY_ASSIGN (int, short); INSTANTIATE_ARRAY_ASSIGN (int, char); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Array-util.cc --- a/liboctave/Array-util.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Array-util.cc Fri Apr 08 16:07:37 2005 +0000 @@ -29,7 +29,7 @@ #include "lo-error.h" bool -index_in_bounds (const Array& ra_idx, const dim_vector& dimensions) +index_in_bounds (const Array& ra_idx, const dim_vector& dimensions) { bool retval = true; @@ -53,7 +53,7 @@ } void -increment_index (Array& ra_idx, const dim_vector& dimensions, +increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension) { ra_idx(start_dimension)++; @@ -72,10 +72,10 @@ } } -int -get_scalar_idx (Array& idx, dim_vector& dims) +octave_idx_type +get_scalar_idx (Array& idx, dim_vector& dims) { - int retval (-1); + octave_idx_type retval (-1); int n = idx.length (); @@ -93,12 +93,12 @@ return retval; } -int -num_ones (const Array& ra_idx) +octave_idx_type +num_ones (const Array& ra_idx) { - int retval = 0; + octave_idx_type retval = 0; - for (int i = 0; i < ra_idx.length (); i++) + for (octave_idx_type i = 0; i < ra_idx.length (); i++) { if (ra_idx (i) == 1) retval++; @@ -134,11 +134,11 @@ } bool -any_ones (const Array& arr) +any_ones (const Array& arr) { bool retval = false; - for (int i = 0; i < arr.length (); i++) + for (octave_idx_type i = 0; i < arr.length (); i++) { if (arr (i) == 1) { @@ -150,10 +150,10 @@ return retval; } -int -compute_index (const Array& ra_idx, const dim_vector& dims) +octave_idx_type +compute_index (const Array& ra_idx, const dim_vector& dims) { - int retval = -1; + octave_idx_type retval = -1; int n = dims.length (); @@ -175,23 +175,23 @@ return retval; } -Array +Array conv_to_int_array (const Array& a) { - Array retval (a.length ()); + Array retval (a.length ()); - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) retval (i) = a(i).elem (0); return retval; } Array -conv_to_array (const idx_vector *tmp, const int len) +conv_to_array (const idx_vector *tmp, const octave_idx_type len) { Array retval (len); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) retval (i) = tmp[i]; return retval; @@ -218,13 +218,13 @@ } bool -vector_equivalent (const Array& ra_idx) +vector_equivalent (const Array& ra_idx) { - int n = ra_idx.length (); + octave_idx_type n = ra_idx.length (); bool found_first = false; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { if (ra_idx(i) != 1) { @@ -243,9 +243,9 @@ { bool retval = true; - int n = ra_idx.length (); + octave_idx_type n = ra_idx.length (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { if (! ra_idx(i)) { @@ -262,9 +262,9 @@ { bool retval = false; - int n = ra_idx.length (); + octave_idx_type n = ra_idx.length (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { if (ra_idx(i).orig_empty ()) { @@ -282,13 +282,13 @@ { bool retval = true; - int idx_n = ra_idx.length (); + octave_idx_type idx_n = ra_idx.length (); int n = frozen_lengths.length (); assert (idx_n == n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { if (! ra_idx(i).is_colon_equiv (frozen_lengths(i))) { @@ -301,25 +301,25 @@ } bool -is_in (int num, const idx_vector& idx) +is_in (octave_idx_type num, const idx_vector& idx) { - int n = idx.capacity (); + octave_idx_type n = idx.capacity (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) if (idx.elem (i) == num) return true; return false; } -int -how_many_lgt (const int num, idx_vector& idxv) +octave_idx_type +how_many_lgt (const octave_idx_type num, idx_vector& idxv) { - int retval = 0; + octave_idx_type retval = 0; - int n = idxv.capacity (); + octave_idx_type n = idxv.capacity (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { if (num > idxv.elem (i)) retval++; @@ -329,11 +329,11 @@ } bool -all_ones (const Array& arr) +all_ones (const Array& arr) { bool retval = true; - for (int i = 0; i < arr.length (); i++) + for (octave_idx_type i = 0; i < arr.length (); i++) { if (arr(i) != 1) { @@ -345,23 +345,23 @@ return retval; } -Array -get_elt_idx (const Array& ra_idx, const Array& result_idx) +Array +get_elt_idx (const Array& ra_idx, const Array& result_idx) { - int n = ra_idx.length (); + octave_idx_type n = ra_idx.length (); - Array retval (n); + Array retval (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) retval(i) = ra_idx(i).elem (result_idx(i)); return retval; } -Array -get_ra_idx (int idx, const dim_vector& dims) +Array +get_ra_idx (octave_idx_type idx, const dim_vector& dims) { - Array retval; + Array retval; int n_dims = dims.length (); @@ -372,14 +372,14 @@ assert (idx > 0 || idx < dims.numel ()); - for (int i = 0; i < idx; i++) + for (octave_idx_type i = 0; i < idx; i++) increment_index (retval, dims); // XXX FIXME XXX -- the solution using increment_index is not // efficient. #if 0 - int var = 1; + octave_idx_type var = 1; for (int i = 0; i < n_dims; i++) { std::cout << "idx: " << idx << ", var: " << var << ", dims(" << i << "): " << dims(i) <<"\n"; @@ -424,8 +424,8 @@ } else { - int last_ra_idx = ra_idx(n-1)(0); - for (int i = 1; i < ra_idx (n - 1).capacity (); i++) + octave_idx_type last_ra_idx = ra_idx(n-1)(0); + for (octave_idx_type i = 1; i < ra_idx (n - 1).capacity (); i++) last_ra_idx = (last_ra_idx > ra_idx(n-1)(i) ? last_ra_idx : ra_idx(n-1)(i)); @@ -450,15 +450,15 @@ return retval; } -Array -calc_permutated_idx (const Array& old_idx, - const Array& perm_vec, bool inv) +Array +calc_permutated_idx (const Array& old_idx, + const Array& perm_vec, bool inv) { - int n_el = old_idx.length (); + octave_idx_type n_el = old_idx.length (); - Array retval (n_el); + Array retval (n_el); - for (int i = 0; i < n_el; i++) + for (octave_idx_type i = 0; i < n_el; i++) { if (inv) retval(perm_vec(i)) = old_idx(i); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Array-util.h --- a/liboctave/Array-util.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Array-util.h Fri Apr 08 16:07:37 2005 +0000 @@ -30,31 +30,31 @@ #include "idx-vector.h" #include "lo-error.h" -extern bool index_in_bounds (const Array& ra_idx, +extern bool index_in_bounds (const Array& ra_idx, const dim_vector& dimensions); -extern void increment_index (Array& ra_idx, +extern void increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension = 0); -extern int get_scalar_idx (Array& idx, dim_vector& dims); +extern octave_idx_type get_scalar_idx (Array& idx, dim_vector& dims); -extern int num_ones (const Array& ra_idx); +extern octave_idx_type num_ones (const Array& ra_idx); extern bool is_scalar (const dim_vector& dim); -extern bool any_ones (const Array& arr); +extern bool any_ones (const Array& arr); -extern int compute_index (const Array& ra_idx, const dim_vector& dims); +extern octave_idx_type compute_index (const Array& ra_idx, const dim_vector& dims); -extern Array conv_to_int_array (const Array& a); +extern Array conv_to_int_array (const Array& a); -extern Array conv_to_array (const idx_vector *tmp, const int len); +extern Array conv_to_array (const idx_vector *tmp, const octave_idx_type len); extern dim_vector freeze (Array& ra_idx, const dim_vector& dimensions, int resize_ok); -extern bool vector_equivalent (const Array& ra_idx); +extern bool vector_equivalent (const Array& ra_idx); extern bool all_ok (const Array& ra_idx); @@ -63,23 +63,23 @@ extern bool all_colon_equiv (const Array& ra_idx, const dim_vector& frozen_lengths); -extern bool is_in (int num, const idx_vector& idx); +extern bool is_in (octave_idx_type num, const idx_vector& idx); -extern int how_many_lgt (const int num, idx_vector& idxv); +extern octave_idx_type how_many_lgt (const octave_idx_type num, idx_vector& idxv); -extern bool all_ones (const Array& arr); +extern bool all_ones (const Array& arr); -extern Array get_elt_idx (const Array& ra_idx, - const Array& result_idx); +extern Array get_elt_idx (const Array& ra_idx, + const Array& result_idx); -extern Array get_ra_idx (int idx, const dim_vector& dims); +extern Array get_ra_idx (octave_idx_type idx, const dim_vector& dims); extern dim_vector short_freeze (Array& ra_idx, const dim_vector& dimensions, int resize_ok); -extern Array calc_permutated_idx (const Array& old_idx, - const Array& perm_vec, bool inv); +extern Array calc_permutated_idx (const Array& old_idx, + const Array& perm_vec, bool inv); extern void gripe_nonconformant (const char *op, int op1_len, int op2_len); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Array.cc --- a/liboctave/Array.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Array.cc Fri Apr 08 16:07:37 2005 +0000 @@ -93,7 +93,7 @@ case 1: { - int tmp = new_dimensions(0); + octave_idx_type tmp = new_dimensions(0); new_dimensions.resize (2); @@ -124,8 +124,8 @@ #define MALLOC_OVERHEAD 1024 template -int -Array::get_size (int r, int c) +octave_idx_type +Array::get_size (octave_idx_type r, octave_idx_type c) { // XXX KLUGE XXX @@ -138,17 +138,17 @@ static int nl; static double dl - = frexp (static_cast - (INT_MAX - MALLOC_OVERHEAD) / sizeof (T), &nl); + = frexp (static_cast + (std::numeric_limits::max() - MALLOC_OVERHEAD) / sizeof (T), &nl); // This value should be an integer. If we return this value and // things work the way we expect, we should be paying a visit to // new_handler in no time flat. - static int max_items = static_cast (ldexp (dl, nl)); + static octave_idx_type max_items = static_cast (ldexp (dl, nl)); // = dl.2^nl int nr, nc; - double dr = frexp (static_cast (r), &nr); - double dc = frexp (static_cast (c), &nc); + double dr = frexp (static_cast (r), &nr); // r = dr * 2^nr + double dc = frexp (static_cast (c), &nc); // c = dc * 2^nc int nt = nr + nc; double dt = dr * dc; @@ -159,12 +159,13 @@ dt *= 2; } + // if (r*c) below limit, then return r*c, otherwise return TOO BIG num! return (nt < nl || (nt == nl && dt < dl)) ? r * c : max_items; } template -int -Array::get_size (int r, int c, int p) +octave_idx_type +Array::get_size (octave_idx_type r, octave_idx_type c, octave_idx_type p) { // XXX KLUGE XXX @@ -178,12 +179,12 @@ static int nl; static double dl = frexp (static_cast - (INT_MAX - MALLOC_OVERHEAD) / sizeof (T), &nl); + (std::numeric_limits::max() - MALLOC_OVERHEAD) / sizeof (T), &nl); // This value should be an integer. If we return this value and // things work the way we expect, we should be paying a visit to // new_handler in no time flat. - static int max_items = static_cast (ldexp (dl, nl)); + static octave_idx_type max_items = static_cast (ldexp (dl, nl)); int nr, nc, np; double dr = frexp (static_cast (r), &nr); @@ -209,7 +210,7 @@ } template -int +octave_idx_type Array::get_size (const dim_vector& ra_idx) { // XXX KLUGE XXX @@ -224,15 +225,15 @@ static int nl; static double dl = frexp (static_cast - (INT_MAX - MALLOC_OVERHEAD) / sizeof (T), &nl); + (std::numeric_limits::max() - MALLOC_OVERHEAD) / sizeof (T), &nl); // This value should be an integer. If we return this value and // things work the way we expect, we should be paying a visit to // new_handler in no time flat. - static int max_items = static_cast (ldexp (dl, nl)); - - int retval = max_items; + static octave_idx_type max_items = static_cast (ldexp (dl, nl)); + + octave_idx_type retval = max_items; int n = ra_idx.length (); @@ -268,10 +269,10 @@ #undef MALLOC_OVERHEAD template -int -Array::compute_index (const Array& ra_idx) const +octave_idx_type +Array::compute_index (const Array& ra_idx) const { - int retval = -1; + octave_idx_type retval = -1; int n = dimensions.length (); @@ -294,7 +295,7 @@ template T -Array::range_error (const char *fcn, int n) const +Array::range_error (const char *fcn, octave_idx_type n) const { (*current_liboctave_error_handler) ("%s (%d): range error", fcn, n); return T (); @@ -302,7 +303,7 @@ template T& -Array::range_error (const char *fcn, int n) +Array::range_error (const char *fcn, octave_idx_type n) { (*current_liboctave_error_handler) ("%s (%d): range error", fcn, n); static T foo; @@ -311,7 +312,7 @@ template T -Array::range_error (const char *fcn, int i, int j) const +Array::range_error (const char *fcn, octave_idx_type i, octave_idx_type j) const { (*current_liboctave_error_handler) ("%s (%d, %d): range error", fcn, i, j); @@ -320,7 +321,7 @@ template T& -Array::range_error (const char *fcn, int i, int j) +Array::range_error (const char *fcn, octave_idx_type i, octave_idx_type j) { (*current_liboctave_error_handler) ("%s (%d, %d): range error", fcn, i, j); @@ -330,7 +331,7 @@ template T -Array::range_error (const char *fcn, int i, int j, int k) const +Array::range_error (const char *fcn, octave_idx_type i, octave_idx_type j, octave_idx_type k) const { (*current_liboctave_error_handler) ("%s (%d, %d, %d): range error", fcn, i, j, k); @@ -339,7 +340,7 @@ template T& -Array::range_error (const char *fcn, int i, int j, int k) +Array::range_error (const char *fcn, octave_idx_type i, octave_idx_type j, octave_idx_type k) { (*current_liboctave_error_handler) ("%s (%d, %d, %d): range error", fcn, i, j, k); @@ -355,12 +356,12 @@ buf << fcn << " ("; - int n = ra_idx.length (); + octave_idx_type n = ra_idx.length (); if (n > 0) buf << ra_idx(0); - for (int i = 1; i < n; i++) + for (octave_idx_type i = 1; i < n; i++) buf << ", " << ra_idx(i); buf << "): range error"; @@ -382,12 +383,12 @@ buf << fcn << " ("; - int n = ra_idx.length (); + octave_idx_type n = ra_idx.length (); if (n > 0) buf << ra_idx(0); - for (int i = 1; i < n; i++) + for (octave_idx_type i = 1; i < n; i++) buf << ", " << ra_idx(i); buf << "): range error"; @@ -423,7 +424,7 @@ template Array -Array::permute (const Array& perm_vec, bool inv) const +Array::permute (const Array& perm_vec, bool inv) const { Array retval; @@ -449,7 +450,7 @@ // Find dimension vector of permuted array. for (int i = 0; i < perm_vec_len; i++) { - int perm_elt = perm_vec.elem (i); + octave_idx_type perm_elt = perm_vec.elem (i); if (perm_elt >= perm_vec_len || perm_elt < 0) { @@ -477,17 +478,17 @@ retval.resize (dv_new); // Index array to the original array. - Array old_idx (perm_vec_len, 0); + Array old_idx (perm_vec_len, 0); // Number of elements in Array (should be the same for // both the permuted array and original array). - int n = retval.length (); + octave_idx_type n = retval.length (); // Permute array. - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { // Get the idx of permuted array. - Array new_idx = calc_permutated_idx (old_idx, perm_vec, inv); + Array new_idx = calc_permutated_idx (old_idx, perm_vec, inv); retval.elem (new_idx) = tmp.elem (old_idx); @@ -499,7 +500,7 @@ template void -Array::resize_no_fill (int n) +Array::resize_no_fill (octave_idx_type n) { if (n < 0) { @@ -513,7 +514,7 @@ typename Array::ArrayRep *old_rep = rep; const T *old_data = data (); - int old_len = length (); + octave_idx_type old_len = length (); rep = new typename Array::ArrayRep (n); @@ -521,9 +522,9 @@ if (n > 0 && old_data && old_len > 0) { - int min_len = old_len < n ? old_len : n; - - for (int i = 0; i < min_len; i++) + octave_idx_type min_len = old_len < n ? old_len : n; + + for (octave_idx_type i = 0; i < min_len; i++) xelem (i) = old_data[i]; } @@ -535,9 +536,9 @@ void Array::resize_no_fill (const dim_vector& dv) { - int n = dv.length (); - - for (int i = 0; i < n; i++) + octave_idx_type n = dv.length (); + + for (octave_idx_type i = 0; i < n; i++) { if (dv(i) < 0) { @@ -555,7 +556,7 @@ } else { - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { if (dv(i) != dimensions(i)) { @@ -571,28 +572,28 @@ typename Array::ArrayRep *old_rep = rep; const T *old_data = data (); - int ts = get_size (dv); + octave_idx_type ts = get_size (dv); rep = new typename Array::ArrayRep (ts); dim_vector dv_old = dimensions; - int dv_old_orig_len = dv_old.length (); + octave_idx_type dv_old_orig_len = dv_old.length (); dimensions = dv; - int ts_old = get_size (dv_old); + octave_idx_type ts_old = get_size (dv_old); if (ts > 0 && ts_old > 0 && dv_old_orig_len > 0) { - Array ra_idx (dimensions.length (), 0); + Array ra_idx (dimensions.length (), 0); if (n > dv_old_orig_len) { dv_old.resize (n); - for (int i = dv_old_orig_len; i < n; i++) + for (octave_idx_type i = dv_old_orig_len; i < n; i++) dv_old.elem (i) = 1; } - for (int i = 0; i < ts; i++) + for (octave_idx_type i = 0; i < ts; i++) { if (index_in_bounds (ra_idx, dv_old)) rep->elem (i) = old_data[get_scalar_idx (ra_idx, dv_old)]; @@ -607,7 +608,7 @@ template void -Array::resize_no_fill (int r, int c) +Array::resize_no_fill (octave_idx_type r, octave_idx_type c) { if (r < 0 || c < 0) { @@ -629,11 +630,11 @@ typename Array::ArrayRep *old_rep = Array::rep; const T *old_data = data (); - int old_d1 = dim1 (); - int old_d2 = dim2 (); - int old_len = length (); - - int ts = get_size (r, c); + octave_idx_type old_d1 = dim1 (); + octave_idx_type old_d2 = dim2 (); + octave_idx_type old_len = length (); + + octave_idx_type ts = get_size (r, c); rep = new typename Array::ArrayRep (ts); @@ -641,11 +642,11 @@ if (ts > 0 && old_data && old_len > 0) { - int min_r = old_d1 < r ? old_d1 : r; - int min_c = old_d2 < c ? old_d2 : c; - - for (int j = 0; j < min_c; j++) - for (int i = 0; i < min_r; i++) + octave_idx_type min_r = old_d1 < r ? old_d1 : r; + octave_idx_type min_c = old_d2 < c ? old_d2 : c; + + for (octave_idx_type j = 0; j < min_c; j++) + for (octave_idx_type i = 0; i < min_r; i++) xelem (i, j) = old_data[old_d1*j+i]; } @@ -655,7 +656,7 @@ template void -Array::resize_no_fill (int r, int c, int p) +Array::resize_no_fill (octave_idx_type r, octave_idx_type c, octave_idx_type p) { if (r < 0 || c < 0 || p < 0) { @@ -677,12 +678,12 @@ typename Array::ArrayRep *old_rep = rep; const T *old_data = data (); - int old_d1 = dim1 (); - int old_d2 = dim2 (); - int old_d3 = dim3 (); - int old_len = length (); - - int ts = get_size (get_size (r, c), p); + octave_idx_type old_d1 = dim1 (); + octave_idx_type old_d2 = dim2 (); + octave_idx_type old_d3 = dim3 (); + octave_idx_type old_len = length (); + + octave_idx_type ts = get_size (get_size (r, c), p); rep = new typename Array::ArrayRep (ts); @@ -690,13 +691,13 @@ if (ts > 0 && old_data && old_len > 0) { - int min_r = old_d1 < r ? old_d1 : r; - int min_c = old_d2 < c ? old_d2 : c; - int min_p = old_d3 < p ? old_d3 : p; - - for (int k = 0; k < min_p; k++) - for (int j = 0; j < min_c; j++) - for (int i = 0; i < min_r; i++) + octave_idx_type min_r = old_d1 < r ? old_d1 : r; + octave_idx_type min_c = old_d2 < c ? old_d2 : c; + octave_idx_type min_p = old_d3 < p ? old_d3 : p; + + for (octave_idx_type k = 0; k < min_p; k++) + for (octave_idx_type j = 0; j < min_c; j++) + for (octave_idx_type i = 0; i < min_r; i++) xelem (i, j, k) = old_data[old_d1*(old_d2*k+j)+i]; } @@ -706,7 +707,7 @@ template void -Array::resize_and_fill (int n, const T& val) +Array::resize_and_fill (octave_idx_type n, const T& val) { if (n < 0) { @@ -720,7 +721,7 @@ typename Array::ArrayRep *old_rep = rep; const T *old_data = data (); - int old_len = length (); + octave_idx_type old_len = length (); rep = new typename Array::ArrayRep (n); @@ -728,15 +729,15 @@ if (n > 0) { - int min_len = old_len < n ? old_len : n; + octave_idx_type min_len = old_len < n ? old_len : n; if (old_data && old_len > 0) { - for (int i = 0; i < min_len; i++) + for (octave_idx_type i = 0; i < min_len; i++) xelem (i) = old_data[i]; } - for (int i = old_len; i < n; i++) + for (octave_idx_type i = old_len; i < n; i++) xelem (i) = val; } @@ -746,7 +747,7 @@ template void -Array::resize_and_fill (int r, int c, const T& val) +Array::resize_and_fill (octave_idx_type r, octave_idx_type c, const T& val) { if (r < 0 || c < 0) { @@ -766,11 +767,11 @@ typename Array::ArrayRep *old_rep = Array::rep; const T *old_data = data (); - int old_d1 = dim1 (); - int old_d2 = dim2 (); - int old_len = length (); - - int ts = get_size (r, c); + octave_idx_type old_d1 = dim1 (); + octave_idx_type old_d2 = dim2 (); + octave_idx_type old_len = length (); + + octave_idx_type ts = get_size (r, c); rep = new typename Array::ArrayRep (ts); @@ -778,22 +779,22 @@ if (ts > 0) { - int min_r = old_d1 < r ? old_d1 : r; - int min_c = old_d2 < c ? old_d2 : c; + octave_idx_type min_r = old_d1 < r ? old_d1 : r; + octave_idx_type min_c = old_d2 < c ? old_d2 : c; if (old_data && old_len > 0) { - for (int j = 0; j < min_c; j++) - for (int i = 0; i < min_r; i++) + for (octave_idx_type j = 0; j < min_c; j++) + for (octave_idx_type i = 0; i < min_r; i++) xelem (i, j) = old_data[old_d1*j+i]; } - for (int j = 0; j < min_c; j++) - for (int i = min_r; i < r; i++) + for (octave_idx_type j = 0; j < min_c; j++) + for (octave_idx_type i = min_r; i < r; i++) xelem (i, j) = val; - for (int j = min_c; j < c; j++) - for (int i = 0; i < r; i++) + for (octave_idx_type j = min_c; j < c; j++) + for (octave_idx_type i = 0; i < r; i++) xelem (i, j) = val; } @@ -803,7 +804,7 @@ template void -Array::resize_and_fill (int r, int c, int p, const T& val) +Array::resize_and_fill (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val) { if (r < 0 || c < 0 || p < 0) { @@ -823,13 +824,13 @@ typename Array::ArrayRep *old_rep = rep; const T *old_data = data (); - int old_d1 = dim1 (); - int old_d2 = dim2 (); - int old_d3 = dim3 (); - - int old_len = length (); - - int ts = get_size (get_size (r, c), p); + octave_idx_type old_d1 = dim1 (); + octave_idx_type old_d2 = dim2 (); + octave_idx_type old_d3 = dim3 (); + + octave_idx_type old_len = length (); + + octave_idx_type ts = get_size (get_size (r, c), p); rep = new typename Array::ArrayRep (ts); @@ -837,33 +838,33 @@ if (ts > 0) { - int min_r = old_d1 < r ? old_d1 : r; - int min_c = old_d2 < c ? old_d2 : c; - int min_p = old_d3 < p ? old_d3 : p; + octave_idx_type min_r = old_d1 < r ? old_d1 : r; + octave_idx_type min_c = old_d2 < c ? old_d2 : c; + octave_idx_type min_p = old_d3 < p ? old_d3 : p; if (old_data && old_len > 0) - for (int k = 0; k < min_p; k++) - for (int j = 0; j < min_c; j++) - for (int i = 0; i < min_r; i++) + for (octave_idx_type k = 0; k < min_p; k++) + for (octave_idx_type j = 0; j < min_c; j++) + for (octave_idx_type i = 0; i < min_r; i++) xelem (i, j, k) = old_data[old_d1*(old_d2*k+j)+i]; // XXX FIXME XXX -- if the copy constructor is expensive, this // may win. Otherwise, it may make more sense to just copy the // value everywhere when making the new ArrayRep. - for (int k = 0; k < min_p; k++) - for (int j = min_c; j < c; j++) - for (int i = 0; i < min_r; i++) + for (octave_idx_type k = 0; k < min_p; k++) + for (octave_idx_type j = min_c; j < c; j++) + for (octave_idx_type i = 0; i < min_r; i++) xelem (i, j, k) = val; - for (int k = 0; k < min_p; k++) - for (int j = 0; j < c; j++) - for (int i = min_r; i < r; i++) + for (octave_idx_type k = 0; k < min_p; k++) + for (octave_idx_type j = 0; j < c; j++) + for (octave_idx_type i = min_r; i < r; i++) xelem (i, j, k) = val; - for (int k = min_p; k < p; k++) - for (int j = 0; j < c; j++) - for (int i = 0; i < r; i++) + for (octave_idx_type k = min_p; k < p; k++) + for (octave_idx_type j = 0; j < c; j++) + for (octave_idx_type i = 0; i < r; i++) xelem (i, j, k) = val; } @@ -875,9 +876,9 @@ void Array::resize_and_fill (const dim_vector& dv, const T& val) { - int n = dv.length (); - - for (int i = 0; i < n; i++) + octave_idx_type n = dv.length (); + + for (octave_idx_type i = 0; i < n; i++) { if (dv(i) < 0) { @@ -895,7 +896,7 @@ } else { - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { if (dv(i) != dimensions(i)) { @@ -911,27 +912,27 @@ typename Array::ArrayRep *old_rep = rep; const T *old_data = data (); - int len = get_size (dv); + octave_idx_type len = get_size (dv); rep = new typename Array::ArrayRep (len); dim_vector dv_old = dimensions; - int dv_old_orig_len = dv_old.length (); + octave_idx_type dv_old_orig_len = dv_old.length (); dimensions = dv; if (len > 0 && dv_old_orig_len > 0) { - Array ra_idx (dimensions.length (), 0); + Array ra_idx (dimensions.length (), 0); if (n > dv_old_orig_len) { dv_old.resize (n); - for (int i = dv_old_orig_len; i < n; i++) + for (octave_idx_type i = dv_old_orig_len; i < n; i++) dv_old.elem (i) = 1; } - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { if (index_in_bounds (ra_idx, dv_old)) rep->elem (i) = old_data[get_scalar_idx (ra_idx, dv_old)]; @@ -942,7 +943,7 @@ } } else - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) rep->elem (i) = val; if (--old_rep->count <= 0) @@ -951,7 +952,7 @@ template Array& -Array::insert (const Array& a, int r, int c) +Array::insert (const Array& a, octave_idx_type r, octave_idx_type c) { if (ndims () == 2 && a.ndims () == 2) insert2 (a, r, c); @@ -964,10 +965,10 @@ template Array& -Array::insert2 (const Array& a, int r, int c) +Array::insert2 (const Array& a, octave_idx_type r, octave_idx_type c) { - int a_rows = a.rows (); - int a_cols = a.cols (); + octave_idx_type a_rows = a.rows (); + octave_idx_type a_cols = a.cols (); if (r < 0 || r + a_rows > rows () || c < 0 || c + a_cols > cols ()) { @@ -975,8 +976,8 @@ return *this; } - for (int j = 0; j < a_cols; j++) - for (int i = 0; i < a_rows; i++) + for (octave_idx_type j = 0; j < a_cols; j++) + for (octave_idx_type i = 0; i < a_rows; i++) elem (r+i, c+j) = a.elem (i, j); return *this; @@ -984,7 +985,7 @@ template Array& -Array::insertN (const Array& a, int r, int c) +Array::insertN (const Array& a, octave_idx_type r, octave_idx_type c) { dim_vector dv = dims (); @@ -994,7 +995,7 @@ if (n == dimensions.length ()) { - Array a_ra_idx (a_dv.length (), 0); + Array a_ra_idx (a_dv.length (), 0); a_ra_idx.elem (0) = r; a_ra_idx.elem (1) = c; @@ -1009,21 +1010,21 @@ } } - int n_elt = a.numel (); + octave_idx_type n_elt = a.numel (); const T *a_data = a.data (); - int iidx = 0; + octave_idx_type iidx = 0; - int a_rows = a_dv(0); - - int this_rows = dv(0); + octave_idx_type a_rows = a_dv(0); + + octave_idx_type this_rows = dv(0); - int numel_page = a_dv(0) * a_dv(1); - - int count_pages = 0; + octave_idx_type numel_page = a_dv(0) * a_dv(1); + + octave_idx_type count_pages = 0; - for (int i = 0; i < n_elt; i++) + for (octave_idx_type i = 0; i < n_elt; i++) { if (i != 0 && i % a_rows == 0) iidx += (this_rows - a_rows); @@ -1043,9 +1044,9 @@ template Array& -Array::insert (const Array& a, const Array& ra_idx) +Array::insert (const Array& a, const Array& ra_idx) { - int n = ra_idx.length (); + octave_idx_type n = ra_idx.length (); if (n == dimensions.length ()) { @@ -1054,7 +1055,7 @@ int len_a = dva.length (); int non_full_dim = 0; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { if (ra_idx(i) < 0 || (ra_idx(i) + (i < len_a ? dva(i) : 1)) > dimensions(i)) @@ -1074,8 +1075,8 @@ { // Special case for fast concatenation const T *a_data = a.data (); - int numel_to_move = 1; - int skip = 0; + octave_idx_type numel_to_move = 1; + octave_idx_type skip = 0; for (int i = 0; i < len_a; i++) if (ra_idx(i) == 0 && dva(i) == dv(i)) numel_to_move *= dva(i); @@ -1086,18 +1087,18 @@ break; } - int jidx = ra_idx(n-1); + octave_idx_type jidx = ra_idx(n-1); for (int i = n-2; i >= 0; i--) { jidx *= dv(i); jidx += ra_idx(i); } - int iidx = 0; - int moves = dva.numel () / numel_to_move; - for (int i = 0; i < moves; i++) + octave_idx_type iidx = 0; + octave_idx_type moves = dva.numel () / numel_to_move; + for (octave_idx_type i = 0; i < moves; i++) { - for (int j = 0; j < numel_to_move; j++) + for (octave_idx_type j = 0; j < numel_to_move; j++) elem (jidx++) = a_data[iidx++]; jidx += skip; } @@ -1107,7 +1108,7 @@ // Generic code const T *a_data = a.data (); int nel = a.numel (); - Array a_idx (n, 0); + Array a_idx (n, 0); for (int i = 0; i < nel; i++) { @@ -1138,15 +1139,15 @@ { assert (ndims () == 2); - int nr = dim1 (); - int nc = dim2 (); + octave_idx_type nr = dim1 (); + octave_idx_type nc = dim2 (); if (nr > 1 && nc > 1) { Array result (dim_vector (nc, nr)); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) result.xelem (j, i) = xelem (i, j); return result; @@ -1261,7 +1262,7 @@ void Array::maybe_delete_elements_1 (idx_vector& idx_arg) { - int len = length (); + octave_idx_type len = length (); if (len == 0) return; @@ -1274,11 +1275,11 @@ if (num_to_delete != 0) { - int new_len = len; - - int iidx = 0; - - for (int i = 0; i < len; i++) + octave_idx_type new_len = len; + + octave_idx_type iidx = 0; + + for (octave_idx_type i = 0; i < len; i++) if (i == idx_arg.elem (iidx)) { iidx++; @@ -1292,9 +1293,9 @@ { T *new_data = new T [new_len]; - int ii = 0; + octave_idx_type ii = 0; iidx = 0; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { if (iidx < num_to_delete && i == idx_arg.elem (iidx)) iidx++; @@ -1326,13 +1327,13 @@ { assert (ndims () == 2); - int nr = dim1 (); - int nc = dim2 (); + octave_idx_type nr = dim1 (); + octave_idx_type nc = dim2 (); if (nr == 0 && nc == 0) return; - int n; + octave_idx_type n; if (nr == 1) n = nc; else if (nc == 1) @@ -1359,15 +1360,15 @@ idx_arg.sort (true); - int num_to_delete = idx_arg.length (n); + octave_idx_type num_to_delete = idx_arg.length (n); if (num_to_delete != 0) { - int new_n = n; - - int iidx = 0; - - for (int i = 0; i < n; i++) + octave_idx_type new_n = n; + + octave_idx_type iidx = 0; + + for (octave_idx_type i = 0; i < n; i++) if (i == idx_arg.elem (iidx)) { iidx++; @@ -1381,9 +1382,9 @@ { T *new_data = new T [new_n]; - int ii = 0; + octave_idx_type ii = 0; iidx = 0; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { if (iidx < num_to_delete && i == idx_arg.elem (iidx)) iidx++; @@ -1425,8 +1426,8 @@ { assert (ndims () == 2); - int nr = dim1 (); - int nc = dim2 (); + octave_idx_type nr = dim1 (); + octave_idx_type nc = dim2 (); if (nr == 0 && nc == 0) return; @@ -1471,7 +1472,7 @@ { idx_j.sort (true); - int num_to_delete = idx_j.length (nc); + octave_idx_type num_to_delete = idx_j.length (nc); if (num_to_delete != 0) { @@ -1479,11 +1480,11 @@ resize_no_fill (0, 0); else { - int new_nc = nc; - - int iidx = 0; - - for (int j = 0; j < nc; j++) + octave_idx_type new_nc = nc; + + octave_idx_type iidx = 0; + + for (octave_idx_type j = 0; j < nc; j++) if (j == idx_j.elem (iidx)) { iidx++; @@ -1497,15 +1498,15 @@ { T *new_data = new T [nr * new_nc]; - int jj = 0; + octave_idx_type jj = 0; iidx = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { if (iidx < num_to_delete && j == idx_j.elem (iidx)) iidx++; else { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) new_data[nr*jj+i] = elem (i, j); jj++; } @@ -1534,7 +1535,7 @@ { idx_i.sort (true); - int num_to_delete = idx_i.length (nr); + octave_idx_type num_to_delete = idx_i.length (nr); if (num_to_delete != 0) { @@ -1542,11 +1543,11 @@ resize_no_fill (0, 0); else { - int new_nr = nr; - - int iidx = 0; - - for (int i = 0; i < nr; i++) + octave_idx_type new_nr = nr; + + octave_idx_type iidx = 0; + + for (octave_idx_type i = 0; i < nr; i++) if (i == idx_i.elem (iidx)) { iidx++; @@ -1560,15 +1561,15 @@ { T *new_data = new T [new_nr * nc]; - int ii = 0; + octave_idx_type ii = 0; iidx = 0; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { if (iidx < num_to_delete && i == idx_i.elem (iidx)) iidx++; else { - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) new_data[new_nr*j+ii] = elem (i, j); ii++; } @@ -1602,7 +1603,7 @@ void Array::maybe_delete_elements (Array& ra_idx, const T& rfv) { - int n_idx = ra_idx.length (); + octave_idx_type n_idx = ra_idx.length (); dim_vector lhs_dims = dims (); @@ -1617,7 +1618,7 @@ // Initialization of colon arrays. - for (int i = 0; i < n_idx; i++) + for (octave_idx_type i = 0; i < n_idx; i++) { idx_is_colon_equiv(i) = ra_idx(i).is_colon_equiv (lhs_dims(i), 1); @@ -1628,7 +1629,7 @@ // Check for index out of bounds. - for (int i = 0 ; i < n_idx - 1; i++) + for (octave_idx_type i = 0 ; i < n_idx - 1; i++) { if (! (idx_is_colon(i) || idx_is_colon_equiv(i))) { @@ -1655,11 +1656,11 @@ if (n_idx <= n_lhs_dims) { - int last_idx = ra_idx(n_idx-1).max (); - - int sum_el = lhs_dims(n_idx-1); - - for (int i = n_idx; i < n_lhs_dims; i++) + octave_idx_type last_idx = ra_idx(n_idx-1).max (); + + octave_idx_type sum_el = lhs_dims(n_idx-1); + + for (octave_idx_type i = n_idx; i < n_lhs_dims; i++) sum_el *= lhs_dims(i); if (last_idx > sum_el - 1) @@ -1702,7 +1703,7 @@ dim_vector temp_dims; temp_dims.resize (n_idx); - for (int i = 0; i < n_idx; i++) + for (octave_idx_type i = 0; i < n_idx; i++) { if (idx_is_colon (i)) temp_dims(i) = lhs_dims(i); @@ -1725,7 +1726,7 @@ (*current_liboctave_warning_handler) ("fewer indices than dimensions for N-d array"); - for (int i = n_idx; i < n_lhs_dims; i++) + for (octave_idx_type i = n_idx; i < n_lhs_dims; i++) lhs_dims(n_idx-1) *= lhs_dims(i); lhs_dims.resize (n_idx); @@ -1738,7 +1739,7 @@ // Find the non-colon column. - for (int i = 0; i < n_idx; i++) + for (octave_idx_type i = 0; i < n_idx; i++) { if (! idx_is_colon(i)) non_col = i; @@ -1746,9 +1747,9 @@ // The length of the non-colon dimension. - int non_col_dim = lhs_dims (non_col); - - int num_to_delete = ra_idx(non_col).length (lhs_dims (non_col)); + octave_idx_type non_col_dim = lhs_dims (non_col); + + octave_idx_type num_to_delete = ra_idx(non_col).length (lhs_dims (non_col)); if (num_to_delete > 0) { @@ -1771,11 +1772,11 @@ // New length of non-colon dimension // (calculated in the next for loop) - int new_dim = non_col_dim; - - int iidx = 0; - - for (int j = 0; j < non_col_dim; j++) + octave_idx_type new_dim = non_col_dim; + + octave_idx_type iidx = 0; + + for (octave_idx_type j = 0; j < non_col_dim; j++) if (j == ra_idx(non_col).elem (iidx)) { iidx++; @@ -1792,7 +1793,7 @@ { // Calculate number of elements in new array. - int num_new_elem=1; + octave_idx_type num_new_elem=1; for (int i = 0; i < n_idx; i++) { @@ -1805,17 +1806,17 @@ T *new_data = new T [num_new_elem]; - Array result_idx (n_lhs_dims, 0); + Array result_idx (n_lhs_dims, 0); dim_vector new_lhs_dim = lhs_dims; new_lhs_dim(non_col) = new_dim; - int num_elem = 1; - - int numidx = 0; - - int n = length (); + octave_idx_type num_elem = 1; + + octave_idx_type numidx = 0; + + octave_idx_type n = length (); for (int i = 0; i < n_lhs_dims; i++) if (i != non_col) @@ -1823,7 +1824,7 @@ num_elem *= ra_idx(non_col).capacity (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { if (numidx < num_elem && is_in (result_idx(non_col), ra_idx(non_col))) @@ -1831,14 +1832,14 @@ else { - Array temp_result_idx = result_idx; - - int num_lgt = how_many_lgt (result_idx(non_col), + Array temp_result_idx = result_idx; + + octave_idx_type num_lgt = how_many_lgt (result_idx(non_col), ra_idx(non_col)); temp_result_idx(non_col) -= num_lgt; - int kidx + octave_idx_type kidx = ::compute_index (temp_result_idx, new_lhs_dim); new_data[kidx] = elem (result_idx); @@ -1870,7 +1871,7 @@ // A(3,3,3)=2; // A(3:5) = []; A(6)=[] - int lhs_numel = numel (); + octave_idx_type lhs_numel = numel (); idx_vector idx_vec = ra_idx(0); @@ -1878,20 +1879,20 @@ idx_vec.sort (true); - int num_to_delete = idx_vec.length (lhs_numel); + octave_idx_type num_to_delete = idx_vec.length (lhs_numel); if (num_to_delete > 0) { - int new_numel = lhs_numel - num_to_delete; + octave_idx_type new_numel = lhs_numel - num_to_delete; T *new_data = new T[new_numel]; - Array lhs_ra_idx (ndims (), 0); - - int ii = 0; - int iidx = 0; - - for (int i = 0; i < lhs_numel; i++) + Array lhs_ra_idx (ndims (), 0); + + octave_idx_type ii = 0; + octave_idx_type iidx = 0; + + for (octave_idx_type i = 0; i < lhs_numel; i++) { if (iidx < num_to_delete && i == idx_vec.elem (iidx)) { @@ -2000,9 +2001,9 @@ { Array retval; - int len = length (); - - int n = idx_arg.freeze (len, "vector", resize_ok); + octave_idx_type len = length (); + + octave_idx_type n = idx_arg.freeze (len, "vector", resize_ok); if (idx_arg) { @@ -2024,9 +2025,9 @@ { retval.resize_no_fill (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { - int ii = idx_arg.elem (i); + octave_idx_type ii = idx_arg.elem (i); if (ii >= len) retval.elem (i) = rfv; else @@ -2048,22 +2049,22 @@ assert (ndims () == 2); - int nr = dim1 (); - int nc = dim2 (); - - int orig_len = nr * nc; + octave_idx_type nr = dim1 (); + octave_idx_type nc = dim2 (); + + octave_idx_type orig_len = nr * nc; dim_vector idx_orig_dims = idx_arg.orig_dimensions (); - int idx_orig_rows = idx_arg.orig_rows (); - int idx_orig_columns = idx_arg.orig_columns (); + octave_idx_type idx_orig_rows = idx_arg.orig_rows (); + octave_idx_type idx_orig_columns = idx_arg.orig_columns (); if (idx_arg.is_colon ()) { // Fast magic colon processing. - int result_nr = nr * nc; - int result_nc = 1; + octave_idx_type result_nr = nr * nc; + octave_idx_type result_nc = 1; retval = Array (*this, dim_vector (result_nr, result_nc)); } @@ -2071,7 +2072,7 @@ { Array tmp = Array::index1 (idx_arg, resize_ok); - int len = tmp.length (); + octave_idx_type len = tmp.length (); if (len == 0 && idx_arg.one_zero_only ()) retval = Array (tmp, dim_vector (0, 0)); @@ -2086,7 +2087,7 @@ Array tmp = Array::index1 (idx_arg, resize_ok); - int len = tmp.length (); + octave_idx_type len = tmp.length (); if ((len != 0 && idx_arg.one_zero_only ()) || idx_orig_rows == 1 || idx_orig_columns == 1) @@ -2114,8 +2115,8 @@ if (idx_arg) { - int result_nr = idx_orig_rows; - int result_nc = idx_orig_columns; + octave_idx_type result_nr = idx_orig_rows; + octave_idx_type result_nc = idx_orig_columns; if (idx_arg.one_zero_only ()) { @@ -2125,18 +2126,18 @@ retval.resize_no_fill (result_nr, result_nc); - int k = 0; - for (int j = 0; j < result_nc; j++) + octave_idx_type k = 0; + for (octave_idx_type j = 0; j < result_nc; j++) { - for (int i = 0; i < result_nr; i++) + for (octave_idx_type i = 0; i < result_nr; i++) { - int ii = idx_arg.elem (k++); + octave_idx_type ii = idx_arg.elem (k++); if (ii >= orig_len) retval.elem (i, j) = rfv; else { - int fr = ii % nr; - int fc = (ii - fr) / nr; + octave_idx_type fr = ii % nr; + octave_idx_type fc = (ii - fr) / nr; retval.elem (i, j) = elem (fr, fc); } } @@ -2156,7 +2157,7 @@ int n_dims = dims().length (); - int orig_len = dims().numel (); + octave_idx_type orig_len = dims().numel (); dim_vector idx_orig_dims = ra_idx.orig_dimensions (); @@ -2172,7 +2173,7 @@ Array tmp = Array::index (ra_idx, resize_ok); - int len = tmp.length (); + octave_idx_type len = tmp.length (); if (len != 0) { @@ -2188,7 +2189,7 @@ Array tmp = Array::index (ra_idx, resize_ok); - int len = tmp.length (); + octave_idx_type len = tmp.length (); if (len == 0) { @@ -2254,7 +2255,7 @@ if (ra_idx.one_zero_only ()) { result_dims.resize (2); - int ntot = ra_idx.ones_count (); + octave_idx_type ntot = ra_idx.ones_count (); result_dims(0) = ntot; result_dims(1) = (ntot > 0 ? 1 : 0); } @@ -2263,17 +2264,17 @@ retval.resize (result_dims); - int n = result_dims.numel (); + octave_idx_type n = result_dims.numel (); int r_dims = result_dims.length (); - Array iidx (r_dims, 0); - - int k = 0; - - for (int i = 0; i < n; i++) + Array iidx (r_dims, 0); + + octave_idx_type k = 0; + + for (octave_idx_type i = 0; i < n; i++) { - int ii = ra_idx.elem (k++); + octave_idx_type ii = ra_idx.elem (k++); if (ii >= orig_len) retval.elem (iidx) = rfv; @@ -2301,11 +2302,11 @@ assert (ndims () == 2); - int nr = dim1 (); - int nc = dim2 (); - - int n = idx_i.freeze (nr, "row", resize_ok); - int m = idx_j.freeze (nc, "column", resize_ok); + octave_idx_type nr = dim1 (); + octave_idx_type nc = dim2 (); + + octave_idx_type n = idx_i.freeze (nr, "row", resize_ok); + octave_idx_type m = idx_j.freeze (nc, "column", resize_ok); if (idx_i && idx_j) { @@ -2321,12 +2322,12 @@ { retval.resize_no_fill (n, m); - for (int j = 0; j < m; j++) + for (octave_idx_type j = 0; j < m; j++) { - int jj = idx_j.elem (j); - for (int i = 0; i < n; i++) + octave_idx_type jj = idx_j.elem (j); + for (octave_idx_type i = 0; i < n; i++) { - int ii = idx_i.elem (i); + octave_idx_type ii = idx_i.elem (i); if (ii >= nr || jj >= nc) retval.elem (i, j) = rfv; else @@ -2355,10 +2356,10 @@ // Remove trailing singletons in ra_idx, but leave at least ndims // elements. - int ra_idx_len = ra_idx.length (); + octave_idx_type ra_idx_len = ra_idx.length (); bool trim_trailing_singletons = true; - for (int j = ra_idx_len; j > n_dims; j--) + for (octave_idx_type j = ra_idx_len; j > n_dims; j--) { idx_vector iidx = ra_idx (ra_idx_len-1); if (iidx.capacity () == 1 && trim_trailing_singletons) @@ -2366,7 +2367,7 @@ else trim_trailing_singletons = false; - for (int i = 0; i < iidx.capacity (); i++) + for (octave_idx_type i = 0; i < iidx.capacity (); i++) if (iidx (i) != 0) { (*current_liboctave_error_handler) @@ -2410,17 +2411,17 @@ retval.resize (frozen_lengths_for_resize); - int n = retval.length (); - - Array result_idx (ra_idx.length (), 0); - - Array elt_idx; - - for (int i = 0; i < n; i++) + octave_idx_type n = retval.length (); + + Array result_idx (ra_idx.length (), 0); + + Array elt_idx; + + for (octave_idx_type i = 0; i < n; i++) { elt_idx = get_elt_idx (ra_idx, result_idx); - int numelem_elt = get_scalar_idx (elt_idx, new_dims); + octave_idx_type numelem_elt = get_scalar_idx (elt_idx, new_dims); if (numelem_elt > length () || numelem_elt < 0) (*current_liboctave_error_handler) @@ -2496,25 +2497,25 @@ idx_vector lhs_idx = tmp[0]; - int lhs_len = lhs.length (); - int rhs_len = rhs.length (); - - int n = lhs_idx.freeze (lhs_len, "vector", true, liboctave_wrore_flag); + octave_idx_type lhs_len = lhs.length (); + octave_idx_type rhs_len = rhs.length (); + + octave_idx_type n = lhs_idx.freeze (lhs_len, "vector", true, liboctave_wrore_flag); if (n != 0) { if (rhs_len == n || rhs_len == 1) { - int max_idx = lhs_idx.max () + 1; + octave_idx_type max_idx = lhs_idx.max () + 1; if (max_idx > lhs_len) lhs.resize_and_fill (max_idx, rfv); } if (rhs_len == n) { - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { - int ii = lhs_idx.elem (i); + octave_idx_type ii = lhs_idx.elem (i); lhs.elem (ii) = rhs.elem (i); } } @@ -2522,9 +2523,9 @@ { RT scalar = rhs.elem (0); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { - int ii = lhs_idx.elem (i); + octave_idx_type ii = lhs_idx.elem (i); lhs.elem (ii) = scalar; } } @@ -2542,7 +2543,7 @@ { lhs.resize_no_fill (rhs_len); - for (int i = 0; i < rhs_len; i++) + for (octave_idx_type i = 0; i < rhs_len; i++) lhs.elem (i) = rhs.elem (i); } else @@ -2565,11 +2566,11 @@ #define MAYBE_RESIZE_LHS \ do \ { \ - int max_row_idx = idx_i_is_colon ? rhs_nr : idx_i.max () + 1; \ - int max_col_idx = idx_j_is_colon ? rhs_nc : idx_j.max () + 1; \ + octave_idx_type max_row_idx = idx_i_is_colon ? rhs_nr : idx_i.max () + 1; \ + octave_idx_type max_col_idx = idx_j_is_colon ? rhs_nc : idx_j.max () + 1; \ \ - int new_nr = max_row_idx > lhs_nr ? max_row_idx : lhs_nr; \ - int new_nc = max_col_idx > lhs_nc ? max_col_idx : lhs_nc; \ + octave_idx_type new_nr = max_row_idx > lhs_nr ? max_row_idx : lhs_nr; \ + octave_idx_type new_nc = max_col_idx > lhs_nc ? max_col_idx : lhs_nc; \ \ lhs.resize_and_fill (new_nr, new_nc, rfv); \ } \ @@ -2583,13 +2584,13 @@ int n_idx = lhs.index_count (); - int lhs_nr = lhs.rows (); - int lhs_nc = lhs.cols (); + octave_idx_type lhs_nr = lhs.rows (); + octave_idx_type lhs_nc = lhs.cols (); Array xrhs = rhs; - int rhs_nr = xrhs.rows (); - int rhs_nc = xrhs.cols (); + octave_idx_type rhs_nr = xrhs.rows (); + octave_idx_type rhs_nc = xrhs.cols (); if (xrhs.ndims () > 2) { @@ -2631,9 +2632,9 @@ if (n_idx == 2) { - int n = idx_i.freeze (lhs_nr, "row", true, liboctave_wrore_flag); - - int m = idx_j.freeze (lhs_nc, "column", true, liboctave_wrore_flag); + octave_idx_type n = idx_i.freeze (lhs_nr, "row", true, liboctave_wrore_flag); + + octave_idx_type m = idx_j.freeze (lhs_nc, "column", true, liboctave_wrore_flag); int idx_i_is_colon = idx_i.is_colon (); int idx_j_is_colon = idx_j.is_colon (); @@ -2663,12 +2664,12 @@ RT scalar = xrhs.elem (0, 0); - for (int j = 0; j < m; j++) + for (octave_idx_type j = 0; j < m; j++) { - int jj = idx_j.elem (j); - for (int i = 0; i < n; i++) + octave_idx_type jj = idx_j.elem (j); + for (octave_idx_type i = 0; i < n; i++) { - int ii = idx_i.elem (i); + octave_idx_type ii = idx_i.elem (i); lhs.elem (ii, jj) = scalar; } } @@ -2680,12 +2681,12 @@ { MAYBE_RESIZE_LHS; - for (int j = 0; j < m; j++) + for (octave_idx_type j = 0; j < m; j++) { - int jj = idx_j.elem (j); - for (int i = 0; i < n; i++) + octave_idx_type jj = idx_j.elem (j); + for (octave_idx_type i = 0; i < n; i++) { - int ii = idx_i.elem (i); + octave_idx_type ii = idx_i.elem (i); lhs.elem (ii, jj) = xrhs.elem (i, j); } } @@ -2723,9 +2724,9 @@ if (lhs_is_empty || (lhs_nr == 1 && lhs_nc == 1)) { - int lhs_len = lhs.length (); - - int n = idx_i.freeze (lhs_len, 0, true, liboctave_wrore_flag); + octave_idx_type lhs_len = lhs.length (); + + octave_idx_type n = idx_i.freeze (lhs_len, 0, true, liboctave_wrore_flag); if (idx_i) { @@ -2747,8 +2748,8 @@ } else { - int idx_nr = idx_i.orig_rows (); - int idx_nc = idx_i.orig_columns (); + octave_idx_type idx_nr = idx_i.orig_rows (); + octave_idx_type idx_nc = idx_i.orig_columns (); if (! (rhs_nr == idx_nr && rhs_nc == idx_nc)) (*current_liboctave_warning_handler) @@ -2758,7 +2759,7 @@ if (assign1 (lhs, xrhs, rfv)) { - int len = lhs.length (); + octave_idx_type len = lhs.length (); if (len > 0) { @@ -2823,7 +2824,7 @@ (*current_liboctave_warning_handler) ("single index used for matrix"); - int len = idx_i.freeze (lhs_nr * lhs_nc, "matrix"); + octave_idx_type len = idx_i.freeze (lhs_nr * lhs_nc, "matrix"); if (idx_i) { @@ -2838,14 +2839,14 @@ } else if (len == rhs_nr * rhs_nc) { - int k = 0; - for (int j = 0; j < rhs_nc; j++) + octave_idx_type k = 0; + for (octave_idx_type j = 0; j < rhs_nc; j++) { - for (int i = 0; i < rhs_nr; i++) + for (octave_idx_type i = 0; i < rhs_nr; i++) { - int ii = idx_i.elem (k++); - int fr = ii % lhs_nr; - int fc = (ii - fr) / lhs_nr; + octave_idx_type ii = idx_i.elem (k++); + octave_idx_type fr = ii % lhs_nr; + octave_idx_type fc = (ii - fr) / lhs_nr; lhs.elem (fr, fc) = xrhs.elem (i, j); } } @@ -2854,9 +2855,9 @@ { RT scalar = rhs.elem (0, 0); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { - int ii = idx_i.elem (i); + octave_idx_type ii = idx_i.elem (i); lhs.elem (ii) = scalar; } } @@ -2892,7 +2893,7 @@ dim_vector rhs_dims = rhs.dims (); - int rhs_dims_len = rhs_dims.length (); + octave_idx_type rhs_dims_len = rhs_dims.length (); bool rhs_is_scalar = is_scalar (rhs_dims); @@ -2917,9 +2918,9 @@ (*current_liboctave_warning_handler) ("single index used for N-d array"); - int lhs_len = lhs.length (); - - int len = iidx.freeze (lhs_len, "N-d arrray"); + octave_idx_type lhs_len = lhs.length (); + + octave_idx_type len = iidx.freeze (lhs_len, "N-d arrray"); if (iidx) { @@ -2935,9 +2936,9 @@ } else if (len == rhs.length ()) { - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { - int ii = iidx.elem (i); + octave_idx_type ii = iidx.elem (i); lhs.elem (ii) = rhs.elem (i); } @@ -2946,9 +2947,9 @@ { RT scalar = rhs.elem (0); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { - int ii = iidx.elem (i); + octave_idx_type ii = iidx.elem (i); lhs.elem (ii) = scalar; } @@ -2970,13 +2971,13 @@ dim_vector lhs_dims = lhs.dims (); - int lhs_dims_len = lhs_dims.length (); + octave_idx_type lhs_dims_len = lhs_dims.length (); dim_vector final_lhs_dims = lhs_dims; dim_vector frozen_len; - int orig_lhs_dims_len = lhs_dims_len; + octave_idx_type orig_lhs_dims_len = lhs_dims_len; bool orig_empty = lhs_dims.all_zero (); @@ -3089,15 +3090,15 @@ if (! final_lhs_dims.any_zero ()) { - int n = Array::get_size (frozen_len); - - Array result_idx (lhs_dims_len, 0); + octave_idx_type n = Array::get_size (frozen_len); + + Array result_idx (lhs_dims_len, 0); RT scalar = rhs.elem (0); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { - Array elt_idx = get_elt_idx (idx, result_idx); + Array elt_idx = get_elt_idx (idx, result_idx); lhs.elem (elt_idx) = scalar; @@ -3109,7 +3110,7 @@ { // RHS is matrix or higher dimension. - int n = Array::get_size (frozen_len); + octave_idx_type n = Array::get_size (frozen_len); if (n != rhs.numel ()) { @@ -3126,11 +3127,11 @@ { n = Array::get_size (frozen_len); - Array result_idx (lhs_dims_len, 0); - - for (int i = 0; i < n; i++) + Array result_idx (lhs_dims_len, 0); + + for (octave_idx_type i = 0; i < n; i++) { - Array elt_idx = get_elt_idx (idx, result_idx); + Array elt_idx = get_elt_idx (idx, result_idx); lhs.elem (elt_idx) = rhs.elem (i); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Array.h --- a/liboctave/Array.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Array.h Fri Apr 08 16:07:37 2005 +0000 @@ -59,16 +59,16 @@ public: T *data; - int len; + octave_idx_type len; int count; - ArrayRep (T *d, int l) : data (d), len (l), count (1) { } + ArrayRep (T *d, octave_idx_type l) : data (d), len (l), count (1) { } ArrayRep (void) : data (0), len (0), count (1) { } - explicit ArrayRep (int n) : data (new T [n]), len (n), count (1) { } + explicit ArrayRep (octave_idx_type n) : data (new T [n]), len (n), count (1) { } - explicit ArrayRep (int n, const T& val) + explicit ArrayRep (octave_idx_type n, const T& val) : data (new T [n]), len (n), count (1) { fill (val); @@ -77,23 +77,23 @@ ArrayRep (const ArrayRep& a) : data (new T [a.len]), len (a.len), count (1) { - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) data[i] = a.data[i]; } ~ArrayRep (void) { delete [] data; } - int length (void) const { return len; } + octave_idx_type length (void) const { return len; } void fill (const T& val) { - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) data[i] = val; } - T& elem (int n) { return data[n]; } + T& elem (octave_idx_type n) { return data[n]; } - T elem (int n) const { return data[n]; } + T elem (octave_idx_type n) const { return data[n]; } void qsort (int (*compare) (const void *, const void *)) { @@ -143,7 +143,7 @@ idx_vector *idx; int idx_count; - Array (T *d, int n) + Array (T *d, octave_idx_type n) : rep (new typename Array::ArrayRep (d, n)), dimensions (n), idx (0), idx_count (0) { } @@ -179,11 +179,11 @@ : rep (nil_rep ()), dimensions (), idx (0), idx_count (0) { rep->count++; } - explicit Array (int n) + explicit Array (octave_idx_type n) : rep (new typename Array::ArrayRep (n)), dimensions (n), idx (0), idx_count (0) { } - explicit Array (int n, const T& val) + explicit Array (octave_idx_type n, const T& val) : rep (new typename Array::ArrayRep (n)), dimensions (n), idx (0), idx_count (0) { @@ -243,19 +243,19 @@ void fill (const T& val) { make_unique (val); } - int capacity (void) const { return rep->length (); } - int length (void) const { return capacity (); } - int nelem (void) const { return capacity (); } - int numel (void) const { return nelem (); } + octave_idx_type capacity (void) const { return rep->length (); } + octave_idx_type length (void) const { return capacity (); } + octave_idx_type nelem (void) const { return capacity (); } + octave_idx_type numel (void) const { return nelem (); } - int dim1 (void) const { return dimensions(0); } - int dim2 (void) const { return dimensions(1); } - int dim3 (void) const { return dimensions(2); } + octave_idx_type dim1 (void) const { return dimensions(0); } + octave_idx_type dim2 (void) const { return dimensions(1); } + octave_idx_type dim3 (void) const { return dimensions(2); } - int rows (void) const { return dim1 (); } - int cols (void) const { return dim2 (); } - int columns (void) const { return dim2 (); } - int pages (void) const { return dim3 (); } + octave_idx_type rows (void) const { return dim1 (); } + octave_idx_type cols (void) const { return dim2 (); } + octave_idx_type columns (void) const { return dim2 (); } + octave_idx_type pages (void) const { return dim3 (); } size_t byte_size (void) const { return numel () * sizeof (T); } @@ -266,34 +266,34 @@ void chop_trailing_singletons (void) { dimensions.chop_trailing_singletons (); } - static int get_size (int r, int c); - static int get_size (int r, int c, int p); - static int get_size (const dim_vector& dv); + static octave_idx_type get_size (octave_idx_type r, octave_idx_type c); + static octave_idx_type get_size (octave_idx_type r, octave_idx_type c, octave_idx_type p); + static octave_idx_type get_size (const dim_vector& dv); - int compute_index (const Array& ra_idx) const; + octave_idx_type compute_index (const Array& ra_idx) const; - T range_error (const char *fcn, int n) const; - T& range_error (const char *fcn, int n); + T range_error (const char *fcn, octave_idx_type n) const; + T& range_error (const char *fcn, octave_idx_type n); - T range_error (const char *fcn, int i, int j) const; - T& range_error (const char *fcn, int i, int j); + T range_error (const char *fcn, octave_idx_type i, octave_idx_type j) const; + T& range_error (const char *fcn, octave_idx_type i, octave_idx_type j); - T range_error (const char *fcn, int i, int j, int k) const; - T& range_error (const char *fcn, int i, int j, int k); + T range_error (const char *fcn, octave_idx_type i, octave_idx_type j, octave_idx_type k) const; + T& range_error (const char *fcn, octave_idx_type i, octave_idx_type j, octave_idx_type k); T range_error (const char *fcn, const Array& ra_idx) const; T& range_error (const char *fcn, const Array& ra_idx); // No checking, even for multiple references, ever. - T& xelem (int n) { return rep->elem (n); } - T xelem (int n) const { return rep->elem (n); } + T& xelem (octave_idx_type n) { return rep->elem (n); } + T xelem (octave_idx_type n) const { return rep->elem (n); } - T& xelem (int i, int j) { return xelem (dim1()*j+i); } - T xelem (int i, int j) const { return xelem (dim1()*j+i); } + T& xelem (octave_idx_type i, octave_idx_type j) { return xelem (dim1()*j+i); } + T xelem (octave_idx_type i, octave_idx_type j) const { return xelem (dim1()*j+i); } - T& xelem (int i, int j, int k) { return xelem (i, dim2()*k+j); } - T xelem (int i, int j, int k) const { return xelem (i, dim2()*k+j); } + T& xelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return xelem (i, dim2()*k+j); } + T 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) { return xelem (compute_index (ra_idx)); } @@ -305,7 +305,7 @@ // unnecessarily force a copy, but that is not so easy, and I see no // clean way to do it. - T& checkelem (int n) + T& checkelem (octave_idx_type n) { if (n < 0 || n >= rep->length ()) return range_error ("T& Array::checkelem", n); @@ -316,7 +316,7 @@ } } - T& checkelem (int i, int j) + T& checkelem (octave_idx_type i, octave_idx_type j) { if (i < 0 || j < 0 || i >= dim1 () || j >= dim2 ()) return range_error ("T& Array::checkelem", i, j); @@ -324,7 +324,7 @@ return elem (dim1()*j+i); } - T& checkelem (int i, int j, int k) + T& checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) { if (i < 0 || j < 0 || k < 0 || i >= dim1 () || j >= dim2 () || k >= dim3 ()) return range_error ("T& Array::checkelem", i, j, k); @@ -334,7 +334,7 @@ T& checkelem (const Array& ra_idx) { - int i = compute_index (ra_idx); + octave_idx_type i = compute_index (ra_idx); if (i < 0) return range_error ("T& Array::checkelem", ra_idx); @@ -342,32 +342,32 @@ return elem (i); } - T& elem (int n) + T& elem (octave_idx_type n) { make_unique (); return xelem (n); } - T& elem (int i, int j) { return elem (dim1()*j+i); } + T& elem (octave_idx_type i, octave_idx_type j) { return elem (dim1()*j+i); } - T& elem (int i, int j, int k) { return elem (i, dim2()*k+j); } + T& elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return elem (i, dim2()*k+j); } T& elem (const Array& ra_idx) { return Array::elem (compute_index (ra_idx)); } #if defined (BOUNDS_CHECKING) - T& operator () (int n) { return checkelem (n); } - T& operator () (int i, int j) { return checkelem (i, j); } - T& operator () (int i, int j, int k) { return checkelem (i, j, k); } + T& operator () (octave_idx_type n) { return checkelem (n); } + T& operator () (octave_idx_type i, octave_idx_type j) { return checkelem (i, j); } + T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return checkelem (i, j, k); } T& operator () (const Array& ra_idx) { return checkelem (ra_idx); } #else - T& operator () (int n) { return elem (n); } - T& operator () (int i, int j) { return elem (i, j); } - T& operator () (int i, int j, int k) { return elem (i, j, k); } + T& operator () (octave_idx_type n) { return elem (n); } + T& operator () (octave_idx_type i, octave_idx_type j) { return elem (i, j); } + T& operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) { return elem (i, j, k); } T& operator () (const Array& ra_idx) { return elem (ra_idx); } #endif - T checkelem (int n) const + T checkelem (octave_idx_type n) const { if (n < 0 || n >= rep->length ()) return range_error ("T Array::checkelem", n); @@ -375,7 +375,7 @@ return xelem (n); } - T checkelem (int i, int j) const + T checkelem (octave_idx_type i, octave_idx_type j) const { if (i < 0 || j < 0 || i >= dim1 () || j >= dim2 ()) return range_error ("T Array::checkelem", i, j); @@ -383,7 +383,7 @@ return elem (dim1()*j+i); } - T checkelem (int i, int j, int k) const + T checkelem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { if (i < 0 || j < 0 || k < 0 || i >= dim1 () || j >= dim2 () || k >= dim3 ()) return range_error ("T Array::checkelem", i, j, k); @@ -393,7 +393,7 @@ T checkelem (const Array& ra_idx) const { - int i = compute_index (ra_idx); + octave_idx_type i = compute_index (ra_idx); if (i < 0) return range_error ("T Array::checkelem", ra_idx); @@ -401,35 +401,35 @@ return Array::elem (i); } - T elem (int n) const { return xelem (n); } + T elem (octave_idx_type n) const { return xelem (n); } - T elem (int i, int j) const { return elem (dim1()*j+i); } + T elem (octave_idx_type i, octave_idx_type j) const { return elem (dim1()*j+i); } - T elem (int i, int j, int k) const { return elem (i, dim2()*k+j); } + T elem (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { return elem (i, dim2()*k+j); } T elem (const Array& ra_idx) const { return Array::elem (compute_index (ra_idx)); } #if defined (BOUNDS_CHECKING) - T operator () (int n) const { return checkelem (n); } - T operator () (int i, int j) const { return checkelem (i, j); } - T operator () (int i, int j, int k) const { return checkelem (i, j, k); } + T operator () (octave_idx_type n) const { return checkelem (n); } + T operator () (octave_idx_type i, octave_idx_type j) const { return checkelem (i, j); } + T operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { return checkelem (i, j, k); } T operator () (const Array& ra_idx) const { return checkelem (ra_idx); } #else - T operator () (int n) const { return elem (n); } - T operator () (int i, int j) const { return elem (i, j); } - T operator () (int i, int j, int k) const { return elem (i, j, k); } + T operator () (octave_idx_type n) const { return elem (n); } + T operator () (octave_idx_type i, octave_idx_type j) const { return elem (i, j); } + T operator () (octave_idx_type i, octave_idx_type j, octave_idx_type k) const { return elem (i, j, k); } T operator () (const Array& ra_idx) const { return elem (ra_idx); } #endif Array reshape (const dim_vector& new_dims) const; - Array permute (const Array& vec, bool inv = false) const; - Array ipermute (const Array& vec) const + Array permute (const Array& vec, bool inv = false) const; + Array ipermute (const Array& vec) const { return permute (vec, true); } - void resize_no_fill (int n); - void resize_and_fill (int n, const T& val); + void resize_no_fill (octave_idx_type n); + void resize_and_fill (octave_idx_type n, const T& val); // !!! WARNING !!! -- the following resize_no_fill and // resize_and_fill functions are public because template friends @@ -439,11 +439,11 @@ // protected: - void resize_no_fill (int r, int c); - void resize_and_fill (int r, int c, const T& val); + void resize_no_fill (octave_idx_type r, octave_idx_type c); + void resize_and_fill (octave_idx_type r, octave_idx_type c, const T& val); - void resize_no_fill (int r, int c, int p); - void resize_and_fill (int r, int c, int p, const T& val); + void resize_no_fill (octave_idx_type r, octave_idx_type c, octave_idx_type p); + void resize_and_fill (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val); void resize_no_fill (const dim_vector& dv); void resize_and_fill (const dim_vector& dv, const T& val); @@ -459,11 +459,11 @@ void resize (const dim_vector& dv, const T& val) { resize_and_fill (dv, val); } - Array& insert (const Array& a, int r, int c); - Array& insert2 (const Array& a, int r, int c); - Array& insertN (const Array& a, int r, int c); + Array& insert (const Array& a, octave_idx_type r, octave_idx_type c); + Array& insert2 (const Array& a, octave_idx_type r, octave_idx_type c); + Array& insertN (const Array& a, octave_idx_type r, octave_idx_type c); - Array& insert (const Array& a, const Array& idx); + Array& insert (const Array& a, const Array& idx); bool is_square (void) const { return (dim1 () == dim2 ()); } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Array2.h --- a/liboctave/Array2.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Array2.h Fri Apr 08 16:07:37 2005 +0000 @@ -42,22 +42,22 @@ { protected: - static int get_size (int r, int c) { return Array::get_size (r, c); } + static octave_idx_type get_size (octave_idx_type r, octave_idx_type c) { return Array::get_size (r, c); } - Array2 (T *d, int r, int c) : Array (d, dim_vector (r, c)) { } + Array2 (T *d, octave_idx_type r, octave_idx_type c) : Array (d, dim_vector (r, c)) { } public: Array2 (void) : Array (dim_vector (0, 0)) { } - Array2 (int r, int c) : Array (dim_vector (r, c)) { } + Array2 (octave_idx_type r, octave_idx_type c) : Array (dim_vector (r, c)) { } - Array2 (int r, int c, const T& val) + Array2 (octave_idx_type r, octave_idx_type c, const T& val) : Array (dim_vector (r, c), val) { } Array2 (const Array2& a) : Array (a, a.dims ()) { } - Array2 (const Array& a, int r, int c) + Array2 (const Array& a, octave_idx_type r, octave_idx_type c) : Array (a, dim_vector (r, c)) { } ~Array2 (void) { } @@ -70,12 +70,12 @@ return *this; } - void resize (int r, int c) { this->resize_no_fill (r, c); } + void resize (octave_idx_type r, octave_idx_type c) { this->resize_no_fill (r, c); } - void resize (int r, int c, const T& val) + void resize (octave_idx_type r, octave_idx_type c, const T& val) { this->resize_and_fill (r, c, val); } - Array2& insert (const Array2& a, int r, int c) + Array2& insert (const Array2& a, octave_idx_type r, octave_idx_type c) { Array::insert (a, r, c); return *this; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Array3.h --- a/liboctave/Array3.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Array3.h Fri Apr 08 16:07:37 2005 +0000 @@ -40,24 +40,24 @@ { protected: - static int get_size (int r, int c, int p) + static octave_idx_type get_size (octave_idx_type r, octave_idx_type c, octave_idx_type p) { return Array::get_size (r, c, p); } - Array3 (T *d, int r, int c, int p) : Array (d, dim_vector (r, c, p)) { } + Array3 (T *d, octave_idx_type r, octave_idx_type c, octave_idx_type p) : Array (d, dim_vector (r, c, p)) { } public: Array3 (void) : Array (dim_vector (0, 0, 0)) { } - Array3 (int r, int c, int p) : Array (dim_vector (r, c, p)) { } + Array3 (octave_idx_type r, octave_idx_type c, octave_idx_type p) : Array (dim_vector (r, c, p)) { } - Array3 (int r, int c, int p, const T& val) + Array3 (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val) : Array (dim_vector (r, c, p), val) { } Array3 (const Array3& a) : Array (a, a.dims ()) { } - Array3 (const Array& a, int r, int c, int p) + Array3 (const Array& a, octave_idx_type r, octave_idx_type c, octave_idx_type p) : Array (a, dim_vector (r, c, p)) { } ~Array3 (void) { } @@ -70,9 +70,9 @@ return *this; } - void resize (int r, int c, int p) { this->resize_no_fill (r, c, p); } + void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p) { this->resize_no_fill (r, c, p); } - void resize (int r, int c, int p, const T& val) + void resize (octave_idx_type r, octave_idx_type c, octave_idx_type p, const T& val) { this->resize_and_fill (r, c, p, val); } }; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/ArrayN.cc --- a/liboctave/ArrayN.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/ArrayN.cc Fri Apr 08 16:07:37 2005 +0000 @@ -56,18 +56,18 @@ { os << "data:"; - Array ra_idx (n_dims, 0); + Array ra_idx (n_dims, 0); // Number of times the first 2d-array is to be displayed. - int m = 1; + octave_idx_type m = 1; for (int i = 2; i < n_dims; i++) m *= a_dims(i); if (m == 1) { - int rows = 0; - int cols = 0; + octave_idx_type rows = 0; + octave_idx_type cols = 0; switch (n_dims) { @@ -75,10 +75,10 @@ rows = a_dims(0); cols = a_dims(1); - for (int j = 0; j < rows; j++) + for (octave_idx_type j = 0; j < rows; j++) { ra_idx(0) = j; - for (int k = 0; k < cols; k++) + for (octave_idx_type k = 0; k < cols; k++) { ra_idx(1) = k; os << " " << a.elem(ra_idx); @@ -90,7 +90,7 @@ default: rows = a_dims(0); - for (int k = 0; k < rows; k++) + for (octave_idx_type k = 0; k < rows; k++) { ra_idx(0) = k; os << " " << a.elem(ra_idx); @@ -102,8 +102,8 @@ } else { - int rows = a_dims(0); - int cols = a_dims(1); + octave_idx_type rows = a_dims(0); + octave_idx_type cols = a_dims(1); for (int i = 0; i < m; i++) { @@ -114,11 +114,11 @@ os << ra_idx(n_dims - 1) + 1 << ") = \n"; - for (int j = 0; j < rows; j++) + for (octave_idx_type j = 0; j < rows; j++) { ra_idx(0) = j; - for (int k = 0; k < cols; k++) + for (octave_idx_type k = 0; k < cols; k++) { ra_idx(1) = k; os << " " << a.elem(ra_idx); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/ArrayN.h --- a/liboctave/ArrayN.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/ArrayN.h Fri Apr 08 16:07:37 2005 +0000 @@ -108,7 +108,7 @@ return *this; } - ArrayN& insert (const ArrayN& a, int r, int c) + ArrayN& insert (const ArrayN& a, octave_idx_type r, octave_idx_type c) { Array::insert (a, r, c); return *this; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Bounds.cc --- a/liboctave/Bounds.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Bounds.cc Fri Apr 08 16:07:37 2005 +0000 @@ -83,7 +83,7 @@ std::ostream& operator << (std::ostream& os, const Bounds& b) { - for (int i = 0; i < b.size (); i++) + for (octave_idx_type i = 0; i < b.size (); i++) os << b.lower_bound (i) << " " << b.upper_bound (i) << "\n"; return os; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Bounds.h --- a/liboctave/Bounds.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Bounds.h Fri Apr 08 16:07:37 2005 +0000 @@ -35,7 +35,7 @@ Bounds (void) : lb (), ub () { } - Bounds (int n) + Bounds (octave_idx_type n) : lb (n, 0.0), ub (n, 0.0) { } Bounds (const ColumnVector l, const ColumnVector u) @@ -63,7 +63,7 @@ ~Bounds (void) { } - Bounds& resize (int n) + Bounds& resize (octave_idx_type n) { lb.resize (n); ub.resize (n); @@ -71,15 +71,15 @@ return *this; } - double lower_bound (int index) const { return lb.elem (index); } - double upper_bound (int index) const { return ub.elem (index); } + double lower_bound (octave_idx_type index) const { return lb.elem (index); } + double upper_bound (octave_idx_type index) const { return ub.elem (index); } ColumnVector lower_bounds (void) const { return lb; } ColumnVector upper_bounds (void) const { return ub; } - int size (void) const { return lb.capacity (); } + octave_idx_type size (void) const { return lb.capacity (); } - Bounds& set_bound (int index, double low, double high) + Bounds& set_bound (octave_idx_type index, double low, double high) { lb.elem (index) = low; ub.elem (index) = high; @@ -95,13 +95,13 @@ Bounds& set_bounds (const ColumnVector lb, const ColumnVector ub); - Bounds& set_lower_bound (int index, double low) + Bounds& set_lower_bound (octave_idx_type index, double low) { lb.elem (index) = low; return *this; } - Bounds& set_upper_bound (int index, double high) + Bounds& set_upper_bound (octave_idx_type index, double high) { ub.elem (index) = high; return *this; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CColVector.cc --- a/liboctave/CColVector.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CColVector.cc Fri Apr 08 16:07:37 2005 +0000 @@ -40,9 +40,9 @@ { F77_RET_T F77_FUNC (zgemv, ZGEMV) (F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const Complex&, - const Complex*, const int&, const Complex*, - const int&, const Complex&, Complex*, const int& + const octave_idx_type&, const octave_idx_type&, const Complex&, + const Complex*, const octave_idx_type&, const Complex*, + const octave_idx_type&, const Complex&, Complex*, const octave_idx_type& F77_CHAR_ARG_LEN_DECL); } @@ -51,14 +51,14 @@ ComplexColumnVector::ComplexColumnVector (const ColumnVector& a) : MArray (a.length ()) { - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) elem (i) = a.elem (i); } bool ComplexColumnVector::operator == (const ComplexColumnVector& a) const { - int len = length (); + octave_idx_type len = length (); if (len != a.length ()) return 0; return mx_inline_equal (data (), a.data (), len); @@ -73,9 +73,9 @@ // destructive insert/delete/reorder operations ComplexColumnVector& -ComplexColumnVector::insert (const ColumnVector& a, int r) +ComplexColumnVector::insert (const ColumnVector& a, octave_idx_type r) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (r < 0 || r + a_len > length ()) { @@ -87,7 +87,7 @@ { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (r+i) = a.elem (i); } @@ -95,9 +95,9 @@ } ComplexColumnVector& -ComplexColumnVector::insert (const ComplexColumnVector& a, int r) +ComplexColumnVector::insert (const ComplexColumnVector& a, octave_idx_type r) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (r < 0 || r + a_len > length ()) { @@ -109,7 +109,7 @@ { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (r+i) = a.elem (i); } @@ -119,13 +119,13 @@ ComplexColumnVector& ComplexColumnVector::fill (double val) { - int len = length (); + octave_idx_type len = length (); if (len > 0) { make_unique (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) xelem (i) = val; } @@ -135,13 +135,13 @@ ComplexColumnVector& ComplexColumnVector::fill (const Complex& val) { - int len = length (); + octave_idx_type len = length (); if (len > 0) { make_unique (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) xelem (i) = val; } @@ -150,9 +150,9 @@ } ComplexColumnVector& -ComplexColumnVector::fill (double val, int r1, int r2) +ComplexColumnVector::fill (double val, octave_idx_type r1, octave_idx_type r2) { - int len = length (); + octave_idx_type len = length (); if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) { @@ -160,13 +160,13 @@ return *this; } - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } if (r2 >= r1) { make_unique (); - for (int i = r1; i <= r2; i++) + for (octave_idx_type i = r1; i <= r2; i++) xelem (i) = val; } @@ -174,9 +174,9 @@ } ComplexColumnVector& -ComplexColumnVector::fill (const Complex& val, int r1, int r2) +ComplexColumnVector::fill (const Complex& val, octave_idx_type r1, octave_idx_type r2) { - int len = length (); + octave_idx_type len = length (); if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) { @@ -184,13 +184,13 @@ return *this; } - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } if (r2 >= r1) { make_unique (); - for (int i = r1; i <= r2; i++) + for (octave_idx_type i = r1; i <= r2; i++) xelem (i) = val; } @@ -200,8 +200,8 @@ ComplexColumnVector ComplexColumnVector::stack (const ColumnVector& a) const { - int len = length (); - int nr_insert = len; + octave_idx_type len = length (); + octave_idx_type nr_insert = len; ComplexColumnVector retval (len + a.length ()); retval.insert (*this, 0); retval.insert (a, nr_insert); @@ -211,8 +211,8 @@ ComplexColumnVector ComplexColumnVector::stack (const ComplexColumnVector& a) const { - int len = length (); - int nr_insert = len; + octave_idx_type len = length (); + octave_idx_type nr_insert = len; ComplexColumnVector retval (len + a.length ()); retval.insert (*this, 0); retval.insert (a, nr_insert); @@ -222,7 +222,7 @@ ComplexRowVector ComplexColumnVector::hermitian (void) const { - int len = length (); + octave_idx_type len = length (); return ComplexRowVector (mx_inline_conj_dup (data (), len), len); } @@ -235,7 +235,7 @@ ComplexColumnVector conj (const ComplexColumnVector& a) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); ComplexColumnVector retval; if (a_len > 0) retval = ComplexColumnVector (mx_inline_conj_dup (a.data (), a_len), a_len); @@ -245,26 +245,26 @@ // resize is the destructive equivalent for this one ComplexColumnVector -ComplexColumnVector::extract (int r1, int r2) const +ComplexColumnVector::extract (octave_idx_type r1, octave_idx_type r2) const { - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - int new_r = r2 - r1 + 1; + octave_idx_type new_r = r2 - r1 + 1; ComplexColumnVector result (new_r); - for (int i = 0; i < new_r; i++) + for (octave_idx_type i = 0; i < new_r; i++) result.elem (i) = elem (r1+i); return result; } ComplexColumnVector -ComplexColumnVector::extract_n (int r1, int n) const +ComplexColumnVector::extract_n (octave_idx_type r1, octave_idx_type n) const { ComplexColumnVector result (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) result.elem (i) = elem (r1+i); return result; @@ -275,9 +275,9 @@ ComplexColumnVector& ComplexColumnVector::operator += (const ColumnVector& a) { - int len = length (); + octave_idx_type len = length (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (len != a_len) { @@ -297,9 +297,9 @@ ComplexColumnVector& ComplexColumnVector::operator -= (const ColumnVector& a) { - int len = length (); + octave_idx_type len = length (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (len != a_len) { @@ -330,10 +330,10 @@ { ComplexColumnVector retval; - int nr = m.rows (); - int nc = m.cols (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.cols (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (nc != a_len) gripe_nonconformant ("operator *", nr, nc, a_len, 1); @@ -343,7 +343,7 @@ retval.resize (nr, 0.0); else { - int ld = nr; + octave_idx_type ld = nr; retval.resize (nr); Complex *y = retval.fortran_vec (); @@ -376,10 +376,10 @@ ComplexColumnVector operator * (const DiagMatrix& m, const ComplexColumnVector& a) { - int nr = m.rows (); - int nc = m.cols (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.cols (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (nc != a_len) { @@ -392,10 +392,10 @@ ComplexColumnVector result (nr); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) result.elem (i) = a.elem (i) * m.elem (i, i); - for (int i = a_len; i < nr; i++) + for (octave_idx_type i = a_len; i < nr; i++) result.elem (i) = 0.0; return result; @@ -404,10 +404,10 @@ ComplexColumnVector operator * (const ComplexDiagMatrix& m, const ColumnVector& a) { - int nr = m.rows (); - int nc = m.cols (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.cols (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (nc != a_len) { @@ -420,10 +420,10 @@ ComplexColumnVector result (nr); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) result.elem (i) = a.elem (i) * m.elem (i, i); - for (int i = a_len; i < nr; i++) + for (octave_idx_type i = a_len; i < nr; i++) result.elem (i) = 0.0; return result; @@ -432,10 +432,10 @@ ComplexColumnVector operator * (const ComplexDiagMatrix& m, const ComplexColumnVector& a) { - int nr = m.rows (); - int nc = m.cols (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.cols (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (nc != a_len) { @@ -448,10 +448,10 @@ ComplexColumnVector result (nr); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) result.elem (i) = a.elem (i) * m.elem (i, i); - for (int i = a_len; i < nr; i++) + for (octave_idx_type i = a_len; i < nr; i++) result.elem (i) = 0.0; return result; @@ -471,13 +471,13 @@ { const Complex *d = data (); - int len = length (); + octave_idx_type len = length (); ColumnVector retval (len); double *r = retval.fortran_vec (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) r[i] = f (d[i]); return retval; @@ -488,7 +488,7 @@ { Complex *d = fortran_vec (); // Ensures only one reference to my privates! - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) d[i] = f (d[i]); return *this; @@ -497,14 +497,14 @@ Complex ComplexColumnVector::min (void) const { - int len = length (); + octave_idx_type len = length (); if (len == 0) return 0.0; Complex res = elem (0); double absres = std::abs (res); - for (int i = 1; i < len; i++) + for (octave_idx_type i = 1; i < len; i++) if (std::abs (elem (i)) < absres) { res = elem (i); @@ -517,14 +517,14 @@ Complex ComplexColumnVector::max (void) const { - int len = length (); + octave_idx_type len = length (); if (len == 0) return 0.0; Complex res = elem (0); double absres = std::abs (res); - for (int i = 1; i < len; i++) + for (octave_idx_type i = 1; i < len; i++) if (std::abs (elem (i)) > absres) { res = elem (i); @@ -540,7 +540,7 @@ operator << (std::ostream& os, const ComplexColumnVector& a) { // int field_width = os.precision () + 7; - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) os << /* setw (field_width) << */ a.elem (i) << "\n"; return os; } @@ -548,14 +548,14 @@ std::istream& operator >> (std::istream& is, ComplexColumnVector& a) { - int len = a.length(); + octave_idx_type len = a.length(); if (len < 1) is.clear (std::ios::badbit); else { double tmp; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { is >> tmp; if (is) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CColVector.h --- a/liboctave/CColVector.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CColVector.h Fri Apr 08 16:07:37 2005 +0000 @@ -37,9 +37,9 @@ ComplexColumnVector (void) : MArray () { } - explicit ComplexColumnVector (int n) : MArray (n) { } + explicit ComplexColumnVector (octave_idx_type n) : MArray (n) { } - ComplexColumnVector (int n, const Complex& val) + ComplexColumnVector (octave_idx_type n, const Complex& val) : MArray (n, val) { } ComplexColumnVector (const ComplexColumnVector& a) : MArray (a) { } @@ -59,13 +59,13 @@ // destructive insert/delete/reorder operations - ComplexColumnVector& insert (const ColumnVector& a, int r); - ComplexColumnVector& insert (const ComplexColumnVector& a, int r); + ComplexColumnVector& insert (const ColumnVector& a, octave_idx_type r); + ComplexColumnVector& insert (const ComplexColumnVector& a, octave_idx_type r); ComplexColumnVector& fill (double val); ComplexColumnVector& fill (const Complex& val); - ComplexColumnVector& fill (double val, int r1, int r2); - ComplexColumnVector& fill (const Complex& val, int r1, int r2); + ComplexColumnVector& fill (double val, octave_idx_type r1, octave_idx_type r2); + ComplexColumnVector& fill (const Complex& val, octave_idx_type r1, octave_idx_type r2); ComplexColumnVector stack (const ColumnVector& a) const; ComplexColumnVector stack (const ComplexColumnVector& a) const; @@ -77,9 +77,9 @@ // resize is the destructive equivalent for this one - ComplexColumnVector extract (int r1, int r2) const; + ComplexColumnVector extract (octave_idx_type r1, octave_idx_type r2) const; - ComplexColumnVector extract_n (int r1, int n) const; + ComplexColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const; // column vector by column vector -> column vector operations @@ -127,7 +127,7 @@ private: - ComplexColumnVector (Complex *d, int l) : MArray (d, l) { } + ComplexColumnVector (Complex *d, octave_idx_type l) : MArray (d, l) { } }; MARRAY_FORWARD_DEFS (MArray, ComplexColumnVector, Complex) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CDiagMatrix.cc --- a/liboctave/CDiagMatrix.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CDiagMatrix.cc Fri Apr 08 16:07:37 2005 +0000 @@ -38,7 +38,7 @@ ComplexDiagMatrix::ComplexDiagMatrix (const DiagMatrix& a) : MDiagArray2 (a.rows (), a.cols ()) { - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) elem (i, i) = a.elem (i, i); } @@ -60,7 +60,7 @@ ComplexDiagMatrix& ComplexDiagMatrix::fill (double val) { - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) elem (i, i) = val; return *this; } @@ -68,13 +68,13 @@ ComplexDiagMatrix& ComplexDiagMatrix::fill (const Complex& val) { - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) elem (i, i) = val; return *this; } ComplexDiagMatrix& -ComplexDiagMatrix::fill (double val, int beg, int end) +ComplexDiagMatrix::fill (double val, octave_idx_type beg, octave_idx_type end) { if (beg < 0 || end >= length () || end < beg) { @@ -82,14 +82,14 @@ return *this; } - for (int i = beg; i <= end; i++) + for (octave_idx_type i = beg; i <= end; i++) elem (i, i) = val; return *this; } ComplexDiagMatrix& -ComplexDiagMatrix::fill (const Complex& val, int beg, int end) +ComplexDiagMatrix::fill (const Complex& val, octave_idx_type beg, octave_idx_type end) { if (beg < 0 || end >= length () || end < beg) { @@ -97,7 +97,7 @@ return *this; } - for (int i = beg; i <= end; i++) + for (octave_idx_type i = beg; i <= end; i++) elem (i, i) = val; return *this; @@ -106,14 +106,14 @@ ComplexDiagMatrix& ComplexDiagMatrix::fill (const ColumnVector& a) { - int len = length (); + octave_idx_type len = length (); if (a.length () != len) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) elem (i, i) = a.elem (i); return *this; @@ -122,14 +122,14 @@ ComplexDiagMatrix& ComplexDiagMatrix::fill (const ComplexColumnVector& a) { - int len = length (); + octave_idx_type len = length (); if (a.length () != len) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) elem (i, i) = a.elem (i); return *this; @@ -138,14 +138,14 @@ ComplexDiagMatrix& ComplexDiagMatrix::fill (const RowVector& a) { - int len = length (); + octave_idx_type len = length (); if (a.length () != len) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) elem (i, i) = a.elem (i); return *this; @@ -154,78 +154,78 @@ ComplexDiagMatrix& ComplexDiagMatrix::fill (const ComplexRowVector& a) { - int len = length (); + octave_idx_type len = length (); if (a.length () != len) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) elem (i, i) = a.elem (i); return *this; } ComplexDiagMatrix& -ComplexDiagMatrix::fill (const ColumnVector& a, int beg) +ComplexDiagMatrix::fill (const ColumnVector& a, octave_idx_type beg) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (beg < 0 || beg + a_len >= length ()) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) elem (i+beg, i+beg) = a.elem (i); return *this; } ComplexDiagMatrix& -ComplexDiagMatrix::fill (const ComplexColumnVector& a, int beg) +ComplexDiagMatrix::fill (const ComplexColumnVector& a, octave_idx_type beg) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (beg < 0 || beg + a_len >= length ()) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) elem (i+beg, i+beg) = a.elem (i); return *this; } ComplexDiagMatrix& -ComplexDiagMatrix::fill (const RowVector& a, int beg) +ComplexDiagMatrix::fill (const RowVector& a, octave_idx_type beg) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (beg < 0 || beg + a_len >= length ()) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) elem (i+beg, i+beg) = a.elem (i); return *this; } ComplexDiagMatrix& -ComplexDiagMatrix::fill (const ComplexRowVector& a, int beg) +ComplexDiagMatrix::fill (const ComplexRowVector& a, octave_idx_type beg) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (beg < 0 || beg + a_len >= length ()) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) elem (i+beg, i+beg) = a.elem (i); return *this; @@ -249,7 +249,7 @@ conj (const ComplexDiagMatrix& a) { ComplexDiagMatrix retval; - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (a_len > 0) retval = ComplexDiagMatrix (mx_inline_conj_dup (a.data (), a_len), a.rows (), a.cols ()); @@ -259,18 +259,18 @@ // resize is the destructive analog for this one ComplexMatrix -ComplexDiagMatrix::extract (int r1, int c1, int r2, int c2) const +ComplexDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } - int new_r = r2 - r1 + 1; - int new_c = c2 - c1 + 1; + octave_idx_type new_r = r2 - r1 + 1; + octave_idx_type new_c = c2 - c1 + 1; ComplexMatrix result (new_r, new_c); - for (int j = 0; j < new_c; j++) - for (int i = 0; i < new_r; i++) + for (octave_idx_type j = 0; j < new_c; j++) + for (octave_idx_type i = 0; i < new_r; i++) result.elem (i, j) = elem (r1+i, c1+j); return result; @@ -279,10 +279,10 @@ // extract row or column i. ComplexRowVector -ComplexDiagMatrix::row (int i) const +ComplexDiagMatrix::row (octave_idx_type i) const { - int r = rows (); - int c = cols (); + octave_idx_type r = rows (); + octave_idx_type c = cols (); if (i < 0 || i >= r) { (*current_liboctave_error_handler) ("invalid row selection"); @@ -307,7 +307,7 @@ char c = *s; if (c == 'f' || c == 'F') - return row (0); + return row (static_cast(0)); else if (c == 'l' || c == 'L') return row (rows () - 1); else @@ -318,10 +318,10 @@ } ComplexColumnVector -ComplexDiagMatrix::column (int i) const +ComplexDiagMatrix::column (octave_idx_type i) const { - int r = rows (); - int c = cols (); + octave_idx_type r = rows (); + octave_idx_type c = cols (); if (i < 0 || i >= c) { (*current_liboctave_error_handler) ("invalid column selection"); @@ -346,7 +346,7 @@ char c = *s; if (c == 'f' || c == 'F') - return column (0); + return column (static_cast(0)); else if (c == 'l' || c == 'L') return column (cols () - 1); else @@ -366,8 +366,8 @@ ComplexDiagMatrix ComplexDiagMatrix::inverse (int& info) const { - int r = rows (); - int c = cols (); + octave_idx_type r = rows (); + octave_idx_type c = cols (); if (r != c) { (*current_liboctave_error_handler) ("inverse requires square matrix"); @@ -377,7 +377,7 @@ ComplexDiagMatrix retval (r, c); info = 0; - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) { if (elem (i, i) == 0.0) { @@ -396,11 +396,11 @@ ComplexDiagMatrix& ComplexDiagMatrix::operator += (const DiagMatrix& a) { - int r = rows (); - int c = cols (); + octave_idx_type r = rows (); + octave_idx_type c = cols (); - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (r != a_nr || c != a_nc) { @@ -420,11 +420,11 @@ ComplexDiagMatrix operator * (const ComplexDiagMatrix& a, const DiagMatrix& b) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (a_nc != b_nr) { @@ -437,9 +437,9 @@ ComplexDiagMatrix c (a_nr, b_nc); - int len = a_nr < b_nc ? a_nr : b_nc; + octave_idx_type len = a_nr < b_nc ? a_nr : b_nc; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { Complex a_element = a.elem (i, i); double b_element = b.elem (i, i); @@ -460,11 +460,11 @@ ComplexDiagMatrix operator * (const DiagMatrix& a, const ComplexDiagMatrix& b) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (a_nc != b_nr) { @@ -477,9 +477,9 @@ ComplexDiagMatrix c (a_nr, b_nc); - int len = a_nr < b_nc ? a_nr : b_nc; + octave_idx_type len = a_nr < b_nc ? a_nr : b_nc; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { double a_element = a.elem (i, i); Complex b_element = b.elem (i, i); @@ -508,10 +508,10 @@ // Could be optimized... ComplexColumnVector -ComplexDiagMatrix::diag (int k) const +ComplexDiagMatrix::diag (octave_idx_type k) const { - int nnr = rows (); - int nnc = cols (); + octave_idx_type nnr = rows (); + octave_idx_type nnc = cols (); if (k > 0) nnc -= k; else if (k < 0) @@ -521,23 +521,23 @@ if (nnr > 0 && nnc > 0) { - int ndiag = (nnr < nnc) ? nnr : nnc; + octave_idx_type ndiag = (nnr < nnc) ? nnr : nnc; d.resize (ndiag); if (k > 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i, i+k); } else if ( k < 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i-k, i); } else { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i, i); } } @@ -555,9 +555,9 @@ { Complex ZERO (0.0); // int field_width = os.precision () + 7; - for (int i = 0; i < a.rows (); i++) + for (octave_idx_type i = 0; i < a.rows (); i++) { - for (int j = 0; j < a.cols (); j++) + for (octave_idx_type j = 0; j < a.cols (); j++) { if (i == j) os << " " /* setw (field_width) */ << a.elem (i, i); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CDiagMatrix.h --- a/liboctave/CDiagMatrix.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CDiagMatrix.h Fri Apr 08 16:07:37 2005 +0000 @@ -39,9 +39,9 @@ ComplexDiagMatrix (void) : MDiagArray2 () { } - ComplexDiagMatrix (int r, int c) : MDiagArray2 (r, c) { } + ComplexDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2 (r, c) { } - ComplexDiagMatrix (int r, int c, const Complex& val) + ComplexDiagMatrix (octave_idx_type r, octave_idx_type c, const Complex& val) : MDiagArray2 (r, c, val) { } explicit ComplexDiagMatrix (const RowVector& a) @@ -75,16 +75,16 @@ ComplexDiagMatrix& fill (double val); ComplexDiagMatrix& fill (const Complex& val); - ComplexDiagMatrix& fill (double val, int beg, int end); - ComplexDiagMatrix& fill (const Complex& val, int beg, int end); + ComplexDiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); + ComplexDiagMatrix& fill (const Complex& val, octave_idx_type beg, octave_idx_type end); ComplexDiagMatrix& fill (const ColumnVector& a); ComplexDiagMatrix& fill (const ComplexColumnVector& a); ComplexDiagMatrix& fill (const RowVector& a); ComplexDiagMatrix& fill (const ComplexRowVector& a); - ComplexDiagMatrix& fill (const ColumnVector& a, int beg); - ComplexDiagMatrix& fill (const ComplexColumnVector& a, int beg); - ComplexDiagMatrix& fill (const RowVector& a, int beg); - ComplexDiagMatrix& fill (const ComplexRowVector& a, int beg); + ComplexDiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); + ComplexDiagMatrix& fill (const ComplexColumnVector& a, octave_idx_type beg); + ComplexDiagMatrix& fill (const RowVector& a, octave_idx_type beg); + ComplexDiagMatrix& fill (const ComplexRowVector& a, octave_idx_type beg); ComplexDiagMatrix hermitian (void) const; // complex conjugate transpose ComplexDiagMatrix transpose (void) const; @@ -93,14 +93,14 @@ // resize is the destructive analog for this one - ComplexMatrix extract (int r1, int c1, int r2, int c2) const; + ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; // extract row or column i - ComplexRowVector row (int i) const; + ComplexRowVector row (octave_idx_type i) const; ComplexRowVector row (char *s) const; - ComplexColumnVector column (int i) const; + ComplexColumnVector column (octave_idx_type i) const; ComplexColumnVector column (char *s) const; ComplexDiagMatrix inverse (int& info) const; @@ -114,7 +114,7 @@ // other operations ComplexColumnVector diag (void) const; - ComplexColumnVector diag (int k) const; + ComplexColumnVector diag (octave_idx_type k) const; // i/o @@ -122,7 +122,7 @@ private: - ComplexDiagMatrix (Complex *d, int nr, int nc) + ComplexDiagMatrix (Complex *d, octave_idx_type nr, octave_idx_type nc) : MDiagArray2 (d, nr, nc) { } }; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CMatrix.cc --- a/liboctave/CMatrix.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CMatrix.cc Fri Apr 08 16:07:37 2005 +0000 @@ -64,54 +64,54 @@ { F77_RET_T F77_FUNC (zgebal, ZGEBAL) (F77_CONST_CHAR_ARG_DECL, - const int&, Complex*, const int&, int&, - int&, double*, int& + const octave_idx_type&, Complex*, const octave_idx_type&, octave_idx_type&, + octave_idx_type&, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (dgebak, DGEBAK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const int&, double*, - const int&, double*, const int&, int& + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, double*, + 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 (zgemm, ZGEMM) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const int&, - const Complex&, const Complex*, const int&, - const Complex*, const int&, const Complex&, - Complex*, const int& + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + const Complex&, const Complex*, const octave_idx_type&, + const Complex*, const octave_idx_type&, const Complex&, + Complex*, const octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (zgetrf, ZGETRF) (const int&, const int&, Complex*, const int&, - int*, int&); + F77_FUNC (zgetrf, ZGETRF) (const octave_idx_type&, const octave_idx_type&, Complex*, const octave_idx_type&, + octave_idx_type*, octave_idx_type&); F77_RET_T F77_FUNC (zgetrs, ZGETRS) (F77_CONST_CHAR_ARG_DECL, - const int&, const int&, Complex*, const int&, - const int*, Complex*, const int&, int& + const octave_idx_type&, const octave_idx_type&, Complex*, const octave_idx_type&, + const octave_idx_type*, Complex*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (zgetri, ZGETRI) (const int&, Complex*, const int&, const int*, - Complex*, const int&, int&); + F77_FUNC (zgetri, ZGETRI) (const octave_idx_type&, Complex*, const octave_idx_type&, const octave_idx_type*, + Complex*, const octave_idx_type&, octave_idx_type&); F77_RET_T F77_FUNC (zgecon, ZGECON) (F77_CONST_CHAR_ARG_DECL, - const int&, Complex*, - const int&, const double&, double&, - Complex*, double*, int& + const octave_idx_type&, Complex*, + const octave_idx_type&, const double&, double&, + Complex*, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (zgelss, ZGELSS) (const int&, const int&, const int&, - Complex*, const int&, Complex*, - const int&, double*, double&, int&, - Complex*, const int&, double*, int&); + F77_FUNC (zgelss, ZGELSS) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + Complex*, const octave_idx_type&, Complex*, + const octave_idx_type&, double*, double&, octave_idx_type&, + Complex*, const octave_idx_type&, double*, octave_idx_type&); // Note that the original complex fft routines were not written for // double complex arguments. They have been modified by adding an @@ -119,13 +119,13 @@ // each subroutine. F77_RET_T - F77_FUNC (cffti, CFFTI) (const int&, Complex*); + F77_FUNC (cffti, CFFTI) (const octave_idx_type&, Complex*); F77_RET_T - F77_FUNC (cfftf, CFFTF) (const int&, Complex*, Complex*); + F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, Complex*, Complex*); F77_RET_T - F77_FUNC (cfftb, CFFTB) (const int&, Complex*, Complex*); + F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, Complex*, Complex*); F77_RET_T F77_FUNC (zlartg, ZLARTG) (const Complex&, const Complex&, @@ -134,17 +134,17 @@ F77_RET_T F77_FUNC (ztrsyl, ZTRSYL) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const int&, - const Complex*, const int&, - const Complex*, const int&, - const Complex*, const int&, double&, int& + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + const Complex*, const octave_idx_type&, + const Complex*, const octave_idx_type&, + const Complex*, const octave_idx_type&, double&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (xzlange, XZLANGE) (F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const Complex*, - const int&, double*, double& + const octave_idx_type&, const octave_idx_type&, const Complex*, + const octave_idx_type&, double*, double& F77_CHAR_ARG_LEN_DECL); } @@ -155,50 +155,50 @@ ComplexMatrix::ComplexMatrix (const Matrix& a) : MArray2 (a.rows (), a.cols ()) { - for (int j = 0; j < cols (); j++) - for (int i = 0; i < rows (); i++) + for (octave_idx_type j = 0; j < cols (); j++) + for (octave_idx_type i = 0; i < rows (); i++) elem (i, j) = a.elem (i, j); } ComplexMatrix::ComplexMatrix (const RowVector& rv) : MArray2 (1, rv.length (), 0.0) { - for (int i = 0; i < rv.length (); i++) + for (octave_idx_type i = 0; i < rv.length (); i++) elem (0, i) = rv.elem (i); } ComplexMatrix::ComplexMatrix (const ColumnVector& cv) : MArray2 (cv.length (), 1, 0.0) { - for (int i = 0; i < cv.length (); i++) + for (octave_idx_type i = 0; i < cv.length (); i++) elem (i, 0) = cv.elem (i); } ComplexMatrix::ComplexMatrix (const DiagMatrix& a) : MArray2 (a.rows (), a.cols (), 0.0) { - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) = a.elem (i, i); } ComplexMatrix::ComplexMatrix (const ComplexRowVector& rv) : MArray2 (1, rv.length (), 0.0) { - for (int i = 0; i < rv.length (); i++) + for (octave_idx_type i = 0; i < rv.length (); i++) elem (0, i) = rv.elem (i); } ComplexMatrix::ComplexMatrix (const ComplexColumnVector& cv) : MArray2 (cv.length (), 1, 0.0) { - for (int i = 0; i < cv.length (); i++) + for (octave_idx_type i = 0; i < cv.length (); i++) elem (i, 0) = cv.elem (i); } ComplexMatrix::ComplexMatrix (const ComplexDiagMatrix& a) : MArray2 (a.rows (), a.cols (), 0.0) { - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) = a.elem (i, i); } @@ -208,16 +208,16 @@ ComplexMatrix::ComplexMatrix (const boolMatrix& a) : MArray2 (a.rows (), a.cols (), 0.0) { - for (int i = 0; i < a.rows (); i++) - for (int j = 0; j < a.cols (); j++) + for (octave_idx_type i = 0; i < a.rows (); i++) + for (octave_idx_type j = 0; j < a.cols (); j++) elem (i, j) = a.elem (i, j); } ComplexMatrix::ComplexMatrix (const charMatrix& a) : MArray2 (a.rows (), a.cols (), 0.0) { - for (int i = 0; i < a.rows (); i++) - for (int j = 0; j < a.cols (); j++) + for (octave_idx_type i = 0; i < a.rows (); i++) + for (octave_idx_type j = 0; j < a.cols (); j++) elem (i, j) = a.elem (i, j); } @@ -239,13 +239,13 @@ bool ComplexMatrix::is_hermitian (void) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (is_square () && nr > 0) { - for (int i = 0; i < nr; i++) - for (int j = i; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) + for (octave_idx_type j = i; j < nc; j++) if (elem (i, j) != conj (elem (j, i))) return false; @@ -258,10 +258,10 @@ // destructive insert/delete/reorder operations ComplexMatrix& -ComplexMatrix::insert (const Matrix& a, int r, int c) +ComplexMatrix::insert (const Matrix& a, octave_idx_type r, octave_idx_type c) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (r < 0 || r + a_nr > rows () || c < 0 || c + a_nc > cols ()) { @@ -273,8 +273,8 @@ { make_unique (); - for (int j = 0; j < a_nc; j++) - for (int i = 0; i < a_nr; i++) + for (octave_idx_type j = 0; j < a_nc; j++) + for (octave_idx_type i = 0; i < a_nr; i++) xelem (r+i, c+j) = a.elem (i, j); } @@ -282,9 +282,9 @@ } ComplexMatrix& -ComplexMatrix::insert (const RowVector& a, int r, int c) +ComplexMatrix::insert (const RowVector& a, octave_idx_type r, octave_idx_type c) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ()) { @@ -296,7 +296,7 @@ { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (r, c+i) = a.elem (i); } @@ -304,9 +304,9 @@ } ComplexMatrix& -ComplexMatrix::insert (const ColumnVector& a, int r, int c) +ComplexMatrix::insert (const ColumnVector& a, octave_idx_type r, octave_idx_type c) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ()) { @@ -318,7 +318,7 @@ { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (r+i, c) = a.elem (i); } @@ -326,10 +326,10 @@ } ComplexMatrix& -ComplexMatrix::insert (const DiagMatrix& a, int r, int c) +ComplexMatrix::insert (const DiagMatrix& a, octave_idx_type r, octave_idx_type c) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (r < 0 || r + a_nr > rows () || c < 0 || c + a_nc > cols ()) { @@ -339,13 +339,13 @@ fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (a_len > 0) { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (r+i, c+i) = a.elem (i, i); } @@ -353,32 +353,32 @@ } ComplexMatrix& -ComplexMatrix::insert (const ComplexMatrix& a, int r, int c) +ComplexMatrix::insert (const ComplexMatrix& a, octave_idx_type r, octave_idx_type c) { Array2::insert (a, r, c); return *this; } ComplexMatrix& -ComplexMatrix::insert (const ComplexRowVector& a, int r, int c) +ComplexMatrix::insert (const ComplexRowVector& a, octave_idx_type r, octave_idx_type c) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ()) { (*current_liboctave_error_handler) ("range error for insert"); return *this; } - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) elem (r, c+i) = a.elem (i); return *this; } ComplexMatrix& -ComplexMatrix::insert (const ComplexColumnVector& a, int r, int c) +ComplexMatrix::insert (const ComplexColumnVector& a, octave_idx_type r, octave_idx_type c) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ()) { @@ -390,7 +390,7 @@ { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (r+i, c) = a.elem (i); } @@ -398,10 +398,10 @@ } ComplexMatrix& -ComplexMatrix::insert (const ComplexDiagMatrix& a, int r, int c) +ComplexMatrix::insert (const ComplexDiagMatrix& a, octave_idx_type r, octave_idx_type c) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (r < 0 || r + a_nr > rows () || c < 0 || c + a_nc > cols ()) { @@ -411,13 +411,13 @@ fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (a_len > 0) { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (r+i, c+i) = a.elem (i, i); } @@ -427,15 +427,15 @@ ComplexMatrix& ComplexMatrix::fill (double val) { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { make_unique (); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) xelem (i, j) = val; } @@ -445,15 +445,15 @@ ComplexMatrix& ComplexMatrix::fill (const Complex& val) { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { make_unique (); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) xelem (i, j) = val; } @@ -461,10 +461,10 @@ } ComplexMatrix& -ComplexMatrix::fill (double val, int r1, int c1, int r2, int c2) +ComplexMatrix::fill (double val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc) @@ -473,15 +473,15 @@ return *this; } - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } if (r2 >= r1 && c2 >= c1) { make_unique (); - for (int j = c1; j <= c2; j++) - for (int i = r1; i <= r2; i++) + for (octave_idx_type j = c1; j <= c2; j++) + for (octave_idx_type i = r1; i <= r2; i++) xelem (i, j) = val; } @@ -489,10 +489,10 @@ } ComplexMatrix& -ComplexMatrix::fill (const Complex& val, int r1, int c1, int r2, int c2) +ComplexMatrix::fill (const Complex& val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc) @@ -501,15 +501,15 @@ return *this; } - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } if (r2 >= r1 && c2 >=c1) { make_unique (); - for (int j = c1; j <= c2; j++) - for (int i = r1; i <= r2; i++) + for (octave_idx_type j = c1; j <= c2; j++) + for (octave_idx_type i = r1; i <= r2; i++) xelem (i, j) = val; } @@ -519,15 +519,15 @@ ComplexMatrix ComplexMatrix::append (const Matrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != a.rows ()) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return *this; } - int nc_insert = nc; + octave_idx_type nc_insert = nc; ComplexMatrix retval (nr, nc + a.cols ()); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -537,15 +537,15 @@ ComplexMatrix ComplexMatrix::append (const RowVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != 1) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return *this; } - int nc_insert = nc; + octave_idx_type nc_insert = nc; ComplexMatrix retval (nr, nc + a.length ()); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -555,15 +555,15 @@ ComplexMatrix ComplexMatrix::append (const ColumnVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != a.length ()) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return *this; } - int nc_insert = nc; + octave_idx_type nc_insert = nc; ComplexMatrix retval (nr, nc + 1); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -573,15 +573,15 @@ ComplexMatrix ComplexMatrix::append (const DiagMatrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != a.rows ()) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return *this; } - int nc_insert = nc; + octave_idx_type nc_insert = nc; ComplexMatrix retval (nr, nc + a.cols ()); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -591,15 +591,15 @@ ComplexMatrix ComplexMatrix::append (const ComplexMatrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != a.rows ()) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return *this; } - int nc_insert = nc; + octave_idx_type nc_insert = nc; ComplexMatrix retval (nr, nc + a.cols ()); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -609,15 +609,15 @@ ComplexMatrix ComplexMatrix::append (const ComplexRowVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != 1) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return *this; } - int nc_insert = nc; + octave_idx_type nc_insert = nc; ComplexMatrix retval (nr, nc + a.length ()); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -627,15 +627,15 @@ ComplexMatrix ComplexMatrix::append (const ComplexColumnVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != a.length ()) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return *this; } - int nc_insert = nc; + octave_idx_type nc_insert = nc; ComplexMatrix retval (nr, nc + 1); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -645,15 +645,15 @@ ComplexMatrix ComplexMatrix::append (const ComplexDiagMatrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != a.rows ()) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return *this; } - int nc_insert = nc; + octave_idx_type nc_insert = nc; ComplexMatrix retval (nr, nc + a.cols ()); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -663,8 +663,8 @@ ComplexMatrix ComplexMatrix::stack (const Matrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != a.cols ()) { (*current_liboctave_error_handler) @@ -672,7 +672,7 @@ return *this; } - int nr_insert = nr; + octave_idx_type nr_insert = nr; ComplexMatrix retval (nr + a.rows (), nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -682,8 +682,8 @@ ComplexMatrix ComplexMatrix::stack (const RowVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != a.length ()) { (*current_liboctave_error_handler) @@ -691,7 +691,7 @@ return *this; } - int nr_insert = nr; + octave_idx_type nr_insert = nr; ComplexMatrix retval (nr + 1, nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -701,8 +701,8 @@ ComplexMatrix ComplexMatrix::stack (const ColumnVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != 1) { (*current_liboctave_error_handler) @@ -710,7 +710,7 @@ return *this; } - int nr_insert = nr; + octave_idx_type nr_insert = nr; ComplexMatrix retval (nr + a.length (), nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -720,8 +720,8 @@ ComplexMatrix ComplexMatrix::stack (const DiagMatrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != a.cols ()) { (*current_liboctave_error_handler) @@ -729,7 +729,7 @@ return *this; } - int nr_insert = nr; + octave_idx_type nr_insert = nr; ComplexMatrix retval (nr + a.rows (), nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -739,8 +739,8 @@ ComplexMatrix ComplexMatrix::stack (const ComplexMatrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != a.cols ()) { (*current_liboctave_error_handler) @@ -748,7 +748,7 @@ return *this; } - int nr_insert = nr; + octave_idx_type nr_insert = nr; ComplexMatrix retval (nr + a.rows (), nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -758,8 +758,8 @@ ComplexMatrix ComplexMatrix::stack (const ComplexRowVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != a.length ()) { (*current_liboctave_error_handler) @@ -767,7 +767,7 @@ return *this; } - int nr_insert = nr; + octave_idx_type nr_insert = nr; ComplexMatrix retval (nr + 1, nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -777,8 +777,8 @@ ComplexMatrix ComplexMatrix::stack (const ComplexColumnVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != 1) { (*current_liboctave_error_handler) @@ -786,7 +786,7 @@ return *this; } - int nr_insert = nr; + octave_idx_type nr_insert = nr; ComplexMatrix retval (nr + a.length (), nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -796,8 +796,8 @@ ComplexMatrix ComplexMatrix::stack (const ComplexDiagMatrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != a.cols ()) { (*current_liboctave_error_handler) @@ -805,7 +805,7 @@ return *this; } - int nr_insert = nr; + octave_idx_type nr_insert = nr; ComplexMatrix retval (nr + a.rows (), nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -815,14 +815,14 @@ ComplexMatrix ComplexMatrix::hermitian (void) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); ComplexMatrix result; if (length () > 0) { result.resize (nc, nr); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) result.elem (j, i) = conj (elem (i, j)); } return result; @@ -831,7 +831,7 @@ ComplexMatrix conj (const ComplexMatrix& a) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); ComplexMatrix retval; if (a_len > 0) retval = ComplexMatrix (mx_inline_conj_dup (a.data (), a_len), @@ -842,30 +842,30 @@ // resize is the destructive equivalent for this one ComplexMatrix -ComplexMatrix::extract (int r1, int c1, int r2, int c2) const +ComplexMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } - - int new_r = r2 - r1 + 1; - int new_c = c2 - c1 + 1; + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + + octave_idx_type new_r = r2 - r1 + 1; + octave_idx_type new_c = c2 - c1 + 1; ComplexMatrix result (new_r, new_c); - for (int j = 0; j < new_c; j++) - for (int i = 0; i < new_r; i++) + for (octave_idx_type j = 0; j < new_c; j++) + for (octave_idx_type i = 0; i < new_r; i++) result.xelem (i, j) = elem (r1+i, c1+j); return result; } ComplexMatrix -ComplexMatrix::extract_n (int r1, int c1, int nr, int nc) const +ComplexMatrix::extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const { ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) result.xelem (i, j) = elem (r1+i, c1+j); return result; @@ -874,9 +874,9 @@ // extract row or column i. ComplexRowVector -ComplexMatrix::row (int i) const +ComplexMatrix::row (octave_idx_type i) const { - int nc = cols (); + octave_idx_type nc = cols (); if (i < 0 || i >= rows ()) { (*current_liboctave_error_handler) ("invalid row selection"); @@ -884,7 +884,7 @@ } ComplexRowVector retval (nc); - for (int j = 0; j < cols (); j++) + for (octave_idx_type j = 0; j < cols (); j++) retval.xelem (j) = elem (i, j); return retval; @@ -901,7 +901,7 @@ char c = *s; if (c == 'f' || c == 'F') - return row (0); + return row (static_cast(0)); else if (c == 'l' || c == 'L') return row (rows () - 1); else @@ -912,9 +912,9 @@ } ComplexColumnVector -ComplexMatrix::column (int i) const +ComplexMatrix::column (octave_idx_type i) const { - int nr = rows (); + octave_idx_type nr = rows (); if (i < 0 || i >= cols ()) { (*current_liboctave_error_handler) ("invalid column selection"); @@ -922,7 +922,7 @@ } ComplexColumnVector retval (nr); - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) retval.xelem (j) = elem (j, i); return retval; @@ -939,7 +939,7 @@ char c = *s; if (c == 'f' || c == 'F') - return column (0); + return column (static_cast(0)); else if (c == 'l' || c == 'L') return column (cols () - 1); else @@ -952,39 +952,39 @@ ComplexMatrix ComplexMatrix::inverse (void) const { - int info; + octave_idx_type info; double rcond; return inverse (info, rcond, 0, 0); } ComplexMatrix -ComplexMatrix::inverse (int& info) const +ComplexMatrix::inverse (octave_idx_type& info) const { double rcond; return inverse (info, rcond, 0, 0); } ComplexMatrix -ComplexMatrix::inverse (int& info, double& rcond, int force, +ComplexMatrix::inverse (octave_idx_type& info, double& rcond, int force, int calc_cond) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != nc) (*current_liboctave_error_handler) ("inverse requires square matrix"); else { - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); retval = *this; Complex *tmp_data = retval.fortran_vec (); Array z(1); - int lwork = -1; + octave_idx_type lwork = -1; // Query the optimum work array size. @@ -998,7 +998,7 @@ return retval; } - lwork = static_cast (STD_OCTAVE::real(z(0))); + lwork = static_cast (STD_OCTAVE::real(z(0))); lwork = (lwork < 2 *nc ? 2*nc : lwork); z.resize (lwork); Complex *pz = z.fortran_vec (); @@ -1008,7 +1008,7 @@ // Calculate the norm of the matrix, for later use. double anorm; if (calc_cond) - anorm = retval.abs().sum().row(0).max(); + anorm = retval.abs().sum().row(static_cast(0)).max(); F77_XFCN (zgetrf, ZGETRF, (nc, nc, tmp_data, nr, pipvt, info)); @@ -1023,7 +1023,7 @@ else if (calc_cond) { // Now calculate the condition number for non-singular matrix. - int zgecon_info = 0; + octave_idx_type zgecon_info = 0; char job = '1'; Array rz (2 * nc); double *prz = rz.fortran_vec (); @@ -1044,7 +1044,7 @@ retval = *this; // Restore contents. else { - int zgetri_info = 0; + octave_idx_type zgetri_info = 0; F77_XFCN (zgetri, ZGETRI, (nc, tmp_data, nr, pipvt, pz, lwork, zgetri_info)); @@ -1075,9 +1075,9 @@ ColumnVector sigma = S.diag (); - int r = sigma.length () - 1; - int nr = rows (); - int nc = cols (); + octave_idx_type r = sigma.length () - 1; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (tol <= 0.0) { @@ -1198,10 +1198,10 @@ { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); - - int npts, nsamples; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type npts, nsamples; if (nr == 1 || nc == 1) { @@ -1214,7 +1214,7 @@ nsamples = nc; } - int nn = 4*npts+15; + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); @@ -1224,7 +1224,7 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; @@ -1239,10 +1239,10 @@ { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); - - int npts, nsamples; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type npts, nsamples; if (nr == 1 || nc == 1) { @@ -1255,7 +1255,7 @@ nsamples = nc; } - int nn = 4*npts+15; + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); @@ -1265,14 +1265,14 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; F77_FUNC (cfftb, CFFTB) (npts, &tmp_data[npts*j], pwsave); } - for (int j = 0; j < npts*nsamples; j++) + for (octave_idx_type j = 0; j < npts*nsamples; j++) tmp_data[j] = tmp_data[j] / static_cast (npts); return retval; @@ -1283,10 +1283,10 @@ { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); - - int npts, nsamples; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type npts, nsamples; if (nr == 1 || nc == 1) { @@ -1299,7 +1299,7 @@ nsamples = nc; } - int nn = 4*npts+15; + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); @@ -1309,7 +1309,7 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; @@ -1328,16 +1328,16 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) prow[i] = tmp_data[i*nr + j]; F77_FUNC (cfftf, CFFTF) (npts, prow, pwsave); - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) tmp_data[i*nr + j] = prow[i]; } @@ -1349,10 +1349,10 @@ { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); - - int npts, nsamples; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type npts, nsamples; if (nr == 1 || nc == 1) { @@ -1365,7 +1365,7 @@ nsamples = nc; } - int nn = 4*npts+15; + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); @@ -1375,14 +1375,14 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; F77_FUNC (cfftb, CFFTB) (npts, &tmp_data[npts*j], pwsave); } - for (int j = 0; j < npts*nsamples; j++) + for (octave_idx_type j = 0; j < npts*nsamples; j++) tmp_data[j] = tmp_data[j] / static_cast (npts); npts = nc; @@ -1397,16 +1397,16 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) prow[i] = tmp_data[i*nr + j]; F77_FUNC (cfftb, CFFTB) (npts, prow, pwsave); - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) tmp_data[i*nr + j] = prow[i] / static_cast (npts); } @@ -1418,25 +1418,25 @@ ComplexDET ComplexMatrix::determinant (void) const { - int info; + octave_idx_type info; double rcond; return determinant (info, rcond, 0); } ComplexDET -ComplexMatrix::determinant (int& info) const +ComplexMatrix::determinant (octave_idx_type& info) const { double rcond; return determinant (info, rcond, 0); } ComplexDET -ComplexMatrix::determinant (int& info, double& rcond, int calc_cond) const +ComplexMatrix::determinant (octave_idx_type& info, double& rcond, int calc_cond) const { ComplexDET retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr == 0 || nc == 0) { @@ -1447,8 +1447,8 @@ } else { - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); ComplexMatrix atmp = *this; Complex *tmp_data = atmp.fortran_vec (); @@ -1458,7 +1458,7 @@ // Calculate the norm of the matrix, for later use. double anorm = 0; if (calc_cond) - anorm = atmp.abs().sum().row(0).max(); + anorm = atmp.abs().sum().row(static_cast(0)).max(); F77_XFCN (zgetrf, ZGETRF, (nr, nc, tmp_data, nr, pipvt, info)); @@ -1502,7 +1502,7 @@ else { Complex d[2] = { 1., 0.}; - for (int i=0; i ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); ComplexMatrix atmp = *this; Complex *tmp_data = atmp.fortran_vec (); @@ -1605,7 +1605,7 @@ double *prz = rz.fortran_vec (); // Calculate the norm of the matrix, for later use. - double anorm = atmp.abs().sum().row(0).max(); + double anorm = atmp.abs().sum().row(static_cast(0)).max(); F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -1660,7 +1660,7 @@ retval = b; Complex *result = retval.fortran_vec (); - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); job = 'N'; F77_XFCN (zgetrs, ZGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1682,26 +1682,26 @@ ComplexColumnVector ComplexMatrix::solve (const ColumnVector& b) const { - int info; + octave_idx_type info; double rcond; return solve (ComplexColumnVector (b), info, rcond, 0); } ComplexColumnVector -ComplexMatrix::solve (const ColumnVector& b, int& info) const +ComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info) const { double rcond; return solve (ComplexColumnVector (b), info, rcond, 0); } ComplexColumnVector -ComplexMatrix::solve (const ColumnVector& b, int& info, double& rcond) const +ComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (ComplexColumnVector (b), info, rcond, 0); } ComplexColumnVector -ComplexMatrix::solve (const ColumnVector& b, int& info, double& rcond, +ComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { return solve (ComplexColumnVector (b), info, rcond, sing_handler); @@ -1710,34 +1710,34 @@ ComplexColumnVector ComplexMatrix::solve (const ComplexColumnVector& b) const { - int info; + octave_idx_type info; double rcond; return solve (b, info, rcond, 0); } ComplexColumnVector -ComplexMatrix::solve (const ComplexColumnVector& b, int& info) const +ComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); } ComplexColumnVector -ComplexMatrix::solve (const ComplexColumnVector& b, int& info, +ComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ComplexColumnVector -ComplexMatrix::solve (const ComplexColumnVector& b, int& info, +ComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { ComplexColumnVector retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr == 0 || nc == 0 || nr != nc || nr != b.length ()) (*current_liboctave_error_handler) @@ -1746,8 +1746,8 @@ { info = 0; - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); ComplexMatrix atmp = *this; Complex *tmp_data = atmp.fortran_vec (); @@ -1758,7 +1758,7 @@ double *prz = rz.fortran_vec (); // Calculate the norm of the matrix, for later use. - double anorm = atmp.abs().sum().row(0).max(); + double anorm = atmp.abs().sum().row(static_cast(0)).max(); F77_XFCN (zgetrf, ZGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -1833,20 +1833,20 @@ ComplexMatrix ComplexMatrix::lssolve (const Matrix& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (ComplexMatrix (b), info, rank); } ComplexMatrix -ComplexMatrix::lssolve (const Matrix& b, int& info) const +ComplexMatrix::lssolve (const Matrix& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (ComplexMatrix (b), info, rank); } ComplexMatrix -ComplexMatrix::lssolve (const Matrix& b, int& info, int& rank) const +ComplexMatrix::lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank) const { return lssolve (ComplexMatrix (b), info, rank); } @@ -1854,27 +1854,27 @@ ComplexMatrix ComplexMatrix::lssolve (const ComplexMatrix& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexMatrix -ComplexMatrix::lssolve (const ComplexMatrix& b, int& info) const +ComplexMatrix::lssolve (const ComplexMatrix& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexMatrix -ComplexMatrix::lssolve (const ComplexMatrix& b, int& info, int& rank) const +ComplexMatrix::lssolve (const ComplexMatrix& b, octave_idx_type& info, octave_idx_type& rank) const { ComplexMatrix retval; - int nrhs = b.cols (); - - int m = rows (); - int n = cols (); + octave_idx_type nrhs = b.cols (); + + octave_idx_type m = rows (); + octave_idx_type n = cols (); if (m == 0 || n == 0 || m != b.rows ()) (*current_liboctave_error_handler) @@ -1884,29 +1884,29 @@ ComplexMatrix atmp = *this; Complex *tmp_data = atmp.fortran_vec (); - int nrr = m > n ? m : n; + octave_idx_type nrr = m > n ? m : n; ComplexMatrix result (nrr, nrhs); - for (int j = 0; j < nrhs; j++) - for (int i = 0; i < m; i++) + for (octave_idx_type j = 0; j < nrhs; j++) + for (octave_idx_type i = 0; i < m; i++) result.elem (i, j) = b.elem (i, j); Complex *presult = result.fortran_vec (); - int len_s = m < n ? m : n; + octave_idx_type len_s = m < n ? m : n; Array s (len_s); double *ps = s.fortran_vec (); double rcond = -1.0; - int lrwork = (5 * (m < n ? m : n)) - 4; + octave_idx_type lrwork = (5 * (m < n ? m : n)) - 4; lrwork = lrwork > 1 ? lrwork : 1; Array rwork (lrwork); double *prwork = rwork.fortran_vec (); // Ask ZGELSS what the dimension of WORK should be. - int lwork = -1; + octave_idx_type lwork = -1; Array work (1); @@ -1919,7 +1919,7 @@ (*current_liboctave_error_handler) ("unrecoverable error in zgelss"); else { - lwork = static_cast (STD_OCTAVE::real (work(0))); + lwork = static_cast (STD_OCTAVE::real (work(0))); work.resize (lwork); F77_XFCN (zgelss, ZGELSS, (m, n, nrhs, tmp_data, m, presult, @@ -1933,8 +1933,8 @@ else { retval.resize (n, nrhs); - for (int j = 0; j < nrhs; j++) - for (int i = 0; i < n; i++) + for (octave_idx_type j = 0; j < nrhs; j++) + for (octave_idx_type i = 0; i < n; i++) retval.elem (i, j) = result.elem (i, j); } } @@ -1946,20 +1946,20 @@ ComplexColumnVector ComplexMatrix::lssolve (const ColumnVector& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (ComplexColumnVector (b), info, rank); } ComplexColumnVector -ComplexMatrix::lssolve (const ColumnVector& b, int& info) const +ComplexMatrix::lssolve (const ColumnVector& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (ComplexColumnVector (b), info, rank); } ComplexColumnVector -ComplexMatrix::lssolve (const ColumnVector& b, int& info, int& rank) const +ComplexMatrix::lssolve (const ColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const { return lssolve (ComplexColumnVector (b), info, rank); } @@ -1967,28 +1967,28 @@ ComplexColumnVector ComplexMatrix::lssolve (const ComplexColumnVector& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexColumnVector -ComplexMatrix::lssolve (const ComplexColumnVector& b, int& info) const +ComplexMatrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexColumnVector -ComplexMatrix::lssolve (const ComplexColumnVector& b, int& info, - int& rank) const +ComplexMatrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info, + octave_idx_type& rank) const { ComplexColumnVector retval; - int nrhs = 1; - - int m = rows (); - int n = cols (); + octave_idx_type nrhs = 1; + + octave_idx_type m = rows (); + octave_idx_type n = cols (); if (m == 0 || n == 0 || m != b.length ()) (*current_liboctave_error_handler) @@ -1998,28 +1998,28 @@ ComplexMatrix atmp = *this; Complex *tmp_data = atmp.fortran_vec (); - int nrr = m > n ? m : n; + octave_idx_type nrr = m > n ? m : n; ComplexColumnVector result (nrr); - for (int i = 0; i < m; i++) + for (octave_idx_type i = 0; i < m; i++) result.elem (i) = b.elem (i); Complex *presult = result.fortran_vec (); - int len_s = m < n ? m : n; + octave_idx_type len_s = m < n ? m : n; Array s (len_s); double *ps = s.fortran_vec (); double rcond = -1.0; - int lrwork = (5 * (m < n ? m : n)) - 4; + octave_idx_type lrwork = (5 * (m < n ? m : n)) - 4; lrwork = lrwork > 1 ? lrwork : 1; Array rwork (lrwork); double *prwork = rwork.fortran_vec (); // Ask ZGELSS what the dimension of WORK should be. - int lwork = -1; + octave_idx_type lwork = -1; Array work (1); @@ -2046,7 +2046,7 @@ else { retval.resize (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) retval.elem (i) = result.elem (i); } } @@ -2076,7 +2076,7 @@ ComplexMatrix m = *this; - int nc = columns (); + octave_idx_type nc = columns (); // Preconditioning step 1: trace normalization to reduce dynamic // range of poles, but avoid making stable eigenvalues unstable. @@ -2084,7 +2084,7 @@ // trace shift value Complex trshift = 0.0; - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) trshift += m.elem (i, i); trshift /= nc; @@ -2092,7 +2092,7 @@ if (trshift.real () < 0.0) trshift = trshift.imag (); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) m.elem (i, i) -= trshift; // Preconditioning step 2: eigenvalue balancing. @@ -2100,7 +2100,7 @@ Complex *mp = m.fortran_vec (); - int info, ilo, ihi,ilos,ihis; + octave_idx_type info, ilo, ihi,ilos,ihis; Array dpermute (nc); Array dscale (nc); @@ -2159,7 +2159,7 @@ if (sqpow > 0) { double scale_factor = 1.0; - for (int i = 0; i < sqpow; i++) + for (octave_idx_type i = 0; i < sqpow; i++) scale_factor *= 2.0; m = m / scale_factor; @@ -2173,7 +2173,7 @@ // Now powers a^8 ... a^1. int minus_one_j = -1; - for (int j = 7; j >= 0; j--) + for (octave_idx_type j = 7; j >= 0; j--) { npp = m * npp + m * padec[j]; dpp = m * dpp + m * (minus_one_j * padec[j]); @@ -2183,7 +2183,7 @@ // Zero power. dpp = -dpp; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { npp.elem (j, j) += 1.0; dpp.elem (j, j) += 1.0; @@ -2205,45 +2205,45 @@ // Done in two steps: inverse scaling, then inverse permutation // inverse scaling (diagonal transformation) - for (int i = 0; i < nc; i++) - for (int j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type j = 0; j < nc; j++) retval(i,j) *= dscale(i) / dscale(j); OCTAVE_QUIT; // construct balancing permutation vector Array iperm (nc); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) iperm(i) = i; // initialize to identity permutation // leading permutations in forward order - for (int i = 0; i < (ilo-1); i++) + for (octave_idx_type i = 0; i < (ilo-1); i++) { - int swapidx = static_cast (dpermute(i)) - 1; - int tmp = iperm(i); + octave_idx_type swapidx = static_cast (dpermute(i)) - 1; + octave_idx_type tmp = iperm(i); iperm(i) = iperm(swapidx); iperm(swapidx) = tmp; } // trailing permutations must be done in reverse order - for (int i = nc - 1; i >= ihi; i--) + for (octave_idx_type i = nc - 1; i >= ihi; i--) { - int swapidx = static_cast (dpermute(i)) - 1; - int tmp = iperm(i); + octave_idx_type swapidx = static_cast (dpermute(i)) - 1; + octave_idx_type tmp = iperm(i); iperm(i) = iperm(swapidx); iperm(swapidx) = tmp; } // construct inverse balancing permutation vector Array invpvec (nc); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) invpvec(iperm(i)) = i; // Thanks to R. A. Lippert for this method OCTAVE_QUIT; ComplexMatrix tmpMat = retval; - for (int i = 0; i < nc; i++) - for (int j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type j = 0; j < nc; j++) retval(i,j) = tmpMat(invpvec(i),invpvec(j)); // Reverse preconditioning step 1: fix trace normalization. @@ -2272,11 +2272,11 @@ { ComplexMatrix retval; - int len = v.length (); + octave_idx_type len = v.length (); if (len != 0) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); retval.resize (len, a_len); Complex *c = retval.fortran_vec (); @@ -2301,11 +2301,11 @@ ComplexMatrix& ComplexMatrix::operator += (const DiagMatrix& a) { - int nr = rows (); - int nc = cols (); - - int a_nr = rows (); - int a_nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type a_nr = rows (); + octave_idx_type a_nc = cols (); if (nr != a_nr || nc != a_nc) { @@ -2313,7 +2313,7 @@ return *this; } - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) += a.elem (i, i); return *this; @@ -2322,11 +2322,11 @@ ComplexMatrix& ComplexMatrix::operator -= (const DiagMatrix& a) { - int nr = rows (); - int nc = cols (); - - int a_nr = rows (); - int a_nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type a_nr = rows (); + octave_idx_type a_nc = cols (); if (nr != a_nr || nc != a_nc) { @@ -2334,7 +2334,7 @@ return *this; } - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) -= a.elem (i, i); return *this; @@ -2343,11 +2343,11 @@ ComplexMatrix& ComplexMatrix::operator += (const ComplexDiagMatrix& a) { - int nr = rows (); - int nc = cols (); - - int a_nr = rows (); - int a_nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type a_nr = rows (); + octave_idx_type a_nc = cols (); if (nr != a_nr || nc != a_nc) { @@ -2355,7 +2355,7 @@ return *this; } - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) += a.elem (i, i); return *this; @@ -2364,11 +2364,11 @@ ComplexMatrix& ComplexMatrix::operator -= (const ComplexDiagMatrix& a) { - int nr = rows (); - int nc = cols (); - - int a_nr = rows (); - int a_nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type a_nr = rows (); + octave_idx_type a_nc = cols (); if (nr != a_nr || nc != a_nc) { @@ -2376,7 +2376,7 @@ return *this; } - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) -= a.elem (i, i); return *this; @@ -2387,11 +2387,11 @@ ComplexMatrix& ComplexMatrix::operator += (const Matrix& a) { - int nr = rows (); - int nc = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (nr != a_nr || nc != a_nc) { @@ -2411,11 +2411,11 @@ ComplexMatrix& ComplexMatrix::operator -= (const Matrix& a) { - int nr = rows (); - int nc = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (nr != a_nr || nc != a_nc) { @@ -2437,13 +2437,13 @@ boolMatrix ComplexMatrix::operator ! (void) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); boolMatrix b (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) b.elem (i, j) = elem (i, j) == 0.0; return b; @@ -2461,13 +2461,13 @@ Matrix ComplexMatrix::map (d_c_Mapper f) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); Matrix retval (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = f (elem(i,j)); return retval; @@ -2476,13 +2476,13 @@ boolMatrix ComplexMatrix::map (b_c_Mapper f) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); boolMatrix retval (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = f (elem(i,j)); return retval; @@ -2493,7 +2493,7 @@ { Complex *d = fortran_vec (); // Ensures only one reference to my privates! - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) d[i] = f (d[i]); return *this; @@ -2502,11 +2502,11 @@ bool ComplexMatrix::any_element_is_inf_or_nan (void) const { - int nr = rows (); - int nc = cols (); - - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { Complex val = elem (i, j); if (xisinf (val) || xisnan (val)) @@ -2521,12 +2521,12 @@ bool ComplexMatrix::all_elements_are_real (void) const { - int nr = rows (); - int nc = cols (); - - for (int j = 0; j < nc; j++) + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { double ip = STD_OCTAVE::imag (elem (i, j)); @@ -2545,8 +2545,8 @@ bool ComplexMatrix::all_integers (double& max_val, double& min_val) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { @@ -2567,8 +2567,8 @@ else return false; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { Complex val = elem (i, j); @@ -2597,11 +2597,11 @@ bool ComplexMatrix::too_large_for_float (void) const { - int nr = rows (); - int nc = cols (); - - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { Complex val = elem (i, j); @@ -2676,13 +2676,13 @@ Matrix ComplexMatrix::abs (void) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); Matrix retval (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval (i, j) = STD_OCTAVE::abs (elem (i, j)); return retval; @@ -2695,10 +2695,10 @@ } ComplexColumnVector -ComplexMatrix::diag (int k) const +ComplexMatrix::diag (octave_idx_type k) const { - int nnr = rows (); - int nnc = cols (); + octave_idx_type nnr = rows (); + octave_idx_type nnc = cols (); if (k > 0) nnc -= k; else if (k < 0) @@ -2708,23 +2708,23 @@ if (nnr > 0 && nnc > 0) { - int ndiag = (nnr < nnc) ? nnr : nnc; + octave_idx_type ndiag = (nnr < nnc) ? nnr : nnc; d.resize (ndiag); if (k > 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i, i+k); } else if (k < 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i-k, i); } else { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i, i); } } @@ -2736,13 +2736,13 @@ } bool -ComplexMatrix::row_is_real_only (int i) const +ComplexMatrix::row_is_real_only (octave_idx_type i) const { bool retval = true; - int nc = columns (); - - for (int j = 0; j < nc; j++) + octave_idx_type nc = columns (); + + for (octave_idx_type j = 0; j < nc; j++) { if (STD_OCTAVE::imag (elem (i, j)) != 0.0) { @@ -2755,13 +2755,13 @@ } bool -ComplexMatrix::column_is_real_only (int j) const +ComplexMatrix::column_is_real_only (octave_idx_type j) const { bool retval = true; - int nr = rows (); - - for (int i = 0; i < nr; i++) + octave_idx_type nr = rows (); + + for (octave_idx_type i = 0; i < nr; i++) { if (STD_OCTAVE::imag (elem (i, j)) != 0.0) { @@ -2776,28 +2776,28 @@ ComplexColumnVector ComplexMatrix::row_min (void) const { - Array dummy_idx; + Array dummy_idx; return row_min (dummy_idx); } ComplexColumnVector -ComplexMatrix::row_min (Array& idx_arg) const +ComplexMatrix::row_min (Array& idx_arg) const { ComplexColumnVector result; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { result.resize (nr); idx_arg.resize (nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { bool real_only = row_is_real_only (i); - int idx_j; + octave_idx_type idx_j; Complex tmp_min; @@ -2814,7 +2814,7 @@ } } - for (int j = idx_j+1; j < nc; j++) + for (octave_idx_type j = idx_j+1; j < nc; j++) { Complex tmp = elem (i, j); @@ -2850,28 +2850,28 @@ ComplexColumnVector ComplexMatrix::row_max (void) const { - Array dummy_idx; + Array dummy_idx; return row_max (dummy_idx); } ComplexColumnVector -ComplexMatrix::row_max (Array& idx_arg) const +ComplexMatrix::row_max (Array& idx_arg) const { ComplexColumnVector result; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { result.resize (nr); idx_arg.resize (nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { bool real_only = row_is_real_only (i); - int idx_j; + octave_idx_type idx_j; Complex tmp_max; @@ -2888,7 +2888,7 @@ } } - for (int j = idx_j+1; j < nc; j++) + for (octave_idx_type j = idx_j+1; j < nc; j++) { Complex tmp = elem (i, j); @@ -2924,28 +2924,28 @@ ComplexRowVector ComplexMatrix::column_min (void) const { - Array dummy_idx; + Array dummy_idx; return column_min (dummy_idx); } ComplexRowVector -ComplexMatrix::column_min (Array& idx_arg) const +ComplexMatrix::column_min (Array& idx_arg) const { ComplexRowVector result; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { result.resize (nc); idx_arg.resize (nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { bool real_only = column_is_real_only (j); - int idx_i; + octave_idx_type idx_i; Complex tmp_min; @@ -2962,7 +2962,7 @@ } } - for (int i = idx_i+1; i < nr; i++) + for (octave_idx_type i = idx_i+1; i < nr; i++) { Complex tmp = elem (i, j); @@ -2998,28 +2998,28 @@ ComplexRowVector ComplexMatrix::column_max (void) const { - Array dummy_idx; + Array dummy_idx; return column_max (dummy_idx); } ComplexRowVector -ComplexMatrix::column_max (Array& idx_arg) const +ComplexMatrix::column_max (Array& idx_arg) const { ComplexRowVector result; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { result.resize (nc); idx_arg.resize (nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { bool real_only = column_is_real_only (j); - int idx_i; + octave_idx_type idx_i; Complex tmp_max; @@ -3036,7 +3036,7 @@ } } - for (int i = idx_i+1; i < nr; i++) + for (octave_idx_type i = idx_i+1; i < nr; i++) { Complex tmp = elem (i, j); @@ -3074,9 +3074,9 @@ std::ostream& operator << (std::ostream& os, const ComplexMatrix& a) { - for (int i = 0; i < a.rows (); i++) + for (octave_idx_type i = 0; i < a.rows (); i++) { - for (int j = 0; j < a.cols (); j++) + for (octave_idx_type j = 0; j < a.cols (); j++) { os << " "; octave_write_complex (os, a.elem (i, j)); @@ -3089,16 +3089,16 @@ std::istream& operator >> (std::istream& is, ComplexMatrix& a) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); if (nr < 1 || nc < 1) is.clear (std::ios::badbit); else { Complex tmp; - for (int i = 0; i < nr; i++) - for (int j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) { tmp = octave_read_complex (is); if (is) @@ -3158,11 +3158,11 @@ // Solve the sylvester equation, back-transform, and return the // solution. - int a_nr = a.rows (); - int b_nr = b.rows (); + octave_idx_type a_nr = a.rows (); + octave_idx_type b_nr = b.rows (); double scale; - int info; + octave_idx_type info; Complex *pa = sch_a.fortran_vec (); Complex *pb = sch_b.fortran_vec (); @@ -3206,11 +3206,11 @@ { ComplexMatrix retval; - int nr = m.rows (); - int nc = m.cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.cols (); + + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (nc != a_nr) gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); @@ -3220,8 +3220,8 @@ retval.resize (nr, a_nc, 0.0); else { - int ld = nr; - int lda = a.rows (); + octave_idx_type ld = nr; + octave_idx_type lda = a.rows (); retval.resize (nr, a_nc); Complex *c = retval.fortran_vec (); @@ -3252,15 +3252,15 @@ ComplexMatrix min (const Complex& c, const ComplexMatrix& m) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (ComplexMatrix); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmin (c, m (i, j)); @@ -3272,15 +3272,15 @@ ComplexMatrix min (const ComplexMatrix& m, const Complex& c) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (ComplexMatrix); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmin (m (i, j), c); @@ -3292,8 +3292,8 @@ ComplexMatrix min (const ComplexMatrix& a, const ComplexMatrix& b) { - int nr = a.rows (); - int nc = a.columns (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.columns (); if (nr != b.rows () || nc != b.columns ()) { @@ -3306,10 +3306,10 @@ ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { int columns_are_real_only = 1; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; if (STD_OCTAVE::imag (a (i, j)) != 0.0 || STD_OCTAVE::imag (b (i, j)) != 0.0) @@ -3321,12 +3321,12 @@ if (columns_are_real_only) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) result (i, j) = xmin (STD_OCTAVE::real (a (i, j)), STD_OCTAVE::real (b (i, j))); } else { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmin (a (i, j), b (i, j)); @@ -3340,15 +3340,15 @@ ComplexMatrix max (const Complex& c, const ComplexMatrix& m) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (ComplexMatrix); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmax (c, m (i, j)); @@ -3360,15 +3360,15 @@ ComplexMatrix max (const ComplexMatrix& m, const Complex& c) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (ComplexMatrix); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmax (m (i, j), c); @@ -3380,8 +3380,8 @@ ComplexMatrix max (const ComplexMatrix& a, const ComplexMatrix& b) { - int nr = a.rows (); - int nc = a.columns (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.columns (); if (nr != b.rows () || nc != b.columns ()) { @@ -3394,10 +3394,10 @@ ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { int columns_are_real_only = 1; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; if (STD_OCTAVE::imag (a (i, j)) != 0.0 || STD_OCTAVE::imag (b (i, j)) != 0.0) @@ -3409,7 +3409,7 @@ if (columns_are_real_only) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmax (STD_OCTAVE::real (a (i, j)), STD_OCTAVE::real (b (i, j))); @@ -3417,7 +3417,7 @@ } else { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmax (a (i, j), b (i, j)); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CMatrix.h --- a/liboctave/CMatrix.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CMatrix.h Fri Apr 08 16:07:37 2005 +0000 @@ -39,9 +39,9 @@ ComplexMatrix (void) : MArray2 () { } - ComplexMatrix (int r, int c) : MArray2 (r, c) { } + ComplexMatrix (octave_idx_type r, octave_idx_type c) : MArray2 (r, c) { } - ComplexMatrix (int r, int c, const Complex& val) + ComplexMatrix (octave_idx_type r, octave_idx_type c, const Complex& val) : MArray2 (r, c, val) { } ComplexMatrix (const ComplexMatrix& a) : MArray2 (a) { } @@ -79,20 +79,20 @@ // destructive insert/delete/reorder operations - ComplexMatrix& insert (const Matrix& a, int r, int c); - ComplexMatrix& insert (const RowVector& a, int r, int c); - ComplexMatrix& insert (const ColumnVector& a, int r, int c); - ComplexMatrix& insert (const DiagMatrix& a, int r, int c); + ComplexMatrix& insert (const Matrix& a, octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const RowVector& a, octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const ColumnVector& a, octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const DiagMatrix& a, octave_idx_type r, octave_idx_type c); - ComplexMatrix& insert (const ComplexMatrix& a, int r, int c); - ComplexMatrix& insert (const ComplexRowVector& a, int r, int c); - ComplexMatrix& insert (const ComplexColumnVector& a, int r, int c); - ComplexMatrix& insert (const ComplexDiagMatrix& a, int r, int c); + ComplexMatrix& insert (const ComplexMatrix& a, octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const ComplexRowVector& a, octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const ComplexColumnVector& a, octave_idx_type r, octave_idx_type c); + ComplexMatrix& insert (const ComplexDiagMatrix& a, octave_idx_type r, octave_idx_type c); ComplexMatrix& fill (double val); ComplexMatrix& fill (const Complex& val); - ComplexMatrix& fill (double val, int r1, int c1, int r2, int c2); - ComplexMatrix& fill (const Complex& val, int r1, int c1, int r2, int c2); + ComplexMatrix& fill (double val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); + ComplexMatrix& fill (const Complex& val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); ComplexMatrix append (const Matrix& a) const; ComplexMatrix append (const RowVector& a) const; @@ -122,21 +122,21 @@ // resize is the destructive equivalent for this one - ComplexMatrix extract (int r1, int c1, int r2, int c2) const; + ComplexMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; - ComplexMatrix extract_n (int r1, int c1, int nr, int nc) const; + ComplexMatrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const; // extract row or column i. - ComplexRowVector row (int i) const; + ComplexRowVector row (octave_idx_type i) const; ComplexRowVector row (char *s) const; - ComplexColumnVector column (int i) const; + ComplexColumnVector column (octave_idx_type i) const; ComplexColumnVector column (char *s) const; ComplexMatrix inverse (void) const; - ComplexMatrix inverse (int& info) const; - ComplexMatrix inverse (int& info, double& rcond, int force = 0, + ComplexMatrix inverse (octave_idx_type& info) const; + ComplexMatrix inverse (octave_idx_type& info, double& rcond, int force = 0, int calc_cond = 1) const; ComplexMatrix pseudo_inverse (double tol = 0.0) const; @@ -148,54 +148,54 @@ ComplexMatrix ifourier2d (void) const; ComplexDET determinant (void) const; - ComplexDET determinant (int& info) const; - ComplexDET determinant (int& info, double& rcond, int calc_cond = 1) const; + ComplexDET determinant (octave_idx_type& info) const; + ComplexDET determinant (octave_idx_type& info, double& rcond, int calc_cond = 1) const; ComplexMatrix solve (const Matrix& b) const; - ComplexMatrix solve (const Matrix& b, int& info) const; - ComplexMatrix solve (const Matrix& b, int& info, double& rcond) const; - ComplexMatrix solve (const Matrix& b, int& info, double& rcond, + ComplexMatrix solve (const Matrix& b, octave_idx_type& info) const; + ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcond) const; + 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, int& info) const; - ComplexMatrix solve (const ComplexMatrix& b, int& info, double& rcond) const; - ComplexMatrix solve (const ComplexMatrix& b, int& info, double& rcond, + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexColumnVector solve (const ColumnVector& b) const; - ComplexColumnVector solve (const ColumnVector& b, int& info) const; - ComplexColumnVector solve (const ColumnVector& b, int& info, + 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, int& info, double& rcond, + 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, int& info) const; - ComplexColumnVector solve (const ComplexColumnVector& b, int& info, + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const; - ComplexColumnVector solve (const ComplexColumnVector& b, int& info, + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexMatrix lssolve (const Matrix& b) const; - ComplexMatrix lssolve (const Matrix& b, int& info) const; - ComplexMatrix lssolve (const Matrix& b, int& info, int& rank) const; + ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info) const; + ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank) const; ComplexMatrix lssolve (const ComplexMatrix& b) const; - ComplexMatrix lssolve (const ComplexMatrix& b, int& info) const; - ComplexMatrix lssolve (const ComplexMatrix& b, int& info, - int& rank) const; + ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info) const; + ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info, + octave_idx_type& rank) const; ComplexColumnVector lssolve (const ColumnVector& b) const; - ComplexColumnVector lssolve (const ColumnVector& b, int& info) const; - ComplexColumnVector lssolve (const ColumnVector& b, int& info, - int& rank) const; + ComplexColumnVector lssolve (const ColumnVector& b, octave_idx_type& info) const; + ComplexColumnVector lssolve (const ColumnVector& b, octave_idx_type& info, + octave_idx_type& rank) const; ComplexColumnVector lssolve (const ComplexColumnVector& b) const; - ComplexColumnVector lssolve (const ComplexColumnVector& b, int& info) const; - ComplexColumnVector lssolve (const ComplexColumnVector& b, int& info, - int& rank) const; + ComplexColumnVector lssolve (const ComplexColumnVector& b, octave_idx_type& info) const; + ComplexColumnVector lssolve (const ComplexColumnVector& b, octave_idx_type& info, + octave_idx_type& rank) const; ComplexMatrix expm (void) const; @@ -251,22 +251,22 @@ Matrix abs (void) const; ComplexColumnVector diag (void) const; - ComplexColumnVector diag (int k) const; + ComplexColumnVector diag (octave_idx_type k) const; - bool row_is_real_only (int) const; - bool column_is_real_only (int) const; + bool row_is_real_only (octave_idx_type) const; + bool column_is_real_only (octave_idx_type) const; ComplexColumnVector row_min (void) const; ComplexColumnVector row_max (void) const; - ComplexColumnVector row_min (Array& index) const; - ComplexColumnVector row_max (Array& index) const; + ComplexColumnVector row_min (Array& index) const; + ComplexColumnVector row_max (Array& index) const; ComplexRowVector column_min (void) const; ComplexRowVector column_max (void) const; - ComplexRowVector column_min (Array& index) const; - ComplexRowVector column_max (Array& index) const; + ComplexRowVector column_min (Array& index) const; + ComplexRowVector column_max (Array& index) const; // i/o @@ -277,7 +277,7 @@ private: - ComplexMatrix (Complex *d, int r, int c) : MArray2 (d, r, c) { } + ComplexMatrix (Complex *d, octave_idx_type r, octave_idx_type c) : MArray2 (d, r, c) { } }; ComplexMatrix Givens (const Complex&, const Complex&); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CNDArray.cc --- a/liboctave/CNDArray.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CNDArray.cc Fri Apr 08 16:07:37 2005 +0000 @@ -47,13 +47,13 @@ // each subroutine. F77_RET_T - F77_FUNC (cffti, CFFTI) (const int&, Complex*); + F77_FUNC (cffti, CFFTI) (const octave_idx_type&, Complex*); F77_RET_T - F77_FUNC (cfftf, CFFTF) (const int&, Complex*, Complex*); + F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, Complex*, Complex*); F77_RET_T - F77_FUNC (cfftb, CFFTB) (const int&, Complex*, Complex*); + F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, Complex*, Complex*); } #endif @@ -66,23 +66,23 @@ if (dim > dv.length () || dim < 0) return ComplexNDArray (); - int stride = 1; - int n = dv(dim); + octave_idx_type stride = 1; + octave_idx_type n = dv(dim); for (int i = 0; i < dim; i++) stride *= dv(i); - int howmany = numel () / dv (dim); + octave_idx_type howmany = numel () / dv (dim); howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); - int dist = (stride == 1 ? n : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); + octave_idx_type dist = (stride == 1 ? n : 1); const Complex *in (fortran_vec ()); ComplexNDArray retval (dv); Complex *out (retval.fortran_vec ()); // Need to be careful here about the distance between fft's - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) octave_fftw::fft (in + k * stride * n, out + k * stride * n, n, howmany, stride, dist); @@ -97,23 +97,23 @@ if (dim > dv.length () || dim < 0) return ComplexNDArray (); - int stride = 1; - int n = dv(dim); + octave_idx_type stride = 1; + octave_idx_type n = dv(dim); for (int i = 0; i < dim; i++) stride *= dv(i); - int howmany = numel () / dv (dim); + octave_idx_type howmany = numel () / dv (dim); howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); - int dist = (stride == 1 ? n : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); + octave_idx_type dist = (stride == 1 ? n : 1); const Complex *in (fortran_vec ()); ComplexNDArray retval (dv); Complex *out (retval.fortran_vec ()); // Need to be careful here about the distance between fft's - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) octave_fftw::ifft (in + k * stride * n, out + k * stride * n, n, howmany, stride, dist); @@ -131,10 +131,10 @@ const Complex *in = fortran_vec (); ComplexNDArray retval (dv); Complex *out = retval.fortran_vec (); - int howmany = numel() / dv(0) / dv(1); - int dist = dv(0) * dv(1); + octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type dist = dv(0) * dv(1); - for (int i=0; i < howmany; i++) + for (octave_idx_type i=0; i < howmany; i++) octave_fftw::fftNd (in + i*dist, out + i*dist, 2, dv2); return retval; @@ -151,10 +151,10 @@ const Complex *in = fortran_vec (); ComplexNDArray retval (dv); Complex *out = retval.fortran_vec (); - int howmany = numel() / dv(0) / dv(1); - int dist = dv(0) * dv(1); + octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type dist = dv(0) * dv(1); - for (int i=0; i < howmany; i++) + for (octave_idx_type i=0; i < howmany; i++) octave_fftw::ifftNd (in + i*dist, out + i*dist, 2, dv2); return retval; @@ -200,37 +200,37 @@ return ComplexNDArray (); ComplexNDArray retval (dv); - int npts = dv(dim); - int nn = 4*npts+15; + octave_idx_type npts = dv(dim); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); OCTAVE_LOCAL_BUFFER (Complex, tmp, npts); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < dim; i++) stride *= dv(i); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) tmp[i] = elem((i + k*npts)*stride + j*dist); F77_FUNC (cfftf, CFFTF) (npts, tmp, pwsave); - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) retval ((i + k*npts)*stride + j*dist) = tmp[i]; } } @@ -247,37 +247,37 @@ return ComplexNDArray (); ComplexNDArray retval (dv); - int npts = dv(dim); - int nn = 4*npts+15; + octave_idx_type npts = dv(dim); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); OCTAVE_LOCAL_BUFFER (Complex, tmp, npts); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < dim; i++) stride *= dv(i); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) tmp[i] = elem((i + k*npts)*stride + j*dist); F77_FUNC (cfftb, CFFTB) (npts, tmp, pwsave); - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) retval ((i + k*npts)*stride + j*dist) = tmp[i] / static_cast (npts); } @@ -293,37 +293,37 @@ dim_vector dv2 (dv(0), dv(1)); int rank = 2; ComplexNDArray retval (*this); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < rank; i++) { - int npts = dv2(i); - int nn = 4*npts+15; + octave_idx_type npts = dv2(i); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); Array row (npts); Complex *prow = row.fortran_vec (); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) prow[l] = retval ((l + k*npts)*stride + j*dist); F77_FUNC (cfftf, CFFTF) (npts, prow, pwsave); - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) retval ((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -341,37 +341,37 @@ dim_vector dv2 (dv(0), dv(1)); int rank = 2; ComplexNDArray retval (*this); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < rank; i++) { - int npts = dv2(i); - int nn = 4*npts+15; + octave_idx_type npts = dv2(i); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); Array row (npts); Complex *prow = row.fortran_vec (); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) prow[l] = retval ((l + k*npts)*stride + j*dist); F77_FUNC (cfftb, CFFTB) (npts, prow, pwsave); - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) retval ((l + k*npts)*stride + j*dist) = prow[l] / static_cast (npts); } @@ -389,37 +389,37 @@ dim_vector dv = dims (); int rank = dv.length (); ComplexNDArray retval (*this); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < rank; i++) { - int npts = dv(i); - int nn = 4*npts+15; + octave_idx_type npts = dv(i); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); Array row (npts); Complex *prow = row.fortran_vec (); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) prow[l] = retval ((l + k*npts)*stride + j*dist); F77_FUNC (cfftf, CFFTF) (npts, prow, pwsave); - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) retval ((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -436,37 +436,37 @@ dim_vector dv = dims (); int rank = dv.length (); ComplexNDArray retval (*this); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < rank; i++) { - int npts = dv(i); - int nn = 4*npts+15; + octave_idx_type npts = dv(i); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); Array row (npts); Complex *prow = row.fortran_vec (); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) prow[l] = retval ((l + k*npts)*stride + j*dist); F77_FUNC (cfftb, CFFTB) (npts, prow, pwsave); - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) retval ((l + k*npts)*stride + j*dist) = prow[l] / static_cast (npts); } @@ -487,7 +487,7 @@ { boolNDArray b (dims ()); - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) b.elem (i) = elem (i) == 0.0; return b; @@ -498,9 +498,9 @@ bool ComplexNDArray::any_element_is_inf_or_nan (void) const { - int nel = nelem (); + octave_idx_type nel = nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { Complex val = elem (i); if (xisinf (val) || xisnan (val)) @@ -514,9 +514,9 @@ bool ComplexNDArray::all_elements_are_real (void) const { - int nel = nelem (); + octave_idx_type nel = nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { double ip = std::imag (elem (i)); @@ -534,7 +534,7 @@ bool ComplexNDArray::all_integers (double& max_val, double& min_val) const { - int nel = nelem (); + octave_idx_type nel = nelem (); if (nel > 0) { @@ -555,7 +555,7 @@ else return false; - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { Complex val = elem (i); @@ -584,9 +584,9 @@ bool ComplexNDArray::too_large_for_float (void) const { - int nel = nelem (); + octave_idx_type nel = nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { Complex val = elem (i); @@ -654,7 +654,7 @@ } ComplexNDArray -ComplexNDArray::concat (const ComplexNDArray& rb, const Array& ra_idx) +ComplexNDArray::concat (const ComplexNDArray& rb, const Array& ra_idx) { if (rb.numel () > 0) insert (rb, ra_idx); @@ -662,7 +662,7 @@ } ComplexNDArray -ComplexNDArray::concat (const NDArray& rb, const Array& ra_idx) +ComplexNDArray::concat (const NDArray& rb, const Array& ra_idx) { ComplexNDArray tmp (rb); if (rb.numel () > 0) @@ -671,7 +671,7 @@ } ComplexNDArray -concat (NDArray& ra, ComplexNDArray& rb, const Array& ra_idx) +concat (NDArray& ra, ComplexNDArray& rb, const Array& ra_idx) { ComplexNDArray retval (ra); if (rb.numel () > 0) @@ -684,12 +684,12 @@ ComplexNDArray ComplexNDArray::max (int dim) const { - ArrayN dummy_idx; + ArrayN dummy_idx; return max (dummy_idx, dim); } ComplexNDArray -ComplexNDArray::max (ArrayN& idx_arg, int dim) const +ComplexNDArray::max (ArrayN& idx_arg, int dim) const { dim_vector dv = dims (); dim_vector dr = dims (); @@ -702,19 +702,19 @@ ComplexNDArray result (dr); idx_arg.resize (dr); - int x_stride = 1; - int x_len = dv(dim); + octave_idx_type x_stride = 1; + octave_idx_type x_len = dv(dim); for (int i = 0; i < dim; i++) x_stride *= dv(i); - for (int i = 0; i < dr.numel (); i++) + for (octave_idx_type i = 0; i < dr.numel (); i++) { - int x_offset; + octave_idx_type x_offset; if (x_stride == 1) x_offset = i * x_len; else { - int x_offset2 = 0; + octave_idx_type x_offset2 = 0; x_offset = i; while (x_offset >= x_stride) { @@ -724,7 +724,7 @@ x_offset += x_offset2 * x_stride * x_len; } - int idx_j; + octave_idx_type idx_j; Complex tmp_max; @@ -741,7 +741,7 @@ } } - for (int j = idx_j+1; j < x_len; j++) + for (octave_idx_type j = idx_j+1; j < x_len; j++) { Complex tmp = elem (j * x_stride + x_offset); @@ -776,12 +776,12 @@ ComplexNDArray ComplexNDArray::min (int dim) const { - ArrayN dummy_idx; + ArrayN dummy_idx; return min (dummy_idx, dim); } ComplexNDArray -ComplexNDArray::min (ArrayN& idx_arg, int dim) const +ComplexNDArray::min (ArrayN& idx_arg, int dim) const { dim_vector dv = dims (); dim_vector dr = dims (); @@ -794,19 +794,19 @@ ComplexNDArray result (dr); idx_arg.resize (dr); - int x_stride = 1; - int x_len = dv(dim); + octave_idx_type x_stride = 1; + octave_idx_type x_len = dv(dim); for (int i = 0; i < dim; i++) x_stride *= dv(i); - for (int i = 0; i < dr.numel (); i++) + for (octave_idx_type i = 0; i < dr.numel (); i++) { - int x_offset; + octave_idx_type x_offset; if (x_stride == 1) x_offset = i * x_len; else { - int x_offset2 = 0; + octave_idx_type x_offset2 = 0; x_offset = i; while (x_offset >= x_stride) { @@ -816,7 +816,7 @@ x_offset += x_offset2 * x_stride * x_len; } - int idx_j; + octave_idx_type idx_j; Complex tmp_min; @@ -833,7 +833,7 @@ } } - for (int j = idx_j+1; j < x_len; j++) + for (octave_idx_type j = idx_j+1; j < x_len; j++) { Complex tmp = elem (j * x_stride + x_offset); @@ -870,16 +870,16 @@ { NDArray retval (dims ()); - int nel = nelem (); + octave_idx_type nel = nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) retval(i) = std::abs (elem (i)); return retval; } ComplexNDArray& -ComplexNDArray::insert (const NDArray& a, int r, int c) +ComplexNDArray::insert (const NDArray& a, octave_idx_type r, octave_idx_type c) { dim_vector a_dv = a.dims (); @@ -887,7 +887,7 @@ if (n == dimensions.length ()) { - Array a_ra_idx (a_dv.length (), 0); + Array a_ra_idx (a_dv.length (), 0); a_ra_idx.elem (0) = r; a_ra_idx.elem (1) = c; @@ -905,13 +905,13 @@ a_ra_idx.elem (0) = 0; a_ra_idx.elem (1) = 0; - int n_elt = a.numel (); + octave_idx_type n_elt = a.numel (); // IS make_unique () NECCESSARY HERE?? - for (int i = 0; i < n_elt; i++) + for (octave_idx_type i = 0; i < n_elt; i++) { - Array ra_idx = a_ra_idx; + Array ra_idx = a_ra_idx; ra_idx.elem (0) = a_ra_idx (0) + r; ra_idx.elem (1) = a_ra_idx (1) + c; @@ -929,14 +929,14 @@ } ComplexNDArray& -ComplexNDArray::insert (const ComplexNDArray& a, int r, int c) +ComplexNDArray::insert (const ComplexNDArray& a, octave_idx_type r, octave_idx_type c) { Array::insert (a, r, c); return *this; } ComplexNDArray& -ComplexNDArray::insert (const ComplexNDArray& a, const Array& ra_idx) +ComplexNDArray::insert (const ComplexNDArray& a, const Array& ra_idx) { Array::insert (a, ra_idx); return *this; @@ -970,15 +970,15 @@ } void -ComplexNDArray::increment_index (Array& ra_idx, +ComplexNDArray::increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension) { ::increment_index (ra_idx, dimensions, start_dimension); } -int -ComplexNDArray::compute_index (Array& ra_idx, +octave_idx_type +ComplexNDArray::compute_index (Array& ra_idx, const dim_vector& dimensions) { return ::compute_index (ra_idx, dimensions); @@ -989,9 +989,9 @@ std::ostream& operator << (std::ostream& os, const ComplexNDArray& a) { - int nel = a.nelem (); + octave_idx_type nel = a.nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { os << " "; octave_write_complex (os, a.elem (i)); @@ -1003,14 +1003,14 @@ std::istream& operator >> (std::istream& is, ComplexNDArray& a) { - int nel = a.nelem (); + octave_idx_type nel = a.nelem (); if (nel < 1 ) is.clear (std::ios::badbit); else { Complex tmp; - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { tmp = octave_read_complex (is); if (is) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CNDArray.h --- a/liboctave/CNDArray.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CNDArray.h Fri Apr 08 16:07:37 2005 +0000 @@ -72,17 +72,16 @@ ComplexNDArray prod (int dim = -1) const; ComplexNDArray sum (int dim = -1) const; ComplexNDArray sumsq (int dim = -1) const; - ComplexNDArray concat (const ComplexNDArray& rb, const Array& ra_idx); - ComplexNDArray concat (const NDArray& rb, const Array& ra_idx); + ComplexNDArray concat (const ComplexNDArray& rb, const Array& ra_idx); + ComplexNDArray concat (const NDArray& rb, const Array& ra_idx); ComplexNDArray max (int dim = 0) const; - ComplexNDArray max (ArrayN& index, int dim = 0) const; + ComplexNDArray max (ArrayN& index, int dim = 0) const; ComplexNDArray min (int dim = 0) const; - ComplexNDArray min (ArrayN& index, int dim = 0) const; - - ComplexNDArray& insert (const NDArray& a, int r, int c); - ComplexNDArray& insert (const ComplexNDArray& a, int r, int c); - ComplexNDArray& insert (const ComplexNDArray& a, const Array& ra_idx); + ComplexNDArray min (ArrayN& index, int dim = 0) const; + ComplexNDArray& insert (const NDArray& a, octave_idx_type r, octave_idx_type c); + ComplexNDArray& insert (const ComplexNDArray& a, octave_idx_type r, octave_idx_type c); + ComplexNDArray& insert (const ComplexNDArray& a, const Array& ra_idx); NDArray abs (void) const; @@ -99,11 +98,11 @@ ComplexNDArray squeeze (void) const { return MArrayN::squeeze (); } - static void increment_index (Array& ra_idx, + static void increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension = 0); - static int compute_index (Array& ra_idx, + static octave_idx_type compute_index (Array& ra_idx, const dim_vector& dimensions); // i/o diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CRowVector.cc --- a/liboctave/CRowVector.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CRowVector.cc Fri Apr 08 16:07:37 2005 +0000 @@ -40,9 +40,9 @@ { F77_RET_T F77_FUNC (zgemv, ZGEMV) (F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const Complex&, - const Complex*, const int&, const Complex*, - const int&, const Complex&, Complex*, const int& + const octave_idx_type&, const octave_idx_type&, const Complex&, + const Complex*, const octave_idx_type&, const Complex*, + const octave_idx_type&, const Complex&, Complex*, const octave_idx_type& F77_CHAR_ARG_LEN_DECL); } @@ -51,14 +51,14 @@ ComplexRowVector::ComplexRowVector (const RowVector& a) : MArray (a.length ()) { - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) elem (i) = a.elem (i); } bool ComplexRowVector::operator == (const ComplexRowVector& a) const { - int len = length (); + octave_idx_type len = length (); if (len != a.length ()) return 0; return mx_inline_equal (data (), a.data (), len); @@ -73,9 +73,9 @@ // destructive insert/delete/reorder operations ComplexRowVector& -ComplexRowVector::insert (const RowVector& a, int c) +ComplexRowVector::insert (const RowVector& a, octave_idx_type c) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (c < 0 || c + a_len > length ()) { @@ -87,7 +87,7 @@ { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (c+i) = a.elem (i); } @@ -95,9 +95,9 @@ } ComplexRowVector& -ComplexRowVector::insert (const ComplexRowVector& a, int c) +ComplexRowVector::insert (const ComplexRowVector& a, octave_idx_type c) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (c < 0 || c + a_len > length ()) { @@ -109,7 +109,7 @@ { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (c+i) = a.elem (i); } @@ -119,13 +119,13 @@ ComplexRowVector& ComplexRowVector::fill (double val) { - int len = length (); + octave_idx_type len = length (); if (len > 0) { make_unique (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) xelem (i) = val; } @@ -135,13 +135,13 @@ ComplexRowVector& ComplexRowVector::fill (const Complex& val) { - int len = length (); + octave_idx_type len = length (); if (len > 0) { make_unique (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) xelem (i) = val; } @@ -149,9 +149,9 @@ } ComplexRowVector& -ComplexRowVector::fill (double val, int c1, int c2) +ComplexRowVector::fill (double val, octave_idx_type c1, octave_idx_type c2) { - int len = length (); + octave_idx_type len = length (); if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) { @@ -159,13 +159,13 @@ return *this; } - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } if (c2 >= c1) { make_unique (); - for (int i = c1; i <= c2; i++) + for (octave_idx_type i = c1; i <= c2; i++) xelem (i) = val; } @@ -173,9 +173,9 @@ } ComplexRowVector& -ComplexRowVector::fill (const Complex& val, int c1, int c2) +ComplexRowVector::fill (const Complex& val, octave_idx_type c1, octave_idx_type c2) { - int len = length (); + octave_idx_type len = length (); if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) { @@ -183,13 +183,13 @@ return *this; } - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } if (c2 >= c1) { make_unique (); - for (int i = c1; i <= c2; i++) + for (octave_idx_type i = c1; i <= c2; i++) xelem (i) = val; } @@ -199,8 +199,8 @@ ComplexRowVector ComplexRowVector::append (const RowVector& a) const { - int len = length (); - int nc_insert = len; + octave_idx_type len = length (); + octave_idx_type nc_insert = len; ComplexRowVector retval (len + a.length ()); retval.insert (*this, 0); retval.insert (a, nc_insert); @@ -210,8 +210,8 @@ ComplexRowVector ComplexRowVector::append (const ComplexRowVector& a) const { - int len = length (); - int nc_insert = len; + octave_idx_type len = length (); + octave_idx_type nc_insert = len; ComplexRowVector retval (len + a.length ()); retval.insert (*this, 0); retval.insert (a, nc_insert); @@ -221,7 +221,7 @@ ComplexColumnVector ComplexRowVector::hermitian (void) const { - int len = length (); + octave_idx_type len = length (); return ComplexColumnVector (mx_inline_conj_dup (data (), len), len); } @@ -234,7 +234,7 @@ ComplexRowVector conj (const ComplexRowVector& a) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); ComplexRowVector retval; if (a_len > 0) retval = ComplexRowVector (mx_inline_conj_dup (a.data (), a_len), a_len); @@ -244,26 +244,26 @@ // resize is the destructive equivalent for this one ComplexRowVector -ComplexRowVector::extract (int c1, int c2) const +ComplexRowVector::extract (octave_idx_type c1, octave_idx_type c2) const { - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } - int new_c = c2 - c1 + 1; + octave_idx_type new_c = c2 - c1 + 1; ComplexRowVector result (new_c); - for (int i = 0; i < new_c; i++) + for (octave_idx_type i = 0; i < new_c; i++) result.elem (i) = elem (c1+i); return result; } ComplexRowVector -ComplexRowVector::extract_n (int r1, int n) const +ComplexRowVector::extract_n (octave_idx_type r1, octave_idx_type n) const { ComplexRowVector result (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) result.elem (i) = elem (r1+i); return result; @@ -274,9 +274,9 @@ ComplexRowVector& ComplexRowVector::operator += (const RowVector& a) { - int len = length (); + octave_idx_type len = length (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (len != a_len) { @@ -296,9 +296,9 @@ ComplexRowVector& ComplexRowVector::operator -= (const RowVector& a) { - int len = length (); + octave_idx_type len = length (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (len != a_len) { @@ -322,10 +322,10 @@ { ComplexRowVector retval; - int len = v.length (); + octave_idx_type len = v.length (); - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (a_nr != len) gripe_nonconformant ("operator *", 1, len, a_nr, a_nc); @@ -337,7 +337,7 @@ { // Transpose A to form A'*x == (x'*A)' - int ld = a_nr; + octave_idx_type ld = a_nr; retval.resize (a_nc); Complex *y = retval.fortran_vec (); @@ -377,13 +377,13 @@ { const Complex *d = data (); - int len = length (); + octave_idx_type len = length (); RowVector retval (len); double *r = retval.fortran_vec (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) r[i] = f (d[i]); return retval; @@ -394,7 +394,7 @@ { Complex *d = fortran_vec (); // Ensures only one reference to my privates! - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) d[i] = f (d[i]); return *this; @@ -403,14 +403,14 @@ Complex ComplexRowVector::min (void) const { - int len = length (); + octave_idx_type len = length (); if (len == 0) return Complex (0.0); Complex res = elem (0); double absres = std::abs (res); - for (int i = 1; i < len; i++) + for (octave_idx_type i = 1; i < len; i++) if (std::abs (elem (i)) < absres) { res = elem (i); @@ -423,14 +423,14 @@ Complex ComplexRowVector::max (void) const { - int len = length (); + octave_idx_type len = length (); if (len == 0) return Complex (0.0); Complex res = elem (0); double absres = std::abs (res); - for (int i = 1; i < len; i++) + for (octave_idx_type i = 1; i < len; i++) if (std::abs (elem (i)) > absres) { res = elem (i); @@ -446,7 +446,7 @@ operator << (std::ostream& os, const ComplexRowVector& a) { // int field_width = os.precision () + 7; - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) os << " " /* setw (field_width) */ << a.elem (i); return os; } @@ -454,14 +454,14 @@ std::istream& operator >> (std::istream& is, ComplexRowVector& a) { - int len = a.length(); + octave_idx_type len = a.length(); if (len < 1) is.clear (std::ios::badbit); else { Complex tmp; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { is >> tmp; if (is) @@ -487,9 +487,9 @@ Complex operator * (const ComplexRowVector& v, const ComplexColumnVector& a) { - int len = v.length (); + octave_idx_type len = v.length (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (len != a_len) { @@ -499,7 +499,7 @@ Complex retval (0.0, 0.0); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) retval += v.elem (i) * a.elem (i); return retval; @@ -508,7 +508,7 @@ // other operations ComplexRowVector -linspace (const Complex& x1, const Complex& x2, int n) +linspace (const Complex& x1, const Complex& x2, octave_idx_type n) { ComplexRowVector retval; @@ -517,7 +517,7 @@ retval.resize (n); Complex delta = (x2 - x1) / (n - 1.0); retval.elem (0) = x1; - for (int i = 1; i < n-1; i++) + for (octave_idx_type i = 1; i < n-1; i++) retval.elem (i) = x1 + 1.0 * i * delta; retval.elem (n-1) = x2; } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CRowVector.h --- a/liboctave/CRowVector.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CRowVector.h Fri Apr 08 16:07:37 2005 +0000 @@ -36,9 +36,9 @@ ComplexRowVector (void) : MArray () { } - explicit ComplexRowVector (int n) : MArray (n) { } + explicit ComplexRowVector (octave_idx_type n) : MArray (n) { } - ComplexRowVector (int n, const Complex& val) : MArray (n, val) { } + ComplexRowVector (octave_idx_type n, const Complex& val) : MArray (n, val) { } ComplexRowVector (const ComplexRowVector& a) : MArray (a) { } @@ -57,13 +57,13 @@ // destructive insert/delete/reorder operations - ComplexRowVector& insert (const RowVector& a, int c); - ComplexRowVector& insert (const ComplexRowVector& a, int c); + ComplexRowVector& insert (const RowVector& a, octave_idx_type c); + ComplexRowVector& insert (const ComplexRowVector& a, octave_idx_type c); ComplexRowVector& fill (double val); ComplexRowVector& fill (const Complex& val); - ComplexRowVector& fill (double val, int c1, int c2); - ComplexRowVector& fill (const Complex& val, int c1, int c2); + ComplexRowVector& fill (double val, octave_idx_type c1, octave_idx_type c2); + ComplexRowVector& fill (const Complex& val, octave_idx_type c1, octave_idx_type c2); ComplexRowVector append (const RowVector& a) const; ComplexRowVector append (const ComplexRowVector& a) const; @@ -75,9 +75,9 @@ // resize is the destructive equivalent for this one - ComplexRowVector extract (int c1, int c2) const; + ComplexRowVector extract (octave_idx_type c1, octave_idx_type c2) const; - ComplexRowVector extract_n (int c1, int n) const; + ComplexRowVector extract_n (octave_idx_type c1, octave_idx_type n) const; // row vector by row vector -> row vector operations @@ -109,7 +109,7 @@ private: - ComplexRowVector (Complex *d, int l) : MArray (d, l) { } + ComplexRowVector (Complex *d, octave_idx_type l) : MArray (d, l) { } }; // row vector by column vector -> scalar @@ -120,7 +120,7 @@ // other operations -ComplexRowVector linspace (const Complex& x1, const Complex& x2, int n); +ComplexRowVector linspace (const Complex& x1, const Complex& x2, octave_idx_type n); MARRAY_FORWARD_DEFS (MArray, ComplexRowVector, Complex) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CSparse.cc --- a/liboctave/CSparse.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CSparse.cc Fri Apr 08 16:07:37 2005 +0000 @@ -51,70 +51,70 @@ extern "C" { F77_RET_T - F77_FUNC (zgbtrf, ZGBTRF) (const int&, const int&, const int&, - const int&, Complex*, const int&, int*, int&); + F77_FUNC (zgbtrf, ZGBTRF) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, Complex*, const octave_idx_type&, octave_idx_type*, octave_idx_type&); F77_RET_T - F77_FUNC (zgbtrs, ZGBTRS) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, const int&, const int&, - const Complex*, const int&, - const int*, Complex*, const int&, int& + F77_FUNC (zgbtrs, ZGBTRS) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + const Complex*, const octave_idx_type&, + const octave_idx_type*, Complex*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (zgbcon, ZGBCON) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, const int&, Complex*, - const int&, const int*, const double&, - double&, Complex*, double*, int& + F77_FUNC (zgbcon, ZGBCON) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, Complex*, + const octave_idx_type&, const octave_idx_type*, const double&, + double&, Complex*, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (zpbtrf, ZPBTRF) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, Complex*, const int&, int& + F77_FUNC (zpbtrf, ZPBTRF) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, Complex*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (zpbtrs, ZPBTRS) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, const int&, Complex*, const int&, - Complex*, const int&, int& + F77_FUNC (zpbtrs, ZPBTRS) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, Complex*, const octave_idx_type&, + Complex*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (zpbcon, ZPBCON) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, Complex*, const int&, - const double&, double&, Complex*, int*, int& + F77_FUNC (zpbcon, ZPBCON) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, Complex*, const octave_idx_type&, + const double&, double&, Complex*, octave_idx_type*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (zgttrf, ZGTTRF) (const int&, Complex*, Complex*, Complex*, - Complex*, int*, int&); + F77_FUNC (zgttrf, ZGTTRF) (const octave_idx_type&, Complex*, Complex*, Complex*, + Complex*, octave_idx_type*, octave_idx_type&); F77_RET_T - F77_FUNC (zgttrs, ZGTTRS) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, const Complex*, const Complex*, - const Complex*, const Complex*, const int*, - Complex *, const int&, int& + F77_FUNC (zgttrs, ZGTTRS) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, const Complex*, const Complex*, + const 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 (zptsv, ZPTSV) (const int&, const int&, Complex*, Complex*, - Complex*, const int&, int&); + F77_FUNC (zptsv, ZPTSV) (const octave_idx_type&, const octave_idx_type&, Complex*, Complex*, + Complex*, const octave_idx_type&, octave_idx_type&); F77_RET_T - F77_FUNC (zgtsv, ZGTSV) (const int&, const int&, Complex*, Complex*, - Complex*, Complex*, const int&, int&); + F77_FUNC (zgtsv, ZGTSV) (const octave_idx_type&, const octave_idx_type&, Complex*, Complex*, + Complex*, Complex*, const octave_idx_type&, octave_idx_type&); } SparseComplexMatrix::SparseComplexMatrix (const SparseMatrix& a) : MSparse (a.rows (), a.cols (), a.nnz ()) { - int nc = cols (); - int nz = nnz (); - - for (int i = 0; i < nc + 1; i++) + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); + + for (octave_idx_type i = 0; i < nc + 1; i++) cidx (i) = a.cidx (i); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { data (i) = a.data (i); ridx (i) = a.ridx (i); @@ -124,13 +124,13 @@ SparseComplexMatrix::SparseComplexMatrix (const SparseBoolMatrix& a) : MSparse (a.rows (), a.cols (), a.nnz ()) { - int nc = cols (); - int nz = nnz (); - - for (int i = 0; i < nc + 1; i++) + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); + + for (octave_idx_type i = 0; i < nc + 1; i++) cidx (i) = a.cidx (i); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { data (i) = a.data (i); ridx (i) = a.ridx (i); @@ -140,21 +140,21 @@ bool SparseComplexMatrix::operator == (const SparseComplexMatrix& a) const { - int nr = rows (); - int nc = cols (); - int nz = nnz (); - int nr_a = a.rows (); - int nc_a = a.cols (); - int nz_a = a.nnz (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); + octave_idx_type nr_a = a.rows (); + octave_idx_type nc_a = a.cols (); + octave_idx_type nz_a = a.nnz (); if (nr != nr_a || nc != nc_a || nz != nz_a) return false; - for (int i = 0; i < nc + 1; i++) + for (octave_idx_type i = 0; i < nc + 1; i++) if (cidx(i) != a.cidx(i)) return false; - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) if (data(i) != a.data(i) || ridx(i) != a.ridx(i)) return false; @@ -170,13 +170,13 @@ bool SparseComplexMatrix::is_hermitian (void) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (is_square () && nr > 0) { - for (int i = 0; i < nr; i++) - for (int j = i; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) + for (octave_idx_type j = i; j < nc; j++) if (elem (i, j) != conj (elem (j, i))) return false; @@ -191,12 +191,12 @@ SparseComplexMatrix SparseComplexMatrix::max (int dim) const { - Array2 dummy_idx; + Array2 dummy_idx; return max (dummy_idx, dim); } SparseComplexMatrix -SparseComplexMatrix::max (Array2& idx_arg, int dim) const +SparseComplexMatrix::max (Array2& idx_arg, int dim) const { SparseComplexMatrix result; dim_vector dv = dims (); @@ -204,19 +204,19 @@ if (dv.numel () == 0 || dim > dv.length () || dim < 0) return result; - int nr = dv(0); - int nc = dv(1); + octave_idx_type nr = dv(0); + octave_idx_type nc = dv(1); if (dim == 0) { idx_arg.resize (1, nc); - int nel = 0; - for (int j = 0; j < nc; j++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nc; j++) { Complex tmp_max; double abs_max = octave_NaN; - int idx_j = 0; - for (int i = cidx(j); i < cidx(j+1); i++) + octave_idx_type idx_j = 0; + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) != idx_j) break; @@ -230,7 +230,7 @@ abs_max = 0.; } - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { Complex tmp = data (i); @@ -254,9 +254,9 @@ result = SparseComplexMatrix (1, nc, nel); - int ii = 0; + octave_idx_type ii = 0; result.xcidx (0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { Complex tmp = elem (idx_arg(j), j); if (tmp != 0.) @@ -271,16 +271,16 @@ { idx_arg.resize (nr, 1, 0); - for (int i = cidx(0); i < cidx(1); i++) + for (octave_idx_type i = cidx(0); i < cidx(1); i++) idx_arg.elem(ridx(i)) = -1; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { if (idx_arg.elem(i) != -1) continue; bool found = false; - for (int k = cidx(j); k < cidx(j+1); k++) + for (octave_idx_type k = cidx(j); k < cidx(j+1); k++) if (ridx(k) == i) { found = true; @@ -292,12 +292,12 @@ } - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ir = ridx (i); - int ix = idx_arg.elem (ir); + octave_idx_type ir = ridx (i); + octave_idx_type ix = idx_arg.elem (ir); Complex tmp = data (i); if (octave_is_NaN_or_NA (tmp)) @@ -307,17 +307,17 @@ } } - int nel = 0; - for (int j = 0; j < nr; j++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nr; j++) if (idx_arg.elem(j) == -1 || elem (j, idx_arg.elem (j)) != 0.) nel++; result = SparseComplexMatrix (nr, 1, nel); - int ii = 0; + octave_idx_type ii = 0; result.xcidx (0) = 0; result.xcidx (1) = nel; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { if (idx_arg(j) == -1) { @@ -343,12 +343,12 @@ SparseComplexMatrix SparseComplexMatrix::min (int dim) const { - Array2 dummy_idx; + Array2 dummy_idx; return min (dummy_idx, dim); } SparseComplexMatrix -SparseComplexMatrix::min (Array2& idx_arg, int dim) const +SparseComplexMatrix::min (Array2& idx_arg, int dim) const { SparseComplexMatrix result; dim_vector dv = dims (); @@ -356,19 +356,19 @@ if (dv.numel () == 0 || dim > dv.length () || dim < 0) return result; - int nr = dv(0); - int nc = dv(1); + octave_idx_type nr = dv(0); + octave_idx_type nc = dv(1); if (dim == 0) { idx_arg.resize (1, nc); - int nel = 0; - for (int j = 0; j < nc; j++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nc; j++) { Complex tmp_min; double abs_min = octave_NaN; - int idx_j = 0; - for (int i = cidx(j); i < cidx(j+1); i++) + octave_idx_type idx_j = 0; + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) != idx_j) break; @@ -382,7 +382,7 @@ abs_min = 0.; } - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { Complex tmp = data (i); @@ -406,9 +406,9 @@ result = SparseComplexMatrix (1, nc, nel); - int ii = 0; + octave_idx_type ii = 0; result.xcidx (0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { Complex tmp = elem (idx_arg(j), j); if (tmp != 0.) @@ -423,16 +423,16 @@ { idx_arg.resize (nr, 1, 0); - for (int i = cidx(0); i < cidx(1); i++) + for (octave_idx_type i = cidx(0); i < cidx(1); i++) idx_arg.elem(ridx(i)) = -1; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { if (idx_arg.elem(i) != -1) continue; bool found = false; - for (int k = cidx(j); k < cidx(j+1); k++) + for (octave_idx_type k = cidx(j); k < cidx(j+1); k++) if (ridx(k) == i) { found = true; @@ -444,12 +444,12 @@ } - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ir = ridx (i); - int ix = idx_arg.elem (ir); + octave_idx_type ir = ridx (i); + octave_idx_type ix = idx_arg.elem (ir); Complex tmp = data (i); if (octave_is_NaN_or_NA (tmp)) @@ -459,17 +459,17 @@ } } - int nel = 0; - for (int j = 0; j < nr; j++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nr; j++) if (idx_arg.elem(j) == -1 || elem (j, idx_arg.elem (j)) != 0.) nel++; result = SparseComplexMatrix (nr, 1, nel); - int ii = 0; + octave_idx_type ii = 0; result.xcidx (0) = 0; result.xcidx (1) = nel; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { if (idx_arg(j) == -1) { @@ -495,14 +495,14 @@ // destructive insert/delete/reorder operations SparseComplexMatrix& -SparseComplexMatrix::insert (const SparseMatrix& a, int r, int c) +SparseComplexMatrix::insert (const SparseMatrix& a, octave_idx_type r, octave_idx_type c) { SparseComplexMatrix tmp (a); return insert (a, r, c); } SparseComplexMatrix& -SparseComplexMatrix::insert (const SparseComplexMatrix& a, int r, int c) +SparseComplexMatrix::insert (const SparseComplexMatrix& a, octave_idx_type r, octave_idx_type c) { MSparse::insert (a, r, c); return *this; @@ -510,7 +510,7 @@ SparseComplexMatrix SparseComplexMatrix::concat (const SparseComplexMatrix& rb, - const Array& ra_idx) + const Array& ra_idx) { // Don't use numel to avoid all possiblity of an overflow if (rb.rows () > 0 && rb.cols () > 0) @@ -519,7 +519,7 @@ } SparseComplexMatrix -SparseComplexMatrix::concat (const SparseMatrix& rb, const Array& ra_idx) +SparseComplexMatrix::concat (const SparseMatrix& rb, const Array& ra_idx) { SparseComplexMatrix tmp (rb); if (rb.rows () > 0 && rb.cols () > 0) @@ -530,12 +530,12 @@ ComplexMatrix SparseComplexMatrix::matrix_value (void) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); ComplexMatrix retval (nr, nc, Complex (0.0, 0.0)); - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) retval.elem (ridx(i), j) = data (i); return retval; @@ -544,16 +544,16 @@ SparseComplexMatrix SparseComplexMatrix::hermitian (void) const { - int nr = rows (); - int nc = cols (); - int nz = nnz (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); SparseComplexMatrix retval (nc, nr, nz); retval.cidx(0) = 0; - for (int i = 0, iidx = 0; i < nr; i++) + for (octave_idx_type i = 0, iidx = 0; i < nr; i++) { - for (int j = 0; j < nc; j++) - for (int k = cidx(j); k < cidx(j+1); k++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type k = cidx(j); k < cidx(j+1); k++) if (ridx(k) == i) { retval.data(iidx) = conj (data(k)); @@ -568,15 +568,15 @@ SparseComplexMatrix conj (const SparseComplexMatrix& a) { - int nr = a.rows (); - int nc = a.cols (); - int nz = a.nnz (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type nz = a.nnz (); SparseComplexMatrix retval (nc, nr, nz); - for (int i = 0; i < nc + 1; i++) + for (octave_idx_type i = 0; i < nc + 1; i++) retval.cidx (i) = a.cidx (i); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { retval.data (i) = conj (a.data (i)); retval.ridx (i) = a.ridx (i); @@ -588,20 +588,20 @@ SparseComplexMatrix SparseComplexMatrix::inverse (void) const { - int info; + octave_idx_type info; double rcond; return inverse (info, rcond, 0, 0); } SparseComplexMatrix -SparseComplexMatrix::inverse (int& info) const +SparseComplexMatrix::inverse (octave_idx_type& info) const { double rcond; return inverse (info, rcond, 0, 0); } SparseComplexMatrix -SparseComplexMatrix::inverse (int& info, double& rcond, int force, +SparseComplexMatrix::inverse (octave_idx_type& info, double& rcond, int force, int calc_cond) const { info = -1; @@ -613,26 +613,26 @@ ComplexDET SparseComplexMatrix::determinant (void) const { - int info; + octave_idx_type info; double rcond; return determinant (info, rcond, 0); } ComplexDET -SparseComplexMatrix::determinant (int& info) const +SparseComplexMatrix::determinant (octave_idx_type& info) const { double rcond; return determinant (info, rcond, 0); } ComplexDET -SparseComplexMatrix::determinant (int& err, double& rcond, int calc_cond) const +SparseComplexMatrix::determinant (octave_idx_type& err, double& rcond, int calc_cond) const { ComplexDET retval; #ifdef HAVE_UMFPACK - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr == 0 || nc == 0 || nr != nc) { @@ -671,8 +671,8 @@ umfpack_zi_report_control (control); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const Complex *Ax = data (); umfpack_zi_report_matrix (nr, nc, Ap, Ai, @@ -753,13 +753,13 @@ } ComplexMatrix -SparseComplexMatrix::dsolve (SparseType &mattype, const Matrix& b, int& err, +SparseComplexMatrix::dsolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -776,16 +776,16 @@ { retval.resize (b.rows (), b.cols()); if (typ == SparseType::Diagonal) - for (int j = 0; j < b.cols(); j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = b(i,j) / data (i); else - for (int j = 0; j < b.cols(); j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = b(ridx(i),j) / data (i); double dmax = 0., dmin = octave_Inf; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { double tmp = std::abs(data(i)); if (tmp > dmax) @@ -804,12 +804,12 @@ SparseComplexMatrix SparseComplexMatrix::dsolve (SparseType &mattype, const SparseMatrix& b, - int& err, double& rcond, solve_singularity_handler) const + octave_idx_type& err, double& rcond, solve_singularity_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -824,17 +824,17 @@ if (typ == SparseType::Diagonal || typ == SparseType::Permuted_Diagonal) { - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseComplexMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; + octave_idx_type ii = 0; if (typ == SparseType::Diagonal) - for (int j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols(); j++) { - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { retval.xridx (ii) = b.ridx(i); retval.xdata (ii++) = b.data(i) / data (b.ridx (i)); @@ -842,12 +842,12 @@ retval.xcidx(j+1) = ii; } else - for (int j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols(); j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { bool found = false; - int k; + octave_idx_type k; for (k = b.cidx(j); k < b.cidx(j+1); k++) if (ridx(i) == b.ridx(k)) { @@ -864,7 +864,7 @@ } double dmax = 0., dmin = octave_Inf; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { double tmp = std::abs(data(i)); if (tmp > dmax) @@ -883,12 +883,12 @@ ComplexMatrix SparseComplexMatrix::dsolve (SparseType &mattype, const ComplexMatrix& b, - int& err, double& rcond, solve_singularity_handler) const + octave_idx_type& err, double& rcond, solve_singularity_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -905,16 +905,16 @@ { retval.resize (b.rows (), b.cols()); if (typ == SparseType::Diagonal) - for (int j = 0; j < b.cols(); j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = b(i,j) / data (i); else - for (int j = 0; j < b.cols(); j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = b(ridx(i),j) / data (i); double dmax = 0., dmin = octave_Inf; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { double tmp = std::abs(data(i)); if (tmp > dmax) @@ -933,13 +933,13 @@ SparseComplexMatrix SparseComplexMatrix::dsolve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -954,17 +954,17 @@ if (typ == SparseType::Diagonal || typ == SparseType::Permuted_Diagonal) { - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseComplexMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; + octave_idx_type ii = 0; if (typ == SparseType::Diagonal) - for (int j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols(); j++) { - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { retval.xridx (ii) = b.ridx(i); retval.xdata (ii++) = b.data(i) / data (b.ridx (i)); @@ -972,12 +972,12 @@ retval.xcidx(j+1) = ii; } else - for (int j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols(); j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { bool found = false; - int k; + octave_idx_type k; for (k = b.cidx(j); k < b.cidx(j+1); k++) if (ridx(i) == b.ridx(k)) { @@ -994,7 +994,7 @@ } double dmax = 0., dmin = octave_Inf; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { double tmp = std::abs(data(i)); if (tmp > dmax) @@ -1012,14 +1012,14 @@ } ComplexMatrix -SparseComplexMatrix::utsolve (SparseType &mattype, const Matrix& b, int& err, +SparseComplexMatrix::utsolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -1036,14 +1036,14 @@ { double anorm = 0.; double ainvnorm = 0.; - int b_cols = b.cols (); + octave_idx_type b_cols = b.cols (); rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += std::abs(data(i)); if (atmp > anorm) anorm = atmp; @@ -1053,20 +1053,20 @@ { retval.resize (b.rows (), b.cols ()); OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseComplexMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_cols; j++) + for (octave_idx_type j = 0; j < b_cols; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = b(i,j); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx+1)-1) != iidx) @@ -1077,44 +1077,44 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i, j) = work[p_perm[i]]; } // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -1128,10 +1128,10 @@ retval = ComplexMatrix (b); Complex *x_vec = retval.fortran_vec (); - for (int j = 0; j < b_cols; j++) + for (octave_idx_type j = 0; j < b_cols; j++) { - int offset = j * nr; - for (int k = nr-1; k >= 0; k--) + octave_idx_type offset = j * nr; + for (octave_idx_type k = nr-1; k >= 0; k--) { if (x_vec[k+offset] != 0.) { @@ -1144,9 +1144,9 @@ Complex tmp = x_vec[k+offset] / data(cidx(k+1)-1); x_vec[k+offset] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); x_vec[iidx+offset] = x_vec[iidx+offset] - tmp * data(i); } @@ -1156,28 +1156,28 @@ // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { if (work[k] != 0.) { Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -1223,13 +1223,13 @@ SparseComplexMatrix SparseComplexMatrix::utsolve (SparseType &mattype, const SparseMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -1249,42 +1249,42 @@ rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += std::abs(data(i)); if (atmp > anorm) anorm = atmp; } - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseComplexMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; - int x_nz = b_nz; + octave_idx_type ii = 0; + octave_idx_type x_nz = b_nz; if (typ == SparseType::Permuted_Upper) { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseComplexMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx+1)-1) != iidx) @@ -1295,9 +1295,9 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } @@ -1306,20 +1306,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[p_perm[i]] != 0.) { retval.xridx(ii) = i; @@ -1331,30 +1331,30 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -1367,14 +1367,14 @@ { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { if (work[k] != 0.) { @@ -1386,9 +1386,9 @@ Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } @@ -1396,20 +1396,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -1421,28 +1421,28 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { if (work[k] != 0.) { Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -1487,13 +1487,13 @@ ComplexMatrix SparseComplexMatrix::utsolve (SparseType &mattype, const ComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -1510,14 +1510,14 @@ { double anorm = 0.; double ainvnorm = 0.; - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += std::abs(data(i)); if (atmp > anorm) anorm = atmp; @@ -1527,20 +1527,20 @@ { retval.resize (b.rows (), b.cols ()); OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseComplexMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = b(i,j); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx+1)-1) != iidx) @@ -1551,45 +1551,45 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i, j) = work[p_perm[i]]; } // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -1603,10 +1603,10 @@ retval = b; Complex *x_vec = retval.fortran_vec (); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - int offset = j * nr; - for (int k = nr-1; k >= 0; k--) + octave_idx_type offset = j * nr; + for (octave_idx_type k = nr-1; k >= 0; k--) { if (x_vec[k+offset] != 0.) { @@ -1619,9 +1619,9 @@ Complex tmp = x_vec[k+offset] / data(cidx(k+1)-1); x_vec[k+offset] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); x_vec[iidx+offset] = x_vec[iidx+offset] - tmp * data(i); } @@ -1631,28 +1631,28 @@ // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { if (work[k] != 0.) { Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -1698,13 +1698,13 @@ SparseComplexMatrix SparseComplexMatrix::utsolve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -1724,42 +1724,42 @@ rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += std::abs(data(i)); if (atmp > anorm) anorm = atmp; } - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseComplexMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; - int x_nz = b_nz; + octave_idx_type ii = 0; + octave_idx_type x_nz = b_nz; if (typ == SparseType::Permuted_Upper) { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseComplexMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx+1)-1) != iidx) @@ -1770,9 +1770,9 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } @@ -1781,20 +1781,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[p_perm[i]] != 0.) { retval.xridx(ii) = i; @@ -1806,30 +1806,30 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -1842,14 +1842,14 @@ { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { if (work[k] != 0.) { @@ -1861,9 +1861,9 @@ Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } @@ -1871,20 +1871,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -1896,28 +1896,28 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { if (work[k] != 0.) { Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -1962,13 +1962,13 @@ } ComplexMatrix -SparseComplexMatrix::ltsolve (SparseType &mattype, const Matrix& b, int& err, +SparseComplexMatrix::ltsolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -1985,14 +1985,14 @@ { double anorm = 0.; double ainvnorm = 0.; - int b_cols = b.cols (); + octave_idx_type b_cols = b.cols (); rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += std::abs(data(i)); if (atmp > anorm) anorm = atmp; @@ -2002,20 +2002,20 @@ { retval.resize (b.rows (), b.cols ()); OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseComplexMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_cols; j++) + for (octave_idx_type j = 0; j < b_cols; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = b(i,j); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx)) != iidx) @@ -2026,45 +2026,45 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i, j) = work[p_perm[i]]; } // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -2078,10 +2078,10 @@ retval = ComplexMatrix (b); Complex *x_vec = retval.fortran_vec (); - for (int j = 0; j < b_cols; j++) + for (octave_idx_type j = 0; j < b_cols; j++) { - int offset = j * nr; - for (int k = 0; k < nr; k++) + octave_idx_type offset = j * nr; + for (octave_idx_type k = 0; k < nr; k++) { if (x_vec[k+offset] != 0.) { @@ -2094,9 +2094,9 @@ Complex tmp = x_vec[k+offset] / data(cidx(k)); x_vec[k+offset] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); x_vec[iidx+offset] = x_vec[iidx+offset] - tmp * data(i); } @@ -2106,29 +2106,29 @@ // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k < nr; k++) + for (octave_idx_type k = j; k < nr; k++) { if (work[k] != 0.) { Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = j; i < nr; i++) + for (octave_idx_type i = j; i < nr; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -2174,13 +2174,13 @@ SparseComplexMatrix SparseComplexMatrix::ltsolve (SparseType &mattype, const SparseMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -2200,42 +2200,42 @@ rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += std::abs(data(i)); if (atmp > anorm) anorm = atmp; } - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseComplexMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; - int x_nz = b_nz; + octave_idx_type ii = 0; + octave_idx_type x_nz = b_nz; if (typ == SparseType::Permuted_Lower) { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseComplexMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx)) != iidx) @@ -2246,9 +2246,9 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } @@ -2257,20 +2257,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[p_perm[i]] != 0.) { retval.xridx(ii) = i; @@ -2282,30 +2282,30 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -2318,14 +2318,14 @@ { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { if (work[k] != 0.) { @@ -2337,9 +2337,9 @@ Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } @@ -2347,20 +2347,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -2372,29 +2372,29 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k < nr; k++) + for (octave_idx_type k = j; k < nr; k++) { if (work[k] != 0.) { Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = j; i < nr; i++) + for (octave_idx_type i = j; i < nr; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -2441,13 +2441,13 @@ ComplexMatrix SparseComplexMatrix::ltsolve (SparseType &mattype, const ComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -2464,14 +2464,14 @@ { double anorm = 0.; double ainvnorm = 0.; - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += std::abs(data(i)); if (atmp > anorm) anorm = atmp; @@ -2481,20 +2481,20 @@ { retval.resize (b.rows (), b.cols ()); OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseComplexMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = b(i,j); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx)) != iidx) @@ -2505,45 +2505,45 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i, j) = work[p_perm[i]]; } // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -2557,10 +2557,10 @@ retval = b; Complex *x_vec = retval.fortran_vec (); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - int offset = j * nr; - for (int k = 0; k < nr; k++) + octave_idx_type offset = j * nr; + for (octave_idx_type k = 0; k < nr; k++) { if (x_vec[k+offset] != 0.) { @@ -2573,9 +2573,9 @@ Complex tmp = x_vec[k+offset] / data(cidx(k)); x_vec[k+offset] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); x_vec[iidx+offset] = x_vec[iidx+offset] - tmp * data(i); } @@ -2585,29 +2585,29 @@ // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k < nr; k++) + for (octave_idx_type k = j; k < nr; k++) { if (work[k] != 0.) { Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = j; i < nr; i++) + for (octave_idx_type i = j; i < nr; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -2654,13 +2654,13 @@ SparseComplexMatrix SparseComplexMatrix::ltsolve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -2680,42 +2680,42 @@ rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += std::abs(data(i)); if (atmp > anorm) anorm = atmp; } - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseComplexMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; - int x_nz = b_nz; + octave_idx_type ii = 0; + octave_idx_type x_nz = b_nz; if (typ == SparseType::Permuted_Lower) { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseComplexMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx)) != iidx) @@ -2726,9 +2726,9 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } @@ -2737,20 +2737,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[p_perm[i]] != 0.) { retval.xridx(ii) = i; @@ -2762,30 +2762,30 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -2798,14 +2798,14 @@ { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { if (work[k] != 0.) { @@ -2817,9 +2817,9 @@ Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } @@ -2827,20 +2827,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -2852,29 +2852,29 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k < nr; k++) + for (octave_idx_type k = j; k < nr; k++) { if (work[k] != 0.) { Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = j; i < nr; i++) + for (octave_idx_type i = j; i < nr; i++) { atmp += std::abs(work[i]); work[i] = 0.; @@ -2920,14 +2920,14 @@ } ComplexMatrix -SparseComplexMatrix::trisolve (SparseType &mattype, const Matrix& b, int& err, +SparseComplexMatrix::trisolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -2946,9 +2946,9 @@ if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii); @@ -2959,14 +2959,14 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -2975,7 +2975,7 @@ } } - int b_nc = b.cols(); + octave_idx_type b_nc = b.cols(); retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); @@ -3003,9 +3003,9 @@ if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii++); @@ -3016,15 +3016,15 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; DU[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -3035,7 +3035,7 @@ } } - int b_nc = b.cols(); + octave_idx_type b_nc = b.cols(); retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); @@ -3069,13 +3069,13 @@ SparseComplexMatrix SparseComplexMatrix::trisolve (SparseType &mattype, const SparseMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -3095,14 +3095,14 @@ OCTAVE_LOCAL_BUFFER (Complex, DU, nr - 1); OCTAVE_LOCAL_BUFFER (Complex, D, nr); OCTAVE_LOCAL_BUFFER (Complex, DL, nr - 1); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii++); @@ -3113,15 +3113,15 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; DU[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -3154,19 +3154,19 @@ else { char job = 'N'; - volatile int x_nz = b.nnz (); - int b_nc = b.cols (); + volatile octave_idx_type x_nz = b.nnz (); + octave_idx_type b_nc = b.cols (); retval = SparseComplexMatrix (nr, b_nc, x_nz); retval.xcidx(0) = 0; - volatile int ii = 0; + volatile octave_idx_type ii = 0; OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + 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, @@ -3184,20 +3184,20 @@ // Count non-zeros in work vector and adjust // space in retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -3219,13 +3219,13 @@ ComplexMatrix SparseComplexMatrix::trisolve (SparseType &mattype, const ComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -3245,9 +3245,9 @@ if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii); @@ -3258,14 +3258,14 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -3274,8 +3274,8 @@ } } - int b_nr = b.rows (); - int b_nc = b.cols(); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols(); rcond = 1.; retval = ComplexMatrix (b); @@ -3306,9 +3306,9 @@ if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii++); @@ -3319,15 +3319,15 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; DU[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -3338,8 +3338,8 @@ } } - int b_nr = b.rows(); - int b_nc = b.cols(); + octave_idx_type b_nr = b.rows(); + octave_idx_type b_nc = b.cols(); rcond = 1.; retval = ComplexMatrix (b); @@ -3375,13 +3375,13 @@ SparseComplexMatrix SparseComplexMatrix::trisolve (SparseType &mattype, - const SparseComplexMatrix& b, int& err, double& rcond, + const SparseComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -3401,14 +3401,14 @@ OCTAVE_LOCAL_BUFFER (Complex, DU, nr - 1); OCTAVE_LOCAL_BUFFER (Complex, D, nr); OCTAVE_LOCAL_BUFFER (Complex, DL, nr - 1); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii++); @@ -3419,15 +3419,15 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; DU[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -3460,21 +3460,21 @@ { rcond = 1.; char job = 'N'; - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); OCTAVE_LOCAL_BUFFER (Complex, Bx, b_nr); // Take a first guess that the number of non-zero terms // will be as many as in b - volatile int x_nz = b.nnz (); - volatile int ii = 0; + volatile octave_idx_type x_nz = b.nnz (); + volatile octave_idx_type ii = 0; retval = SparseComplexMatrix (b_nr, b_nc, x_nz); retval.xcidx(0) = 0; - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b (i,j); F77_XFCN (zgttrs, ZGTTRS, @@ -3501,20 +3501,20 @@ // Count non-zeros in work vector and adjust // space in retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0.) { retval.xridx(ii) = i; @@ -3536,14 +3536,14 @@ } ComplexMatrix -SparseComplexMatrix::bsolve (SparseType &mattype, const Matrix& b, int& err, +SparseComplexMatrix::bsolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -3557,24 +3557,24 @@ if (typ == SparseType::Banded_Hermitian) { - int n_lower = mattype.nlower (); - int ldm = n_lower + 1; + octave_idx_type n_lower = mattype.nlower (); + octave_idx_type ldm = n_lower + 1; ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ri = ridx (i); + octave_idx_type ri = ridx (i); if (ri >= j) m_band(ri - j, j) = data(i); } @@ -3611,8 +3611,8 @@ //Array z (3 * nr); //Complex *pz = z.fortran_vec (); - //Array iz (nr); - //int *piz = iz.fortran_vec (); + //Array iz (nr); + //octave_idx_type *piz = iz.fortran_vec (); // //F77_XFCN (zpbcon, ZGBCON, // (F77_CONST_CHAR_ARG2 (&job, 1), @@ -3648,7 +3648,7 @@ retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); F77_XFCN (zpbtrs, ZPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -3673,28 +3673,28 @@ if (typ == SparseType::Banded) { // Create the storage for the banded form of the sparse matrix - int n_upper = mattype.nupper (); - int n_lower = mattype.nlower (); - int ldm = n_upper + 2 * n_lower + 1; + octave_idx_type n_upper = mattype.nupper (); + octave_idx_type n_lower = mattype.nlower (); + octave_idx_type ldm = n_upper + 2 * n_lower + 1; ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) m_band(ridx(i) - j + n_lower + n_upper, j) = data(i); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); @@ -3761,7 +3761,7 @@ retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); job = 'N'; F77_XFCN (zgbtrs, ZGBTRS, @@ -3785,13 +3785,13 @@ SparseComplexMatrix SparseComplexMatrix::bsolve (SparseType &mattype, const SparseMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -3805,25 +3805,25 @@ if (typ == SparseType::Banded_Hermitian) { - int n_lower = mattype.nlower (); - int ldm = n_lower + 1; + octave_idx_type n_lower = mattype.nlower (); + octave_idx_type ldm = n_lower + 1; ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ri = ridx (i); + octave_idx_type ri = ridx (i); if (ri >= j) m_band(ri - j, j) = data(i); } @@ -3848,20 +3848,20 @@ else { rcond = 1.; - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); OCTAVE_LOCAL_BUFFER (Complex, Bx, b_nr); // Take a first guess that the number of non-zero terms // will be as many as in b - volatile int x_nz = b.nnz (); - volatile int ii = 0; + volatile octave_idx_type x_nz = b.nnz (); + volatile octave_idx_type ii = 0; retval = SparseComplexMatrix (b_nr, b_nc, x_nz); retval.xcidx(0) = 0; - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b.elem (i, j); F77_XFCN (zpbtrs, ZPBTRS, @@ -3886,7 +3886,7 @@ break; } - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) { Complex tmp = Bx[i]; if (tmp != 0.0) @@ -3894,7 +3894,7 @@ if (ii == x_nz) { // Resize the sparse matrix - int sz = x_nz * (b_nc - j) / b_nc; + octave_idx_type sz = x_nz * (b_nc - j) / b_nc; sz = (sz > 10 ? sz : 10) + x_nz; retval.change_capacity (sz); x_nz = sz; @@ -3914,28 +3914,28 @@ if (typ == SparseType::Banded) { // Create the storage for the banded form of the sparse matrix - int n_upper = mattype.nupper (); - int n_lower = mattype.nlower (); - int ldm = n_upper + 2 * n_lower + 1; + octave_idx_type n_upper = mattype.nupper (); + octave_idx_type n_lower = mattype.nlower (); + octave_idx_type ldm = n_upper + 2 * n_lower + 1; ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) m_band(ridx(i) - j + n_lower + n_upper, j) = data(i); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); @@ -3960,19 +3960,19 @@ else { char job = 'N'; - volatile int x_nz = b.nnz (); - int b_nc = b.cols (); + volatile octave_idx_type x_nz = b.nnz (); + octave_idx_type b_nc = b.cols (); retval = SparseComplexMatrix (nr, b_nc, x_nz); retval.xcidx(0) = 0; - volatile int ii = 0; + volatile octave_idx_type ii = 0; OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + 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, @@ -3990,20 +3990,20 @@ // Count non-zeros in work vector and adjust // space in retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -4025,13 +4025,13 @@ ComplexMatrix SparseComplexMatrix::bsolve (SparseType &mattype, const ComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -4045,25 +4045,25 @@ if (typ == SparseType::Banded_Hermitian) { - int n_lower = mattype.nlower (); - int ldm = n_lower + 1; + octave_idx_type n_lower = mattype.nlower (); + octave_idx_type ldm = n_lower + 1; ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ri = ridx (i); + octave_idx_type ri = ridx (i); if (ri >= j) m_band(ri - j, j) = data(i); } @@ -4090,8 +4090,8 @@ else { rcond = 1.; - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); @@ -4121,28 +4121,28 @@ if (typ == SparseType::Banded) { // Create the storage for the banded form of the sparse matrix - int n_upper = mattype.nupper (); - int n_lower = mattype.nlower (); - int ldm = n_upper + 2 * n_lower + 1; + octave_idx_type n_upper = mattype.nupper (); + octave_idx_type n_lower = mattype.nlower (); + octave_idx_type ldm = n_upper + 2 * n_lower + 1; ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) m_band(ridx(i) - j + n_lower + n_upper, j) = data(i); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); @@ -4167,7 +4167,7 @@ else { char job = 'N'; - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); retval = ComplexMatrix (b); Complex *result = retval.fortran_vec (); @@ -4194,13 +4194,13 @@ SparseComplexMatrix SparseComplexMatrix::bsolve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -4214,25 +4214,25 @@ if (typ == SparseType::Banded_Hermitian) { - int n_lower = mattype.nlower (); - int ldm = n_lower + 1; + octave_idx_type n_lower = mattype.nlower (); + octave_idx_type ldm = n_lower + 1; ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ri = ridx (i); + octave_idx_type ri = ridx (i); if (ri >= j) m_band(ri - j, j) = data(i); } @@ -4260,21 +4260,21 @@ else { rcond = 1.; - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); OCTAVE_LOCAL_BUFFER (Complex, Bx, b_nr); // Take a first guess that the number of non-zero terms // will be as many as in b - volatile int x_nz = b.nnz (); - volatile int ii = 0; + volatile octave_idx_type x_nz = b.nnz (); + volatile octave_idx_type ii = 0; retval = SparseComplexMatrix (b_nr, b_nc, x_nz); retval.xcidx(0) = 0; - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b (i,j); F77_XFCN (zpbtrs, ZPBTRS, @@ -4302,20 +4302,20 @@ // Count non-zeros in work vector and adjust // space in retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0.) { retval.xridx(ii) = i; @@ -4333,28 +4333,28 @@ if (typ == SparseType::Banded) { // Create the storage for the banded form of the sparse matrix - int n_upper = mattype.nupper (); - int n_lower = mattype.nlower (); - int ldm = n_upper + 2 * n_lower + 1; + octave_idx_type n_upper = mattype.nupper (); + octave_idx_type n_lower = mattype.nlower (); + octave_idx_type ldm = n_upper + 2 * n_lower + 1; ComplexMatrix m_band (ldm, nc); Complex *tmp_data = m_band.fortran_vec (); if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) m_band(ridx(i) - j + n_lower + n_upper, j) = data(i); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (zgbtrf, ZGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); @@ -4379,20 +4379,20 @@ else { char job = 'N'; - volatile int x_nz = b.nnz (); - int b_nc = b.cols (); + volatile octave_idx_type x_nz = b.nnz (); + octave_idx_type b_nc = b.cols (); retval = SparseComplexMatrix (nr, b_nc, x_nz); retval.xcidx(0) = 0; - volatile int ii = 0; + volatile octave_idx_type ii = 0; OCTAVE_LOCAL_BUFFER (Complex, Bx, nr); - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) Bx[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + 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, @@ -4410,20 +4410,20 @@ // Count non-zeros in work vector and adjust // space in retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0.) { retval.xridx(ii) = i; @@ -4444,7 +4444,7 @@ } void * -SparseComplexMatrix::factorize (int& err, double &rcond, Matrix &Control, +SparseComplexMatrix::factorize (octave_idx_type& err, double &rcond, Matrix &Control, Matrix &Info, solve_singularity_handler sing_handler) const { @@ -4475,11 +4475,11 @@ umfpack_zi_report_control (control); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const Complex *Ax = data (); - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); umfpack_zi_report_matrix (nr, nc, Ap, Ai, X_CAST (const double *, Ax), NULL, 1, control); @@ -4557,14 +4557,14 @@ } ComplexMatrix -SparseComplexMatrix::fsolve (SparseType &mattype, const Matrix& b, int& err, +SparseComplexMatrix::fsolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -4597,18 +4597,18 @@ if (err == 0) { - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); int status = 0; double *control = Control.fortran_vec (); double *info = Info.fortran_vec (); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const Complex *Ax = data (); #ifdef UMFPACK_SEPARATE_SPLIT const double *Bx = b.fortran_vec (); OCTAVE_LOCAL_BUFFER (double, Bz, b_nr); - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) Bz[i] = 0.; #else OCTAVE_LOCAL_BUFFER (Complex, Bz, b_nr); @@ -4616,7 +4616,7 @@ retval.resize (b_nr, b_nc); Complex *Xx = retval.fortran_vec (); - for (int j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) + for (octave_idx_type j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) { #ifdef UMFPACK_SEPARATE_SPLIT status = umfpack_zi_solve (UMFPACK_A, Ap, Ai, @@ -4627,7 +4627,7 @@ &Bx[iidx], Bz, Numeric, control, info); #else - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) Bz[i] = b.elem (i, j); status = umfpack_zi_solve (UMFPACK_A, Ap, Ai, @@ -4689,13 +4689,13 @@ SparseComplexMatrix SparseComplexMatrix::fsolve (SparseType &mattype, const SparseMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -4727,19 +4727,19 @@ if (err == 0) { - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); int status = 0; double *control = Control.fortran_vec (); double *info = Info.fortran_vec (); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const Complex *Ax = data (); #ifdef UMFPACK_SEPARATE_SPLIT OCTAVE_LOCAL_BUFFER (double, Bx, b_nr); OCTAVE_LOCAL_BUFFER (double, Bz, b_nr); - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) Bz[i] = 0.; #else OCTAVE_LOCAL_BUFFER (Complex, Bz, b_nr); @@ -4747,18 +4747,18 @@ // Take a first guess that the number of non-zero terms // will be as many as in b - int x_nz = b.nnz (); - int ii = 0; + octave_idx_type x_nz = b.nnz (); + octave_idx_type ii = 0; retval = SparseComplexMatrix (b_nr, b_nc, x_nz); OCTAVE_LOCAL_BUFFER (Complex, Xx, b_nr); retval.xcidx(0) = 0; - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { #ifdef UMFPACK_SEPARATE_SPLIT - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b.elem (i, j); status = umfpack_zi_solve (UMFPACK_A, Ap, Ai, @@ -4768,7 +4768,7 @@ Bx, Bz, Numeric, control, info); #else - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) Bz[i] = b.elem (i, j); status = umfpack_zi_solve (UMFPACK_A, Ap, Ai, @@ -4791,7 +4791,7 @@ break; } - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) { Complex tmp = Xx[i]; if (tmp != 0.0) @@ -4799,7 +4799,7 @@ if (ii == x_nz) { // Resize the sparse matrix - int sz = x_nz * (b_nc - j) / b_nc; + octave_idx_type sz = x_nz * (b_nc - j) / b_nc; sz = (sz > 10 ? sz : 10) + x_nz; retval.change_capacity (sz); x_nz = sz; @@ -4849,13 +4849,13 @@ ComplexMatrix SparseComplexMatrix::fsolve (SparseType &mattype, const ComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -4887,20 +4887,20 @@ if (err == 0) { - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); int status = 0; double *control = Control.fortran_vec (); double *info = Info.fortran_vec (); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const Complex *Ax = data (); const Complex *Bx = b.fortran_vec (); retval.resize (b_nr, b_nc); Complex *Xx = retval.fortran_vec (); - for (int j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) + for (octave_idx_type j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) { status = umfpack_zi_solve (UMFPACK_A, Ap, Ai, @@ -4958,13 +4958,13 @@ SparseComplexMatrix SparseComplexMatrix::fsolve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -4996,29 +4996,29 @@ if (err == 0) { - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); int status = 0; double *control = Control.fortran_vec (); double *info = Info.fortran_vec (); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const Complex *Ax = data (); OCTAVE_LOCAL_BUFFER (Complex, Bx, b_nr); // Take a first guess that the number of non-zero terms // will be as many as in b - int x_nz = b.nnz (); - int ii = 0; + octave_idx_type x_nz = b.nnz (); + octave_idx_type ii = 0; retval = SparseComplexMatrix (b_nr, b_nc, x_nz); OCTAVE_LOCAL_BUFFER (Complex, Xx, b_nr); retval.xcidx(0) = 0; - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b (i,j); status = umfpack_zi_solve (UMFPACK_A, Ap, Ai, @@ -5039,7 +5039,7 @@ break; } - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) { Complex tmp = Xx[i]; if (tmp != 0.0) @@ -5047,7 +5047,7 @@ if (ii == x_nz) { // Resize the sparse matrix - int sz = x_nz * (b_nc - j) / b_nc; + octave_idx_type sz = x_nz * (b_nc - j) / b_nc; sz = (sz > 10 ? sz : 10) + x_nz; retval.change_capacity (sz); x_nz = sz; @@ -5098,28 +5098,28 @@ ComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const Matrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond, 0); } ComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const Matrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); } ComplexMatrix -SparseComplexMatrix::solve (SparseType &mattype, const Matrix& b, int& info, +SparseComplexMatrix::solve (SparseType &mattype, const Matrix& b, octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ComplexMatrix -SparseComplexMatrix::solve (SparseType &mattype, const Matrix& b, int& err, +SparseComplexMatrix::solve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { @@ -5152,14 +5152,14 @@ SparseComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const SparseMatrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond, 0); } SparseComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const SparseMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); @@ -5167,14 +5167,14 @@ SparseComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const SparseMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } SparseComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const SparseMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { int typ = mattype.type (); @@ -5206,14 +5206,14 @@ ComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const ComplexMatrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond, 0); } ComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const ComplexMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); @@ -5221,14 +5221,14 @@ ComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const ComplexMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const ComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { int typ = mattype.type (); @@ -5261,14 +5261,14 @@ SparseComplexMatrix::solve (SparseType &mattype, const SparseComplexMatrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond, 0); } SparseComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const SparseComplexMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); @@ -5276,14 +5276,14 @@ SparseComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const SparseComplexMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } SparseComplexMatrix SparseComplexMatrix::solve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { int typ = mattype.type (); @@ -5315,13 +5315,13 @@ ComplexColumnVector SparseComplexMatrix::solve (SparseType &mattype, const ColumnVector& b) const { - int info; double rcond; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond); } ComplexColumnVector SparseComplexMatrix::solve (SparseType &mattype, const ColumnVector& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond); @@ -5329,32 +5329,32 @@ ComplexColumnVector SparseComplexMatrix::solve (SparseType &mattype, const ColumnVector& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ComplexColumnVector SparseComplexMatrix::solve (SparseType &mattype, const ColumnVector& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { Matrix tmp (b); - return solve (mattype, tmp, info, rcond, sing_handler).column (0); + return solve (mattype, tmp, info, rcond, sing_handler).column (static_cast (0)); } ComplexColumnVector SparseComplexMatrix::solve (SparseType &mattype, const ComplexColumnVector& b) const { - int info; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond, 0); } ComplexColumnVector SparseComplexMatrix::solve (SparseType &mattype, const ComplexColumnVector& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); @@ -5362,44 +5362,44 @@ ComplexColumnVector SparseComplexMatrix::solve (SparseType &mattype, const ComplexColumnVector& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ComplexColumnVector SparseComplexMatrix::solve (SparseType &mattype, const ComplexColumnVector& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix tmp (b); - return solve (mattype, tmp, info, rcond, sing_handler).column (0); + return solve (mattype, tmp, info, rcond, sing_handler).column (static_cast (0)); } ComplexMatrix SparseComplexMatrix::solve (const Matrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (b, info, rcond, 0); } ComplexMatrix -SparseComplexMatrix::solve (const Matrix& b, int& info) const +SparseComplexMatrix::solve (const Matrix& b, octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); } ComplexMatrix -SparseComplexMatrix::solve (const Matrix& b, int& 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, int& err, +SparseComplexMatrix::solve (const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { @@ -5410,14 +5410,14 @@ SparseComplexMatrix SparseComplexMatrix::solve (const SparseMatrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (b, info, rcond, 0); } SparseComplexMatrix SparseComplexMatrix::solve (const SparseMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); @@ -5425,14 +5425,14 @@ SparseComplexMatrix SparseComplexMatrix::solve (const SparseMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } SparseComplexMatrix SparseComplexMatrix::solve (const SparseMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseType mattype (*this); @@ -5441,7 +5441,7 @@ ComplexMatrix SparseComplexMatrix::solve (const ComplexMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); @@ -5449,14 +5449,14 @@ ComplexMatrix SparseComplexMatrix::solve (const ComplexMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ComplexMatrix SparseComplexMatrix::solve (const ComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseType mattype (*this); @@ -5466,14 +5466,14 @@ SparseComplexMatrix SparseComplexMatrix::solve (const SparseComplexMatrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (b, info, rcond, 0); } SparseComplexMatrix SparseComplexMatrix::solve (const SparseComplexMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); @@ -5481,14 +5481,14 @@ SparseComplexMatrix SparseComplexMatrix::solve (const SparseComplexMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } SparseComplexMatrix SparseComplexMatrix::solve (const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseType mattype (*this); @@ -5498,80 +5498,80 @@ ComplexColumnVector SparseComplexMatrix::solve (const ColumnVector& b) const { - int info; double rcond; + octave_idx_type info; double rcond; return solve (b, info, rcond); } ComplexColumnVector -SparseComplexMatrix::solve (const ColumnVector& b, int& info) const +SparseComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info) const { double rcond; return solve (b, info, rcond); } ComplexColumnVector -SparseComplexMatrix::solve (const ColumnVector& b, int& info, +SparseComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ComplexColumnVector -SparseComplexMatrix::solve (const ColumnVector& b, int& info, double& rcond, +SparseComplexMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { Matrix tmp (b); - return solve (tmp, info, rcond, sing_handler).column (0); + return solve (tmp, info, rcond, sing_handler).column (static_cast (0)); } ComplexColumnVector SparseComplexMatrix::solve (const ComplexColumnVector& b) const { - int info; + octave_idx_type info; double rcond; return solve (b, info, rcond, 0); } ComplexColumnVector -SparseComplexMatrix::solve (const ComplexColumnVector& b, int& info) const +SparseComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); } ComplexColumnVector -SparseComplexMatrix::solve (const ComplexColumnVector& b, int& 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, int& info, +SparseComplexMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix tmp (b); - return solve (tmp, info, rcond, sing_handler).column (0); + return solve (tmp, info, rcond, sing_handler).column (static_cast (0)); } ComplexMatrix SparseComplexMatrix::lssolve (const Matrix& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexMatrix -SparseComplexMatrix::lssolve (const Matrix& b, int& info) const +SparseComplexMatrix::lssolve (const Matrix& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexMatrix -SparseComplexMatrix::lssolve (const Matrix& b, int& info, int& rank) const +SparseComplexMatrix::lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank) const { info = -1; (*current_liboctave_error_handler) @@ -5582,21 +5582,21 @@ SparseComplexMatrix SparseComplexMatrix::lssolve (const SparseMatrix& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } SparseComplexMatrix -SparseComplexMatrix::lssolve (const SparseMatrix& b, int& info) const +SparseComplexMatrix::lssolve (const SparseMatrix& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } SparseComplexMatrix -SparseComplexMatrix::lssolve (const SparseMatrix& b, int& info, - int& rank) const +SparseComplexMatrix::lssolve (const SparseMatrix& b, octave_idx_type& info, + octave_idx_type& rank) const { info = -1; (*current_liboctave_error_handler) @@ -5607,21 +5607,21 @@ ComplexMatrix SparseComplexMatrix::lssolve (const ComplexMatrix& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexMatrix -SparseComplexMatrix::lssolve (const ComplexMatrix& b, int& info) const +SparseComplexMatrix::lssolve (const ComplexMatrix& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexMatrix -SparseComplexMatrix::lssolve (const ComplexMatrix& b, int& info, - int& rank) const +SparseComplexMatrix::lssolve (const ComplexMatrix& b, octave_idx_type& info, + octave_idx_type& rank) const { info = -1; (*current_liboctave_error_handler) @@ -5632,21 +5632,21 @@ SparseComplexMatrix SparseComplexMatrix::lssolve (const SparseComplexMatrix& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } SparseComplexMatrix -SparseComplexMatrix::lssolve (const SparseComplexMatrix& b, int& info) const +SparseComplexMatrix::lssolve (const SparseComplexMatrix& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } SparseComplexMatrix -SparseComplexMatrix::lssolve (const SparseComplexMatrix& b, int& info, - int& rank) const +SparseComplexMatrix::lssolve (const SparseComplexMatrix& b, octave_idx_type& info, + octave_idx_type& rank) const { info = -1; (*current_liboctave_error_handler) @@ -5657,20 +5657,20 @@ ComplexColumnVector SparseComplexMatrix::lssolve (const ColumnVector& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexColumnVector -SparseComplexMatrix::lssolve (const ColumnVector& b, int& info) const +SparseComplexMatrix::lssolve (const ColumnVector& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexColumnVector -SparseComplexMatrix::lssolve (const ColumnVector& b, int& info, int& rank) const +SparseComplexMatrix::lssolve (const ColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const { info = -1; (*current_liboctave_error_handler) @@ -5681,21 +5681,21 @@ ComplexColumnVector SparseComplexMatrix::lssolve (const ComplexColumnVector& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexColumnVector -SparseComplexMatrix::lssolve (const ComplexColumnVector& b, int& info) const +SparseComplexMatrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexColumnVector -SparseComplexMatrix::lssolve (const ComplexColumnVector& b, int& info, - int& rank) const +SparseComplexMatrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info, + octave_idx_type& rank) const { info = -1; (*current_liboctave_error_handler) @@ -5707,19 +5707,19 @@ SparseBoolMatrix SparseComplexMatrix::operator ! (void) const { - int nr = rows (); - int nc = cols (); - int nz1 = nnz (); - int nz2 = nr*nc - nz1; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz1 = nnz (); + octave_idx_type nz2 = nr*nc - nz1; SparseBoolMatrix r (nr, nc, nz2); - int ii = 0; - int jj = 0; + octave_idx_type ii = 0; + octave_idx_type jj = 0; r.cidx (0) = 0; - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { if (jj < cidx(i+1) && ridx(jj) == j) jj++; @@ -5765,13 +5765,13 @@ } SparseComplexMatrix -SparseComplexMatrix::permute (const Array& vec, bool inv) const +SparseComplexMatrix::permute (const Array& vec, bool inv) const { return MSparse::permute (vec, inv); } SparseComplexMatrix -SparseComplexMatrix::ipermute (const Array& vec) const +SparseComplexMatrix::ipermute (const Array& vec) const { return MSparse::ipermute (vec); } @@ -5781,14 +5781,14 @@ SparseComplexMatrix SparseComplexMatrix::map (c_c_Mapper f) const { - int nr = rows (); - int nc = cols (); - int nz = nnz (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); bool f_zero = (f(0.0) == 0.0); // Count number of non-zero elements - int nel = (f_zero ? 0 : nr*nc - nz); - for (int i = 0; i < nz; i++) + octave_idx_type nel = (f_zero ? 0 : nr*nc - nz); + for (octave_idx_type i = 0; i < nz; i++) if (f (data(i)) != 0.0) nel++; @@ -5796,10 +5796,10 @@ if (f_zero) { - int ii = 0; - for (int j = 0; j < nc; j++) + octave_idx_type ii = 0; + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { Complex tmp = f (elem (i, j)); if (tmp != 0.0) @@ -5813,10 +5813,10 @@ } else { - int ii = 0; - for (int j = 0; j < nc; j++) + octave_idx_type ii = 0; + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { retval.data(ii) = f (elem(i)); retval.ridx(ii++) = ridx(i); @@ -5831,14 +5831,14 @@ SparseMatrix SparseComplexMatrix::map (d_c_Mapper f) const { - int nr = rows (); - int nc = cols (); - int nz = nnz (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); bool f_zero = (f(0.0) == 0.0); // Count number of non-zero elements - int nel = (f_zero ? 0 : nr*nc - nz); - for (int i = 0; i < nz; i++) + octave_idx_type nel = (f_zero ? 0 : nr*nc - nz); + for (octave_idx_type i = 0; i < nz; i++) if (f (data(i)) != 0.0) nel++; @@ -5846,10 +5846,10 @@ if (f_zero) { - int ii = 0; - for (int j = 0; j < nc; j++) + octave_idx_type ii = 0; + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { double tmp = f (elem (i, j)); if (tmp != 0.0) @@ -5863,10 +5863,10 @@ } else { - int ii = 0; - for (int j = 0; j < nc; j++) + octave_idx_type ii = 0; + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { retval.data(ii) = f (elem(i)); retval.ridx(ii++) = ridx(i); @@ -5881,14 +5881,14 @@ SparseBoolMatrix SparseComplexMatrix::map (b_c_Mapper f) const { - int nr = rows (); - int nc = cols (); - int nz = nnz (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); bool f_zero = f(0.0); // Count number of non-zero elements - int nel = (f_zero ? 0 : nr*nc - nz); - for (int i = 0; i < nz; i++) + octave_idx_type nel = (f_zero ? 0 : nr*nc - nz); + for (octave_idx_type i = 0; i < nz; i++) if (f (data(i)) != 0.0) nel++; @@ -5896,10 +5896,10 @@ if (f_zero) { - int ii = 0; - for (int j = 0; j < nc; j++) + octave_idx_type ii = 0; + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { bool tmp = f (elem (i, j)); if (tmp) @@ -5913,10 +5913,10 @@ } else { - int ii = 0; - for (int j = 0; j < nc; j++) + octave_idx_type ii = 0; + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { retval.data(ii) = f (elem(i)); retval.ridx(ii++) = ridx(i); @@ -5938,9 +5938,9 @@ bool SparseComplexMatrix::any_element_is_inf_or_nan (void) const { - int nel = nnz (); - - for (int i = 0; i < nel; i++) + octave_idx_type nel = nnz (); + + for (octave_idx_type i = 0; i < nel; i++) { Complex val = data (i); if (xisinf (val) || xisnan (val)) @@ -5955,9 +5955,9 @@ bool SparseComplexMatrix::all_elements_are_real (void) const { - int nel = nnz (); - - for (int i = 0; i < nel; i++) + octave_idx_type nel = nnz (); + + for (octave_idx_type i = 0; i < nel; i++) { double ip = std::imag (data (i)); @@ -5975,7 +5975,7 @@ bool SparseComplexMatrix::all_integers (double& max_val, double& min_val) const { - int nel = nnz (); + octave_idx_type nel = nnz (); if (nel == 0) return false; @@ -5983,7 +5983,7 @@ max_val = std::real(data (0)); min_val = std::real(data (0)); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { Complex val = data (i); @@ -6012,9 +6012,9 @@ bool SparseComplexMatrix::too_large_for_float (void) const { - int nel = nnz (); - - for (int i = 0; i < nel; i++) + octave_idx_type nel = nnz (); + + for (octave_idx_type i = 0; i < nel; i++) { Complex val = data (i); @@ -6090,15 +6090,15 @@ SparseMatrix SparseComplexMatrix::abs (void) const { - int nz = nnz (); - int nc = cols (); + octave_idx_type nz = nnz (); + octave_idx_type nc = cols (); SparseMatrix retval (rows(), nc, nz); - for (int i = 0; i < nc + 1; i++) + for (octave_idx_type i = 0; i < nc + 1; i++) retval.cidx (i) = cidx (i); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { retval.data (i) = std::abs (data (i)); retval.ridx (i) = ridx (i); @@ -6108,10 +6108,10 @@ } SparseComplexMatrix -SparseComplexMatrix::diag (int k) const +SparseComplexMatrix::diag (octave_idx_type k) const { - int nnr = rows (); - int nnc = cols (); + octave_idx_type nnr = rows (); + octave_idx_type nnc = cols (); if (k > 0) nnc -= k; @@ -6122,25 +6122,25 @@ if (nnr > 0 && nnc > 0) { - int ndiag = (nnr < nnc) ? nnr : nnc; + octave_idx_type ndiag = (nnr < nnc) ? nnr : nnc; // Count the number of non-zero elements - int nel = 0; + octave_idx_type nel = 0; if (k > 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) if (elem (i, i+k) != 0.) nel++; } else if ( k < 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) if (elem (i-k, i) != 0.) nel++; } else { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) if (elem (i, i) != 0.) nel++; } @@ -6149,10 +6149,10 @@ d.xcidx (0) = 0; d.xcidx (1) = nel; - int ii = 0; + octave_idx_type ii = 0; if (k > 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) { Complex tmp = elem (i, i+k); if (tmp != 0.) @@ -6164,7 +6164,7 @@ } else if ( k < 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) { Complex tmp = elem (i-k, i); if (tmp != 0.) @@ -6176,7 +6176,7 @@ } else { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) { Complex tmp = elem (i, i); if (tmp != 0.) @@ -6197,13 +6197,13 @@ std::ostream& operator << (std::ostream& os, const SparseComplexMatrix& a) { - int nc = a.cols (); + octave_idx_type nc = a.cols (); // add one to the printed indices to go from // zero-based to one-based arrays - for (int j = 0; j < nc; j++) { + for (octave_idx_type j = 0; j < nc; j++) { OCTAVE_QUIT; - for (int i = a.cidx(j); i < a.cidx(j+1); i++) { + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { os << a.ridx(i) + 1 << " " << j + 1 << " "; octave_write_complex (os, a.data(i)); os << "\n"; @@ -6216,20 +6216,20 @@ std::istream& operator >> (std::istream& is, SparseComplexMatrix& a) { - int nr = a.rows (); - int nc = a.cols (); - int nz = a.nnz (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type nz = a.nnz (); if (nr < 1 || nc < 1) is.clear (std::ios::badbit); else { - int itmp, jtmp, jold = 0; + octave_idx_type itmp, jtmp, jold = 0; Complex tmp; - int ii = 0; + octave_idx_type ii = 0; a.cidx (0) = 0; - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { is >> itmp; itmp--; @@ -6241,7 +6241,7 @@ { if (jold != jtmp) { - for (int j = jold; j < jtmp; j++) + for (octave_idx_type j = jold; j < jtmp; j++) a.cidx(j+1) = ii; jold = jtmp; @@ -6253,7 +6253,7 @@ goto done; } - for (int j = jold; j < nc; j++) + for (octave_idx_type j = jold; j < nc; j++) a.cidx(j+1) = ii; } @@ -6299,8 +6299,8 @@ { SparseComplexMatrix result; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (SparseComplexMatrix); @@ -6310,8 +6310,8 @@ { result = SparseComplexMatrix (m); - for (int j = 0; j < nc; j++) - for (int i = m.cidx(j); i < m.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) result.data(i) = xmin(c, m.data(i)); } @@ -6331,11 +6331,11 @@ if ((a.rows() == b.rows()) && (a.cols() == b.cols())) { - int a_nr = a.rows (); - int a_nc = a.cols (); - - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); + + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (a_nr == 0 || b_nc == 0 || a.nnz () == 0 || b.nnz () == 0) return SparseComplexMatrix (a_nr, a_nc); @@ -6346,16 +6346,16 @@ { r = SparseComplexMatrix (a_nr, a_nc, (a.nnz () + b.nnz ())); - int jx = 0; + octave_idx_type jx = 0; r.cidx (0) = 0; - for (int i = 0 ; i < a_nc ; i++) + for (octave_idx_type i = 0 ; i < a_nc ; i++) { - int ja = a.cidx(i); - int ja_max = a.cidx(i+1); + octave_idx_type ja = a.cidx(i); + octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - int jb = b.cidx(i); - int jb_max = b.cidx(i+1); + 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 ) @@ -6419,8 +6419,8 @@ { SparseComplexMatrix result; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (SparseComplexMatrix); @@ -6428,8 +6428,8 @@ if (xmax(c, 0.) != 0.) { result = SparseComplexMatrix (nr, nc, c); - for (int j = 0; j < nc; j++) - for (int i = m.cidx(j); i < m.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) result.xdata(m.ridx(i) + j * nr) = xmax (c, m.data(i)); } else @@ -6451,11 +6451,11 @@ if ((a.rows() == b.rows()) && (a.cols() == b.cols())) { - int a_nr = a.rows (); - int a_nc = a.cols (); - - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); + + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (a_nr == 0 || b_nc == 0) return SparseComplexMatrix (a_nr, a_nc); @@ -6470,16 +6470,16 @@ { r = SparseComplexMatrix (a_nr, a_nc, (a.nnz () + b.nnz ())); - int jx = 0; + octave_idx_type jx = 0; r.cidx (0) = 0; - for (int i = 0 ; i < a_nc ; i++) + for (octave_idx_type i = 0 ; i < a_nc ; i++) { - int ja = a.cidx(i); - int ja_max = a.cidx(i+1); + octave_idx_type ja = a.cidx(i); + octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - int jb = b.cidx(i); - int jb_max = b.cidx(i+1); + 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 ) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CSparse.h --- a/liboctave/CSparse.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CSparse.h Fri Apr 08 16:07:37 2005 +0000 @@ -47,12 +47,12 @@ SparseComplexMatrix (void) : MSparse () { } - SparseComplexMatrix (int r, int c) : MSparse (r, c) { } + SparseComplexMatrix (octave_idx_type r, octave_idx_type c) : MSparse (r, c) { } - explicit SparseComplexMatrix (int r, int c, Complex val) + explicit SparseComplexMatrix (octave_idx_type r, octave_idx_type c, Complex val) : MSparse (r, c, val) { } - SparseComplexMatrix (int r, int c, double val) + SparseComplexMatrix (octave_idx_type r, octave_idx_type c, double val) : MSparse (r, c, Complex (val)) { } SparseComplexMatrix (const SparseComplexMatrix& a) @@ -69,22 +69,22 @@ explicit SparseComplexMatrix (const ComplexNDArray& a) : MSparse (a) { } - explicit SparseComplexMatrix (const Array a, const Array& r, - const Array& c, int nr = -1, - int nc = -1, bool sum_terms = true) + explicit SparseComplexMatrix (const Array a, const Array& r, + const Array& c, octave_idx_type nr = -1, + octave_idx_type nc = -1, bool sum_terms = true) : MSparse (a, r, c, nr, nc, sum_terms) { } explicit SparseComplexMatrix (const Array a, const Array& r, - const Array& c, int nr = -1, - int nc = -1, bool sum_terms = true) + const Array& c, octave_idx_type nr = -1, + octave_idx_type nc = -1, bool sum_terms = true) : MSparse (a, r, c, nr, nc, sum_terms) { } explicit SparseComplexMatrix (const SparseMatrix& a); explicit SparseComplexMatrix (const SparseBoolMatrix& a); - SparseComplexMatrix (int r, int c, int 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) @@ -99,17 +99,17 @@ bool is_hermitian (void) const; SparseComplexMatrix max (int dim = 0) const; - SparseComplexMatrix max (Array2& index, int dim = 0) const; + SparseComplexMatrix max (Array2& index, int dim = 0) const; SparseComplexMatrix min (int dim = 0) const; - SparseComplexMatrix min (Array2& index, int dim = 0) const; + SparseComplexMatrix min (Array2& index, int dim = 0) const; - SparseComplexMatrix& insert (const SparseComplexMatrix& a, int r, int c); - SparseComplexMatrix& insert (const SparseMatrix& a, int r, int c); + SparseComplexMatrix& insert (const SparseComplexMatrix& a, octave_idx_type r, octave_idx_type c); + SparseComplexMatrix& insert (const SparseMatrix& a, octave_idx_type r, octave_idx_type c); SparseComplexMatrix concat (const SparseComplexMatrix& rb, - const Array& ra_idx); + const Array& ra_idx); SparseComplexMatrix concat (const SparseMatrix& rb, - const Array& ra_idx); + const Array& ra_idx); ComplexMatrix matrix_value (void) const; @@ -120,229 +120,229 @@ friend SparseComplexMatrix conj (const SparseComplexMatrix& a); SparseComplexMatrix inverse (void) const; - SparseComplexMatrix inverse (int& info) const; - SparseComplexMatrix inverse (int& info, double& rcond, int force = 0, + SparseComplexMatrix inverse (octave_idx_type& info) const; + SparseComplexMatrix inverse (octave_idx_type& info, double& rcond, int force = 0, int calc_cond = 1) const; ComplexDET determinant (void) const; - ComplexDET determinant (int& info) const; - ComplexDET determinant (int& info, double& rcond, + ComplexDET determinant (octave_idx_type& info) const; + ComplexDET determinant (octave_idx_type& info, double& rcond, int calc_cond = 1) const; private: // Diagonal matrix solvers - ComplexMatrix dsolve (SparseType &typ, const Matrix& b, int& info, + ComplexMatrix dsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix dsolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix dsolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseComplexMatrix dsolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseComplexMatrix dsolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix dsolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Upper triangular matrix solvers - ComplexMatrix utsolve (SparseType &typ, const Matrix& b, int& info, + ComplexMatrix utsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix utsolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix utsolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseComplexMatrix utsolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseComplexMatrix utsolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix utsolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Lower triangular matrix solvers - ComplexMatrix ltsolve (SparseType &typ, const Matrix& b, int& info, + ComplexMatrix ltsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix ltsolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix ltsolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseComplexMatrix ltsolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseComplexMatrix ltsolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix ltsolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Tridiagonal matrix solvers - ComplexMatrix trisolve (SparseType &typ, const Matrix& b, int& info, + ComplexMatrix trisolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix trisolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix trisolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseComplexMatrix trisolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseComplexMatrix trisolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix trisolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Banded matrix solvers (umfpack/cholesky) - ComplexMatrix bsolve (SparseType &typ, const Matrix& b, int& info, + ComplexMatrix bsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix bsolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix bsolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseComplexMatrix bsolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseComplexMatrix bsolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix bsolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Full matrix solvers (umfpack/cholesky) - void * factorize (int& err, double &rcond, Matrix &Control, Matrix &Info, + void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, Matrix &Info, solve_singularity_handler sing_handler) const; - ComplexMatrix fsolve (SparseType &typ, const Matrix& b, int& info, + ComplexMatrix fsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix fsolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix fsolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseComplexMatrix fsolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseComplexMatrix fsolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix fsolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; public: // Generic interface to solver with no probing of type ComplexMatrix solve (SparseType &typ, const Matrix& b) const; - ComplexMatrix solve (SparseType &typ, const Matrix& b, int& info) const; - ComplexMatrix solve (SparseType &typ, const Matrix& b, int& info, + ComplexMatrix solve (SparseType &typ, const Matrix& b, octave_idx_type& info) const; + ComplexMatrix solve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond) const; - ComplexMatrix solve (SparseType &typ, const Matrix& b, int& info, + ComplexMatrix solve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b) const; ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, - int& info) const; - ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, int& info, + octave_idx_type& info) const; + ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; - ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix solve (SparseType &typ, const SparseMatrix& b) const; SparseComplexMatrix solve (SparseType &typ, const SparseMatrix& b, - int& info) const; - SparseComplexMatrix solve (SparseType &typ, const SparseMatrix& b, int& info, + octave_idx_type& info) const; + SparseComplexMatrix solve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond) const; - SparseComplexMatrix solve (SparseType &typ, const SparseMatrix& b, int& info, + SparseComplexMatrix solve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b) const; SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b, - int& info) const; + octave_idx_type& info) const; SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond) const; - SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b, int& info, + octave_idx_type& info, double& rcond) const; + SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexColumnVector solve (SparseType &typ, const ColumnVector& b) const; ComplexColumnVector solve (SparseType &typ, const ColumnVector& b, - int& info) const; + octave_idx_type& info) const; ComplexColumnVector solve (SparseType &typ, const ColumnVector& b, - int& info, double& rcond) const; - ComplexColumnVector solve (SparseType &typ, const ColumnVector& b, int& info, + octave_idx_type& info, double& rcond) const; + ComplexColumnVector solve (SparseType &typ, const ColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexColumnVector solve (SparseType &typ, const ComplexColumnVector& b) const; ComplexColumnVector solve (SparseType &typ, - const ComplexColumnVector& b, int& info) const; + const ComplexColumnVector& b, octave_idx_type& info) const; ComplexColumnVector solve (SparseType &typ, const ComplexColumnVector& b, - int& info, double& rcond) const; + octave_idx_type& info, double& rcond) const; ComplexColumnVector solve (SparseType &typ, const ComplexColumnVector& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Generic interface to solver with probing of type ComplexMatrix solve (const Matrix& b) const; - ComplexMatrix solve (const Matrix& b, int& info) const; - ComplexMatrix solve (const Matrix& b, int& info, double& rcond) const; - ComplexMatrix solve (const Matrix& b, int& info, double& rcond, + ComplexMatrix solve (const Matrix& b, octave_idx_type& info) const; + ComplexMatrix solve (const Matrix& b, octave_idx_type& info, double& rcond) const; + 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, int& info) const; - ComplexMatrix solve (const ComplexMatrix& b, int& info, + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; - ComplexMatrix solve (const ComplexMatrix& b, int& info, double& rcond, + 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, int& info) const; - SparseComplexMatrix solve (const SparseMatrix& b, int& info, + SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info) const; + SparseComplexMatrix solve (const SparseMatrix& b, octave_idx_type& info, double& rcond) const; - SparseComplexMatrix solve (const SparseMatrix& b, int& info, + 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, int& info) const; - SparseComplexMatrix solve (const SparseComplexMatrix& b, int& info, + SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info) const; + SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, double& rcond) const; - SparseComplexMatrix solve (const SparseComplexMatrix& b, int& info, + SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexColumnVector solve (const ColumnVector& b) const; - ComplexColumnVector solve (const ColumnVector& b, int& info) const; - ComplexColumnVector solve (const ColumnVector& b, int& info, + 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, int& info, double& rcond, + 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, int& info) const; - ComplexColumnVector solve (const ComplexColumnVector& b, int& info, + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const; - ComplexColumnVector solve (const ComplexColumnVector& b, int& info, + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexMatrix lssolve (const Matrix& b) const; - ComplexMatrix lssolve (const Matrix& b, int& info) const; - ComplexMatrix lssolve (const Matrix& b, int& info, int& rank) const; + ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info) const; + ComplexMatrix lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank) const; ComplexMatrix lssolve (const ComplexMatrix& b) const; - ComplexMatrix lssolve (const ComplexMatrix& b, int& info) const; - ComplexMatrix lssolve (const ComplexMatrix& b, int& info, - int& rank) const; + ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info) const; + ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info, + octave_idx_type& rank) const; SparseComplexMatrix lssolve (const SparseMatrix& b) const; - SparseComplexMatrix lssolve (const SparseMatrix& b, int& info) const; - SparseComplexMatrix lssolve (const SparseMatrix& b, int& info, - int& rank) const; + SparseComplexMatrix lssolve (const SparseMatrix& b, octave_idx_type& info) const; + SparseComplexMatrix lssolve (const SparseMatrix& b, octave_idx_type& info, + octave_idx_type& rank) const; SparseComplexMatrix lssolve (const SparseComplexMatrix& b) const; SparseComplexMatrix lssolve (const SparseComplexMatrix& b, - int& info) const; - SparseComplexMatrix lssolve (const SparseComplexMatrix& b, int& info, - int& rank) const; + octave_idx_type& info) const; + SparseComplexMatrix lssolve (const SparseComplexMatrix& b, octave_idx_type& info, + octave_idx_type& rank) const; ComplexColumnVector lssolve (const ColumnVector& b) const; - ComplexColumnVector lssolve (const ColumnVector& b, int& info) const; - ComplexColumnVector lssolve (const ColumnVector& b, int& info, - int& rank) const; + ComplexColumnVector lssolve (const ColumnVector& b, octave_idx_type& info) const; + ComplexColumnVector lssolve (const ColumnVector& b, octave_idx_type& info, + octave_idx_type& rank) const; ComplexColumnVector lssolve (const ComplexColumnVector& b) const; - ComplexColumnVector lssolve (const ComplexColumnVector& b, int& info) const; - ComplexColumnVector lssolve (const ComplexColumnVector& b, int& info, - int& rank) const; + ComplexColumnVector lssolve (const ComplexColumnVector& b, octave_idx_type& info) const; + ComplexColumnVector lssolve (const ComplexColumnVector& b, octave_idx_type& info, + octave_idx_type& rank) const; SparseComplexMatrix squeeze (void) const; @@ -354,9 +354,9 @@ SparseComplexMatrix reshape (const dim_vector& new_dims) const; - SparseComplexMatrix permute (const Array& vec, bool inv = false) const; + SparseComplexMatrix permute (const Array& vec, bool inv = false) const; - SparseComplexMatrix ipermute (const Array& vec) const; + SparseComplexMatrix ipermute (const Array& vec) const; SparseComplexMatrix map (c_c_Mapper f) const; SparseMatrix map (d_c_Mapper f) const; @@ -381,7 +381,7 @@ SparseComplexMatrix sumsq (int dim = -1) const; SparseMatrix abs (void) const; - SparseComplexMatrix diag (int k = 0) const; + SparseComplexMatrix diag (octave_idx_type k = 0) const; // i/o friend std::ostream& operator << (std::ostream& os, diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/ChangeLog --- a/liboctave/ChangeLog Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/ChangeLog Fri Apr 08 16:07:37 2005 +0000 @@ -1,3 +1,58 @@ +2005-04-08 John W. Eaton + + * Initial merge of 64-bit changes from Clinton Chee: + + 2005-04-07 John W. Eaton + + * MArray-i.cc, Array-i.cc: Instantiate Array and MArray. + + * CSparse.cc, CSparse.h, MSparse.cc, MSparse.h, Sparse-op-defs.h, + Sparse.cc, Sparse.h, SparseCmplxLU.cc, SparseType.cc, + SparseType.h, SparsedbleLU.cc, boolSparse.cc, boolSparse.h, + dSparse.cc, dSparse.h, sparse-base-lu.cc: + Use octave_idx_type instead of int where needed. + + 2005-03-31 Clinton Chee + + * Array-util.cc, Array-util.h, Array.cc,Array.h, Array2.h, + Array3.h, ArrayN.cc, ArrayN.h, Bounds.cc, Bounds.h, CColVector.cc, + CColVector.h, CDiagMatrix.cc, CDiagMatrix.h, CMatrix.cc, + CMatrix.h, CNDArray.cc, CNDArray.h, CRowVector.cc, CRowVector.h, + CmplxAEPBAL.cc, CmplxAEPBAL.h, CmplxCHOL.cc, CmplxCHOL.h, + CmplxHESS.cc, CmplxHESS.h, CmplxLU.cc, CmplxQR.cc, CmplxQRP.cc, + CmplxSCHUR.cc, CmplxSCHUR.h, CmplxSVD.cc, CmplxSVD.h, CollocWt.cc, + CollocWt.h, DAEFunc.h, DASPK-opts.in,DASPK.cc,DASPK.h, + DASRT-opts.in, DASRT.cc, DASRT.h, DASSL-opts.in, DASSL.cc, + DASSL.h, DiagArray2.cc, DiagArray2.h, EIG.cc, EIG.h, FEGrid.cc, + FEGrid.h, LPsolve.cc, LPsolve.h, LSODE-opts.in, LSODE.cc, LSODE.h, + MArray-defs.h, MArray.cc, MArray.h, MArray2.cc, MArray2.h, + MArrayN.cc, MDiagArray2.cc, MDiagArray2.h, NLConst.h, NLEqn.cc, + NLEqn.h, Quad.cc, Quad.h, Range.cc,Range.cc, Range.h, base-de.h, + base-lu.cc, base-lu.h, base-min.h, boolMatrix.cc, boolMatrix.h, + boolNDArray.cc, boolNDArray.h, chMatrix.cc, chMatrix.h, + chNDArray.cc, chNDArray.h, dColVector.cc, dColVector.h, + dDiagMatrix.cc, dDiagMatrix.h, dMatrix.cc, dMatrix.h, + dNDArray.cc,dNDArray.cc, dNDArray.h, dRowVector.cc, dRowVector.h, + dbleAEPBAL.cc, dbleAEPBAL.h, dbleCHOL.cc, dbleCHOL.h, dbleHESS.cc, + dbleHESS.h, dbleLU.cc, dbleQR.cc, dbleQRP.cc, dbleSCHUR.cc, + dbleSCHUR.h, dbleSVD.cc, dbleSVD.h, dim-vector.h, idx-vector.cc, + idx-vector.h, intNDArray.cc, intNDArray.h, lo-specfun.cc, + lo-specfun.h, mach-info.cc, mx-inlines.cc, oct-fftw.cc, + oct-fftw.h, oct-rand.cc, oct-rand.h, so-array.cc, so-array.h, + str-vec.cc, str-vec.h: + Use octave_idx_type instead of int where needed. + + 2005-04-01 John W. Eaton + + * dim-vector.h, lo-utils.h: Include oct-types.h. + + * oct-types.h.in: New file. + + 2005-03-31 Clinton Chee + + * lo-utils.cc (NINTbig): New function. + * lo-utils.h: Provide decl. + 2005-04-06 David Bateman * Makefile.in: Link to UMFPACK_LIBS. diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxAEPBAL.cc --- a/liboctave/CmplxAEPBAL.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxAEPBAL.cc Fri Apr 08 16:07:37 2005 +0000 @@ -33,25 +33,25 @@ extern "C" { F77_RET_T - F77_FUNC (zgebal, ZGEBAL) (F77_CONST_CHAR_ARG_DECL, - const int&, Complex*, const int&, int&, - int&, double*, int& - F77_CHAR_ARG_LEN_DECL); + F77_FUNC (zgebal, ZGEBAL) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + Complex*, 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, - const int&, const int&, const int&, double*, - const int&, Complex*, const int&, int& - F77_CHAR_ARG_LEN_DECL - F77_CHAR_ARG_LEN_DECL); + F77_FUNC (zgebak, ZGEBAK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, + const octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, double*, + const octave_idx_type&, Complex*, + const octave_idx_type&, octave_idx_type& + F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); } -int +octave_idx_type ComplexAEPBALANCE::init (const ComplexMatrix& a, const std::string& balance_job) { - int n = a.cols (); + octave_idx_type n = a.cols (); if (a.rows () != n) { @@ -59,9 +59,9 @@ return -1; } - int info; - int ilo; - int ihi; + octave_idx_type info; + octave_idx_type ilo; + octave_idx_type ihi; Array scale (n); double *pscale = scale.fortran_vec (); @@ -81,7 +81,7 @@ else { balancing_mat = ComplexMatrix (n, n, 0.0); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) balancing_mat.elem (i, i) = 1.0; Complex *p_balancing_mat = balancing_mat.fortran_vec (); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxAEPBAL.h --- a/liboctave/CmplxAEPBAL.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxAEPBAL.h Fri Apr 08 16:07:37 2005 +0000 @@ -66,7 +66,7 @@ ComplexMatrix balanced_mat; ComplexMatrix balancing_mat; - int init (const ComplexMatrix& a, const std::string& balance_job); + octave_idx_type init (const ComplexMatrix& a, const std::string& balance_job); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxCHOL.cc --- a/liboctave/CmplxCHOL.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxCHOL.cc Fri Apr 08 16:07:37 2005 +0000 @@ -32,15 +32,15 @@ { F77_RET_T F77_FUNC (zpotrf, ZPOTRF) (F77_CONST_CHAR_ARG_DECL, - const int&, Complex*, const int&, int& + const octave_idx_type&, Complex*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); } -int +octave_idx_type ComplexCHOL::init (const ComplexMatrix& a) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (a_nr != a_nc) { @@ -49,8 +49,8 @@ return -1; } - int n = a_nc; - int info; + octave_idx_type n = a_nc; + octave_idx_type info; chol_mat = a; Complex *h = chol_mat.fortran_vec (); @@ -66,8 +66,8 @@ // faster for that matter :-)), please let me know! if (n > 1) - for (int j = 0; j < a_nc; j++) - for (int i = j+1; i < a_nr; i++) + for (octave_idx_type j = 0; j < a_nc; j++) + for (octave_idx_type i = j+1; i < a_nr; i++) chol_mat.elem (i, j) = 0.0; } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxCHOL.h --- a/liboctave/CmplxCHOL.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxCHOL.h Fri Apr 08 16:07:37 2005 +0000 @@ -36,7 +36,7 @@ ComplexCHOL (const ComplexMatrix& a) { init (a); } - ComplexCHOL (const ComplexMatrix& a, int& info) + ComplexCHOL (const ComplexMatrix& a, octave_idx_type& info) { info = init (a); } @@ -63,7 +63,7 @@ ComplexMatrix chol_mat; - int init (const ComplexMatrix& a); + octave_idx_type init (const ComplexMatrix& a); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxHESS.cc --- a/liboctave/CmplxHESS.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxHESS.cc Fri Apr 08 16:07:37 2005 +0000 @@ -32,34 +32,34 @@ { F77_RET_T F77_FUNC (zgebal, ZGEBAL) (F77_CONST_CHAR_ARG_DECL, - const int&, Complex*, const int&, - int&, int&, double*, int& + const octave_idx_type&, Complex*, 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 int&, const int&, const int&, - Complex*, const int&, Complex*, - Complex*, const int&, int&); + 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 int&, const int&, const int&, - Complex*, const int&, Complex*, - Complex*, const int&, int&); + F77_FUNC (zunghr, ZUNGHR) (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 (zgebak, ZGEBAK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const int&, double*, - const int&, Complex*, const int&, int& + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, double*, + const octave_idx_type&, Complex*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); } -int +octave_idx_type ComplexHESS::init (const ComplexMatrix& a) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (a_nr != a_nc) { @@ -71,11 +71,11 @@ char job = 'N'; char side = 'R'; - int n = a_nc; - int lwork = 32 * n; - int info; - int ilo; - int ihi; + octave_idx_type n = a_nc; + octave_idx_type lwork = 32 * n; + octave_idx_type info; + octave_idx_type ilo; + octave_idx_type ihi; hess_mat = a; Complex *h = hess_mat.fortran_vec (); @@ -130,8 +130,8 @@ // please let me know! if (n > 2) - for (int j = 0; j < a_nc; j++) - for (int i = j+2; i < a_nr; i++) + for (octave_idx_type j = 0; j < a_nc; j++) + for (octave_idx_type i = j+2; i < a_nr; i++) hess_mat.elem (i, j) = 0; } } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxHESS.h --- a/liboctave/CmplxHESS.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxHESS.h Fri Apr 08 16:07:37 2005 +0000 @@ -36,7 +36,7 @@ ComplexHESS (const ComplexMatrix& a) { init (a); } - ComplexHESS (const ComplexMatrix& a, int& info) { info = init (a); } + ComplexHESS (const ComplexMatrix& a, octave_idx_type& info) { info = init (a); } ComplexHESS (const ComplexHESS& a) : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } @@ -67,7 +67,7 @@ ComplexMatrix hess_mat; ComplexMatrix unitary_hess_mat; - int init (const ComplexMatrix& a); + octave_idx_type init (const ComplexMatrix& a); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxLU.cc --- a/liboctave/CmplxLU.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxLU.cc Fri Apr 08 16:07:37 2005 +0000 @@ -40,30 +40,30 @@ extern "C" { F77_RET_T - F77_FUNC (zgetrf, ZGETRF) (const int&, const int&, Complex*, - const int&, int*, int&); + F77_FUNC (zgetrf, ZGETRF) (const octave_idx_type&, const octave_idx_type&, Complex*, + const octave_idx_type&, octave_idx_type*, octave_idx_type&); } ComplexLU::ComplexLU (const ComplexMatrix& a) { - int a_nr = a.rows (); - int a_nc = a.cols (); - int mn = (a_nr < a_nc ? a_nr : a_nc); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); + octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc); ipvt.resize (mn); - int *pipvt = ipvt.fortran_vec (); + octave_idx_type *pipvt = ipvt.fortran_vec (); a_fact = a; Complex *tmp_data = a_fact.fortran_vec (); - int info = 0; + octave_idx_type info = 0; F77_XFCN (zgetrf, ZGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info)); if (f77_exception_encountered) (*current_liboctave_error_handler) ("unrecoverable error in zgetrf"); else - ipvt -= 1; + ipvt -= static_cast (1); } /* diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxQR.cc --- a/liboctave/CmplxQR.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxQR.cc Fri Apr 08 16:07:37 2005 +0000 @@ -31,14 +31,14 @@ extern "C" { F77_RET_T - F77_FUNC (zgeqrf, ZGEQRF) (const int&, const int&, Complex*, - const int&, Complex*, Complex*, - const int&, int&); + 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&); F77_RET_T - F77_FUNC (zungqr, ZUNGQR) (const int&, const int&, const int&, - Complex*, const int&, Complex*, - Complex*, const int&, int&); + F77_FUNC (zungqr, ZUNGQR) (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&); } ComplexQR::ComplexQR (const ComplexMatrix& a, QR::type qr_type) @@ -50,8 +50,8 @@ void ComplexQR::init (const ComplexMatrix& a, QR::type qr_type) { - int m = a.rows (); - int n = a.cols (); + octave_idx_type m = a.rows (); + octave_idx_type n = a.cols (); if (m == 0 || n == 0) { @@ -60,16 +60,16 @@ return; } - int min_mn = m < n ? m : n; + octave_idx_type min_mn = m < n ? m : n; Array tau (min_mn); Complex *ptau = tau.fortran_vec (); - int lwork = 32*n; + octave_idx_type lwork = 32*n; Array work (lwork); Complex *pwork = work.fortran_vec (); - int info = 0; + octave_idx_type info = 0; ComplexMatrix A_fact; if (m > n && qr_type != QR::economy) @@ -90,10 +90,10 @@ { if (qr_type == QR::raw) { - for (int j = 0; j < min_mn; j++) + for (octave_idx_type j = 0; j < min_mn; j++) { - int limit = j < min_mn - 1 ? j : min_mn - 1; - for (int i = limit + 1; i < m; i++) + octave_idx_type limit = j < min_mn - 1 ? j : min_mn - 1; + for (octave_idx_type i = limit + 1; i < m; i++) A_fact.elem (i, j) *= tau.elem (j); } @@ -104,17 +104,17 @@ } else { - int n2 = (qr_type == QR::economy) ? min_mn : m; + octave_idx_type n2 = (qr_type == QR::economy) ? min_mn : m; if (qr_type == QR::economy && m > n) r.resize (n, n, 0.0); else r.resize (m, n, 0.0); - for (int j = 0; j < n; j++) + for (octave_idx_type j = 0; j < n; j++) { - int limit = j < min_mn-1 ? j : min_mn-1; - for (int i = 0; i <= limit; i++) + octave_idx_type limit = j < min_mn-1 ? j : min_mn-1; + for (octave_idx_type i = 0; i <= limit; i++) r.elem (i, j) = A_fact.elem (i, j); } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxQRP.cc --- a/liboctave/CmplxQRP.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxQRP.cc Fri Apr 08 16:07:37 2005 +0000 @@ -33,14 +33,14 @@ extern "C" { F77_RET_T - F77_FUNC (zgeqpf, ZGEQPF) (const int&, const int&, Complex*, - const int&, int*, Complex*, Complex*, - double*, int&); + F77_FUNC (zgeqpf, ZGEQPF) (const octave_idx_type&, const octave_idx_type&, Complex*, + const octave_idx_type&, octave_idx_type*, Complex*, Complex*, + double*, octave_idx_type&); F77_RET_T - F77_FUNC (zungqr, ZUNGQR) (const int&, const int&, const int&, - Complex*, const int&, Complex*, - Complex*, const int&, int&); + F77_FUNC (zungqr, ZUNGQR) (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&); } // It would be best to share some of this code with ComplexQR class... @@ -56,8 +56,8 @@ { assert (qr_type != QR::raw); - int m = a.rows (); - int n = a.cols (); + octave_idx_type m = a.rows (); + octave_idx_type n = a.cols (); if (m == 0 || n == 0) { @@ -66,15 +66,15 @@ return; } - int min_mn = m < n ? m : n; + octave_idx_type min_mn = m < n ? m : n; Array tau (min_mn); Complex *ptau = tau.fortran_vec (); - int lwork = 3*n > 32*m ? 3*n : 32*m; + octave_idx_type lwork = 3*n > 32*m ? 3*n : 32*m; Array work (lwork); Complex *pwork = work.fortran_vec (); - int info = 0; + octave_idx_type info = 0; ComplexMatrix A_fact = a; if (m > n && qr_type != QR::economy) @@ -85,8 +85,8 @@ Array rwork (2*n); double *prwork = rwork.fortran_vec (); - Array jpvt (n, 0); - int *pjpvt = jpvt.fortran_vec (); + Array jpvt (n, 0); + octave_idx_type *pjpvt = jpvt.fortran_vec (); // Code to enforce a certain permutation could go here... @@ -103,27 +103,27 @@ if (qr_type == QR::economy) { p.resize (1, n, 0.0); - for (int j = 0; j < n; j++) + for (octave_idx_type j = 0; j < n; j++) p.elem (0, j) = jpvt.elem (j); } else { p.resize (n, n, 0.0); - for (int j = 0; j < n; j++) + for (octave_idx_type j = 0; j < n; j++) p.elem (jpvt.elem (j) - 1, j) = 1.0; } - int n2 = (qr_type == QR::economy) ? min_mn : m; + octave_idx_type n2 = (qr_type == QR::economy) ? min_mn : m; if (qr_type == QR::economy && m > n) r.resize (n, n, 0.0); else r.resize (m, n, 0.0); - for (int j = 0; j < n; j++) + for (octave_idx_type j = 0; j < n; j++) { - int limit = j < min_mn-1 ? j : min_mn-1; - for (int i = 0; i <= limit; i++) + octave_idx_type limit = j < min_mn-1 ? j : min_mn-1; + for (octave_idx_type i = 0; i <= limit; i++) r.elem (i, j) = A_fact.elem (i, j); } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxSCHUR.cc --- a/liboctave/CmplxSCHUR.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxSCHUR.cc Fri Apr 08 16:07:37 2005 +0000 @@ -35,33 +35,33 @@ F77_CONST_CHAR_ARG_DECL, ComplexSCHUR::select_function, F77_CONST_CHAR_ARG_DECL, - const int&, Complex*, const int&, int&, - Complex*, Complex*, const int&, double&, - double&, Complex*, const int&, double*, int*, - int& + const octave_idx_type&, Complex*, const octave_idx_type&, octave_idx_type&, + Complex*, Complex*, const octave_idx_type&, double&, + double&, Complex*, const 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); } -static int +static octave_idx_type select_ana (const Complex& a) { return a.real () < 0.0; } -static int +static octave_idx_type select_dig (const Complex& a) { return (abs (a) < 1.0); } -int +octave_idx_type ComplexSCHUR::init (const ComplexMatrix& a, const std::string& ord, bool calc_unitary) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (a_nr != a_nc) { @@ -94,10 +94,10 @@ else selector = 0; - int n = a_nc; - int lwork = 8 * n; - int info; - int sdim; + octave_idx_type n = a_nc; + octave_idx_type lwork = 8 * n; + octave_idx_type info; + octave_idx_type sdim; double rconde; double rcondv; @@ -118,8 +118,8 @@ Complex *pwork = work.fortran_vec (); // BWORK is not referenced for non-ordered Schur. - Array bwork ((ord_char == 'N' || ord_char == 'n') ? 0 : n); - int *pbwork = bwork.fortran_vec (); + Array bwork ((ord_char == 'N' || ord_char == 'n') ? 0 : n); + octave_idx_type *pbwork = bwork.fortran_vec (); F77_XFCN (zgeesx, ZGEESX, (F77_CONST_CHAR_ARG2 (&jobvs, 1), F77_CONST_CHAR_ARG2 (&sort, 1), diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxSCHUR.h --- a/liboctave/CmplxSCHUR.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxSCHUR.h Fri Apr 08 16:07:37 2005 +0000 @@ -40,7 +40,7 @@ bool calc_unitary = true) : schur_mat (), unitary_mat () { init (a, ord, calc_unitary); } - ComplexSCHUR (const ComplexMatrix& a, const std::string& ord, int& info, + ComplexSCHUR (const ComplexMatrix& a, const std::string& ord, octave_idx_type& info, bool calc_unitary = true) : schur_mat (), unitary_mat () { info = init (a, ord, calc_unitary); } @@ -65,7 +65,7 @@ friend std::ostream& operator << (std::ostream& os, const ComplexSCHUR& a); - typedef int (*select_function) (const Complex&); + typedef octave_idx_type (*select_function) (const Complex&); private: @@ -74,7 +74,7 @@ select_function selector; - int init (const ComplexMatrix& a, const std::string& ord, bool calc_unitary); + octave_idx_type init (const ComplexMatrix& a, const std::string& ord, bool calc_unitary); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxSVD.cc --- a/liboctave/CmplxSVD.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxSVD.cc Fri Apr 08 16:07:37 2005 +0000 @@ -33,10 +33,10 @@ F77_RET_T F77_FUNC (zgesvd, ZGESVD) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, const int&, Complex*, - const int&, double*, Complex*, const int&, - Complex*, const int&, Complex*, const int&, - double*, int& + const octave_idx_type&, const octave_idx_type&, Complex*, + const octave_idx_type&, double*, Complex*, const octave_idx_type&, + Complex*, const octave_idx_type&, Complex*, const octave_idx_type&, + double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); } @@ -67,27 +67,27 @@ return right_sm; } -int +octave_idx_type ComplexSVD::init (const ComplexMatrix& a, SVD::type svd_type) { - int info; + octave_idx_type info; - int m = a.rows (); - int n = a.cols (); + octave_idx_type m = a.rows (); + octave_idx_type n = a.cols (); ComplexMatrix atmp = a; Complex *tmp_data = atmp.fortran_vec (); - int min_mn = m < n ? m : n; - int max_mn = m > n ? m : n; + octave_idx_type min_mn = m < n ? m : n; + octave_idx_type max_mn = m > n ? m : n; char jobu = 'A'; char jobv = 'A'; - int ncol_u = m; - int nrow_vt = n; - int nrow_s = m; - int ncol_s = n; + octave_idx_type ncol_u = m; + octave_idx_type nrow_vt = n; + octave_idx_type nrow_s = m; + octave_idx_type ncol_s = n; switch (svd_type) { @@ -130,13 +130,13 @@ Complex *vt = right_sm.fortran_vec (); - int lrwork = 5*max_mn; + octave_idx_type lrwork = 5*max_mn; Array rwork (lrwork); // Ask ZGESVD what the dimension of WORK should be. - int lwork = -1; + octave_idx_type lwork = -1; Array work (1); @@ -152,7 +152,7 @@ (*current_liboctave_error_handler) ("unrecoverable error in zgesvd"); else { - lwork = static_cast (work(0).real ()); + lwork = static_cast (work(0).real ()); work.resize (lwork); F77_XFCN (zgesvd, ZGESVD, (F77_CONST_CHAR_ARG2 (&jobu, 1), diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CmplxSVD.h --- a/liboctave/CmplxSVD.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CmplxSVD.h Fri Apr 08 16:07:37 2005 +0000 @@ -41,7 +41,7 @@ init (a, svd_type); } - ComplexSVD (const ComplexMatrix& a, int& info, + ComplexSVD (const ComplexMatrix& a, octave_idx_type& info, SVD::type svd_type = SVD::std) { info = init (a, svd_type); @@ -81,7 +81,7 @@ ComplexMatrix left_sm; ComplexMatrix right_sm; - int init (const ComplexMatrix& a, SVD::type svd_type = SVD::std); + octave_idx_type init (const ComplexMatrix& a, SVD::type svd_type = SVD::std); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CollocWt.cc --- a/liboctave/CollocWt.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CollocWt.cc Fri Apr 08 16:07:37 2005 +0000 @@ -33,12 +33,12 @@ extern "C" { F77_RET_T - F77_FUNC (jcobi, JCOBI) (int&, int&, int&, int&, double&, + F77_FUNC (jcobi, JCOBI) (octave_idx_type&, octave_idx_type&, octave_idx_type&, octave_idx_type&, double&, double&, double*, double*, double*, double*); F77_RET_T - F77_FUNC (dfopr, DFOPR) (int&, int&, int&, int&, int&, int&, + F77_FUNC (dfopr, DFOPR) (octave_idx_type&, octave_idx_type&, octave_idx_type&, octave_idx_type&, octave_idx_type&, octave_idx_type&, double*, double*, double*, double*, double*); } @@ -91,7 +91,7 @@ return; } - int nt = n + inc_left + inc_right; + octave_idx_type nt = n + inc_left + inc_right; if (nt < 0) { @@ -125,29 +125,29 @@ F77_FUNC (jcobi, JCOBI) (nt, n, inc_left, inc_right, Alpha, Beta, pdif1, pdif2, pdif3, pr); - int id; + octave_idx_type id; // First derivative weights. id = 1; - for (int i = 1; i <= nt; i++) + for (octave_idx_type i = 1; i <= nt; i++) { F77_FUNC (dfopr, DFOPR) (nt, n, inc_left, inc_right, i, id, pdif1, pdif2, pdif3, pr, pvect); - for (int j = 0; j < nt; j++) + for (octave_idx_type j = 0; j < nt; j++) A (i-1, j) = vect.elem (j); } // Second derivative weights. id = 2; - for (int i = 1; i <= nt; i++) + for (octave_idx_type i = 1; i <= nt; i++) { F77_FUNC (dfopr, DFOPR) (nt, n, inc_left, inc_right, i, id, pdif1, pdif2, pdif3, pr, pvect); - for (int j = 0; j < nt; j++) + for (octave_idx_type j = 0; j < nt; j++) B (i-1, j) = vect.elem (j); } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/CollocWt.h --- a/liboctave/CollocWt.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/CollocWt.h Fri Apr 08 16:07:37 2005 +0000 @@ -37,19 +37,19 @@ : n (0), inc_left (0), inc_right (0), lb (0.0), rb (1.0), Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { } - CollocWt (int nc, int il, int ir) + CollocWt (octave_idx_type nc, octave_idx_type il, octave_idx_type ir) : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0), Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { } - CollocWt (int nc, int il, int ir, double l, double rr) + CollocWt (octave_idx_type nc, octave_idx_type il, octave_idx_type ir, double l, double rr) : n (nc), inc_left (il), inc_right (ir), lb (l), rb (rr), Alpha (0.0), Beta (0.0), r (), q (), A (), B (), initialized (0) { } - CollocWt (int nc, double a, double b, int il, int ir) + CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il, octave_idx_type ir) : n (nc), inc_left (il), inc_right (ir), lb (0.0), rb (1.0), Alpha (a), Beta (b), initialized (0) { } - CollocWt (int nc, double a, double b, int il, int ir, + CollocWt (octave_idx_type nc, double a, double b, octave_idx_type il, octave_idx_type ir, 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 (0) { } @@ -80,7 +80,7 @@ ~CollocWt (void) { } - CollocWt& resize (int nc) + CollocWt& resize (octave_idx_type nc) { n = nc; initialized = 0; @@ -133,10 +133,10 @@ return *this; } - int ncol (void) const { return n; } + octave_idx_type ncol (void) const { return n; } - int left_included (void) const { return inc_left; } - int right_included (void) const { return inc_right; } + octave_idx_type left_included (void) const { return inc_left; } + octave_idx_type right_included (void) const { return inc_right; } double left (void) const { return lb; } double right (void) const { return rb; } @@ -159,10 +159,10 @@ protected: - int n; + octave_idx_type n; - int inc_left; - int inc_right; + octave_idx_type inc_left; + octave_idx_type inc_right; double lb; double rb; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DAEFunc.h --- a/liboctave/DAEFunc.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DAEFunc.h Fri Apr 08 16:07:37 2005 +0000 @@ -23,6 +23,8 @@ #if !defined (octave_DAEFunc_h) #define octave_DAEFunc_h 1 +#include "oct-types.h" + class Matrix; class ColumnVector; @@ -33,7 +35,7 @@ typedef ColumnVector (*DAERHSFunc) (const ColumnVector& x, const ColumnVector& xdot, - double t, int& ires); + double t, octave_idx_type& ires); // This is really the form used by DASSL: // diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DASPK-opts.in --- a/liboctave/DASPK-opts.in Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DASPK-opts.in Fri Apr 08 16:07:37 2005 +0000 @@ -83,7 +83,7 @@ @code{\"algebraic variables\"} option to declare which variables in the problem are algebraic. END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "0" SET_EXPR = "val" END_OPTION @@ -94,7 +94,7 @@ Set to a nonzero value to use the initial condition heuristics options described below. END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "0" SET_EXPR = "val" END_OPTION @@ -153,7 +153,7 @@ Set this option to a nonzero value to display detailed information about the initial condition calculation (default is 0). END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "0" SET_EXPR = "val" END_OPTION @@ -165,7 +165,7 @@ test. You must also set the @code{\"algebraic variables\"} option to declare which variables in the problem are algebraic (default is 0). END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "0" SET_EXPR = "val" END_OPTION @@ -182,7 +182,7 @@ @code{compute consistent initial condition\"} and @code{\"exclude algebraic variables from error test\"} options. END_DOC_ITEM - TYPE = "Array" + TYPE = "Array" SET_ARG_TYPE = const $TYPE& INIT_BODY $OPTVAR.resize (1); @@ -214,7 +214,7 @@ @item To enforce both options 1 and 2. @end enumerate END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "0" SET_EXPR = "val" END_OPTION @@ -243,14 +243,14 @@ This option only has an effect if the @code{\"enforce inequality constraints\"} option is nonzero. END_DOC_ITEM - TYPE = "Array" + TYPE = "Array" SET_ARG_TYPE = const $TYPE& INIT_BODY $OPTVAR.resize (1); $OPTVAR(0) = 0; END_INIT_BODY SET_CODE - void set_$OPT (int val) + void set_$OPT (octave_idx_type val) { $OPTVAR.resize (1); $OPTVAR(0) = val; @@ -282,7 +282,7 @@ Restrict the maximum order of the solution method. This option must be between 1 and 5, inclusive (default is 5). END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "5" SET_EXPR = "val" END_OPTION diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DASPK.cc --- a/liboctave/DASPK.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DASPK.cc Fri Apr 08 16:07:37 2005 +0000 @@ -33,39 +33,39 @@ #include "lo-sstream.h" #include "quit.h" -typedef int (*daspk_fcn_ptr) (const double&, const double*, +typedef octave_idx_type (*daspk_fcn_ptr) (const double&, const double*, const double*, const double&, - double*, int&, double*, int*); + double*, octave_idx_type&, double*, octave_idx_type*); -typedef int (*daspk_jac_ptr) (const double&, const double*, +typedef octave_idx_type (*daspk_jac_ptr) (const double&, const double*, const double*, double*, - const double&, double*, int*); + const double&, double*, octave_idx_type*); -typedef int (*daspk_psol_ptr) (const int&, const double&, +typedef octave_idx_type (*daspk_psol_ptr) (const octave_idx_type&, const double&, const double*, const double*, const double*, const double&, - const double*, double*, int*, - double*, const double&, int&, - double*, int*); + const double*, double*, octave_idx_type*, + double*, const double&, octave_idx_type&, + double*, octave_idx_type*); extern "C" { F77_RET_T - F77_FUNC (ddaspk, DDASPK) (daspk_fcn_ptr, const int&, double&, - double*, double*, double&, const int*, - const double*, const double*, int&, - double*, const int&, int*, const int&, - const double*, const int*, + F77_FUNC (ddaspk, DDASPK) (daspk_fcn_ptr, const octave_idx_type&, double&, + double*, double*, double&, const octave_idx_type*, + const double*, const double*, octave_idx_type&, + double*, const octave_idx_type&, octave_idx_type*, const octave_idx_type&, + const double*, const octave_idx_type*, daspk_jac_ptr, daspk_psol_ptr); } static DAEFunc::DAERHSFunc user_fun; static DAEFunc::DAEJacFunc user_jac; -static int nn; +static octave_idx_type nn; -static int +static octave_idx_type ddaspk_f (const double& time, const double *state, const double *deriv, - const double&, double *delta, int& ires, double *, int *) + const double&, double *delta, octave_idx_type& ires, double *, octave_idx_type *) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -73,7 +73,7 @@ ColumnVector tmp_state (nn); ColumnVector tmp_delta (nn); - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) { tmp_deriv.elem (i) = deriv [i]; tmp_state.elem (i) = state [i]; @@ -87,7 +87,7 @@ ires = -2; else { - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) delta [i] = tmp_delta.elem (i); } } @@ -100,11 +100,11 @@ //NEQ, T, Y, YPRIME, SAVR, WK, CJ, WGHT, //C WP, IWP, B, EPLIN, IER, RPAR, IPAR) -static int -ddaspk_psol (const int&, const double&, const double *, +static octave_idx_type +ddaspk_psol (const octave_idx_type&, const double&, const double *, const double *, const double *, const double&, - const double *, double *, int *, double *, - const double&, int&, double *, int*) + const double *, double *, octave_idx_type *, double *, + const double&, octave_idx_type&, double *, octave_idx_type*) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -116,9 +116,9 @@ } -static int +static octave_idx_type ddaspk_j (const double& time, const double *state, const double *deriv, - double *pd, const double& cj, double *, int *) + double *pd, const double& cj, double *, octave_idx_type *) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -127,7 +127,7 @@ ColumnVector tmp_state (nn); ColumnVector tmp_deriv (nn); - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) { tmp_deriv.elem (i) = deriv [i]; tmp_state.elem (i) = state [i]; @@ -135,8 +135,8 @@ Matrix tmp_pd = user_jac (tmp_state, tmp_deriv, time, cj); - for (int j = 0; j < nn; j++) - for (int i = 0; i < nn; i++) + for (octave_idx_type j = 0; j < nn; j++) + for (octave_idx_type i = 0; i < nn; i++) pd [nn * j + i] = tmp_pd.elem (i, j); END_INTERRUPT_WITH_EXCEPTIONS; @@ -160,12 +160,12 @@ info.resize (20); - for (int i = 0; i < 20; i++) + for (octave_idx_type i = 0; i < 20; i++) info(i) = 0; pinfo = info.fortran_vec (); - int n = size (); + octave_idx_type n = size (); nn = n; @@ -189,7 +189,7 @@ if (user_fun) { - int ires = 0; + octave_idx_type ires = 0; ColumnVector res = (*user_fun) (x, xdot, t, ires); @@ -215,9 +215,9 @@ DAEFunc::reset = false; - int eiq = enforce_inequality_constraints (); - int ccic = compute_consistent_initial_condition (); - int eavfet = exclude_algebraic_variables_from_error_test (); + octave_idx_type eiq = enforce_inequality_constraints (); + octave_idx_type ccic = compute_consistent_initial_condition (); + octave_idx_type eavfet = exclude_algebraic_variables_from_error_test (); liw = 40 + n; if (eiq == 1 || eiq == 3) @@ -240,8 +240,8 @@ abs_tol = absolute_tolerance (); rel_tol = relative_tolerance (); - int abs_tol_len = abs_tol.length (); - int rel_tol_len = rel_tol.length (); + octave_idx_type abs_tol_len = abs_tol.length (); + octave_idx_type rel_tol_len = rel_tol.length (); if (abs_tol_len == 1 && rel_tol_len == 1) { @@ -281,7 +281,7 @@ else info(7) = 0; - int maxord = maximum_order (); + octave_idx_type maxord = maximum_order (); if (maxord >= 0) { if (maxord > 0 && maxord < 6) @@ -303,13 +303,13 @@ case 1: case 3: { - Array ict = inequality_constraint_types (); + Array ict = inequality_constraint_types (); if (ict.length () == n) { - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { - int val = ict(i); + octave_idx_type val = ict(i); if (val < -2 || val > 2) { (*current_liboctave_error_handler) @@ -348,11 +348,11 @@ { // XXX FIXME XXX -- this code is duplicated below. - Array av = algebraic_variables (); + Array av = algebraic_variables (); if (av.length () == n) { - int lid; + octave_idx_type lid; if (eiq == 0 || eiq == 2) lid = 40; else if (eiq == 1 || eiq == 3) @@ -360,7 +360,7 @@ else abort (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) iwork(lid+i) = av(i) ? -1 : 1; } else @@ -388,11 +388,11 @@ // XXX FIXME XXX -- this code is duplicated above. - Array av = algebraic_variables (); + Array av = algebraic_variables (); if (av.length () == n) { - int lid; + octave_idx_type lid; if (eiq == 0 || eiq == 2) lid = 40; else if (eiq == 1 || eiq == 3) @@ -400,7 +400,7 @@ else abort (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) iwork(lid+i) = av(i) ? -1 : 1; } } @@ -411,10 +411,10 @@ if (ich.length () == 6) { - iwork(31) = NINT (ich(0)); - iwork(32) = NINT (ich(1)); - iwork(33) = NINT (ich(2)); - iwork(34) = NINT (ich(3)); + iwork(31) = NINTbig (ich(0)); + iwork(32) = NINTbig (ich(1)); + iwork(33) = NINTbig (ich(2)); + iwork(34) = NINTbig (ich(3)); rwork(13) = ich(4); rwork(14) = ich(5); @@ -430,7 +430,7 @@ info(16) = 1; } - int pici = print_initial_condition_info (); + octave_idx_type pici = print_initial_condition_info (); switch (pici) { case 0: @@ -453,7 +453,7 @@ } static double *dummy = 0; - static int *idummy = 0; + static octave_idx_type *idummy = 0; F77_XFCN (ddaspk, DDASPK, (ddaspk_f, nn, t, px, pxdot, tout, pinfo, prel_tol, pabs_tol, istate, prwork, lrw, @@ -538,28 +538,28 @@ { Matrix retval; - int n_out = tout.capacity (); - int n = size (); + octave_idx_type n_out = tout.capacity (); + octave_idx_type n = size (); if (n_out > 0 && n > 0) { retval.resize (n_out, n); xdot_out.resize (n_out, n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { retval.elem (0, i) = x.elem (i); xdot_out.elem (0, i) = xdot.elem (i); } - for (int j = 1; j < n_out; j++) + for (octave_idx_type j = 1; j < n_out; j++) { ColumnVector x_next = do_integrate (tout.elem (j)); if (integration_error) return retval; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { retval.elem (j, i) = x_next.elem (i); xdot_out.elem (j, i) = xdot.elem (i); @@ -583,26 +583,26 @@ { Matrix retval; - int n_out = tout.capacity (); - int n = size (); + octave_idx_type n_out = tout.capacity (); + octave_idx_type n = size (); if (n_out > 0 && n > 0) { retval.resize (n_out, n); xdot_out.resize (n_out, n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { retval.elem (0, i) = x.elem (i); xdot_out.elem (0, i) = xdot.elem (i); } - int n_crit = tcrit.capacity (); + octave_idx_type n_crit = tcrit.capacity (); if (n_crit > 0) { - int i_crit = 0; - int i_out = 1; + octave_idx_type i_crit = 0; + octave_idx_type i_out = 1; double next_crit = tcrit.elem (0); double next_out; while (i_out < n_out) @@ -658,7 +658,7 @@ if (save_output) { - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { retval.elem (i_out-1, i) = x_next.elem (i); xdot_out.elem (i_out-1, i) = xdot.elem (i); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DASPK.h --- a/liboctave/DASPK.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DASPK.h Fri Apr 08 16:07:37 2005 +0000 @@ -61,11 +61,11 @@ bool initialized; - int liw; - int lrw; + octave_idx_type liw; + octave_idx_type lrw; - Array info; - Array iwork; + Array info; + Array iwork; Array rwork; @@ -76,8 +76,8 @@ double *pxdot; double *pabs_tol; double *prel_tol; - int *pinfo; - int *piwork; + octave_idx_type *pinfo; + octave_idx_type *piwork; double *prwork; }; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DASRT-opts.in --- a/liboctave/DASRT-opts.in Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DASRT-opts.in Fri Apr 08 16:07:37 2005 +0000 @@ -78,7 +78,7 @@ Restrict the maximum order of the solution method. This option must be between 1 and 5, inclusive. END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "-1" SET_EXPR = "val" END_OPTION @@ -100,7 +100,7 @@ Maximum number of integration steps to attempt on a single call to the underlying Fortran code. END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "-1" SET_EXPR = "(val >= 0) ? val : -1" END_OPTION diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DASRT.cc --- a/liboctave/DASRT.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DASRT.cc Fri Apr 08 16:07:37 2005 +0000 @@ -33,42 +33,42 @@ #include "lo-sstream.h" #include "quit.h" -typedef int (*dasrt_fcn_ptr) (const double&, const double*, const double*, - double*, int&, double*, int*); +typedef octave_idx_type (*dasrt_fcn_ptr) (const double&, const double*, const double*, + double*, octave_idx_type&, double*, octave_idx_type*); -typedef int (*dasrt_jac_ptr) (const double&, const double*, const double*, - double*, const double&, double*, int*); +typedef octave_idx_type (*dasrt_jac_ptr) (const double&, const double*, const double*, + double*, const double&, double*, octave_idx_type*); -typedef int (*dasrt_constr_ptr) (const int&, const double&, const double*, - const int&, double*, double*, int*); +typedef octave_idx_type (*dasrt_constr_ptr) (const octave_idx_type&, const double&, const double*, + const octave_idx_type&, double*, double*, octave_idx_type*); extern "C" { F77_RET_T - F77_FUNC (ddasrt, DDASRT) (dasrt_fcn_ptr, const int&, double&, - double*, double*, const double&, int*, - const double*, const double*, int&, double*, - const int&, int*, const int&, double*, - int*, dasrt_jac_ptr, dasrt_constr_ptr, - const int&, int*); + F77_FUNC (ddasrt, DDASRT) (dasrt_fcn_ptr, const octave_idx_type&, double&, + double*, double*, const double&, octave_idx_type*, + const double*, const double*, octave_idx_type&, double*, + const octave_idx_type&, octave_idx_type*, const octave_idx_type&, double*, + octave_idx_type*, dasrt_jac_ptr, dasrt_constr_ptr, + const octave_idx_type&, octave_idx_type*); } static DAEFunc::DAERHSFunc user_fsub; static DAEFunc::DAEJacFunc user_jsub; static DAERTFunc::DAERTConstrFunc user_csub; -static int nn; +static octave_idx_type nn; -static int +static octave_idx_type ddasrt_f (const double& t, const double *state, const double *deriv, - double *delta, int& ires, double *, int *) + double *delta, octave_idx_type& ires, double *, octave_idx_type *) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; ColumnVector tmp_state (nn); ColumnVector tmp_deriv (nn); - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) { tmp_state(i) = state[i]; tmp_deriv(i) = deriv[i]; @@ -80,7 +80,7 @@ ires = -2; else { - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) delta[i] = tmp_fval(i); } @@ -89,9 +89,9 @@ return 0; } -int +octave_idx_type ddasrt_j (const double& time, const double *state, const double *deriv, - double *pd, const double& cj, double *, int *) + double *pd, const double& cj, double *, octave_idx_type *) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -100,7 +100,7 @@ ColumnVector tmp_state (nn); ColumnVector tmp_deriv (nn); - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) { tmp_deriv.elem (i) = deriv [i]; tmp_state.elem (i) = state [i]; @@ -108,8 +108,8 @@ Matrix tmp_pd = (*user_jsub) (tmp_state, tmp_deriv, time, cj); - for (int j = 0; j < nn; j++) - for (int i = 0; i < nn; i++) + for (octave_idx_type j = 0; j < nn; j++) + for (octave_idx_type i = 0; i < nn; i++) pd [nn * j + i] = tmp_pd.elem (i, j); END_INTERRUPT_WITH_EXCEPTIONS; @@ -117,21 +117,21 @@ return 0; } -static int -ddasrt_g (const int& neq, const double& t, const double *state, - const int& ng, double *gout, double *, int *) +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 *) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; - int n = neq; + octave_idx_type n = neq; ColumnVector tmp_state (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) tmp_state(i) = state[i]; ColumnVector tmp_fval = (*user_csub) (tmp_state, t); - for (int i = 0; i < ng; i++) + for (octave_idx_type i = 0; i < ng; i++) gout[i] = tmp_fval(i); END_INTERRUPT_WITH_EXCEPTIONS; @@ -157,12 +157,12 @@ info.resize (15); - for (int i = 0; i < 15; i++) + for (octave_idx_type i = 0; i < 15; i++) info(i) = 0; pinfo = info.fortran_vec (); - int n = size (); + octave_idx_type n = size (); nn = n; @@ -178,7 +178,7 @@ else ng = 0; - int maxord = maximum_order (); + octave_idx_type maxord = maximum_order (); if (maxord >= 0) { if (maxord > 0 && maxord < 6) @@ -226,7 +226,7 @@ if (user_fsub) { - int ires = 0; + octave_idx_type ires = 0; ColumnVector fval = (*user_fsub) (x, xdot, t, ires); @@ -289,8 +289,8 @@ abs_tol = absolute_tolerance (); rel_tol = relative_tolerance (); - int abs_tol_len = abs_tol.length (); - int rel_tol_len = rel_tol.length (); + octave_idx_type abs_tol_len = abs_tol.length (); + octave_idx_type rel_tol_len = rel_tol.length (); if (abs_tol_len == 1 && rel_tol_len == 1) { @@ -316,7 +316,7 @@ } static double *dummy = 0; - static int *idummy = 0; + static octave_idx_type *idummy = 0; F77_XFCN (ddasrt, DDASRT, (ddasrt_f, nn, t, px, pxdot, tout, pinfo, prel_tol, pabs_tol, istate, prwork, lrw, @@ -390,21 +390,21 @@ Matrix xdot_out; ColumnVector t_out = tout; - int n_out = tout.capacity (); - int n = size (); + octave_idx_type n_out = tout.capacity (); + octave_idx_type n = size (); if (n_out > 0 && n > 0) { x_out.resize (n_out, n); xdot_out.resize (n_out, n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { x_out(0,i) = x(i); xdot_out(0,i) = xdot(i); } - for (int j = 1; j < n_out; j++) + for (octave_idx_type j = 1; j < n_out; j++) { integrate (tout(j)); @@ -419,7 +419,7 @@ else t_out(j) = tout(j); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { x_out(j,i) = x(i); xdot_out(j,i) = xdot(i); @@ -449,20 +449,20 @@ Matrix xdot_out; ColumnVector t_outs = tout; - int n_out = tout.capacity (); - int n = size (); + octave_idx_type n_out = tout.capacity (); + octave_idx_type n = size (); if (n_out > 0 && n > 0) { x_out.resize (n_out, n); xdot_out.resize (n_out, n); - int n_crit = tcrit.capacity (); + octave_idx_type n_crit = tcrit.capacity (); if (n_crit > 0) { - int i_crit = 0; - int i_out = 1; + octave_idx_type i_crit = 0; + octave_idx_type i_out = 1; double next_crit = tcrit(0); double next_out; while (i_out < n_out) @@ -473,7 +473,7 @@ if (i_crit < n_crit) next_crit = tcrit(i_crit); - int save_output; + octave_idx_type save_output; double t_out; if (next_crit == next_out) @@ -524,7 +524,7 @@ if (save_output) { - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { x_out(i_out-1,i) = x(i); xdot_out(i_out-1,i) = xdot(i); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DASRT.h --- a/liboctave/DASRT.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DASRT.h Fri Apr 08 16:07:37 2005 +0000 @@ -92,14 +92,14 @@ bool initialized; - int liw; - int lrw; + octave_idx_type liw; + octave_idx_type lrw; - int ng; + octave_idx_type ng; - Array info; - Array iwork; - Array jroot; + Array info; + Array iwork; + Array jroot; Array rwork; @@ -110,10 +110,10 @@ double *pxdot; double *pabs_tol; double *prel_tol; - int *pinfo; - int *piwork; + octave_idx_type *pinfo; + octave_idx_type *piwork; double *prwork; - int *pjroot; + octave_idx_type *pjroot; void integrate (double t); }; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DASSL-opts.in --- a/liboctave/DASSL-opts.in Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DASSL-opts.in Fri Apr 08 16:07:37 2005 +0000 @@ -68,7 +68,7 @@ conditions. This is generally not reliable, so it is best to provide a consistent set and leave this option set to zero. END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "0" SET_EXPR = "val" END_OPTION @@ -82,7 +82,7 @@ zero first, and only setting it to a nonzero value if that doesn't work very well. END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "0" SET_EXPR = "val" END_OPTION @@ -106,7 +106,7 @@ Restrict the maximum order of the solution method. This option must be between 1 and 5, inclusive. END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "-1" SET_EXPR = "val" END_OPTION @@ -128,7 +128,7 @@ Maximum number of integration steps to attempt on a single call to the underlying Fortran code. END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "-1" SET_EXPR = "(val >= 0) ? val : -1" END_OPTION diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DASSL.cc --- a/liboctave/DASSL.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DASSL.cc Fri Apr 08 16:07:37 2005 +0000 @@ -33,31 +33,31 @@ #include "lo-sstream.h" #include "quit.h" -typedef int (*dassl_fcn_ptr) (const double&, const double*, const double*, - double*, int&, double*, int*); +typedef octave_idx_type (*dassl_fcn_ptr) (const double&, const double*, const double*, + double*, octave_idx_type&, double*, octave_idx_type*); -typedef int (*dassl_jac_ptr) (const double&, const double*, const double*, - double*, const double&, double*, int*); +typedef octave_idx_type (*dassl_jac_ptr) (const double&, const double*, const double*, + double*, const double&, double*, octave_idx_type*); extern "C" { F77_RET_T - F77_FUNC (ddassl, DDASSL) (dassl_fcn_ptr, const int&, double&, - double*, double*, double&, const int*, - const double*, const double*, int&, - double*, const int&, int*, const int&, - const double*, const int*, + F77_FUNC (ddassl, DDASSL) (dassl_fcn_ptr, const octave_idx_type&, double&, + double*, double*, double&, const octave_idx_type*, + const double*, const double*, octave_idx_type&, + double*, const octave_idx_type&, octave_idx_type*, const octave_idx_type&, + const double*, const octave_idx_type*, dassl_jac_ptr); } static DAEFunc::DAERHSFunc user_fun; static DAEFunc::DAEJacFunc user_jac; -static int nn; +static octave_idx_type nn; -static int +static octave_idx_type ddassl_f (const double& time, const double *state, const double *deriv, - double *delta, int& ires, double *, int *) + double *delta, octave_idx_type& ires, double *, octave_idx_type *) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -67,7 +67,7 @@ ColumnVector tmp_state (nn); ColumnVector tmp_delta (nn); - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) { tmp_deriv.elem (i) = deriv [i]; tmp_state.elem (i) = state [i]; @@ -81,7 +81,7 @@ ires = -2; else { - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) delta [i] = tmp_delta.elem (i); } } @@ -91,9 +91,9 @@ return 0; } -static int +static octave_idx_type ddassl_j (const double& time, const double *state, const double *deriv, - double *pd, const double& cj, double *, int *) + double *pd, const double& cj, double *, octave_idx_type *) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -102,7 +102,7 @@ ColumnVector tmp_state (nn); ColumnVector tmp_deriv (nn); - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) { tmp_deriv.elem (i) = deriv [i]; tmp_state.elem (i) = state [i]; @@ -110,8 +110,8 @@ Matrix tmp_pd = user_jac (tmp_state, tmp_deriv, time, cj); - for (int j = 0; j < nn; j++) - for (int i = 0; i < nn; i++) + for (octave_idx_type j = 0; j < nn; j++) + for (octave_idx_type i = 0; i < nn; i++) pd [nn * j + i] = tmp_pd.elem (i, j); END_INTERRUPT_WITH_EXCEPTIONS; @@ -132,12 +132,12 @@ info.resize (15); - for (int i = 0; i < 15; i++) + for (octave_idx_type i = 0; i < 15; i++) info(i) = 0; pinfo = info.fortran_vec (); - int n = size (); + octave_idx_type n = size (); liw = 21 + n; lrw = 40 + 9*n + n*n; @@ -172,7 +172,7 @@ if (user_fun) { - int ires = 0; + octave_idx_type ires = 0; ColumnVector res = (*user_fun) (x, xdot, t, ires); @@ -226,7 +226,7 @@ else info(11) = 0; - int maxord = maximum_order (); + octave_idx_type maxord = maximum_order (); if (maxord >= 0) { if (maxord > 0 && maxord < 6) @@ -243,17 +243,17 @@ } } - int enc = enforce_nonnegativity_constraints (); + octave_idx_type enc = enforce_nonnegativity_constraints (); info(9) = enc ? 1 : 0; - int ccic = compute_consistent_initial_condition (); + octave_idx_type ccic = compute_consistent_initial_condition (); info(10) = ccic ? 1 : 0; abs_tol = absolute_tolerance (); rel_tol = relative_tolerance (); - int abs_tol_len = abs_tol.length (); - int rel_tol_len = rel_tol.length (); + octave_idx_type abs_tol_len = abs_tol.length (); + octave_idx_type rel_tol_len = rel_tol.length (); if (abs_tol_len == 1 && rel_tol_len == 1) { @@ -279,7 +279,7 @@ } static double *dummy = 0; - static int *idummy = 0; + static octave_idx_type *idummy = 0; F77_XFCN (ddassl, DDASSL, (ddassl_f, nn, t, px, pxdot, tout, pinfo, prel_tol, pabs_tol, istate, prwork, lrw, @@ -354,28 +354,28 @@ { Matrix retval; - int n_out = tout.capacity (); - int n = size (); + octave_idx_type n_out = tout.capacity (); + octave_idx_type n = size (); if (n_out > 0 && n > 0) { retval.resize (n_out, n); xdot_out.resize (n_out, n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { retval.elem (0, i) = x.elem (i); xdot_out.elem (0, i) = xdot.elem (i); } - for (int j = 1; j < n_out; j++) + for (octave_idx_type j = 1; j < n_out; j++) { ColumnVector x_next = do_integrate (tout.elem (j)); if (integration_error) return retval; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { retval.elem (j, i) = x_next.elem (i); xdot_out.elem (j, i) = xdot.elem (i); @@ -399,26 +399,26 @@ { Matrix retval; - int n_out = tout.capacity (); - int n = size (); + octave_idx_type n_out = tout.capacity (); + octave_idx_type n = size (); if (n_out > 0 && n > 0) { retval.resize (n_out, n); xdot_out.resize (n_out, n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { retval.elem (0, i) = x.elem (i); xdot_out.elem (0, i) = xdot.elem (i); } - int n_crit = tcrit.capacity (); + octave_idx_type n_crit = tcrit.capacity (); if (n_crit > 0) { - int i_crit = 0; - int i_out = 1; + octave_idx_type i_crit = 0; + octave_idx_type i_out = 1; double next_crit = tcrit.elem (0); double next_out; while (i_out < n_out) @@ -474,7 +474,7 @@ if (save_output) { - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { retval.elem (i_out-1, i) = x_next.elem (i); xdot_out.elem (i_out-1, i) = xdot.elem (i); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DASSL.h --- a/liboctave/DASSL.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DASSL.h Fri Apr 08 16:07:37 2005 +0000 @@ -61,11 +61,11 @@ bool initialized; - int liw; - int lrw; + octave_idx_type liw; + octave_idx_type lrw; - Array info; - Array iwork; + Array info; + Array iwork; Array rwork; @@ -76,8 +76,8 @@ double *pxdot; double *pabs_tol; double *prel_tol; - int *pinfo; - int *piwork; + octave_idx_type *pinfo; + octave_idx_type *piwork; double *prwork; }; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DiagArray2.cc --- a/liboctave/DiagArray2.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DiagArray2.cc Fri Apr 08 16:07:37 2005 +0000 @@ -37,14 +37,14 @@ template T -DiagArray2::elem (int r, int c) const +DiagArray2::elem (octave_idx_type r, octave_idx_type c) const { return (r == c) ? Array::xelem (r) : T (0); } template T -DiagArray2::checkelem (int r, int c) const +DiagArray2::checkelem (octave_idx_type r, octave_idx_type c) const { if (r < 0 || c < 0 || r >= this->dim1 () || c >= this->dim2 ()) { @@ -56,7 +56,7 @@ template T -DiagArray2::operator () (int r, int c) const +DiagArray2::operator () (octave_idx_type r, octave_idx_type c) const { if (r < 0 || c < 0 || r >= this->dim1 () || c >= this->dim2 ()) { @@ -68,7 +68,7 @@ template T& -DiagArray2::xelem (int r, int c) +DiagArray2::xelem (octave_idx_type r, octave_idx_type c) { static T foo (0); return (r == c) ? Array::xelem (r) : foo; @@ -76,14 +76,14 @@ template T -DiagArray2::xelem (int r, int c) const +DiagArray2::xelem (octave_idx_type r, octave_idx_type c) const { return (r == c) ? Array::xelem (r) : T (0); } template void -DiagArray2::resize (int r, int c) +DiagArray2::resize (octave_idx_type r, octave_idx_type c) { if (r < 0 || c < 0) { @@ -96,9 +96,9 @@ typename Array::ArrayRep *old_rep = Array::rep; const T *old_data = this->data (); - int old_len = this->length (); + octave_idx_type old_len = this->length (); - int new_len = r < c ? r : c; + octave_idx_type new_len = r < c ? r : c; Array::rep = new typename Array::ArrayRep (new_len); @@ -106,9 +106,9 @@ if (old_data && old_len > 0) { - int min_len = old_len < new_len ? old_len : new_len; + octave_idx_type min_len = old_len < new_len ? old_len : new_len; - for (int i = 0; i < min_len; i++) + for (octave_idx_type i = 0; i < min_len; i++) xelem (i, i) = old_data[i]; } @@ -118,7 +118,7 @@ template void -DiagArray2::resize (int r, int c, const T& val) +DiagArray2::resize (octave_idx_type r, octave_idx_type c, const T& val) { if (r < 0 || c < 0) { @@ -131,23 +131,23 @@ typename Array::ArrayRep *old_rep = Array::rep; const T *old_data = this->data (); - int old_len = this->length (); + octave_idx_type old_len = this->length (); - int new_len = r < c ? r : c; + octave_idx_type new_len = r < c ? r : c; Array::rep = new typename Array::ArrayRep (new_len); this->dimensions = dim_vector (r, c); - int min_len = old_len < new_len ? old_len : new_len; + octave_idx_type min_len = old_len < new_len ? old_len : new_len; if (old_data && old_len > 0) { - for (int i = 0; i < min_len; i++) + for (octave_idx_type i = 0; i < min_len; i++) xelem (i, i) = old_data[i]; } - for (int i = min_len; i < new_len; i++) + for (octave_idx_type i = min_len; i < new_len; i++) xelem (i, i) = val; if (--old_rep->count <= 0) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/DiagArray2.h --- a/liboctave/DiagArray2.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/DiagArray2.h Fri Apr 08 16:07:37 2005 +0000 @@ -51,15 +51,15 @@ { private: - T get (int i) { return Array::xelem (i); } + T get (octave_idx_type i) { return Array::xelem (i); } - void set (const T& val, int i) { Array::xelem (i) = val; } + void set (const T& val, octave_idx_type i) { Array::xelem (i) = val; } class Proxy { public: - Proxy (DiagArray2 *ref, int r, int c) + Proxy (DiagArray2 *ref, octave_idx_type r, octave_idx_type c) : i (r), j (c), object (ref) { } const Proxy& operator = (const T& val) const @@ -95,8 +95,8 @@ T *operator& () const { assert (0); return (T *) 0; } - int i; - int j; + octave_idx_type i; + octave_idx_type j; DiagArray2 *object; @@ -106,17 +106,17 @@ protected: - DiagArray2 (T *d, int r, int c) : Array (d, r < c ? r : c) + DiagArray2 (T *d, octave_idx_type r, octave_idx_type c) : Array (d, r < c ? r : c) { Array::dimensions = dim_vector (r, c); } public: DiagArray2 (void) : Array (dim_vector (0, 0)) { } - DiagArray2 (int r, int c) : Array (r < c ? r : c) + DiagArray2 (octave_idx_type r, octave_idx_type c) : Array (r < c ? r : c) { this->dimensions = dim_vector (r, c); } - DiagArray2 (int r, int c, const T& val) : Array (r < c ? r : c) + DiagArray2 (octave_idx_type r, octave_idx_type c, const T& val) : Array (r < c ? r : c) { this->dimensions = dim_vector (r, c); @@ -139,12 +139,12 @@ return *this; } - Proxy elem (int r, int c) + Proxy elem (octave_idx_type r, octave_idx_type c) { return Proxy (this, r, c); } - Proxy checkelem (int r, int c) + Proxy checkelem (octave_idx_type r, octave_idx_type c) { if (r < 0 || c < 0 || r >= this->dim1 () || c >= this->dim2 ()) { @@ -155,7 +155,7 @@ return Proxy (this, r, c); } - Proxy operator () (int r, int c) + Proxy operator () (octave_idx_type r, octave_idx_type c) { if (r < 0 || c < 0 || r >= this->dim1 () || c >= this->dim2 ()) { @@ -166,17 +166,17 @@ return Proxy (this, r, c); } - T elem (int r, int c) const; - T checkelem (int r, int c) const; - T operator () (int r, int c) const; + T elem (octave_idx_type r, octave_idx_type c) const; + T checkelem (octave_idx_type r, octave_idx_type c) const; + T operator () (octave_idx_type r, octave_idx_type c) const; // No checking. - T& xelem (int r, int c); - T xelem (int r, int c) const; + T& xelem (octave_idx_type r, octave_idx_type c); + T xelem (octave_idx_type r, octave_idx_type c) const; - void resize (int n, int m); - void resize (int n, int m, const T& val); + void resize (octave_idx_type n, octave_idx_type m); + void resize (octave_idx_type n, octave_idx_type m, const T& val); void maybe_delete_elements (idx_vector& i, idx_vector& j); }; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/EIG.cc --- a/liboctave/EIG.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/EIG.cc Fri Apr 08 16:07:37 2005 +0000 @@ -34,45 +34,45 @@ F77_RET_T F77_FUNC (dgeev, DGEEV) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, double*, const int&, double*, - double*, double*, const int&, double*, - const int&, double*, const int&, int& + const octave_idx_type&, double*, const octave_idx_type&, double*, + double*, double*, const octave_idx_type&, double*, + 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 (zgeev, ZGEEV) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, Complex*, const int&, Complex*, - Complex*, const int&, Complex*, const int&, - Complex*, const int&, double*, int& + const octave_idx_type&, Complex*, const octave_idx_type&, Complex*, + Complex*, const octave_idx_type&, Complex*, const octave_idx_type&, + Complex*, const octave_idx_type&, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (dsyev, DSYEV) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, double*, const int&, double*, - double*, const int&, int& + const octave_idx_type&, double*, const octave_idx_type&, double*, + double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (zheev, ZHEEV) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, Complex*, const int&, double*, - Complex*, const int&, double*, int& + const octave_idx_type&, Complex*, const octave_idx_type&, double*, + Complex*, const octave_idx_type&, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); } -int +octave_idx_type EIG::init (const Matrix& a, bool calc_ev) { if (a.is_symmetric ()) return symmetric_init (a, calc_ev); - int n = a.rows (); + octave_idx_type n = a.rows (); if (n != a.cols ()) { @@ -80,7 +80,7 @@ return -1; } - int info = 0; + octave_idx_type info = 0; Matrix atmp = a; double *tmp_data = atmp.fortran_vec (); @@ -91,15 +91,15 @@ Array wi (n); double *pwi = wi.fortran_vec (); - volatile int nvr = calc_ev ? n : 0; + volatile octave_idx_type nvr = calc_ev ? n : 0; Matrix vr (nvr, nvr); double *pvr = vr.fortran_vec (); - int lwork = -1; + octave_idx_type lwork = -1; double dummy_work; double *dummy = 0; - int idummy = 1; + octave_idx_type idummy = 1; F77_XFCN (dgeev, DGEEV, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -110,7 +110,7 @@ if (! f77_exception_encountered && info == 0) { - lwork = static_cast (dummy_work); + lwork = static_cast (dummy_work); Array work (lwork); double *pwork = work.fortran_vec (); @@ -136,12 +136,12 @@ lambda.resize (n); v.resize (nvr, nvr); - for (int j = 0; j < n; j++) + for (octave_idx_type j = 0; j < n; j++) { if (wi.elem (j) == 0.0) { lambda.elem (j) = Complex (wr.elem (j)); - for (int i = 0; i < nvr; i++) + for (octave_idx_type i = 0; i < nvr; i++) v.elem (i, j) = vr.elem (i, j); } else @@ -155,7 +155,7 @@ lambda.elem(j) = Complex (wr.elem(j), wi.elem(j)); lambda.elem(j+1) = Complex (wr.elem(j+1), wi.elem(j+1)); - for (int i = 0; i < nvr; i++) + for (octave_idx_type i = 0; i < nvr; i++) { double real_part = vr.elem (i, j); double imag_part = vr.elem (i, j+1); @@ -172,10 +172,10 @@ return info; } -int +octave_idx_type EIG::symmetric_init (const Matrix& a, bool calc_ev) { - int n = a.rows (); + octave_idx_type n = a.rows (); if (n != a.cols ()) { @@ -183,7 +183,7 @@ return -1; } - int info = 0; + octave_idx_type info = 0; Matrix atmp = a; double *tmp_data = atmp.fortran_vec (); @@ -191,7 +191,7 @@ ColumnVector wr (n); double *pwr = wr.fortran_vec (); - int lwork = -1; + octave_idx_type lwork = -1; double dummy_work; F77_XFCN (dsyev, DSYEV, (F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -202,7 +202,7 @@ if (! f77_exception_encountered && info == 0) { - lwork = static_cast (dummy_work); + lwork = static_cast (dummy_work); Array work (lwork); double *pwork = work.fortran_vec (); @@ -233,13 +233,13 @@ return info; } -int +octave_idx_type EIG::init (const ComplexMatrix& a, bool calc_ev) { if (a.is_hermitian ()) return hermitian_init (a, calc_ev); - int n = a.rows (); + octave_idx_type n = a.rows (); if (n != a.cols ()) { @@ -247,7 +247,7 @@ return -1; } - int info = 0; + octave_idx_type info = 0; ComplexMatrix atmp = a; Complex *tmp_data = atmp.fortran_vec (); @@ -255,19 +255,19 @@ ComplexColumnVector w (n); Complex *pw = w.fortran_vec (); - int nvr = calc_ev ? n : 0; + octave_idx_type nvr = calc_ev ? n : 0; ComplexMatrix vtmp (nvr, nvr); Complex *pv = vtmp.fortran_vec (); - int lwork = -1; + octave_idx_type lwork = -1; Complex dummy_work; - int lrwork = 2*n; + octave_idx_type lrwork = 2*n; Array rwork (lrwork); double *prwork = rwork.fortran_vec (); Complex *dummy = 0; - int idummy = 1; + octave_idx_type idummy = 1; F77_XFCN (zgeev, ZGEEV, (F77_CONST_CHAR_ARG2 ("N", 1), F77_CONST_CHAR_ARG2 (calc_ev ? "V" : "N", 1), @@ -278,7 +278,7 @@ if (! f77_exception_encountered && info == 0) { - lwork = static_cast (dummy_work.real ()); + lwork = static_cast (dummy_work.real ()); Array work (lwork); Complex *pwork = work.fortran_vec (); @@ -310,10 +310,10 @@ return info; } -int +octave_idx_type EIG::hermitian_init (const ComplexMatrix& a, bool calc_ev) { - int n = a.rows (); + octave_idx_type n = a.rows (); if (n != a.cols ()) { @@ -321,7 +321,7 @@ return -1; } - int info = 0; + octave_idx_type info = 0; ComplexMatrix atmp = a; Complex *tmp_data = atmp.fortran_vec (); @@ -329,10 +329,10 @@ ColumnVector wr (n); double *pwr = wr.fortran_vec (); - int lwork = -1; + octave_idx_type lwork = -1; Complex dummy_work; - int lrwork = 3*n; + octave_idx_type lrwork = 3*n; Array rwork (lrwork); double *prwork = rwork.fortran_vec (); @@ -345,7 +345,7 @@ if (! f77_exception_encountered && info == 0) { - lwork = static_cast (dummy_work.real ()); + lwork = static_cast (dummy_work.real ()); Array work (lwork); Complex *pwork = work.fortran_vec (); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/EIG.h --- a/liboctave/EIG.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/EIG.h Fri Apr 08 16:07:37 2005 +0000 @@ -43,13 +43,13 @@ EIG (const Matrix& a, bool calc_eigenvectors = true) { init (a, calc_eigenvectors); } - EIG (const Matrix& a, int& info, bool calc_eigenvectors = true) + EIG (const Matrix& a, octave_idx_type& info, bool calc_eigenvectors = true) { info = init (a, calc_eigenvectors); } EIG (const ComplexMatrix& a, bool calc_eigenvectors = true) { init (a, calc_eigenvectors); } - EIG (const ComplexMatrix& a, int& info, bool calc_eigenvectors = true) + EIG (const ComplexMatrix& a, octave_idx_type& info, bool calc_eigenvectors = true) { info = init (a, calc_eigenvectors); } EIG (const EIG& a) @@ -78,11 +78,11 @@ ComplexColumnVector lambda; ComplexMatrix v; - int init (const Matrix& a, bool calc_eigenvectors); - int init (const ComplexMatrix& a, bool calc_eigenvectors); + octave_idx_type init (const Matrix& a, bool calc_eigenvectors); + octave_idx_type init (const ComplexMatrix& a, bool calc_eigenvectors); - int symmetric_init (const Matrix& a, bool calc_eigenvectors); - int hermitian_init (const ComplexMatrix& a, bool calc_eigenvectors); + octave_idx_type symmetric_init (const Matrix& a, bool calc_eigenvectors); + octave_idx_type hermitian_init (const ComplexMatrix& a, bool calc_eigenvectors); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/FEGrid.cc --- a/liboctave/FEGrid.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/FEGrid.cc Fri Apr 08 16:07:37 2005 +0000 @@ -45,7 +45,7 @@ // Constructors -FEGrid::FEGrid (int nel, double width) +FEGrid::FEGrid (octave_idx_type nel, double width) { if (nel < 1) { @@ -55,11 +55,11 @@ elem.resize (nel+1); - for (int i = 0; i <= nel; i++) + for (octave_idx_type i = 0; i <= nel; i++) elem.elem (i) = i * width; } -FEGrid::FEGrid (int nel, double l, double r) +FEGrid::FEGrid (octave_idx_type nel, double l, double r) { if (nel < 1) { @@ -71,13 +71,13 @@ double width = (r - l) / nel; - for (int i = 0; i <= nel; i++) + for (octave_idx_type i = 0; i <= nel; i++) elem.elem (i) = i * width + l; check_grid (); } -int +octave_idx_type FEGrid::element (double x) const { if (! in_bounds (x)) @@ -86,8 +86,8 @@ return -1; } - int nel = elem.capacity () - 1; - for (int i = 1; i <= nel; i++) + octave_idx_type nel = elem.capacity () - 1; + for (octave_idx_type i = 1; i <= nel; i++) { if (x >= elem.elem (i-1) && x <= elem.elem (i)) return i; @@ -99,14 +99,14 @@ void FEGrid::check_grid (void) const { - int nel = elem.capacity () - 1; + octave_idx_type nel = elem.capacity () - 1; if (nel < 1) { nel_error (); return; } - for (int i = 1; i <= nel; i++) + for (octave_idx_type i = 1; i <= nel; i++) { if (elem.elem (i-1) > elem.elem (i)) { diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/FEGrid.h --- a/liboctave/FEGrid.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/FEGrid.h Fri Apr 08 16:07:37 2005 +0000 @@ -38,9 +38,9 @@ FEGrid (const ColumnVector& elbnds) : elem (elbnds) { check_grid (); } - FEGrid (int nel, double width); + FEGrid (octave_idx_type nel, double width); - FEGrid (int nel, double left, double right); + FEGrid (octave_idx_type nel, double left, double right); FEGrid (const FEGrid& a) : elem (a.elem) { } @@ -55,7 +55,7 @@ ~FEGrid (void) { } - int element (double x) const; + octave_idx_type element (double x) const; double left (void) const { return elem.elem (0); } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/LPsolve.cc --- a/liboctave/LPsolve.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/LPsolve.cc Fri Apr 08 16:07:37 2005 +0000 @@ -29,7 +29,7 @@ #include "lo-error.h" ColumnVector -LPsolve::do_minimize (double&, int&, ColumnVector&) +LPsolve::do_minimize (double&, octave_idx_type&, ColumnVector&) { (*current_liboctave_error_handler) ("sorry, not implemented"); return ColumnVector (); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/LPsolve.h --- a/liboctave/LPsolve.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/LPsolve.h Fri Apr 08 16:07:37 2005 +0000 @@ -60,7 +60,7 @@ ~LPsolve (void) { } - ColumnVector do_minimize (double& objf, int& inform, ColumnVector& lambda); + ColumnVector do_minimize (double& objf, octave_idx_type& inform, ColumnVector& lambda); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/LSODE-opts.in --- a/liboctave/LSODE-opts.in Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/LSODE-opts.in Fri Apr 08 16:07:37 2005 +0000 @@ -93,7 +93,7 @@ method, this option must be between 1 and 12. Otherwise, it must be between 1 and 5, inclusive. END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "-1" SET_EXPR = "val" END_OPTION @@ -124,7 +124,7 @@ DOC_ITEM Maximum number of steps allowed (default is 100000). END_DOC_ITEM - TYPE = "int" + TYPE = "octave_idx_type" INIT_VALUE = "100000" SET_EXPR = "val" END_OPTION diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/LSODE.cc --- a/liboctave/LSODE.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/LSODE.cc Fri Apr 08 16:07:37 2005 +0000 @@ -33,29 +33,29 @@ #include "lo-sstream.h" #include "quit.h" -typedef int (*lsode_fcn_ptr) (const int&, const double&, double*, - double*, int&); +typedef octave_idx_type (*lsode_fcn_ptr) (const octave_idx_type&, const double&, double*, + double*, octave_idx_type&); -typedef int (*lsode_jac_ptr) (const int&, const double&, double*, - const int&, const int&, double*, const - int&); +typedef octave_idx_type (*lsode_jac_ptr) (const octave_idx_type&, const double&, double*, + const octave_idx_type&, const octave_idx_type&, double*, const + octave_idx_type&); extern "C" { F77_RET_T - F77_FUNC (dlsode, DLSODE) (lsode_fcn_ptr, int&, double*, double&, - double&, int&, double&, const double*, int&, - int&, int&, double*, int&, int*, int&, - lsode_jac_ptr, int&); + F77_FUNC (dlsode, DLSODE) (lsode_fcn_ptr, octave_idx_type&, double*, double&, + double&, octave_idx_type&, double&, const double*, octave_idx_type&, + octave_idx_type&, octave_idx_type&, double*, octave_idx_type&, octave_idx_type*, octave_idx_type&, + lsode_jac_ptr, octave_idx_type&); } static ODEFunc::ODERHSFunc user_fun; static ODEFunc::ODEJacFunc user_jac; static ColumnVector *tmp_x; -static int -lsode_f (const int& neq, const double& time, double *, - double *deriv, int& ierr) +static octave_idx_type +lsode_f (const octave_idx_type& neq, const double& time, double *, + double *deriv, octave_idx_type& ierr) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -71,7 +71,7 @@ ierr = -1; else { - for (int i = 0; i < neq; i++) + for (octave_idx_type i = 0; i < neq; i++) deriv [i] = tmp_deriv.elem (i); } @@ -80,9 +80,9 @@ return 0; } -static int -lsode_j (const int& neq, const double& time, double *, - const int&, const int&, double *pd, const int& nrowpd) +static octave_idx_type +lsode_j (const octave_idx_type& neq, const double& time, double *, + const octave_idx_type&, const octave_idx_type&, double *pd, const octave_idx_type& nrowpd) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -94,8 +94,8 @@ tmp_jac = (*user_jac) (*tmp_x, time); - for (int j = 0; j < neq; j++) - for (int i = 0; i < neq; i++) + for (octave_idx_type j = 0; j < neq; j++) + for (octave_idx_type i = 0; i < neq; i++) pd [nrowpd * j + i] = tmp_jac (i, j); END_INTERRUPT_WITH_EXCEPTIONS; @@ -108,7 +108,7 @@ { ColumnVector retval; - static int nn = 0; + static octave_idx_type nn = 0; if (! initialized || restart || ODEFunc::reset || LSODE_options::reset) { @@ -118,11 +118,11 @@ istate = 1; - int n = size (); + octave_idx_type n = size (); nn = n; - int max_maxord = 0; + octave_idx_type max_maxord = 0; if (integration_method () == "stiff") { @@ -166,12 +166,12 @@ iwork.resize (liw); - for (int i = 4; i < 9; i++) + for (octave_idx_type i = 4; i < 9; i++) iwork(i) = 0; rwork.resize (lrw); - for (int i = 4; i < 9; i++) + for (octave_idx_type i = 4; i < 9; i++) rwork(i) = 0; if (stop_time_set) @@ -221,7 +221,7 @@ rel_tol = relative_tolerance (); abs_tol = absolute_tolerance (); - int abs_tol_len = abs_tol.length (); + octave_idx_type abs_tol_len = abs_tol.length (); if (abs_tol_len == 1) itol = 1; @@ -257,7 +257,7 @@ iopt = 1; } - int sl = step_limit (); + octave_idx_type sl = step_limit (); if (sl > 0) { iwork(5) = sl; @@ -384,24 +384,24 @@ { Matrix retval; - int n_out = tout.capacity (); - int n = size (); + octave_idx_type n_out = tout.capacity (); + octave_idx_type n = size (); if (n_out > 0 && n > 0) { retval.resize (n_out, n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) retval.elem (0, i) = x.elem (i); - for (int j = 1; j < n_out; j++) + for (octave_idx_type j = 1; j < n_out; j++) { ColumnVector x_next = do_integrate (tout.elem (j)); if (integration_error) return retval; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) retval.elem (j, i) = x_next.elem (i); } } @@ -414,22 +414,22 @@ { Matrix retval; - int n_out = tout.capacity (); - int n = size (); + octave_idx_type n_out = tout.capacity (); + octave_idx_type n = size (); if (n_out > 0 && n > 0) { retval.resize (n_out, n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) retval.elem (0, i) = x.elem (i); - int n_crit = tcrit.capacity (); + octave_idx_type n_crit = tcrit.capacity (); if (n_crit > 0) { - int i_crit = 0; - int i_out = 1; + octave_idx_type i_crit = 0; + octave_idx_type i_out = 1; double next_crit = tcrit.elem (0); double next_out; while (i_out < n_out) @@ -440,7 +440,7 @@ if (i_crit < n_crit) next_crit = tcrit.elem (i_crit); - int save_output; + octave_idx_type save_output; double t_out; if (next_crit == next_out) @@ -485,7 +485,7 @@ if (save_output) { - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) retval.elem (i_out-1, i) = x_next.elem (i); } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/LSODE.h --- a/liboctave/LSODE.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/LSODE.h Fri Apr 08 16:07:37 2005 +0000 @@ -52,16 +52,16 @@ bool initialized; - int method_flag; - int maxord; - int itask; - int iopt; - int itol; + octave_idx_type method_flag; + octave_idx_type maxord; + octave_idx_type itask; + octave_idx_type iopt; + octave_idx_type itol; - int liw; - int lrw; + octave_idx_type liw; + octave_idx_type lrw; - Array iwork; + Array iwork; Array rwork; double rel_tol; @@ -70,7 +70,7 @@ double *px; double *pabs_tol; - int *piwork; + octave_idx_type *piwork; double *prwork; }; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/LinConst.cc --- a/liboctave/LinConst.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/LinConst.cc Fri Apr 08 16:07:37 2005 +0000 @@ -40,7 +40,7 @@ std::ostream& operator << (std::ostream& os, const LinConst& c) { - for (int i = 0; i < c.size (); i++) + for (octave_idx_type i = 0; i < c.size (); i++) os << c.lower_bound (i) << " " << c.upper_bound (i) << "\n"; os << "\n"; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/MArray-defs.h --- a/liboctave/MArray-defs.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/MArray-defs.h Fri Apr 08 16:07:37 2005 +0000 @@ -6,37 +6,37 @@ #define DO_VS_OP(r, l, v, OP, s) \ if (l > 0) \ { \ - for (int i = 0; i < l; i++) \ + for (octave_idx_type i = 0; i < l; i++) \ r[i] = v[i] OP s; \ } #define DO_SV_OP(r, l, s, OP, v) \ if (l > 0) \ { \ - for (int i = 0; i < l; i++) \ + for (octave_idx_type i = 0; i < l; i++) \ r[i] = s OP v[i]; \ } #define DO_VV_OP(r, l, x, OP, y) \ if (l > 0) \ { \ - for (int i = 0; i < l; i++) \ + for (octave_idx_type i = 0; i < l; i++) \ r[i] = x[i] OP y[i]; \ } #define NEG_V(r, l, x) \ if (l > 0) \ { \ - for (int i = 0; i < l; i++) \ + for (octave_idx_type i = 0; i < l; i++) \ r[i] = -x[i]; \ } #define DO_VS_OP2(T, a, OP, s) \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ if (l > 0) \ { \ T *tmp = a.fortran_vec (); \ - for (int i = 0; i < l; i++) \ + for (octave_idx_type i = 0; i < l; i++) \ tmp[i] OP s; \ } @@ -45,7 +45,7 @@ { \ T *a_tmp = a.fortran_vec (); \ const T *b_tmp = b.data (); \ - for (int i = 0; i < l; i++) \ + for (octave_idx_type i = 0; i < l; i++) \ a_tmp[i] OP b_tmp[i]; \ } \ while (0) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/MArray-i.cc --- a/liboctave/MArray-i.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/MArray-i.cc Fri Apr 08 16:07:37 2005 +0000 @@ -32,8 +32,10 @@ #include "MArray.cc" template class MArray; +template class MArray; INSTANTIATE_MARRAY_FRIENDS (int) +INSTANTIATE_MARRAY_FRIENDS (long) template class MArray; template class MArray; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/MArray.cc --- a/liboctave/MArray.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/MArray.cc Fri Apr 08 16:07:37 2005 +0000 @@ -56,10 +56,10 @@ MArray& operator += (MArray& a, const MArray& b) { - int l = a.length (); + octave_idx_type l = a.length (); if (l > 0) { - int bl = b.length (); + octave_idx_type bl = b.length (); if (l != bl) gripe_nonconformant ("operator +=", l, bl); else @@ -72,10 +72,10 @@ MArray& operator -= (MArray& a, const MArray& b) { - int l = a.length (); + octave_idx_type l = a.length (); if (l > 0) { - int bl = b.length (); + octave_idx_type bl = b.length (); if (l != bl) gripe_nonconformant ("operator -=", l, bl); else @@ -93,7 +93,7 @@ { \ MArray result (a.length ()); \ T *r = result.fortran_vec (); \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ const T *v = a.data (); \ DO_VS_OP (r, l, v, OP, s); \ return result; \ @@ -113,7 +113,7 @@ { \ MArray result (a.length ()); \ T *r = result.fortran_vec (); \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ const T *v = a.data (); \ DO_SV_OP (r, l, s, OP, v); \ return result; \ @@ -131,8 +131,8 @@ MArray \ FCN (const MArray& a, const MArray& b) \ { \ - int l = a.length (); \ - int bl = b.length (); \ + octave_idx_type l = a.length (); \ + octave_idx_type bl = b.length (); \ if (l != bl) \ { \ gripe_nonconformant (#FCN, l, bl); \ @@ -166,7 +166,7 @@ MArray operator - (const MArray& a) { - int l = a.length (); + octave_idx_type l = a.length (); MArray result (l); T *r = result.fortran_vec (); const T *x = a.data (); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/MArray.h --- a/liboctave/MArray.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/MArray.h Fri Apr 08 16:07:37 2005 +0000 @@ -40,15 +40,15 @@ { protected: - MArray (T *d, int l) : Array (d, l) { } + MArray (T *d, octave_idx_type l) : Array (d, l) { } public: MArray (void) : Array () { } - explicit MArray (int n) : Array (n) { } + explicit MArray (octave_idx_type n) : Array (n) { } - MArray (int n, const T& val) : Array (n, val) { } + MArray (octave_idx_type n, const T& val) : Array (n, val) { } MArray (const MArray& a) : Array (a) { } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/MArray2.cc --- a/liboctave/MArray2.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/MArray2.cc Fri Apr 08 16:07:37 2005 +0000 @@ -56,17 +56,17 @@ MArray2& operator += (MArray2& a, const MArray2& b) { - int r = a.rows (); - int c = a.cols (); - int br = b.rows (); - int bc = b.cols (); + octave_idx_type r = a.rows (); + octave_idx_type c = a.cols (); + octave_idx_type br = b.rows (); + octave_idx_type bc = b.cols (); if (r != br || c != bc) gripe_nonconformant ("operator +=", r, c, br, bc); else { if (r > 0 && c > 0) { - int l = a.length (); + octave_idx_type l = a.length (); DO_VV_OP2 (T, a, +=, b); } } @@ -77,17 +77,17 @@ MArray2& operator -= (MArray2& a, const MArray2& b) { - int r = a.rows (); - int c = a.cols (); - int br = b.rows (); - int bc = b.cols (); + octave_idx_type r = a.rows (); + octave_idx_type c = a.cols (); + octave_idx_type br = b.rows (); + octave_idx_type bc = b.cols (); if (r != br || c != bc) gripe_nonconformant ("operator -=", r, c, br, bc); else { if (r > 0 && c > 0) { - int l = a.length (); + octave_idx_type l = a.length (); DO_VV_OP2 (T, a, -=, b); } } @@ -103,7 +103,7 @@ { \ MArray2 result (a.rows (), a.cols ()); \ T *r = result.fortran_vec (); \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ const T *v = a.data (); \ DO_VS_OP (r, l, v, OP, s); \ return result; \ @@ -123,7 +123,7 @@ { \ MArray2 result (a.rows (), a.cols ()); \ T *r = result.fortran_vec (); \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ const T *v = a.data (); \ DO_SV_OP (r, l, s, OP, v); \ return result; \ @@ -141,10 +141,10 @@ MArray2 \ FCN (const MArray2& a, const MArray2& b) \ { \ - int a_nr = a.rows (); \ - int a_nc = a.cols (); \ - int b_nr = b.rows (); \ - int b_nc = b.cols (); \ + octave_idx_type a_nr = a.rows (); \ + octave_idx_type a_nc = a.cols (); \ + octave_idx_type b_nr = b.rows (); \ + octave_idx_type b_nc = b.cols (); \ if (a_nr != b_nr || a_nc != b_nc) \ { \ gripe_nonconformant (#FCN, a_nr, a_nc, b_nr, b_nc); \ @@ -152,7 +152,7 @@ } \ if (a_nr == 0 || a_nc == 0) \ return MArray2 (a_nr, a_nc); \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ MArray2 result (a_nr, a_nc); \ T *r = result.fortran_vec (); \ const T *x = a.data (); \ @@ -179,7 +179,7 @@ MArray2 operator - (const MArray2& a) { - int l = a.length (); + octave_idx_type l = a.length (); MArray2 result (a.rows (), a.cols ()); T *r = result.fortran_vec (); const T *x = a.data (); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/MArray2.h --- a/liboctave/MArray2.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/MArray2.h Fri Apr 08 16:07:37 2005 +0000 @@ -40,15 +40,15 @@ { protected: - MArray2 (T *d, int n, int m) : Array2 (d, n, m) { } + MArray2 (T *d, octave_idx_type n, octave_idx_type m) : Array2 (d, n, m) { } public: MArray2 (void) : Array2 () { } - MArray2 (int n, int m) : Array2 (n, m) { } + MArray2 (octave_idx_type n, octave_idx_type m) : Array2 (n, m) { } - MArray2 (int n, int m, const T& val) : Array2 (n, m, val) { } + MArray2 (octave_idx_type n, octave_idx_type m, const T& val) : Array2 (n, m, val) { } MArray2 (const MArray2& a) : Array2 (a) { } @@ -62,7 +62,7 @@ return *this; } - MArray2& insert (const Array2& a, int r, int c) + MArray2& insert (const Array2& a, octave_idx_type r, octave_idx_type c) { Array2::insert (a, r, c); return *this; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/MArrayN.cc --- a/liboctave/MArrayN.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/MArrayN.cc Fri Apr 08 16:07:37 2005 +0000 @@ -57,7 +57,7 @@ MArrayN& operator += (MArrayN& a, const MArrayN& b) { - int l = a.length (); + octave_idx_type l = a.length (); if (l > 0) { @@ -77,7 +77,7 @@ MArrayN& operator -= (MArrayN& a, const MArrayN& b) { - int l = a.length (); + octave_idx_type l = a.length (); if (l > 0) { @@ -101,7 +101,7 @@ { \ MArrayN result (a.dims ()); \ T *r = result.fortran_vec (); \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ const T *v = a.data (); \ DO_VS_OP (r, l, v, OP, s); \ return result; \ @@ -121,7 +121,7 @@ { \ MArrayN result (a.dims ()); \ T *r = result.fortran_vec (); \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ const T *v = a.data (); \ DO_SV_OP (r, l, s, OP, v); \ return result; \ @@ -160,7 +160,7 @@ } \ if (any_dims_zero) \ return MArrayN (a_dims); \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ MArrayN result (a_dims); \ T* r = result.fortran_vec (); \ const T *x = a.data (); \ @@ -185,7 +185,7 @@ MArrayN operator - (const MArrayN& a) { - int l = a.length (); + octave_idx_type l = a.length (); MArrayN result (a.dims ()); T *r = result.fortran_vec (); const T *x = a.data (); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/MDiagArray2.cc --- a/liboctave/MDiagArray2.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/MDiagArray2.cc Fri Apr 08 16:07:37 2005 +0000 @@ -41,11 +41,11 @@ MDiagArray2& operator += (MDiagArray2& a, const MDiagArray2& b) { - int r = a.rows (); - int c = a.cols (); + octave_idx_type r = a.rows (); + octave_idx_type c = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (r != b_nr || c != b_nc) { @@ -54,7 +54,7 @@ } else { - int l = a.length (); + octave_idx_type l = a.length (); DO_VV_OP2 (T, a, +=, b); } return a; @@ -64,11 +64,11 @@ MDiagArray2& operator -= (MDiagArray2& a, const MDiagArray2& b) { - int r = a.rows (); - int c = a.cols (); + octave_idx_type r = a.rows (); + octave_idx_type c = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (r != b_nr || c != b_nc) { @@ -77,7 +77,7 @@ } else { - int l = a.length (); + octave_idx_type l = a.length (); DO_VV_OP2 (T, a, -=, b); } return a; @@ -92,7 +92,7 @@ { \ MDiagArray2 result (a.rows (), a.cols ()); \ T *r = result.fortran_vec (); \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ const T *v = a.data (); \ DO_VS_OP (r, l, v, OP, s); \ return result; \ @@ -109,7 +109,7 @@ { MDiagArray2 result (a.rows (), a.cols ()); \ T *r = result.fortran_vec (); \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ const T *v = a.data (); \ DO_SV_OP (r, l, s, *, v); \ return result; \ @@ -122,10 +122,10 @@ MDiagArray2 \ FCN (const MDiagArray2& a, const MDiagArray2& b) \ { \ - int a_nr = a.rows (); \ - int a_nc = a.cols (); \ - int b_nr = b.rows (); \ - int b_nc = b.cols (); \ + octave_idx_type a_nr = a.rows (); \ + octave_idx_type a_nc = a.cols (); \ + octave_idx_type b_nr = b.rows (); \ + octave_idx_type b_nc = b.cols (); \ if (a_nr != b_nr || a_nc != b_nc) \ { \ gripe_nonconformant (#FCN, a_nr, a_nc, b_nr, b_nc); \ @@ -133,7 +133,7 @@ } \ if (a_nc == 0 || a_nr == 0) \ return MDiagArray2 (); \ - int l = a.length (); \ + octave_idx_type l = a.length (); \ MDiagArray2 result (a_nr, a_nc); \ T *r = result.fortran_vec (); \ const T *x = a.data (); \ @@ -159,7 +159,7 @@ MDiagArray2 operator - (const MDiagArray2& a) { - int l = a.length (); + octave_idx_type l = a.length (); MDiagArray2 result (a.rows (), a.cols ()); T *r = result.fortran_vec (); const T *x = a.data (); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/MDiagArray2.h --- a/liboctave/MDiagArray2.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/MDiagArray2.h Fri Apr 08 16:07:37 2005 +0000 @@ -41,15 +41,15 @@ { protected: - MDiagArray2 (T *d, int r, int c) : DiagArray2 (d, r, c) { } + MDiagArray2 (T *d, octave_idx_type r, octave_idx_type c) : DiagArray2 (d, r, c) { } public: MDiagArray2 (void) : DiagArray2 () { } - MDiagArray2 (int r, int c) : DiagArray2 (r, c) { } + MDiagArray2 (octave_idx_type r, octave_idx_type c) : DiagArray2 (r, c) { } - MDiagArray2 (int r, int c, const T& val) : DiagArray2 (r, c, val) { } + MDiagArray2 (octave_idx_type r, octave_idx_type c, const T& val) : DiagArray2 (r, c, val) { } MDiagArray2 (const MDiagArray2& a) : DiagArray2 (a) { } @@ -67,14 +67,14 @@ operator MArray2 () const { - int nr = DiagArray2::dim1 (); - int nc = DiagArray2::dim2 (); + octave_idx_type nr = DiagArray2::dim1 (); + octave_idx_type nc = DiagArray2::dim2 (); MArray2 retval (nr, nc, T (0)); - int len = nr < nc ? nr : nc; + octave_idx_type len = nr < nc ? nr : nc; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) retval.xelem (i, i) = this->xelem (i, i); return retval; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/MSparse.cc --- a/liboctave/MSparse.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/MSparse.cc Fri Apr 08 16:07:37 2005 +0000 @@ -41,11 +41,11 @@ { MSparse r; - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (a_nr != b_nr || a_nc != b_nc) gripe_nonconformant ("operator +=" , a_nr, a_nc, b_nr, b_nc); @@ -53,15 +53,15 @@ { r = MSparse (a_nr, a_nc, (a.nnz () + b.nnz ())); - int jx = 0; - for (int i = 0 ; i < a_nc ; i++) + octave_idx_type jx = 0; + for (octave_idx_type i = 0 ; i < a_nc ; i++) { - int ja = a.cidx(i); - int ja_max = a.cidx(i+1); + octave_idx_type ja = a.cidx(i); + octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - int jb = b.cidx(i); - int jb_max = b.cidx(i+1); + 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 ) @@ -114,11 +114,11 @@ { MSparse r; - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (a_nr != b_nr || a_nc != b_nc) gripe_nonconformant ("operator -=" , a_nr, a_nc, b_nr, b_nc); @@ -126,15 +126,15 @@ { r = MSparse (a_nr, a_nc, (a.nnz () + b.nnz ())); - int jx = 0; - for (int i = 0 ; i < a_nc ; i++) + octave_idx_type jx = 0; + for (octave_idx_type i = 0 ; i < a_nc ; i++) { - int ja = a.cidx(i); - int ja_max = a.cidx(i+1); + octave_idx_type ja = a.cidx(i); + octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - int jb = b.cidx(i); - int jb_max = b.cidx(i+1); + 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 ) @@ -188,13 +188,13 @@ MArray2 \ operator OP (const MSparse& a, const T& s) \ { \ - int nr = a.rows (); \ - int nc = a.cols (); \ + octave_idx_type nr = a.rows (); \ + octave_idx_type nc = a.cols (); \ \ MArray2 r (nr, nc, (0.0 OP s)); \ \ - for (int j = 0; j < nc; j++) \ - for (int i = a.cidx(j); i < a.cidx(j+1); i++) \ + for (octave_idx_type j = 0; j < nc; j++) \ + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) \ r.elem (a.ridx (i), j) = a.data (i) OP s; \ return r; \ } @@ -204,18 +204,18 @@ MSparse \ operator OP (const MSparse& a, const T& s) \ { \ - int nr = a.rows (); \ - int nc = a.cols (); \ - int nz = a.nnz (); \ + octave_idx_type nr = a.rows (); \ + octave_idx_type nc = a.cols (); \ + octave_idx_type nz = a.nnz (); \ \ MSparse r (nr, nc, nz); \ \ - for (int i = 0; i < nz; i++) \ + for (octave_idx_type i = 0; i < nz; i++) \ { \ r.data(i) = a.data(i) OP s; \ r.ridx(i) = a.ridx(i); \ } \ - for (int i = 0; i < nc + 1; i++) \ + for (octave_idx_type i = 0; i < nc + 1; i++) \ r.cidx(i) = a.cidx(i); \ r.maybe_compress (true); \ return r; \ @@ -234,13 +234,13 @@ MArray2 \ operator OP (const T& s, const MSparse& a) \ { \ - int nr = a.rows (); \ - int nc = a.cols (); \ + octave_idx_type nr = a.rows (); \ + octave_idx_type nc = a.cols (); \ \ MArray2 r (nr, nc, (s OP 0.0)); \ \ - for (int j = 0; j < nc; j++) \ - for (int i = a.cidx(j); i < a.cidx(j+1); i++) \ + for (octave_idx_type j = 0; j < nc; j++) \ + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) \ r.elem (a.ridx (i), j) = s OP a.data (i); \ return r; \ } @@ -250,18 +250,18 @@ MSparse \ operator OP (const T& s, const MSparse& a) \ { \ - int nr = a.rows (); \ - int nc = a.cols (); \ - int nz = a.nnz (); \ + octave_idx_type nr = a.rows (); \ + octave_idx_type nc = a.cols (); \ + octave_idx_type nz = a.nnz (); \ \ MSparse r (nr, nc, nz); \ \ - for (int i = 0; i < nz; i++) \ + for (octave_idx_type i = 0; i < nz; i++) \ { \ r.data(i) = s OP a.data(i); \ r.ridx(i) = a.ridx(i); \ } \ - for (int i = 0; i < nc + 1; i++) \ + for (octave_idx_type i = 0; i < nc + 1; i++) \ r.cidx(i) = a.cidx(i); \ r.maybe_compress (true); \ return r; \ @@ -281,11 +281,11 @@ { \ MSparse r; \ \ - int a_nr = a.rows (); \ - int a_nc = a.cols (); \ + octave_idx_type a_nr = a.rows (); \ + octave_idx_type a_nc = a.cols (); \ \ - int b_nr = b.rows (); \ - int b_nc = b.cols (); \ + octave_idx_type b_nr = b.rows (); \ + octave_idx_type b_nc = b.cols (); \ \ if (a_nr != b_nr || a_nc != b_nc) \ gripe_nonconformant ("operator " # OP, a_nr, a_nc, b_nr, b_nc); \ @@ -293,16 +293,16 @@ { \ r = MSparse (a_nr, a_nc, (a.nnz () + b.nnz ())); \ \ - int jx = 0; \ + octave_idx_type jx = 0; \ r.cidx (0) = 0; \ - for (int i = 0 ; i < a_nc ; i++) \ + for (octave_idx_type i = 0 ; i < a_nc ; i++) \ { \ - int ja = a.cidx(i); \ - int ja_max = a.cidx(i+1); \ + octave_idx_type ja = a.cidx(i); \ + octave_idx_type ja_max = a.cidx(i+1); \ bool ja_lt_max= ja < ja_max; \ \ - int jb = b.cidx(i); \ - int jb_max = b.cidx(i+1); \ + 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 ) \ @@ -356,11 +356,11 @@ { \ MSparse r; \ \ - int a_nr = a.rows (); \ - int a_nc = a.cols (); \ + octave_idx_type a_nr = a.rows (); \ + octave_idx_type a_nc = a.cols (); \ \ - int b_nr = b.rows (); \ - int b_nc = b.cols (); \ + octave_idx_type b_nr = b.rows (); \ + octave_idx_type b_nc = b.cols (); \ \ if (a_nr != b_nr || a_nc != b_nc) \ gripe_nonconformant (#FCN, a_nr, a_nc, b_nr, b_nc); \ @@ -368,16 +368,16 @@ { \ r = MSparse (a_nr, a_nc, (a.nnz() > b.nnz() ? a.nnz() : b.nnz())); \ \ - int jx = 0; \ + octave_idx_type jx = 0; \ r.cidx (0) = 0; \ - for (int i = 0 ; i < a_nc ; i++) \ + for (octave_idx_type i = 0 ; i < a_nc ; i++) \ { \ - int ja = a.cidx(i); \ - int ja_max = a.cidx(i+1); \ + octave_idx_type ja = a.cidx(i); \ + octave_idx_type ja_max = a.cidx(i+1); \ bool ja_lt_max= ja < ja_max; \ \ - int jb = b.cidx(i); \ - int jb_max = b.cidx(i+1); \ + 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 ) \ @@ -422,11 +422,11 @@ MSparse r; \ T Zero = T (); \ \ - int a_nr = a.rows (); \ - int a_nc = a.cols (); \ + octave_idx_type a_nr = a.rows (); \ + octave_idx_type a_nc = a.cols (); \ \ - int b_nr = b.rows (); \ - int b_nc = b.cols (); \ + octave_idx_type b_nr = b.rows (); \ + octave_idx_type b_nc = b.cols (); \ \ if (a_nr != b_nr || a_nc != b_nc) \ gripe_nonconformant (#FCN, a_nr, a_nc, b_nr, b_nc); \ @@ -434,14 +434,14 @@ { \ r = MSparse( a_nr, a_nc, (Zero OP Zero)); \ \ - for (int i = 0 ; i < a_nc ; i++) \ + for (octave_idx_type i = 0 ; i < a_nc ; i++) \ { \ - int ja = a.cidx(i); \ - int ja_max = a.cidx(i+1); \ + octave_idx_type ja = a.cidx(i); \ + octave_idx_type ja_max = a.cidx(i+1); \ bool ja_lt_max= ja < ja_max; \ \ - int jb = b.cidx(i); \ - int jb_max = b.cidx(i+1); \ + 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 ) \ @@ -493,8 +493,8 @@ operator - (const MSparse& a) { MSparse retval (a); - int nz = a.nnz (); - for (int i = 0; i < nz; i++) + octave_idx_type nz = a.nnz (); + for (octave_idx_type i = 0; i < nz; i++) retval.data(i) = - retval.data(i); return retval; } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/MSparse.h --- a/liboctave/MSparse.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/MSparse.h Fri Apr 08 16:07:37 2005 +0000 @@ -42,7 +42,7 @@ MSparse (void) : Sparse () { } - MSparse (int n, int m) : Sparse (n, m) { } + MSparse (octave_idx_type n, octave_idx_type m) : Sparse (n, m) { } MSparse (const MSparse& a) : Sparse (a) { } @@ -50,19 +50,19 @@ MSparse (const Sparse& a) : Sparse (a) { } - MSparse (const Array a, const Array& r, - const Array& c, int nr = -1, - int nc = -1, bool sum_terms = true) + MSparse (const Array a, const Array& r, + const Array& c, octave_idx_type nr = -1, + octave_idx_type nc = -1, bool sum_terms = true) : Sparse (a, r, c, nr, nc, sum_terms) { } MSparse (const Array a, const Array& r, - const Array& c, int nr = -1, - int nc = -1, bool sum_terms = true) + const Array& c, octave_idx_type nr = -1, + octave_idx_type nc = -1, bool sum_terms = true) : Sparse (a, r, c, nr, nc, sum_terms) { } - explicit MSparse (int r, int c, T val) : Sparse (r, c, val) { } + explicit MSparse (octave_idx_type r, octave_idx_type c, T val) : Sparse (r, c, val) { } - MSparse (int r, int c, int num_nz) : Sparse (r, c, num_nz) { } + MSparse (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) : Sparse (r, c, num_nz) { } ~MSparse (void) { } @@ -72,7 +72,7 @@ return *this; } - MSparse& insert (const Sparse& a, int r, int c) + MSparse& insert (const Sparse& a, octave_idx_type r, octave_idx_type c) { Sparse::insert (a, r, c); return *this; @@ -94,10 +94,10 @@ MSparse reshape (const dim_vector& new_dims) const { return Sparse::reshape (new_dims); } - MSparse permute (const Array& vec, bool inv = false) const + MSparse permute (const Array& vec, bool inv = false) const { return Sparse::permute (vec, inv); } - MSparse ipermute (const Array& vec) const + MSparse ipermute (const Array& vec) const { return Sparse::ipermute (vec); } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/NLConst.h --- a/liboctave/NLConst.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/NLConst.h Fri Apr 08 16:07:37 2005 +0000 @@ -36,7 +36,7 @@ NLConst (void) : Bounds (), NLFunc () { } - NLConst (int n) + NLConst (octave_idx_type n) : Bounds (n), NLFunc () { } NLConst (const ColumnVector& lb, const NLFunc f, const ColumnVector& ub) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/NLEqn.cc --- a/liboctave/NLEqn.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/NLEqn.cc Fri Apr 08 16:07:37 2005 +0000 @@ -30,22 +30,22 @@ #include "lo-error.h" #include "quit.h" -typedef int (*hybrd1_fcn_ptr) (int*, double*, double*, int*); +typedef octave_idx_type (*hybrd1_fcn_ptr) (octave_idx_type*, double*, double*, octave_idx_type*); -typedef int (*hybrj1_fcn_ptr) (int*, double*, double*, double*, int*, int*); +typedef octave_idx_type (*hybrj1_fcn_ptr) (octave_idx_type*, double*, double*, double*, octave_idx_type*, octave_idx_type*); extern "C" { F77_RET_T - F77_FUNC (hybrd1, HYBRD1) (hybrd1_fcn_ptr, const int&, double*, - double*, const double&, int&, double*, - const int&); + F77_FUNC (hybrd1, HYBRD1) (hybrd1_fcn_ptr, const octave_idx_type&, double*, + double*, const double&, octave_idx_type&, double*, + const octave_idx_type&); F77_RET_T - F77_FUNC (hybrj1, HYBRJ1) (hybrj1_fcn_ptr, const int&, double*, - double*, double*, const int&, const - double&, int&, double*, const int&); + F77_FUNC (hybrj1, HYBRJ1) (hybrj1_fcn_ptr, const octave_idx_type&, double*, + double*, double*, const octave_idx_type&, const + double&, octave_idx_type&, double*, const octave_idx_type&); } static NLFunc::nonlinear_fcn user_fun; @@ -61,16 +61,16 @@ // Other operations -int -hybrd1_fcn (int *n, double *x, double *fvec, int *iflag) +octave_idx_type +hybrd1_fcn (octave_idx_type *n, double *x, double *fvec, octave_idx_type *iflag) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; - int nn = *n; + octave_idx_type nn = *n; ColumnVector tmp_f (nn); ColumnVector tmp_x (nn); - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) tmp_x.elem (i) = x[i]; tmp_f = (*user_fun) (tmp_x); @@ -79,7 +79,7 @@ *iflag = -1; else { - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) fvec[i] = tmp_f.elem (i); } @@ -88,19 +88,19 @@ return 0; } -int -hybrj1_fcn (int *n, double *x, double *fvec, double *fjac, - int *ldfjac, int *iflag) +octave_idx_type +hybrj1_fcn (octave_idx_type *n, double *x, double *fvec, double *fjac, + octave_idx_type *ldfjac, octave_idx_type *iflag) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; - int nn = *n; + octave_idx_type nn = *n; ColumnVector tmp_x (nn); - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) tmp_x.elem (i) = x[i]; - int flag = *iflag; + octave_idx_type flag = *iflag; if (flag == 1) { ColumnVector tmp_f (nn); @@ -111,7 +111,7 @@ *iflag = -1; else { - for (int i = 0; i < nn; i++) + for (octave_idx_type i = 0; i < nn; i++) fvec[i] = tmp_f.elem (i); } } @@ -125,9 +125,9 @@ *iflag = -1; else { - int ld = *ldfjac; - for (int j = 0; j < nn; j++) - for (int i = 0; i < nn; i++) + octave_idx_type ld = *ldfjac; + for (octave_idx_type j = 0; j < nn; j++) + for (octave_idx_type i = 0; i < nn; i++) fjac[j*ld+i] = tmp_fj.elem (i, j); } } @@ -138,11 +138,11 @@ } ColumnVector -NLEqn::solve (int& info) +NLEqn::solve (octave_idx_type& info) { ColumnVector retval; - int n = x.capacity (); + octave_idx_type n = x.capacity (); if (n == 0) { @@ -163,7 +163,7 @@ Array fvec (n); double *pfvec = fvec.fortran_vec (); - int lwa = (n*(n+13))/2; + octave_idx_type lwa = (n*(n+13))/2; Array wa (lwa); double *pwa = wa.fortran_vec (); @@ -183,7 +183,7 @@ Array fvec (n); double *pfvec = fvec.fortran_vec (); - int lwa = (n*(3*n+13))/2; + octave_idx_type lwa = (n*(3*n+13))/2; Array wa (lwa); double *pwa = wa.fortran_vec (); @@ -206,7 +206,7 @@ std::string prefix; - int info = solution_status; + octave_idx_type info = solution_status; if (info < 0) info = -info; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/NLEqn.h --- a/liboctave/NLEqn.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/NLEqn.h Fri Apr 08 16:07:37 2005 +0000 @@ -62,30 +62,30 @@ ColumnVector states (void) const { return x; } - int size (void) const { return x.capacity (); } + octave_idx_type size (void) const { return x.capacity (); } ColumnVector solve (void) { - int info; + octave_idx_type info; return solve (info); } ColumnVector solve (const ColumnVector& xvec) { set_states (xvec); - int info; + octave_idx_type info; return solve (info); } - ColumnVector solve (const ColumnVector& xvec, int& info) + ColumnVector solve (const ColumnVector& xvec, octave_idx_type& info) { set_states (xvec); return solve (info); } - ColumnVector solve (int& info); + ColumnVector solve (octave_idx_type& info); - int solution_state (void) const { return solution_status; } + octave_idx_type solution_state (void) const { return solution_status; } bool solution_ok (void) const { return solution_status == 1; } @@ -94,7 +94,7 @@ private: ColumnVector x; - int solution_status; + octave_idx_type solution_status; void error (const char* msg); }; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Quad.cc --- a/liboctave/Quad.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Quad.cc Fri Apr 08 16:07:37 2005 +0000 @@ -38,25 +38,25 @@ // function, and the user wants us to quit. int quad_integration_error = 0; -typedef int (*quad_fcn_ptr) (double*, int&, double*); +typedef octave_idx_type (*quad_fcn_ptr) (double*, int&, double*); extern "C" { F77_RET_T F77_FUNC (dqagp, DQAGP) (quad_fcn_ptr, const double&, const double&, - const int&, const double*, const double&, - const double&, double&, double&, int&, - int&, const int&, const int&, int&, int*, + const octave_idx_type&, const double*, const double&, + 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*); F77_RET_T - F77_FUNC (dqagi, DQAGI) (quad_fcn_ptr, const double&, const int&, + F77_FUNC (dqagi, DQAGI) (quad_fcn_ptr, const double&, const octave_idx_type&, const double&, const double&, double&, - double&, int&, int&, const int&, - const int&, int&, int*, double*); + double&, octave_idx_type&, octave_idx_type&, const octave_idx_type&, + const octave_idx_type&, octave_idx_type&, octave_idx_type*, double*); } -static int +static octave_idx_type user_function (double *x, int& ierr, double *result) { BEGIN_INTERRUPT_WITH_EXCEPTIONS; @@ -86,22 +86,22 @@ } double -DefQuad::do_integrate (int& ier, int& neval, double& abserr) +DefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr) { - int npts = singularities.capacity () + 2; + octave_idx_type npts = singularities.capacity () + 2; double *points = singularities.fortran_vec (); double result = 0.0; - int leniw = 183*npts - 122; - Array iwork (leniw); - int *piwork = iwork.fortran_vec (); + octave_idx_type leniw = 183*npts - 122; + Array iwork (leniw); + octave_idx_type *piwork = iwork.fortran_vec (); - int lenw = 2*leniw - npts; + octave_idx_type lenw = 2*leniw - npts; Array work (lenw); double *pwork = work.fortran_vec (); user_fcn = f; - int last; + octave_idx_type last; double abs_tol = absolute_tolerance (); double rel_tol = relative_tolerance (); @@ -118,22 +118,22 @@ } double -IndefQuad::do_integrate (int& ier, int& neval, double& abserr) +IndefQuad::do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr) { double result = 0.0; - int leniw = 128; - Array iwork (leniw); - int *piwork = iwork.fortran_vec (); + octave_idx_type leniw = 128; + Array iwork (leniw); + octave_idx_type *piwork = iwork.fortran_vec (); - int lenw = 8*leniw; + octave_idx_type lenw = 8*leniw; Array work (lenw); double *pwork = work.fortran_vec (); user_fcn = f; - int last; + octave_idx_type last; - int inf; + octave_idx_type inf; switch (type) { case bound_to_inf: diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Quad.h --- a/liboctave/Quad.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Quad.h Fri Apr 08 16:07:37 2005 +0000 @@ -55,30 +55,30 @@ virtual double integrate (void) { - int ier, neval; + octave_idx_type ier, neval; double abserr; return do_integrate (ier, neval, abserr); } - virtual double integrate (int& ier) + virtual double integrate (octave_idx_type& ier) { - int neval; + octave_idx_type neval; double abserr; return do_integrate (ier, neval, abserr); } - virtual double integrate (int& ier, int& neval) + virtual double integrate (octave_idx_type& ier, octave_idx_type& neval) { double abserr; return do_integrate (ier, neval, abserr); } - virtual double integrate (int& ier, int& neval, double& abserr) + virtual double integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr) { return do_integrate (ier, neval, abserr); } - virtual double do_integrate (int& ier, int& neval, double& abserr) = 0; + virtual double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr) = 0; protected: @@ -107,7 +107,7 @@ ~DefQuad (void) { } - double do_integrate (int& ier, int& neval, double& abserr); + double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr); private: @@ -132,7 +132,7 @@ ~IndefQuad (void) { } - double do_integrate (int& ier, int& neval, double& abserr); + double do_integrate (octave_idx_type& ier, octave_idx_type& neval, double& abserr); private: diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Range.cc --- a/liboctave/Range.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Range.cc Fri Apr 08 16:07:37 2005 +0000 @@ -41,8 +41,8 @@ // will also be an integer, even if the limit is not. return (! (xisnan (rng_base) || xisnan (rng_inc)) - && NINT (rng_base) == rng_base - && NINT (rng_inc) == rng_inc); + && NINTbig (rng_base) == rng_base + && NINTbig (rng_inc) == rng_inc); } Matrix @@ -53,7 +53,7 @@ cache.resize (1, rng_nelem); double b = rng_base; double increment = rng_inc; - for (int i = 0; i < rng_nelem; i++) + for (octave_idx_type i = 0; i < rng_nelem; i++) cache(i) = b + i * increment; // On some machines (x86 with extended precision floating point @@ -134,9 +134,9 @@ { double b = a.base (); double increment = a.inc (); - int num_elem = a.nelem (); + octave_idx_type num_elem = a.nelem (); - for (int i = 0; i < num_elem-1; i++) + for (octave_idx_type i = 0; i < num_elem-1; i++) os << b + i * increment << " "; // Prevent overshoot. See comment in the matrix_value method @@ -247,10 +247,10 @@ return fabs (u - v) < ((tu > tv ? tu : tv) * ct); } -int +octave_idx_type Range::nelem_internal (void) const { - int retval = -1; + octave_idx_type retval = -1; if (rng_inc == 0 || (rng_limit > rng_base && rng_inc < 0) @@ -264,7 +264,7 @@ double tmp = tfloor ((rng_limit - rng_base + rng_inc) / rng_inc, ct); - int n_elt = (tmp > 0.0 ? static_cast (tmp) : 0); + octave_idx_type n_elt = (tmp > 0.0 ? static_cast (tmp) : 0); // If the final element that we would compute for the range is // equal to the limit of the range, or is an adjacent floating diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Range.h --- a/liboctave/Range.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Range.h Fri Apr 08 16:07:37 2005 +0000 @@ -49,7 +49,7 @@ double base (void) const { return rng_base; } double limit (void) const { return rng_limit; } double inc (void) const { return rng_inc; } - int nelem (void) const { return rng_nelem; } + octave_idx_type nelem (void) const { return rng_nelem; } bool all_elements_are_ints (void) const; @@ -98,11 +98,11 @@ double rng_limit; double rng_inc; - int rng_nelem; + octave_idx_type rng_nelem; mutable Matrix cache; - int nelem_internal (void) const; + octave_idx_type nelem_internal (void) const; void clear_cache (void) const { cache.resize (0, 0); } }; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Sparse-op-defs.h --- a/liboctave/Sparse-op-defs.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Sparse-op-defs.h Fri Apr 08 16:07:37 2005 +0000 @@ -45,13 +45,13 @@ R \ F (const M& m, const S& s) \ { \ - int nr = m.rows (); \ - int nc = m.cols (); \ + octave_idx_type nr = m.rows (); \ + octave_idx_type nc = m.cols (); \ \ R r (nr, nc, (0.0 OP s)); \ \ - for (int j = 0; j < nc; j++) \ - for (int i = m.cidx (j); i < m.cidx (j+1); i++) \ + for (octave_idx_type j = 0; j < nc; j++) \ + for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \ r.elem (m.ridx (i), j) = m.data (i) OP s; \ return r; \ } @@ -60,18 +60,18 @@ R \ F (const M& m, const S& s) \ { \ - int nr = m.rows (); \ - int nc = m.cols (); \ - int nz = m.nnz (); \ + octave_idx_type nr = m.rows (); \ + octave_idx_type nc = m.cols (); \ + octave_idx_type nz = m.nnz (); \ \ R r (nr, nc, nz); \ \ - for (int i = 0; i < nz; i++) \ + for (octave_idx_type i = 0; i < nz; i++) \ { \ r.data(i) = m.data(i) OP s; \ r.ridx(i) = m.ridx(i); \ } \ - for (int i = 0; i < nc + 1; i++) \ + for (octave_idx_type i = 0; i < nc + 1; i++) \ r.cidx(i) = m.cidx(i); \ \ r.maybe_compress (true); \ @@ -101,27 +101,27 @@ F (const M& m, const S& s) \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - int nz = m.nnz (); \ + octave_idx_type nel = 0; \ + octave_idx_type nz = m.nnz (); \ if (MC (MZ) OP SC (s)) \ nel += m.numel() - nz; \ - for (int i = 0; i < nz; i++) \ + for (octave_idx_type i = 0; i < nz; i++) \ if (MC (m.data (i)) OP SC (s)) \ nel++; \ \ - int nr = m.rows (); \ - int nc = m.cols (); \ + octave_idx_type nr = m.rows (); \ + octave_idx_type nc = m.cols (); \ SparseBoolMatrix r (nr, nc, nel); \ \ if (nr > 0 && nc > 0) \ { \ if (MC (MZ) OP SC (s)) \ { \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ { \ bool el = MC (m.elem(i, j)) OP SC (s); \ if (el) \ @@ -135,11 +135,11 @@ } \ else \ { \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ - for (int i = m.cidx(j); i < m.cidx(j+1); i++) \ + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ { \ bool el = MC (m.data(i)) OP SC (s); \ if (el) \ @@ -176,27 +176,27 @@ F (const M& m, const S& s) \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - int nz = m.nnz (); \ + octave_idx_type nel = 0; \ + octave_idx_type nz = m.nnz (); \ if (LHS_ZERO OP (s != RHS_ZERO)) \ nel += m.numel() - nz; \ - for (int i = 0; i < nz; i++) \ + for (octave_idx_type i = 0; i < nz; i++) \ if ((m.data(i) != LHS_ZERO) OP (s != RHS_ZERO))\ nel++; \ \ - int nr = m.rows (); \ - int nc = m.cols (); \ + octave_idx_type nr = m.rows (); \ + octave_idx_type nc = m.cols (); \ SparseBoolMatrix r (nr, nc, nel); \ \ if (nr > 0 && nc > 0) \ { \ if (LHS_ZERO OP (s != RHS_ZERO)) \ { \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ { \ bool el = (m.elem(i, j) != LHS_ZERO) OP (s != RHS_ZERO); \ if (el) \ @@ -210,11 +210,11 @@ } \ else \ { \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ - for (int i = m.cidx(j); i < m.cidx(j+1); i++) \ + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ { \ bool el = (m.data(i) != LHS_ZERO) OP (s != RHS_ZERO); \ if (el) \ @@ -254,13 +254,13 @@ R \ F (const S& s, const M& m) \ { \ - int nr = m.rows (); \ - int nc = m.cols (); \ + octave_idx_type nr = m.rows (); \ + octave_idx_type nc = m.cols (); \ \ R r (nr, nc, (s OP 0.0)); \ \ - for (int j = 0; j < nc; j++) \ - for (int i = m.cidx (j); i < m.cidx (j+1); i++) \ + for (octave_idx_type j = 0; j < nc; j++) \ + for (octave_idx_type i = m.cidx (j); i < m.cidx (j+1); i++) \ r.elem (m.ridx (i), j) = s OP m.data (i); \ \ return r; \ @@ -270,18 +270,18 @@ R \ F (const S& s, const M& m) \ { \ - int nr = m.rows (); \ - int nc = m.cols (); \ - int nz = m.nnz (); \ + octave_idx_type nr = m.rows (); \ + octave_idx_type nc = m.cols (); \ + octave_idx_type nz = m.nnz (); \ \ R r (nr, nc, nz); \ \ - for (int i = 0; i < nz; i++) \ + for (octave_idx_type i = 0; i < nz; i++) \ { \ r.data(i) = s OP m.data(i); \ r.ridx(i) = m.ridx(i); \ } \ - for (int i = 0; i < nc + 1; i++) \ + for (octave_idx_type i = 0; i < nc + 1; i++) \ r.cidx(i) = m.cidx(i); \ \ r.maybe_compress(true); \ @@ -311,27 +311,27 @@ F (const S& s, const M& m) \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - int nz = m.nnz (); \ + octave_idx_type nel = 0; \ + octave_idx_type nz = m.nnz (); \ if (SC (s) OP MC (MZ)) \ nel += m.numel() - nz; \ - for (int i = 0; i < nz; i++) \ + for (octave_idx_type i = 0; i < nz; i++) \ if (SC (s) OP MC (m.data (i))) \ nel++; \ \ - int nr = m.rows (); \ - int nc = m.cols (); \ + octave_idx_type nr = m.rows (); \ + octave_idx_type nc = m.cols (); \ SparseBoolMatrix r (nr, nc, nel); \ \ if (nr > 0 && nc > 0) \ { \ if (SC (s) OP MC (MZ))\ { \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ { \ bool el = SC (s) OP MC (m.elem(i, j)); \ if (el) \ @@ -345,11 +345,11 @@ } \ else \ { \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ - for (int i = m.cidx(j); i < m.cidx(j+1); i++) \ + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ { \ bool el = SC (s) OP MC (m.data(i)); \ if (el) \ @@ -386,27 +386,27 @@ F (const S& s, const M& m) \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - int nz = m.nnz (); \ + octave_idx_type nel = 0; \ + octave_idx_type nz = m.nnz (); \ if ((s != LHS_ZERO) OP RHS_ZERO) \ nel += m.numel() - nz; \ - for (int i = 0; i < nz; i++) \ + for (octave_idx_type i = 0; i < nz; i++) \ if ((s != LHS_ZERO) OP m.data(i) != RHS_ZERO) \ nel++; \ \ - int nr = m.rows (); \ - int nc = m.cols (); \ + octave_idx_type nr = m.rows (); \ + octave_idx_type nc = m.cols (); \ SparseBoolMatrix r (nr, nc, nel); \ \ if (nr > 0 && nc > 0) \ { \ if ((s != LHS_ZERO) OP RHS_ZERO) \ { \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ { \ bool el = (s != LHS_ZERO) OP (m.elem(i, j) != RHS_ZERO); \ if (el) \ @@ -420,11 +420,11 @@ } \ else \ { \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ - for (int i = m.cidx(j); i < m.cidx(j+1); i++) \ + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) \ { \ bool el = (s != LHS_ZERO) OP (m.data(i) != RHS_ZERO); \ if (el) \ @@ -466,11 +466,11 @@ { \ R r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr != m2_nr || m1_nc != m2_nc) \ gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ @@ -478,16 +478,16 @@ { \ r = R (m1_nr, m1_nc, (m1.nnz () + m2.nnz ())); \ \ - int jx = 0; \ + octave_idx_type jx = 0; \ r.cidx (0) = 0; \ - for (int i = 0 ; i < m1_nc ; i++) \ + for (octave_idx_type i = 0 ; i < m1_nc ; i++) \ { \ - int ja = m1.cidx(i); \ - int ja_max = m1.cidx(i+1); \ + octave_idx_type ja = m1.cidx(i); \ + octave_idx_type ja_max = m1.cidx(i+1); \ bool ja_lt_max= ja < ja_max; \ \ - int jb = m2.cidx(i); \ - int jb_max = m2.cidx(i+1); \ + octave_idx_type jb = m2.cidx(i); \ + octave_idx_type jb_max = m2.cidx(i+1); \ bool jb_lt_max = jb < jb_max; \ \ while (ja_lt_max || jb_lt_max ) \ @@ -540,11 +540,11 @@ { \ R r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr != m2_nr || m1_nc != m2_nc) \ gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ @@ -552,16 +552,16 @@ { \ r = R (m1_nr, m1_nc, (m1.nnz () > m2.nnz () ? m1.nnz () : m2.nnz ())); \ \ - int jx = 0; \ + octave_idx_type jx = 0; \ r.cidx (0) = 0; \ - for (int i = 0 ; i < m1_nc ; i++) \ + for (octave_idx_type i = 0 ; i < m1_nc ; i++) \ { \ - int ja = m1.cidx(i); \ - int ja_max = m1.cidx(i+1); \ + octave_idx_type ja = m1.cidx(i); \ + octave_idx_type ja_max = m1.cidx(i+1); \ bool ja_lt_max= ja < ja_max; \ \ - int jb = m2.cidx(i); \ - int jb_max = m2.cidx(i+1); \ + octave_idx_type jb = m2.cidx(i); \ + octave_idx_type jb_max = m2.cidx(i+1); \ bool jb_lt_max = jb < jb_max; \ \ while (ja_lt_max || jb_lt_max ) \ @@ -604,11 +604,11 @@ { \ R r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr != m2_nr || m1_nc != m2_nc) \ gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ @@ -618,14 +618,14 @@ /* XXX FIXME XXX Kludge... Always double/Complex, so Complex () */ \ r = R (m1_nr, m1_nc, (Complex () OP Complex ())); \ \ - for (int i = 0 ; i < m1_nc ; i++) \ + for (octave_idx_type i = 0 ; i < m1_nc ; i++) \ { \ - int ja = m1.cidx(i); \ - int ja_max = m1.cidx(i+1); \ + octave_idx_type ja = m1.cidx(i); \ + octave_idx_type ja_max = m1.cidx(i+1); \ bool ja_lt_max= ja < ja_max; \ \ - int jb = m2.cidx(i); \ - int jb_max = m2.cidx(i+1); \ + octave_idx_type jb = m2.cidx(i); \ + octave_idx_type jb_max = m2.cidx(i+1); \ bool jb_lt_max = jb < jb_max; \ \ while (ja_lt_max || jb_lt_max ) \ @@ -691,30 +691,30 @@ { \ SparseBoolMatrix r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr == m2_nr && m1_nc == m2_nc) \ { \ if (m1_nr != 0 || m1_nc != 0) \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - for (int j = 0; j < m1_nc; j++) \ - for (int i = 0; i < m1_nr; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ if (C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j))) \ nel++; \ \ r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < m1_nc; j++) \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ { \ - for (int i = 0; i < m1_nr; i++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ { \ bool el = C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j)); \ if (el) \ @@ -757,31 +757,31 @@ { \ SparseBoolMatrix r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr == m2_nr && m1_nc == m2_nc) \ { \ if (m1_nr != 0 || m1_nc != 0) \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - for (int j = 0; j < m1_nc; j++) \ - for (int i = 0; i < m1_nr; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ if ((m1.elem(i, j) != LHS_ZERO) \ OP (m2.elem(i, j) != RHS_ZERO)) \ nel++; \ \ r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < m1_nc; j++) \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ { \ - for (int i = 0; i < m1_nr; i++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ { \ bool el = (m1.elem(i, j) != LHS_ZERO) \ OP (m2.elem(i, j) != RHS_ZERO); \ @@ -829,11 +829,11 @@ { \ R r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr != m2_nr || m1_nc != m2_nc) \ gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ @@ -841,8 +841,8 @@ { \ r = R (m1_nr, m1_nc); \ \ - for (int j = 0; j < m1_nc; j++) \ - for (int i = 0; i < m1_nr; i++) \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ r.elem (i, j) = m1.elem (i, j) OP m2.elem (i, j); \ } \ return r; \ @@ -854,30 +854,30 @@ { \ R r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr != m2_nr || m1_nc != m2_nc) \ gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ else \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - for (int j = 0; j < m1_nc; j++) \ - for (int i = 0; i < m1_nr; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ if ((m1.elem(i, j) OP m2.elem(i, j)) != ZERO) \ nel++; \ \ r = R (m1_nr, m1_nc, nel); \ \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0 ; j < m1_nc ; j++) \ + for (octave_idx_type j = 0 ; j < m1_nc ; j++) \ { \ - for (int i = 0 ; i < m1_nr ; i++) \ + for (octave_idx_type i = 0 ; i < m1_nr ; i++) \ { \ if ((m1.elem(i, j) OP m2.elem(i, j)) != ZERO) \ { \ @@ -917,30 +917,30 @@ { \ SparseBoolMatrix r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr == m2_nr && m1_nc == m2_nc) \ { \ if (m1_nr != 0 || m1_nc != 0) \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - for (int j = 0; j < m1_nc; j++) \ - for (int i = 0; i < m1_nr; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ if (C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j))) \ nel++; \ \ r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < m1_nc; j++) \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ { \ - for (int i = 0; i < m1_nr; i++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ { \ bool el = C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j)); \ if (el) \ @@ -983,31 +983,31 @@ { \ SparseBoolMatrix r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr == m2_nr && m1_nc == m2_nc) \ { \ if (m1_nr != 0 || m1_nc != 0) \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - for (int j = 0; j < m1_nc; j++) \ - for (int i = 0; i < m1_nr; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ if ((m1.elem(i, j) != LHS_ZERO) \ OP (m2.elem(i, j) != RHS_ZERO)) \ nel++; \ \ r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < m1_nc; j++) \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ { \ - for (int i = 0; i < m1_nr; i++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ { \ bool el = (m1.elem(i, j) != LHS_ZERO) \ OP (m2.elem(i, j) != RHS_ZERO); \ @@ -1055,11 +1055,11 @@ { \ R r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr != m2_nr || m1_nc != m2_nc) \ gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ @@ -1067,8 +1067,8 @@ { \ r = R (m1_nr, m1_nc); \ \ - for (int j = 0; j < m1_nc; j++) \ - for (int i = 0; i < m1_nr; i++) \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ r.elem (i, j) = m1.elem (i, j) OP m2.elem (i, j); \ } \ return r; \ @@ -1080,30 +1080,30 @@ { \ R r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr != m2_nr || m1_nc != m2_nc) \ gripe_nonconformant (#F, m1_nr, m1_nc, m2_nr, m2_nc); \ else \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - for (int j = 0; j < m1_nc; j++) \ - for (int i = 0; i < m1_nr; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ if ((m1.elem(i, j) OP m2.elem(i, j)) != ZERO) \ nel++; \ \ r = R (m1_nr, m1_nc, nel); \ \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0 ; j < m1_nc ; j++) \ + for (octave_idx_type j = 0 ; j < m1_nc ; j++) \ { \ - for (int i = 0 ; i < m1_nr ; i++) \ + for (octave_idx_type i = 0 ; i < m1_nr ; i++) \ { \ if ((m1.elem(i, j) OP m2.elem(i, j)) != ZERO) \ { \ @@ -1143,30 +1143,30 @@ { \ SparseBoolMatrix r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr == m2_nr && m1_nc == m2_nc) \ { \ if (m1_nr != 0 || m1_nc != 0) \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - for (int j = 0; j < m1_nc; j++) \ - for (int i = 0; i < m1_nr; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ if (C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j))) \ nel++; \ \ r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < m1_nc; j++) \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ { \ - for (int i = 0; i < m1_nr; i++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ { \ bool el = C1 (m1.elem(i, j)) OP C2 (m2.elem(i, j)); \ if (el) \ @@ -1209,31 +1209,31 @@ { \ SparseBoolMatrix r; \ \ - int m1_nr = m1.rows (); \ - int m1_nc = m1.cols (); \ + octave_idx_type m1_nr = m1.rows (); \ + octave_idx_type m1_nc = m1.cols (); \ \ - int m2_nr = m2.rows (); \ - int m2_nc = m2.cols (); \ + octave_idx_type m2_nr = m2.rows (); \ + octave_idx_type m2_nc = m2.cols (); \ \ if (m1_nr == m2_nr && m1_nc == m2_nc) \ { \ if (m1_nr != 0 || m1_nc != 0) \ { \ /* Count num of non-zero elements */ \ - int nel = 0; \ - for (int j = 0; j < m1_nc; j++) \ - for (int i = 0; i < m1_nr; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ if ((m1.elem(i, j) != LHS_ZERO) \ OP (m2.elem(i, j) != RHS_ZERO)) \ nel++; \ \ r = SparseBoolMatrix (m1_nr, m1_nc, nel); \ \ - int ii = 0; \ + octave_idx_type ii = 0; \ r.cidx (0) = 0; \ - for (int j = 0; j < m1_nc; j++) \ + for (octave_idx_type j = 0; j < m1_nc; j++) \ { \ - for (int i = 0; i < m1_nr; i++) \ + for (octave_idx_type i = 0; i < m1_nr; i++) \ { \ bool el = (m1.elem(i, j) != LHS_ZERO) \ OP (m2.elem(i, j) != RHS_ZERO); \ @@ -1271,8 +1271,8 @@ #define SPARSE_CUMSUM(RET_TYPE, ELT_TYPE, FCN) \ \ - int nr = rows (); \ - int nc = cols (); \ + octave_idx_type nr = rows (); \ + octave_idx_type nc = cols (); \ \ RET_TYPE retval; \ \ @@ -1283,11 +1283,11 @@ retval = transpose (). FCN (0) .transpose (); \ else \ { \ - int nel = 0; \ - for (int i = 0; i < nc; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type i = 0; i < nc; i++) \ { \ ELT_TYPE t = ELT_TYPE (); \ - for (int j = cidx (i); j < cidx (i+1); j++) \ + for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ { \ t += data(j); \ if (t != ELT_TYPE ()) \ @@ -1299,18 +1299,18 @@ } \ retval = RET_TYPE (nr, nc, nel); \ retval.cidx(0) = 0; \ - int ii = 0; \ - for (int i = 0; i < nc; i++) \ + octave_idx_type ii = 0; \ + for (octave_idx_type i = 0; i < nc; i++) \ { \ ELT_TYPE t = ELT_TYPE (); \ - for (int j = cidx (i); j < cidx (i+1); j++) \ + for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ { \ t += data(j); \ if (t != ELT_TYPE ()) \ { \ if (j == cidx(i+1) - 1) \ { \ - for (int k = ridx(j); k < nr; k++) \ + for (octave_idx_type k = ridx(j); k < nr; k++) \ { \ retval.data (ii) = t; \ retval.ridx (ii++) = k; \ @@ -1318,7 +1318,7 @@ } \ else \ { \ - for (int k = ridx(j); k < ridx(j+1); k++) \ + for (octave_idx_type k = ridx(j); k < ridx(j+1); k++) \ { \ retval.data (ii) = t; \ retval.ridx (ii++) = k; \ @@ -1338,8 +1338,8 @@ #define SPARSE_CUMPROD(RET_TYPE, ELT_TYPE, FCN) \ \ - int nr = rows (); \ - int nc = cols (); \ + octave_idx_type nr = rows (); \ + octave_idx_type nc = cols (); \ \ RET_TYPE retval; \ \ @@ -1350,11 +1350,11 @@ retval = transpose (). FCN (0) .transpose (); \ else \ { \ - int nel = 0; \ - for (int i = 0; i < nc; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type i = 0; i < nc; i++) \ { \ - int jj = 0; \ - for (int j = cidx (i); j < cidx (i+1); j++) \ + octave_idx_type jj = 0; \ + for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ { \ if (jj == ridx(j)) \ { \ @@ -1367,12 +1367,12 @@ } \ retval = RET_TYPE (nr, nc, nel); \ retval.cidx(0) = 0; \ - int ii = 0; \ - for (int i = 0; i < nc; i++) \ + octave_idx_type ii = 0; \ + for (octave_idx_type i = 0; i < nc; i++) \ { \ ELT_TYPE t = ELT_TYPE (1.); \ - int jj = 0; \ - for (int j = cidx (i); j < cidx (i+1); j++) \ + octave_idx_type jj = 0; \ + for (octave_idx_type j = cidx (i); j < cidx (i+1); j++) \ { \ if (jj == ridx(j)) \ { \ @@ -1395,8 +1395,8 @@ #define SPARSE_BASE_REDUCTION_OP(RET_TYPE, EL_TYPE, ROW_EXPR, COL_EXPR, \ INIT_VAL, MT_RESULT) \ \ - int nr = rows (); \ - int nc = cols (); \ + octave_idx_type nr = rows (); \ + octave_idx_type nc = cols (); \ \ RET_TYPE retval; \ \ @@ -1406,23 +1406,23 @@ { \ OCTAVE_LOCAL_BUFFER (EL_TYPE, tmp, nr); \ \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ { \ tmp[i] = INIT_VAL; \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ ROW_EXPR; \ } \ } \ - int nel = 0; \ - for (int i = 0; i < nr; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type i = 0; i < nr; i++) \ if (tmp[i] != EL_TYPE ()) \ nel++ ; \ - retval = RET_TYPE (nr, 1, nel); \ + retval = RET_TYPE (nr, static_cast (1), nel); \ retval.cidx(0) = 0; \ retval.cidx(1) = nel; \ nel = 0; \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ if (tmp[i] != EL_TYPE ()) \ { \ retval.data(nel) = tmp[i]; \ @@ -1433,22 +1433,22 @@ { \ OCTAVE_LOCAL_BUFFER (EL_TYPE, tmp, nc); \ \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ tmp[j] = INIT_VAL; \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ { \ COL_EXPR; \ } \ } \ - int nel = 0; \ - for (int i = 0; i < nc; i++) \ + octave_idx_type nel = 0; \ + for (octave_idx_type i = 0; i < nc; i++) \ if (tmp[i] != EL_TYPE ()) \ nel++ ; \ - retval = RET_TYPE (1, nc, nel); \ + retval = RET_TYPE (static_cast (1), nc, nel); \ retval.cidx(0) = 0; \ nel = 0; \ - for (int i = 0; i < nc; i++) \ + for (octave_idx_type i = 0; i < nc; i++) \ if (tmp[i] != EL_TYPE ()) \ { \ retval.data(nel) = tmp[i]; \ @@ -1461,7 +1461,9 @@ } \ else if (nc == 0 && (nr == 0 || (nr == 1 && dim == -1))) \ { \ - retval = RET_TYPE (1, 1, 1); \ + retval = RET_TYPE (static_cast (1), \ + static_cast (1), \ + static_cast (1)); \ retval.cidx(0) = 0; \ retval.cidx(1) = 1; \ retval.ridx(0) = 0; \ @@ -1469,9 +1471,9 @@ } \ else if (nr == 0 && (dim == 0 || dim == -1)) \ { \ - retval = RET_TYPE (1, nc, nc); \ + retval = RET_TYPE (static_cast (1), nc, nc); \ retval.cidx (0) = 0; \ - for (int i = 0; i < nc ; i++) \ + for (octave_idx_type i = 0; i < nc ; i++) \ { \ retval.ridx (i) = 0; \ retval.cidx (i+1) = i; \ @@ -1480,10 +1482,10 @@ } \ else if (nc == 0 && dim == 1) \ { \ - retval = RET_TYPE (nr, 1, nr); \ + retval = RET_TYPE (nr, static_cast (1), nr); \ retval.cidx(0) = 0; \ retval.cidx(1) = nr; \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ { \ retval.ridx(i) = i; \ retval.data(i) = MT_RESULT; \ @@ -1531,11 +1533,11 @@ #define SPARSE_ANY_OP(DIM) SPARSE_ANY_ALL_OP (DIM, false, !=, true) #define SPARSE_SPARSE_MUL( RET_TYPE, EL_TYPE ) \ - int nr = m.rows (); \ - int nc = m.cols (); \ + octave_idx_type nr = m.rows (); \ + octave_idx_type nc = m.cols (); \ \ - int a_nr = a.rows (); \ - int a_nc = a.cols (); \ + octave_idx_type a_nr = a.rows (); \ + octave_idx_type a_nc = a.cols (); \ \ if (nc != a_nr) \ { \ @@ -1546,17 +1548,17 @@ { \ OCTAVE_LOCAL_BUFFER (EL_TYPE, Xcol, nr); \ \ - int nel = 0; \ + octave_idx_type nel = 0; \ \ - for (int i = 0; i < a_nc; i++) \ + for (octave_idx_type i = 0; i < a_nc; i++) \ { \ OCTAVE_QUIT; \ - for (int k = 0; k < nr; k++) \ + for (octave_idx_type k = 0; k < nr; k++) \ Xcol[k]= 0.; \ - for (int j = a.cidx(i); j < a.cidx(i+1); j++) \ + for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \ { \ - int col = a.ridx(j); \ - for (int k = m.cidx(col) ; k < m.cidx(col+1); k++) \ + octave_idx_type col = a.ridx(j); \ + for (octave_idx_type k = m.cidx(col) ; k < m.cidx(col+1); k++) \ if (Xcol[m.ridx(k)] == 0.) \ { \ Xcol[m.ridx(k)] = 1.; \ @@ -1571,22 +1573,22 @@ { \ RET_TYPE retval (nr, a_nc, nel); \ \ - int ii = 0; \ + octave_idx_type ii = 0; \ \ retval.cidx(0) = 0; \ - for (int i = 0; i < a_nc ; i++) \ + for (octave_idx_type i = 0; i < a_nc ; i++) \ { \ OCTAVE_QUIT; \ - for (int k = 0; k < nr; k++) \ + for (octave_idx_type k = 0; k < nr; k++) \ Xcol[k]= 0.; \ - for (int j = a.cidx(i); j < a.cidx(i+1); j++) \ + for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) \ { \ - int col = a.ridx(j); \ + octave_idx_type col = a.ridx(j); \ EL_TYPE tmpval = a.data(j); \ - for (int k = m.cidx(col) ; k < m.cidx(col+1); k++) \ + for (octave_idx_type k = m.cidx(col) ; k < m.cidx(col+1); k++) \ Xcol[m.ridx(k)] += tmpval * m.data(k); \ } \ - for (int k = 0; k < nr; k++) \ + for (octave_idx_type k = 0; k < nr; k++) \ { \ if (Xcol[k] !=0. ) \ { \ diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Sparse.cc --- a/liboctave/Sparse.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Sparse.cc Fri Apr 08 16:07:37 2005 +0000 @@ -45,9 +45,9 @@ template T& -Sparse::SparseRep::elem (int _r, int _c) +Sparse::SparseRep::elem (octave_idx_type _r, octave_idx_type _c) { - int i; + octave_idx_type i; if (nnz > 0) { @@ -62,21 +62,21 @@ if (c[ncols+1] == nnz) { (*current_liboctave_error_handler) - ("Sparse::SparseRep::elem (int, int): sparse matrix filled"); + ("Sparse::SparseRep::elem (octave_idx_type, octave_idx_type): sparse matrix filled"); return *d; } - int to_move = c[ncols] - i; + octave_idx_type to_move = c[ncols] - i; if (to_move != 0) { - for (int j = c[ncols]; j > i; j--) + for (octave_idx_type j = c[ncols]; j > i; j--) { d[j] = d[j-1]; r[j] = r[j-1]; } } - for (int j = _c + 1; j < ncols + 1; j++) + for (octave_idx_type j = _c + 1; j < ncols + 1; j++) c[j] = c[j] + 1; d[i] = 0.; @@ -87,17 +87,17 @@ else { (*current_liboctave_error_handler) - ("Sparse::SparseRep::elem (int, int): sparse matrix filled"); + ("Sparse::SparseRep::elem (octave_idx_type, octave_idx_type): sparse matrix filled"); return *d; } } template T -Sparse::SparseRep::celem (int _r, int _c) const +Sparse::SparseRep::celem (octave_idx_type _r, octave_idx_type _c) const { if (nnz > 0) - for (int i = c[_c]; i < c[_c + 1]; i++) + for (octave_idx_type i = c[_c]; i < c[_c + 1]; i++) if (r[i] == _r) return d[i]; return T (); @@ -107,11 +107,11 @@ void Sparse::SparseRep::maybe_compress (bool remove_zeros) { - int ndel = nnz - c[ncols]; - int nzero = 0; + octave_idx_type ndel = nnz - c[ncols]; + octave_idx_type nzero = 0; if (remove_zeros) - for (int i = 0; i < nnz - ndel; i++) + for (octave_idx_type i = 0; i < nnz - ndel; i++) if (d[i] == T ()) nzero++; @@ -120,32 +120,32 @@ if (!nzero) { - int new_nnz = nnz - ndel; + octave_idx_type new_nnz = nnz - ndel; T *new_data = new T [new_nnz]; - for (int i = 0; i < new_nnz; i++) + for (octave_idx_type i = 0; i < new_nnz; i++) new_data[i] = d[i]; delete [] d; d = new_data; - int *new_ridx = new int [new_nnz]; - for (int i = 0; i < new_nnz; i++) + octave_idx_type *new_ridx = new octave_idx_type [new_nnz]; + for (octave_idx_type i = 0; i < new_nnz; i++) new_ridx[i] = r[i]; delete [] r; r = new_ridx; } else { - int new_nnz = nnz - ndel - nzero; + octave_idx_type new_nnz = nnz - ndel - nzero; T *new_data = new T [new_nnz]; - int *new_ridx = new int [new_nnz]; - - int ii = 0; - int ic = 0; - for (int j = 0; j < ncols; j++) + octave_idx_type *new_ridx = new octave_idx_type [new_nnz]; + + octave_idx_type ii = 0; + octave_idx_type ic = 0; + for (octave_idx_type j = 0; j < ncols; j++) { - for (int k = ic; k < c[j+1]; k++) + for (octave_idx_type k = ic; k < c[j+1]; k++) if (d[k] != T ()) { new_data [ii] = d[k]; @@ -167,28 +167,28 @@ template void -Sparse::SparseRep::change_length (int nz) +Sparse::SparseRep::change_length (octave_idx_type nz) { if (nz != nnz) { - int min_nnz = (nz < nnz ? nz : nnz); - - int * new_ridx = new int [nz]; - for (int i = 0; i < min_nnz; i++) + octave_idx_type min_nnz = (nz < nnz ? nz : nnz); + + octave_idx_type * new_ridx = new octave_idx_type [nz]; + for (octave_idx_type i = 0; i < min_nnz; i++) new_ridx[i] = r[i]; delete [] r; r = new_ridx; T * new_data = new T [nz]; - for (int i = 0; i < min_nnz; i++) + for (octave_idx_type i = 0; i < min_nnz; i++) new_data[i] = d[i]; delete [] d; d = new_data; if (nz < nnz) - for (int i = 0; i <= ncols; i++) + for (octave_idx_type i = 0; i <= ncols; i++) if (c[i] > nz) c[i] = nz; @@ -207,29 +207,29 @@ { rep = new typename Sparse::SparseRep (rows (), cols (), a.nnz ()); - int nz = nnz (); - int nc = cols (); - for (int i = 0; i < nz; i++) + octave_idx_type nz = nnz (); + octave_idx_type nc = cols (); + for (octave_idx_type i = 0; i < nz; i++) { xdata (i) = T (a.data (i)); xridx (i) = a.ridx (i); } - for (int i = 0; i < nc + 1; i++) + for (octave_idx_type i = 0; i < nc + 1; i++) xcidx (i) = a.cidx (i); } } template -Sparse::Sparse (int nr, int nc, T val) +Sparse::Sparse (octave_idx_type nr, octave_idx_type nc, T val) : rep (new typename Sparse::SparseRep (nr, nc, nr*nc)), dimensions (dim_vector (nr, nc)), idx (0), idx_count (0) { - int ii = 0; + octave_idx_type ii = 0; xcidx (0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { xdata (ii) = val; xridx (ii++) = i; @@ -266,42 +266,42 @@ else { dim_vector old_dims = a.dims(); - int new_nnz = a.nnz (); - int new_nr = dv (0); - int new_nc = dv (1); - int old_nr = old_dims (0); - int old_nc = old_dims (1); + octave_idx_type new_nnz = a.nnz (); + octave_idx_type new_nr = dv (0); + octave_idx_type new_nc = dv (1); + octave_idx_type old_nr = old_dims (0); + octave_idx_type old_nc = old_dims (1); rep = new typename Sparse::SparseRep (new_nr, new_nc, new_nnz); - int kk = 0; + octave_idx_type kk = 0; xcidx(0) = 0; - for (int i = 0; i < old_nc; i++) - for (int j = a.cidx(i); j < a.cidx(i+1); j++) + for (octave_idx_type i = 0; i < old_nc; i++) + for (octave_idx_type j = a.cidx(i); j < a.cidx(i+1); j++) { - int tmp = i * old_nr + a.ridx(j); - int ii = tmp % new_nr; - int jj = (tmp - ii) / new_nr; - for (int k = kk; k < jj; k++) + 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; + for (octave_idx_type k = kk; k < jj; k++) xcidx(k+1) = j; kk = jj; xdata(j) = a.data(j); xridx(j) = ii; } - for (int k = kk; k < new_nc; k++) + for (octave_idx_type k = kk; k < new_nc; k++) xcidx(k+1) = new_nnz; } } template -Sparse::Sparse (const Array& a, const Array& r, - const Array& c, int nr, - int nc, bool sum_terms) +Sparse::Sparse (const Array& a, const Array& r, + const Array& c, octave_idx_type nr, + octave_idx_type nc, bool sum_terms) : dimensions (dim_vector (nr, nc)), idx (0), idx_count (0) { - int a_len = a.length (); - int r_len = r.length (); - int c_len = c.length (); + octave_idx_type a_len = a.length (); + octave_idx_type r_len = r.length (); + octave_idx_type c_len = c.length (); bool ri_scalar = (r_len == 1); bool ci_scalar = (c_len == 1); bool cf_scalar = (a_len == 1); @@ -311,26 +311,26 @@ (r_len != c_len && !ri_scalar && !ci_scalar) || nr < 0 || nc < 0) { (*current_liboctave_error_handler) - ("Sparse::Sparse (const Array&, const Array&, ...): dimension mismatch"); + ("Sparse::Sparse (const Array&, const Array&, ...): dimension mismatch"); rep = nil_rep (); dimensions = dim_vector (0, 0); } else { - int max_nnz = (r_len > c_len ? r_len : c_len); + octave_idx_type max_nnz = (r_len > c_len ? r_len : c_len); OCTAVE_LOCAL_BUFFER (octave_sparse_sort_idxl *, sidx, max_nnz); OCTAVE_LOCAL_BUFFER (octave_sparse_sort_idxl, sidxX, max_nnz); - for (int i = 0; i < max_nnz; i++) + for (octave_idx_type i = 0; i < max_nnz; i++) sidx[i] = &sidxX[i]; - int actual_nnz = 0; + octave_idx_type actual_nnz = 0; OCTAVE_QUIT; - for (int i = 0; i < max_nnz; i++) + for (octave_idx_type i = 0; i < max_nnz; i++) { - int rowidx = (ri_scalar ? r(0) : r(i)); - int colidx = (ci_scalar ? c(0) : c(i)); + octave_idx_type rowidx = (ri_scalar ? r(0) : r(i)); + octave_idx_type colidx = (ci_scalar ? c(0) : c(i)); if (rowidx < nr && rowidx >= 0 && colidx < nc && colidx >= 0 ) { @@ -365,33 +365,33 @@ OCTAVE_QUIT; // Now count the unique non-zero values - int real_nnz = 1; - for (int i = 1; i < actual_nnz; i++) + octave_idx_type real_nnz = 1; + for (octave_idx_type i = 1; i < actual_nnz; i++) if (sidx[i-1]->r != sidx[i]->r || sidx[i-1]->c != sidx[i]->c) real_nnz++; rep = new typename Sparse::SparseRep (nr, nc, real_nnz); - int cx = 0; - int prev_rval = -1; - int prev_cval = -1; - int ii = -1; + octave_idx_type cx = 0; + octave_idx_type prev_rval = -1; + octave_idx_type prev_cval = -1; + octave_idx_type ii = -1; xcidx (0) = 0; - for (int i = 0; i < actual_nnz; i++) + for (octave_idx_type i = 0; i < actual_nnz; i++) { OCTAVE_QUIT; - int iidx = sidx[i]->idx; - int rval = sidx[i]->r; - int cval = sidx[i]->c; + octave_idx_type iidx = sidx[i]->idx; + octave_idx_type rval = sidx[i]->r; + octave_idx_type cval = sidx[i]->c; if (prev_cval < cval || (prev_rval < rval && prev_cval == cval)) { - int ci = static_cast (c (ci_scalar ? 0 : iidx)); + octave_idx_type ci = static_cast (c (ci_scalar ? 0 : iidx)); ii++; while (cx < ci) xcidx (++cx) = ii; xdata(ii) = a (cf_scalar ? 0 : iidx); - xridx(ii) = static_cast (r (ri_scalar ? 0 : iidx)); + xridx(ii) = static_cast (r (ri_scalar ? 0 : iidx)); } else { @@ -412,13 +412,13 @@ template Sparse::Sparse (const Array& a, const Array& r, - const Array& c, int nr, - int nc, bool sum_terms) + const Array& c, octave_idx_type nr, + octave_idx_type nc, bool sum_terms) : dimensions (dim_vector (nr, nc)), idx (0), idx_count (0) { - int a_len = a.length (); - int r_len = r.length (); - int c_len = c.length (); + octave_idx_type a_len = a.length (); + octave_idx_type r_len = r.length (); + octave_idx_type c_len = c.length (); bool ri_scalar = (r_len == 1); bool ci_scalar = (c_len == 1); bool cf_scalar = (a_len == 1); @@ -434,21 +434,21 @@ } else { - int max_nnz = (r_len > c_len ? r_len : c_len); + octave_idx_type max_nnz = (r_len > c_len ? r_len : c_len); OCTAVE_LOCAL_BUFFER (octave_sparse_sort_idxl *, sidx, max_nnz); OCTAVE_LOCAL_BUFFER (octave_sparse_sort_idxl, sidxX, max_nnz); - for (int i = 0; i < max_nnz; i++) + for (octave_idx_type i = 0; i < max_nnz; i++) sidx[i] = &sidxX[i]; - int actual_nnz = 0; + octave_idx_type actual_nnz = 0; OCTAVE_QUIT; - for (int i = 0; i < max_nnz; i++) + for (octave_idx_type i = 0; i < max_nnz; i++) { - int rowidx = static_cast (ri_scalar ? r(0) : r(i)); - int colidx = static_cast (ci_scalar ? c(0) : c(i)); + octave_idx_type rowidx = static_cast (ri_scalar ? r(0) : r(i)); + octave_idx_type colidx = static_cast (ci_scalar ? c(0) : c(i)); if (rowidx < nr && rowidx >= 0 && colidx < nc && colidx >= 0 ) { @@ -483,34 +483,34 @@ OCTAVE_QUIT; // Now count the unique non-zero values - int real_nnz = 1; - for (int i = 1; i < actual_nnz; i++) + octave_idx_type real_nnz = 1; + for (octave_idx_type i = 1; i < actual_nnz; i++) if (sidx[i-1]->r != sidx[i]->r || sidx[i-1]->c != sidx[i]->c) real_nnz++; rep = new typename Sparse::SparseRep (nr, nc, real_nnz); - int cx = 0; - int prev_rval = -1; - int prev_cval = -1; - int ii = -1; + octave_idx_type cx = 0; + octave_idx_type prev_rval = -1; + octave_idx_type prev_cval = -1; + octave_idx_type ii = -1; xcidx (0) = 0; - for (int i = 0; i < actual_nnz; i++) + for (octave_idx_type i = 0; i < actual_nnz; i++) { OCTAVE_QUIT; - int iidx = sidx[i]->idx; - int rval = sidx[i]->r; - int cval = sidx[i]->c; + octave_idx_type iidx = sidx[i]->idx; + octave_idx_type rval = sidx[i]->r; + octave_idx_type cval = sidx[i]->c; if (prev_cval < cval || (prev_rval < rval && prev_cval == cval)) { - int ci = static_cast (c (ci_scalar ? 0 : iidx)); + octave_idx_type ci = static_cast (c (ci_scalar ? 0 : iidx)); ii++; while (cx < ci) xcidx (++cx) = ii; xdata(ii) = a (cf_scalar ? 0 : iidx); - xridx(ii) = static_cast (r (ri_scalar ? 0 : iidx)); + xridx(ii) = static_cast (r (ri_scalar ? 0 : iidx)); } else { @@ -533,23 +533,23 @@ Sparse::Sparse (const Array2& a) : dimensions (a.dims ()), idx (0), idx_count (0) { - int nr = rows (); - int nc = cols (); - int len = a.length (); - int new_nnz = 0; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type len = a.length (); + octave_idx_type new_nnz = 0; // First count the number of non-zero terms - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) if (a(i) != T ()) new_nnz++; rep = new typename Sparse::SparseRep (nr, nc, new_nnz); - int ii = 0; + octave_idx_type ii = 0; xcidx(0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (a.elem (i,j) != T ()) { xdata(ii) = a.elem (i,j); @@ -568,23 +568,23 @@ ("Sparse::Sparse (const Array&): dimension mismatch"); else { - int nr = rows (); - int nc = cols (); - int len = a.length (); - int new_nnz = 0; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type len = a.length (); + octave_idx_type new_nnz = 0; // First count the number of non-zero terms - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) if (a(i) != T ()) new_nnz++; rep = new typename Sparse::SparseRep (nr, nc, new_nnz); - int ii = 0; + octave_idx_type ii = 0; xcidx(0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (a.elem (i,j) != T ()) { xdata(ii) = a.elem (i,j); @@ -605,12 +605,12 @@ } template -int -Sparse::compute_index (const Array& ra_idx) const +octave_idx_type +Sparse::compute_index (const Array& ra_idx) const { - int retval = -1; - - int n = dimensions.length (); + octave_idx_type retval = -1; + + octave_idx_type n = dimensions.length (); if (n > 0 && n == ra_idx.length ()) { @@ -631,7 +631,7 @@ template T -Sparse::range_error (const char *fcn, int n) const +Sparse::range_error (const char *fcn, octave_idx_type n) const { (*current_liboctave_error_handler) ("%s (%d): range error", fcn, n); return T (); @@ -639,7 +639,7 @@ template T& -Sparse::range_error (const char *fcn, int n) +Sparse::range_error (const char *fcn, octave_idx_type n) { (*current_liboctave_error_handler) ("%s (%d): range error", fcn, n); static T foo; @@ -648,7 +648,7 @@ template T -Sparse::range_error (const char *fcn, int i, int j) const +Sparse::range_error (const char *fcn, octave_idx_type i, octave_idx_type j) const { (*current_liboctave_error_handler) ("%s (%d, %d): range error", fcn, i, j); @@ -657,7 +657,7 @@ template T& -Sparse::range_error (const char *fcn, int i, int j) +Sparse::range_error (const char *fcn, octave_idx_type i, octave_idx_type j) { (*current_liboctave_error_handler) ("%s (%d, %d): range error", fcn, i, j); @@ -667,18 +667,18 @@ template T -Sparse::range_error (const char *fcn, const Array& ra_idx) const +Sparse::range_error (const char *fcn, const Array& ra_idx) const { OSSTREAM buf; buf << fcn << " ("; - int n = ra_idx.length (); + octave_idx_type n = ra_idx.length (); if (n > 0) buf << ra_idx(0); - for (int i = 1; i < n; i++) + for (octave_idx_type i = 1; i < n; i++) buf << ", " << ra_idx(i); buf << "): range error"; @@ -694,18 +694,18 @@ template T& -Sparse::range_error (const char *fcn, const Array& ra_idx) +Sparse::range_error (const char *fcn, const Array& ra_idx) { OSSTREAM buf; buf << fcn << " ("; - int n = ra_idx.length (); + octave_idx_type n = ra_idx.length (); if (n > 0) buf << ra_idx(0); - for (int i = 1; i < n; i++) + for (octave_idx_type i = 1; i < n; i++) buf << ", " << ra_idx(i); buf << "): range error"; @@ -730,28 +730,28 @@ { if (dimensions.numel () == new_dims.numel ()) { - int new_nnz = nnz (); - int new_nr = new_dims (0); - int new_nc = new_dims (1); - int old_nr = rows (); - int old_nc = cols (); + octave_idx_type new_nnz = nnz (); + octave_idx_type new_nr = new_dims (0); + octave_idx_type new_nc = new_dims (1); + octave_idx_type old_nr = rows (); + octave_idx_type old_nc = cols (); retval = Sparse (new_nr, new_nc, new_nnz); - int kk = 0; + octave_idx_type kk = 0; retval.xcidx(0) = 0; - for (int i = 0; i < old_nc; i++) - for (int j = cidx(i); j < cidx(i+1); j++) + for (octave_idx_type i = 0; i < old_nc; i++) + for (octave_idx_type j = cidx(i); j < cidx(i+1); j++) { - int tmp = i * old_nr + ridx(j); - int ii = tmp % new_nr; - int jj = (tmp - ii) / new_nr; - for (int k = kk; k < jj; k++) + octave_idx_type tmp = i * old_nr + ridx(j); + octave_idx_type ii = tmp % 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; retval.xdata(j) = data(j); retval.xridx(j) = ii; } - for (int k = kk; k < new_nc; k++) + for (octave_idx_type k = kk; k < new_nc; k++) retval.xcidx(k+1) = new_nnz; } else @@ -765,12 +765,12 @@ template Sparse -Sparse::permute (const Array& perm_vec, bool) const +Sparse::permute (const Array& perm_vec, bool) const { dim_vector dv = dims (); dim_vector dv_new; - int nd = dv.length (); + octave_idx_type nd = dv.length (); dv_new.resize (nd); @@ -778,9 +778,9 @@ Array checked (nd, false); // Find dimension vector of permuted array. - for (int i = 0; i < nd; i++) + for (octave_idx_type i = 0; i < nd; i++) { - int perm_el = perm_vec.elem (i); + octave_idx_type perm_el = perm_vec.elem (i); if (perm_el > dv.length () || perm_el < 1) { @@ -813,7 +813,7 @@ void Sparse::resize_no_fill (const dim_vector& dv) { - int n = dv.length (); + octave_idx_type n = dv.length (); if (n != 2) { @@ -826,7 +826,7 @@ template void -Sparse::resize_no_fill (int r, int c) +Sparse::resize_no_fill (octave_idx_type r, octave_idx_type c) { if (r < 0 || c < 0) { @@ -842,8 +842,8 @@ return; typename Sparse::SparseRep *old_rep = Sparse::rep; - int nc = cols (); - int nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nr = rows (); if (nnz () == 0 || r == 0 || c == 0) // Special case of redimensioning to/from a sparse matrix with @@ -851,7 +851,7 @@ rep = new typename Sparse::SparseRep (r, c); else { - int n = 0; + octave_idx_type n = 0; Sparse tmpval; if (r >= nr) { @@ -864,16 +864,16 @@ if (c > nc) { - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) tmpval.cidx(i) = cidx(i); - for (int i = nc+2; i < c; i++) + for (octave_idx_type i = nc+2; i < c; i++) tmpval.cidx(i) = tmpval.cidx(i-1); } else if (c <= nc) - for (int i = 0; i < c; i++) + for (octave_idx_type i = 0; i < c; i++) tmpval.cidx(i) = cidx(i); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { tmpval.data(i) = data(i); tmpval.ridx(i) = ridx(i); @@ -882,8 +882,8 @@ else { // Count how many non zero terms before we do anything - for (int i = 0; i < c; i++) - for (int j = cidx(i); j < cidx(i+1); j++) + for (octave_idx_type i = 0; i < c; i++) + for (octave_idx_type j = cidx(i); j < cidx(i+1); j++) if (ridx(j) < r) n++; @@ -893,9 +893,9 @@ tmpval = Sparse (r, c, n); tmpval.cidx(0); - for (int i = 0, ii = 0; i < c; i++) + for (octave_idx_type i = 0, ii = 0; i < c; i++) { - for (int j = cidx(i); j < cidx(i+1); j++) + for (octave_idx_type j = cidx(i); j < cidx(i+1); j++) if (ridx(j) < r) { tmpval.data(ii) = data(j); @@ -920,12 +920,12 @@ template Sparse& -Sparse::insert (const Sparse& a, int r, int c) +Sparse::insert (const Sparse& a, octave_idx_type r, octave_idx_type c) { - int a_rows = a.rows (); - int a_cols = a.cols (); - int nr = rows (); - int nc = cols (); + octave_idx_type a_rows = a.rows (); + octave_idx_type a_cols = a.cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (r < 0 || r + a_rows > rows () || c < 0 || c + a_cols > cols ()) { @@ -934,13 +934,13 @@ } // First count the number of elements in the final array - int nel = cidx(c) + a.nnz (); + octave_idx_type nel = cidx(c) + a.nnz (); if (c + a_cols < nc) nel += cidx(nc) - cidx(c + a_cols); - for (int i = c; i < c + a_cols; i++) - for (int j = cidx(i); j < cidx(i+1); j++) + for (octave_idx_type i = c; i < c + a_cols; i++) + for (octave_idx_type j = cidx(i); j < cidx(i+1); j++) if (ridx(j) < r || ridx(j) >= r + a_rows) nel++; @@ -948,21 +948,21 @@ --rep->count; rep = new typename Sparse::SparseRep (nr, nc, nel); - for (int i = 0; i < tmp.cidx(c); i++) + for (octave_idx_type i = 0; i < tmp.cidx(c); i++) { data(i) = tmp.data(i); ridx(i) = tmp.ridx(i); } - for (int i = 0; i < c + 1; i++) + for (octave_idx_type i = 0; i < c + 1; i++) cidx(i) = tmp.cidx(i); - int ii = cidx(c); - - for (int i = c; i < c + a_cols; i++) + octave_idx_type ii = cidx(c); + + for (octave_idx_type i = c; i < c + a_cols; i++) { OCTAVE_QUIT; - for (int j = tmp.cidx(i); j < tmp.cidx(i+1); j++) + for (octave_idx_type j = tmp.cidx(i); j < tmp.cidx(i+1); j++) if (tmp.ridx(j) < r) { data(ii) = tmp.data(j); @@ -971,7 +971,7 @@ OCTAVE_QUIT; - for (int j = a.cidx(i-c); j < a.cidx(i-c+1); j++) + for (octave_idx_type j = a.cidx(i-c); j < a.cidx(i-c+1); j++) { data(ii) = a.data(j); ridx(ii++) = r + a.ridx(j); @@ -979,7 +979,7 @@ OCTAVE_QUIT; - for (int j = tmp.cidx(i); j < tmp.cidx(i+1); j++) + for (octave_idx_type j = tmp.cidx(i); j < tmp.cidx(i+1); j++) if (tmp.ridx(j) >= r + a_rows) { data(ii) = tmp.data(j); @@ -989,9 +989,9 @@ cidx(i+1) = ii; } - for (int i = c + a_cols; i < nc; i++) + for (octave_idx_type i = c + a_cols; i < nc; i++) { - for (int j = tmp.cidx(i); j < tmp.cidx(i+1); j++) + for (octave_idx_type j = tmp.cidx(i); j < tmp.cidx(i+1); j++) { data(ii) = tmp.data(j); ridx(ii++) = tmp.ridx(j); @@ -1004,7 +1004,7 @@ template Sparse& -Sparse::insert (const Sparse& a, const Array& ra_idx) +Sparse::insert (const Sparse& a, const Array& ra_idx) { if (ra_idx.length () != 2) @@ -1022,16 +1022,16 @@ { assert (ndims () == 2); - int nr = rows (); - int nc = cols (); - int nz = nnz (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); Sparse retval (nc, nr, nz); retval.cidx(0) = 0; - for (int i = 0, iidx = 0; i < nr; i++) + for (octave_idx_type i = 0, iidx = 0; i < nr; i++) { - for (int j = 0; j < nc; j++) - for (int k = cidx(j); k < cidx(j+1); k++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type k = cidx(j); k < cidx(j+1); k++) if (ridx(k) == i) { retval.data(iidx) = data(k); @@ -1056,7 +1056,7 @@ void Sparse::set_index (const idx_vector& idx_arg) { - int nd = ndims (); + octave_idx_type nd = ndims (); if (! idx && nd > 0) idx = new idx_vector [nd]; @@ -1069,7 +1069,7 @@ { idx_vector *new_idx = new idx_vector [idx_count+1]; - for (int i = 0; i < idx_count; i++) + for (octave_idx_type i = 0; i < idx_count; i++) new_idx[i] = idx[i]; new_idx[idx_count++] = idx_arg; @@ -1084,13 +1084,13 @@ void Sparse::maybe_delete_elements (idx_vector& idx_arg) { - int nr = dim1 (); - int nc = dim2 (); + octave_idx_type nr = dim1 (); + octave_idx_type nc = dim2 (); if (nr == 0 && nc == 0) return; - int n; + octave_idx_type n; if (nr == 1) n = nc; else if (nc == 1) @@ -1117,18 +1117,18 @@ idx_arg.sort (true); - int num_to_delete = idx_arg.length (n); + octave_idx_type num_to_delete = idx_arg.length (n); if (num_to_delete != 0) { - int new_n = n; - int new_nnz = nnz (); - - int iidx = 0; + octave_idx_type new_n = n; + octave_idx_type new_nnz = nnz (); + + octave_idx_type iidx = 0; const Sparse tmp (*this); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; @@ -1154,10 +1154,10 @@ else rep = new typename Sparse::SparseRep (new_n, 1, new_nnz); - int ii = 0; - int jj = 0; + octave_idx_type ii = 0; + octave_idx_type jj = 0; iidx = 0; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; @@ -1181,7 +1181,7 @@ { ii = 0; cidx(0) = 0; - for (int i = 0; i < new_n; i++) + for (octave_idx_type i = 0; i < new_n; i++) { OCTAVE_QUIT; if (ridx(ii) == i) @@ -1212,8 +1212,8 @@ { assert (ndims () == 2); - int nr = dim1 (); - int nc = dim2 (); + octave_idx_type nr = dim1 (); + octave_idx_type nc = dim2 (); if (nr == 0 && nc == 0) return; @@ -1258,7 +1258,7 @@ { idx_j.sort (true); - int num_to_delete = idx_j.length (nc); + octave_idx_type num_to_delete = idx_j.length (nc); if (num_to_delete != 0) { @@ -1266,12 +1266,12 @@ resize_no_fill (0, 0); else { - int new_nc = nc; - int new_nnz = nnz (); - - int iidx = 0; - - for (int j = 0; j < nc; j++) + octave_idx_type new_nc = nc; + octave_idx_type new_nnz = nnz (); + + octave_idx_type iidx = 0; + + for (octave_idx_type j = 0; j < nc; j++) { OCTAVE_QUIT; @@ -1293,11 +1293,11 @@ --rep->count; rep = new typename Sparse::SparseRep (nr, new_nc, new_nnz); - int ii = 0; - int jj = 0; + octave_idx_type ii = 0; + octave_idx_type jj = 0; iidx = 0; cidx(0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { OCTAVE_QUIT; @@ -1305,7 +1305,7 @@ iidx++; else { - for (int i = tmp.cidx(j); + for (octave_idx_type i = tmp.cidx(j); i < tmp.cidx(j+1); i++) { data(jj) = tmp.data(i); @@ -1333,7 +1333,7 @@ { idx_i.sort (true); - int num_to_delete = idx_i.length (nr); + octave_idx_type num_to_delete = idx_i.length (nr); if (num_to_delete != 0) { @@ -1341,12 +1341,12 @@ resize_no_fill (0, 0); else { - int new_nr = nr; - int new_nnz = nnz (); - - int iidx = 0; - - for (int i = 0; i < nr; i++) + octave_idx_type new_nr = nr; + octave_idx_type new_nnz = nnz (); + + octave_idx_type iidx = 0; + + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; @@ -1355,7 +1355,7 @@ iidx++; new_nr--; - for (int j = 0; j < nnz (); j++) + for (octave_idx_type j = 0; j < nnz (); j++) if (ridx(j) == i) new_nnz--; @@ -1371,16 +1371,16 @@ rep = new typename Sparse::SparseRep (new_nr, nc, new_nnz); - int jj = 0; + octave_idx_type jj = 0; cidx(0) = 0; - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { iidx = 0; - for (int j = tmp.cidx(i); j < tmp.cidx(i+1); j++) + for (octave_idx_type j = tmp.cidx(i); j < tmp.cidx(i+1); j++) { OCTAVE_QUIT; - int ri = tmp.ridx(j); + octave_idx_type ri = tmp.ridx(j); while (iidx < num_to_delete && ri > idx_i.elem (iidx)) @@ -1461,16 +1461,16 @@ assert (ndims () == 2); - int nr = dim1 (); - int nc = dim2 (); - int nz = nnz (); - - int orig_len = nr * nc; + octave_idx_type nr = dim1 (); + octave_idx_type nc = dim2 (); + octave_idx_type nz = nnz (); + + octave_idx_type orig_len = nr * nc; dim_vector idx_orig_dims = idx_arg.orig_dimensions (); - int idx_orig_rows = idx_arg.orig_rows (); - int idx_orig_columns = idx_arg.orig_columns (); + octave_idx_type idx_orig_rows = idx_arg.orig_rows (); + octave_idx_type idx_orig_columns = idx_arg.orig_columns (); if (idx_orig_dims.length () > 2) (*current_liboctave_error_handler) @@ -1480,8 +1480,8 @@ // Fast magic colon processing. retval = Sparse (nr * nc, 1, nz); - for (int i = 0; i < nc; i++) - for (int j = cidx(i); j < cidx(i+1); j++) + for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type j = cidx(i); j < cidx(i+1); j++) { OCTAVE_QUIT; retval.xdata(j) = data(j); @@ -1497,7 +1497,7 @@ // then want to make a dense matrix with sparse // representation. Ok, we'll do it, but you deserve what // you get!! - int n = idx_arg.freeze (length (), "sparse vector", resize_ok); + octave_idx_type n = idx_arg.freeze (length (), "sparse vector", resize_ok); if (n == 0) if (idx_arg.one_zero_only ()) retval = Sparse (dim_vector (0, 0)); @@ -1511,20 +1511,20 @@ else if (n >= idx_orig_dims.numel ()) { T el = elem (0); - int new_nr = idx_orig_rows; - int new_nc = idx_orig_columns; - for (int i = 2; i < idx_orig_dims.length (); i++) + octave_idx_type new_nr = idx_orig_rows; + octave_idx_type new_nc = idx_orig_columns; + for (octave_idx_type i = 2; i < idx_orig_dims.length (); i++) new_nc *= idx_orig_dims (i); retval = Sparse (new_nr, new_nc, idx_arg.ones_count ()); - int ic = 0; - for (int i = 0; i < n; i++) + octave_idx_type ic = 0; + for (octave_idx_type i = 0; i < n; i++) { if (i % new_nr == 0) retval.xcidx(i % new_nr) = ic; - int ii = idx_arg.elem (i); + octave_idx_type ii = idx_arg.elem (i); if (ii == 0) { OCTAVE_QUIT; @@ -1539,7 +1539,7 @@ T el = elem (0); retval = Sparse (n, 1, nz); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { OCTAVE_QUIT; retval.xdata(i) = el; @@ -1554,8 +1554,8 @@ // If indexing a vector with a matrix, return value has same // shape as the index. Otherwise, it has same orientation as // indexed object. - int len = length (); - int n = idx_arg.freeze (len, "sparse vector", resize_ok); + octave_idx_type len = length (); + octave_idx_type n = idx_arg.freeze (len, "sparse vector", resize_ok); if (n == 0) if (nr == 1) @@ -1571,23 +1571,23 @@ else { - int new_nnz = 0; + octave_idx_type new_nnz = 0; if (nr == 1) - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; - int ii = idx_arg.elem (i); + octave_idx_type ii = idx_arg.elem (i); if (ii < len) if (cidx(ii) != cidx(ii+1)) new_nnz++; } else - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { - int ii = idx_arg.elem (i); + octave_idx_type ii = idx_arg.elem (i); if (ii < len) - for (int j = 0; j < nz; j++) + for (octave_idx_type j = 0; j < nz; j++) { OCTAVE_QUIT; @@ -1604,13 +1604,13 @@ if (nr == 1) { retval = Sparse (1, n, new_nnz); - int jj = 0; + octave_idx_type jj = 0; retval.xcidx(0) = 0; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; - int ii = idx_arg.elem (i); + octave_idx_type ii = idx_arg.elem (i); if (ii < len) if (cidx(ii) != cidx(ii+1)) { @@ -1625,12 +1625,12 @@ retval = Sparse (n, 1, new_nnz); retval.xcidx(0) = 0; retval.xcidx(1) = new_nnz; - int jj = 0; - for (int i = 0; i < n; i++) + octave_idx_type jj = 0; + for (octave_idx_type i = 0; i < n; i++) { - int ii = idx_arg.elem (i); + octave_idx_type ii = idx_arg.elem (i); if (ii < len) - for (int j = 0; j < nz; j++) + for (octave_idx_type j = 0; j < nz; j++) { OCTAVE_QUIT; @@ -1647,8 +1647,8 @@ } else { - int new_nr; - int new_nc; + octave_idx_type new_nr; + octave_idx_type new_nc; if (n >= idx_orig_dims.numel ()) { new_nr = idx_orig_rows; @@ -1664,13 +1664,13 @@ if (nr == 1) { - int jj = 0; + octave_idx_type jj = 0; retval.xcidx(0) = 0; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; - int ii = idx_arg.elem (i); + octave_idx_type ii = idx_arg.elem (i); if (ii < len) if (cidx(ii) != cidx(ii+1)) { @@ -1682,13 +1682,13 @@ } else { - int jj = 0; + octave_idx_type jj = 0; retval.xcidx(0) = 0; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { - int ii = idx_arg.elem (i); + octave_idx_type ii = idx_arg.elem (i); if (ii < len) - for (int j = 0; j < nz; j++) + for (octave_idx_type j = 0; j < nz; j++) { OCTAVE_QUIT; @@ -1722,8 +1722,8 @@ if (idx_arg) { - int result_nr = idx_orig_rows; - int result_nc = idx_orig_columns; + octave_idx_type result_nr = idx_orig_rows; + octave_idx_type result_nc = idx_orig_columns; if (idx_arg.one_zero_only ()) { @@ -1736,20 +1736,20 @@ else { // Count number of non-zero elements - int new_nnz = 0; - int kk = 0; - for (int j = 0; j < result_nc; j++) + octave_idx_type new_nnz = 0; + octave_idx_type kk = 0; + for (octave_idx_type j = 0; j < result_nc; j++) { - for (int i = 0; i < result_nr; i++) + for (octave_idx_type i = 0; i < result_nr; i++) { OCTAVE_QUIT; - int ii = idx_arg.elem (kk++); + octave_idx_type ii = idx_arg.elem (kk++); if (ii < orig_len) { - int fr = ii % nr; - int fc = (ii - fr) / nr; - for (int k = cidx(fc); k < cidx(fc+1); k++) + octave_idx_type fr = ii % nr; + octave_idx_type fc = (ii - fr) / nr; + for (octave_idx_type k = cidx(fc); k < cidx(fc+1); k++) { if (ridx(k) == fr) new_nnz++; @@ -1763,20 +1763,20 @@ retval = Sparse (result_nr, result_nc, new_nnz); kk = 0; - int jj = 0; + octave_idx_type jj = 0; retval.xcidx(0) = 0; - for (int j = 0; j < result_nc; j++) + for (octave_idx_type j = 0; j < result_nc; j++) { - for (int i = 0; i < result_nr; i++) + for (octave_idx_type i = 0; i < result_nr; i++) { OCTAVE_QUIT; - int ii = idx_arg.elem (kk++); + octave_idx_type ii = idx_arg.elem (kk++); if (ii < orig_len) { - int fr = ii % nr; - int fc = (ii - fr) / nr; - for (int k = cidx(fc); k < cidx(fc+1); k++) + octave_idx_type fr = ii % nr; + octave_idx_type fc = (ii - fr) / nr; + for (octave_idx_type k = cidx(fc); k < cidx(fc+1); k++) { if (ridx(k) == fr) { @@ -1806,11 +1806,11 @@ assert (ndims () == 2); - int nr = dim1 (); - int nc = dim2 (); - - int n = idx_i.freeze (nr, "row", resize_ok); - int m = idx_j.freeze (nc, "column", resize_ok); + octave_idx_type nr = dim1 (); + octave_idx_type nc = dim2 (); + + octave_idx_type n = idx_i.freeze (nr, "row", resize_ok); + octave_idx_type m = idx_j.freeze (nc, "column", resize_ok); if (idx_i && idx_j) { @@ -1825,18 +1825,18 @@ else { // First count the number of non-zero elements - int new_nnz = 0; - for (int j = 0; j < m; j++) + octave_idx_type new_nnz = 0; + for (octave_idx_type j = 0; j < m; j++) { - int jj = idx_j.elem (j); - for (int i = 0; i < n; i++) + octave_idx_type jj = idx_j.elem (j); + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; - int ii = idx_i.elem (i); + octave_idx_type ii = idx_i.elem (i); if (ii < nr && jj < nc) { - for (int k = cidx(jj); k < cidx(jj+1); k++) + for (octave_idx_type k = cidx(jj); k < cidx(jj+1); k++) { if (ridx(k) == ii) new_nnz++; @@ -1849,19 +1849,19 @@ retval = Sparse (n, m, new_nnz); - int kk = 0; + octave_idx_type kk = 0; retval.xcidx(0) = 0; - for (int j = 0; j < m; j++) + for (octave_idx_type j = 0; j < m; j++) { - int jj = idx_j.elem (j); - for (int i = 0; i < n; i++) + octave_idx_type jj = idx_j.elem (j); + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; - int ii = idx_i.elem (i); + octave_idx_type ii = idx_i.elem (i); if (ii < nr && jj < nc) { - for (int k = cidx(jj); k < cidx(jj+1); k++) + for (octave_idx_type k = cidx(jj); k < cidx(jj+1); k++) { if (ridx(k) == ii) { @@ -1910,8 +1910,8 @@ idx_vector lhs_idx = idx_tmp[0]; - int lhs_len = lhs.numel (); - int rhs_len = rhs.numel (); + octave_idx_type lhs_len = lhs.numel (); + octave_idx_type rhs_len = rhs.numel (); unsigned EIGHT_BYTE_INT long_lhs_len = static_cast (lhs.rows ()) * @@ -1933,15 +1933,15 @@ return 0; } - int nr = lhs.rows (); - int nc = lhs.cols (); - int nz = lhs.nnz (); - - int n = lhs_idx.freeze (lhs_len, "vector", true, liboctave_wrore_flag); + octave_idx_type nr = lhs.rows (); + octave_idx_type nc = lhs.cols (); + octave_idx_type nz = lhs.nnz (); + + octave_idx_type n = lhs_idx.freeze (lhs_len, "vector", true, liboctave_wrore_flag); if (n != 0) { - int max_idx = lhs_idx.max () + 1; + octave_idx_type max_idx = lhs_idx.max () + 1; max_idx = max_idx < lhs_len ? lhs_len : max_idx; // Take a constant copy of lhs. This means that elem won't @@ -1950,14 +1950,14 @@ if (rhs_len == n) { - int new_nnz = lhs.nnz (); + octave_idx_type new_nnz = lhs.nnz (); // First count the number of non-zero elements - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; - int ii = lhs_idx.elem (i); + octave_idx_type ii = lhs_idx.elem (i); if (ii < lhs_len && c_lhs.elem(ii) != LT ()) new_nnz--; if (rhs.elem(i) != RT ()) @@ -1970,15 +1970,15 @@ tmp.cidx(0) = 0; tmp.cidx(1) = tmp.nnz (); - int i = 0; - int ii = 0; + octave_idx_type i = 0; + octave_idx_type ii = 0; if (i < nz) ii = c_lhs.ridx(i); - int j = 0; - int jj = lhs_idx.elem(j); - - int kk = 0; + octave_idx_type j = 0; + octave_idx_type jj = lhs_idx.elem(j); + + octave_idx_type kk = 0; while (j < n || i < nz) { @@ -2012,16 +2012,16 @@ { Sparse tmp (1, max_idx, new_nnz); - int i = 0; - int ii = 0; + octave_idx_type i = 0; + octave_idx_type ii = 0; while (ii < nc && c_lhs.cidx(ii+1) <= i) ii++; - int j = 0; - int jj = lhs_idx.elem(j); - - int kk = 0; - int ic = 0; + octave_idx_type j = 0; + octave_idx_type jj = lhs_idx.elem(j); + + octave_idx_type kk = 0; + octave_idx_type ic = 0; while (j < n || i < nz) { @@ -2055,7 +2055,7 @@ tmp.xridx (kk++) = 0; } - for (int iidx = ic; iidx < max_idx+1; iidx++) + for (octave_idx_type iidx = ic; iidx < max_idx+1; iidx++) tmp.xcidx(iidx) = kk; lhs = tmp; @@ -2063,18 +2063,18 @@ } else if (rhs_len == 1) { - int new_nnz = lhs.nnz (); + octave_idx_type new_nnz = lhs.nnz (); RT scalar = rhs.elem (0); bool scalar_non_zero = (scalar != RT ()); // First count the number of non-zero elements if (scalar != RT ()) new_nnz += n; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; - int ii = lhs_idx.elem (i); + octave_idx_type ii = lhs_idx.elem (i); if (ii < lhs_len && c_lhs.elem(ii) != LT ()) new_nnz--; } @@ -2085,15 +2085,15 @@ tmp.cidx(0) = 0; tmp.cidx(1) = tmp.nnz (); - int i = 0; - int ii = 0; + octave_idx_type i = 0; + octave_idx_type ii = 0; if (i < nz) ii = c_lhs.ridx(i); - int j = 0; - int jj = lhs_idx.elem(j); - - int kk = 0; + octave_idx_type j = 0; + octave_idx_type jj = lhs_idx.elem(j); + + octave_idx_type kk = 0; while (j < n || i < nz) { @@ -2126,16 +2126,16 @@ { Sparse tmp (1, max_idx, new_nnz); - int i = 0; - int ii = 0; + octave_idx_type i = 0; + octave_idx_type ii = 0; while (ii < nc && c_lhs.cidx(ii+1) <= i) ii++; - int j = 0; - int jj = lhs_idx.elem(j); - - int kk = 0; - int ic = 0; + octave_idx_type j = 0; + octave_idx_type jj = lhs_idx.elem(j); + + octave_idx_type kk = 0; + octave_idx_type ic = 0; while (j < n || i < nz) { @@ -2167,7 +2167,7 @@ tmp.xridx (kk++) = 0; } - for (int iidx = ic; iidx < max_idx+1; iidx++) + for (octave_idx_type iidx = ic; iidx < max_idx+1; iidx++) tmp.xcidx(iidx) = kk; lhs = tmp; @@ -2186,23 +2186,23 @@ if (lhs_len == 0) { - int new_nnz = rhs.nnz (); + octave_idx_type new_nnz = rhs.nnz (); Sparse tmp (1, rhs_len, new_nnz); - int ii = 0; - int jj = 0; - for (int i = 0; i < rhs.cols(); i++) - for (int j = rhs.cidx(i); j < rhs.cidx(i+1); j++) + octave_idx_type ii = 0; + octave_idx_type jj = 0; + for (octave_idx_type i = 0; i < rhs.cols(); i++) + for (octave_idx_type j = rhs.cidx(i); j < rhs.cidx(i+1); j++) { OCTAVE_QUIT; - for (int k = jj; k <= i * rhs.rows() + rhs.ridx(j); k++) + for (octave_idx_type k = jj; k <= i * rhs.rows() + rhs.ridx(j); k++) tmp.cidx(jj++) = ii; tmp.data(ii) = rhs.data(j); tmp.ridx(ii++) = 0; } - for (int i = jj; i < rhs_len + 1; i++) + for (octave_idx_type i = jj; i < rhs_len + 1; i++) tmp.cidx(i) = ii; lhs = tmp; @@ -2232,12 +2232,12 @@ int n_idx = lhs.index_count (); - int lhs_nr = lhs.rows (); - int lhs_nc = lhs.cols (); - int lhs_nz = lhs.nnz (); - - int rhs_nr = rhs.rows (); - int rhs_nc = rhs.cols (); + octave_idx_type lhs_nr = lhs.rows (); + octave_idx_type lhs_nc = lhs.cols (); + octave_idx_type lhs_nz = lhs.nnz (); + + octave_idx_type rhs_nr = rhs.rows (); + octave_idx_type rhs_nc = rhs.cols (); idx_vector *tmp = lhs.get_idx (); @@ -2259,10 +2259,10 @@ if (n_idx == 2) { - int n = idx_i.freeze (lhs_nr, "row", true, liboctave_wrore_flag); + octave_idx_type n = idx_i.freeze (lhs_nr, "row", true, liboctave_wrore_flag); idx_i.sort (true); - int m = idx_j.freeze (lhs_nc, "column", true, liboctave_wrore_flag); + octave_idx_type m = idx_j.freeze (lhs_nc, "column", true, liboctave_wrore_flag); idx_j.sort (true); @@ -2290,32 +2290,32 @@ if (n > 0 && m > 0) { - int max_row_idx = idx_i_is_colon ? rhs_nr : + octave_idx_type max_row_idx = idx_i_is_colon ? rhs_nr : idx_i.max () + 1; - int max_col_idx = idx_j_is_colon ? rhs_nc : + octave_idx_type max_col_idx = idx_j_is_colon ? rhs_nc : idx_j.max () + 1; - int new_nr = max_row_idx > lhs_nr ? max_row_idx : + octave_idx_type new_nr = max_row_idx > lhs_nr ? max_row_idx : lhs_nr; - int new_nc = max_col_idx > lhs_nc ? max_col_idx : + octave_idx_type new_nc = max_col_idx > lhs_nc ? max_col_idx : lhs_nc; RT scalar = rhs.elem (0, 0); // Count the number of non-zero terms - int new_nnz = lhs.nnz (); - for (int j = 0; j < m; j++) + octave_idx_type new_nnz = lhs.nnz (); + for (octave_idx_type j = 0; j < m; j++) { - int jj = idx_j.elem (j); + octave_idx_type jj = idx_j.elem (j); if (jj < lhs_nc) { - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; - int ii = idx_i.elem (i); + octave_idx_type ii = idx_i.elem (i); if (ii < lhs_nr) { - for (int k = lhs.cidx(jj); + for (octave_idx_type k = lhs.cidx(jj); k < lhs.cidx(jj+1); k++) { if (lhs.ridx(k) == ii) @@ -2333,17 +2333,17 @@ Sparse stmp (new_nr, new_nc, new_nnz); - int jji = 0; - int jj = idx_j.elem (jji); - int kk = 0; + octave_idx_type jji = 0; + octave_idx_type jj = idx_j.elem (jji); + octave_idx_type kk = 0; stmp.cidx(0) = 0; - for (int j = 0; j < new_nc; j++) + for (octave_idx_type j = 0; j < new_nc; j++) { if (jji < m && jj == j) { - int iii = 0; - int ii = idx_i.elem (iii); - for (int i = 0; i < new_nr; i++) + octave_idx_type iii = 0; + octave_idx_type ii = idx_i.elem (iii); + for (octave_idx_type i = 0; i < new_nr; i++) { OCTAVE_QUIT; @@ -2359,7 +2359,7 @@ } else if (j < lhs.cols()) { - for (int k = lhs.cidx(j); + for (octave_idx_type k = lhs.cidx(j); k < lhs.cidx(j+1); k++) { if (lhs.ridx(k) == i) @@ -2377,7 +2377,7 @@ } else if (j < lhs.cols()) { - for (int i = lhs.cidx(j); + for (octave_idx_type i = lhs.cidx(j); i < lhs.cidx(j+1); i++) { stmp.data(kk) = lhs.data(i); @@ -2394,31 +2394,31 @@ { if (n > 0 && m > 0) { - int max_row_idx = idx_i_is_colon ? rhs_nr : + octave_idx_type max_row_idx = idx_i_is_colon ? rhs_nr : idx_i.max () + 1; - int max_col_idx = idx_j_is_colon ? rhs_nc : + octave_idx_type max_col_idx = idx_j_is_colon ? rhs_nc : idx_j.max () + 1; - int new_nr = max_row_idx > lhs_nr ? max_row_idx : + octave_idx_type new_nr = max_row_idx > lhs_nr ? max_row_idx : lhs_nr; - int new_nc = max_col_idx > lhs_nc ? max_col_idx : + octave_idx_type new_nc = max_col_idx > lhs_nc ? max_col_idx : lhs_nc; // Count the number of non-zero terms - int new_nnz = lhs.nnz (); - for (int j = 0; j < m; j++) + octave_idx_type new_nnz = lhs.nnz (); + for (octave_idx_type j = 0; j < m; j++) { - int jj = idx_j.elem (j); - for (int i = 0; i < n; i++) + octave_idx_type jj = idx_j.elem (j); + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; if (jj < lhs_nc) { - int ii = idx_i.elem (i); + octave_idx_type ii = idx_i.elem (i); if (ii < lhs_nr) { - for (int k = lhs.cidx(jj); + for (octave_idx_type k = lhs.cidx(jj); k < lhs.cidx(jj+1); k++) { if (lhs.ridx(k) == ii) @@ -2436,17 +2436,17 @@ Sparse stmp (new_nr, new_nc, new_nnz); - int jji = 0; - int jj = idx_j.elem (jji); - int kk = 0; + octave_idx_type jji = 0; + octave_idx_type jj = idx_j.elem (jji); + octave_idx_type kk = 0; stmp.cidx(0) = 0; - for (int j = 0; j < new_nc; j++) + for (octave_idx_type j = 0; j < new_nc; j++) { if (jji < m && jj == j) { - int iii = 0; - int ii = idx_i.elem (iii); - for (int i = 0; i < new_nr; i++) + octave_idx_type iii = 0; + octave_idx_type ii = idx_i.elem (iii); + for (octave_idx_type i = 0; i < new_nr; i++) { OCTAVE_QUIT; @@ -2463,7 +2463,7 @@ } else if (j < lhs.cols()) { - for (int k = lhs.cidx(j); + for (octave_idx_type k = lhs.cidx(j); k < lhs.cidx(j+1); k++) { if (lhs.ridx(k) == i) @@ -2481,7 +2481,7 @@ } else if (j < lhs.cols()) { - for (int i = lhs.cidx(j); + for (octave_idx_type i = lhs.cidx(j); i < lhs.cidx(j+1); i++) { stmp.data(kk) = lhs.data(i); @@ -2526,9 +2526,9 @@ if (lhs_is_empty || (lhs_nr == 1 && lhs_nc == 1)) { - int lhs_len = lhs.length (); - - int n = idx_i.freeze (lhs_len, 0, true, liboctave_wrore_flag); + octave_idx_type lhs_len = lhs.length (); + + octave_idx_type n = idx_i.freeze (lhs_len, 0, true, liboctave_wrore_flag); idx_i.sort (true); if (idx_i) @@ -2551,8 +2551,8 @@ } else { - int idx_nr = idx_i.orig_rows (); - int idx_nc = idx_i.orig_columns (); + octave_idx_type idx_nr = idx_i.orig_rows (); + octave_idx_type idx_nc = idx_i.orig_columns (); if (! (rhs_nr == idx_nr && rhs_nc == idx_nc)) (*current_liboctave_warning_handler) @@ -2604,9 +2604,9 @@ (*current_liboctave_warning_handler) ("single index used for matrix"); - int lhs_len = lhs.length (); - - int len = idx_i.freeze (lhs_nr * lhs_nc, "matrix"); + octave_idx_type lhs_len = lhs.length (); + + octave_idx_type len = idx_i.freeze (lhs_nr * lhs_nc, "matrix"); idx_i.sort (true); if (idx_i) @@ -2626,14 +2626,14 @@ } else if (len == rhs_nr * rhs_nc) { - int new_nnz = lhs_nz; + octave_idx_type new_nnz = lhs_nz; // First count the number of non-zero elements - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { OCTAVE_QUIT; - int ii = idx_i.elem (i); + octave_idx_type ii = idx_i.elem (i); if (ii < lhs_len && c_lhs.elem(ii) != LT ()) new_nnz--; if (rhs.elem(i) != RT ()) @@ -2642,9 +2642,9 @@ Sparse stmp (lhs_nr, lhs_nc, new_nnz); - int i = 0; - int ii = 0; - int ic = 0; + octave_idx_type i = 0; + octave_idx_type ii = 0; + octave_idx_type ic = 0; if (i < lhs_nz) { while (ic < lhs_nc && i >= c_lhs.cidx(ic+1)) @@ -2652,13 +2652,13 @@ ii = ic * lhs_nr + c_lhs.ridx(i); } - int j = 0; - int jj = idx_i.elem (j); - int jr = jj % lhs_nr; - int jc = (jj - jr) / lhs_nr; - - int kk = 0; - int kc = 0; + octave_idx_type j = 0; + octave_idx_type jj = idx_i.elem (j); + octave_idx_type jr = jj % lhs_nr; + octave_idx_type jc = (jj - jr) / lhs_nr; + + octave_idx_type kk = 0; + octave_idx_type kc = 0; while (j < len || i < lhs_nz) { @@ -2702,7 +2702,7 @@ } } - for (int iidx = kc; iidx < lhs_nc+1; iidx++) + for (octave_idx_type iidx = kc; iidx < lhs_nc+1; iidx++) stmp.xcidx(iidx) = kk; @@ -2711,24 +2711,24 @@ else if (rhs_nr == 1 && rhs_nc == 1) { RT scalar = rhs.elem (0, 0); - int new_nnz = lhs_nz; + octave_idx_type new_nnz = lhs_nz; // First count the number of non-zero elements if (scalar != RT ()) new_nnz += len; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { OCTAVE_QUIT; - int ii = idx_i.elem (i); + octave_idx_type ii = idx_i.elem (i); if (ii < lhs_len && c_lhs.elem(ii) != LT ()) new_nnz--; } Sparse stmp (lhs_nr, lhs_nc, new_nnz); - int i = 0; - int ii = 0; - int ic = 0; + octave_idx_type i = 0; + octave_idx_type ii = 0; + octave_idx_type ic = 0; if (i < lhs_nz) { while (ic < lhs_nc && i >= c_lhs.cidx(ic+1)) @@ -2736,13 +2736,13 @@ ii = ic * lhs_nr + c_lhs.ridx(i); } - int j = 0; - int jj = idx_i.elem (j); - int jr = jj % lhs_nr; - int jc = (jj - jr) / lhs_nr; - - int kk = 0; - int kc = 0; + octave_idx_type j = 0; + octave_idx_type jj = idx_i.elem (j); + octave_idx_type jr = jj % lhs_nr; + octave_idx_type jc = (jj - jr) / lhs_nr; + + octave_idx_type kk = 0; + octave_idx_type kc = 0; while (j < len || i < lhs_nz) { @@ -2785,7 +2785,7 @@ } } - for (int iidx = kc; iidx < lhs_nc+1; iidx++) + for (octave_idx_type iidx = kc; iidx < lhs_nc+1; iidx++) stmp.xcidx(iidx) = kk; lhs = stmp; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/Sparse.h --- a/liboctave/Sparse.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/Sparse.h Fri Apr 08 16:07:37 2005 +0000 @@ -52,76 +52,76 @@ public: T *d; - int *r; - int *c; - int nnz; - int nrows; - int ncols; + octave_idx_type *r; + octave_idx_type *c; + octave_idx_type nnz; + octave_idx_type nrows; + octave_idx_type ncols; int count; - SparseRep (void) : d (0), r (0), c (new int [1]), nnz (0), nrows (0), + SparseRep (void) : d (0), r (0), c (new octave_idx_type [1]), nnz (0), nrows (0), ncols (0), count (1) { c[0] = 0; } - SparseRep (int n) : d (0), r (0), c (new int [n+1]), nnz (0), nrows (n), + SparseRep (octave_idx_type n) : d (0), r (0), c (new octave_idx_type [n+1]), nnz (0), nrows (n), ncols (n), count (1) { - for (int i = 0; i < n + 1; i++) + for (octave_idx_type i = 0; i < n + 1; i++) c[i] = 0; } - SparseRep (int nr, int nc) : d (0), r (0), c (new int [nc+1]), nnz (0), + SparseRep (octave_idx_type nr, octave_idx_type nc) : d (0), r (0), c (new octave_idx_type [nc+1]), nnz (0), nrows (nr), ncols (nc), count (1) { - for (int i = 0; i < nc + 1; i++) + for (octave_idx_type i = 0; i < nc + 1; i++) c[i] = 0; } - SparseRep (int nr, int nc, int nz) : d (new T [nz]), - r (new int [nz]), c (new int [nc+1]), nnz (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]), nnz (nz), nrows (nr), ncols (nc), count (1) { - for (int i = 0; i < nc + 1; i++) + for (octave_idx_type i = 0; i < nc + 1; i++) c[i] = 0; } SparseRep (const SparseRep& a) - : d (new T [a.nnz]), r (new int [a.nnz]), c (new int [a.ncols + 1]), + : d (new T [a.nnz]), r (new octave_idx_type [a.nnz]), c (new octave_idx_type [a.ncols + 1]), nnz (a.nnz), nrows (a.nrows), ncols (a.ncols), count (1) { - for (int i = 0; i < nnz; i++) + for (octave_idx_type i = 0; i < nnz; i++) { d[i] = a.d[i]; r[i] = a.r[i]; } - for (int i = 0; i < ncols + 1; i++) + for (octave_idx_type i = 0; i < ncols + 1; i++) c[i] = a.c[i]; } ~SparseRep (void) { delete [] d; delete [] r; delete [] c; } - int length (void) const { return nnz; } + octave_idx_type length (void) const { return nnz; } - int nonzero (void) const { return c [ncols]; } + octave_idx_type nonzero (void) const { return c [ncols]; } - T& elem (int _r, int _c); + T& elem (octave_idx_type _r, octave_idx_type _c); - T celem (int _r, int _c) const; + T celem (octave_idx_type _r, octave_idx_type _c) const; - T& data (int i) { return d[i]; } + T& data (octave_idx_type i) { return d[i]; } - T cdata (int i) const { return d[i]; } + T cdata (octave_idx_type i) const { return d[i]; } - int& ridx (int i) { return r[i]; } + octave_idx_type& ridx (octave_idx_type i) { return r[i]; } - int cridx (int i) const { return r[i]; } + octave_idx_type cridx (octave_idx_type i) const { return r[i]; } - int& cidx (int i) { return c[i]; } + octave_idx_type& cidx (octave_idx_type i) { return c[i]; } - int ccidx (int i) const { return c[i]; } + octave_idx_type ccidx (octave_idx_type i) const { return c[i]; } void maybe_compress (bool remove_zeros); - void change_length (int nz); + void change_length (octave_idx_type nz); private: @@ -152,7 +152,7 @@ protected: idx_vector *idx; - int idx_count; + octave_idx_type idx_count; private: @@ -172,21 +172,21 @@ : rep (nil_rep ()), dimensions (dim_vector(0,0)), idx (0), idx_count (0) { } - explicit Sparse (int n) + explicit Sparse (octave_idx_type n) : rep (new typename Sparse::SparseRep (n)), dimensions (dim_vector (n, n)), idx (0), idx_count (0) { } - explicit Sparse (int nr, int nc) + explicit Sparse (octave_idx_type nr, octave_idx_type nc) : rep (new typename Sparse::SparseRep (nr, nc)), dimensions (dim_vector (nr, nc)), idx (0), idx_count (0) { } - explicit Sparse (int nr, int nc, T val); + explicit Sparse (octave_idx_type nr, octave_idx_type nc, T val); - Sparse (const dim_vector& dv, int nz) + Sparse (const dim_vector& dv, octave_idx_type nz) : rep (new typename Sparse::SparseRep (dv(0), dv(1), nz)), dimensions (dv), idx (0), idx_count (0) { } - Sparse (int nr, int nc, int nz) + Sparse (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz) : rep (new typename Sparse::SparseRep (nr, nc, nz)), dimensions (dim_vector (nr, nc)), idx (0), idx_count (0) { } @@ -206,11 +206,11 @@ Sparse (const Sparse& a, const dim_vector& dv); - Sparse (const Array& a, const Array& r, const Array& c, - int nr, int nc, bool sum_terms); + Sparse (const Array& a, const Array& r, const Array& c, + octave_idx_type nr, octave_idx_type nc, bool sum_terms); Sparse (const Array& a, const Array& r, const Array& c, - int nr, int nc, bool sum_terms); + octave_idx_type nr, octave_idx_type nc, bool sum_terms); // Sparsify a normal matrix Sparse (const Array2& a); @@ -239,12 +239,12 @@ // Note that capacity and nnz are the amount of storage for non-zero // elements, while nonzero is the actual number of non-zero terms - int capacity (void) const { return rep->length (); } - int nnz (void) const { return capacity (); } - int nonzero (void) const { return rep->nonzero (); } + octave_idx_type capacity (void) const { return rep->length (); } + octave_idx_type nnz (void) const { return capacity (); } + octave_idx_type nonzero (void) const { return rep->nonzero (); } // Paranoid number of elements test for case of dims = (-1,-1) - int numel (void) const + octave_idx_type numel (void) const { if (dim1() < 0 || dim2() < 0) return 0; @@ -252,70 +252,70 @@ return dimensions.numel (); } - int nelem (void) const { return capacity (); } - int length (void) const { return numel (); } + octave_idx_type nelem (void) const { return capacity (); } + octave_idx_type length (void) const { return numel (); } - int dim1 (void) const { return dimensions(0); } - int dim2 (void) const { return dimensions(1); } + octave_idx_type dim1 (void) const { return dimensions(0); } + octave_idx_type dim2 (void) const { return dimensions(1); } - int rows (void) const { return dim1 (); } - int cols (void) const { return dim2 (); } - int columns (void) const { return dim2 (); } + octave_idx_type rows (void) const { return dim1 (); } + octave_idx_type cols (void) const { return dim2 (); } + octave_idx_type columns (void) const { return dim2 (); } - int get_row_index (int k) { return ridx (k); } - int get_col_index (int k) + octave_idx_type get_row_index (octave_idx_type k) { return ridx (k); } + octave_idx_type get_col_index (octave_idx_type k) { - int ret = 0; + octave_idx_type ret = 0; while (cidx(ret+1) < k) ret++; return ret; } - size_t byte_size (void) const { return (cols () + 1) * sizeof (int) + - capacity () * (sizeof (T) + sizeof (int)); } + size_t byte_size (void) const { return (cols () + 1) * sizeof (octave_idx_type) + + capacity () * (sizeof (T) + sizeof (octave_idx_type)); } dim_vector dims (void) const { return dimensions; } Sparse squeeze (void) const { return *this; } - int compute_index (const Array& ra_idx) const; + octave_idx_type compute_index (const Array& ra_idx) const; - T range_error (const char *fcn, int n) const; - T& range_error (const char *fcn, int n); + T range_error (const char *fcn, octave_idx_type n) const; + T& range_error (const char *fcn, octave_idx_type n); - T range_error (const char *fcn, int i, int j) const; - T& range_error (const char *fcn, int i, int j); + T range_error (const char *fcn, octave_idx_type i, octave_idx_type j) const; + T& range_error (const char *fcn, octave_idx_type i, octave_idx_type j); - T range_error (const char *fcn, const Array& ra_idx) const; - T& range_error (const char *fcn, const Array& ra_idx); + T range_error (const char *fcn, const Array& ra_idx) const; + T& range_error (const char *fcn, const Array& ra_idx); // No checking, even for multiple references, ever. - T& xelem (int n) + T& xelem (octave_idx_type n) { - int i = n % rows (), j = n / rows(); + octave_idx_type i = n % rows (), j = n / rows(); return xelem (i, j); } - T xelem (int n) const + T xelem (octave_idx_type n) const { - int i = n % rows (), j = n / rows(); + octave_idx_type i = n % rows (), j = n / rows(); return xelem (i, j); } - T& xelem (int i, int j) { return rep->elem (i, j); } - T xelem (int i, int j) const { return rep->celem (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); } - T& xelem (const Array& ra_idx) + T& xelem (const Array& ra_idx) { return xelem (compute_index (ra_idx)); } - T xelem (const Array& ra_idx) const + T xelem (const Array& ra_idx) const { return xelem (compute_index (ra_idx)); } // XXX FIXME XXX -- would be nice to fix this so that we don't // unnecessarily force a copy, but that is not so easy, and I see no // clean way to do it. - T& checkelem (int n) + T& checkelem (octave_idx_type n) { if (n < 0 || n >= numel ()) return range_error ("T& Sparse::checkelem", n); @@ -326,7 +326,7 @@ } } - T& checkelem (int i, int j) + T& checkelem (octave_idx_type i, octave_idx_type j) { if (i < 0 || j < 0 || i >= dim1 () || j >= dim2 ()) return range_error ("T& Sparse::checkelem", i, j); @@ -337,9 +337,9 @@ } } - T& checkelem (const Array& ra_idx) + T& checkelem (const Array& ra_idx) { - int i = compute_index (ra_idx); + octave_idx_type i = compute_index (ra_idx); if (i < 0) return range_error ("T& Sparse::checkelem", ra_idx); @@ -347,32 +347,32 @@ return elem (i); } - T& elem (int n) + T& elem (octave_idx_type n) { make_unique (); return xelem (n); } - T& elem (int i, int j) + T& elem (octave_idx_type i, octave_idx_type j) { make_unique (); return xelem (i, j); } - T& elem (const Array& ra_idx) + T& elem (const Array& ra_idx) { return Sparse::elem (compute_index (ra_idx)); } #if defined (BOUNDS_CHECKING) - T& operator () (int n) { return checkelem (n); } - T& operator () (int i, int j) { return checkelem (i, j); } - T& operator () (const Array& ra_idx) { return checkelem (ra_idx); } + T& operator () (octave_idx_type n) { return checkelem (n); } + T& operator () (octave_idx_type i, octave_idx_type j) { return checkelem (i, j); } + T& operator () (const Array& ra_idx) { return checkelem (ra_idx); } #else - T& operator () (int n) { return elem (n); } - T& operator () (int i, int j) { return elem (i, j); } - T& operator () (const Array& ra_idx) { return elem (ra_idx); } + T& operator () (octave_idx_type n) { return elem (n); } + T& operator () (octave_idx_type i, octave_idx_type j) { return elem (i, j); } + T& operator () (const Array& ra_idx) { return elem (ra_idx); } #endif - T checkelem (int n) const + T checkelem (octave_idx_type n) const { if (n < 0 || n >= numel ()) return range_error ("T Sparse::checkelem", n); @@ -380,7 +380,7 @@ return xelem (n); } - T checkelem (int i, int j) const + T checkelem (octave_idx_type i, octave_idx_type j) const { if (i < 0 || j < 0 || i >= dim1 () || j >= dim2 ()) return range_error ("T Sparse::checkelem", i, j); @@ -388,9 +388,9 @@ return xelem (i, j); } - T checkelem (const Array& ra_idx) const + T checkelem (const Array& ra_idx) const { - int i = compute_index (ra_idx); + octave_idx_type i = compute_index (ra_idx); if (i < 0) return range_error ("T Sparse::checkelem", ra_idx); @@ -398,21 +398,21 @@ return Sparse::elem (i); } - T elem (int n) const { return xelem (n); } + T elem (octave_idx_type n) const { return xelem (n); } - T elem (int i, int j) const { return xelem (i, j); } + T elem (octave_idx_type i, octave_idx_type j) const { return xelem (i, j); } - T elem (const Array& ra_idx) const + T elem (const Array& ra_idx) const { return Sparse::elem (compute_index (ra_idx)); } #if defined (BOUNDS_CHECKING) - T operator () (int n) const { return checkelem (n); } - T operator () (int i, int j) const { return checkelem (i, j); } - T operator () (const Array& ra_idx) const { return checkelem (ra_idx); } + T operator () (octave_idx_type n) const { return checkelem (n); } + T operator () (octave_idx_type i, octave_idx_type j) const { return checkelem (i, j); } + T operator () (const Array& ra_idx) const { return checkelem (ra_idx); } #else - T operator () (int n) const { return elem (n); } - T operator () (int i, int j) const { return elem (i, j); } - T operator () (const Array& ra_idx) const { return elem (ra_idx); } + T operator () (octave_idx_type n) const { return elem (n); } + T operator () (octave_idx_type i, octave_idx_type j) const { return elem (i, j); } + T operator () (const Array& ra_idx) const { return elem (ra_idx); } #endif Sparse maybe_compress (bool remove_zeros = false) @@ -427,24 +427,24 @@ // protected: - void resize_no_fill (int r, int c); + void resize_no_fill (octave_idx_type r, octave_idx_type c); void resize_no_fill (const dim_vector& dv); public: - Sparse permute (const Array& vec, bool inv = false) const; + Sparse permute (const Array& vec, bool inv = false) const; - Sparse ipermute (const Array& vec) const + Sparse ipermute (const Array& vec) const { return permute (vec, true); } - void resize (int r, int c) { resize_no_fill (r, c); } + void resize (octave_idx_type r, octave_idx_type c) { resize_no_fill (r, c); } void resize (const dim_vector& dv) { resize_no_fill (dv); } - void change_capacity (int nz) { rep->change_length (nz); } + void change_capacity (octave_idx_type nz) { rep->change_length (nz); } - Sparse& insert (const Sparse& a, int r, int c); - Sparse& insert (const Sparse& a, const Array& idx); + Sparse& insert (const Sparse& a, octave_idx_type r, octave_idx_type c); + Sparse& insert (const Sparse& a, const Array& idx); bool is_square (void) const { return (dim1 () == dim2 ()); } @@ -453,36 +453,36 @@ Sparse transpose (void) const; T* data (void) { make_unique (); return rep->d; } - T& data (int i) { make_unique (); return rep->data (i); } + T& data (octave_idx_type i) { make_unique (); return rep->data (i); } T* xdata (void) { return rep->d; } - T& xdata (int i) { return rep->data (i); } + T& xdata (octave_idx_type i) { return rep->data (i); } - T data (int i) const { return rep->data (i); } + T data (octave_idx_type i) const { return rep->data (i); } T* data (void) const { return rep->d; } - int* ridx (void) { make_unique (); return rep->r; } - int& ridx (int i) { make_unique (); return rep->ridx (i); } - int* xridx (void) { return rep->r; } - int& xridx (int i) { return rep->ridx (i); } + octave_idx_type* ridx (void) { make_unique (); return rep->r; } + octave_idx_type& ridx (octave_idx_type i) { make_unique (); return rep->ridx (i); } + octave_idx_type* xridx (void) { return rep->r; } + octave_idx_type& xridx (octave_idx_type i) { return rep->ridx (i); } - int ridx (int i) const { return rep->cridx (i); } - int* ridx (void) const { return rep->r; } + octave_idx_type ridx (octave_idx_type i) const { return rep->cridx (i); } + octave_idx_type* ridx (void) const { return rep->r; } - int* cidx (void) { make_unique (); return rep->c; } - int& cidx (int i) { make_unique (); return rep->cidx (i); } - int* xcidx (void) { return rep->c; } - int& xcidx (int i) { return rep->cidx (i); } + octave_idx_type* cidx (void) { make_unique (); return rep->c; } + octave_idx_type& cidx (octave_idx_type i) { make_unique (); return rep->cidx (i); } + octave_idx_type* xcidx (void) { return rep->c; } + octave_idx_type& xcidx (octave_idx_type i) { return rep->cidx (i); } - int cidx (int i) const { return rep->ccidx (i); } - int* cidx (void) const { return rep->c; } + octave_idx_type cidx (octave_idx_type i) const { return rep->ccidx (i); } + octave_idx_type* cidx (void) const { return rep->c; } - int ndims (void) const { return dimensions.length (); } + octave_idx_type ndims (void) const { return dimensions.length (); } void clear_index (void); void set_index (const idx_vector& i); - int index_count (void) const { return idx_count; } + octave_idx_type index_count (void) const { return idx_count; } idx_vector *get_idx (void) const { return idx; } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/SparseCmplxLU.cc --- a/liboctave/SparseCmplxLU.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/SparseCmplxLU.cc Fri Apr 08 16:07:37 2005 +0000 @@ -48,8 +48,8 @@ double piv_thres) { #ifdef HAVE_UMFPACK - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); // Setup the control parameters Matrix Control (UMFPACK_CONTROL, 1); @@ -85,8 +85,8 @@ umfpack_zi_report_control (control); - const int *Ap = a.cidx (); - const int *Ai = a.ridx (); + const octave_idx_type *Ap = a.cidx (); + const octave_idx_type *Ai = a.ridx (); const Complex *Ax = a.data (); umfpack_zi_report_matrix (nr, nc, Ap, Ai, X_CAST (const double *, Ax), @@ -153,21 +153,24 @@ int n_inner = (nr < nc ? nr : nc); if (lnz < 1) - Lfact = SparseComplexMatrix (n_inner, nr, 1); + Lfact = SparseComplexMatrix (static_cast (n_inner), nr, + static_cast (1)); else - Lfact = SparseComplexMatrix (n_inner, nr, lnz); + Lfact = SparseComplexMatrix (static_cast (n_inner), nr, + static_cast (lnz)); - int *Ltp = Lfact.cidx (); - int *Ltj = Lfact.ridx (); + octave_idx_type *Ltp = Lfact.cidx (); + octave_idx_type *Ltj = Lfact.ridx (); Complex *Ltx = Lfact.data (); if (unz < 1) - Ufact = SparseComplexMatrix (n_inner, nc, 1); + Ufact = SparseComplexMatrix (static_cast (n_inner), nc, + static_cast (1)); else - Ufact = SparseComplexMatrix (n_inner, nc, unz); + Ufact = SparseComplexMatrix (static_cast (n_inner), nc, unz); - int *Up = Ufact.cidx (); - int *Uj = Ufact.ridx (); + octave_idx_type *Up = Ufact.cidx (); + octave_idx_type *Uj = Ufact.ridx (); Complex *Ux = Ufact.data (); P.resize (nr); @@ -223,8 +226,8 @@ double piv_thres, bool FixedQ) { #ifdef HAVE_UMFPACK - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); // Setup the control parameters Matrix Control (UMFPACK_CONTROL, 1); @@ -265,8 +268,8 @@ umfpack_zi_report_control (control); - const int *Ap = a.cidx (); - const int *Ai = a.ridx (); + const octave_idx_type *Ap = a.cidx (); + const octave_idx_type *Ai = a.ridx (); const Complex *Ax = a.data (); umfpack_zi_report_matrix (nr, nc, Ap, Ai, X_CAST (const double *, Ax), NULL, @@ -342,21 +345,24 @@ int n_inner = (nr < nc ? nr : nc); if (lnz < 1) - Lfact = SparseComplexMatrix (n_inner, nr, 1); + Lfact = SparseComplexMatrix (static_cast (n_inner), nr, + static_cast (1)); else - Lfact = SparseComplexMatrix (n_inner, nr, lnz); + Lfact = SparseComplexMatrix (static_cast (n_inner), nr, + static_cast (lnz)); - int *Ltp = Lfact.cidx (); - int *Ltj = Lfact.ridx (); + octave_idx_type *Ltp = Lfact.cidx (); + octave_idx_type *Ltj = Lfact.ridx (); Complex *Ltx = Lfact.data (); if (unz < 1) - Ufact = SparseComplexMatrix (n_inner, nc, 1); + Ufact = SparseComplexMatrix (static_cast (n_inner), nc, + static_cast (1)); else - Ufact = SparseComplexMatrix (n_inner, nc, unz); + Ufact = SparseComplexMatrix (static_cast (n_inner), nc, unz); - int *Up = Ufact.cidx (); - int *Uj = Ufact.ridx (); + octave_idx_type *Up = Ufact.cidx (); + octave_idx_type *Uj = Ufact.ridx (); Complex *Ux = Ufact.data (); P.resize (nr); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/SparseType.cc --- a/liboctave/SparseType.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/SparseType.cc Fri Apr 08 16:07:37 2005 +0000 @@ -37,9 +37,9 @@ { if (nperm != 0) { - row_perm = new int [nperm]; - col_perm = new int [nperm]; - for (int i = 0; i < nperm; i++) + row_perm = new octave_idx_type [nperm]; + col_perm = new octave_idx_type [nperm]; + for (octave_idx_type i = 0; i < nperm; i++) { row_perm[i] = a.row_perm[i]; col_perm[i] = a.col_perm[i]; @@ -49,9 +49,9 @@ SparseType::SparseType (const SparseMatrix &a) { - int nrows = a.rows (); - int ncols = a.cols (); - int nnz = a.nnz (); + octave_idx_type nrows = a.rows (); + octave_idx_type ncols = a.cols (); + octave_idx_type nnz = a.nnz (); nperm = 0; @@ -66,7 +66,7 @@ if (nnz == ncols) { matrix_type tmp_typ = SparseType::Diagonal; - int i; + octave_idx_type i; // Maybe the matrix is diagonal for (i = 0; i < ncols; i++) { @@ -86,12 +86,12 @@ { bool found [ncols]; - for (int j = 0; j < i; j++) + for (octave_idx_type j = 0; j < i; j++) found [j] = true; - for (int j = i; j < ncols; j++) + for (octave_idx_type j = i; j < ncols; j++) found [j] = false; - for (int j = i; j < ncols; j++) + for (octave_idx_type j = i; j < ncols; j++) { if ((a.cidx(j+1) != a.cidx(j) + 1) || found [a.ridx(j)]) { @@ -110,10 +110,10 @@ bool singular = false; upper_band = 0; lower_band = 0; - for (int j = 0; j < ncols; j++) + for (octave_idx_type j = 0; j < ncols; j++) { bool zero_on_diagonal = true; - for (int i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) if (a.ridx(i) == j) { zero_on_diagonal = false; @@ -128,8 +128,8 @@ if (a.cidx(j+1) - a.cidx(j) > 0) { - int ru = a.ridx(a.cidx(j)); - int rl = a.ridx(a.cidx(j+1)-1); + octave_idx_type ru = a.ridx(a.cidx(j)); + octave_idx_type rl = a.ridx(a.cidx(j+1)-1); if (j - ru > upper_band) upper_band = j - ru; @@ -154,7 +154,7 @@ else typ = SparseType::Banded; - int nnz_in_band = (upper_band + lower_band + 1) * nrows - + 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) @@ -189,13 +189,13 @@ // definite.. bool is_herm = true; - for (int j = 0; j < ncols; j++) + for (octave_idx_type j = 0; j < ncols; j++) { bool diag_positive = false; - for (int i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { - int ri = a.ridx(i); + octave_idx_type ri = a.ridx(i); if (ri == j) { @@ -208,7 +208,7 @@ { bool found = false; - for (int k = a.cidx(ri); k < a.cidx(ri+1); k++) + for (octave_idx_type k = a.cidx(ri); k < a.cidx(ri+1); k++) { if (a.ridx(k) == j) { @@ -248,9 +248,9 @@ SparseType::SparseType (const SparseComplexMatrix &a) { - int nrows = a.rows (); - int ncols = a.cols (); - int nnz = a.nnz (); + octave_idx_type nrows = a.rows (); + octave_idx_type ncols = a.cols (); + octave_idx_type nnz = a.nnz (); nperm = 0; @@ -265,7 +265,7 @@ if (nnz == ncols) { matrix_type tmp_typ = SparseType::Diagonal; - int i; + octave_idx_type i; // Maybe the matrix is diagonal for (i = 0; i < ncols; i++) { @@ -285,12 +285,12 @@ { bool found [ncols]; - for (int j = 0; j < i; j++) + for (octave_idx_type j = 0; j < i; j++) found [j] = true; - for (int j = i; j < ncols; j++) + for (octave_idx_type j = i; j < ncols; j++) found [j] = false; - for (int j = i; j < ncols; j++) + for (octave_idx_type j = i; j < ncols; j++) { if ((a.cidx(j+1) != a.cidx(j) + 1) || found [a.ridx(j)]) { @@ -309,10 +309,10 @@ bool singular = false; upper_band = 0; lower_band = 0; - for (int j = 0; j < ncols; j++) + for (octave_idx_type j = 0; j < ncols; j++) { bool zero_on_diagonal = true; - for (int i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) if (a.ridx(i) == j) { zero_on_diagonal = false; @@ -327,8 +327,8 @@ if (a.cidx(j+1) - a.cidx(j) > 0) { - int ru = a.ridx(a.cidx(j)); - int rl = a.ridx(a.cidx(j+1)-1); + octave_idx_type ru = a.ridx(a.cidx(j)); + octave_idx_type rl = a.ridx(a.cidx(j+1)-1); if (j - ru > upper_band) upper_band = j - ru; @@ -353,7 +353,7 @@ else typ = SparseType::Banded; - int nnz_in_band = (upper_band + lower_band + 1) * nrows - + 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) @@ -388,13 +388,13 @@ // definite.. bool is_herm = true; - for (int j = 0; j < ncols; j++) + for (octave_idx_type j = 0; j < ncols; j++) { bool diag_positive = false; - for (int i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { - int ri = a.ridx(i); + octave_idx_type ri = a.ridx(i); if (ri == j) { @@ -407,7 +407,7 @@ { bool found = false; - for (int k = a.cidx(ri); k < a.cidx(ri+1); k++) + for (octave_idx_type k = a.cidx(ri); k < a.cidx(ri+1); k++) { if (a.ridx(k) == j) { @@ -469,9 +469,9 @@ if (nperm != 0) { - row_perm = new int [nperm]; - col_perm = new int [nperm]; - for (int i = 0; i < nperm; i++) + row_perm = new octave_idx_type [nperm]; + col_perm = new octave_idx_type [nperm]; + for (octave_idx_type i = 0; i < nperm; i++) { row_perm[i] = a.row_perm[i]; col_perm[i] = a.col_perm[i]; @@ -511,9 +511,9 @@ if (nperm != 0) { - row_perm = new int [nperm]; - col_perm = new int [nperm]; - for (int i = 0; i < nperm; i++) + row_perm = new octave_idx_type [nperm]; + col_perm = new octave_idx_type [nperm]; + for (octave_idx_type i = 0; i < nperm; i++) { row_perm[i] = tmp_typ.row_perm[i]; col_perm[i] = tmp_typ.col_perm[i]; @@ -552,9 +552,9 @@ if (nperm != 0) { - row_perm = new int [nperm]; - col_perm = new int [nperm]; - for (int i = 0; i < nperm; i++) + row_perm = new octave_idx_type [nperm]; + col_perm = new octave_idx_type [nperm]; + for (octave_idx_type i = 0; i < nperm; i++) { row_perm[i] = tmp_typ.row_perm[i]; col_perm[i] = tmp_typ.col_perm[i]; @@ -648,12 +648,12 @@ } void -SparseType::mark_as_permuted (const int np, const int *pr, const int *pc) +SparseType::mark_as_permuted (const octave_idx_type np, const octave_idx_type *pr, const octave_idx_type *pc) { nperm = np; - row_perm = new int [nperm]; - col_perm = new int [nperm]; - for (int i = 0; i < nperm; i++) + row_perm = new octave_idx_type [nperm]; + col_perm = new octave_idx_type [nperm]; + for (octave_idx_type i = 0; i < nperm; i++) { row_perm[i] = pr[i]; col_perm[i] = pc[i]; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/SparseType.h --- a/liboctave/SparseType.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/SparseType.h Fri Apr 08 16:07:37 2005 +0000 @@ -99,9 +99,9 @@ void info (void) const; - int * triangular_row_perm (void) const { return row_perm; } + octave_idx_type * triangular_row_perm (void) const { return row_perm; } - int * triangular_col_perm (void) const { return col_perm; } + octave_idx_type * triangular_col_perm (void) const { return col_perm; } void invaldate_type (void) { typ = Unknown; } @@ -113,7 +113,7 @@ void mark_as_tridiagonal (void) {typ = Tridiagonal; } - void mark_as_banded (const int ku, const int kl) + void mark_as_banded (const octave_idx_type ku, const octave_idx_type kl) { typ = Banded; upper_band = ku; lower_band = kl; } void mark_as_full (void) { typ = Full; } @@ -128,7 +128,7 @@ void mark_as_unsymmetric (void); - void mark_as_permuted (const int np, const int *pr, const int *pc); + void mark_as_permuted (const octave_idx_type np, const octave_idx_type *pr, const octave_idx_type *pc); void mark_as_unpermuted (void); @@ -138,12 +138,12 @@ matrix_type typ; double sp_bandden; double bandden; - int upper_band; - int lower_band; + octave_idx_type upper_band; + octave_idx_type lower_band; bool dense; - int nperm; - int *row_perm; - int *col_perm; + octave_idx_type nperm; + octave_idx_type *row_perm; + octave_idx_type *col_perm; }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/SparsedbleLU.cc --- a/liboctave/SparsedbleLU.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/SparsedbleLU.cc Fri Apr 08 16:07:37 2005 +0000 @@ -47,8 +47,8 @@ SparseLU::SparseLU (const SparseMatrix& a, double piv_thres) { #ifdef HAVE_UMFPACK - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); // Setup the control parameters Matrix Control (UMFPACK_CONTROL, 1); @@ -85,8 +85,8 @@ umfpack_di_report_control (control); - const int *Ap = a.cidx (); - const int *Ai = a.ridx (); + const octave_idx_type *Ap = a.cidx (); + const octave_idx_type *Ai = a.ridx (); const double *Ax = a.data (); umfpack_di_report_matrix (nr, nc, Ap, Ai, Ax, 1, control); @@ -151,21 +151,25 @@ int n_inner = (nr < nc ? nr : nc); if (lnz < 1) - Lfact = SparseMatrix (n_inner, nr, 1); + Lfact = SparseMatrix (static_cast (n_inner), nr, + static_cast (1)); else - Lfact = SparseMatrix (n_inner, nr, lnz); + Lfact = SparseMatrix (static_cast (n_inner), nr, + static_cast (lnz)); - int *Ltp = Lfact.cidx (); - int *Ltj = Lfact.ridx (); + octave_idx_type *Ltp = Lfact.cidx (); + octave_idx_type *Ltj = Lfact.ridx (); double *Ltx = Lfact.data (); if (unz < 1) - Ufact = SparseMatrix (n_inner, nc, 1); + Ufact = SparseMatrix (static_cast (n_inner), nc, + static_cast (1)); else - Ufact = SparseMatrix (n_inner, nc, unz); + Ufact = SparseMatrix (static_cast (n_inner), nc, + static_cast (unz)); - int *Up = Ufact.cidx (); - int *Uj = Ufact.ridx (); + octave_idx_type *Up = Ufact.cidx (); + octave_idx_type *Uj = Ufact.ridx (); double *Ux = Ufact.data (); P.resize (nr); @@ -216,8 +220,8 @@ double piv_thres, bool FixedQ) { #ifdef HAVE_UMFPACK - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); // Setup the control parameters Matrix Control (UMFPACK_CONTROL, 1); @@ -258,8 +262,8 @@ umfpack_di_report_control (control); - const int *Ap = a.cidx (); - const int *Ai = a.ridx (); + const octave_idx_type *Ap = a.cidx (); + const octave_idx_type *Ai = a.ridx (); const double *Ax = a.data (); umfpack_di_report_matrix (nr, nc, Ap, Ai, Ax, 1, control); @@ -334,21 +338,25 @@ int n_inner = (nr < nc ? nr : nc); if (lnz < 1) - Lfact = SparseMatrix (n_inner, nr, 1); + Lfact = SparseMatrix (static_cast (n_inner), nr, + static_cast (1)); else - Lfact = SparseMatrix (n_inner, nr, lnz); + Lfact = SparseMatrix (static_cast (n_inner), nr, + static_cast (lnz)); - int *Ltp = Lfact.cidx (); - int *Ltj = Lfact.ridx (); + octave_idx_type *Ltp = Lfact.cidx (); + octave_idx_type *Ltj = Lfact.ridx (); double *Ltx = Lfact.data (); if (unz < 1) - Ufact = SparseMatrix (n_inner, nc, 1); + Ufact = SparseMatrix (static_cast (n_inner), nc, + static_cast (1)); else - Ufact = SparseMatrix (n_inner, nc, unz); + Ufact = SparseMatrix (static_cast (n_inner), nc, + static_cast (unz)); - int *Up = Ufact.cidx (); - int *Uj = Ufact.ridx (); + octave_idx_type *Up = Ufact.cidx (); + octave_idx_type *Uj = Ufact.ridx (); double *Ux = Ufact.data (); P.resize (nr); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/base-de.h --- a/liboctave/base-de.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/base-de.h Fri Apr 08 16:07:37 2005 +0000 @@ -72,7 +72,7 @@ force_restart (); } - int size (void) const { return x.capacity (); } + octave_idx_type size (void) const { return x.capacity (); } ColumnVector state (void) const { return x; } @@ -95,7 +95,7 @@ bool integration_ok (void) const { return ! integration_error; } - int integration_state (void) const { return istate; } + octave_idx_type integration_state (void) const { return istate; } virtual std::string error_message (void) const = 0; @@ -113,7 +113,7 @@ bool integration_error; - int istate; + octave_idx_type istate; }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/base-lu.cc --- a/liboctave/base-lu.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/base-lu.cc Fri Apr 08 16:07:37 2005 +0000 @@ -30,18 +30,18 @@ lu_type base_lu :: L (void) const { - int a_nr = a_fact.rows (); - int a_nc = a_fact.cols (); - int mn = (a_nr < a_nc ? a_nr : a_nc); + octave_idx_type a_nr = a_fact.rows (); + octave_idx_type a_nc = a_fact.cols (); + octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc); lu_type l (a_nr, mn, lu_elt_type (0.0)); - for (int i = 0; i < a_nr; i++) + for (octave_idx_type i = 0; i < a_nr; i++) { if (i < a_nc) l.xelem (i, i) = 1.0; - for (int j = 0; j < (i < a_nc ? i : a_nc); j++) + for (octave_idx_type j = 0; j < (i < a_nc ? i : a_nc); j++) l.xelem (i, j) = a_fact.xelem (i, j); } @@ -52,15 +52,15 @@ lu_type base_lu :: U (void) const { - int a_nr = a_fact.rows (); - int a_nc = a_fact.cols (); - int mn = (a_nr < a_nc ? a_nr : a_nc); + octave_idx_type a_nr = a_fact.rows (); + octave_idx_type a_nc = a_fact.cols (); + octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc); lu_type u (mn, a_nc, lu_elt_type (0.0)); - for (int i = 0; i < mn; i++) + for (octave_idx_type i = 0; i < mn; i++) { - for (int j = i; j < a_nc; j++) + for (octave_idx_type j = i; j < a_nc; j++) u.xelem (i, j) = a_fact.xelem (i, j); } @@ -71,20 +71,20 @@ p_type base_lu :: P (void) const { - int a_nr = a_fact.rows (); + octave_idx_type a_nr = a_fact.rows (); - Array pvt (a_nr); + Array pvt (a_nr); - for (int i = 0; i < a_nr; i++) + for (octave_idx_type i = 0; i < a_nr; i++) pvt.xelem (i) = i; - for (int i = 0; i < ipvt.length(); i++) + for (octave_idx_type i = 0; i < ipvt.length(); i++) { - int k = ipvt.xelem (i); + octave_idx_type k = ipvt.xelem (i); if (k != i) { - int tmp = pvt.xelem (k); + octave_idx_type tmp = pvt.xelem (k); pvt.xelem (k) = pvt.xelem (i); pvt.xelem (i) = tmp; } @@ -92,7 +92,7 @@ p_type p (a_nr, a_nr, p_elt_type (0.0)); - for (int i = 0; i < a_nr; i++) + for (octave_idx_type i = 0; i < a_nr; i++) p.xelem (i, pvt.xelem (i)) = 1.0; return p; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/base-lu.h --- a/liboctave/base-lu.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/base-lu.h Fri Apr 08 16:07:37 2005 +0000 @@ -56,7 +56,7 @@ protected: lu_type a_fact; - MArray ipvt; + MArray ipvt; }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/base-min.h --- a/liboctave/base-min.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/base-min.h Fri Apr 08 16:07:37 2005 +0000 @@ -49,7 +49,7 @@ // Derived classes must provide a function to actually do the // minimization. - virtual ColumnVector do_minimize (double& objf, int& inform, + virtual ColumnVector do_minimize (double& objf, octave_idx_type& inform, ColumnVector& lambda) = 0; // Lots of ways to call the single function and optionally set and @@ -58,25 +58,25 @@ virtual ColumnVector minimize (void) { double objf; - int inform; + octave_idx_type inform; ColumnVector lambda; return do_minimize (objf, inform, lambda); } virtual ColumnVector minimize (double& objf) { - int inform; + octave_idx_type inform; ColumnVector lambda; return do_minimize (objf, inform, lambda); } - virtual ColumnVector minimize (double& objf, int& inform) + virtual ColumnVector minimize (double& objf, octave_idx_type& inform) { ColumnVector lambda; return do_minimize (objf, inform, lambda); } - virtual ColumnVector minimize (double& objf, int& inform, + virtual ColumnVector minimize (double& objf, octave_idx_type& inform, ColumnVector& lambda) { return do_minimize (objf, inform, lambda); @@ -86,7 +86,7 @@ { x = x0; double objf; - int inform; + octave_idx_type inform; ColumnVector lambda; return do_minimize (objf, inform, lambda); } @@ -94,13 +94,13 @@ virtual ColumnVector minimize (const ColumnVector& x0, double& objf) { x = x0; - int inform; + octave_idx_type inform; ColumnVector lambda; return do_minimize (objf, inform, lambda); } virtual ColumnVector minimize (const ColumnVector& x0, double& objf, - int& inform) + octave_idx_type& inform) { x = x0; ColumnVector lambda; @@ -108,13 +108,13 @@ } virtual ColumnVector minimize (const ColumnVector& x0, double& objf, - int& inform, ColumnVector& lambda) + octave_idx_type& inform, ColumnVector& lambda) { x = x0; return do_minimize (objf, inform, lambda); } - int size (void) const { return x.capacity (); } + octave_idx_type size (void) const { return x.capacity (); } protected: diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/boolMatrix.cc --- a/liboctave/boolMatrix.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/boolMatrix.cc Fri Apr 08 16:07:37 2005 +0000 @@ -51,7 +51,7 @@ } boolMatrix& -boolMatrix::insert (const boolMatrix& a, int r, int c) +boolMatrix::insert (const boolMatrix& a, octave_idx_type r, octave_idx_type c) { Array2::insert (a, r, c); return *this; @@ -62,13 +62,13 @@ boolMatrix boolMatrix::operator ! (void) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); boolMatrix b (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) b.elem (i, j) = ! elem (i, j); return b; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/boolMatrix.h --- a/liboctave/boolMatrix.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/boolMatrix.h Fri Apr 08 16:07:37 2005 +0000 @@ -34,8 +34,8 @@ public: boolMatrix (void) : Array2 () { } - boolMatrix (int r, int c) : Array2 (r, c) { } - boolMatrix (int r, int c, bool val) : Array2 (r, c, val) { } + boolMatrix (octave_idx_type r, octave_idx_type c) : Array2 (r, c) { } + boolMatrix (octave_idx_type r, octave_idx_type c, bool val) : Array2 (r, c, val) { } boolMatrix (const Array2& a) : Array2 (a) { } boolMatrix (const boolMatrix& a) : Array2 (a) { } @@ -52,7 +52,7 @@ // destructive insert/delete/reorder operations - boolMatrix& insert (const boolMatrix& a, int r, int c); + boolMatrix& insert (const boolMatrix& a, octave_idx_type r, octave_idx_type c); // unary operations @@ -74,7 +74,7 @@ private: - boolMatrix (bool *b, int r, int c) : Array2 (b, r, c) { } + boolMatrix (bool *b, octave_idx_type r, octave_idx_type c) : Array2 (b, r, c) { } }; MM_CMP_OP_DECLS (boolMatrix, boolMatrix) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/boolNDArray.cc --- a/liboctave/boolNDArray.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/boolNDArray.cc Fri Apr 08 16:07:37 2005 +0000 @@ -37,7 +37,7 @@ { boolNDArray b (dims ()); - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) b.elem (i) = ! elem (i); return b; @@ -58,7 +58,7 @@ } boolNDArray -boolNDArray::concat (const boolNDArray& rb, const Array& ra_idx) +boolNDArray::concat (const boolNDArray& rb, const Array& ra_idx) { if (rb.numel () > 0) insert (rb, ra_idx); @@ -66,14 +66,14 @@ } boolNDArray& -boolNDArray::insert (const boolNDArray& a, int r, int c) +boolNDArray::insert (const boolNDArray& a, octave_idx_type r, octave_idx_type c) { Array::insert (a, r, c); return *this; } boolNDArray& -boolNDArray::insert (const boolNDArray& a, const Array& ra_idx) +boolNDArray::insert (const boolNDArray& a, const Array& ra_idx) { Array::insert (a, ra_idx); return *this; @@ -109,15 +109,15 @@ } void -boolNDArray::increment_index (Array& ra_idx, +boolNDArray::increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension) { ::increment_index (ra_idx, dimensions, start_dimension); } -int -boolNDArray::compute_index (Array& ra_idx, +octave_idx_type +boolNDArray::compute_index (Array& ra_idx, const dim_vector& dimensions) { return ::compute_index (ra_idx, dimensions); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/boolNDArray.h --- a/liboctave/boolNDArray.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/boolNDArray.h Fri Apr 08 16:07:37 2005 +0000 @@ -66,20 +66,20 @@ boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; - boolNDArray concat (const boolNDArray& rb, const Array& ra_idx); + boolNDArray concat (const boolNDArray& rb, const Array& ra_idx); - boolNDArray& insert (const boolNDArray& a, int r, int c); - boolNDArray& insert (const boolNDArray& a, const Array& ra_idx); + boolNDArray& insert (const boolNDArray& a, octave_idx_type r, octave_idx_type c); + boolNDArray& insert (const boolNDArray& a, const Array& ra_idx); boolMatrix matrix_value (void) const; boolNDArray squeeze (void) const { return ArrayN::squeeze (); } - static void increment_index (Array& ra_idx, + static void increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension = 0); - static int compute_index (Array& ra_idx, + static octave_idx_type compute_index (Array& ra_idx, const dim_vector& dimensions); // i/o diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/boolSparse.cc --- a/liboctave/boolSparse.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/boolSparse.cc Fri Apr 08 16:07:37 2005 +0000 @@ -38,21 +38,21 @@ bool SparseBoolMatrix::operator == (const SparseBoolMatrix& a) const { - int nr = rows (); - int nc = cols (); - int nz = nnz (); - int nr_a = a.rows (); - int nc_a = a.cols (); - int nz_a = a.nnz (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); + octave_idx_type nr_a = a.rows (); + octave_idx_type nc_a = a.cols (); + octave_idx_type nz_a = a.nnz (); if (nr != nr_a || nc != nc_a || nz != nz_a) return false; - for (int i = 0; i < nc + 1; i++) + for (octave_idx_type i = 0; i < nc + 1; i++) if (cidx(i) != a.cidx(i)) return false; - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) if (data(i) != a.data(i) || ridx(i) != a.ridx(i)) return false; @@ -66,14 +66,14 @@ } SparseBoolMatrix& -SparseBoolMatrix::insert (const SparseBoolMatrix& a, int r, int c) +SparseBoolMatrix::insert (const SparseBoolMatrix& a, octave_idx_type r, octave_idx_type c) { Sparse::insert (a, r, c); return *this; } SparseBoolMatrix -SparseBoolMatrix::concat (const SparseBoolMatrix& rb, const Array& ra_idx) +SparseBoolMatrix::concat (const SparseBoolMatrix& rb, const Array& ra_idx) { // Don't use numel to avoid all possiblity of an overflow if (rb.rows () > 0 && rb.cols () > 0) @@ -86,18 +86,18 @@ SparseBoolMatrix SparseBoolMatrix::operator ! (void) const { - int nr = rows (); - int nc = cols (); - int nz1 = nnz (); - int nz2 = nr*nc - nz1; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz1 = nnz (); + octave_idx_type nz2 = nr*nc - nz1; SparseBoolMatrix r (nr, nc, nz2); - int ii = 0; - int jj = 0; - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + octave_idx_type jj = 0; + for (octave_idx_type i = 0; i < nc; i++) { - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { if (jj < cidx(i+1) && ridx(jj) == j) jj++; @@ -133,12 +133,12 @@ boolMatrix SparseBoolMatrix::matrix_value (void) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); boolMatrix retval (nr, nc, false); - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) retval.elem (ridx(i), j) = data (i); return retval; @@ -147,14 +147,14 @@ std::ostream& operator << (std::ostream& os, const SparseBoolMatrix& a) { - int nc = a.cols (); + octave_idx_type nc = a.cols (); // add one to the printed indices to go from // zero-based to one-based arrays - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { OCTAVE_QUIT; - for (int i = a.cidx(j); i < a.cidx(j+1); i++) + 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"; } @@ -164,20 +164,20 @@ std::istream& operator >> (std::istream& is, SparseBoolMatrix& a) { - int nr = a.rows (); - int nc = a.cols (); - int nz = a.nnz (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type nz = a.nnz (); if (nr < 1 || nc < 1) is.clear (std::ios::badbit); else { - int itmp, jtmp, jold = 0; + octave_idx_type itmp, jtmp, jold = 0; bool tmp; - int ii = 0; + octave_idx_type ii = 0; a.cidx (0) = 0; - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { is >> itmp; itmp--; @@ -188,7 +188,7 @@ { if (jold != jtmp) { - for (int j = jold; j < jtmp; j++) + for (octave_idx_type j = jold; j < jtmp; j++) a.cidx(j+1) = ii; jold = jtmp; @@ -200,7 +200,7 @@ goto done; } - for (int j = jold; j < nc; j++) + for (octave_idx_type j = jold; j < nc; j++) a.cidx(j+1) = ii; } @@ -240,13 +240,13 @@ } SparseBoolMatrix -SparseBoolMatrix::permute (const Array& vec, bool inv) const +SparseBoolMatrix::permute (const Array& vec, bool inv) const { return Sparse::permute (vec, inv); } SparseBoolMatrix -SparseBoolMatrix::ipermute (const Array& vec) const +SparseBoolMatrix::ipermute (const Array& vec) const { return Sparse::ipermute (vec); } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/boolSparse.h --- a/liboctave/boolSparse.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/boolSparse.h Fri Apr 08 16:07:37 2005 +0000 @@ -33,9 +33,9 @@ SparseBoolMatrix (void) : Sparse () { } - SparseBoolMatrix (int r, int c) : Sparse (r, c) { } + SparseBoolMatrix (octave_idx_type r, octave_idx_type c) : Sparse (r, c) { } - explicit SparseBoolMatrix (int r, int c, bool val) + explicit SparseBoolMatrix (octave_idx_type r, octave_idx_type c, bool val) : Sparse (r, c, val) { } SparseBoolMatrix (const Sparse& a) : Sparse (a) { } @@ -49,17 +49,17 @@ explicit SparseBoolMatrix (const boolNDArray& a) : Sparse (a) { } - explicit SparseBoolMatrix (const Array a, const Array& r, - const Array& c, int nr = -1, - int nc = -1, bool sum_terms = true) + explicit SparseBoolMatrix (const Array a, const Array& r, + const Array& c, octave_idx_type nr = -1, + octave_idx_type nc = -1, bool sum_terms = true) : Sparse (a, r, c, nr, nc, sum_terms) { } explicit SparseBoolMatrix (const Array a, const Array& r, - const Array& c, int nr = -1, - int nc = -1, bool sum_terms = true) + const Array& c, octave_idx_type nr = -1, + octave_idx_type nc = -1, bool sum_terms = true) : Sparse (a, r, c, nr, nc, sum_terms) { } - SparseBoolMatrix (int r, int c, int num_nz) : Sparse (r, c, num_nz) { } + SparseBoolMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) : Sparse (r, c, num_nz) { } SparseBoolMatrix& operator = (const SparseBoolMatrix& a) { @@ -75,10 +75,10 @@ // destructive insert/delete/reorder operations - SparseBoolMatrix& insert (const SparseBoolMatrix& a, int r, int c); + SparseBoolMatrix& insert (const SparseBoolMatrix& a, octave_idx_type r, octave_idx_type c); SparseBoolMatrix concat (const SparseBoolMatrix& rb, - const Array& ra_idx); + const Array& ra_idx); boolMatrix matrix_value (void) const; @@ -92,9 +92,9 @@ SparseBoolMatrix reshape (const dim_vector& new_dims) const; - SparseBoolMatrix permute (const Array& vec, bool inv = false) const; + SparseBoolMatrix permute (const Array& vec, bool inv = false) const; - SparseBoolMatrix ipermute (const Array& vec) const; + SparseBoolMatrix ipermute (const Array& vec) const; // unary operations diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/chMatrix.cc --- a/liboctave/chMatrix.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/chMatrix.cc Fri Apr 08 16:07:37 2005 +0000 @@ -38,8 +38,8 @@ charMatrix::charMatrix (char c) : MArray2 () { - int nc = 1; - int nr = 1; + octave_idx_type nc = 1; + octave_idx_type nr = 1; resize (nr, nc); @@ -49,36 +49,36 @@ charMatrix::charMatrix (const char *s) : MArray2 () { - int nc = s ? strlen (s) : 0; - int nr = s && nc > 0 ? 1 : 0; + octave_idx_type nc = s ? strlen (s) : 0; + octave_idx_type nr = s && nc > 0 ? 1 : 0; resize (nr, nc); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) elem (0, i) = s[i]; } charMatrix::charMatrix (const std::string& s) : MArray2 () { - int nc = s.length (); - int nr = nc > 0 ? 1 : 0; + octave_idx_type nc = s.length (); + octave_idx_type nr = nc > 0 ? 1 : 0; resize (nr, nc); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) elem (0, i) = s[i]; } charMatrix::charMatrix (const string_vector& s) : MArray2 (s.length (), s.max_length (), 0) { - int nr = rows (); + octave_idx_type nr = rows (); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { - int nc = s[i].length (); - for (int j = 0; j < nc; j++) + octave_idx_type nc = s[i].length (); + for (octave_idx_type j = 0; j < nc; j++) elem (i, j) = s[i][j]; } } @@ -99,11 +99,11 @@ } charMatrix& -charMatrix::insert (const char *s, int r, int c) +charMatrix::insert (const char *s, octave_idx_type r, octave_idx_type c) { if (s) { - int s_len = strlen (s); + octave_idx_type s_len = strlen (s); if (r < 0 || r >= rows () || c < 0 || c + s_len - 1 > cols ()) { @@ -111,26 +111,26 @@ return *this; } - for (int i = 0; i < s_len; i++) + for (octave_idx_type i = 0; i < s_len; i++) elem (r, c+i) = s[i]; } return *this; } charMatrix& -charMatrix::insert (const charMatrix& a, int r, int c) +charMatrix::insert (const charMatrix& a, octave_idx_type r, octave_idx_type c) { Array2::insert (a, r, c); return *this; } std::string -charMatrix::row_as_string (int r, bool strip_ws, bool raw) const +charMatrix::row_as_string (octave_idx_type r, bool strip_ws, bool raw) const { std::string retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (r == 0 && nr == 0 && nc == 0) return retval; @@ -143,7 +143,7 @@ retval.resize (nc, '\0'); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval[i] = elem (r, i); if (! raw) @@ -171,18 +171,18 @@ } charMatrix -charMatrix::extract (int r1, int c1, int r2, int c2) const +charMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } - int new_r = r2 - r1 + 1; - int new_c = c2 - c1 + 1; + octave_idx_type new_r = r2 - r1 + 1; + octave_idx_type new_c = c2 - c1 + 1; charMatrix result (new_r, new_c); - for (int j = 0; j < new_c; j++) - for (int i = 0; i < new_r; i++) + for (octave_idx_type j = 0; j < new_c; j++) + for (octave_idx_type i = 0; i < new_r; i++) result.elem (i, j) = elem (r1+i, c1+j); return result; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/chMatrix.h --- a/liboctave/chMatrix.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/chMatrix.h Fri Apr 08 16:07:37 2005 +0000 @@ -38,8 +38,8 @@ public: charMatrix (void) : MArray2 () { } - charMatrix (int r, int c) : MArray2 (r, c) { } - charMatrix (int r, int c, char val) : MArray2 (r, c, val) { } + charMatrix (octave_idx_type r, octave_idx_type c) : MArray2 (r, c) { } + charMatrix (octave_idx_type r, octave_idx_type c, char val) : MArray2 (r, c, val) { } charMatrix (const MArray2& a) : MArray2 (a) { } charMatrix (const charMatrix& a) : MArray2 (a) { } charMatrix (char c); @@ -60,14 +60,14 @@ // destructive insert/delete/reorder operations - charMatrix& insert (const char *s, int r, int c); - charMatrix& insert (const charMatrix& a, int r, int c); + charMatrix& insert (const char *s, octave_idx_type r, octave_idx_type c); + charMatrix& insert (const charMatrix& a, octave_idx_type r, octave_idx_type c); - std::string row_as_string (int, bool strip_ws = false, bool raw = false) const; + std::string row_as_string (octave_idx_type, bool strip_ws = false, bool raw = false) const; // resize is the destructive equivalent for this one - charMatrix extract (int r1, int c1, int r2, int c2) const; + charMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; boolMatrix all (int dim = -1) const; boolMatrix any (int dim = -1) const; @@ -83,7 +83,7 @@ private: - charMatrix (char *ch, int r, int c) : MArray2 (ch, r, c) { } + charMatrix (char *ch, octave_idx_type r, octave_idx_type c) : MArray2 (ch, r, c) { } }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/chNDArray.cc --- a/liboctave/chNDArray.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/chNDArray.cc Fri Apr 08 16:07:37 2005 +0000 @@ -46,7 +46,7 @@ } charNDArray -charNDArray::concat (const charNDArray& rb, const Array& ra_idx) +charNDArray::concat (const charNDArray& rb, const Array& ra_idx) { if (rb.numel () > 0) insert (rb, ra_idx); @@ -54,15 +54,15 @@ } charNDArray -charNDArray::concat (const NDArray& rb, const Array& ra_idx) +charNDArray::concat (const NDArray& rb, const Array& ra_idx) { charNDArray tmp (rb.dims ()); - int nel = rb.numel (); + octave_idx_type nel = rb.numel (); if (rb.numel () == 0) return *this; - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { double d = rb.elem (i); @@ -74,7 +74,7 @@ } else { - int ival = NINT (d); + octave_idx_type ival = NINTbig (d); if (ival < 0 || ival > UCHAR_MAX) // XXX FIXME XXX -- is there something @@ -90,14 +90,14 @@ } charNDArray& -charNDArray::insert (const charNDArray& a, int r, int c) +charNDArray::insert (const charNDArray& a, octave_idx_type r, octave_idx_type c) { Array::insert (a, r, c); return *this; } charNDArray& -charNDArray::insert (const charNDArray& a, const Array& ra_idx) +charNDArray::insert (const charNDArray& a, const Array& ra_idx) { Array::insert (a, ra_idx); return *this; @@ -131,15 +131,15 @@ } void -charNDArray::increment_index (Array& ra_idx, +charNDArray::increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension) { ::increment_index (ra_idx, dimensions, start_dimension); } -int -charNDArray::compute_index (Array& ra_idx, +octave_idx_type +charNDArray::compute_index (Array& ra_idx, const dim_vector& dimensions) { return ::compute_index (ra_idx, dimensions); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/chNDArray.h --- a/liboctave/chNDArray.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/chNDArray.h Fri Apr 08 16:07:37 2005 +0000 @@ -64,21 +64,21 @@ boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; - charNDArray concat (const charNDArray& rb, const Array& ra_idx); - charNDArray concat (const NDArray& rb, const Array& ra_idx); + charNDArray concat (const charNDArray& rb, const Array& ra_idx); + charNDArray concat (const NDArray& rb, const Array& ra_idx); - charNDArray& insert (const charNDArray& a, int r, int c); - charNDArray& insert (const charNDArray& a, const Array& ra_idx); + 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 ArrayN::squeeze (); } - static void increment_index (Array& ra_idx, + static void increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension = 0); - static int compute_index (Array& ra_idx, + static octave_idx_type compute_index (Array& ra_idx, const dim_vector& dimensions); // i/o diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dColVector.cc --- a/liboctave/dColVector.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dColVector.cc Fri Apr 08 16:07:37 2005 +0000 @@ -40,10 +40,10 @@ { F77_RET_T F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const double&, - const double*, const int&, const double*, - const int&, const double&, double*, - const int& + const octave_idx_type&, const octave_idx_type&, const double&, + const double*, const octave_idx_type&, const double*, + const octave_idx_type&, const double&, double*, + const octave_idx_type& F77_CHAR_ARG_LEN_DECL); } @@ -52,7 +52,7 @@ bool ColumnVector::operator == (const ColumnVector& a) const { - int len = length (); + octave_idx_type len = length (); if (len != a.length ()) return 0; return mx_inline_equal (data (), a.data (), len); @@ -65,9 +65,9 @@ } ColumnVector& -ColumnVector::insert (const ColumnVector& a, int r) +ColumnVector::insert (const ColumnVector& a, octave_idx_type r) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (r < 0 || r + a_len > length ()) { @@ -79,7 +79,7 @@ { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (r+i) = a.elem (i); } @@ -89,13 +89,13 @@ ColumnVector& ColumnVector::fill (double val) { - int len = length (); + octave_idx_type len = length (); if (len > 0) { make_unique (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) xelem (i) = val; } @@ -103,9 +103,9 @@ } ColumnVector& -ColumnVector::fill (double val, int r1, int r2) +ColumnVector::fill (double val, octave_idx_type r1, octave_idx_type r2) { - int len = length (); + octave_idx_type len = length (); if (r1 < 0 || r2 < 0 || r1 >= len || r2 >= len) { @@ -113,13 +113,13 @@ return *this; } - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } if (r2 >= r1) { make_unique (); - for (int i = r1; i <= r2; i++) + for (octave_idx_type i = r1; i <= r2; i++) xelem (i) = val; } @@ -129,8 +129,8 @@ ColumnVector ColumnVector::stack (const ColumnVector& a) const { - int len = length (); - int nr_insert = len; + octave_idx_type len = length (); + octave_idx_type nr_insert = len; ColumnVector retval (len + a.length ()); retval.insert (*this, 0); retval.insert (a, nr_insert); @@ -146,7 +146,7 @@ ColumnVector real (const ComplexColumnVector& a) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); ColumnVector retval; if (a_len > 0) retval = ColumnVector (mx_inline_real_dup (a.data (), a_len), a_len); @@ -156,7 +156,7 @@ ColumnVector imag (const ComplexColumnVector& a) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); ColumnVector retval; if (a_len > 0) retval = ColumnVector (mx_inline_imag_dup (a.data (), a_len), a_len); @@ -166,26 +166,26 @@ // resize is the destructive equivalent for this one ColumnVector -ColumnVector::extract (int r1, int r2) const +ColumnVector::extract (octave_idx_type r1, octave_idx_type r2) const { - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - int new_r = r2 - r1 + 1; + octave_idx_type new_r = r2 - r1 + 1; ColumnVector result (new_r); - for (int i = 0; i < new_r; i++) + for (octave_idx_type i = 0; i < new_r; i++) result.xelem (i) = elem (r1+i); return result; } ColumnVector -ColumnVector::extract_n (int r1, int n) const +ColumnVector::extract_n (octave_idx_type r1, octave_idx_type n) const { ColumnVector result (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) result.xelem (i) = elem (r1+i); return result; @@ -198,10 +198,10 @@ { ColumnVector retval; - int nr = m.rows (); - int nc = m.cols (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.cols (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (nc != a_len) gripe_nonconformant ("operator *", nr, nc, a_len, 1); @@ -211,7 +211,7 @@ retval.resize (nr, 0.0); else { - int ld = nr; + octave_idx_type ld = nr; retval.resize (nr); double *y = retval.fortran_vec (); @@ -237,10 +237,10 @@ { ColumnVector retval; - int nr = m.rows (); - int nc = m.cols (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.cols (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (nc != a_len) gripe_nonconformant ("operator *", nr, nc, a_len, 1); @@ -252,10 +252,10 @@ { retval.resize (nr); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) retval.elem (i) = a.elem (i) * m.elem (i, i); - for (int i = a_len; i < nr; i++) + for (octave_idx_type i = a_len; i < nr; i++) retval.elem (i) = 0.0; } } @@ -277,7 +277,7 @@ { double *d = fortran_vec (); // Ensures only one reference to my privates! - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) d[i] = f (d[i]); return *this; @@ -286,13 +286,13 @@ double ColumnVector::min (void) const { - int len = length (); + octave_idx_type len = length (); if (len == 0) return 0.0; double res = elem (0); - for (int i = 1; i < len; i++) + for (octave_idx_type i = 1; i < len; i++) if (elem (i) < res) res = elem (i); @@ -302,13 +302,13 @@ double ColumnVector::max (void) const { - int len = length (); + octave_idx_type len = length (); if (len == 0) return 0.0; double res = elem (0); - for (int i = 1; i < len; i++) + for (octave_idx_type i = 1; i < len; i++) if (elem (i) > res) res = elem (i); @@ -319,7 +319,7 @@ operator << (std::ostream& os, const ColumnVector& a) { // int field_width = os.precision () + 7; - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) os << /* setw (field_width) << */ a.elem (i) << "\n"; return os; } @@ -327,14 +327,14 @@ std::istream& operator >> (std::istream& is, ColumnVector& a) { - int len = a.length(); + octave_idx_type len = a.length(); if (len < 1) is.clear (std::ios::badbit); else { double tmp; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { is >> tmp; if (is) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dColVector.h --- a/liboctave/dColVector.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dColVector.h Fri Apr 08 16:07:37 2005 +0000 @@ -34,9 +34,9 @@ ColumnVector (void) : MArray () { } - explicit ColumnVector (int n) : MArray (n) { } + explicit ColumnVector (octave_idx_type n) : MArray (n) { } - ColumnVector (int n, double val) : MArray (n, val) { } + ColumnVector (octave_idx_type n, double val) : MArray (n, val) { } ColumnVector (const ColumnVector& a) : MArray (a) { } @@ -53,10 +53,10 @@ // destructive insert/delete/reorder operations - ColumnVector& insert (const ColumnVector& a, int r); + ColumnVector& insert (const ColumnVector& a, octave_idx_type r); ColumnVector& fill (double val); - ColumnVector& fill (double val, int r1, int r2); + ColumnVector& fill (double val, octave_idx_type r1, octave_idx_type r2); ColumnVector stack (const ColumnVector& a) const; @@ -67,9 +67,9 @@ // resize is the destructive equivalent for this one - ColumnVector extract (int r1, int r2) const; + ColumnVector extract (octave_idx_type r1, octave_idx_type r2) const; - ColumnVector extract_n (int r1, int n) const; + ColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const; // matrix by column vector -> column vector operations @@ -95,7 +95,7 @@ private: - ColumnVector (double *d, int l) : MArray (d, l) { } + ColumnVector (double *d, octave_idx_type l) : MArray (d, l) { } }; MARRAY_FORWARD_DEFS (MArray, ColumnVector, double) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dDiagMatrix.cc --- a/liboctave/dDiagMatrix.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dDiagMatrix.cc Fri Apr 08 16:07:37 2005 +0000 @@ -53,13 +53,13 @@ DiagMatrix& DiagMatrix::fill (double val) { - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) elem (i, i) = val; return *this; } DiagMatrix& -DiagMatrix::fill (double val, int beg, int end) +DiagMatrix::fill (double val, octave_idx_type beg, octave_idx_type end) { if (beg < 0 || end >= length () || end < beg) { @@ -67,7 +67,7 @@ return *this; } - for (int i = beg; i <= end; i++) + for (octave_idx_type i = beg; i <= end; i++) elem (i, i) = val; return *this; @@ -76,14 +76,14 @@ DiagMatrix& DiagMatrix::fill (const ColumnVector& a) { - int len = length (); + octave_idx_type len = length (); if (a.length () != len) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) elem (i, i) = a.elem (i); return *this; @@ -92,46 +92,46 @@ DiagMatrix& DiagMatrix::fill (const RowVector& a) { - int len = length (); + octave_idx_type len = length (); if (a.length () != len) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) elem (i, i) = a.elem (i); return *this; } DiagMatrix& -DiagMatrix::fill (const ColumnVector& a, int beg) +DiagMatrix::fill (const ColumnVector& a, octave_idx_type beg) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (beg < 0 || beg + a_len >= length ()) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) elem (i+beg, i+beg) = a.elem (i); return *this; } DiagMatrix& -DiagMatrix::fill (const RowVector& a, int beg) +DiagMatrix::fill (const RowVector& a, octave_idx_type beg) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (beg < 0 || beg + a_len >= length ()) { (*current_liboctave_error_handler) ("range error for fill"); return *this; } - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) elem (i+beg, i+beg) = a.elem (i); return *this; @@ -147,7 +147,7 @@ real (const ComplexDiagMatrix& a) { DiagMatrix retval; - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (a_len > 0) retval = DiagMatrix (mx_inline_real_dup (a.data (), a_len), a.rows (), a.cols ()); @@ -158,7 +158,7 @@ imag (const ComplexDiagMatrix& a) { DiagMatrix retval; - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (a_len > 0) retval = DiagMatrix (mx_inline_imag_dup (a.data (), a_len), a.rows (), a.cols ()); @@ -166,18 +166,18 @@ } Matrix -DiagMatrix::extract (int r1, int c1, int r2, int c2) const +DiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } - int new_r = r2 - r1 + 1; - int new_c = c2 - c1 + 1; + octave_idx_type new_r = r2 - r1 + 1; + octave_idx_type new_c = c2 - c1 + 1; Matrix result (new_r, new_c); - for (int j = 0; j < new_c; j++) - for (int i = 0; i < new_r; i++) + for (octave_idx_type j = 0; j < new_c; j++) + for (octave_idx_type i = 0; i < new_r; i++) result.elem (i, j) = elem (r1+i, c1+j); return result; @@ -186,10 +186,10 @@ // extract row or column i. RowVector -DiagMatrix::row (int i) const +DiagMatrix::row (octave_idx_type i) const { - int r = rows (); - int c = cols (); + octave_idx_type r = rows (); + octave_idx_type c = cols (); if (i < 0 || i >= r) { (*current_liboctave_error_handler) ("invalid row selection"); @@ -214,7 +214,7 @@ char c = *s; if (c == 'f' || c == 'F') - return row (0); + return row (static_cast(0)); else if (c == 'l' || c == 'L') return row (rows () - 1); else @@ -225,10 +225,10 @@ } ColumnVector -DiagMatrix::column (int i) const +DiagMatrix::column (octave_idx_type i) const { - int r = rows (); - int c = cols (); + octave_idx_type r = rows (); + octave_idx_type c = cols (); if (i < 0 || i >= c) { (*current_liboctave_error_handler) ("invalid column selection"); @@ -253,7 +253,7 @@ char c = *s; if (c == 'f' || c == 'F') - return column (0); + return column (static_cast(0)); else if (c == 'l' || c == 'L') return column (cols () - 1); else @@ -273,9 +273,9 @@ DiagMatrix DiagMatrix::inverse (int &info) const { - int r = rows (); - int c = cols (); - int len = length (); + octave_idx_type r = rows (); + octave_idx_type c = cols (); + octave_idx_type len = length (); if (r != c) { (*current_liboctave_error_handler) ("inverse requires square matrix"); @@ -285,7 +285,7 @@ DiagMatrix retval (r, c); info = 0; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { if (elem (i, i) == 0.0) { @@ -306,11 +306,11 @@ DiagMatrix operator * (const DiagMatrix& a, const DiagMatrix& b) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (a_nc != b_nr) { @@ -323,9 +323,9 @@ DiagMatrix c (a_nr, b_nc); - int len = a_nr < b_nc ? a_nr : b_nc; + octave_idx_type len = a_nr < b_nc ? a_nr : b_nc; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { double a_element = a.elem (i, i); double b_element = b.elem (i, i); @@ -354,10 +354,10 @@ // Could be optimized... ColumnVector -DiagMatrix::diag (int k) const +DiagMatrix::diag (octave_idx_type k) const { - int nnr = rows (); - int nnc = cols (); + octave_idx_type nnr = rows (); + octave_idx_type nnc = cols (); if (k > 0) nnc -= k; else if (k < 0) @@ -367,23 +367,23 @@ if (nnr > 0 && nnc > 0) { - int ndiag = (nnr < nnc) ? nnr : nnc; + octave_idx_type ndiag = (nnr < nnc) ? nnr : nnc; d.resize (ndiag); if (k > 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i, i+k); } else if ( k < 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i-k, i); } else { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i, i); } } @@ -399,9 +399,9 @@ { // int field_width = os.precision () + 7; - for (int i = 0; i < a.rows (); i++) + for (octave_idx_type i = 0; i < a.rows (); i++) { - for (int j = 0; j < a.cols (); j++) + for (octave_idx_type j = 0; j < a.cols (); j++) { if (i == j) os << " " /* setw (field_width) */ << a.elem (i, i); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dDiagMatrix.h --- a/liboctave/dDiagMatrix.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dDiagMatrix.h Fri Apr 08 16:07:37 2005 +0000 @@ -40,9 +40,9 @@ DiagMatrix (void) : MDiagArray2 () { } - DiagMatrix (int r, int c) : MDiagArray2 (r, c) { } + DiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2 (r, c) { } - DiagMatrix (int r, int c, double val) : MDiagArray2 (r, c, val) { } + DiagMatrix (octave_idx_type r, octave_idx_type c, double val) : MDiagArray2 (r, c, val) { } DiagMatrix (const DiagMatrix& a) : MDiagArray2 (a) { } @@ -62,11 +62,11 @@ bool operator != (const DiagMatrix& a) const; DiagMatrix& fill (double val); - DiagMatrix& fill (double val, int beg, int end); + DiagMatrix& fill (double val, octave_idx_type beg, octave_idx_type end); DiagMatrix& fill (const ColumnVector& a); DiagMatrix& fill (const RowVector& a); - DiagMatrix& fill (const ColumnVector& a, int beg); - DiagMatrix& fill (const RowVector& a, int beg); + DiagMatrix& fill (const ColumnVector& a, octave_idx_type beg); + DiagMatrix& fill (const RowVector& a, octave_idx_type beg); DiagMatrix transpose (void) const; @@ -75,14 +75,14 @@ // resize is the destructive analog for this one - Matrix extract (int r1, int c1, int r2, int c2) const; + Matrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; // extract row or column i. - RowVector row (int i) const; + RowVector row (octave_idx_type i) const; RowVector row (char *s) const; - ColumnVector column (int i) const; + ColumnVector column (octave_idx_type i) const; ColumnVector column (char *s) const; DiagMatrix inverse (void) const; @@ -91,7 +91,7 @@ // other operations ColumnVector diag (void) const; - ColumnVector diag (int k) const; + ColumnVector diag (octave_idx_type k) const; // i/o @@ -99,7 +99,7 @@ private: - DiagMatrix (double *d, int nr, int nc) : MDiagArray2 (d, nr, nc) { } + DiagMatrix (double *d, octave_idx_type nr, octave_idx_type nc) : MDiagArray2 (d, nr, nc) { } }; // diagonal matrix by diagonal matrix -> diagonal matrix operations diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dMatrix.cc --- a/liboctave/dMatrix.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dMatrix.cc Fri Apr 08 16:07:37 2005 +0000 @@ -58,15 +58,15 @@ { F77_RET_T F77_FUNC (dgebal, DGEBAL) (F77_CONST_CHAR_ARG_DECL, - const int&, double*, const int&, int&, - int&, double*, int& + const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type&, + octave_idx_type&, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (dgebak, DGEBAK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const int&, double*, - const int&, double*, const int&, int& + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, double*, + const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); @@ -74,38 +74,38 @@ F77_RET_T F77_FUNC (dgemm, DGEMM) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const int&, - const double&, const double*, const int&, - const double*, const int&, const double&, - double*, const int& + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + const double&, const double*, const octave_idx_type&, + const double*, const octave_idx_type&, const double&, + double*, const octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dgetrf, DGETRF) (const int&, const int&, double*, const int&, - int*, int&); + F77_FUNC (dgetrf, DGETRF) (const octave_idx_type&, const octave_idx_type&, double*, const octave_idx_type&, + octave_idx_type*, octave_idx_type&); F77_RET_T - F77_FUNC (dgetrs, DGETRS) (F77_CONST_CHAR_ARG_DECL, const int&, const int&, - const double*, const int&, - const int*, double*, const int&, int& + F77_FUNC (dgetrs, DGETRS) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, const octave_idx_type&, + const double*, const octave_idx_type&, + const octave_idx_type*, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dgetri, DGETRI) (const int&, double*, const int&, const int*, - double*, const int&, int&); + F77_FUNC (dgetri, DGETRI) (const octave_idx_type&, double*, const octave_idx_type&, const octave_idx_type*, + double*, const octave_idx_type&, octave_idx_type&); F77_RET_T - F77_FUNC (dgecon, DGECON) (F77_CONST_CHAR_ARG_DECL, const int&, double*, - const int&, const double&, double&, - double*, int*, int& + F77_FUNC (dgecon, DGECON) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, double*, + const octave_idx_type&, const double&, double&, + double*, octave_idx_type*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dgelss, DGELSS) (const int&, const int&, const int&, - double*, const int&, double*, - const int&, double*, double&, int&, - double*, const int&, int&); + F77_FUNC (dgelss, DGELSS) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + double*, const octave_idx_type&, double*, + const octave_idx_type&, double*, double&, octave_idx_type&, + double*, const octave_idx_type&, octave_idx_type&); // Note that the original complex fft routines were not written for // double complex arguments. They have been modified by adding an @@ -113,13 +113,13 @@ // each subroutine. F77_RET_T - F77_FUNC (cffti, CFFTI) (const int&, Complex*); + F77_FUNC (cffti, CFFTI) (const octave_idx_type&, Complex*); F77_RET_T - F77_FUNC (cfftf, CFFTF) (const int&, Complex*, Complex*); + F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, Complex*, Complex*); F77_RET_T - F77_FUNC (cfftb, CFFTB) (const int&, Complex*, Complex*); + F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, Complex*, Complex*); F77_RET_T F77_FUNC (dlartg, DLARTG) (const double&, const double&, double&, @@ -128,17 +128,17 @@ F77_RET_T F77_FUNC (dtrsyl, DTRSYL) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const int&, - const double*, const int&, const double*, - const int&, const double*, const int&, - double&, int& + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + const double*, const octave_idx_type&, const double*, + const octave_idx_type&, const double*, const octave_idx_type&, + double&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (xdlange, XDLANGE) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, const double*, - const int&, double*, double& + F77_FUNC (xdlange, XDLANGE) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, const double*, + const octave_idx_type&, double*, double& F77_CHAR_ARG_LEN_DECL); } @@ -147,21 +147,21 @@ Matrix::Matrix (const RowVector& rv) : MArray2 (1, rv.length (), 0.0) { - for (int i = 0; i < rv.length (); i++) + for (octave_idx_type i = 0; i < rv.length (); i++) elem (0, i) = rv.elem (i); } Matrix::Matrix (const ColumnVector& cv) : MArray2 (cv.length (), 1, 0.0) { - for (int i = 0; i < cv.length (); i++) + for (octave_idx_type i = 0; i < cv.length (); i++) elem (i, 0) = cv.elem (i); } Matrix::Matrix (const DiagMatrix& a) : MArray2 (a.rows (), a.cols (), 0.0) { - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) = a.elem (i, i); } @@ -171,16 +171,16 @@ Matrix::Matrix (const boolMatrix& a) : MArray2 (a.rows (), a.cols ()) { - for (int i = 0; i < a.rows (); i++) - for (int j = 0; j < a.cols (); j++) + for (octave_idx_type i = 0; i < a.rows (); i++) + for (octave_idx_type j = 0; j < a.cols (); j++) elem (i, j) = a.elem (i, j); } Matrix::Matrix (const charMatrix& a) : MArray2 (a.rows (), a.cols ()) { - for (int i = 0; i < a.rows (); i++) - for (int j = 0; j < a.cols (); j++) + for (octave_idx_type i = 0; i < a.rows (); i++) + for (octave_idx_type j = 0; j < a.cols (); j++) elem (i, j) = a.elem (i, j); } @@ -204,8 +204,8 @@ { if (is_square () && rows () > 0) { - for (int i = 0; i < rows (); i++) - for (int j = i+1; j < cols (); j++) + for (octave_idx_type i = 0; i < rows (); i++) + for (octave_idx_type j = i+1; j < cols (); j++) if (elem (i, j) != elem (j, i)) return false; @@ -216,16 +216,16 @@ } Matrix& -Matrix::insert (const Matrix& a, int r, int c) +Matrix::insert (const Matrix& a, octave_idx_type r, octave_idx_type c) { Array2::insert (a, r, c); return *this; } Matrix& -Matrix::insert (const RowVector& a, int r, int c) +Matrix::insert (const RowVector& a, octave_idx_type r, octave_idx_type c) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ()) { @@ -237,7 +237,7 @@ { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (r, c+i) = a.elem (i); } @@ -245,9 +245,9 @@ } Matrix& -Matrix::insert (const ColumnVector& a, int r, int c) +Matrix::insert (const ColumnVector& a, octave_idx_type r, octave_idx_type c) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ()) { @@ -259,7 +259,7 @@ { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (r+i, c) = a.elem (i); } @@ -267,10 +267,10 @@ } Matrix& -Matrix::insert (const DiagMatrix& a, int r, int c) +Matrix::insert (const DiagMatrix& a, octave_idx_type r, octave_idx_type c) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (r < 0 || r + a_nr > rows () || c < 0 || c + a_nc > cols ()) { @@ -280,13 +280,13 @@ fill (0.0, r, c, r + a_nr - 1, c + a_nc - 1); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (a_len > 0) { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (r+i, c+i) = a.elem (i, i); } @@ -296,15 +296,15 @@ Matrix& Matrix::fill (double val) { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { make_unique (); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) xelem (i, j) = val; } @@ -312,10 +312,10 @@ } Matrix& -Matrix::fill (double val, int r1, int c1, int r2, int c2) +Matrix::fill (double val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc) @@ -324,15 +324,15 @@ return *this; } - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } if (r2 >= r1 && c2 >= c1) { make_unique (); - for (int j = c1; j <= c2; j++) - for (int i = r1; i <= r2; i++) + for (octave_idx_type j = c1; j <= c2; j++) + for (octave_idx_type i = r1; i <= r2; i++) xelem (i, j) = val; } @@ -342,15 +342,15 @@ Matrix Matrix::append (const Matrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != a.rows ()) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return Matrix (); } - int nc_insert = nc; + octave_idx_type nc_insert = nc; Matrix retval (nr, nc + a.cols ()); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -360,15 +360,15 @@ Matrix Matrix::append (const RowVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != 1) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return Matrix (); } - int nc_insert = nc; + octave_idx_type nc_insert = nc; Matrix retval (nr, nc + a.length ()); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -378,15 +378,15 @@ Matrix Matrix::append (const ColumnVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != a.length ()) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return Matrix (); } - int nc_insert = nc; + octave_idx_type nc_insert = nc; Matrix retval (nr, nc + 1); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -396,15 +396,15 @@ Matrix Matrix::append (const DiagMatrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != a.rows ()) { (*current_liboctave_error_handler) ("row dimension mismatch for append"); return *this; } - int nc_insert = nc; + octave_idx_type nc_insert = nc; Matrix retval (nr, nc + a.cols ()); retval.insert (*this, 0, 0); retval.insert (a, 0, nc_insert); @@ -414,8 +414,8 @@ Matrix Matrix::stack (const Matrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != a.cols ()) { (*current_liboctave_error_handler) @@ -423,7 +423,7 @@ return Matrix (); } - int nr_insert = nr; + octave_idx_type nr_insert = nr; Matrix retval (nr + a.rows (), nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -433,8 +433,8 @@ Matrix Matrix::stack (const RowVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != a.length ()) { (*current_liboctave_error_handler) @@ -442,7 +442,7 @@ return Matrix (); } - int nr_insert = nr; + octave_idx_type nr_insert = nr; Matrix retval (nr + 1, nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -452,8 +452,8 @@ Matrix Matrix::stack (const ColumnVector& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != 1) { (*current_liboctave_error_handler) @@ -461,7 +461,7 @@ return Matrix (); } - int nr_insert = nr; + octave_idx_type nr_insert = nr; Matrix retval (nr + a.length (), nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -471,8 +471,8 @@ Matrix Matrix::stack (const DiagMatrix& a) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nc != a.cols ()) { (*current_liboctave_error_handler) @@ -480,7 +480,7 @@ return Matrix (); } - int nr_insert = nr; + octave_idx_type nr_insert = nr; Matrix retval (nr + a.rows (), nc); retval.insert (*this, 0, 0); retval.insert (a, nr_insert, 0); @@ -490,7 +490,7 @@ Matrix real (const ComplexMatrix& a) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); Matrix retval; if (a_len > 0) retval = Matrix (mx_inline_real_dup (a.data (), a_len), @@ -501,7 +501,7 @@ Matrix imag (const ComplexMatrix& a) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); Matrix retval; if (a_len > 0) retval = Matrix (mx_inline_imag_dup (a.data (), a_len), @@ -510,30 +510,30 @@ } Matrix -Matrix::extract (int r1, int c1, int r2, int c2) const +Matrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } - - int new_r = r2 - r1 + 1; - int new_c = c2 - c1 + 1; + if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + + octave_idx_type new_r = r2 - r1 + 1; + octave_idx_type new_c = c2 - c1 + 1; Matrix result (new_r, new_c); - for (int j = 0; j < new_c; j++) - for (int i = 0; i < new_r; i++) + for (octave_idx_type j = 0; j < new_c; j++) + for (octave_idx_type i = 0; i < new_r; i++) result.xelem (i, j) = elem (r1+i, c1+j); return result; } Matrix -Matrix::extract_n (int r1, int c1, int nr, int nc) const +Matrix::extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const { Matrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) result.xelem (i, j) = elem (r1+i, c1+j); return result; @@ -542,9 +542,9 @@ // extract row or column i. RowVector -Matrix::row (int i) const +Matrix::row (octave_idx_type i) const { - int nc = cols (); + octave_idx_type nc = cols (); if (i < 0 || i >= rows ()) { (*current_liboctave_error_handler) ("invalid row selection"); @@ -552,7 +552,7 @@ } RowVector retval (nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) retval.xelem (j) = elem (i, j); return retval; @@ -569,7 +569,7 @@ char c = *s; if (c == 'f' || c == 'F') - return row (0); + return row ( static_cast(0) ); else if (c == 'l' || c == 'L') return row (rows () - 1); else @@ -580,9 +580,9 @@ } ColumnVector -Matrix::column (int i) const +Matrix::column (octave_idx_type i) const { - int nr = rows (); + octave_idx_type nr = rows (); if (i < 0 || i >= cols ()) { (*current_liboctave_error_handler) ("invalid column selection"); @@ -590,7 +590,7 @@ } ColumnVector retval (nr); - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) retval.xelem (j) = elem (j, i); return retval; @@ -607,7 +607,7 @@ char c = *s; if (c == 'f' || c == 'F') - return column (0); + return column (static_cast (0)); else if (c == 'l' || c == 'L') return column (cols () - 1); else @@ -620,38 +620,38 @@ Matrix Matrix::inverse (void) const { - int info; + octave_idx_type info; double rcond; return inverse (info, rcond, 0, 0); } Matrix -Matrix::inverse (int& info) const +Matrix::inverse (octave_idx_type& info) const { double rcond; return inverse (info, rcond, 0, 0); } Matrix -Matrix::inverse (int& info, double& rcond, int force, int calc_cond) const +Matrix::inverse (octave_idx_type& info, double& rcond, int force, int calc_cond) const { Matrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr != nc || nr == 0 || nc == 0) (*current_liboctave_error_handler) ("inverse requires square matrix"); else { - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); retval = *this; double *tmp_data = retval.fortran_vec (); Array z(1); - int lwork = -1; + octave_idx_type lwork = -1; // Query the optimum work array size. F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt, @@ -664,7 +664,7 @@ return retval; } - lwork = static_cast (z(0)); + lwork = static_cast (z(0)); lwork = (lwork < 2 *nc ? 2*nc : lwork); z.resize (lwork); double *pz = z.fortran_vec (); @@ -674,7 +674,7 @@ // Calculate the norm of the matrix, for later use. double anorm = 0; if (calc_cond) - anorm = retval.abs().sum().row(0).max(); + anorm = retval.abs().sum().row(static_cast(0)).max(); F77_XFCN (dgetrf, DGETRF, (nc, nc, tmp_data, nr, pipvt, info)); @@ -688,12 +688,12 @@ info = -1; else if (calc_cond) { - int dgecon_info = 0; + octave_idx_type dgecon_info = 0; // Now calculate the condition number for non-singular matrix. char job = '1'; - Array iz (nc); - int *piz = iz.fortran_vec (); + Array iz (nc); + octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, tmp_data, nr, anorm, rcond, pz, piz, dgecon_info @@ -711,7 +711,7 @@ retval = *this; // Restore matrix contents. else { - int dgetri_info = 0; + octave_idx_type dgetri_info = 0; F77_XFCN (dgetri, DGETRI, (nc, tmp_data, nr, pipvt, pz, lwork, dgetri_info)); @@ -740,9 +740,9 @@ ColumnVector sigma = S.diag (); - int r = sigma.length () - 1; - int nr = rows (); - int nc = cols (); + octave_idx_type r = sigma.length () - 1; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (tol <= 0.0) { @@ -859,10 +859,10 @@ { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); - - int npts, nsamples; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type npts, nsamples; if (nr == 1 || nc == 1) { @@ -875,7 +875,7 @@ nsamples = nc; } - int nn = 4*npts+15; + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); @@ -885,7 +885,7 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; @@ -900,10 +900,10 @@ { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); - - int npts, nsamples; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type npts, nsamples; if (nr == 1 || nc == 1) { @@ -916,7 +916,7 @@ nsamples = nc; } - int nn = 4*npts+15; + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); @@ -926,14 +926,14 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; F77_FUNC (cfftb, CFFTB) (npts, &tmp_data[npts*j], pwsave); } - for (int j = 0; j < npts*nsamples; j++) + for (octave_idx_type j = 0; j < npts*nsamples; j++) tmp_data[j] = tmp_data[j] / static_cast (npts); return retval; @@ -944,10 +944,10 @@ { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); - - int npts, nsamples; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type npts, nsamples; if (nr == 1 || nc == 1) { @@ -960,7 +960,7 @@ nsamples = nc; } - int nn = 4*npts+15; + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); @@ -970,7 +970,7 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; @@ -989,16 +989,16 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) prow[i] = tmp_data[i*nr + j]; F77_FUNC (cfftf, CFFTF) (npts, prow, pwsave); - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) tmp_data[i*nr + j] = prow[i]; } @@ -1010,10 +1010,10 @@ { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); - - int npts, nsamples; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type npts, nsamples; if (nr == 1 || nc == 1) { @@ -1026,7 +1026,7 @@ nsamples = nc; } - int nn = 4*npts+15; + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); @@ -1036,14 +1036,14 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; F77_FUNC (cfftb, CFFTB) (npts, &tmp_data[npts*j], pwsave); } - for (int j = 0; j < npts*nsamples; j++) + for (octave_idx_type j = 0; j < npts*nsamples; j++) tmp_data[j] = tmp_data[j] / static_cast (npts); npts = nc; @@ -1058,16 +1058,16 @@ F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int j = 0; j < nsamples; j++) + for (octave_idx_type j = 0; j < nsamples; j++) { OCTAVE_QUIT; - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) prow[i] = tmp_data[i*nr + j]; F77_FUNC (cfftb, CFFTB) (npts, prow, pwsave); - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) tmp_data[i*nr + j] = prow[i] / static_cast (npts); } @@ -1079,25 +1079,25 @@ DET Matrix::determinant (void) const { - int info; + octave_idx_type info; double rcond; return determinant (info, rcond, 0); } DET -Matrix::determinant (int& info) const +Matrix::determinant (octave_idx_type& info) const { double rcond; return determinant (info, rcond, 0); } DET -Matrix::determinant (int& info, double& rcond, int calc_cond) const +Matrix::determinant (octave_idx_type& info, double& rcond, int calc_cond) const { DET retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr == 0 || nc == 0) { @@ -1108,8 +1108,8 @@ } else { - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); Matrix atmp = *this; double *tmp_data = atmp.fortran_vec (); @@ -1119,7 +1119,7 @@ // Calculate the norm of the matrix, for later use. double anorm = 0; if (calc_cond) - anorm = atmp.abs().sum().row(0).max(); + anorm = atmp.abs().sum().row(static_cast(0)).max(); F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -1142,8 +1142,8 @@ char job = '1'; Array z (4 * nc); double *pz = z.fortran_vec (); - Array iz (nc); - int *piz = iz.fortran_vec (); + Array iz (nc); + octave_idx_type *piz = iz.fortran_vec (); F77_XFCN (dgecon, DGECON, (F77_CONST_CHAR_ARG2 (&job, 1), nc, tmp_data, nr, anorm, @@ -1163,7 +1163,7 @@ else { double d[2] = { 1., 0.}; - for (int i=0; i ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); Matrix atmp = *this; double *tmp_data = atmp.fortran_vec (); Array z (4 * nc); double *pz = z.fortran_vec (); - Array iz (nc); - int *piz = iz.fortran_vec (); + Array iz (nc); + octave_idx_type *piz = iz.fortran_vec (); // Calculate the norm of the matrix, for later use. - double anorm = atmp.abs().sum().row(0).max(); + double anorm = atmp.abs().sum().row(static_cast(0)).max(); F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -1292,7 +1292,7 @@ retval = b; double *result = retval.fortran_vec (); - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); job = 'N'; F77_XFCN (dgetrs, DGETRS, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -1319,21 +1319,21 @@ } ComplexMatrix -Matrix::solve (const ComplexMatrix& b, int& info) const +Matrix::solve (const ComplexMatrix& b, octave_idx_type& info) const { ComplexMatrix tmp (*this); return tmp.solve (b, info); } ComplexMatrix -Matrix::solve (const ComplexMatrix& b, int& info, double& rcond) const +Matrix::solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const { ComplexMatrix tmp (*this); return tmp.solve (b, info, rcond); } ComplexMatrix -Matrix::solve (const ComplexMatrix& b, int& info, double& rcond, +Matrix::solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix tmp (*this); @@ -1343,31 +1343,31 @@ ColumnVector Matrix::solve (const ColumnVector& b) const { - int info; double rcond; + octave_idx_type info; double rcond; return solve (b, info, rcond); } ColumnVector -Matrix::solve (const ColumnVector& b, int& info) const +Matrix::solve (const ColumnVector& b, octave_idx_type& info) const { double rcond; return solve (b, info, rcond); } ColumnVector -Matrix::solve (const ColumnVector& b, int& info, double& rcond) const +Matrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ColumnVector -Matrix::solve (const ColumnVector& b, int& info, double& rcond, +Matrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { ColumnVector retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr == 0 || nc == 0 || nr != nc || nr != b.length ()) (*current_liboctave_error_handler) @@ -1376,19 +1376,19 @@ { info = 0; - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); Matrix atmp = *this; double *tmp_data = atmp.fortran_vec (); Array z (4 * nc); double *pz = z.fortran_vec (); - Array iz (nc); - int *piz = iz.fortran_vec (); + Array iz (nc); + octave_idx_type *piz = iz.fortran_vec (); // Calculate the norm of the matrix, for later use. - double anorm = atmp.abs().sum().row(0).max(); + double anorm = atmp.abs().sum().row(static_cast(0)).max(); F77_XFCN (dgetrf, DGETRF, (nr, nr, tmp_data, nr, pipvt, info)); @@ -1468,21 +1468,21 @@ } ComplexColumnVector -Matrix::solve (const ComplexColumnVector& b, int& info) const +Matrix::solve (const ComplexColumnVector& b, octave_idx_type& info) const { ComplexMatrix tmp (*this); return tmp.solve (b, info); } ComplexColumnVector -Matrix::solve (const ComplexColumnVector& b, int& info, double& rcond) const +Matrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const { ComplexMatrix tmp (*this); return tmp.solve (b, info, rcond); } ComplexColumnVector -Matrix::solve (const ComplexColumnVector& b, int& info, double& rcond, +Matrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix tmp (*this); @@ -1492,27 +1492,27 @@ Matrix Matrix::lssolve (const Matrix& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } Matrix -Matrix::lssolve (const Matrix& b, int& info) const +Matrix::lssolve (const Matrix& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } Matrix -Matrix::lssolve (const Matrix& b, int& info, int& rank) const +Matrix::lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank) const { Matrix retval; - int nrhs = b.cols (); - - int m = rows (); - int n = cols (); + octave_idx_type nrhs = b.cols (); + + octave_idx_type m = rows (); + octave_idx_type n = cols (); if (m == 0 || n == 0 || m != b.rows ()) (*current_liboctave_error_handler) @@ -1522,16 +1522,16 @@ Matrix atmp = *this; double *tmp_data = atmp.fortran_vec (); - int nrr = m > n ? m : n; + octave_idx_type nrr = m > n ? m : n; Matrix result (nrr, nrhs, 0.0); - for (int j = 0; j < nrhs; j++) - for (int i = 0; i < m; i++) + for (octave_idx_type j = 0; j < nrhs; j++) + for (octave_idx_type i = 0; i < m; i++) result.elem (i, j) = b.elem (i, j); double *presult = result.fortran_vec (); - int len_s = m < n ? m : n; + octave_idx_type len_s = m < n ? m : n; Array s (len_s); double *ps = s.fortran_vec (); @@ -1539,7 +1539,7 @@ // Ask DGELSS what the dimension of WORK should be. - int lwork = -1; + octave_idx_type lwork = -1; Array work (1); @@ -1551,7 +1551,7 @@ (*current_liboctave_error_handler) ("unrecoverable error in dgelss"); else { - lwork = static_cast (work(0)); + lwork = static_cast (work(0)); work.resize (lwork); F77_XFCN (dgelss, DGELSS, (m, n, nrhs, tmp_data, m, presult, @@ -1564,8 +1564,8 @@ else { retval.resize (n, nrhs); - for (int j = 0; j < nrhs; j++) - for (int i = 0; i < n; i++) + for (octave_idx_type j = 0; j < nrhs; j++) + for (octave_idx_type i = 0; i < n; i++) retval.elem (i, j) = result.elem (i, j); } } @@ -1578,21 +1578,21 @@ Matrix::lssolve (const ComplexMatrix& b) const { ComplexMatrix tmp (*this); - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return tmp.lssolve (b, info, rank); } ComplexMatrix -Matrix::lssolve (const ComplexMatrix& b, int& info) const +Matrix::lssolve (const ComplexMatrix& b, octave_idx_type& info) const { ComplexMatrix tmp (*this); - int rank; + octave_idx_type rank; return tmp.lssolve (b, info, rank); } ComplexMatrix -Matrix::lssolve (const ComplexMatrix& b, int& info, int& rank) const +Matrix::lssolve (const ComplexMatrix& b, octave_idx_type& info, octave_idx_type& rank) const { ComplexMatrix tmp (*this); return tmp.lssolve (b, info, rank); @@ -1601,27 +1601,27 @@ ColumnVector Matrix::lssolve (const ColumnVector& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } ColumnVector -Matrix::lssolve (const ColumnVector& b, int& info) const +Matrix::lssolve (const ColumnVector& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } ColumnVector -Matrix::lssolve (const ColumnVector& b, int& info, int& rank) const +Matrix::lssolve (const ColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const { ColumnVector retval; - int nrhs = 1; - - int m = rows (); - int n = cols (); + octave_idx_type nrhs = 1; + + octave_idx_type m = rows (); + octave_idx_type n = cols (); if (m == 0 || n == 0 || m != b.length ()) (*current_liboctave_error_handler) @@ -1631,15 +1631,15 @@ Matrix atmp = *this; double *tmp_data = atmp.fortran_vec (); - int nrr = m > n ? m : n; + octave_idx_type nrr = m > n ? m : n; ColumnVector result (nrr); - for (int i = 0; i < m; i++) + for (octave_idx_type i = 0; i < m; i++) result.elem (i) = b.elem (i); double *presult = result.fortran_vec (); - int len_s = m < n ? m : n; + octave_idx_type len_s = m < n ? m : n; Array s (len_s); double *ps = s.fortran_vec (); @@ -1647,7 +1647,7 @@ // Ask DGELSS what the dimension of WORK should be. - int lwork = -1; + octave_idx_type lwork = -1; Array work (1); @@ -1659,7 +1659,7 @@ (*current_liboctave_error_handler) ("unrecoverable error in dgelss"); else { - lwork = static_cast (work(0)); + lwork = static_cast (work(0)); work.resize (lwork); F77_XFCN (dgelss, DGELSS, (m, n, nrhs, tmp_data, m, presult, @@ -1672,7 +1672,7 @@ else { retval.resize (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) retval.elem (i) = result.elem (i); } } @@ -1689,14 +1689,14 @@ } ComplexColumnVector -Matrix::lssolve (const ComplexColumnVector& b, int& info) const +Matrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info) const { ComplexMatrix tmp (*this); return tmp.lssolve (b, info); } ComplexColumnVector -Matrix::lssolve (const ComplexColumnVector& b, int& info, int& rank) const +Matrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const { ComplexMatrix tmp (*this); return tmp.lssolve (b, info, rank); @@ -1723,7 +1723,7 @@ Matrix m = *this; - int nc = columns (); + octave_idx_type nc = columns (); // Preconditioning step 1: trace normalization to reduce dynamic // range of poles, but avoid making stable eigenvalues unstable. @@ -1731,14 +1731,14 @@ // trace shift value volatile double trshift = 0.0; - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) trshift += m.elem (i, i); trshift /= nc; if (trshift > 0.0) { - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) m.elem (i, i) -= trshift; } @@ -1747,7 +1747,7 @@ double *p_m = m.fortran_vec (); - int info, ilo, ihi, ilos, ihis; + octave_idx_type info, ilo, ihi, ilos, ihis; Array dpermute (nc); Array dscale (nc); @@ -1787,7 +1787,7 @@ return retval; } - int sqpow = (int) (inf_norm > 0.0 + octave_idx_type sqpow = static_cast (inf_norm > 0.0 ? (1.0 + log (inf_norm) / log (2.0)) : 0.0); @@ -1799,7 +1799,7 @@ if (sqpow > 0) { double scale_factor = 1.0; - for (int i = 0; i < sqpow; i++) + for (octave_idx_type i = 0; i < sqpow; i++) scale_factor *= 2.0; m = m / scale_factor; @@ -1812,8 +1812,8 @@ // Now powers a^8 ... a^1. - int minus_one_j = -1; - for (int j = 7; j >= 0; j--) + octave_idx_type minus_one_j = -1; + for (octave_idx_type j = 7; j >= 0; j--) { npp = m * npp + padec[j] * m; dpp = m * dpp + (minus_one_j * padec[j]) * m; @@ -1823,7 +1823,7 @@ // Zero power. dpp = -dpp; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { npp.elem (j, j) += 1.0; dpp.elem (j, j) += 1.0; @@ -1843,45 +1843,45 @@ // Reverse preconditioning step 2: inverse balancing. // apply inverse scaling to computed exponential - for (int i = 0; i < nc; i++) - for (int j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type j = 0; j < nc; j++) retval(i,j) *= dscale(i) / dscale(j); OCTAVE_QUIT; // construct balancing permutation vector - Array iperm (nc); - for (int i = 0; i < nc; i++) + Array iperm (nc); + for (octave_idx_type i = 0; i < nc; i++) iperm(i) = i; // identity permutation // leading permutations in forward order - for (int i = 0; i < (ilo-1); i++) + for (octave_idx_type i = 0; i < (ilo-1); i++) { - int swapidx = static_cast (dpermute(i)) - 1; - int tmp = iperm(i); + octave_idx_type swapidx = static_cast (dpermute(i)) - 1; + octave_idx_type tmp = iperm(i); iperm(i) = iperm (swapidx); iperm(swapidx) = tmp; } // trailing permutations must be done in reverse order - for (int i = nc - 1; i >= ihi; i--) + for (octave_idx_type i = nc - 1; i >= ihi; i--) { - int swapidx = static_cast (dpermute(i)) - 1; - int tmp = iperm(i); + octave_idx_type swapidx = static_cast (dpermute(i)) - 1; + octave_idx_type tmp = iperm(i); iperm(i) = iperm(swapidx); iperm(swapidx) = tmp; } // construct inverse balancing permutation vector - Array invpvec (nc); - for (int i = 0; i < nc; i++) + Array invpvec (nc); + for (octave_idx_type i = 0; i < nc; i++) invpvec(iperm(i)) = i; // Thanks to R. A. Lippert for this method OCTAVE_QUIT; Matrix tmpMat = retval; - for (int i = 0; i < nc; i++) - for (int j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nc; i++) + for (octave_idx_type j = 0; j < nc; j++) retval(i,j) = tmpMat(invpvec(i),invpvec(j)); // Reverse preconditioning step 1: fix trace normalization. @@ -1895,11 +1895,11 @@ Matrix& Matrix::operator += (const DiagMatrix& a) { - int nr = rows (); - int nc = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (nr != a_nr || nc != a_nc) { @@ -1907,7 +1907,7 @@ return *this; } - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) += a.elem (i, i); return *this; @@ -1916,11 +1916,11 @@ Matrix& Matrix::operator -= (const DiagMatrix& a) { - int nr = rows (); - int nc = cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (nr != a_nr || nc != a_nc) { @@ -1928,7 +1928,7 @@ return *this; } - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) elem (i, i) -= a.elem (i, i); return *this; @@ -1939,13 +1939,13 @@ boolMatrix Matrix::operator ! (void) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); boolMatrix b (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) b.elem (i, j) = ! elem (i, j); return b; @@ -1958,11 +1958,11 @@ { Matrix retval; - int len = v.length (); + octave_idx_type len = v.length (); if (len != 0) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); retval.resize (len, a_len); double *c = retval.fortran_vec (); @@ -1994,13 +1994,13 @@ boolMatrix Matrix::map (b_d_Mapper f) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); boolMatrix retval (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = f (elem(i,j)); return retval; @@ -2011,7 +2011,7 @@ { double *d = fortran_vec (); // Ensures only one reference to my privates! - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) d[i] = f (d[i]); return *this; @@ -2020,17 +2020,17 @@ bool Matrix::any_element_is_negative (bool neg_zero) const { - int nel = nelem (); + octave_idx_type nel = nelem (); if (neg_zero) { - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) if (lo_ieee_signbit (elem (i))) return true; } else { - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) if (elem (i) < 0) return true; } @@ -2042,9 +2042,9 @@ bool Matrix::any_element_is_inf_or_nan (void) const { - int nel = nelem (); - - for (int i = 0; i < nel; i++) + octave_idx_type nel = nelem (); + + for (octave_idx_type i = 0; i < nel; i++) { double val = elem (i); if (xisinf (val) || xisnan (val)) @@ -2057,9 +2057,9 @@ bool Matrix::all_elements_are_int_or_inf_or_nan (void) const { - int nel = nelem (); - - for (int i = 0; i < nel; i++) + octave_idx_type nel = nelem (); + + for (octave_idx_type i = 0; i < nel; i++) { double val = elem (i); if (xisnan (val) || D_NINT (val) == val) @@ -2077,7 +2077,7 @@ bool Matrix::all_integers (double& max_val, double& min_val) const { - int nel = nelem (); + octave_idx_type nel = nelem (); if (nel > 0) { @@ -2087,7 +2087,7 @@ else return false; - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { double val = elem (i); @@ -2107,9 +2107,9 @@ bool Matrix::too_large_for_float (void) const { - int nel = nelem (); - - for (int i = 0; i < nel; i++) + octave_idx_type nel = nelem (); + + for (octave_idx_type i = 0; i < nel; i++) { double val = elem (i); @@ -2179,13 +2179,13 @@ Matrix Matrix::abs (void) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); Matrix retval (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval (i, j) = fabs (elem (i, j)); return retval; @@ -2198,10 +2198,10 @@ } ColumnVector -Matrix::diag (int k) const +Matrix::diag (octave_idx_type k) const { - int nnr = rows (); - int nnc = cols (); + octave_idx_type nnr = rows (); + octave_idx_type nnc = cols (); if (k > 0) nnc -= k; else if (k < 0) @@ -2211,23 +2211,23 @@ if (nnr > 0 && nnc > 0) { - int ndiag = (nnr < nnc) ? nnr : nnc; + octave_idx_type ndiag = (nnr < nnc) ? nnr : nnc; d.resize (ndiag); if (k > 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i, i+k); } else if (k < 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i-k, i); } else { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) d.elem (i) = elem (i, i); } } @@ -2241,26 +2241,26 @@ ColumnVector Matrix::row_min (void) const { - Array dummy_idx; + Array dummy_idx; return row_min (dummy_idx); } ColumnVector -Matrix::row_min (Array& idx_arg) const +Matrix::row_min (Array& idx_arg) const { ColumnVector result; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { result.resize (nr); idx_arg.resize (nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { - int idx_j; + octave_idx_type idx_j; double tmp_min = octave_NaN; @@ -2272,7 +2272,7 @@ break; } - for (int j = idx_j+1; j < nc; j++) + for (octave_idx_type j = idx_j+1; j < nc; j++) { double tmp = elem (i, j); @@ -2296,26 +2296,26 @@ ColumnVector Matrix::row_max (void) const { - Array dummy_idx; + Array dummy_idx; return row_max (dummy_idx); } ColumnVector -Matrix::row_max (Array& idx_arg) const +Matrix::row_max (Array& idx_arg) const { ColumnVector result; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { result.resize (nr); idx_arg.resize (nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { - int idx_j; + octave_idx_type idx_j; double tmp_max = octave_NaN; @@ -2327,7 +2327,7 @@ break; } - for (int j = idx_j+1; j < nc; j++) + for (octave_idx_type j = idx_j+1; j < nc; j++) { double tmp = elem (i, j); @@ -2351,26 +2351,26 @@ RowVector Matrix::column_min (void) const { - Array dummy_idx; + Array dummy_idx; return column_min (dummy_idx); } RowVector -Matrix::column_min (Array& idx_arg) const +Matrix::column_min (Array& idx_arg) const { RowVector result; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { result.resize (nc); idx_arg.resize (nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - int idx_i; + octave_idx_type idx_i; double tmp_min = octave_NaN; @@ -2382,7 +2382,7 @@ break; } - for (int i = idx_i+1; i < nr; i++) + for (octave_idx_type i = idx_i+1; i < nr; i++) { double tmp = elem (i, j); @@ -2406,26 +2406,26 @@ RowVector Matrix::column_max (void) const { - Array dummy_idx; + Array dummy_idx; return column_max (dummy_idx); } RowVector -Matrix::column_max (Array& idx_arg) const +Matrix::column_max (Array& idx_arg) const { RowVector result; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr > 0 && nc > 0) { result.resize (nc); idx_arg.resize (nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - int idx_i; + octave_idx_type idx_i; double tmp_max = octave_NaN; @@ -2437,7 +2437,7 @@ break; } - for (int i = idx_i+1; i < nr; i++) + for (octave_idx_type i = idx_i+1; i < nr; i++) { double tmp = elem (i, j); @@ -2461,9 +2461,9 @@ std::ostream& operator << (std::ostream& os, const Matrix& a) { - for (int i = 0; i < a.rows (); i++) + for (octave_idx_type i = 0; i < a.rows (); i++) { - for (int j = 0; j < a.cols (); j++) + for (octave_idx_type j = 0; j < a.cols (); j++) { os << " "; octave_write_double (os, a.elem (i, j)); @@ -2476,16 +2476,16 @@ std::istream& operator >> (std::istream& is, Matrix& a) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); if (nr < 1 || nc < 1) is.clear (std::ios::badbit); else { double tmp; - for (int i = 0; i < nr; i++) - for (int j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) { tmp = octave_read_double (is); if (is) @@ -2543,11 +2543,11 @@ // Solve the sylvester equation, back-transform, and return the // solution. - int a_nr = a.rows (); - int b_nr = b.rows (); + octave_idx_type a_nr = a.rows (); + octave_idx_type b_nr = b.rows (); double scale; - int info; + octave_idx_type info; double *pa = sch_a.fortran_vec (); double *pb = sch_b.fortran_vec (); @@ -2580,11 +2580,11 @@ { Matrix retval; - int nr = m.rows (); - int nc = m.cols (); - - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.cols (); + + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (nc != a_nr) gripe_nonconformant ("operator *", nr, nc, a_nr, a_nc); @@ -2594,8 +2594,8 @@ retval.resize (nr, a_nc, 0.0); else { - int ld = nr; - int lda = a_nr; + octave_idx_type ld = nr; + octave_idx_type lda = a_nr; retval.resize (nr, a_nc); double *c = retval.fortran_vec (); @@ -2626,15 +2626,15 @@ Matrix min (double d, const Matrix& m) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (Matrix); Matrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmin (d, m (i, j)); @@ -2646,15 +2646,15 @@ Matrix min (const Matrix& m, double d) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (Matrix); Matrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmin (m (i, j), d); @@ -2666,8 +2666,8 @@ Matrix min (const Matrix& a, const Matrix& b) { - int nr = a.rows (); - int nc = a.columns (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.columns (); if (nr != b.rows () || nc != b.columns ()) { @@ -2680,8 +2680,8 @@ Matrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmin (a (i, j), b (i, j)); @@ -2693,15 +2693,15 @@ Matrix max (double d, const Matrix& m) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (Matrix); Matrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmax (d, m (i, j)); @@ -2713,15 +2713,15 @@ Matrix max (const Matrix& m, double d) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (Matrix); Matrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmax (m (i, j), d); @@ -2733,8 +2733,8 @@ Matrix max (const Matrix& a, const Matrix& b) { - int nr = a.rows (); - int nc = a.columns (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.columns (); if (nr != b.rows () || nc != b.columns ()) { @@ -2747,8 +2747,8 @@ Matrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = xmax (a (i, j), b (i, j)); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dMatrix.h --- a/liboctave/dMatrix.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dMatrix.h Fri Apr 08 16:07:37 2005 +0000 @@ -38,9 +38,9 @@ Matrix (void) : MArray2 () { } - Matrix (int r, int c) : MArray2 (r, c) { } + Matrix (octave_idx_type r, octave_idx_type c) : MArray2 (r, c) { } - Matrix (int r, int c, double val) : MArray2 (r, c, val) { } + Matrix (octave_idx_type r, octave_idx_type c, double val) : MArray2 (r, c, val) { } Matrix (const Matrix& a) : MArray2 (a) { } @@ -69,13 +69,13 @@ // destructive insert/delete/reorder operations - Matrix& insert (const Matrix& a, int r, int c); - Matrix& insert (const RowVector& a, int r, int c); - Matrix& insert (const ColumnVector& a, int r, int c); - Matrix& insert (const DiagMatrix& a, int r, int c); + Matrix& insert (const Matrix& a, octave_idx_type r, octave_idx_type c); + Matrix& insert (const RowVector& a, octave_idx_type r, octave_idx_type c); + Matrix& insert (const ColumnVector& a, octave_idx_type r, octave_idx_type c); + Matrix& insert (const DiagMatrix& a, octave_idx_type r, octave_idx_type c); Matrix& fill (double val); - Matrix& fill (double val, int r1, int c1, int r2, int c2); + Matrix& fill (double val, octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); Matrix append (const Matrix& a) const; Matrix append (const RowVector& a) const; @@ -94,21 +94,21 @@ // resize is the destructive equivalent for this one - Matrix extract (int r1, int c1, int r2, int c2) const; + Matrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; - Matrix extract_n (int r1, int c1, int nr, int nc) const; + Matrix extract_n (octave_idx_type r1, octave_idx_type c1, octave_idx_type nr, octave_idx_type nc) const; // extract row or column i. - RowVector row (int i) const; + RowVector row (octave_idx_type i) const; RowVector row (char *s) const; - ColumnVector column (int i) const; + ColumnVector column (octave_idx_type i) const; ColumnVector column (char *s) const; Matrix inverse (void) const; - Matrix inverse (int& info) const; - Matrix inverse (int& info, double& rcond, int force = 0, + Matrix inverse (octave_idx_type& info) const; + Matrix inverse (octave_idx_type& info, double& rcond, int force = 0, int calc_cond = 1) const; Matrix pseudo_inverse (double tol = 0.0) const; @@ -120,52 +120,52 @@ ComplexMatrix ifourier2d (void) const; DET determinant (void) const; - DET determinant (int& info) const; - DET determinant (int& info, double& rcond, int calc_cond = 1) const; + DET determinant (octave_idx_type& info) const; + DET determinant (octave_idx_type& info, double& rcond, int calc_cond = 1) const; Matrix solve (const Matrix& b) const; - Matrix solve (const Matrix& b, int& info) const; - Matrix solve (const Matrix& b, int& info, double& rcond) const; - Matrix solve (const Matrix& b, int& info, double& rcond, + Matrix solve (const Matrix& b, octave_idx_type& info) const; + Matrix solve (const Matrix& b, octave_idx_type& info, double& rcond) const; + Matrix 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, int& info) const; - ComplexMatrix solve (const ComplexMatrix& b, int& info, double& rcond) const; - ComplexMatrix solve (const ComplexMatrix& b, int& info, double& rcond, + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ColumnVector solve (const ColumnVector& b) const; - ColumnVector solve (const ColumnVector& b, int& info) const; - ColumnVector solve (const ColumnVector& b, int& info, double& rcond) const; - ColumnVector solve (const ColumnVector& b, int& info, double& rcond, + ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; + ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const; + ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexColumnVector solve (const ComplexColumnVector& b) const; - ComplexColumnVector solve (const ComplexColumnVector& b, int& info) const; - ComplexColumnVector solve (const ComplexColumnVector& b, int& info, + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const; - ComplexColumnVector solve (const ComplexColumnVector& b, int& info, + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; Matrix lssolve (const Matrix& b) const; - Matrix lssolve (const Matrix& b, int& info) const; - Matrix lssolve (const Matrix& b, int& info, int& rank) const; + Matrix lssolve (const Matrix& b, octave_idx_type& info) const; + Matrix lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank) const; ComplexMatrix lssolve (const ComplexMatrix& b) const; - ComplexMatrix lssolve (const ComplexMatrix& b, int& info) const; - ComplexMatrix lssolve (const ComplexMatrix& b, int& info, - int& rank) const; + ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info) const; + ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info, + octave_idx_type& rank) const; ColumnVector lssolve (const ColumnVector& b) const; - ColumnVector lssolve (const ColumnVector& b, int& info) const; - ColumnVector lssolve (const ColumnVector& b, int& info, int& rank) const; + ColumnVector lssolve (const ColumnVector& b, octave_idx_type& info) const; + ColumnVector lssolve (const ColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const; ComplexColumnVector lssolve (const ComplexColumnVector& b) const; - ComplexColumnVector lssolve (const ComplexColumnVector& b, int& info) const; - ComplexColumnVector lssolve (const ComplexColumnVector& b, int& info, - int& rank) const; + ComplexColumnVector lssolve (const ComplexColumnVector& b, octave_idx_type& info) const; + ComplexColumnVector lssolve (const ComplexColumnVector& b, octave_idx_type& info, + octave_idx_type& rank) const; Matrix expm (void) const; @@ -204,19 +204,19 @@ Matrix abs (void) const; ColumnVector diag (void) const; - ColumnVector diag (int k) const; + ColumnVector diag (octave_idx_type k) const; ColumnVector row_min (void) const; ColumnVector row_max (void) const; - ColumnVector row_min (Array& index) const; - ColumnVector row_max (Array& index) const; + ColumnVector row_min (Array& index) const; + ColumnVector row_max (Array& index) const; RowVector column_min (void) const; RowVector column_max (void) const; - RowVector column_min (Array& index) const; - RowVector column_max (Array& index) const; + RowVector column_min (Array& index) const; + RowVector column_max (Array& index) const; // i/o @@ -227,7 +227,7 @@ private: - Matrix (double *d, int r, int c) : MArray2 (d, r, c) { } + Matrix (double *d, octave_idx_type r, octave_idx_type c) : MArray2 (d, r, c) { } }; extern Matrix Givens (double, double); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dNDArray.cc --- a/liboctave/dNDArray.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dNDArray.cc Fri Apr 08 16:07:37 2005 +0000 @@ -48,23 +48,23 @@ if (dim > dv.length () || dim < 0) return ComplexNDArray (); - int stride = 1; - int n = dv(dim); + octave_idx_type stride = 1; + octave_idx_type n = dv(dim); for (int i = 0; i < dim; i++) stride *= dv(i); - int howmany = numel () / dv (dim); + octave_idx_type howmany = numel () / dv (dim); howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); - int dist = (stride == 1 ? n : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); + octave_idx_type dist = (stride == 1 ? n : 1); const double *in (fortran_vec ()); ComplexNDArray retval (dv); Complex *out (retval.fortran_vec ()); // Need to be careful here about the distance between fft's - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) octave_fftw::fft (in + k * stride * n, out + k * stride * n, n, howmany, stride, dist); @@ -79,22 +79,22 @@ if (dim > dv.length () || dim < 0) return ComplexNDArray (); - int stride = 1; - int n = dv(dim); + octave_idx_type stride = 1; + octave_idx_type n = dv(dim); for (int i = 0; i < dim; i++) stride *= dv(i); - int howmany = numel () / dv (dim); + octave_idx_type howmany = numel () / dv (dim); howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); - int dist = (stride == 1 ? n : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); + octave_idx_type dist = (stride == 1 ? n : 1); ComplexNDArray retval (*this); Complex *out (retval.fortran_vec ()); // Need to be careful here about the distance between fft's - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) octave_fftw::ifft (out + k * stride * n, out + k * stride * n, n, howmany, stride, dist); @@ -112,10 +112,10 @@ const double *in = fortran_vec (); ComplexNDArray retval (dv); Complex *out = retval.fortran_vec (); - int howmany = numel() / dv(0) / dv(1); - int dist = dv(0) * dv(1); + octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type dist = dv(0) * dv(1); - for (int i=0; i < howmany; i++) + for (octave_idx_type i=0; i < howmany; i++) octave_fftw::fftNd (in + i*dist, out + i*dist, 2, dv2); return retval; @@ -131,10 +131,10 @@ dim_vector dv2(dv(0), dv(1)); ComplexNDArray retval (*this); Complex *out = retval.fortran_vec (); - int howmany = numel() / dv(0) / dv(1); - int dist = dv(0) * dv(1); + octave_idx_type howmany = numel() / dv(0) / dv(1); + octave_idx_type dist = dv(0) * dv(1); - for (int i=0; i < howmany; i++) + for (octave_idx_type i=0; i < howmany; i++) octave_fftw::ifftNd (out + i*dist, out + i*dist, 2, dv2); return retval; @@ -181,13 +181,13 @@ // each subroutine. F77_RET_T - F77_FUNC (cffti, CFFTI) (const int&, Complex*); + F77_FUNC (cffti, CFFTI) (const octave_idx_type&, Complex*); F77_RET_T - F77_FUNC (cfftf, CFFTF) (const int&, Complex*, Complex*); + F77_FUNC (cfftf, CFFTF) (const octave_idx_type&, Complex*, Complex*); F77_RET_T - F77_FUNC (cfftb, CFFTB) (const int&, Complex*, Complex*); + F77_FUNC (cfftb, CFFTB) (const octave_idx_type&, Complex*, Complex*); } ComplexNDArray @@ -199,37 +199,37 @@ return ComplexNDArray (); ComplexNDArray retval (dv); - int npts = dv(dim); - int nn = 4*npts+15; + octave_idx_type npts = dv(dim); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); OCTAVE_LOCAL_BUFFER (Complex, tmp, npts); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < dim; i++) stride *= dv(i); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) tmp[i] = elem((i + k*npts)*stride + j*dist); F77_FUNC (cfftf, CFFTF) (npts, tmp, pwsave); - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) retval ((i + k*npts)*stride + j*dist) = tmp[i]; } } @@ -246,37 +246,37 @@ return ComplexNDArray (); ComplexNDArray retval (dv); - int npts = dv(dim); - int nn = 4*npts+15; + octave_idx_type npts = dv(dim); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); OCTAVE_LOCAL_BUFFER (Complex, tmp, npts); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < dim; i++) stride *= dv(i); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) tmp[i] = elem((i + k*npts)*stride + j*dist); F77_FUNC (cfftb, CFFTB) (npts, tmp, pwsave); - for (int i = 0; i < npts; i++) + for (octave_idx_type i = 0; i < npts; i++) retval ((i + k*npts)*stride + j*dist) = tmp[i] / static_cast (npts); } @@ -292,37 +292,37 @@ dim_vector dv2 (dv(0), dv(1)); int rank = 2; ComplexNDArray retval (*this); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < rank; i++) { - int npts = dv2(i); - int nn = 4*npts+15; + octave_idx_type npts = dv2(i); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); Array row (npts); Complex *prow = row.fortran_vec (); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) prow[l] = retval ((l + k*npts)*stride + j*dist); F77_FUNC (cfftf, CFFTF) (npts, prow, pwsave); - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) retval ((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -340,37 +340,37 @@ dim_vector dv2 (dv(0), dv(1)); int rank = 2; ComplexNDArray retval (*this); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < rank; i++) { - int npts = dv2(i); - int nn = 4*npts+15; + octave_idx_type npts = dv2(i); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); Array row (npts); Complex *prow = row.fortran_vec (); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) prow[l] = retval ((l + k*npts)*stride + j*dist); F77_FUNC (cfftb, CFFTB) (npts, prow, pwsave); - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) retval ((l + k*npts)*stride + j*dist) = prow[l] / static_cast (npts); } @@ -388,37 +388,37 @@ dim_vector dv = dims (); int rank = dv.length (); ComplexNDArray retval (*this); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < rank; i++) { - int npts = dv(i); - int nn = 4*npts+15; + octave_idx_type npts = dv(i); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); Array row (npts); Complex *prow = row.fortran_vec (); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) prow[l] = retval ((l + k*npts)*stride + j*dist); F77_FUNC (cfftf, CFFTF) (npts, prow, pwsave); - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) retval ((l + k*npts)*stride + j*dist) = prow[l]; } } @@ -435,37 +435,37 @@ dim_vector dv = dims (); int rank = dv.length (); ComplexNDArray retval (*this); - int stride = 1; + octave_idx_type stride = 1; for (int i = 0; i < rank; i++) { - int npts = dv(i); - int nn = 4*npts+15; + octave_idx_type npts = dv(i); + octave_idx_type nn = 4*npts+15; Array wsave (nn); Complex *pwsave = wsave.fortran_vec (); Array row (npts); Complex *prow = row.fortran_vec (); - int howmany = numel () / npts; + octave_idx_type howmany = numel () / npts; howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); - int nloop = (stride == 1 ? 1 : numel () / npts / stride); - int dist = (stride == 1 ? npts : 1); + octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); + octave_idx_type dist = (stride == 1 ? npts : 1); F77_FUNC (cffti, CFFTI) (npts, pwsave); - for (int k = 0; k < nloop; k++) + for (octave_idx_type k = 0; k < nloop; k++) { - for (int j = 0; j < howmany; j++) + for (octave_idx_type j = 0; j < howmany; j++) { OCTAVE_QUIT; - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) prow[l] = retval ((l + k*npts)*stride + j*dist); F77_FUNC (cfftb, CFFTB) (npts, prow, pwsave); - for (int l = 0; l < npts; l++) + for (octave_idx_type l = 0; l < npts; l++) retval ((l + k*npts)*stride + j*dist) = prow[l] / static_cast (npts); } @@ -486,7 +486,7 @@ { boolNDArray b (dims ()); - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) b.elem (i) = ! elem (i); return b; @@ -495,17 +495,17 @@ bool NDArray::any_element_is_negative (bool neg_zero) const { - int nel = nelem (); + octave_idx_type nel = nelem (); if (neg_zero) { - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) if (lo_ieee_signbit (elem (i))) return true; } else { - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) if (elem (i) < 0) return true; } @@ -517,9 +517,9 @@ bool NDArray::any_element_is_inf_or_nan (void) const { - int nel = nelem (); + octave_idx_type nel = nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { double val = elem (i); if (xisinf (val) || xisnan (val)) @@ -532,9 +532,9 @@ bool NDArray::all_elements_are_int_or_inf_or_nan (void) const { - int nel = nelem (); + octave_idx_type nel = nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { double val = elem (i); if (xisnan (val) || D_NINT (val) == val) @@ -552,7 +552,7 @@ bool NDArray::all_integers (double& max_val, double& min_val) const { - int nel = nelem (); + octave_idx_type nel = nelem (); if (nel > 0) { @@ -562,7 +562,7 @@ else return false; - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { double val = elem (i); @@ -582,9 +582,9 @@ bool NDArray::too_large_for_float (void) const { - int nel = nelem (); + octave_idx_type nel = nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { double val = elem (i); @@ -644,12 +644,12 @@ NDArray NDArray::max (int dim) const { - ArrayN dummy_idx; + ArrayN dummy_idx; return max (dummy_idx, dim); } NDArray -NDArray::max (ArrayN& idx_arg, int dim) const +NDArray::max (ArrayN& idx_arg, int dim) const { dim_vector dv = dims (); dim_vector dr = dims (); @@ -662,19 +662,19 @@ NDArray result (dr); idx_arg.resize (dr); - int x_stride = 1; - int x_len = dv(dim); + octave_idx_type x_stride = 1; + octave_idx_type x_len = dv(dim); for (int i = 0; i < dim; i++) x_stride *= dv(i); - for (int i = 0; i < dr.numel (); i++) + for (octave_idx_type i = 0; i < dr.numel (); i++) { - int x_offset; + octave_idx_type x_offset; if (x_stride == 1) x_offset = i * x_len; else { - int x_offset2 = 0; + octave_idx_type x_offset2 = 0; x_offset = i; while (x_offset >= x_stride) { @@ -684,7 +684,7 @@ x_offset += x_offset2 * x_stride * x_len; } - int idx_j; + octave_idx_type idx_j; double tmp_max = octave_NaN; @@ -696,7 +696,7 @@ break; } - for (int j = idx_j+1; j < x_len; j++) + for (octave_idx_type j = idx_j+1; j < x_len; j++) { double tmp = elem (j * x_stride + x_offset); @@ -719,12 +719,12 @@ NDArray NDArray::min (int dim) const { - ArrayN dummy_idx; + ArrayN dummy_idx; return min (dummy_idx, dim); } NDArray -NDArray::min (ArrayN& idx_arg, int dim) const +NDArray::min (ArrayN& idx_arg, int dim) const { dim_vector dv = dims (); dim_vector dr = dims (); @@ -737,19 +737,19 @@ NDArray result (dr); idx_arg.resize (dr); - int x_stride = 1; - int x_len = dv(dim); + octave_idx_type x_stride = 1; + octave_idx_type x_len = dv(dim); for (int i = 0; i < dim; i++) x_stride *= dv(i); - for (int i = 0; i < dr.numel (); i++) + for (octave_idx_type i = 0; i < dr.numel (); i++) { - int x_offset; + octave_idx_type x_offset; if (x_stride == 1) x_offset = i * x_len; else { - int x_offset2 = 0; + octave_idx_type x_offset2 = 0; x_offset = i; while (x_offset >= x_stride) { @@ -759,7 +759,7 @@ x_offset += x_offset2 * x_stride * x_len; } - int idx_j; + octave_idx_type idx_j; double tmp_min = octave_NaN; @@ -771,7 +771,7 @@ break; } - for (int j = idx_j+1; j < x_len; j++) + for (octave_idx_type j = idx_j+1; j < x_len; j++) { double tmp = elem (j * x_stride + x_offset); @@ -792,7 +792,7 @@ } NDArray -NDArray::concat (const NDArray& rb, const Array& ra_idx) +NDArray::concat (const NDArray& rb, const Array& ra_idx) { if (rb.numel () > 0) insert (rb, ra_idx); @@ -800,7 +800,7 @@ } ComplexNDArray -NDArray::concat (const ComplexNDArray& rb, const Array& ra_idx) +NDArray::concat (const ComplexNDArray& rb, const Array& ra_idx) { ComplexNDArray retval (*this); if (rb.numel () > 0) @@ -809,12 +809,12 @@ } charNDArray -NDArray::concat (const charNDArray& rb, const Array& ra_idx) +NDArray::concat (const charNDArray& rb, const Array& ra_idx) { charNDArray retval (dims ()); - int nel = numel (); + octave_idx_type nel = numel (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { double d = elem (i); @@ -826,7 +826,7 @@ } else { - int ival = NINT (d); + octave_idx_type ival = NINTbig (d); if (ival < 0 || ival > UCHAR_MAX) // XXX FIXME XXX -- is there something @@ -847,7 +847,7 @@ NDArray real (const ComplexNDArray& a) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); NDArray retval; if (a_len > 0) retval = NDArray (mx_inline_real_dup (a.data (), a_len), a.dims ()); @@ -857,7 +857,7 @@ NDArray imag (const ComplexNDArray& a) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); NDArray retval; if (a_len > 0) retval = NDArray (mx_inline_imag_dup (a.data (), a_len), a.dims ()); @@ -865,14 +865,14 @@ } NDArray& -NDArray::insert (const NDArray& a, int r, int c) +NDArray::insert (const NDArray& a, octave_idx_type r, octave_idx_type c) { Array::insert (a, r, c); return *this; } NDArray& -NDArray::insert (const NDArray& a, const Array& ra_idx) +NDArray::insert (const NDArray& a, const Array& ra_idx) { Array::insert (a, ra_idx); return *this; @@ -883,9 +883,9 @@ { NDArray retval (dims ()); - int nel = nelem (); + octave_idx_type nel = nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) retval(i) = fabs (elem (i)); return retval; @@ -918,15 +918,15 @@ } void -NDArray::increment_index (Array& ra_idx, +NDArray::increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension) { ::increment_index (ra_idx, dimensions, start_dimension); } -int -NDArray::compute_index (Array& ra_idx, +octave_idx_type +NDArray::compute_index (Array& ra_idx, const dim_vector& dimensions) { return ::compute_index (ra_idx, dimensions); @@ -936,9 +936,9 @@ std::ostream& operator << (std::ostream& os, const NDArray& a) { - int nel = a.nelem (); + octave_idx_type nel = a.nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { os << " "; octave_write_double (os, a.elem (i)); @@ -950,14 +950,14 @@ std::istream& operator >> (std::istream& is, NDArray& a) { - int nel = a.nelem (); + octave_idx_type nel = a.nelem (); if (nel < 1 ) is.clear (std::ios::badbit); else { double tmp; - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { tmp = octave_read_double (is); if (is) @@ -983,13 +983,13 @@ min (double d, const NDArray& m) { dim_vector dv = m.dims (); - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); EMPTY_RETURN_CHECK (NDArray); NDArray result (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { OCTAVE_QUIT; result (i) = xmin (d, m (i)); @@ -1002,13 +1002,13 @@ min (const NDArray& m, double d) { dim_vector dv = m.dims (); - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); EMPTY_RETURN_CHECK (NDArray); NDArray result (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { OCTAVE_QUIT; result (i) = xmin (d, m (i)); @@ -1021,7 +1021,7 @@ min (const NDArray& a, const NDArray& b) { dim_vector dv = a.dims (); - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); if (dv != b.dims ()) { @@ -1034,7 +1034,7 @@ NDArray result (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { OCTAVE_QUIT; result (i) = xmin (a (i), b (i)); @@ -1047,13 +1047,13 @@ max (double d, const NDArray& m) { dim_vector dv = m.dims (); - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); EMPTY_RETURN_CHECK (NDArray); NDArray result (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { OCTAVE_QUIT; result (i) = xmax (d, m (i)); @@ -1066,13 +1066,13 @@ max (const NDArray& m, double d) { dim_vector dv = m.dims (); - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); EMPTY_RETURN_CHECK (NDArray); NDArray result (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { OCTAVE_QUIT; result (i) = xmax (d, m (i)); @@ -1085,7 +1085,7 @@ max (const NDArray& a, const NDArray& b) { dim_vector dv = a.dims (); - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); if (dv != b.dims ()) { @@ -1098,7 +1098,7 @@ NDArray result (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { OCTAVE_QUIT; result (i) = xmax (a (i), b (i)); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dNDArray.h --- a/liboctave/dNDArray.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dNDArray.h Fri Apr 08 16:07:37 2005 +0000 @@ -77,17 +77,17 @@ NDArray prod (int dim = -1) const; NDArray sum (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); - charNDArray concat (const charNDArray& rb, const Array& ra_idx); + NDArray concat (const NDArray& rb, const Array& ra_idx); + ComplexNDArray concat (const ComplexNDArray& rb, const Array& ra_idx); + charNDArray concat (const charNDArray& rb, const Array& ra_idx); NDArray max (int dim = 0) const; - NDArray max (ArrayN& index, int dim = 0) const; + NDArray max (ArrayN& index, int dim = 0) const; NDArray min (int dim = 0) const; - NDArray min (ArrayN& index, int dim = 0) const; + NDArray min (ArrayN& index, int dim = 0) const; - NDArray& insert (const NDArray& a, int r, int c); - NDArray& insert (const NDArray& a, const Array& ra_idx); + NDArray& insert (const NDArray& a, octave_idx_type r, octave_idx_type c); + NDArray& insert (const NDArray& a, const Array& ra_idx); NDArray abs (void) const; @@ -107,11 +107,11 @@ NDArray squeeze (void) const { return MArrayN::squeeze (); } - static void increment_index (Array& ra_idx, + static void increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension = 0); - static int compute_index (Array& ra_idx, + static octave_idx_type compute_index (Array& ra_idx, const dim_vector& dimensions); // i/o diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dRowVector.cc --- a/liboctave/dRowVector.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dRowVector.cc Fri Apr 08 16:07:37 2005 +0000 @@ -40,13 +40,13 @@ { F77_RET_T F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const double&, - const double*, const int&, const double*, - const int&, const double&, double*, const int& + const octave_idx_type&, const octave_idx_type&, const double&, + const double*, const octave_idx_type&, const double*, + const octave_idx_type&, const double&, double*, const octave_idx_type& F77_CHAR_ARG_LEN_DECL); - double F77_FUNC (ddot, DDOT) (const int&, const double*, const int&, - const double*, const int&); + double F77_FUNC (ddot, DDOT) (const octave_idx_type&, const double*, const octave_idx_type&, + const double*, const octave_idx_type&); } // Row Vector class. @@ -54,7 +54,7 @@ bool RowVector::operator == (const RowVector& a) const { - int len = length (); + octave_idx_type len = length (); if (len != a.length ()) return 0; return mx_inline_equal (data (), a.data (), len); @@ -67,9 +67,9 @@ } RowVector& -RowVector::insert (const RowVector& a, int c) +RowVector::insert (const RowVector& a, octave_idx_type c) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (c < 0 || c + a_len > length ()) { @@ -81,7 +81,7 @@ { make_unique (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) xelem (c+i) = a.elem (i); } @@ -91,13 +91,13 @@ RowVector& RowVector::fill (double val) { - int len = length (); + octave_idx_type len = length (); if (len > 0) { make_unique (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) xelem (i) = val; } @@ -105,9 +105,9 @@ } RowVector& -RowVector::fill (double val, int c1, int c2) +RowVector::fill (double val, octave_idx_type c1, octave_idx_type c2) { - int len = length (); + octave_idx_type len = length (); if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) { @@ -115,13 +115,13 @@ return *this; } - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } if (c2 >= c1) { make_unique (); - for (int i = c1; i <= c2; i++) + for (octave_idx_type i = c1; i <= c2; i++) xelem (i) = val; } @@ -131,8 +131,8 @@ RowVector RowVector::append (const RowVector& a) const { - int len = length (); - int nc_insert = len; + octave_idx_type len = length (); + octave_idx_type nc_insert = len; RowVector retval (len + a.length ()); retval.insert (*this, 0); retval.insert (a, nc_insert); @@ -148,7 +148,7 @@ RowVector real (const ComplexRowVector& a) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); RowVector retval; if (a_len > 0) retval = RowVector (mx_inline_real_dup (a.data (), a_len), a_len); @@ -158,7 +158,7 @@ RowVector imag (const ComplexRowVector& a) { - int a_len = a.length (); + octave_idx_type a_len = a.length (); RowVector retval; if (a_len > 0) retval = RowVector (mx_inline_imag_dup (a.data (), a_len), a_len); @@ -166,26 +166,26 @@ } RowVector -RowVector::extract (int c1, int c2) const +RowVector::extract (octave_idx_type c1, octave_idx_type c2) const { - if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } - int new_c = c2 - c1 + 1; + octave_idx_type new_c = c2 - c1 + 1; RowVector result (new_c); - for (int i = 0; i < new_c; i++) + for (octave_idx_type i = 0; i < new_c; i++) result.xelem (i) = elem (c1+i); return result; } RowVector -RowVector::extract_n (int r1, int n) const +RowVector::extract_n (octave_idx_type r1, octave_idx_type n) const { RowVector result (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) result.xelem (i) = elem (r1+i); return result; @@ -198,10 +198,10 @@ { RowVector retval; - int len = v.length (); + octave_idx_type len = v.length (); - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (a_nr != len) gripe_nonconformant ("operator *", 1, len, a_nr, a_nc); @@ -213,7 +213,7 @@ { // Transpose A to form A'*x == (x'*A)' - int ld = a_nr; + octave_idx_type ld = a_nr; retval.resize (a_nc); double *y = retval.fortran_vec (); @@ -246,7 +246,7 @@ { double *d = fortran_vec (); // Ensures only one reference to my privates! - for (int i = 0; i < length (); i++) + for (octave_idx_type i = 0; i < length (); i++) d[i] = f (d[i]); return *this; @@ -255,13 +255,13 @@ double RowVector::min (void) const { - int len = length (); + octave_idx_type len = length (); if (len == 0) return 0; double res = elem (0); - for (int i = 1; i < len; i++) + for (octave_idx_type i = 1; i < len; i++) if (elem (i) < res) res = elem (i); @@ -271,13 +271,13 @@ double RowVector::max (void) const { - int len = length (); + octave_idx_type len = length (); if (len == 0) return 0; double res = elem (0); - for (int i = 1; i < len; i++) + for (octave_idx_type i = 1; i < len; i++) if (elem (i) > res) res = elem (i); @@ -289,7 +289,7 @@ { // int field_width = os.precision () + 7; - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) os << " " /* setw (field_width) */ << a.elem (i); return os; } @@ -297,14 +297,14 @@ std::istream& operator >> (std::istream& is, RowVector& a) { - int len = a.length(); + octave_idx_type len = a.length(); if (len < 1) is.clear (std::ios::badbit); else { double tmp; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { is >> tmp; if (is) @@ -319,7 +319,7 @@ // other operations RowVector -linspace (double x1, double x2, int n) +linspace (double x1, double x2, octave_idx_type n) { RowVector retval; @@ -328,7 +328,7 @@ retval.resize (n); double delta = (x2 - x1) / (n - 1); retval.elem (0) = x1; - for (int i = 1; i < n-1; i++) + for (octave_idx_type i = 1; i < n-1; i++) retval.elem (i) = x1 + i * delta; retval.elem (n-1) = x2; } @@ -357,9 +357,9 @@ { double retval = 0.0; - int len = v.length (); + octave_idx_type len = v.length (); - int a_len = a.length (); + octave_idx_type a_len = a.length (); if (len != a_len) gripe_nonconformant ("operator *", len, a_len); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dRowVector.h --- a/liboctave/dRowVector.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dRowVector.h Fri Apr 08 16:07:37 2005 +0000 @@ -34,9 +34,9 @@ RowVector (void) : MArray () { } - explicit RowVector (int n) : MArray (n) { } + explicit RowVector (octave_idx_type n) : MArray (n) { } - RowVector (int n, double val) : MArray (n, val) { } + RowVector (octave_idx_type n, double val) : MArray (n, val) { } RowVector (const RowVector& a) : MArray (a) { } @@ -53,10 +53,10 @@ // destructive insert/delete/reorder operations - RowVector& insert (const RowVector& a, int c); + RowVector& insert (const RowVector& a, octave_idx_type c); RowVector& fill (double val); - RowVector& fill (double val, int c1, int c2); + RowVector& fill (double val, octave_idx_type c1, octave_idx_type c2); RowVector append (const RowVector& a) const; @@ -67,9 +67,9 @@ // resize is the destructive equivalent for this one - RowVector extract (int c1, int c2) const; + RowVector extract (octave_idx_type c1, octave_idx_type c2) const; - RowVector extract_n (int c1, int n) const; + RowVector extract_n (octave_idx_type c1, octave_idx_type n) const; // row vector by matrix -> row vector @@ -91,7 +91,7 @@ private: - RowVector (double *d, int l) : MArray (d, l) { } + RowVector (double *d, octave_idx_type l) : MArray (d, l) { } }; // row vector by column vector -> scalar @@ -102,7 +102,7 @@ // other operations -RowVector linspace (double x1, double x2, int n); +RowVector linspace (double x1, double x2, octave_idx_type n); MARRAY_FORWARD_DEFS (MArray, RowVector, double) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dSparse.cc --- a/liboctave/dSparse.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dSparse.cc Fri Apr 08 16:07:37 2005 +0000 @@ -52,78 +52,78 @@ extern "C" { F77_RET_T - F77_FUNC (dgbtrf, DGBTRF) (const int&, const int&, const int&, - const int&, double*, const int&, int*, int&); + F77_FUNC (dgbtrf, DGBTRF) (const octave_idx_type&, const int&, const octave_idx_type&, + const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type*, octave_idx_type&); F77_RET_T - F77_FUNC (dgbtrs, DGBTRS) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, const int&, const int&, - const double*, const int&, - const int*, double*, const int&, int& + F77_FUNC (dgbtrs, DGBTRS) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + const double*, const octave_idx_type&, + const octave_idx_type*, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dgbcon, DGBCON) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, const int&, double*, - const int&, const int*, const double&, - double&, double*, int*, int& + F77_FUNC (dgbcon, DGBCON) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, double*, + const octave_idx_type&, const octave_idx_type*, const double&, + double&, double*, octave_idx_type*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dpbtrf, DPBTRF) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, double*, const int&, int& + F77_FUNC (dpbtrf, DPBTRF) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dpbtrs, DPBTRS) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, const int&, double*, const int&, - double*, const int&, int& + F77_FUNC (dpbtrs, DPBTRS) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, const octave_idx_type&, double*, const octave_idx_type&, + double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dpbcon, DPBCON) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, double*, const int&, - const double&, double&, double*, int*, int& + F77_FUNC (dpbcon, DPBCON) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, double*, const octave_idx_type&, + const double&, double&, double*, octave_idx_type*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dptsv, DPTSV) (const int&, const int&, double*, double*, - double*, const int&, int&); + F77_FUNC (dptsv, DPTSV) (const octave_idx_type&, const octave_idx_type&, double*, double*, + double*, const octave_idx_type&, octave_idx_type&); F77_RET_T - F77_FUNC (dgtsv, DGTSV) (const int&, const int&, double*, double*, - double*, double*, const int&, int&); + F77_FUNC (dgtsv, DGTSV) (const octave_idx_type&, const octave_idx_type&, double*, double*, + double*, double*, const octave_idx_type&, octave_idx_type&); F77_RET_T - F77_FUNC (dgttrf, DGTTRF) (const int&, double*, double*, double*, double*, - int*, int&); + F77_FUNC (dgttrf, DGTTRF) (const octave_idx_type&, double*, double*, double*, double*, + octave_idx_type*, octave_idx_type&); F77_RET_T - F77_FUNC (dgttrs, DGTTRS) (F77_CONST_CHAR_ARG_DECL, const int&, - const int&, const double*, const double*, - const double*, const double*, const int*, - double *, const int&, int& + F77_FUNC (dgttrs, DGTTRS) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type&, + const octave_idx_type&, const double*, const double*, + const 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 (zptsv, ZPTSV) (const int&, const int&, Complex*, Complex*, - Complex*, const int&, int&); + F77_FUNC (zptsv, ZPTSV) (const octave_idx_type&, const octave_idx_type&, Complex*, Complex*, + Complex*, const octave_idx_type&, octave_idx_type&); F77_RET_T - F77_FUNC (zgtsv, ZGTSV) (const int&, const int&, Complex*, Complex*, - Complex*, Complex*, const int&, int&); + F77_FUNC (zgtsv, ZGTSV) (const octave_idx_type&, const octave_idx_type&, Complex*, Complex*, + Complex*, Complex*, const octave_idx_type&, octave_idx_type&); } SparseMatrix::SparseMatrix (const SparseBoolMatrix &a) : MSparse (a.rows (), a.cols (), a.nnz ()) { - int nc = cols (); - int nz = nnz (); - - for (int i = 0; i < nc + 1; i++) + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); + + for (octave_idx_type i = 0; i < nc + 1; i++) cidx (i) = a.cidx (i); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { data (i) = a.data (i); ridx (i) = a.ridx (i); @@ -133,21 +133,21 @@ bool SparseMatrix::operator == (const SparseMatrix& a) const { - int nr = rows (); - int nc = cols (); - int nz = nnz (); - int nr_a = a.rows (); - int nc_a = a.cols (); - int nz_a = a.nnz (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); + octave_idx_type nr_a = a.rows (); + octave_idx_type nc_a = a.cols (); + octave_idx_type nz_a = a.nnz (); if (nr != nr_a || nc != nc_a || nz != nz_a) return false; - for (int i = 0; i < nc + 1; i++) + for (octave_idx_type i = 0; i < nc + 1; i++) if (cidx(i) != a.cidx(i)) return false; - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) if (data(i) != a.data(i) || ridx(i) != a.ridx(i)) return false; @@ -165,8 +165,8 @@ { if (is_square () && rows () > 0) { - for (int i = 0; i < rows (); i++) - for (int j = i+1; j < cols (); j++) + for (octave_idx_type i = 0; i < rows (); i++) + for (octave_idx_type j = i+1; j < cols (); j++) if (elem (i, j) != elem (j, i)) return false; @@ -177,7 +177,7 @@ } SparseMatrix& -SparseMatrix::insert (const SparseMatrix& a, int r, int c) +SparseMatrix::insert (const SparseMatrix& a, octave_idx_type r, octave_idx_type c) { MSparse::insert (a, r, c); return *this; @@ -186,12 +186,12 @@ SparseMatrix SparseMatrix::max (int dim) const { - Array2 dummy_idx; + Array2 dummy_idx; return max (dummy_idx, dim); } SparseMatrix -SparseMatrix::max (Array2& idx_arg, int dim) const +SparseMatrix::max (Array2& idx_arg, int dim) const { SparseMatrix result; dim_vector dv = dims (); @@ -199,18 +199,18 @@ if (dv.numel () == 0 || dim > dv.length () || dim < 0) return result; - int nr = dv(0); - int nc = dv(1); + octave_idx_type nr = dv(0); + octave_idx_type nc = dv(1); if (dim == 0) { idx_arg.resize (1, nc); - int nel = 0; - for (int j = 0; j < nc; j++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nc; j++) { double tmp_max = octave_NaN; - int idx_j = 0; - for (int i = cidx(j); i < cidx(j+1); i++) + octave_idx_type idx_j = 0; + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) != idx_j) break; @@ -221,7 +221,7 @@ if (idx_j != nr) tmp_max = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { double tmp = data (i); @@ -242,9 +242,9 @@ result = SparseMatrix (1, nc, nel); - int ii = 0; + octave_idx_type ii = 0; result.xcidx (0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { double tmp = elem (idx_arg(j), j); if (tmp != 0.) @@ -260,16 +260,16 @@ { idx_arg.resize (nr, 1, 0); - for (int i = cidx(0); i < cidx(1); i++) + for (octave_idx_type i = cidx(0); i < cidx(1); i++) idx_arg.elem(ridx(i)) = -1; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { if (idx_arg.elem(i) != -1) continue; bool found = false; - for (int k = cidx(j); k < cidx(j+1); k++) + for (octave_idx_type k = cidx(j); k < cidx(j+1); k++) if (ridx(k) == i) { found = true; @@ -281,12 +281,12 @@ } - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ir = ridx (i); - int ix = idx_arg.elem (ir); + octave_idx_type ir = ridx (i); + octave_idx_type ix = idx_arg.elem (ir); double tmp = data (i); if (octave_is_NaN_or_NA (tmp)) @@ -296,17 +296,17 @@ } } - int nel = 0; - for (int j = 0; j < nr; j++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nr; j++) if (idx_arg.elem(j) == -1 || elem (j, idx_arg.elem (j)) != 0.) nel++; result = SparseMatrix (nr, 1, nel); - int ii = 0; + octave_idx_type ii = 0; result.xcidx (0) = 0; result.xcidx (1) = nel; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { if (idx_arg(j) == -1) { @@ -332,12 +332,12 @@ SparseMatrix SparseMatrix::min (int dim) const { - Array2 dummy_idx; + Array2 dummy_idx; return min (dummy_idx, dim); } SparseMatrix -SparseMatrix::min (Array2& idx_arg, int dim) const +SparseMatrix::min (Array2& idx_arg, int dim) const { SparseMatrix result; dim_vector dv = dims (); @@ -345,18 +345,18 @@ if (dv.numel () == 0 || dim > dv.length () || dim < 0) return result; - int nr = dv(0); - int nc = dv(1); + octave_idx_type nr = dv(0); + octave_idx_type nc = dv(1); if (dim == 0) { idx_arg.resize (1, nc); - int nel = 0; - for (int j = 0; j < nc; j++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nc; j++) { double tmp_min = octave_NaN; - int idx_j = 0; - for (int i = cidx(j); i < cidx(j+1); i++) + octave_idx_type idx_j = 0; + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) != idx_j) break; @@ -367,7 +367,7 @@ if (idx_j != nr) tmp_min = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { double tmp = data (i); @@ -388,9 +388,9 @@ result = SparseMatrix (1, nc, nel); - int ii = 0; + octave_idx_type ii = 0; result.xcidx (0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { double tmp = elem (idx_arg(j), j); if (tmp != 0.) @@ -406,16 +406,16 @@ { idx_arg.resize (nr, 1, 0); - for (int i = cidx(0); i < cidx(1); i++) + for (octave_idx_type i = cidx(0); i < cidx(1); i++) idx_arg.elem(ridx(i)) = -1; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { if (idx_arg.elem(i) != -1) continue; bool found = false; - for (int k = cidx(j); k < cidx(j+1); k++) + for (octave_idx_type k = cidx(j); k < cidx(j+1); k++) if (ridx(k) == i) { found = true; @@ -427,12 +427,12 @@ } - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ir = ridx (i); - int ix = idx_arg.elem (ir); + octave_idx_type ir = ridx (i); + octave_idx_type ix = idx_arg.elem (ir); double tmp = data (i); if (octave_is_NaN_or_NA (tmp)) @@ -442,17 +442,17 @@ } } - int nel = 0; - for (int j = 0; j < nr; j++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nr; j++) if (idx_arg.elem(j) == -1 || elem (j, idx_arg.elem (j)) != 0.) nel++; result = SparseMatrix (nr, 1, nel); - int ii = 0; + octave_idx_type ii = 0; result.xcidx (0) = 0; result.xcidx (1) = nel; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { if (idx_arg(j) == -1) { @@ -476,7 +476,7 @@ } SparseMatrix -SparseMatrix::concat (const SparseMatrix& rb, const Array& ra_idx) +SparseMatrix::concat (const SparseMatrix& rb, const Array& ra_idx) { // Don't use numel to avoid all possiblity of an overflow if (rb.rows () > 0 && rb.cols () > 0) @@ -485,7 +485,7 @@ } SparseComplexMatrix -SparseMatrix::concat (const SparseComplexMatrix& rb, const Array& ra_idx) +SparseMatrix::concat (const SparseComplexMatrix& rb, const Array& ra_idx) { SparseComplexMatrix retval (*this); if (rb.rows () > 0 && rb.cols () > 0) @@ -496,15 +496,15 @@ SparseMatrix real (const SparseComplexMatrix& a) { - int nr = a.rows (); - int nc = a.cols (); - int nz = a.nnz (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type nz = a.nnz (); SparseMatrix r (nr, nc, nz); - for (int i = 0; i < nc +1; i++) + for (octave_idx_type i = 0; i < nc +1; i++) r.cidx(i) = a.cidx(i); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { r.data(i) = std::real (a.data(i)); r.ridx(i) = a.ridx(i); @@ -516,15 +516,15 @@ SparseMatrix imag (const SparseComplexMatrix& a) { - int nr = a.rows (); - int nc = a.cols (); - int nz = a.nnz (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type nz = a.nnz (); SparseMatrix r (nr, nc, nz); - for (int i = 0; i < nc +1; i++) + for (octave_idx_type i = 0; i < nc +1; i++) r.cidx(i) = a.cidx(i); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { r.data(i) = std::imag (a.data(i)); r.ridx(i) = a.ridx(i); @@ -536,8 +536,8 @@ SparseMatrix atan2 (const double& x, const SparseMatrix& y) { - int nr = y.rows (); - int nc = y.cols (); + octave_idx_type nr = y.rows (); + octave_idx_type nc = y.cols (); if (x == 0.) return SparseMatrix (nr, nc); @@ -547,8 +547,8 @@ // best way to handle it. Matrix tmp (nr, nc, atan2 (x, 0.)); - for (int j = 0; j < nc; j++) - for (int i = y.cidx (j); i < y.cidx (j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = y.cidx (j); i < y.cidx (j+1); i++) tmp.elem (y.ridx(i), j) = atan2 (x, y.data(i)); return SparseMatrix (tmp); @@ -558,17 +558,17 @@ SparseMatrix atan2 (const SparseMatrix& x, const double& y) { - int nr = x.rows (); - int nc = x.cols (); - int nz = x.nnz (); + octave_idx_type nr = x.rows (); + octave_idx_type nc = x.cols (); + octave_idx_type nz = x.nnz (); SparseMatrix retval (nr, nc, nz); - int ii = 0; + octave_idx_type ii = 0; retval.xcidx(0) = 0; - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { - for (int j = x.cidx(i); j < x.cidx(i+1); j++) + for (octave_idx_type j = x.cidx(i); j < x.cidx(i+1); j++) { double tmp = atan2 (x.data(j), y); if (tmp != 0.) @@ -583,9 +583,9 @@ if (ii != nz) { SparseMatrix retval2 (nr, nc, ii); - for (int i = 0; i < nc+1; i++) + for (octave_idx_type i = 0; i < nc+1; i++) retval2.xcidx (i) = retval.cidx (i); - for (int i = 0; i < ii; i++) + for (octave_idx_type i = 0; i < ii; i++) { retval2.xdata (i) = retval.data (i); retval2.xridx (i) = retval.ridx (i); @@ -603,11 +603,11 @@ if ((x.rows() == y.rows()) && (x.cols() == y.cols())) { - int x_nr = x.rows (); - int x_nc = x.cols (); - - int y_nr = y.rows (); - int y_nc = y.cols (); + octave_idx_type x_nr = x.rows (); + octave_idx_type x_nc = x.cols (); + + octave_idx_type y_nr = y.rows (); + octave_idx_type y_nc = y.cols (); if (x_nr != y_nr || x_nc != y_nc) gripe_nonconformant ("atan2", x_nr, x_nc, y_nr, y_nc); @@ -615,16 +615,16 @@ { r = SparseMatrix (x_nr, x_nc, (x.nnz () + y.nnz ())); - int jx = 0; + octave_idx_type jx = 0; r.cidx (0) = 0; - for (int i = 0 ; i < x_nc ; i++) + for (octave_idx_type i = 0 ; i < x_nc ; i++) { - int ja = x.cidx(i); - int ja_max = x.cidx(i+1); + octave_idx_type ja = x.cidx(i); + octave_idx_type ja_max = x.cidx(i+1); bool ja_lt_max= ja < ja_max; - int jb = y.cidx(i); - int jb_max = y.cidx(i+1); + 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 ) @@ -675,20 +675,20 @@ SparseMatrix SparseMatrix::inverse (void) const { - int info; + octave_idx_type info; double rcond; return inverse (info, rcond, 0, 0); } SparseMatrix -SparseMatrix::inverse (int& info) const +SparseMatrix::inverse (octave_idx_type& info) const { double rcond; return inverse (info, rcond, 0, 0); } SparseMatrix -SparseMatrix::inverse (int& info, double& rcond, int force, int calc_cond) const +SparseMatrix::inverse (octave_idx_type& info, double& rcond, int force, int calc_cond) const { info = -1; (*current_liboctave_error_handler) @@ -699,26 +699,26 @@ DET SparseMatrix::determinant (void) const { - int info; + octave_idx_type info; double rcond; return determinant (info, rcond, 0); } DET -SparseMatrix::determinant (int& info) const +SparseMatrix::determinant (octave_idx_type& info) const { double rcond; return determinant (info, rcond, 0); } DET -SparseMatrix::determinant (int& err, double& rcond, int) const +SparseMatrix::determinant (octave_idx_type& err, double& rcond, int) const { DET retval; #ifdef HAVE_UMFPACK - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); if (nr == 0 || nc == 0 || nr != nc) { @@ -757,8 +757,8 @@ umfpack_di_report_control (control); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const double *Ax = data (); umfpack_di_report_matrix (nr, nc, Ap, Ai, Ax, 1, control); @@ -832,13 +832,13 @@ } Matrix -SparseMatrix::dsolve (SparseType &mattype, const Matrix& b, int& err, +SparseMatrix::dsolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler) const { Matrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -855,16 +855,16 @@ { retval.resize (b.rows (), b.cols()); if (typ == SparseType::Diagonal) - for (int j = 0; j < b.cols(); j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = b(i,j) / data (i); else - for (int j = 0; j < b.cols(); j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = b(ridx(i),j) / data (i); double dmax = 0., dmin = octave_Inf; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { double tmp = fabs(data(i)); if (tmp > dmax) @@ -882,13 +882,13 @@ } SparseMatrix -SparseMatrix::dsolve (SparseType &mattype, const SparseMatrix& b, int& err, +SparseMatrix::dsolve (SparseType &mattype, const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler) const { SparseMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -903,17 +903,17 @@ if (typ == SparseType::Diagonal || typ == SparseType::Permuted_Diagonal) { - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; + octave_idx_type ii = 0; if (typ == SparseType::Diagonal) - for (int j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols(); j++) { - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { retval.xridx (ii) = b.ridx(i); retval.xdata (ii++) = b.data(i) / data (b.ridx (i)); @@ -921,12 +921,12 @@ retval.xcidx(j+1) = ii; } else - for (int j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols(); j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { bool found = false; - int k; + octave_idx_type k; for (k = b.cidx(j); k < b.cidx(j+1); k++) if (ridx(i) == b.ridx(k)) { @@ -943,7 +943,7 @@ } double dmax = 0., dmin = octave_Inf; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { double tmp = fabs(data(i)); if (tmp > dmax) @@ -961,13 +961,13 @@ } ComplexMatrix -SparseMatrix::dsolve (SparseType &mattype, const ComplexMatrix& b, int& err, +SparseMatrix::dsolve (SparseType &mattype, const ComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -984,16 +984,16 @@ { retval.resize (b.rows (), b.cols()); if (typ == SparseType::Diagonal) - for (int j = 0; j < b.cols(); j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = b(i,j) / data (i); else - for (int j = 0; j < b.cols(); j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < b.cols(); j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = b(ridx(i),j) / data (i); double dmax = 0., dmin = octave_Inf; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { double tmp = fabs(data(i)); if (tmp > dmax) @@ -1012,13 +1012,13 @@ SparseComplexMatrix SparseMatrix::dsolve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -1033,17 +1033,17 @@ if (typ == SparseType::Diagonal || typ == SparseType::Permuted_Diagonal) { - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseComplexMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; + octave_idx_type ii = 0; if (typ == SparseType::Diagonal) - for (int j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols(); j++) { - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { retval.xridx (ii) = b.ridx(i); retval.xdata (ii++) = b.data(i) / data (b.ridx (i)); @@ -1051,12 +1051,12 @@ retval.xcidx(j+1) = ii; } else - for (int j = 0; j < b.cols(); j++) + for (octave_idx_type j = 0; j < b.cols(); j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { bool found = false; - int k; + octave_idx_type k; for (k = b.cidx(j); k < b.cidx(j+1); k++) if (ridx(i) == b.ridx(k)) { @@ -1073,7 +1073,7 @@ } double dmax = 0., dmin = octave_Inf; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { double tmp = fabs(data(i)); if (tmp > dmax) @@ -1091,14 +1091,14 @@ } Matrix -SparseMatrix::utsolve (SparseType &mattype, const Matrix& b, int& err, +SparseMatrix::utsolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { Matrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -1115,14 +1115,14 @@ { double anorm = 0.; double ainvnorm = 0.; - int b_cols = b.cols (); + octave_idx_type b_cols = b.cols (); rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += fabs(data(i)); if (atmp > anorm) anorm = atmp; @@ -1132,20 +1132,20 @@ { retval.resize (b.rows (), b.cols ()); OCTAVE_LOCAL_BUFFER (double, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_cols; j++) + for (octave_idx_type j = 0; j < b_cols; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = b(i,j); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx+1)-1) != iidx) @@ -1156,44 +1156,44 @@ double tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i, j) = work[p_perm[i]]; } // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { double tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work[i]); work[i] = 0.; @@ -1207,10 +1207,10 @@ retval = b; double *x_vec = retval.fortran_vec (); - for (int j = 0; j < b_cols; j++) + for (octave_idx_type j = 0; j < b_cols; j++) { - int offset = j * nr; - for (int k = nr-1; k >= 0; k--) + octave_idx_type offset = j * nr; + for (octave_idx_type k = nr-1; k >= 0; k--) { if (x_vec[k+offset] != 0.) { @@ -1223,9 +1223,9 @@ double tmp = x_vec[k+offset] / data(cidx(k+1)-1); x_vec[k+offset] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); x_vec[iidx+offset] = x_vec[iidx+offset] - tmp * data(i); } @@ -1235,28 +1235,28 @@ // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (double, work, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { if (work[k] != 0.) { double tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work[i]); work[i] = 0.; @@ -1301,13 +1301,13 @@ } SparseMatrix -SparseMatrix::utsolve (SparseType &mattype, const SparseMatrix& b, int& err, +SparseMatrix::utsolve (SparseType &mattype, const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -1327,42 +1327,42 @@ rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += fabs(data(i)); if (atmp > anorm) anorm = atmp; } - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; - int x_nz = b_nz; + octave_idx_type ii = 0; + octave_idx_type x_nz = b_nz; if (typ == SparseType::Permuted_Upper) { OCTAVE_LOCAL_BUFFER (double, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx+1)-1) != iidx) @@ -1373,9 +1373,9 @@ double tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } @@ -1384,20 +1384,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[p_perm[i]] != 0.) { retval.xridx(ii) = i; @@ -1409,30 +1409,30 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { double tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work[i]); work[i] = 0.; @@ -1445,14 +1445,14 @@ { OCTAVE_LOCAL_BUFFER (double, work, nr); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { if (work[k] != 0.) { @@ -1464,9 +1464,9 @@ double tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } @@ -1474,20 +1474,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -1499,28 +1499,28 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { if (work[k] != 0.) { double tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work[i]); work[i] = 0.; @@ -1564,13 +1564,13 @@ } ComplexMatrix -SparseMatrix::utsolve (SparseType &mattype, const ComplexMatrix& b, int& err, +SparseMatrix::utsolve (SparseType &mattype, const ComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -1587,14 +1587,14 @@ { double anorm = 0.; double ainvnorm = 0.; - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += fabs(data(i)); if (atmp > anorm) anorm = atmp; @@ -1604,20 +1604,20 @@ { retval.resize (b.rows (), b.cols ()); OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = b(i,j); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx+1)-1) != iidx) @@ -1628,46 +1628,46 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i, j) = work[p_perm[i]]; } // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (double, work2, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work2[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work2[q_perm[j]] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work2[iidx] != 0.) { double tmp = work2[iidx] / data(cidx(iidx+1)-1); work2[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work2[idx2] = work2[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work2[i]); work2[i] = 0.; @@ -1681,10 +1681,10 @@ retval = b; Complex *x_vec = retval.fortran_vec (); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - int offset = j * nr; - for (int k = nr-1; k >= 0; k--) + octave_idx_type offset = j * nr; + for (octave_idx_type k = nr-1; k >= 0; k--) { if (x_vec[k+offset] != 0.) { @@ -1697,9 +1697,9 @@ Complex tmp = x_vec[k+offset] / data(cidx(k+1)-1); x_vec[k+offset] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); x_vec[iidx+offset] = x_vec[iidx+offset] - tmp * data(i); } @@ -1709,28 +1709,28 @@ // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (double, work, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { if (work[k] != 0.) { double tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work[i]); work[i] = 0.; @@ -1776,13 +1776,13 @@ SparseComplexMatrix SparseMatrix::utsolve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -1802,42 +1802,42 @@ rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += fabs(data(i)); if (atmp > anorm) anorm = atmp; } - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseComplexMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; - int x_nz = b_nz; + octave_idx_type ii = 0; + octave_idx_type x_nz = b_nz; if (typ == SparseType::Permuted_Upper) { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx+1)-1) != iidx) @@ -1848,9 +1848,9 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } @@ -1859,20 +1859,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[p_perm[i]] != 0.) { retval.xridx(ii) = i; @@ -1885,30 +1885,30 @@ OCTAVE_LOCAL_BUFFER (double, work2, nr); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work2[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work2[q_perm[j]] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work2[iidx] != 0.) { double tmp = work2[iidx] / data(cidx(iidx+1)-1); work2[iidx] = tmp; - for (int i = cidx(iidx); i < cidx(iidx+1)-1; i++) + for (octave_idx_type i = cidx(iidx); i < cidx(iidx+1)-1; i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work2[idx2] = work2[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work2[i]); work2[i] = 0.; @@ -1921,14 +1921,14 @@ { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = nr-1; k >= 0; k--) + for (octave_idx_type k = nr-1; k >= 0; k--) { if (work[k] != 0.) { @@ -1940,9 +1940,9 @@ Complex tmp = work[k] / data(cidx(k+1)-1); work[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } @@ -1950,20 +1950,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -1976,28 +1976,28 @@ // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (double, work2, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work2[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work2[j] = 1.; - for (int k = j; k >= 0; k--) + for (octave_idx_type k = j; k >= 0; k--) { if (work2[k] != 0.) { double tmp = work2[k] / data(cidx(k+1)-1); work2[k] = tmp; - for (int i = cidx(k); i < cidx(k+1)-1; i++) + for (octave_idx_type i = cidx(k); i < cidx(k+1)-1; i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work2[iidx] = work2[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work2[i]); work2[i] = 0.; @@ -2042,14 +2042,14 @@ } Matrix -SparseMatrix::ltsolve (SparseType &mattype, const Matrix& b, int& err, +SparseMatrix::ltsolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { Matrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -2066,14 +2066,14 @@ { double anorm = 0.; double ainvnorm = 0.; - int b_cols = b.cols (); + octave_idx_type b_cols = b.cols (); rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += fabs(data(i)); if (atmp > anorm) anorm = atmp; @@ -2083,20 +2083,20 @@ { retval.resize (b.rows (), b.cols ()); OCTAVE_LOCAL_BUFFER (double, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_cols; j++) + for (octave_idx_type j = 0; j < b_cols; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = b(i,j); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx)) != iidx) @@ -2107,45 +2107,45 @@ double tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i, j) = work[p_perm[i]]; } // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { double tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work[i]); work[i] = 0.; @@ -2159,10 +2159,10 @@ retval = b; double *x_vec = retval.fortran_vec (); - for (int j = 0; j < b_cols; j++) + for (octave_idx_type j = 0; j < b_cols; j++) { - int offset = j * nr; - for (int k = 0; k < nr; k++) + octave_idx_type offset = j * nr; + for (octave_idx_type k = 0; k < nr; k++) { if (x_vec[k+offset] != 0.) { @@ -2175,9 +2175,9 @@ double tmp = x_vec[k+offset] / data(cidx(k)); x_vec[k+offset] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); x_vec[iidx+offset] = x_vec[iidx+offset] - tmp * data(i); } @@ -2187,29 +2187,29 @@ // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (double, work, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k < nr; k++) + for (octave_idx_type k = j; k < nr; k++) { if (work[k] != 0.) { double tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = j; i < nr; i++) + for (octave_idx_type i = j; i < nr; i++) { atmp += fabs(work[i]); work[i] = 0.; @@ -2255,13 +2255,13 @@ } SparseMatrix -SparseMatrix::ltsolve (SparseType &mattype, const SparseMatrix& b, int& err, +SparseMatrix::ltsolve (SparseType &mattype, const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -2281,42 +2281,42 @@ rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += fabs(data(i)); if (atmp > anorm) anorm = atmp; } - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; - int x_nz = b_nz; + octave_idx_type ii = 0; + octave_idx_type x_nz = b_nz; if (typ == SparseType::Permuted_Lower) { OCTAVE_LOCAL_BUFFER (double, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx)) != iidx) @@ -2327,9 +2327,9 @@ double tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } @@ -2338,20 +2338,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[p_perm[i]] != 0.) { retval.xridx(ii) = i; @@ -2363,30 +2363,30 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[q_perm[j]] = 1.; - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { double tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work[i]); work[i] = 0.; @@ -2399,14 +2399,14 @@ { OCTAVE_LOCAL_BUFFER (double, work, nr); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { if (work[k] != 0.) { @@ -2418,9 +2418,9 @@ double tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } @@ -2428,20 +2428,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -2453,29 +2453,29 @@ retval.maybe_compress (); // Calculation of 1-norm of inv(*this) - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k < nr; k++) + for (octave_idx_type k = j; k < nr; k++) { if (work[k] != 0.) { double tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = j; i < nr; i++) + for (octave_idx_type i = j; i < nr; i++) { atmp += fabs(work[i]); work[i] = 0.; @@ -2521,13 +2521,13 @@ } ComplexMatrix -SparseMatrix::ltsolve (SparseType &mattype, const ComplexMatrix& b, int& err, +SparseMatrix::ltsolve (SparseType &mattype, const ComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -2544,14 +2544,14 @@ { double anorm = 0.; double ainvnorm = 0.; - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += fabs(data(i)); if (atmp > anorm) anorm = atmp; @@ -2561,20 +2561,20 @@ { retval.resize (b.rows (), b.cols ()); OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = b(i,j); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx)) != iidx) @@ -2585,46 +2585,46 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } } } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i, j) = work[p_perm[i]]; } // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (double, work2, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work2[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work2[q_perm[j]] = 1.; - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work2[iidx] != 0.) { double tmp = work2[iidx] / data(cidx(iidx+1)-1); work2[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work2[idx2] = work2[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work2[i]); work2[i] = 0.; @@ -2638,10 +2638,10 @@ retval = b; Complex *x_vec = retval.fortran_vec (); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - int offset = j * nr; - for (int k = 0; k < nr; k++) + octave_idx_type offset = j * nr; + for (octave_idx_type k = 0; k < nr; k++) { if (x_vec[k+offset] != 0.) { @@ -2654,9 +2654,9 @@ Complex tmp = x_vec[k+offset] / data(cidx(k)); x_vec[k+offset] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); x_vec[iidx+offset] = x_vec[iidx+offset] - tmp * data(i); } @@ -2666,29 +2666,29 @@ // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (double, work, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work[j] = 1.; - for (int k = j; k < nr; k++) + for (octave_idx_type k = j; k < nr; k++) { if (work[k] != 0.) { double tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = j; i < nr; i++) + for (octave_idx_type i = j; i < nr; i++) { atmp += fabs(work[i]); work[i] = 0.; @@ -2735,13 +2735,13 @@ SparseComplexMatrix SparseMatrix::ltsolve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -2761,42 +2761,42 @@ rcond = 0.; // Calculate the 1-norm of matrix for rcond calculation - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { double atmp = 0.; - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) atmp += fabs(data(i)); if (atmp > anorm) anorm = atmp; } - int b_nr = b.rows (); - int b_nc = b.cols (); - int b_nz = b.nnz (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); + octave_idx_type b_nz = b.nnz (); retval = SparseComplexMatrix (b_nr, b_nc, b_nz); retval.xcidx(0) = 0; - int ii = 0; - int x_nz = b_nz; + octave_idx_type ii = 0; + octave_idx_type x_nz = b_nz; if (typ == SparseType::Permuted_Lower) { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - int *p_perm = mattype.triangular_row_perm (); - int *q_perm = mattype.triangular_col_perm (); + octave_idx_type *p_perm = mattype.triangular_row_perm (); + octave_idx_type *q_perm = mattype.triangular_col_perm (); (*current_liboctave_warning_handler) ("SparseMatrix::solve XXX FIXME XXX permuted triangular code not tested"); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work[iidx] != 0.) { if (ridx(cidx(iidx)) != iidx) @@ -2807,9 +2807,9 @@ Complex tmp = work[iidx] / data(cidx(iidx+1)-1); work[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work[idx2] = work[idx2] - tmp * data(i); } @@ -2818,20 +2818,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[p_perm[i]] != 0.) { retval.xridx(ii) = i; @@ -2844,30 +2844,30 @@ // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (double, work2, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work2[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work2[q_perm[j]] = 1.; - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { - int iidx = q_perm[k]; + octave_idx_type iidx = q_perm[k]; if (work2[iidx] != 0.) { double tmp = work2[iidx] / data(cidx(iidx+1)-1); work2[iidx] = tmp; - for (int i = cidx(iidx)+1; i < cidx(iidx+1); i++) + for (octave_idx_type i = cidx(iidx)+1; i < cidx(iidx+1); i++) { - int idx2 = q_perm[ridx(i)]; + octave_idx_type idx2 = q_perm[ridx(i)]; work2[idx2] = work2[idx2] - tmp * data(i); } } } double atmp = 0; - for (int i = 0; i < j+1; i++) + for (octave_idx_type i = 0; i < j+1; i++) { atmp += fabs(work2[i]); work2[i] = 0.; @@ -2880,14 +2880,14 @@ { OCTAVE_LOCAL_BUFFER (Complex, work, nr); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) work[b.ridx(i)] = b.data(i); - for (int k = 0; k < nr; k++) + for (octave_idx_type k = 0; k < nr; k++) { if (work[k] != 0.) { @@ -2899,9 +2899,9 @@ Complex tmp = work[k] / data(cidx(k)); work[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work[iidx] = work[iidx] - tmp * data(i); } } @@ -2909,20 +2909,20 @@ // Count non-zeros in work vector and adjust space in // retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -2935,29 +2935,29 @@ // Calculation of 1-norm of inv(*this) OCTAVE_LOCAL_BUFFER (double, work2, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work2[i] = 0.; - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { work2[j] = 1.; - for (int k = j; k < nr; k++) + for (octave_idx_type k = j; k < nr; k++) { if (work2[k] != 0.) { double tmp = work2[k] / data(cidx(k)); work2[k] = tmp; - for (int i = cidx(k)+1; i < cidx(k+1); i++) + for (octave_idx_type i = cidx(k)+1; i < cidx(k+1); i++) { - int iidx = ridx(i); + octave_idx_type iidx = ridx(i); work2[iidx] = work2[iidx] - tmp * data(i); } } } double atmp = 0; - for (int i = j; i < nr; i++) + for (octave_idx_type i = j; i < nr; i++) { atmp += fabs(work2[i]); work2[i] = 0.; @@ -3003,14 +3003,14 @@ } Matrix -SparseMatrix::trisolve (SparseType &mattype, const Matrix& b, int& err, +SparseMatrix::trisolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { Matrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -3029,9 +3029,9 @@ if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii); @@ -3042,14 +3042,14 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -3058,7 +3058,7 @@ } } - int b_nc = b.cols(); + octave_idx_type b_nc = b.cols(); retval = b; double *result = retval.fortran_vec (); @@ -3086,9 +3086,9 @@ if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii++); @@ -3099,15 +3099,15 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; DU[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -3118,7 +3118,7 @@ } } - int b_nc = b.cols(); + octave_idx_type b_nc = b.cols(); retval = b; double *result = retval.fortran_vec (); @@ -3151,13 +3151,13 @@ } SparseMatrix -SparseMatrix::trisolve (SparseType &mattype, const SparseMatrix& b, int& err, +SparseMatrix::trisolve (SparseType &mattype, const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -3177,14 +3177,14 @@ OCTAVE_LOCAL_BUFFER (double, DU, nr - 1); OCTAVE_LOCAL_BUFFER (double, D, nr); OCTAVE_LOCAL_BUFFER (double, DL, nr - 1); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii++); @@ -3195,15 +3195,15 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; DU[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -3236,19 +3236,19 @@ else { char job = 'N'; - volatile int x_nz = b.nnz (); - int b_nc = b.cols (); + volatile octave_idx_type x_nz = b.nnz (); + octave_idx_type b_nc = b.cols (); retval = SparseMatrix (nr, b_nc, x_nz); retval.xcidx(0) = 0; - volatile int ii = 0; + volatile octave_idx_type ii = 0; OCTAVE_LOCAL_BUFFER (double, work, nr); - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + 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, @@ -3266,20 +3266,20 @@ // Count non-zeros in work vector and adjust // space in retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -3300,13 +3300,13 @@ } ComplexMatrix -SparseMatrix::trisolve (SparseType &mattype, const ComplexMatrix& b, int& err, +SparseMatrix::trisolve (SparseType &mattype, const ComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -3326,9 +3326,9 @@ if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii); @@ -3339,14 +3339,14 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -3355,8 +3355,8 @@ } } - int b_nr = b.rows (); - int b_nc = b.cols(); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols(); rcond = 1.; retval = b; @@ -3387,9 +3387,9 @@ if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii++); @@ -3400,15 +3400,15 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; DU[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -3419,8 +3419,8 @@ } } - int b_nr = b.rows(); - int b_nc = b.cols(); + octave_idx_type b_nr = b.rows(); + octave_idx_type b_nc = b.cols(); rcond = 1.; retval = b; @@ -3456,13 +3456,13 @@ SparseComplexMatrix SparseMatrix::trisolve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -3482,14 +3482,14 @@ OCTAVE_LOCAL_BUFFER (double, DU, nr - 1); OCTAVE_LOCAL_BUFFER (double, D, nr); OCTAVE_LOCAL_BUFFER (double, DL, nr - 1); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); if (mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < nc-1; j++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < nc-1; j++) { D[j] = data(ii++); DL[j] = data(ii++); @@ -3500,15 +3500,15 @@ else { D[0] = 0.; - for (int i = 0; i < nr - 1; i++) + for (octave_idx_type i = 0; i < nr - 1; i++) { D[i+1] = 0.; DL[i] = 0.; DU[i] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { if (ridx(i) == j) D[j] = data(i); @@ -3541,22 +3541,22 @@ { rcond = 1.; char job = 'N'; - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); OCTAVE_LOCAL_BUFFER (double, Bx, b_nr); OCTAVE_LOCAL_BUFFER (double, Bz, b_nr); // Take a first guess that the number of non-zero terms // will be as many as in b - volatile int x_nz = b.nnz (); - volatile int ii = 0; + volatile octave_idx_type x_nz = b.nnz (); + volatile octave_idx_type ii = 0; retval = SparseComplexMatrix (b_nr, b_nc, x_nz); retval.xcidx(0) = 0; - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) { Complex c = b (i,j); Bx[i] = std::real (c); @@ -3610,20 +3610,20 @@ // Count non-zeros in work vector and adjust // space in retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0. || Bz[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0. || Bz[i] != 0.) { retval.xridx(ii) = i; @@ -3646,14 +3646,14 @@ } Matrix -SparseMatrix::bsolve (SparseType &mattype, const Matrix& b, int& err, +SparseMatrix::bsolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { Matrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -3667,24 +3667,24 @@ if (typ == SparseType::Banded_Hermitian) { - int n_lower = mattype.nlower (); - int ldm = n_lower + 1; + octave_idx_type n_lower = mattype.nlower (); + octave_idx_type ldm = n_lower + 1; Matrix m_band (ldm, nc); double *tmp_data = m_band.fortran_vec (); if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ri = ridx (i); + octave_idx_type ri = ridx (i); if (ri >= j) m_band(ri - j, j) = data(i); } @@ -3758,7 +3758,7 @@ retval = b; double *result = retval.fortran_vec (); - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); F77_XFCN (dpbtrs, DPBTRS, (F77_CONST_CHAR_ARG2 (&job, 1), @@ -3792,19 +3792,19 @@ if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) m_band(ridx(i) - j + n_lower + n_upper, j) = data(i); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); @@ -3871,7 +3871,7 @@ retval = b; double *result = retval.fortran_vec (); - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); job = 'N'; F77_XFCN (dgbtrs, DGBTRS, @@ -3894,13 +3894,13 @@ } SparseMatrix -SparseMatrix::bsolve (SparseType &mattype, const SparseMatrix& b, int& err, +SparseMatrix::bsolve (SparseType &mattype, const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -3922,17 +3922,17 @@ if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ri = ridx (i); + octave_idx_type ri = ridx (i); if (ri >= j) m_band(ri - j, j) = data(i); } @@ -3957,20 +3957,20 @@ else { rcond = 1.; - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); OCTAVE_LOCAL_BUFFER (double, Bx, b_nr); // Take a first guess that the number of non-zero terms // will be as many as in b - volatile int x_nz = b.nnz (); - volatile int ii = 0; + volatile octave_idx_type x_nz = b.nnz (); + volatile octave_idx_type ii = 0; retval = SparseMatrix (b_nr, b_nc, x_nz); retval.xcidx(0) = 0; - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b.elem (i, j); F77_XFCN (dpbtrs, DPBTRS, @@ -3995,7 +3995,7 @@ break; } - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) { double tmp = Bx[i]; if (tmp != 0.0) @@ -4003,7 +4003,7 @@ if (ii == x_nz) { // Resize the sparse matrix - int sz = x_nz * (b_nc - j) / b_nc; + octave_idx_type sz = x_nz * (b_nc - j) / b_nc; sz = (sz > 10 ? sz : 10) + x_nz; retval.change_capacity (sz); x_nz = sz; @@ -4023,28 +4023,28 @@ if (typ == SparseType::Banded) { // Create the storage for the banded form of the sparse matrix - int n_upper = mattype.nupper (); - int n_lower = mattype.nlower (); - int ldm = n_upper + 2 * n_lower + 1; + octave_idx_type n_upper = mattype.nupper (); + octave_idx_type n_lower = mattype.nlower (); + octave_idx_type ldm = n_upper + 2 * n_lower + 1; Matrix m_band (ldm, nc); double *tmp_data = m_band.fortran_vec (); if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) m_band(ridx(i) - j + n_lower + n_upper, j) = data(i); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); @@ -4069,19 +4069,19 @@ else { char job = 'N'; - volatile int x_nz = b.nnz (); - int b_nc = b.cols (); + volatile octave_idx_type x_nz = b.nnz (); + octave_idx_type b_nc = b.cols (); retval = SparseMatrix (nr, b_nc, x_nz); retval.xcidx(0) = 0; - volatile int ii = 0; + volatile octave_idx_type ii = 0; OCTAVE_LOCAL_BUFFER (double, work, nr); - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) work[i] = 0.; - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + 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, @@ -4099,20 +4099,20 @@ // Count non-zeros in work vector and adjust // space in retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (work[i] != 0.) { retval.xridx(ii) = i; @@ -4133,13 +4133,13 @@ } ComplexMatrix -SparseMatrix::bsolve (SparseType &mattype, const ComplexMatrix& b, int& err, +SparseMatrix::bsolve (SparseType &mattype, const ComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -4153,25 +4153,25 @@ if (typ == SparseType::Banded_Hermitian) { - int n_lower = mattype.nlower (); - int ldm = n_lower + 1; + octave_idx_type n_lower = mattype.nlower (); + octave_idx_type ldm = n_lower + 1; Matrix m_band (ldm, nc); double *tmp_data = m_band.fortran_vec (); if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ri = ridx (i); + octave_idx_type ri = ridx (i); if (ri >= j) m_band(ri - j, j) = data(i); } @@ -4198,17 +4198,17 @@ else { rcond = 1.; - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); OCTAVE_LOCAL_BUFFER (double, Bx, b_nr); OCTAVE_LOCAL_BUFFER (double, Bz, b_nr); retval.resize (b_nr, b_nc); - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) { Complex c = b (i,j); Bx[i] = std::real (c); @@ -4259,7 +4259,7 @@ break; } - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) retval (i, j) = Complex (Bx[i], Bz[i]); } } @@ -4278,19 +4278,19 @@ if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) m_band(ridx(i) - j + n_lower + n_upper, j) = data(i); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); @@ -4315,15 +4315,15 @@ else { char job = 'N'; - int b_nc = b.cols (); + octave_idx_type b_nc = b.cols (); retval.resize (nr,b_nc); OCTAVE_LOCAL_BUFFER (double, Bz, nr); OCTAVE_LOCAL_BUFFER (double, Bx, nr); - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { Complex c = b (i, j); Bx[i] = std::real (c); @@ -4356,7 +4356,7 @@ break; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i, j) = Complex (Bx[i], Bz[i]); } } @@ -4371,13 +4371,13 @@ SparseComplexMatrix SparseMatrix::bsolve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -4399,17 +4399,17 @@ if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { - int ri = ridx (i); + octave_idx_type ri = ridx (i); if (ri >= j) m_band(ri - j, j) = data(i); } @@ -4437,22 +4437,22 @@ else { rcond = 1.; - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); OCTAVE_LOCAL_BUFFER (double, Bx, b_nr); OCTAVE_LOCAL_BUFFER (double, Bz, b_nr); // Take a first guess that the number of non-zero terms // will be as many as in b - volatile int x_nz = b.nnz (); - volatile int ii = 0; + volatile octave_idx_type x_nz = b.nnz (); + volatile octave_idx_type ii = 0; retval = SparseComplexMatrix (b_nr, b_nc, x_nz); retval.xcidx(0) = 0; - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) { Complex c = b (i,j); Bx[i] = std::real (c); @@ -4506,20 +4506,20 @@ // Count non-zeros in work vector and adjust // space in retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0. || Bz[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0. || Bz[i] != 0.) { retval.xridx(ii) = i; @@ -4547,19 +4547,19 @@ if (! mattype.is_dense ()) { - int ii = 0; - - for (int j = 0; j < ldm; j++) - for (int i = 0; i < nc; i++) + octave_idx_type ii = 0; + + for (octave_idx_type j = 0; j < ldm; j++) + for (octave_idx_type i = 0; i < nc; i++) tmp_data[ii++] = 0.; } - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) m_band(ridx(i) - j + n_lower + n_upper, j) = data(i); - Array ipvt (nr); - int *pipvt = ipvt.fortran_vec (); + Array ipvt (nr); + octave_idx_type *pipvt = ipvt.fortran_vec (); F77_XFCN (dgbtrf, DGBTRF, (nr, nr, n_lower, n_upper, tmp_data, ldm, pipvt, err)); @@ -4584,23 +4584,23 @@ else { char job = 'N'; - volatile int x_nz = b.nnz (); - int b_nc = b.cols (); + volatile octave_idx_type x_nz = b.nnz (); + octave_idx_type b_nc = b.cols (); retval = SparseComplexMatrix (nr, b_nc, x_nz); retval.xcidx(0) = 0; - volatile int ii = 0; + volatile octave_idx_type ii = 0; OCTAVE_LOCAL_BUFFER (double, Bx, nr); OCTAVE_LOCAL_BUFFER (double, Bz, nr); - for (volatile int j = 0; j < b_nc; j++) + for (volatile octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { Bx[i] = 0.; Bz[i] = 0.; } - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { Complex c = b.data(i); Bx[b.ridx(i)] = std::real (c); @@ -4635,20 +4635,20 @@ // Count non-zeros in work vector and adjust // space in retval if needed - int new_nnz = 0; - for (int i = 0; i < nr; i++) + octave_idx_type new_nnz = 0; + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0. || Bz[i] != 0.) new_nnz++; if (ii + new_nnz > x_nz) { // Resize the sparse matrix - int sz = new_nnz * (b_nc - j) + x_nz; + octave_idx_type sz = new_nnz * (b_nc - j) + x_nz; retval.change_capacity (sz); x_nz = sz; } - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) if (Bx[i] != 0. || Bz[i] != 0.) { retval.xridx(ii) = i; @@ -4670,7 +4670,7 @@ } void * -SparseMatrix::factorize (int& err, double &rcond, Matrix &Control, Matrix &Info, +SparseMatrix::factorize (octave_idx_type& err, double &rcond, Matrix &Control, Matrix &Info, solve_singularity_handler sing_handler) const { // The return values @@ -4700,11 +4700,11 @@ umfpack_di_report_control (control); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const double *Ax = data (); - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); umfpack_di_report_matrix (nr, nc, Ap, Ai, Ax, 1, control); @@ -4781,14 +4781,14 @@ } Matrix -SparseMatrix::fsolve (SparseType &mattype, const Matrix& b, int& err, +SparseMatrix::fsolve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { Matrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -4824,16 +4824,16 @@ const double *Bx = b.fortran_vec (); retval.resize (b.rows (), b.cols()); double *result = retval.fortran_vec (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); int status = 0; double *control = Control.fortran_vec (); double *info = Info.fortran_vec (); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const double *Ax = data (); - for (int j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) + for (octave_idx_type j = 0, iidx = 0; j < b_nc; j++, iidx += b_nr) { status = umfpack_di_solve (UMFPACK_A, Ap, Ai, Ax, &result[iidx], &Bx[iidx], @@ -4886,13 +4886,13 @@ } SparseMatrix -SparseMatrix::fsolve (SparseType &mattype, const SparseMatrix& b, int& err, double& rcond, +SparseMatrix::fsolve (SparseType &mattype, const SparseMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -4925,13 +4925,13 @@ if (err == 0) { - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); int status = 0; double *control = Control.fortran_vec (); double *info = Info.fortran_vec (); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const double *Ax = data (); OCTAVE_LOCAL_BUFFER (double, Bx, b_nr); @@ -4939,15 +4939,15 @@ // Take a first guess that the number of non-zero terms // will be as many as in b - int x_nz = b.nnz (); - int ii = 0; + octave_idx_type x_nz = b.nnz (); + octave_idx_type ii = 0; retval = SparseMatrix (b_nr, b_nc, x_nz); retval.xcidx(0) = 0; - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) Bx[i] = b.elem (i, j); status = umfpack_di_solve (UMFPACK_A, Ap, Ai, Ax, Xx, @@ -4965,7 +4965,7 @@ break; } - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) { double tmp = Xx[i]; if (tmp != 0.0) @@ -4973,7 +4973,7 @@ if (ii == x_nz) { // Resize the sparse matrix - int sz = x_nz * (b_nc - j) / b_nc; + octave_idx_type sz = x_nz * (b_nc - j) / b_nc; sz = (sz > 10 ? sz : 10) + x_nz; retval.change_capacity (sz); x_nz = sz; @@ -5022,13 +5022,13 @@ } ComplexMatrix -SparseMatrix::fsolve (SparseType &mattype, const ComplexMatrix& b, int& err, double& rcond, +SparseMatrix::fsolve (SparseType &mattype, const ComplexMatrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -5061,13 +5061,13 @@ if (err == 0) { - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); int status = 0; double *control = Control.fortran_vec (); double *info = Info.fortran_vec (); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const double *Ax = data (); OCTAVE_LOCAL_BUFFER (double, Bx, b_nr); @@ -5078,9 +5078,9 @@ OCTAVE_LOCAL_BUFFER (double, Xx, b_nr); OCTAVE_LOCAL_BUFFER (double, Xz, b_nr); - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) { Complex c = b (i,j); Bx[i] = std::real (c); @@ -5106,7 +5106,7 @@ break; } - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) retval (i, j) = Complex (Xx[i], Xz[i]); } @@ -5146,13 +5146,13 @@ SparseComplexMatrix SparseMatrix::fsolve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseComplexMatrix retval; - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); err = 0; if (nr == 0 || nc == 0 || nr != nc || nr != b.rows ()) @@ -5185,13 +5185,13 @@ if (err == 0) { - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); int status = 0; double *control = Control.fortran_vec (); double *info = Info.fortran_vec (); - const int *Ap = cidx (); - const int *Ai = ridx (); + const octave_idx_type *Ap = cidx (); + const octave_idx_type *Ai = ridx (); const double *Ax = data (); OCTAVE_LOCAL_BUFFER (double, Bx, b_nr); @@ -5199,17 +5199,17 @@ // Take a first guess that the number of non-zero terms // will be as many as in b - int x_nz = b.nnz (); - int ii = 0; + octave_idx_type x_nz = b.nnz (); + octave_idx_type ii = 0; retval = SparseComplexMatrix (b_nr, b_nc, x_nz); OCTAVE_LOCAL_BUFFER (double, Xx, b_nr); OCTAVE_LOCAL_BUFFER (double, Xz, b_nr); retval.xcidx(0) = 0; - for (int j = 0; j < b_nc; j++) + for (octave_idx_type j = 0; j < b_nc; j++) { - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) { Complex c = b (i,j); Bx[i] = std::real (c); @@ -5235,7 +5235,7 @@ break; } - for (int i = 0; i < b_nr; i++) + for (octave_idx_type i = 0; i < b_nr; i++) { Complex tmp = Complex (Xx[i], Xz[i]); if (tmp != 0.0) @@ -5243,7 +5243,7 @@ if (ii == x_nz) { // Resize the sparse matrix - int sz = x_nz * (b_nc - j) / b_nc; + octave_idx_type sz = x_nz * (b_nc - j) / b_nc; sz = (sz > 10 ? sz : 10) + x_nz; retval.change_capacity (sz); x_nz = sz; @@ -5294,27 +5294,27 @@ Matrix SparseMatrix::solve (SparseType &mattype, const Matrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond, 0); } Matrix -SparseMatrix::solve (SparseType &mattype, const Matrix& b, int& info) const +SparseMatrix::solve (SparseType &mattype, const Matrix& b, octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); } Matrix -SparseMatrix::solve (SparseType &mattype, const Matrix& b, int& info, +SparseMatrix::solve (SparseType &mattype, const Matrix& b, octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } Matrix -SparseMatrix::solve (SparseType &mattype, const Matrix& b, int& err, +SparseMatrix::solve (SparseType &mattype, const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { @@ -5347,14 +5347,14 @@ SparseMatrix SparseMatrix::solve (SparseType &mattype, const SparseMatrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond, 0); } SparseMatrix SparseMatrix::solve (SparseType &mattype, const SparseMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); @@ -5362,14 +5362,14 @@ SparseMatrix SparseMatrix::solve (SparseType &mattype, const SparseMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } SparseMatrix SparseMatrix::solve (SparseType &mattype, const SparseMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { int typ = mattype.type (); @@ -5401,14 +5401,14 @@ ComplexMatrix SparseMatrix::solve (SparseType &mattype, const ComplexMatrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond, 0); } ComplexMatrix SparseMatrix::solve (SparseType &mattype, const ComplexMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); @@ -5416,14 +5416,14 @@ ComplexMatrix SparseMatrix::solve (SparseType &mattype, const ComplexMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ComplexMatrix SparseMatrix::solve (SparseType &mattype, const ComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { int typ = mattype.type (); @@ -5455,14 +5455,14 @@ SparseComplexMatrix SparseMatrix::solve (SparseType &mattype, const SparseComplexMatrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond, 0); } SparseComplexMatrix SparseMatrix::solve (SparseType &mattype, const SparseComplexMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); @@ -5470,14 +5470,14 @@ SparseComplexMatrix SparseMatrix::solve (SparseType &mattype, const SparseComplexMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } SparseComplexMatrix SparseMatrix::solve (SparseType &mattype, const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { int typ = mattype.type (); @@ -5509,85 +5509,85 @@ ColumnVector SparseMatrix::solve (SparseType &mattype, const ColumnVector& b) const { - int info; double rcond; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond); } ColumnVector -SparseMatrix::solve (SparseType &mattype, const ColumnVector& b, int& info) const +SparseMatrix::solve (SparseType &mattype, const ColumnVector& b, octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond); } ColumnVector -SparseMatrix::solve (SparseType &mattype, const ColumnVector& b, int& info, double& rcond) const +SparseMatrix::solve (SparseType &mattype, const ColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ColumnVector -SparseMatrix::solve (SparseType &mattype, const ColumnVector& b, int& info, double& rcond, +SparseMatrix::solve (SparseType &mattype, const ColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { Matrix tmp (b); - return solve (mattype, tmp, info, rcond, sing_handler).column (0); + return solve (mattype, tmp, info, rcond, sing_handler).column (static_cast (0)); } ComplexColumnVector SparseMatrix::solve (SparseType &mattype, const ComplexColumnVector& b) const { - int info; + octave_idx_type info; double rcond; return solve (mattype, b, info, rcond, 0); } ComplexColumnVector -SparseMatrix::solve (SparseType &mattype, const ComplexColumnVector& b, int& info) const +SparseMatrix::solve (SparseType &mattype, const ComplexColumnVector& b, octave_idx_type& info) const { double rcond; return solve (mattype, b, info, rcond, 0); } ComplexColumnVector -SparseMatrix::solve (SparseType &mattype, const ComplexColumnVector& b, int& info, +SparseMatrix::solve (SparseType &mattype, const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (mattype, b, info, rcond, 0); } ComplexColumnVector -SparseMatrix::solve (SparseType &mattype, const ComplexColumnVector& b, int& info, double& rcond, +SparseMatrix::solve (SparseType &mattype, const ComplexColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix tmp (b); - return solve (mattype, tmp, info, rcond, sing_handler).column (0); + return solve (mattype, tmp, info, rcond, sing_handler).column (static_cast (0)); } Matrix SparseMatrix::solve (const Matrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (b, info, rcond, 0); } Matrix -SparseMatrix::solve (const Matrix& b, int& info) const +SparseMatrix::solve (const Matrix& b, octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); } Matrix -SparseMatrix::solve (const Matrix& b, int& 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, int& err, +SparseMatrix::solve (const Matrix& b, octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { @@ -5598,14 +5598,14 @@ SparseMatrix SparseMatrix::solve (const SparseMatrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (b, info, rcond, 0); } SparseMatrix SparseMatrix::solve (const SparseMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); @@ -5613,14 +5613,14 @@ SparseMatrix SparseMatrix::solve (const SparseMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } SparseMatrix SparseMatrix::solve (const SparseMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseType mattype (*this); @@ -5629,7 +5629,7 @@ ComplexMatrix SparseMatrix::solve (const ComplexMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); @@ -5637,14 +5637,14 @@ ComplexMatrix SparseMatrix::solve (const ComplexMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ComplexMatrix SparseMatrix::solve (const ComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseType mattype (*this); @@ -5654,14 +5654,14 @@ SparseComplexMatrix SparseMatrix::solve (const SparseComplexMatrix& b) const { - int info; + octave_idx_type info; double rcond; return solve (b, info, rcond, 0); } SparseComplexMatrix SparseMatrix::solve (const SparseComplexMatrix& b, - int& info) const + octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); @@ -5669,14 +5669,14 @@ SparseComplexMatrix SparseMatrix::solve (const SparseComplexMatrix& b, - int& info, double& rcond) const + octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } SparseComplexMatrix SparseMatrix::solve (const SparseComplexMatrix& b, - int& err, double& rcond, + octave_idx_type& err, double& rcond, solve_singularity_handler sing_handler) const { SparseType mattype (*this); @@ -5686,78 +5686,78 @@ ColumnVector SparseMatrix::solve (const ColumnVector& b) const { - int info; double rcond; + octave_idx_type info; double rcond; return solve (b, info, rcond); } ColumnVector -SparseMatrix::solve (const ColumnVector& b, int& info) const +SparseMatrix::solve (const ColumnVector& b, octave_idx_type& info) const { double rcond; return solve (b, info, rcond); } ColumnVector -SparseMatrix::solve (const ColumnVector& b, int& info, double& rcond) const +SparseMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ColumnVector -SparseMatrix::solve (const ColumnVector& b, int& info, double& rcond, +SparseMatrix::solve (const ColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { Matrix tmp (b); - return solve (tmp, info, rcond, sing_handler).column (0); + return solve (tmp, info, rcond, sing_handler).column (static_cast (0)); } ComplexColumnVector SparseMatrix::solve (const ComplexColumnVector& b) const { - int info; + octave_idx_type info; double rcond; return solve (b, info, rcond, 0); } ComplexColumnVector -SparseMatrix::solve (const ComplexColumnVector& b, int& info) const +SparseMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info) const { double rcond; return solve (b, info, rcond, 0); } ComplexColumnVector -SparseMatrix::solve (const ComplexColumnVector& b, int& info, +SparseMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const { return solve (b, info, rcond, 0); } ComplexColumnVector -SparseMatrix::solve (const ComplexColumnVector& b, int& info, double& rcond, +SparseMatrix::solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const { ComplexMatrix tmp (b); - return solve (tmp, info, rcond, sing_handler).column (0); + return solve (tmp, info, rcond, sing_handler).column (static_cast (0)); } Matrix SparseMatrix::lssolve (const Matrix& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } Matrix -SparseMatrix::lssolve (const Matrix& b, int& info) const +SparseMatrix::lssolve (const Matrix& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } Matrix -SparseMatrix::lssolve (const Matrix& b, int& info, int& rank) const +SparseMatrix::lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank) const { info = -1; (*current_liboctave_error_handler) @@ -5768,20 +5768,20 @@ SparseMatrix SparseMatrix::lssolve (const SparseMatrix& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } SparseMatrix -SparseMatrix::lssolve (const SparseMatrix& b, int& info) const +SparseMatrix::lssolve (const SparseMatrix& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } SparseMatrix -SparseMatrix::lssolve (const SparseMatrix& b, int& info, int& rank) const +SparseMatrix::lssolve (const SparseMatrix& b, octave_idx_type& info, octave_idx_type& rank) const { info = -1; (*current_liboctave_error_handler) @@ -5792,20 +5792,20 @@ ComplexMatrix SparseMatrix::lssolve (const ComplexMatrix& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexMatrix -SparseMatrix::lssolve (const ComplexMatrix& b, int& info) const +SparseMatrix::lssolve (const ComplexMatrix& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexMatrix -SparseMatrix::lssolve (const ComplexMatrix& b, int& info, int& rank) const +SparseMatrix::lssolve (const ComplexMatrix& b, octave_idx_type& info, octave_idx_type& rank) const { info = -1; (*current_liboctave_error_handler) @@ -5816,21 +5816,21 @@ SparseComplexMatrix SparseMatrix::lssolve (const SparseComplexMatrix& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } SparseComplexMatrix -SparseMatrix::lssolve (const SparseComplexMatrix& b, int& info) const +SparseMatrix::lssolve (const SparseComplexMatrix& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } SparseComplexMatrix -SparseMatrix::lssolve (const SparseComplexMatrix& b, int& info, - int& rank) const +SparseMatrix::lssolve (const SparseComplexMatrix& b, octave_idx_type& info, + octave_idx_type& rank) const { info = -1; (*current_liboctave_error_handler) @@ -5841,46 +5841,46 @@ ColumnVector SparseMatrix::lssolve (const ColumnVector& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } ColumnVector -SparseMatrix::lssolve (const ColumnVector& b, int& info) const +SparseMatrix::lssolve (const ColumnVector& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } ColumnVector -SparseMatrix::lssolve (const ColumnVector& b, int& info, int& rank) const +SparseMatrix::lssolve (const ColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const { Matrix tmp (b); - return lssolve (tmp, info, rank).column (0); + return lssolve (tmp, info, rank).column (static_cast (0)); } ComplexColumnVector SparseMatrix::lssolve (const ComplexColumnVector& b) const { - int info; - int rank; + octave_idx_type info; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexColumnVector -SparseMatrix::lssolve (const ComplexColumnVector& b, int& info) const +SparseMatrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info) const { - int rank; + octave_idx_type rank; return lssolve (b, info, rank); } ComplexColumnVector -SparseMatrix::lssolve (const ComplexColumnVector& b, int& info, - int& rank) const +SparseMatrix::lssolve (const ComplexColumnVector& b, octave_idx_type& info, + octave_idx_type& rank) const { ComplexMatrix tmp (b); - return lssolve (tmp, info, rank).column (0); + return lssolve (tmp, info, rank).column (static_cast (0)); } // other operations. @@ -5888,14 +5888,14 @@ SparseMatrix SparseMatrix::map (d_d_Mapper f) const { - int nr = rows (); - int nc = cols (); - int nz = nnz (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); bool f_zero = (f(0.0) == 0.0); // Count number of non-zero elements - int nel = (f_zero ? 0 : nr*nc - nz); - for (int i = 0; i < nz; i++) + octave_idx_type nel = (f_zero ? 0 : nr*nc - nz); + for (octave_idx_type i = 0; i < nz; i++) if (f (data(i)) != 0.0) nel++; @@ -5903,10 +5903,10 @@ if (f_zero) { - int ii = 0; - for (int j = 0; j < nc; j++) + octave_idx_type ii = 0; + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { double tmp = f (elem (i, j)); if (tmp != 0.0) @@ -5920,10 +5920,10 @@ } else { - int ii = 0; - for (int j = 0; j < nc; j++) + octave_idx_type ii = 0; + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { retval.data(ii) = f (elem(i)); retval.ridx(ii++) = ridx(i); @@ -5938,14 +5938,14 @@ SparseBoolMatrix SparseMatrix::map (b_d_Mapper f) const { - int nr = rows (); - int nc = cols (); - int nz = nnz (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz = nnz (); bool f_zero = f(0.0); // Count number of non-zero elements - int nel = (f_zero ? 0 : nr*nc - nz); - for (int i = 0; i < nz; i++) + octave_idx_type nel = (f_zero ? 0 : nr*nc - nz); + for (octave_idx_type i = 0; i < nz; i++) if (f (data(i)) != 0.0) nel++; @@ -5953,10 +5953,10 @@ if (f_zero) { - int ii = 0; - for (int j = 0; j < nc; j++) + octave_idx_type ii = 0; + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { bool tmp = f (elem (i, j)); if (tmp) @@ -5970,10 +5970,10 @@ } else { - int ii = 0; - for (int j = 0; j < nc; j++) + octave_idx_type ii = 0; + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) { retval.data(ii) = f (elem(i)); retval.ridx(ii++) = ridx(i); @@ -5995,17 +5995,17 @@ bool SparseMatrix::any_element_is_negative (bool neg_zero) const { - int nel = nnz (); + octave_idx_type nel = nnz (); if (neg_zero) { - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) if (lo_ieee_signbit (data (i))) return true; } else { - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) if (data (i) < 0) return true; } @@ -6016,9 +6016,9 @@ bool SparseMatrix::any_element_is_inf_or_nan (void) const { - int nel = nnz (); - - for (int i = 0; i < nel; i++) + octave_idx_type nel = nnz (); + + for (octave_idx_type i = 0; i < nel; i++) { double val = data (i); if (xisinf (val) || xisnan (val)) @@ -6031,9 +6031,9 @@ bool SparseMatrix::all_elements_are_int_or_inf_or_nan (void) const { - int nel = nnz (); - - for (int i = 0; i < nel; i++) + octave_idx_type nel = nnz (); + + for (octave_idx_type i = 0; i < nel; i++) { double val = data (i); if (xisnan (val) || D_NINT (val) == val) @@ -6051,7 +6051,7 @@ bool SparseMatrix::all_integers (double& max_val, double& min_val) const { - int nel = nnz (); + octave_idx_type nel = nnz (); if (nel == 0) return false; @@ -6059,7 +6059,7 @@ max_val = data (0); min_val = data (0); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { double val = data (i); @@ -6079,9 +6079,9 @@ bool SparseMatrix::too_large_for_float (void) const { - int nel = nnz (); - - for (int i = 0; i < nel; i++) + octave_idx_type nel = nnz (); + + for (octave_idx_type i = 0; i < nel; i++) { double val = data (i); @@ -6095,19 +6095,19 @@ SparseBoolMatrix SparseMatrix::operator ! (void) const { - int nr = rows (); - int nc = cols (); - int nz1 = nnz (); - int nz2 = nr*nc - nz1; + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); + octave_idx_type nz1 = nnz (); + octave_idx_type nz2 = nr*nc - nz1; SparseBoolMatrix r (nr, nc, nz2); - int ii = 0; - int jj = 0; + octave_idx_type ii = 0; + octave_idx_type jj = 0; r.cidx (0) = 0; - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) { if (jj < cidx(i+1) && ridx(jj) == j) jj++; @@ -6183,21 +6183,21 @@ SparseMatrix SparseMatrix::abs (void) const { - int nz = nnz (); + octave_idx_type nz = nnz (); SparseMatrix retval (*this); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) retval.data(i) = fabs(retval.data(i)); return retval; } SparseMatrix -SparseMatrix::diag (int k) const +SparseMatrix::diag (octave_idx_type k) const { - int nnr = rows (); - int nnc = cols (); + octave_idx_type nnr = rows (); + octave_idx_type nnc = cols (); if (k > 0) nnc -= k; @@ -6208,25 +6208,25 @@ if (nnr > 0 && nnc > 0) { - int ndiag = (nnr < nnc) ? nnr : nnc; + octave_idx_type ndiag = (nnr < nnc) ? nnr : nnc; // Count the number of non-zero elements - int nel = 0; + octave_idx_type nel = 0; if (k > 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) if (elem (i, i+k) != 0.) nel++; } else if ( k < 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) if (elem (i-k, i) != 0.) nel++; } else { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) if (elem (i, i) != 0.) nel++; } @@ -6235,10 +6235,10 @@ d.xcidx (0) = 0; d.xcidx (1) = nel; - int ii = 0; + octave_idx_type ii = 0; if (k > 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) { double tmp = elem (i, i+k); if (tmp != 0.) @@ -6250,7 +6250,7 @@ } else if ( k < 0) { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) { double tmp = elem (i-k, i); if (tmp != 0.) @@ -6262,7 +6262,7 @@ } else { - for (int i = 0; i < ndiag; i++) + for (octave_idx_type i = 0; i < ndiag; i++) { double tmp = elem (i, i); if (tmp != 0.) @@ -6283,12 +6283,12 @@ Matrix SparseMatrix::matrix_value (void) const { - int nr = rows (); - int nc = cols (); + octave_idx_type nr = rows (); + octave_idx_type nc = cols (); Matrix retval (nr, nc, 0.0); - for (int j = 0; j < nc; j++) - for (int i = cidx(j); i < cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) retval.elem (ridx(i), j) = data (i); return retval; @@ -6297,13 +6297,13 @@ std::ostream& operator << (std::ostream& os, const SparseMatrix& a) { - int nc = a.cols (); + octave_idx_type nc = a.cols (); // add one to the printed indices to go from // zero-based to one-based arrays - for (int j = 0; j < nc; j++) { + for (octave_idx_type j = 0; j < nc; j++) { OCTAVE_QUIT; - for (int i = a.cidx(j); i < a.cidx(j+1); i++) { + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { os << a.ridx(i) + 1 << " " << j + 1 << " "; octave_write_double (os, a.data(i)); os << "\n"; @@ -6316,20 +6316,20 @@ std::istream& operator >> (std::istream& is, SparseMatrix& a) { - int nr = a.rows (); - int nc = a.cols (); - int nz = a.nnz (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); + octave_idx_type nz = a.nnz (); if (nr < 1 || nc < 1) is.clear (std::ios::badbit); else { - int itmp, jtmp, jold = 0; + octave_idx_type itmp, jtmp, jold = 0; double tmp; - int ii = 0; + octave_idx_type ii = 0; a.cidx (0) = 0; - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { is >> itmp; itmp--; @@ -6341,7 +6341,7 @@ { if (jold != jtmp) { - for (int j = jold; j < jtmp; j++) + for (octave_idx_type j = jold; j < jtmp; j++) a.cidx(j+1) = ii; jold = jtmp; @@ -6353,7 +6353,7 @@ goto done; } - for (int j = jold; j < nc; j++) + for (octave_idx_type j = jold; j < nc; j++) a.cidx(j+1) = ii; } @@ -6393,13 +6393,13 @@ } SparseMatrix -SparseMatrix::permute (const Array& vec, bool inv) const +SparseMatrix::permute (const Array& vec, bool inv) const { return MSparse::permute (vec, inv); } SparseMatrix -SparseMatrix::ipermute (const Array& vec) const +SparseMatrix::ipermute (const Array& vec) const { return MSparse::ipermute (vec); } @@ -6429,8 +6429,8 @@ { SparseMatrix result; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (SparseMatrix); @@ -6438,13 +6438,13 @@ if (d < 0.) { result = SparseMatrix (nr, nc, d); - for (int j = 0; j < nc; j++) - for (int i = m.cidx(j); i < m.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) { double tmp = xmin (d, m.data (i)); if (tmp != 0.) { - int idx = m.ridx(i) + j * nr; + octave_idx_type idx = m.ridx(i) + j * nr; result.xdata(idx) = tmp; result.xridx(idx) = m.ridx(i); } @@ -6452,19 +6452,19 @@ } else { - int nel = 0; - for (int j = 0; j < nc; j++) - for (int i = m.cidx(j); i < m.cidx(j+1); i++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) if (xmin (d, m.data (i)) != 0.) nel++; result = SparseMatrix (nr, nc, nel); - int ii = 0; + octave_idx_type ii = 0; result.xcidx(0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = m.cidx(j); i < m.cidx(j+1); i++) + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) { double tmp = xmin (d, m.data (i)); @@ -6494,11 +6494,11 @@ if ((a.rows() == b.rows()) && (a.cols() == b.cols())) { - int a_nr = a.rows (); - int a_nc = a.cols (); - - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); + + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (a_nr != b_nr || a_nc != b_nc) gripe_nonconformant ("min", a_nr, a_nc, b_nr, b_nc); @@ -6506,16 +6506,16 @@ { r = SparseMatrix (a_nr, a_nc, (a.nnz () + b.nnz ())); - int jx = 0; + octave_idx_type jx = 0; r.cidx (0) = 0; - for (int i = 0 ; i < a_nc ; i++) + for (octave_idx_type i = 0 ; i < a_nc ; i++) { - int ja = a.cidx(i); - int ja_max = a.cidx(i+1); + octave_idx_type ja = a.cidx(i); + octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - int jb = b.cidx(i); - int jb_max = b.cidx(i+1); + 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 ) @@ -6579,8 +6579,8 @@ { SparseMatrix result; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); EMPTY_RETURN_CHECK (SparseMatrix); @@ -6588,14 +6588,14 @@ if (d > 0.) { result = SparseMatrix (nr, nc, d); - for (int j = 0; j < nc; j++) - for (int i = m.cidx(j); i < m.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) { double tmp = xmax (d, m.data (i)); if (tmp != 0.) { - int idx = m.ridx(i) + j * nr; + octave_idx_type idx = m.ridx(i) + j * nr; result.xdata(idx) = tmp; result.xridx(idx) = m.ridx(i); } @@ -6603,19 +6603,19 @@ } else { - int nel = 0; - for (int j = 0; j < nc; j++) - for (int i = m.cidx(j); i < m.cidx(j+1); i++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) if (xmax (d, m.data (i)) != 0.) nel++; result = SparseMatrix (nr, nc, nel); - int ii = 0; + octave_idx_type ii = 0; result.xcidx(0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = m.cidx(j); i < m.cidx(j+1); i++) + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) { double tmp = xmax (d, m.data (i)); if (tmp != 0.) @@ -6644,11 +6644,11 @@ if ((a.rows() == b.rows()) && (a.cols() == b.cols())) { - int a_nr = a.rows (); - int a_nc = a.cols (); - - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); + + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (a_nr != b_nr || a_nc != b_nc) gripe_nonconformant ("min", a_nr, a_nc, b_nr, b_nc); @@ -6656,16 +6656,16 @@ { r = SparseMatrix (a_nr, a_nc, (a.nnz () + b.nnz ())); - int jx = 0; + octave_idx_type jx = 0; r.cidx (0) = 0; - for (int i = 0 ; i < a_nc ; i++) + for (octave_idx_type i = 0 ; i < a_nc ; i++) { - int ja = a.cidx(i); - int ja_max = a.cidx(i+1); + octave_idx_type ja = a.cidx(i); + octave_idx_type ja_max = a.cidx(i+1); bool ja_lt_max= ja < ja_max; - int jb = b.cidx(i); - int jb_max = b.cidx(i+1); + 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 ) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dSparse.h --- a/liboctave/dSparse.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dSparse.h Fri Apr 08 16:07:37 2005 +0000 @@ -46,9 +46,9 @@ SparseMatrix (void) : MSparse () { } - SparseMatrix (int r, int c) : MSparse (r, c) { } + SparseMatrix (octave_idx_type r, octave_idx_type c) : MSparse (r, c) { } - explicit SparseMatrix (int r, int 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) { } @@ -64,17 +64,17 @@ explicit SparseMatrix (const NDArray& a) : MSparse (a) { } - explicit SparseMatrix (const Array a, const Array& r, - const Array& c, int nr = -1, - int nc = -1, bool sum_terms = true) + explicit SparseMatrix (const Array a, const Array& r, + const Array& c, octave_idx_type nr = -1, + octave_idx_type nc = -1, bool sum_terms = true) : MSparse (a, r, c, nr, nc, sum_terms) { } explicit SparseMatrix (const Array a, const Array& r, - const Array& c, int nr = -1, - int nc = -1, bool sum_terms = true) + const Array& c, octave_idx_type nr = -1, + octave_idx_type nc = -1, bool sum_terms = true) : MSparse (a, r, c, nr, nc, sum_terms) { } - SparseMatrix (int r, int c, int num_nz) : MSparse (r, c, num_nz) { } + SparseMatrix (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz) : MSparse (r, c, num_nz) { } SparseMatrix& operator = (const SparseMatrix& a) { @@ -88,17 +88,17 @@ bool is_symmetric (void) const; SparseMatrix max (int dim = 0) const; - SparseMatrix max (Array2& index, int dim = 0) const; + SparseMatrix max (Array2& index, int dim = 0) const; SparseMatrix min (int dim = 0) const; - SparseMatrix min (Array2& index, int dim = 0) const; + SparseMatrix min (Array2& index, int dim = 0) const; // destructive insert/delete/reorder operations - SparseMatrix& insert (const SparseMatrix& a, int r, int c); + SparseMatrix& insert (const SparseMatrix& a, octave_idx_type r, octave_idx_type c); - SparseMatrix concat (const SparseMatrix& rb, const Array& ra_idx); + SparseMatrix concat (const SparseMatrix& rb, const Array& ra_idx); SparseComplexMatrix concat (const SparseComplexMatrix& rb, - const Array& ra_idx); + const Array& ra_idx); friend SparseMatrix real (const SparseComplexMatrix& a); friend SparseMatrix imag (const SparseComplexMatrix& a); @@ -113,225 +113,225 @@ } SparseMatrix inverse (void) const; - SparseMatrix inverse (int& info) const; - SparseMatrix inverse (int& info, double& rcond, int force = 0, + SparseMatrix inverse (octave_idx_type& info) const; + SparseMatrix inverse (octave_idx_type& info, double& rcond, int force = 0, int calc_cond = 1) const; DET determinant (void) const; - DET determinant (int& info) const; - DET determinant (int& info, double& rcond, int calc_cond = 1) const; + DET determinant (octave_idx_type& info) const; + DET determinant (octave_idx_type& info, double& rcond, int calc_cond = 1) const; private: // Diagonal matrix solvers - Matrix dsolve (SparseType &typ, const Matrix& b, int& info, double& rcond, + Matrix dsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix dsolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix dsolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseMatrix dsolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseMatrix dsolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix dsolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Upper triangular matrix solvers - Matrix utsolve (SparseType &typ, const Matrix& b, int& info, double& rcond, + Matrix utsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix utsolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix utsolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseMatrix utsolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseMatrix utsolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix utsolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Lower triangular matrix solvers - Matrix ltsolve (SparseType &typ, const Matrix& b, int& info, double& rcond, + Matrix ltsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix ltsolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix ltsolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseMatrix ltsolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseMatrix ltsolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix ltsolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Tridiagonal matrix solvers - Matrix trisolve (SparseType &typ, const Matrix& b, int& info, double& rcond, + Matrix trisolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix trisolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix trisolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseMatrix trisolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseMatrix trisolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix trisolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Banded matrix solvers (umfpack/cholesky) - Matrix bsolve (SparseType &typ, const Matrix& b, int& info, double& rcond, + Matrix bsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix bsolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix bsolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseMatrix bsolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseMatrix bsolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix bsolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Full matrix solvers (umfpack/cholesky) - void * factorize (int& err, double &rcond, Matrix &Control, Matrix &Info, + void * factorize (octave_idx_type& err, double &rcond, Matrix &Control, Matrix &Info, solve_singularity_handler sing_handler) const; - Matrix fsolve (SparseType &typ, const Matrix& b, int& info, double& rcond, + Matrix fsolve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - ComplexMatrix fsolve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix fsolve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; - SparseMatrix fsolve (SparseType &typ, const SparseMatrix& b, int& info, + SparseMatrix fsolve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix fsolve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; public: // Generic interface to solver with no probing of type Matrix solve (SparseType &typ, const Matrix& b) const; - Matrix solve (SparseType &typ, const Matrix& b, int& info) const; - Matrix solve (SparseType &typ, const Matrix& b, int& info, + Matrix solve (SparseType &typ, const Matrix& b, octave_idx_type& info) const; + Matrix solve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond) const; - Matrix solve (SparseType &typ, const Matrix& b, int& info, double& rcond, + Matrix solve (SparseType &typ, const Matrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b) const; ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, - int& info) const; - ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, int& info, + octave_idx_type& info) const; + ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; - ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, int& info, + ComplexMatrix solve (SparseType &typ, const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseMatrix solve (SparseType &typ, const SparseMatrix& b) const; SparseMatrix solve (SparseType &typ, const SparseMatrix& b, - int& info) const; - SparseMatrix solve (SparseType &typ, const SparseMatrix& b, int& info, + octave_idx_type& info) const; + SparseMatrix solve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond) const; - SparseMatrix solve (SparseType &typ, const SparseMatrix& b, int& info, + SparseMatrix solve (SparseType &typ, const SparseMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b) const; SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b, - int& info) const; + octave_idx_type& info) const; SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b, - int& info, double& rcond) const; - SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b, int& info, + octave_idx_type& info, double& rcond) const; + SparseComplexMatrix solve (SparseType &typ, const SparseComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ColumnVector solve (SparseType &typ, const ColumnVector& b) const; ColumnVector solve (SparseType &typ, const ColumnVector& b, - int& info) const; + octave_idx_type& info) const; ColumnVector solve (SparseType &typ, const ColumnVector& b, - int& info, double& rcond) const; - ColumnVector solve (SparseType &typ, const ColumnVector& b, int& info, + octave_idx_type& info, double& rcond) const; + ColumnVector solve (SparseType &typ, const ColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexColumnVector solve (SparseType &typ, const ComplexColumnVector& b) const; ComplexColumnVector solve (SparseType &typ, - const ComplexColumnVector& b, int& info) const; + const ComplexColumnVector& b, octave_idx_type& info) const; ComplexColumnVector solve (SparseType &typ, const ComplexColumnVector& b, - int& info, double& rcond) const; + octave_idx_type& info, double& rcond) const; ComplexColumnVector solve (SparseType &typ, const ComplexColumnVector& b, - int& info, double& rcond, + octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Generic interface to solver with probing of type Matrix solve (const Matrix& b) const; - Matrix solve (const Matrix& b, int& info) const; - Matrix solve (const Matrix& b, int& info, double& rcond) const; - Matrix solve (const Matrix& b, int& info, double& rcond, + Matrix solve (const Matrix& b, octave_idx_type& info) const; + Matrix solve (const Matrix& b, octave_idx_type& info, double& rcond) const; + Matrix 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, int& info) const; - ComplexMatrix solve (const ComplexMatrix& b, int& info, + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const; + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const; - ComplexMatrix solve (const ComplexMatrix& b, int& info, double& rcond, + ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; SparseMatrix solve (const SparseMatrix& b) const; - SparseMatrix solve (const SparseMatrix& b, int& info) const; - SparseMatrix solve (const SparseMatrix& b, int& info, + SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info) const; + SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info, double& rcond) const; - SparseMatrix solve (const SparseMatrix& b, int& info, double& rcond, + 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, int& info) const; - SparseComplexMatrix solve (const SparseComplexMatrix& b, int& info, + SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info) const; + SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, double& rcond) const; - SparseComplexMatrix solve (const SparseComplexMatrix& b, int& info, + SparseComplexMatrix solve (const SparseComplexMatrix& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ColumnVector solve (const ColumnVector& b) const; - ColumnVector solve (const ColumnVector& b, int& info) const; - ColumnVector solve (const ColumnVector& b, int& info, double& rcond) const; - ColumnVector solve (const ColumnVector& b, int& info, double& rcond, + ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const; + ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const; + ColumnVector solve (const ColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; ComplexColumnVector solve (const ComplexColumnVector& b) const; - ComplexColumnVector solve (const ComplexColumnVector& b, int& info) const; - ComplexColumnVector solve (const ComplexColumnVector& b, int& info, + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info) const; + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond) const; - ComplexColumnVector solve (const ComplexColumnVector& b, int& info, + ComplexColumnVector solve (const ComplexColumnVector& b, octave_idx_type& info, double& rcond, solve_singularity_handler sing_handler) const; // Minimum-norm solvers Matrix lssolve (const Matrix& b) const; - Matrix lssolve (const Matrix& b, int& info) const; - Matrix lssolve (const Matrix& b, int& info, int& rank) const; + Matrix lssolve (const Matrix& b, octave_idx_type& info) const; + Matrix lssolve (const Matrix& b, octave_idx_type& info, octave_idx_type& rank) const; ComplexMatrix lssolve (const ComplexMatrix& b) const; - ComplexMatrix lssolve (const ComplexMatrix& b, int& info) const; - ComplexMatrix lssolve (const ComplexMatrix& b, int& info, - int& rank) const; + ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info) const; + ComplexMatrix lssolve (const ComplexMatrix& b, octave_idx_type& info, + octave_idx_type& rank) const; SparseMatrix lssolve (const SparseMatrix& b) const; - SparseMatrix lssolve (const SparseMatrix& b, int& info) const; - SparseMatrix lssolve (const SparseMatrix& b, int& info, int& rank) const; + SparseMatrix lssolve (const SparseMatrix& b, octave_idx_type& info) const; + SparseMatrix lssolve (const SparseMatrix& b, octave_idx_type& info, octave_idx_type& rank) const; SparseComplexMatrix lssolve (const SparseComplexMatrix& b) const; SparseComplexMatrix lssolve (const SparseComplexMatrix& b, - int& info) const; - SparseComplexMatrix lssolve (const SparseComplexMatrix& b, int& info, - int& rank) const; + octave_idx_type& info) const; + SparseComplexMatrix lssolve (const SparseComplexMatrix& b, octave_idx_type& info, + octave_idx_type& rank) const; ColumnVector lssolve (const ColumnVector& b) const; - ColumnVector lssolve (const ColumnVector& b, int& info) const; - ColumnVector lssolve (const ColumnVector& b, int& info, int& rank) const; + ColumnVector lssolve (const ColumnVector& b, octave_idx_type& info) const; + ColumnVector lssolve (const ColumnVector& b, octave_idx_type& info, octave_idx_type& rank) const; ComplexColumnVector lssolve (const ComplexColumnVector& b) const; - ComplexColumnVector lssolve (const ComplexColumnVector& b, int& info) const; - ComplexColumnVector lssolve (const ComplexColumnVector& b, int& info, - int& rank) const; + ComplexColumnVector lssolve (const ComplexColumnVector& b, octave_idx_type& info) const; + ComplexColumnVector lssolve (const ComplexColumnVector& b, octave_idx_type& info, + octave_idx_type& rank) const; // other operations SparseMatrix map (d_d_Mapper f) const; @@ -357,7 +357,7 @@ SparseMatrix sumsq (int dim = -1) const; SparseMatrix abs (void) const; - SparseMatrix diag (int k = 0) const; + SparseMatrix diag (octave_idx_type k = 0) const; Matrix matrix_value (void) const; @@ -371,9 +371,9 @@ SparseMatrix reshape (const dim_vector& new_dims) const; - SparseMatrix permute (const Array& vec, bool inv = false) const; + SparseMatrix permute (const Array& vec, bool inv = false) const; - SparseMatrix ipermute (const Array& vec) const; + SparseMatrix ipermute (const Array& vec) const; // i/o diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleAEPBAL.cc --- a/liboctave/dbleAEPBAL.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleAEPBAL.cc Fri Apr 08 16:07:37 2005 +0000 @@ -33,23 +33,23 @@ { F77_RET_T F77_FUNC (dgebal, DGEBAL) (F77_CONST_CHAR_ARG_DECL, - const int&, double*, const int&, int&, - int&, double*, int& + const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type&, + octave_idx_type&, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (dgebak, DGEBAK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const int&, double*, - const int&, double*, const int&, int& + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, double*, + const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); } -int +octave_idx_type AEPBALANCE::init (const Matrix& a, const std::string& balance_job) { - int n = a.cols (); + octave_idx_type n = a.cols (); if (a.rows () != n) { @@ -57,9 +57,9 @@ return -1; } - int info; - int ilo; - int ihi; + octave_idx_type info; + octave_idx_type ilo; + octave_idx_type ihi; Array scale (n); double *pscale = scale.fortran_vec (); @@ -78,7 +78,7 @@ else { balancing_mat = Matrix (n, n, 0.0); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) balancing_mat.elem (i ,i) = 1.0; double *p_balancing_mat = balancing_mat.fortran_vec (); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleAEPBAL.h --- a/liboctave/dbleAEPBAL.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleAEPBAL.h Fri Apr 08 16:07:37 2005 +0000 @@ -66,7 +66,7 @@ Matrix balanced_mat; Matrix balancing_mat; - int init (const Matrix& a, const std::string& balance_job); + octave_idx_type init (const Matrix& a, const std::string& balance_job); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleCHOL.cc --- a/liboctave/dbleCHOL.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleCHOL.cc Fri Apr 08 16:07:37 2005 +0000 @@ -31,16 +31,16 @@ extern "C" { F77_RET_T - F77_FUNC (dpotrf, DPOTRF) (F77_CONST_CHAR_ARG_DECL, const int&, - double*, const int&, int& + 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); } -int +octave_idx_type CHOL::init (const Matrix& a) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (a_nr != a_nc) { @@ -48,8 +48,8 @@ return -1; } - int n = a_nc; - int info; + octave_idx_type n = a_nc; + octave_idx_type info; chol_mat = a; double *h = chol_mat.fortran_vec (); @@ -66,8 +66,8 @@ // faster for that matter :-)), please let me know! if (n > 1) - for (int j = 0; j < a_nc; j++) - for (int i = j+1; i < a_nr; i++) + for (octave_idx_type j = 0; j < a_nc; j++) + for (octave_idx_type i = j+1; i < a_nr; i++) chol_mat.elem (i, j) = 0.0; } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleCHOL.h --- a/liboctave/dbleCHOL.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleCHOL.h Fri Apr 08 16:07:37 2005 +0000 @@ -36,7 +36,7 @@ CHOL (const Matrix& a) { init (a); } - CHOL (const Matrix& a, int& info) { info = init (a); } + CHOL (const Matrix& a, octave_idx_type& info) { info = init (a); } CHOL (const CHOL& a) : chol_mat (a.chol_mat) { } @@ -56,7 +56,7 @@ Matrix chol_mat; - int init (const Matrix& a); + octave_idx_type init (const Matrix& a); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleHESS.cc --- a/liboctave/dbleHESS.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleHESS.cc Fri Apr 08 16:07:37 2005 +0000 @@ -32,34 +32,34 @@ { F77_RET_T F77_FUNC (dgebal, DGEBAL) (F77_CONST_CHAR_ARG_DECL, - const int&, double*, const int&, int&, - int&, double*, int& + const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type&, + octave_idx_type&, double*, octave_idx_type& F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dgehrd, DGEHRD) (const int&, const int&, const int&, - double*, const int&, double*, double*, - const int&, int&); + F77_FUNC (dgehrd, DGEHRD) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + double*, const octave_idx_type&, double*, double*, + const octave_idx_type&, octave_idx_type&); F77_RET_T - F77_FUNC (dorghr, DORGHR) (const int&, const int&, const int&, - double*, const int&, double*, double*, - const int&, int&); + F77_FUNC (dorghr, DORGHR) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + double*, const octave_idx_type&, double*, double*, + const octave_idx_type&, octave_idx_type&); F77_RET_T F77_FUNC (dgebak, DGEBAK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const int&, double*, - const int&, double*, const int&, int& + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, double*, + const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); } -int +octave_idx_type HESS::init (const Matrix& a) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (a_nr != a_nc) { @@ -70,11 +70,11 @@ char job = 'N'; char side = 'R'; - int n = a_nc; - int lwork = 32 * n; - int info; - int ilo; - int ihi; + octave_idx_type n = a_nc; + octave_idx_type lwork = 32 * n; + octave_idx_type info; + octave_idx_type ilo; + octave_idx_type ihi; hess_mat = a; double *h = hess_mat.fortran_vec (); @@ -131,8 +131,8 @@ // me know! if (n > 2) - for (int j = 0; j < a_nc; j++) - for (int i = j+2; i < a_nr; i++) + for (octave_idx_type j = 0; j < a_nc; j++) + for (octave_idx_type i = j+2; i < a_nr; i++) hess_mat.elem (i, j) = 0; } } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleHESS.h --- a/liboctave/dbleHESS.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleHESS.h Fri Apr 08 16:07:37 2005 +0000 @@ -36,7 +36,7 @@ HESS (const Matrix& a) { init (a); } - HESS (const Matrix& a, int& info) { info = init (a); } + HESS (const Matrix& a, octave_idx_type& info) { info = init (a); } HESS (const HESS& a) : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) { } @@ -64,7 +64,7 @@ Matrix hess_mat; Matrix unitary_hess_mat; - int init (const Matrix& a); + octave_idx_type init (const Matrix& a); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleLU.cc --- a/liboctave/dbleLU.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleLU.cc Fri Apr 08 16:07:37 2005 +0000 @@ -40,30 +40,30 @@ extern "C" { F77_RET_T - F77_FUNC (dgetrf, DGETRF) (const int&, const int&, double*, - const int&, int*, int&); + F77_FUNC (dgetrf, DGETRF) (const octave_idx_type&, const octave_idx_type&, double*, + const octave_idx_type&, octave_idx_type*, octave_idx_type&); } LU::LU (const Matrix& a) { - int a_nr = a.rows (); - int a_nc = a.cols (); - int mn = (a_nr < a_nc ? a_nr : a_nc); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); + octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc); ipvt.resize (mn); - int *pipvt = ipvt.fortran_vec (); + octave_idx_type *pipvt = ipvt.fortran_vec (); a_fact = a; double *tmp_data = a_fact.fortran_vec (); - int info = 0; + octave_idx_type info = 0; F77_XFCN (dgetrf, DGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info)); if (f77_exception_encountered) (*current_liboctave_error_handler) ("unrecoverable error in dgetrf"); else - ipvt -= 1; + ipvt -= static_cast (1); } /* diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleQR.cc --- a/liboctave/dbleQR.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleQR.cc Fri Apr 08 16:07:37 2005 +0000 @@ -31,12 +31,12 @@ extern "C" { F77_RET_T - F77_FUNC (dgeqrf, DGEQRF) (const int&, const int&, double*, const int&, - double*, double*, const int&, int&); + 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&); F77_RET_T - F77_FUNC (dorgqr, DORGQR) (const int&, const int&, const int&, double*, - const int&, double*, double*, const int&, int&); + F77_FUNC (dorgqr, DORGQR) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, double*, + const octave_idx_type&, double*, double*, const octave_idx_type&, octave_idx_type&); } QR::QR (const Matrix& a, QR::type qr_type) @@ -48,8 +48,8 @@ void QR::init (const Matrix& a, QR::type qr_type) { - int m = a.rows (); - int n = a.cols (); + octave_idx_type m = a.rows (); + octave_idx_type n = a.cols (); if (m == 0 || n == 0) { @@ -57,15 +57,15 @@ return; } - int min_mn = m < n ? m : n; + octave_idx_type min_mn = m < n ? m : n; Array tau (min_mn); double *ptau = tau.fortran_vec (); - int lwork = 32*n; + octave_idx_type lwork = 32*n; Array work (lwork); double *pwork = work.fortran_vec (); - int info = 0; + octave_idx_type info = 0; Matrix A_fact = a; if (m > n && qr_type != QR::economy) @@ -81,10 +81,10 @@ { if (qr_type == QR::raw) { - for (int j = 0; j < min_mn; j++) + for (octave_idx_type j = 0; j < min_mn; j++) { - int limit = j < min_mn - 1 ? j : min_mn - 1; - for (int i = limit + 1; i < m; i++) + octave_idx_type limit = j < min_mn - 1 ? j : min_mn - 1; + for (octave_idx_type i = limit + 1; i < m; i++) A_fact.elem (i, j) *= tau.elem (j); } @@ -95,17 +95,17 @@ } else { - int n2 = (qr_type == QR::economy) ? min_mn : m; + octave_idx_type n2 = (qr_type == QR::economy) ? min_mn : m; if (qr_type == QR::economy && m > n) r.resize (n, n, 0.0); else r.resize (m, n, 0.0); - for (int j = 0; j < n; j++) + for (octave_idx_type j = 0; j < n; j++) { - int limit = j < min_mn-1 ? j : min_mn-1; - for (int i = 0; i <= limit; i++) + octave_idx_type limit = j < min_mn-1 ? j : min_mn-1; + for (octave_idx_type i = 0; i <= limit; i++) r.elem (i, j) = tmp_data[m*j+i]; } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleQRP.cc --- a/liboctave/dbleQRP.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleQRP.cc Fri Apr 08 16:07:37 2005 +0000 @@ -33,13 +33,13 @@ extern "C" { F77_RET_T - F77_FUNC (dgeqpf, DGEQPF) (const int&, const int&, double*, - const int&, int*, double*, double*, int&); + F77_FUNC (dgeqpf, DGEQPF) (const octave_idx_type&, const octave_idx_type&, double*, + const octave_idx_type&, octave_idx_type*, double*, double*, octave_idx_type&); F77_RET_T - F77_FUNC (dorgqr, DORGQR) (const int&, const int&, const int&, - double*, const int&, double*, double*, - const int&, int&); + F77_FUNC (dorgqr, DORGQR) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, + double*, const octave_idx_type&, double*, double*, + const octave_idx_type&, octave_idx_type&); } // It would be best to share some of this code with QR class... @@ -55,8 +55,8 @@ { assert (qr_type != QR::raw); - int m = a.rows (); - int n = a.cols (); + octave_idx_type m = a.rows (); + octave_idx_type n = a.cols (); if (m == 0 || n == 0) { @@ -64,15 +64,15 @@ return; } - int min_mn = m < n ? m : n; + octave_idx_type min_mn = m < n ? m : n; Array tau (min_mn); double *ptau = tau.fortran_vec (); - int lwork = 3*n > 32*m ? 3*n : 32*m; + octave_idx_type lwork = 3*n > 32*m ? 3*n : 32*m; Array work (lwork); double *pwork = work.fortran_vec (); - int info = 0; + octave_idx_type info = 0; Matrix A_fact = a; if (m > n && qr_type != QR::economy) @@ -80,8 +80,8 @@ double *tmp_data = A_fact.fortran_vec (); - Array jpvt (n, 0); - int *pjpvt = jpvt.fortran_vec (); + Array jpvt (n, 0); + octave_idx_type *pjpvt = jpvt.fortran_vec (); // Code to enforce a certain permutation could go here... @@ -97,27 +97,27 @@ if (qr_type == QR::economy) { p.resize (1, n, 0.0); - for (int j = 0; j < n; j++) + for (octave_idx_type j = 0; j < n; j++) p.elem (0, j) = jpvt.elem (j); } else { p.resize (n, n, 0.0); - for (int j = 0; j < n; j++) + for (octave_idx_type j = 0; j < n; j++) p.elem (jpvt.elem (j) - 1, j) = 1.0; } - int n2 = (qr_type == QR::economy) ? min_mn : m; + octave_idx_type n2 = (qr_type == QR::economy) ? min_mn : m; if (qr_type == QR::economy && m > n) r.resize (n, n, 0.0); else r.resize (m, n, 0.0); - for (int j = 0; j < n; j++) + for (octave_idx_type j = 0; j < n; j++) { - int limit = j < min_mn-1 ? j : min_mn-1; - for (int i = 0; i <= limit; i++) + octave_idx_type limit = j < min_mn-1 ? j : min_mn-1; + for (octave_idx_type i = 0; i <= limit; i++) r.elem (i, j) = A_fact.elem (i, j); } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleSCHUR.cc --- a/liboctave/dbleSCHUR.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleSCHUR.cc Fri Apr 08 16:07:37 2005 +0000 @@ -37,32 +37,32 @@ F77_CONST_CHAR_ARG_DECL, SCHUR::select_function, F77_CONST_CHAR_ARG_DECL, - const int&, double*, const int&, int&, - double*, double*, double*, const int&, - double&, double&, double*, const int&, - int*, const int&, int*, int& + const octave_idx_type&, double*, const octave_idx_type&, octave_idx_type&, + double*, double*, double*, const octave_idx_type&, + double&, double&, double*, const octave_idx_type&, + octave_idx_type*, const octave_idx_type&, octave_idx_type*, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); } -static int +static octave_idx_type select_ana (const double& a, const double&) { return (a < 0.0); } -static int +static octave_idx_type select_dig (const double& a, const double& b) { return (hypot (a, b) < 1.0); } -int +octave_idx_type SCHUR::init (const Matrix& a, const std::string& ord, bool calc_unitary) { - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (a_nr != a_nc) { @@ -94,11 +94,11 @@ else selector = 0; - int n = a_nc; - int lwork = 8 * n; - int liwork = 1; - int info; - int sdim; + octave_idx_type n = a_nc; + octave_idx_type lwork = 8 * n; + octave_idx_type liwork = 1; + octave_idx_type info; + octave_idx_type sdim; double rconde; double rcondv; @@ -120,11 +120,11 @@ double *pwork = work.fortran_vec (); // BWORK is not referenced for the non-ordered Schur routine. - Array bwork ((ord_char == 'N' || ord_char == 'n') ? 0 : n); - int *pbwork = bwork.fortran_vec (); + Array bwork ((ord_char == 'N' || ord_char == 'n') ? 0 : n); + octave_idx_type *pbwork = bwork.fortran_vec (); - Array iwork (liwork); - int *piwork = iwork.fortran_vec (); + Array iwork (liwork); + octave_idx_type *piwork = iwork.fortran_vec (); F77_XFCN (dgeesx, DGEESX, (F77_CONST_CHAR_ARG2 (&jobvs, 1), F77_CONST_CHAR_ARG2 (&sort, 1), diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleSCHUR.h --- a/liboctave/dbleSCHUR.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleSCHUR.h Fri Apr 08 16:07:37 2005 +0000 @@ -64,7 +64,7 @@ friend std::ostream& operator << (std::ostream& os, const SCHUR& a); - typedef int (*select_function) (const double&, const double&); + typedef octave_idx_type (*select_function) (const double&, const double&); private: @@ -73,7 +73,7 @@ select_function selector; - int init (const Matrix& a, const std::string& ord, bool calc_unitary); + octave_idx_type init (const Matrix& a, const std::string& ord, bool calc_unitary); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleSVD.cc --- a/liboctave/dbleSVD.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleSVD.cc Fri Apr 08 16:07:37 2005 +0000 @@ -34,10 +34,10 @@ F77_RET_T F77_FUNC (dgesvd, DGESVD) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int&, const int&, double*, - const int&, double*, double*, - const int&, double*, const int&, - double*, const int&, int& + const octave_idx_type&, const octave_idx_type&, double*, + const octave_idx_type&, double*, double*, + const octave_idx_type&, double*, const octave_idx_type&, + double*, const octave_idx_type&, octave_idx_type& F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); } @@ -68,26 +68,26 @@ return right_sm; } -int +octave_idx_type SVD::init (const Matrix& a, SVD::type svd_type) { - int info; + octave_idx_type info; - int m = a.rows (); - int n = a.cols (); + octave_idx_type m = a.rows (); + octave_idx_type n = a.cols (); Matrix atmp = a; double *tmp_data = atmp.fortran_vec (); - int min_mn = m < n ? m : n; + octave_idx_type min_mn = m < n ? m : n; char jobu = 'A'; char jobv = 'A'; - int ncol_u = m; - int nrow_vt = n; - int nrow_s = m; - int ncol_s = n; + octave_idx_type ncol_u = m; + octave_idx_type nrow_vt = n; + octave_idx_type nrow_s = m; + octave_idx_type ncol_s = n; switch (svd_type) { @@ -132,7 +132,7 @@ // Ask DGESVD what the dimension of WORK should be. - int lwork = -1; + octave_idx_type lwork = -1; Array work (1); @@ -147,7 +147,7 @@ (*current_liboctave_error_handler) ("unrecoverable error in dgesvd"); else { - lwork = static_cast (work(0)); + lwork = static_cast (work(0)); work.resize (lwork); F77_XFCN (dgesvd, DGESVD, (F77_CONST_CHAR_ARG2 (&jobu, 1), diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dbleSVD.h --- a/liboctave/dbleSVD.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dbleSVD.h Fri Apr 08 16:07:37 2005 +0000 @@ -44,7 +44,7 @@ SVD (const Matrix& a, type svd_type = SVD::std) { init (a, svd_type); } - SVD (const Matrix& a, int& info, type svd_type = SVD::std) + SVD (const Matrix& a, octave_idx_type& info, type svd_type = SVD::std) { info = init (a, svd_type); } @@ -84,7 +84,7 @@ Matrix left_sm; Matrix right_sm; - int init (const Matrix& a, type svd_type = std); + octave_idx_type init (const Matrix& a, type svd_type = std); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/dim-vector.h --- a/liboctave/dim-vector.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/dim-vector.h Fri Apr 08 16:07:37 2005 +0000 @@ -27,6 +27,7 @@ #include #include "lo-sstream.h" +#include "oct-types.h" class dim_vector @@ -37,25 +38,25 @@ { public: - int *dims; + octave_idx_type *dims; int ndims; int count; dim_vector_rep (void) : dims (0), ndims (0), count (1) { } - dim_vector_rep (int n) : dims (new int [1]), ndims (1), count (1) + dim_vector_rep (octave_idx_type n) : dims (new octave_idx_type [1]), ndims (1), count (1) { dims[0] = n; } - dim_vector_rep (int r, int c) : dims (new int [2]), ndims (2), count (1) + dim_vector_rep (octave_idx_type r, octave_idx_type c) : dims (new octave_idx_type [2]), ndims (2), count (1) { dims[0] = r; dims[1] = c; } - dim_vector_rep (int r, int c, int p) - : dims (new int [3]), ndims (3), count (1) + dim_vector_rep (octave_idx_type r, octave_idx_type c, octave_idx_type p) + : dims (new octave_idx_type [3]), ndims (3), count (1) { dims[0] = r; dims[1] = c; @@ -63,7 +64,7 @@ } dim_vector_rep (const dim_vector_rep& dv) - : dims (dv.ndims > 0 ? new int [dv.ndims] : 0), + : dims (dv.ndims > 0 ? new octave_idx_type [dv.ndims] : 0), ndims (dv.ndims > 0 ? dv.ndims : 0), count (1) { if (dims) @@ -73,8 +74,8 @@ } } - dim_vector_rep (int n, const dim_vector_rep *dv, int fill_value = 0) - : dims ((dv && n > 0) ? new int [n] : 0), + dim_vector_rep (octave_idx_type n, const dim_vector_rep *dv, int fill_value = 0) + : dims ((dv && n > 0) ? new octave_idx_type [n] : 0), ndims (n > 0 ? n : 0), count (1) { if (dims) @@ -95,13 +96,13 @@ int length (void) const { return ndims; } - int& elem (int i) + octave_idx_type& elem (int i) { assert (i >= 0 && i < ndims); return dims[i]; } - int elem (int i) const + octave_idx_type elem (int i) const { assert (i >= 0 && i < ndims); return dims[i]; @@ -150,13 +151,13 @@ explicit dim_vector (void) : rep (nil_rep ()) { rep->count++; } - explicit dim_vector (int n) + explicit dim_vector (octave_idx_type n) : rep (new dim_vector_rep (n)) { } - explicit dim_vector (int r, int c) + explicit dim_vector (octave_idx_type r, octave_idx_type c) : rep (new dim_vector_rep (r, c)) { } - explicit dim_vector (int r, int c, int p) + explicit dim_vector (octave_idx_type r, octave_idx_type c, octave_idx_type p) : rep (new dim_vector_rep (r, c, p)) { } dim_vector (const dim_vector& dv) @@ -184,13 +185,13 @@ int length (void) const { return rep->length (); } - int& elem (int i) { make_unique (); return rep->elem (i); } + octave_idx_type& elem (int i) { make_unique (); return rep->elem (i); } - int elem (int i) const { return rep->elem (i); } + octave_idx_type elem (int i) const { return rep->elem (i); } - int& operator () (int i) { return elem (i); } + octave_idx_type& operator () (int i) { return elem (i); } - int operator () (int i) const { return elem (i); } + octave_idx_type operator () (int i) const { return elem (i); } void resize (int n, int fill_value = 0) { @@ -282,11 +283,11 @@ // vector would have, NOT the number of dimensions (elements in the // dimension vector). - int numel (void) const + octave_idx_type numel (void) const { int n_dims = length (); - int retval = n_dims > 0 ? elem (0) : 0; + octave_idx_type retval = n_dims > 0 ? elem (0) : 0; for (int i = 1; i < n_dims; i++) retval *= elem (i); @@ -330,7 +331,7 @@ // The original dimension vector had a leading // singleton dimension. - int tmp = new_dims(0); + octave_idx_type tmp = new_dims(0); new_dims.resize (2); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/idx-vector.cc --- a/liboctave/idx-vector.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/idx-vector.cc Fri Apr 08 16:07:37 2005 +0000 @@ -49,16 +49,16 @@ { if (len > 0) { - data = new int [len]; - for (int i = 0; i < len; i++) + data = new octave_idx_type [len]; + for (octave_idx_type i = 0; i < len; i++) data[i] = a.data[i]; } } -int +octave_idx_type IDX_VEC_REP::tree_to_mat_idx (double x, bool& conversion_error) { - int retval = -1; + octave_idx_type retval = -1; conversion_error = false; @@ -70,7 +70,7 @@ conversion_error = true; } else - retval = static_cast (x - 1); + retval = static_cast (x - 1); return retval; } @@ -107,11 +107,11 @@ } else { - data = new int [len]; + data = new octave_idx_type [len]; bool conversion_error = false; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { double d = v.elem (i); @@ -142,12 +142,12 @@ } else { - int k = 0; - data = new int [len]; + octave_idx_type k = 0; + data = new octave_idx_type [len]; bool conversion_error = false; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { double d = nda.elem (i); @@ -185,11 +185,11 @@ double b = r.base (); double step = r.inc (); - data = new int [len]; + data = new octave_idx_type [len]; bool conversion_error = false; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { double val = b + i * step; @@ -216,7 +216,7 @@ return; else { - data = new int [len]; + data = new octave_idx_type [len]; bool conversion_error = false; @@ -229,14 +229,14 @@ init_state (); } -IDX_VEC_REP::idx_vector_rep (int i) +IDX_VEC_REP::idx_vector_rep (octave_idx_type i) : data (0), len (1), num_zeros (0), num_ones (0), max_val (0), min_val (0), count (1), frozen_at_z_len (0), frozen_len (0), colon (0), one_zero (0), initialized (0), frozen (0), colon_equiv_checked (0), colon_equiv (0), orig_dims (1, 1) { - data = new int [len]; + data = new octave_idx_type [len]; data[0] = tree_to_mat_idx (i); @@ -262,7 +262,7 @@ frozen (0), colon_equiv_checked (0), colon_equiv (0), orig_dims (1, 1) { - data = new int [len]; + data = new octave_idx_type [len]; data[0] = tree_to_mat_idx (b); @@ -283,10 +283,10 @@ } else { - int k = 0; - data = new int [len]; + octave_idx_type k = 0; + data = new octave_idx_type [len]; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) data[k++] = tree_to_mat_idx (bnda.elem (i)); } @@ -300,8 +300,8 @@ { delete [] data; len = a.len; - data = new int [len]; - for (int i = 0; i < len; i++) + data = new octave_idx_type [len]; + for (octave_idx_type i = 0; i < len; i++) data[i] = a.data[i]; num_zeros = a.num_zeros; @@ -337,7 +337,7 @@ { min_val = max_val = data[0]; - int i = 0; + octave_idx_type i = 0; do { if (data[i] == -1) @@ -358,7 +358,7 @@ } void -IDX_VEC_REP::maybe_convert_one_zero_to_idx (int z_len) +IDX_VEC_REP::maybe_convert_one_zero_to_idx (octave_idx_type z_len) { if (one_zero && (z_len == len || z_len == 0)) { @@ -374,9 +374,9 @@ { assert (num_ones + num_zeros == len); - int *new_data = new int [num_ones]; - int k = 0; - for (int i = 0; i < len; i++) + octave_idx_type *new_data = new octave_idx_type [num_ones]; + octave_idx_type k = 0; + for (octave_idx_type i = 0; i < len; i++) if (data[i] == 0) new_data[k++] = i; @@ -386,7 +386,7 @@ min_val = max_val = data[0]; - int i = 0; + octave_idx_type i = 0; do { if (data[i] > max_val) @@ -400,8 +400,8 @@ } } -int -IDX_VEC_REP::checkelem (int n) const +octave_idx_type +IDX_VEC_REP::checkelem (octave_idx_type n) const { if (n < 0 || n >= len) { @@ -415,23 +415,23 @@ static inline int intcmp (const void *ii, const void *jj) { - return (*(static_cast (ii)) - *(static_cast (jj))); + return (*(static_cast (ii)) - *(static_cast (jj))); } static inline void -sort_data (int *d, int l) +sort_data (octave_idx_type *d, octave_idx_type l) { - qsort (d, l, sizeof (int), intcmp); + qsort (d, l, sizeof (octave_idx_type), intcmp); } -static inline int -make_uniq (int *d, int l) +static inline octave_idx_type +make_uniq (octave_idx_type *d, octave_idx_type l) { if (l < 2) return l; - int k = 0; - for (int ii = 1; ii < l; ii++) + octave_idx_type k = 0; + for (octave_idx_type ii = 1; ii < l; ii++) { if (d[ii] != d[k]) { @@ -442,19 +442,19 @@ return k+1; } -static inline int * -copy_data (const int *d, int l) +static inline octave_idx_type * +copy_data (const octave_idx_type *d, octave_idx_type l) { - int *new_data = new int [l]; + octave_idx_type *new_data = new octave_idx_type [l]; - for (int ii = 0; ii < l; ii++) + for (octave_idx_type ii = 0; ii < l; ii++) new_data[ii] = d[ii]; return new_data; } int -IDX_VEC_REP::is_colon_equiv (int n, int sort_uniq) +IDX_VEC_REP::is_colon_equiv (octave_idx_type n, int sort_uniq) { if (! colon_equiv_checked) { @@ -462,7 +462,7 @@ { colon_equiv = 1; } - else if (len > 1) + else if (static_cast (len) > 1) { if (one_zero) { @@ -470,11 +470,11 @@ } else if (sort_uniq) { - int *tmp_data = copy_data (data, len); + octave_idx_type *tmp_data = copy_data (data, len); sort_data (tmp_data, len); - int tmp_len = make_uniq (tmp_data, len); + octave_idx_type tmp_len = make_uniq (tmp_data, len); colon_equiv = (tmp_len == n && tmp_data[0] == 0 @@ -488,7 +488,7 @@ { colon_equiv = 1; - for (int ii = 0; ii < n; ii++) + for (octave_idx_type ii = 0; ii < n; ii++) if (data[ii] != ii) { colon_equiv = 0; @@ -519,7 +519,7 @@ } void -IDX_VEC_REP::shorten (int n) +IDX_VEC_REP::shorten (octave_idx_type n) { if (n > 0 && n <= len) len = n; @@ -531,13 +531,13 @@ std::ostream& IDX_VEC_REP::print (std::ostream& os) const { - for (int ii = 0; ii < len; ii++) + for (octave_idx_type ii = 0; ii < len; ii++) os << data[ii] << "\n"; return os; } -int -IDX_VEC_REP::freeze (int z_len, const char *tag, bool resize_ok, +octave_idx_type +IDX_VEC_REP::freeze (octave_idx_type z_len, const char *tag, bool resize_ok, bool warn_resize) { if (frozen) diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/idx-vector.h --- a/liboctave/idx-vector.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/idx-vector.h Fri Apr 08 16:07:37 2005 +0000 @@ -69,11 +69,11 @@ } else { - data = new int [len]; + data = new octave_idx_type [len]; bool conversion_error = false; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) data[i] = tree_to_mat_idx (inda.elem (i), conversion_error); if (conversion_error) @@ -87,7 +87,7 @@ idx_vector_rep (double d); - idx_vector_rep (int i); + idx_vector_rep (octave_idx_type i); idx_vector_rep (char c); @@ -101,7 +101,7 @@ frozen (0), colon_equiv_checked (0), colon_equiv (0), orig_dims (1, 1) { - data = new int [len]; + data = new octave_idx_type [len]; data[0] = tree_to_mat_idx (i); @@ -118,51 +118,52 @@ int ok (void) { return initialized; } - int capacity (void) const { return len; } - int length (int colon_len) const { return colon ? colon_len : len; } + octave_idx_type capacity (void) const { return len; } + octave_idx_type length (octave_idx_type colon_len) const { return colon ? colon_len : len; } - int elem (int n) const { return colon ? n : data[n]; } + octave_idx_type elem (octave_idx_type n) const { return colon ? n : data[n]; } - int checkelem (int n) const; - int operator () (int n) const { return checkelem (n); } + octave_idx_type checkelem (octave_idx_type n) const; + octave_idx_type operator () (octave_idx_type n) const { return checkelem (n); } - int max (void) const { return max_val; } - int min (void) const { return min_val; } + octave_idx_type max (void) const { return max_val; } + octave_idx_type min (void) const { return min_val; } int one_zero_only (void) const { return one_zero; } - int zeros_count (void) const { return num_zeros; } - int ones_count (void) const { return num_ones; } + octave_idx_type zeros_count (void) const { return num_zeros; } + octave_idx_type ones_count (void) const { return num_ones; } int is_colon (void) const { return colon; } - int is_colon_equiv (int n, int sort_uniq); + int is_colon_equiv (octave_idx_type n, int sort_uniq); void sort (bool uniq); - int orig_rows (void) const { return orig_dims(0); } - int orig_columns (void) const { return orig_dims(1); } + octave_idx_type orig_rows (void) const { return orig_dims(0); } + octave_idx_type orig_columns (void) const { return orig_dims(1); } dim_vector orig_dimensions (void) const { return orig_dims; } // other stuff - void shorten (int n); // Unsafe. Avoid at all cost. + void shorten (octave_idx_type n); // Unsafe. Avoid at all cost. - int freeze (int z_len, const char *tag, bool resize_ok, bool warn_resize); + octave_idx_type freeze (octave_idx_type z_len, const char *tag, bool resize_ok, bool warn_resize); // i/o std::ostream& print (std::ostream& os) const; - int *data; - int len; - int num_zeros; - int num_ones; - int max_val; - int min_val; + octave_idx_type *data; + octave_idx_type len; + octave_idx_type num_zeros; + octave_idx_type num_ones; + octave_idx_type max_val; + octave_idx_type min_val; int count; - int frozen_at_z_len; - int frozen_len; + + octave_idx_type frozen_at_z_len; + octave_idx_type frozen_len; unsigned int colon : 1; unsigned int one_zero : 1; @@ -175,13 +176,13 @@ void init_state (void); - void maybe_convert_one_zero_to_idx (int z_len); + void maybe_convert_one_zero_to_idx (octave_idx_type z_len); - int tree_to_mat_idx (double x, bool& conversion_error); + octave_idx_type tree_to_mat_idx (double x, bool& conversion_error); - int tree_to_mat_idx (int i) { return i - 1; } + octave_idx_type tree_to_mat_idx (octave_idx_type i) { return i - 1; } - template int tree_to_mat_idx (const octave_int& i) + template octave_idx_type tree_to_mat_idx (const octave_int& i) { return i.value () - 1; } }; @@ -200,7 +201,7 @@ idx_vector (double d) : rep (new idx_vector_rep (d)) { } - idx_vector (int i) : rep (new idx_vector_rep (i)) { } + idx_vector (octave_idx_type i) : rep (new idx_vector_rep (i)) { } idx_vector (char c) : rep (new idx_vector_rep (c)) { } @@ -234,28 +235,28 @@ operator bool () const { return rep->ok (); } - int capacity (void) const { return rep->capacity (); } - int length (int cl) const { return rep->length (cl); } + octave_idx_type capacity (void) const { return rep->capacity (); } + octave_idx_type length (octave_idx_type cl) const { return rep->length (cl); } - int elem (int n) const { return rep->elem (n); } - int checkelem (int n) const { return rep->checkelem (n); } - int operator () (int n) const { return rep->operator () (n); } + octave_idx_type elem (octave_idx_type n) const { return rep->elem (n); } + octave_idx_type checkelem (octave_idx_type n) const { return rep->checkelem (n); } + octave_idx_type operator () (octave_idx_type n) const { return rep->operator () (n); } - int max (void) const { return rep->max (); } - int min (void) const { return rep->min (); } + octave_idx_type max (void) const { return rep->max (); } + octave_idx_type min (void) const { return rep->min (); } int one_zero_only (void) const { return rep->one_zero_only (); } - int zeros_count (void) const { return rep->zeros_count (); } - int ones_count (void) const { return rep->ones_count (); } + octave_idx_type zeros_count (void) const { return rep->zeros_count (); } + octave_idx_type ones_count (void) const { return rep->ones_count (); } int is_colon (void) const { return rep->is_colon (); } - int is_colon_equiv (int n, int sort_uniq = 0) const + int is_colon_equiv (octave_idx_type n, int sort_uniq = 0) const { return rep->is_colon_equiv (n, sort_uniq); } void sort (bool uniq = false) { rep->sort (uniq); } - int orig_rows (void) const { return rep->orig_rows (); } - int orig_columns (void) const { return rep->orig_columns (); } + octave_idx_type orig_rows (void) const { return rep->orig_rows (); } + octave_idx_type orig_columns (void) const { return rep->orig_columns (); } dim_vector orig_dimensions (void) const { return rep->orig_dimensions (); } @@ -263,11 +264,11 @@ { return (! is_colon () && orig_dimensions().any_zero ()); } // Unsafe. Avoid at all cost. - void shorten (int n) { rep->shorten (n); } + void shorten (octave_idx_type n) { rep->shorten (n); } // i/o - int freeze (int z_len, const char *tag, bool resize_ok = false, + octave_idx_type freeze (octave_idx_type z_len, const char *tag, bool resize_ok = false, bool warn_resize = false) { return rep->freeze (z_len, tag, resize_ok, warn_resize); } @@ -276,7 +277,7 @@ friend std::ostream& operator << (std::ostream& os, const idx_vector& a) { return a.print (os); } - void maybe_convert_one_zero_to_idx (int z_len) + void maybe_convert_one_zero_to_idx (octave_idx_type z_len) { rep->maybe_convert_one_zero_to_idx (z_len); } private: diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/intNDArray.cc --- a/liboctave/intNDArray.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/intNDArray.cc Fri Apr 08 16:07:37 2005 +0000 @@ -37,7 +37,7 @@ { boolNDArray b (this->dims ()); - for (int i = 0; i < this->length (); i++) + for (octave_idx_type i = 0; i < this->length (); i++) b.elem (i) = ! this->elem (i); return b; @@ -61,7 +61,7 @@ template void -intNDArray::increment_index (Array& ra_idx, +intNDArray::increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension) { @@ -69,8 +69,8 @@ } template -int -intNDArray::compute_index (Array& ra_idx, +octave_idx_type +intNDArray::compute_index (Array& ra_idx, const dim_vector& dimensions) { return ::compute_index (ra_idx, dimensions); @@ -78,7 +78,7 @@ template intNDArray -intNDArray::concat (const intNDArray& rb, const Array& ra_idx) +intNDArray::concat (const intNDArray& rb, const Array& ra_idx) { if (rb.numel () > 0); insert (rb, ra_idx); @@ -87,7 +87,7 @@ template intNDArray& -intNDArray::insert (const intNDArray& a, int r, int c) +intNDArray::insert (const intNDArray& a, octave_idx_type r, octave_idx_type c) { Array::insert (a, r, c); return *this; @@ -95,7 +95,7 @@ template intNDArray& -intNDArray::insert (const intNDArray& a, const Array& ra_idx) +intNDArray::insert (const intNDArray& a, const Array& ra_idx) { Array::insert (a, ra_idx); return *this; @@ -107,9 +107,9 @@ std::ostream& operator << (std::ostream& os, const intNDArray& a) { - int nel = a.nelem (); + octave_idx_type nel = a.nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) os << " " << a.elem (i) << "\n"; return os; @@ -119,7 +119,7 @@ std::istream& operator >> (std::istream& is, intNDArray& a) { - int nel = a.nelem (); + octave_idx_type nel = a.nelem (); if (nel < 1 ) is.clear (std::ios::badbit); @@ -127,7 +127,7 @@ { T tmp; - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { is >> tmp; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/intNDArray.h --- a/liboctave/intNDArray.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/intNDArray.h Fri Apr 08 16:07:37 2005 +0000 @@ -72,16 +72,16 @@ intNDArray transpose (void) const { return intNDArray (MArrayN::transpose ()); } - intNDArray concat (const intNDArray& rb, const Array& ra_idx); + intNDArray concat (const intNDArray& rb, const Array& ra_idx); - intNDArray& insert (const intNDArray& a, int r, int c); - intNDArray& insert (const intNDArray& a, const Array& ra_idx); + intNDArray& insert (const intNDArray& a, octave_idx_type r, octave_idx_type c); + intNDArray& insert (const intNDArray& a, const Array& ra_idx); - static void increment_index (Array& ra_idx, + static void increment_index (Array& ra_idx, const dim_vector& dimensions, int start_dimension = 0); - static int compute_index (Array& ra_idx, + static octave_idx_type compute_index (Array& ra_idx, const dim_vector& dimensions); static T resize_fill_value (void) { return 0; } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/lo-specfun.cc --- a/liboctave/lo-specfun.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/lo-specfun.cc Fri Apr 08 16:07:37 2005 +0000 @@ -45,36 +45,36 @@ { F77_RET_T F77_FUNC (zbesj, ZBESJ) (const double&, const double&, const double&, - const int&, const int&, double*, double*, - int&, int&); + const octave_idx_type&, const octave_idx_type&, double*, double*, + octave_idx_type&, octave_idx_type&); F77_RET_T F77_FUNC (zbesy, ZBESY) (const double&, const double&, const double&, - const int&, const int&, double*, double*, - int&, double*, double*, int&); + const octave_idx_type&, const octave_idx_type&, double*, double*, + octave_idx_type&, double*, double*, octave_idx_type&); F77_RET_T F77_FUNC (zbesi, ZBESI) (const double&, const double&, const double&, - const int&, const int&, double*, double*, - int&, int&); + const octave_idx_type&, const octave_idx_type&, double*, double*, + octave_idx_type&, octave_idx_type&); F77_RET_T F77_FUNC (zbesk, ZBESK) (const double&, const double&, const double&, - const int&, const int&, double*, double*, - int&, int&); + const octave_idx_type&, const octave_idx_type&, double*, double*, + octave_idx_type&, octave_idx_type&); F77_RET_T F77_FUNC (zbesh, ZBESH) (const double&, const double&, const double&, - const int&, const int&, const int&, double*, - double*, int&, int&); + const octave_idx_type&, const octave_idx_type&, const octave_idx_type&, double*, + double*, octave_idx_type&, octave_idx_type&); F77_RET_T - F77_FUNC (zairy, ZAIRY) (const double&, const double&, const int&, - const int&, double&, double&, int&, int&); + F77_FUNC (zairy, ZAIRY) (const double&, const double&, const octave_idx_type&, + const octave_idx_type&, double&, double&, octave_idx_type&, octave_idx_type&); F77_RET_T - F77_FUNC (zbiry, ZBIRY) (const double&, const double&, const int&, - const int&, double&, double&, int&); + F77_FUNC (zbiry, ZBIRY) (const double&, const double&, const octave_idx_type&, + const octave_idx_type&, double&, double&, octave_idx_type&); F77_RET_T F77_FUNC (xdacosh, XDACOSH) (const double&, double&); @@ -179,25 +179,25 @@ } static inline Complex -zbesj (const Complex& z, double alpha, int kode, int& ierr); +zbesj (const Complex& z, double alpha, int kode, octave_idx_type& ierr); static inline Complex -zbesy (const Complex& z, double alpha, int kode, int& ierr); +zbesy (const Complex& z, double alpha, int kode, octave_idx_type& ierr); static inline Complex -zbesi (const Complex& z, double alpha, int kode, int& ierr); +zbesi (const Complex& z, double alpha, int kode, octave_idx_type& ierr); static inline Complex -zbesk (const Complex& z, double alpha, int kode, int& ierr); +zbesk (const Complex& z, double alpha, int kode, octave_idx_type& ierr); static inline Complex -zbesh1 (const Complex& z, double alpha, int kode, int& ierr); +zbesh1 (const Complex& z, double alpha, int kode, octave_idx_type& ierr); static inline Complex -zbesh2 (const Complex& z, double alpha, int kode, int& ierr); +zbesh2 (const Complex& z, double alpha, int kode, octave_idx_type& ierr); static inline Complex -bessel_return_value (const Complex& val, int ierr) +bessel_return_value (const Complex& val, octave_idx_type ierr) { static const Complex inf_val = Complex (octave_Inf, octave_Inf); static const Complex nan_val = Complex (octave_NaN, octave_NaN); @@ -230,7 +230,7 @@ } static inline Complex -zbesj (const Complex& z, double alpha, int kode, int& ierr) +zbesj (const Complex& z, double alpha, int kode, octave_idx_type& ierr) { Complex retval; @@ -239,7 +239,7 @@ double yr = 0.0; double yi = 0.0; - int nz; + octave_idx_type nz; double zr = z.real (); double zi = z.imag (); @@ -287,7 +287,7 @@ } static inline Complex -zbesy (const Complex& z, double alpha, int kode, int& ierr) +zbesy (const Complex& z, double alpha, int kode, octave_idx_type& ierr) { Complex retval; @@ -296,7 +296,7 @@ double yr = 0.0; double yi = 0.0; - int nz; + octave_idx_type nz; double wr, wi; @@ -357,7 +357,7 @@ } static inline Complex -zbesi (const Complex& z, double alpha, int kode, int& ierr) +zbesi (const Complex& z, double alpha, int kode, octave_idx_type& ierr) { Complex retval; @@ -366,7 +366,7 @@ double yr = 0.0; double yi = 0.0; - int nz; + octave_idx_type nz; double zr = z.real (); double zi = z.imag (); @@ -407,7 +407,7 @@ } static inline Complex -zbesk (const Complex& z, double alpha, int kode, int& ierr) +zbesk (const Complex& z, double alpha, int kode, octave_idx_type& ierr) { Complex retval; @@ -416,7 +416,7 @@ double yr = 0.0; double yi = 0.0; - int nz; + octave_idx_type nz; double zr = z.real (); double zi = z.imag (); @@ -462,7 +462,7 @@ } static inline Complex -zbesh1 (const Complex& z, double alpha, int kode, int& ierr) +zbesh1 (const Complex& z, double alpha, int kode, octave_idx_type& ierr) { Complex retval; @@ -471,7 +471,7 @@ double yr = 0.0; double yi = 0.0; - int nz; + octave_idx_type nz; double zr = z.real (); double zi = z.imag (); @@ -508,7 +508,7 @@ } static inline Complex -zbesh2 (const Complex& z, double alpha, int kode, int& ierr) +zbesh2 (const Complex& z, double alpha, int kode, octave_idx_type& ierr) { Complex retval; @@ -517,7 +517,7 @@ double yr = 0.0; double yi = 0.0; - int nz; + octave_idx_type nz; double zr = z.real (); double zi = z.imag (); @@ -553,11 +553,11 @@ return retval; } -typedef Complex (*fptr) (const Complex&, double, int, int&); +typedef Complex (*fptr) (const Complex&, double, int, octave_idx_type&); static inline Complex do_bessel (fptr f, const char *, double alpha, const Complex& x, - bool scaled, int& ierr) + bool scaled, octave_idx_type& ierr) { Complex retval; @@ -568,17 +568,17 @@ static inline ComplexMatrix do_bessel (fptr f, const char *, double alpha, const ComplexMatrix& x, - bool scaled, Array2& ierr) + bool scaled, Array2& ierr) { - int nr = x.rows (); - int nc = x.cols (); + octave_idx_type nr = x.rows (); + octave_idx_type nc = x.cols (); ComplexMatrix retval (nr, nc); ierr.resize (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = f (x(i,j), alpha, (scaled ? 2 : 1), ierr(i,j)); return retval; @@ -586,17 +586,17 @@ static inline ComplexMatrix do_bessel (fptr f, const char *, const Matrix& alpha, const Complex& x, - bool scaled, Array2& ierr) + bool scaled, Array2& ierr) { - int nr = alpha.rows (); - int nc = alpha.cols (); + octave_idx_type nr = alpha.rows (); + octave_idx_type nc = alpha.cols (); ComplexMatrix retval (nr, nc); ierr.resize (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = f (x, alpha(i,j), (scaled ? 2 : 1), ierr(i,j)); return retval; @@ -604,27 +604,27 @@ static inline ComplexMatrix do_bessel (fptr f, const char *fn, const Matrix& alpha, - const ComplexMatrix& x, bool scaled, Array2& ierr) + const ComplexMatrix& x, bool scaled, Array2& ierr) { ComplexMatrix retval; - int x_nr = x.rows (); - int x_nc = x.cols (); + octave_idx_type x_nr = x.rows (); + octave_idx_type x_nc = x.cols (); - int alpha_nr = alpha.rows (); - int alpha_nc = alpha.cols (); + octave_idx_type alpha_nr = alpha.rows (); + octave_idx_type alpha_nc = alpha.cols (); if (x_nr == alpha_nr && x_nc == alpha_nc) { - int nr = x_nr; - int nc = x_nc; + octave_idx_type nr = x_nr; + octave_idx_type nc = x_nc; retval.resize (nr, nc); ierr.resize (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = f (x(i,j), alpha(i,j), (scaled ? 2 : 1), ierr(i,j)); } else @@ -636,15 +636,15 @@ static inline ComplexNDArray do_bessel (fptr f, const char *, double alpha, const ComplexNDArray& x, - bool scaled, ArrayN& ierr) + bool scaled, ArrayN& ierr) { dim_vector dv = x.dims (); - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); ComplexNDArray retval (dv); ierr.resize (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) retval(i) = f (x(i), alpha, (scaled ? 2 : 1), ierr(i)); return retval; @@ -652,15 +652,15 @@ static inline ComplexNDArray do_bessel (fptr f, const char *, const NDArray& alpha, const Complex& x, - bool scaled, ArrayN& ierr) + bool scaled, ArrayN& ierr) { dim_vector dv = alpha.dims (); - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); ComplexNDArray retval (dv); ierr.resize (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) retval(i) = f (x, alpha(i), (scaled ? 2 : 1), ierr(i)); return retval; @@ -668,19 +668,19 @@ static inline ComplexNDArray do_bessel (fptr f, const char *fn, const NDArray& alpha, - const ComplexNDArray& x, bool scaled, ArrayN& ierr) + const ComplexNDArray& x, bool scaled, ArrayN& ierr) { dim_vector dv = x.dims (); ComplexNDArray retval; if (dv == alpha.dims ()) { - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); retval.resize (dv); ierr.resize (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) retval(i) = f (x(i), alpha(i), (scaled ? 2 : 1), ierr(i)); } else @@ -692,17 +692,17 @@ static inline ComplexMatrix do_bessel (fptr f, const char *, const RowVector& alpha, - const ComplexColumnVector& x, bool scaled, Array2& ierr) + const ComplexColumnVector& x, bool scaled, Array2& ierr) { - int nr = x.length (); - int nc = alpha.length (); + octave_idx_type nr = x.length (); + octave_idx_type nc = alpha.length (); ComplexMatrix retval (nr, nc); ierr.resize (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = f (x(i), alpha(j), (scaled ? 2 : 1), ierr(i,j)); return retval; @@ -710,7 +710,7 @@ #define SS_BESSEL(name, fcn) \ Complex \ - name (double alpha, const Complex& x, bool scaled, int& ierr) \ + name (double alpha, const Complex& x, bool scaled, octave_idx_type& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -718,7 +718,7 @@ #define SM_BESSEL(name, fcn) \ ComplexMatrix \ name (double alpha, const ComplexMatrix& x, bool scaled, \ - Array2& ierr) \ + Array2& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -726,7 +726,7 @@ #define MS_BESSEL(name, fcn) \ ComplexMatrix \ name (const Matrix& alpha, const Complex& x, bool scaled, \ - Array2& ierr) \ + Array2& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -734,7 +734,7 @@ #define MM_BESSEL(name, fcn) \ ComplexMatrix \ name (const Matrix& alpha, const ComplexMatrix& x, bool scaled, \ - Array2& ierr) \ + Array2& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -742,7 +742,7 @@ #define SN_BESSEL(name, fcn) \ ComplexNDArray \ name (double alpha, const ComplexNDArray& x, bool scaled, \ - ArrayN& ierr) \ + ArrayN& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -750,7 +750,7 @@ #define NS_BESSEL(name, fcn) \ ComplexNDArray \ name (const NDArray& alpha, const Complex& x, bool scaled, \ - ArrayN& ierr) \ + ArrayN& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -758,7 +758,7 @@ #define NN_BESSEL(name, fcn) \ ComplexNDArray \ name (const NDArray& alpha, const ComplexNDArray& x, bool scaled, \ - ArrayN& ierr) \ + ArrayN& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -766,7 +766,7 @@ #define RC_BESSEL(name, fcn) \ ComplexMatrix \ name (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, \ - Array2& ierr) \ + Array2& ierr) \ { \ return do_bessel (fcn, #name, alpha, x, scaled, ierr); \ } @@ -789,17 +789,17 @@ ALL_BESSEL (besselh2, zbesh2) Complex -airy (const Complex& z, bool deriv, bool scaled, int& ierr) +airy (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr) { double ar = 0.0; double ai = 0.0; - int nz; + octave_idx_type nz; double zr = z.real (); double zi = z.imag (); - int id = deriv ? 1 : 0; + octave_idx_type id = deriv ? 1 : 0; F77_FUNC (zairy, ZAIRY) (zr, zi, id, 2, ar, ai, nz, ierr); @@ -823,7 +823,7 @@ } Complex -biry (const Complex& z, bool deriv, bool scaled, int& ierr) +biry (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr) { double ar = 0.0; double ai = 0.0; @@ -831,7 +831,7 @@ double zr = z.real (); double zi = z.imag (); - int id = deriv ? 1 : 0; + octave_idx_type id = deriv ? 1 : 0; F77_FUNC (zbiry, ZBIRY) (zr, zi, id, 2, ar, ai, ierr); @@ -855,72 +855,72 @@ } ComplexMatrix -airy (const ComplexMatrix& z, bool deriv, bool scaled, Array2& ierr) +airy (const ComplexMatrix& z, bool deriv, bool scaled, Array2& ierr) { - int nr = z.rows (); - int nc = z.cols (); + octave_idx_type nr = z.rows (); + octave_idx_type nc = z.cols (); ComplexMatrix retval (nr, nc); ierr.resize (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = airy (z(i,j), deriv, scaled, ierr(i,j)); return retval; } ComplexMatrix -biry (const ComplexMatrix& z, bool deriv, bool scaled, Array2& ierr) +biry (const ComplexMatrix& z, bool deriv, bool scaled, Array2& ierr) { - int nr = z.rows (); - int nc = z.cols (); + octave_idx_type nr = z.rows (); + octave_idx_type nc = z.cols (); ComplexMatrix retval (nr, nc); ierr.resize (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = biry (z(i,j), deriv, scaled, ierr(i,j)); return retval; } ComplexNDArray -airy (const ComplexNDArray& z, bool deriv, bool scaled, ArrayN& ierr) +airy (const ComplexNDArray& z, bool deriv, bool scaled, ArrayN& ierr) { dim_vector dv = z.dims (); - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); ComplexNDArray retval (dv); ierr.resize (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) retval (i) = airy (z(i), deriv, scaled, ierr(i)); return retval; } ComplexNDArray -biry (const ComplexNDArray& z, bool deriv, bool scaled, ArrayN& ierr) +biry (const ComplexNDArray& z, bool deriv, bool scaled, ArrayN& ierr) { dim_vector dv = z.dims (); - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); ComplexNDArray retval (dv); ierr.resize (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) retval (i) = biry (z(i), deriv, scaled, ierr(i)); return retval; } static void -gripe_betainc_nonconformant (int r1, int c1, int r2, int c2, int r3, - int c3) +gripe_betainc_nonconformant (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2, octave_idx_type r3, + octave_idx_type c3) { (*current_liboctave_error_handler) ("betainc: nonconformant arguments (x is %dx%d, a is %dx%d, b is %dx%d)", @@ -953,13 +953,13 @@ Matrix betainc (double x, double a, const Matrix& b) { - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); Matrix retval (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = betainc (x, a, b(i,j)); return retval; @@ -968,13 +968,13 @@ Matrix betainc (double x, const Matrix& a, double b) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); Matrix retval (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = betainc (x, a(i,j), b); return retval; @@ -985,18 +985,18 @@ { Matrix retval; - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (a_nr == b_nr && a_nc == b_nc) { retval.resize (a_nr, a_nc); - for (int j = 0; j < a_nc; j++) - for (int i = 0; i < a_nr; i++) + for (octave_idx_type j = 0; j < a_nc; j++) + for (octave_idx_type i = 0; i < a_nr; i++) retval(i,j) = betainc (x, a(i,j), b(i,j)); } else @@ -1058,13 +1058,13 @@ Matrix betainc (const Matrix& x, double a, double b) { - int nr = x.rows (); - int nc = x.cols (); + octave_idx_type nr = x.rows (); + octave_idx_type nc = x.cols (); Matrix retval (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = betainc (x(i,j), a, b); return retval; @@ -1075,18 +1075,18 @@ { Matrix retval; - int nr = x.rows (); - int nc = x.cols (); + octave_idx_type nr = x.rows (); + octave_idx_type nc = x.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (nr == b_nr && nc == b_nc) { retval.resize (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = betainc (x(i,j), a, b(i,j)); } else @@ -1100,18 +1100,18 @@ { Matrix retval; - int nr = x.rows (); - int nc = x.cols (); + octave_idx_type nr = x.rows (); + octave_idx_type nc = x.cols (); - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (nr == a_nr && nc == a_nc) { retval.resize (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = betainc (x(i,j), a(i,j), b); } else @@ -1125,21 +1125,21 @@ { Matrix retval; - int nr = x.rows (); - int nc = x.cols (); + octave_idx_type nr = x.rows (); + octave_idx_type nc = x.cols (); - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (nr == a_nr && nr == b_nr && nc == a_nc && nc == b_nc) { retval.resize (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval(i,j) = betainc (x(i,j), a(i,j), b(i,j)); } else @@ -1250,16 +1250,16 @@ Matrix gammainc (double x, const Matrix& a) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); Matrix result (nr, nc); Matrix retval; bool err; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { result(i,j) = gammainc (x, a(i,j), err); @@ -1277,16 +1277,16 @@ Matrix gammainc (const Matrix& x, double a) { - int nr = x.rows (); - int nc = x.cols (); + octave_idx_type nr = x.rows (); + octave_idx_type nc = x.cols (); Matrix result (nr, nc); Matrix retval; bool err; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { result(i,j) = gammainc (x(i,j), a, err); @@ -1307,11 +1307,11 @@ Matrix result; Matrix retval; - int nr = x.rows (); - int nc = x.cols (); + octave_idx_type nr = x.rows (); + octave_idx_type nc = x.cols (); - int a_nr = a.rows (); - int a_nc = a.cols (); + octave_idx_type a_nr = a.rows (); + octave_idx_type a_nc = a.cols (); if (nr == a_nr && nc == a_nc) { @@ -1319,8 +1319,8 @@ bool err; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { result(i,j) = gammainc (x(i,j), a(i,j), err); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/lo-specfun.h --- a/liboctave/lo-specfun.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/lo-specfun.h Fri Apr 08 16:07:37 2005 +0000 @@ -24,6 +24,7 @@ #define octave_liboctave_specfun_h 1 #include "oct-cmplx.h" +#include "oct-types.h" #include "ArrayN.h" template class Array2; @@ -59,205 +60,205 @@ extern double xlgamma (double x); extern Complex -besselj (double alpha, const Complex& x, bool scaled, int& ierr); +besselj (double alpha, const Complex& x, bool scaled, octave_idx_type& ierr); extern Complex -bessely (double alpha, const Complex& x, bool scaled, int& ierr); +bessely (double alpha, const Complex& x, bool scaled, octave_idx_type& ierr); extern Complex -besseli (double alpha, const Complex& x, bool scaled, int& ierr); +besseli (double alpha, const Complex& x, bool scaled, octave_idx_type& ierr); extern Complex -besselk (double alpha, const Complex& x, bool scaled, int& ierr); +besselk (double alpha, const Complex& x, bool scaled, octave_idx_type& ierr); extern Complex -besselh1 (double alpha, const Complex& x, bool scaled, int& ierr); +besselh1 (double alpha, const Complex& x, bool scaled, octave_idx_type& ierr); extern Complex -besselh2 (double alpha, const Complex& x, bool scaled, int& ierr); +besselh2 (double alpha, const Complex& x, bool scaled, octave_idx_type& ierr); extern ComplexMatrix besselj (double alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix bessely (double alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besseli (double alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselk (double alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselh1 (double alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselh2 (double alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselj (const Matrix& alpha, const Complex& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix bessely (const Matrix& alpha, const Complex& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besseli (const Matrix& alpha, const Complex& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselk (const Matrix& alpha, const Complex& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselh1 (const Matrix& alpha, const Complex& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselh2 (const Matrix& alpha, const Complex& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselj (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix bessely (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besseli (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselk (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselh1 (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselh2 (const Matrix& alpha, const ComplexMatrix& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexNDArray besselj (double alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray bessely (double alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besseli (double alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besselk (double alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besselh1 (double alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besselh2 (double alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besselj (const NDArray& alpha, const Complex& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray bessely (const NDArray& alpha, const Complex& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besseli (const NDArray& alpha, const Complex& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besselk (const NDArray& alpha, const Complex& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besselh1 (const NDArray& alpha, const Complex& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besselh2 (const NDArray& alpha, const Complex& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besselj (const NDArray& alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray bessely (const NDArray& alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besseli (const NDArray& alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besselk (const NDArray& alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besselh1 (const NDArray& alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexNDArray besselh2 (const NDArray& alpha, const ComplexNDArray& x, bool scaled, - ArrayN& ierr); + ArrayN& ierr); extern ComplexMatrix besselj (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix bessely (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besseli (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselk (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselh1 (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2& ierr); + Array2& ierr); extern ComplexMatrix besselh2 (const RowVector& alpha, const ComplexColumnVector& x, bool scaled, - Array2& ierr); + Array2& ierr); -extern Complex airy (const Complex& z, bool deriv, bool scaled, int& ierr); -extern Complex biry (const Complex& z, bool deriv, bool scaled, int& ierr); +extern Complex airy (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr); +extern Complex biry (const Complex& z, bool deriv, bool scaled, octave_idx_type& ierr); extern ComplexMatrix -airy (const ComplexMatrix& z, bool deriv, bool scaled, Array2& ierr); +airy (const ComplexMatrix& z, bool deriv, bool scaled, Array2& ierr); extern ComplexMatrix -biry (const ComplexMatrix& z, bool deriv, bool scaled, Array2& ierr); +biry (const ComplexMatrix& z, bool deriv, bool scaled, Array2& ierr); extern ComplexNDArray -airy (const ComplexNDArray& z, bool deriv, bool scaled, ArrayN& ierr); +airy (const ComplexNDArray& z, bool deriv, bool scaled, ArrayN& ierr); extern ComplexNDArray -biry (const ComplexNDArray& z, bool deriv, bool scaled, ArrayN& ierr); +biry (const ComplexNDArray& z, bool deriv, bool scaled, ArrayN& ierr); extern double betainc (double x, double a, double b); extern Matrix betainc (double x, double a, const Matrix& b); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/lo-utils.cc --- a/liboctave/lo-utils.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/lo-utils.cc Fri Apr 08 16:07:37 2005 +0000 @@ -46,6 +46,20 @@ // Convert X to the nearest integer value. Should not pass NaN to // this function. +// Sometimes you need a large integer, but not always. +// XXX FIXME-64 XXX -- INT_MAX and INT_MIN are probably not right here. + +octave_idx_type +NINTbig (double x) +{ + if (x > INT_MAX) + return INT_MAX; + else if (x < INT_MIN) + return INT_MIN; + else + return static_cast ((x > 0) ? (x + 0.5) : (x - 0.5)); +} + int NINT (double x) { diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/lo-utils.h --- a/liboctave/lo-utils.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/lo-utils.h Fri Apr 08 16:07:37 2005 +0000 @@ -29,7 +29,9 @@ #include #include "oct-cmplx.h" +#include "oct-types.h" +extern octave_idx_type NINTbig (double x); extern int NINT (double x); extern double D_NINT (double x); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/mach-info.cc --- a/liboctave/mach-info.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/mach-info.cc Fri Apr 08 16:07:37 2005 +0000 @@ -27,10 +27,11 @@ #include "f77-fcn.h" #include "lo-error.h" #include "mach-info.h" +#include "oct-types.h" extern "C" { - double F77_FUNC (d1mach, D1MACH) (const int&); + double F77_FUNC (d1mach, D1MACH) (const octave_idx_type&); } oct_mach_info *oct_mach_info::instance = 0; diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/mx-inlines.cc --- a/liboctave/mx-inlines.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/mx-inlines.cc Fri Apr 08 16:07:37 2005 +0000 @@ -231,8 +231,8 @@ #define MX_CUMULATIVE_OP(RET_TYPE, ELT_TYPE, OP) \ \ - int nr = rows (); \ - int nc = cols (); \ + octave_idx_type nr = rows (); \ + octave_idx_type nc = cols (); \ \ RET_TYPE retval (nr, nc); \ \ @@ -240,10 +240,10 @@ { \ if ((nr == 1 && dim == -1) || dim == 1) \ { \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ { \ ELT_TYPE t = elem (i, 0); \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ retval.elem (i, j) = t; \ if (j < nc - 1) \ @@ -253,10 +253,10 @@ } \ else \ { \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ ELT_TYPE t = elem (0, j); \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ { \ retval.elem (i, j) = t; \ if (i < nr - 1) \ @@ -271,8 +271,8 @@ #define MX_BASE_REDUCTION_OP(RET_TYPE, ROW_EXPR, COL_EXPR, INIT_VAL, \ MT_RESULT) \ \ - int nr = rows (); \ - int nc = cols (); \ + octave_idx_type nr = rows (); \ + octave_idx_type nc = cols (); \ \ RET_TYPE retval; \ \ @@ -281,10 +281,10 @@ if ((nr == 1 && dim == -1) || dim == 1) \ { \ retval.resize (nr, 1); \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ { \ retval.elem (i, 0) = INIT_VAL; \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ ROW_EXPR; \ } \ @@ -293,10 +293,10 @@ else \ { \ retval.resize (1, nc); \ - for (int j = 0; j < nc; j++) \ + for (octave_idx_type j = 0; j < nc; j++) \ { \ retval.elem (0, j) = INIT_VAL; \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type i = 0; i < nr; i++) \ { \ COL_EXPR; \ } \ @@ -439,7 +439,7 @@ } \ \ /* Length of Dimension */ \ - int dim_length = 1; \ + octave_idx_type dim_length = 1; \ \ /* dim = -1 means from here that the user specified a */ \ /* dimension which is larger that the number of dimensions */ \ @@ -454,20 +454,20 @@ dv(dim) = 1; \ \ /* This finds the number of elements in retval */ \ - int num_iter = (this->numel () / dim_length); \ + octave_idx_type num_iter = (this->numel () / dim_length); \ \ /* Make sure retval has correct dimensions */ \ retval.resize (dv, VAL); \ \ - Array iter_idx (dv.length (), 0); \ + Array iter_idx (dv.length (), 0); \ \ /* Filling in values. */ \ /* First loop finds new index */ \ \ - for (int j = 0; j < num_iter; j++) \ + for (octave_idx_type j = 0; j < num_iter; j++) \ { \ ACC_DECL;\ - for (int i = 0; i < dim_length; i++) \ + for (octave_idx_type i = 0; i < dim_length; i++) \ { \ if (dim > -1) \ iter_idx(dim) = i; \ @@ -567,23 +567,23 @@ retval.resize (dv, VAL); \ \ /* Length of Dimension */ \ - int dim_length = 1; \ + octave_idx_type dim_length = 1; \ \ dim_length = dv (dim); \ \ dv (dim) = 1; \ \ /* This finds the number of elements in retval */ \ - int num_iter = (this->numel () / dim_length); \ + octave_idx_type num_iter = (this->numel () / dim_length); \ \ - Array iter_idx (dv.length (), 0); \ + Array iter_idx (dv.length (), 0); \ \ /* Filling in values. */ \ /* First loop finds new index */ \ \ - for (int j = 0; j < num_iter; j++) \ + for (octave_idx_type j = 0; j < num_iter; j++) \ { \ - for (int i = 0; i < dim_length; i++) \ + for (octave_idx_type i = 0; i < dim_length; i++) \ { \ if (i > 0) \ { \ diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/oct-fftw.cc --- a/liboctave/oct-fftw.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/oct-fftw.cc Fri Apr 08 16:07:37 2005 +0000 @@ -57,11 +57,11 @@ octave_fftw_planner (void); fftw_plan create_plan (int dir, const int rank, const dim_vector dims, - int howmany, int stride, int dist, + octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, const Complex *in, Complex *out); fftw_plan create_plan (const int rank, const dim_vector dims, - int howmany, int stride, int dist, + octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, const double *in, Complex *out); private: @@ -74,16 +74,16 @@ fftw_plan plan[2]; // dist - int d[2]; + octave_idx_type d[2]; // stride - int s[2]; + octave_idx_type s[2]; // rank int r[2]; // howmany - int h[2]; + octave_idx_type h[2]; // dims dim_vector n[2]; @@ -95,16 +95,16 @@ fftw_plan rplan; // dist - int rd; + octave_idx_type rd; // stride - int rs; + octave_idx_type rs; // rank int rr; // howmany - int rh; + octave_idx_type rh; // dims dim_vector rn; @@ -136,8 +136,8 @@ fftw_plan octave_fftw_planner::create_plan (int dir, const int rank, - const dim_vector dims, int howmany, - int stride, int dist, + const dim_vector dims, octave_idx_type howmany, + octave_idx_type stride, octave_idx_type dist, const Complex *in, Complex *out) { int which = (dir == FFTW_FORWARD) ? 0 : 1; @@ -207,7 +207,7 @@ fftw_plan octave_fftw_planner::create_plan (const int rank, const dim_vector dims, - int howmany, int stride, int dist, + octave_idx_type howmany, octave_idx_type stride, octave_idx_type dist, const double *in, Complex *out) { fftw_plan *cur_plan_p = &rplan; @@ -274,7 +274,7 @@ static inline void convert_packcomplex_1d (Complex *out, size_t nr, size_t nc, - int stride, int dist) + octave_idx_type stride, octave_idx_type dist) { OCTAVE_QUIT; @@ -351,7 +351,7 @@ int octave_fftw::fft (const double *in, Complex *out, size_t npts, - size_t nsamples, int stride, int dist) + size_t nsamples, octave_idx_type stride, octave_idx_type dist) { dist = (dist < 0 ? npts : dist); @@ -371,7 +371,7 @@ int octave_fftw::fft (const Complex *in, Complex *out, size_t npts, - size_t nsamples, int stride, int dist) + size_t nsamples, octave_idx_type stride, octave_idx_type dist) { dist = (dist < 0 ? npts : dist); @@ -388,7 +388,7 @@ int octave_fftw::ifft (const Complex *in, Complex *out, size_t npts, - size_t nsamples, int stride, int dist) + size_t nsamples, octave_idx_type stride, octave_idx_type dist) { dist = (dist < 0 ? npts : dist); @@ -412,14 +412,14 @@ octave_fftw::fftNd (const double *in, Complex *out, const int rank, const dim_vector &dv) { - int dist = 1; + octave_idx_type dist = 1; for (int i = 0; i < rank; i++) dist *= dv(i); // Fool with the position of the start of the output matrix, so that // creating other half of the matrix won't cause cache problems. - int offset = (dv.numel () / dv(0)) * ((dv(0) - 1) / 2); + octave_idx_type offset = (dv.numel () / dv(0)) * ((dv(0) - 1) / 2); fftw_plan plan = fftw_planner.create_plan (rank, dv, 1, 1, dist, in, out + offset); @@ -438,7 +438,7 @@ octave_fftw::fftNd (const Complex *in, Complex *out, const int rank, const dim_vector &dv) { - int dist = 1; + octave_idx_type dist = 1; for (int i = 0; i < rank; i++) dist *= dv(i); @@ -456,7 +456,7 @@ octave_fftw::ifftNd (const Complex *in, Complex *out, const int rank, const dim_vector &dv) { - int dist = 1; + octave_idx_type dist = 1; for (int i = 0; i < rank; i++) dist *= dv(i); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/oct-fftw.h --- a/liboctave/oct-fftw.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/oct-fftw.h Fri Apr 08 16:07:37 2005 +0000 @@ -32,11 +32,11 @@ { public: static int fft (const double *in, Complex *out, size_t npts, - size_t nsamples = 1, int stride = 1, int dist = -1); + size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); static int fft (const Complex *in, Complex *out, size_t npts, - size_t nsamples = 1, int stride = 1, int dist = -1); + size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); static int ifft (const Complex *in, Complex *out, size_t npts, - size_t nsamples = 1, int stride = 1, int dist = -1); + size_t nsamples = 1, octave_idx_type stride = 1, octave_idx_type dist = -1); static int fftNd (const double*, Complex*, const int, const dim_vector &); static int fftNd (const Complex*, Complex*, const int, diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/oct-rand.cc --- a/liboctave/oct-rand.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/oct-rand.cc Fri Apr 08 16:07:37 2005 +0000 @@ -49,20 +49,20 @@ F77_FUNC (dgenunf, DGENUNF) (const double&, const double&, double&); F77_RET_T - F77_FUNC (setall, SETALL) (const int&, const int&); + F77_FUNC (setall, SETALL) (const octave_idx_type&, const octave_idx_type&); F77_RET_T - F77_FUNC (getsd, GETSD) (int&, int&); + F77_FUNC (getsd, GETSD) (octave_idx_type&, octave_idx_type&); F77_RET_T - F77_FUNC (setsd, SETSD) (const int&, const int&); + F77_FUNC (setsd, SETSD) (const octave_idx_type&, const octave_idx_type&); F77_RET_T - F77_FUNC (setcgn, SETCGN) (const int&); + F77_FUNC (setcgn, SETCGN) (const octave_idx_type&); } -static int -force_to_fit_range (int i, int lo, int hi) +static octave_idx_type +force_to_fit_range (octave_idx_type i, octave_idx_type lo, octave_idx_type hi) { assert (hi > lo && lo >= 0 && hi > lo); @@ -90,8 +90,8 @@ int minute = tm.min() + 1; int second = tm.sec() + 1; - int s0 = tm.mday() * hour * minute * second; - int s1 = hour * minute * second; + octave_idx_type s0 = tm.mday() * hour * minute * second; + octave_idx_type s1 = hour * minute * second; s0 = force_to_fit_range (s0, 1, 2147483563); s1 = force_to_fit_range (s1, 1, 2147483399); @@ -113,7 +113,7 @@ { maybe_initialize (); - union d2i { double d; int i[2]; }; + union d2i { double d; octave_idx_type i[2]; }; union d2i u; F77_FUNC (getsd, GETSD) (u.i[0], u.i[1]); return u.d; @@ -124,7 +124,7 @@ { maybe_initialize (); - union d2i { double d; int i[2]; }; + union d2i { double d; octave_idx_type i[2]; }; union d2i u; u.d = s; int i0 = force_to_fit_range (u.i[0], 1, 2147483563); @@ -208,8 +208,8 @@ do \ { \ double val; \ - for (volatile int j = 0; j < nc; j++) \ - for (volatile int i = 0; i < nr; i++) \ + for (volatile octave_idx_type j = 0; j < nc; j++) \ + for (volatile octave_idx_type i = 0; i < nr; i++) \ { \ OCTAVE_QUIT; \ F77_FUNC (f, F) (0.0, 1.0, val); \ @@ -219,7 +219,7 @@ while (0) Matrix -octave_rand::matrix (int n, int m) +octave_rand::matrix (octave_idx_type n, octave_idx_type m) { maybe_initialize (); @@ -257,7 +257,7 @@ do \ { \ double val; \ - for (volatile int i = 0; i < len; i++) \ + for (volatile octave_idx_type i = 0; i < len; i++) \ { \ OCTAVE_QUIT; \ F77_FUNC (f, F) (0.0, 1.0, val); \ @@ -277,7 +277,7 @@ { retval.resize (dims); - int len = retval.length (); + octave_idx_type len = retval.length (); switch (current_distribution) { @@ -302,7 +302,7 @@ do \ { \ double val; \ - for (volatile int i = 0; i < n; i++) \ + for (volatile octave_idx_type i = 0; i < n; i++) \ { \ OCTAVE_QUIT; \ F77_FUNC (f, F) (0.0, 1.0, val); \ @@ -312,7 +312,7 @@ while (0) Array -octave_rand::vector (int n) +octave_rand::vector (octave_idx_type n) { maybe_initialize (); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/oct-rand.h --- a/liboctave/oct-rand.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/oct-rand.h Fri Apr 08 16:07:37 2005 +0000 @@ -53,14 +53,14 @@ // Return a matrix of numbers from the sequence, filled in column // major order. - static Matrix matrix (int r, int c); + static Matrix matrix (octave_idx_type r, octave_idx_type c); // Return an N-dimensional array of numbers from the sequence, // filled in column major order. static NDArray nd_array (const dim_vector& dims); // Return an array of numbers from the sequence. - static Array vector (int n); + static Array vector (octave_idx_type n); }; #endif diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/oct-types.h.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/oct-types.h.in Fri Apr 08 16:07:37 2005 +0000 @@ -0,0 +1,34 @@ +/* + +Copyright (C) 2005 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#if !defined (octave_oct_types_h) +#define octave_oct_types_h 1 + +typedef @OCTAVE_IDX_TYPE@ octave_idx_type; + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/ diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/so-array.cc --- a/liboctave/so-array.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/so-array.cc Fri Apr 08 16:07:37 2005 +0000 @@ -68,10 +68,10 @@ streamoff_array& operator += (streamoff_array& a, const streamoff_array& b) { - int l = a.length (); + octave_idx_type l = a.length (); if (l > 0) { - int bl = b.length (); + octave_idx_type bl = b.length (); if (l != bl) gripe_nonconformant ("operator +=", l, bl); else @@ -83,10 +83,10 @@ streamoff_array& operator -= (streamoff_array& a, const streamoff_array& b) { - int l = a.length (); + octave_idx_type l = a.length (); if (l > 0) { - int bl = b.length (); + octave_idx_type bl = b.length (); if (l != bl) gripe_nonconformant ("operator -=", l, bl); else @@ -95,7 +95,7 @@ return a; } -int +octave_idx_type streamoff_array::compute_index (Array& ra_idx, const dim_vector& dimensions) { diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/so-array.h --- a/liboctave/so-array.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/so-array.h Fri Apr 08 16:07:37 2005 +0000 @@ -64,7 +64,7 @@ boolNDArray all (int dim = -1) const; boolNDArray any (int dim = -1) const; - static int compute_index (Array& ra_idx, + static octave_idx_type compute_index (Array& ra_idx, const dim_vector& dimensions); static std::streamoff resize_fill_value (void) { return 0; } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/sparse-base-lu.cc --- a/liboctave/sparse-base-lu.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/sparse-base-lu.cc Fri Apr 08 16:07:37 2005 +0000 @@ -29,11 +29,11 @@ p_type sparse_base_lu :: Pr (void) const { - int nr = Lfact.rows (); + octave_idx_type nr = Lfact.rows (); p_type Pout (nr, nr, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { Pout.cidx (i) = i; Pout.ridx (P (i)) = i; @@ -48,11 +48,11 @@ p_type sparse_base_lu :: Pc (void) const { - int nc = Ufact.cols (); + octave_idx_type nc = Ufact.cols (); p_type Pout (nc, nc, nc); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { Pout.cidx (i) = i; Pout.ridx (i) = Q (i); diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/str-vec.cc --- a/liboctave/str-vec.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/str-vec.cc Fri Apr 08 16:07:37 2005 +0000 @@ -44,7 +44,7 @@ string_vector::string_vector (const char * const *s) : Array () { - int n = 0; + octave_idx_type n = 0; const char * const *t = s; @@ -53,17 +53,17 @@ resize (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) elem (i) = s[i]; } // Create a string vector from up to N C strings. Assumes that N is // nonnegative. -string_vector::string_vector (const char * const *s, int n) +string_vector::string_vector (const char * const *s, octave_idx_type n) : Array (n) { - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) elem (i) = s[i]; } @@ -79,13 +79,13 @@ string_vector& string_vector::uniq (void) { - int len = length (); + octave_idx_type len = length (); if (len > 0) { - int k = 0; + octave_idx_type k = 0; - for (int i = 1; i < len; i++) + for (octave_idx_type i = 1; i < len; i++) if (elem(i) != elem(k)) if (++k != i) elem(k) = elem(i); @@ -100,7 +100,7 @@ string_vector& string_vector::append (const std::string& s) { - int len = length (); + octave_idx_type len = length (); resize (len + 1); @@ -112,13 +112,13 @@ string_vector& string_vector::append (const string_vector& sv) { - int len = length (); - int sv_len = sv.length (); - int new_len = len + sv_len; + octave_idx_type len = length (); + octave_idx_type sv_len = sv.length (); + octave_idx_type new_len = len + sv_len; resize (new_len); - for (int i = 0; i < sv_len; i++) + for (octave_idx_type i = 0; i < sv_len; i++) elem(len + i) = sv[i]; return *this; @@ -127,13 +127,13 @@ char ** string_vector::c_str_vec (void) const { - int len = length (); + octave_idx_type len = length (); char **retval = new char * [len + 1]; retval [len] = 0; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) retval[i] = strsave (elem(i).c_str ()); return retval; @@ -155,12 +155,12 @@ { // Compute the maximum name length. - int max_name_length = 0; - int total_names = length (); + octave_idx_type max_name_length = 0; + octave_idx_type total_names = length (); - for (int i = 0; i < total_names; i++) + for (octave_idx_type i = 0; i < total_names; i++) { - int name_length = elem (i).length (); + octave_idx_type name_length = elem (i).length (); if (name_length > max_name_length) max_name_length = name_length; } @@ -171,25 +171,25 @@ // Calculate the maximum number of columns that will fit. - int line_length = command_editor::terminal_cols (); - int nc = line_length / max_name_length; + octave_idx_type line_length = command_editor::terminal_cols (); + octave_idx_type nc = line_length / max_name_length; if (nc == 0) nc = 1; // Calculate the number of rows that will be in each column except // possibly for a short column on the right. - int nr = total_names / nc + (total_names % nc != 0); + octave_idx_type nr = total_names / nc + (total_names % nc != 0); // Recalculate columns based on rows. nc = total_names / nr + (total_names % nr != 0); - int count; - for (int row = 0; row < nr; row++) + octave_idx_type count; + for (octave_idx_type row = 0; row < nr; row++) { count = row; - int pos = 0; + octave_idx_type pos = 0; // Print the next row. @@ -198,14 +198,14 @@ std::string nm = elem (count); os << nm; - int name_length = nm.length (); + octave_idx_type name_length = nm.length (); count += nr; if (count >= total_names) break; - int spaces_to_pad = max_name_length - name_length; - for (int i = 0; i < spaces_to_pad; i++) + octave_idx_type spaces_to_pad = max_name_length - name_length; + for (octave_idx_type i = 0; i < spaces_to_pad; i++) os << " "; pos += max_name_length; } diff -r eae7b40388e9 -r 23b37da9fd5b liboctave/str-vec.h --- a/liboctave/str-vec.h Thu Apr 07 21:51:37 2005 +0000 +++ b/liboctave/str-vec.h Fri Apr 08 16:07:37 2005 +0000 @@ -35,7 +35,7 @@ string_vector (void) : Array () { } - explicit string_vector (int n) : Array (n) { } + explicit string_vector (octave_idx_type n) : Array (n) { } string_vector (const char *s) : Array (1, s) { } @@ -45,7 +45,7 @@ string_vector (const char * const *s); - string_vector (const char * const *s, int n); + string_vector (const char * const *s, octave_idx_type n); string_vector& operator = (const string_vector& s) { @@ -59,14 +59,14 @@ int empty (void) const { return length () == 0; } - int max_length (void) const + octave_idx_type max_length (void) const { - int n = length (); - int longest = 0; + octave_idx_type n = length (); + octave_idx_type longest = 0; - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { - int tmp = elem(i).length (); + octave_idx_type tmp = elem(i).length (); if (tmp > longest) longest = tmp; @@ -75,9 +75,9 @@ return longest; } - std::string& operator[] (int i) { return Array::elem (i); } + std::string& operator[] (octave_idx_type i) { return Array::elem (i); } - std::string operator[] (int i) const { return Array::elem (i); } + std::string operator[] (octave_idx_type i) const { return Array::elem (i); } static int compare (const void *a_arg, const void *b_arg); diff -r eae7b40388e9 -r 23b37da9fd5b mk-opts.pl --- a/mk-opts.pl Thu Apr 07 21:51:37 2005 +0000 +++ b/mk-opts.pl Fri Apr 08 16:07:37 2005 +0000 @@ -619,7 +619,7 @@ print " double val = $static_object_name.$opt[$i] ();\n\n"; print " os << val << \"\\n\";\n"; } - elsif ($type[$i] eq "int") + elsif ($type[$i] eq "int" || $type[$i] eq "octave_idx_type") { print " int val = $static_object_name.$opt[$i] ();\n\n"; print " os << val << \"\\n\";\n"; @@ -628,9 +628,17 @@ { print " os << $static_object_name.$opt[$i] () << \"\\n\";\n"; } - elsif ($type[$i] eq "Array") + elsif ($type[$i] eq "Array" || $type[$i] eq "Array") { - print " Array val = $static_object_name.$opt[$i] ();\n\n"; + if ($type[$i] eq "Array") + { + $elt_type = "int"; + } + else + { + $elt_type = "octave_idx_type"; + } + print " Array<$elt_type> val = $static_object_name.$opt[$i] ();\n\n"; print " if (val.length () == 1) { os << val(0) << \"\\n\"; @@ -638,9 +646,9 @@ else { os << \"\\n\\n\"; - int len = val.length (); + octave_idx_type len = val.length (); Matrix tmp (len, 1); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) tmp(i,0) = val(i); octave_print_internal (os, tmp, false, 2); os << \"\\n\\n\"; @@ -695,7 +703,7 @@ print " if (! error_state) $static_object_name.set_$opt[$i] (tmp);\n"; } - elsif ($type[$i] eq "int") + elsif ($type[$i] eq "int" || $type[$i] eq "octave_idx_type") { print " int tmp = val.int_value ();\n\n"; print " if (! error_state) @@ -707,7 +715,7 @@ print " if (! error_state) $static_object_name.set_$opt[$i] (tmp);\n"; } - elsif ($type[$i] eq "Array") + elsif ($type[$i] eq "Array" || $type[$i] eq "Array") { print " Array tmp = val.int_vector_value ();\n\n"; print " if (! error_state) @@ -760,7 +768,7 @@ print " double val = $static_object_name.$opt[$i] ();\n\n"; print " retval = val;\n"; } - elsif ($type[$i] eq "int") + elsif ($type[$i] eq "int" || $type[$i] eq "octave_idx_type") { print " int val = $static_object_name.$opt[$i] ();\n\n"; print " retval = static_cast (val);\n"; @@ -769,18 +777,26 @@ { print " retval = $static_object_name.$opt[$i] ();\n"; } - elsif ($type[$i] eq "Array") + elsif ($type[$i] eq "Array" || $type[$i] eq "Array") { - print " Array val = $static_object_name.$opt[$i] ();\n\n"; + if ($type[$i] eq "Array") + { + $elt_type = "int"; + } + else + { + $elt_type = "octave_idx_type"; + } + print " Array<$elt_type> val = $static_object_name.$opt[$i] ();\n\n"; print " if (val.length () == 1) { retval = static_cast (val(0)); } else { - int len = val.length (); + octave_idx_type len = val.length (); ColumnVector tmp (len); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) tmp(i) = val(i); retval = tmp; }\n"; diff -r eae7b40388e9 -r 23b37da9fd5b src/Cell.cc --- a/src/Cell.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/Cell.cc Fri Apr 08 16:07:37 2005 +0000 @@ -32,13 +32,13 @@ Cell::Cell (const string_vector& sv) : ArrayN () { - int n = sv.length (); + octave_idx_type n = sv.length (); if (n > 0) { resize (dim_vector (n, 1)); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) elem(i,0) = sv[i]; } } @@ -48,7 +48,7 @@ { Cell retval; - int n = idx_arg.length (); + octave_idx_type n = idx_arg.length (); switch (n) { @@ -79,7 +79,7 @@ { Array iv (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { iv(i) = idx_arg(i).index_vector (); @@ -101,7 +101,7 @@ const octave_value& fill_val) { - for (int i = 0; i < idx_arg.length (); i++) + for (octave_idx_type i = 0; i < idx_arg.length (); i++) set_index (idx_arg(i).index_vector ()); ::assign (*this, rhs, fill_val); @@ -110,20 +110,20 @@ } Cell -Cell::concat (const Cell& rb, const Array& ra_idx) +Cell::concat (const Cell& rb, const Array& ra_idx) { return insert (rb, ra_idx); } Cell& -Cell::insert (const Cell& a, int r, int c) +Cell::insert (const Cell& a, octave_idx_type r, octave_idx_type c) { Array::insert (a, r, c); return *this; } Cell& -Cell::insert (const Cell& a, const Array& ra_idx) +Cell::insert (const Cell& a, const Array& ra_idx) { Array::insert (a, ra_idx); return *this; diff -r eae7b40388e9 -r 23b37da9fd5b src/Cell.h --- a/src/Cell.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/Cell.h Fri Apr 08 16:07:37 2005 +0000 @@ -45,11 +45,11 @@ Cell (const octave_value_list& ovl) : ArrayN (dim_vector (ovl.length (), 1)) { - for (int i = 0; i < ovl.length (); i++) + for (octave_idx_type i = 0; i < ovl.length (); i++) elem (i) = ovl (i); } - Cell (int n, int m, const octave_value& val = resize_fill_value ()) + Cell (octave_idx_type n, octave_idx_type m, const octave_value& val = resize_fill_value ()) : ArrayN (dim_vector (n, m), val) { } Cell (const dim_vector& dv, const octave_value& val = resize_fill_value ()) @@ -61,7 +61,7 @@ Cell (const Array& c) : ArrayN (c) { } - Cell (const Array& c, int nr, int nc) + Cell (const Array& c, octave_idx_type nr, octave_idx_type nc) : ArrayN (c, dim_vector (nr, nc)) { } Cell (const string_vector& sv); @@ -95,10 +95,10 @@ // XXX FIXME XXX boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); } - Cell concat (const Cell& rb, const Array& ra_idx); + Cell concat (const Cell& rb, const Array& ra_idx); - Cell& insert (const Cell& a, int r, int c); - Cell& insert (const Cell& a, const Array& ra_idx); + Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c); + Cell& insert (const Cell& a, const Array& ra_idx); // XXX FIXME XXX bool is_true (void) const { return false; } diff -r eae7b40388e9 -r 23b37da9fd5b src/ChangeLog --- a/src/ChangeLog Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ChangeLog Fri Apr 08 16:07:37 2005 +0000 @@ -1,3 +1,65 @@ +2005-04-08 John W. Eaton + + * Initial merge of 64-bit changes from Clinton Chee: + + 2005-04-07 John W. Eaton + + * ls-oct-ascii.h, ls-oct-ascii.cc (extract_keyword): Now template + functions defined in the header file. + + * ls-mat5.cc, ov-base-sparse.h, ov-base.h, ov-bool-sparse.cc + ov-cx-sparse.cc, ov-re-sparse.cc, ov.cc, pt-loop.cc, + sparse-xdiv.cc, sparse-xpow.cc, DLD-FUNCTIONS/sparse.cc, + DLD-FUNCTIONS/spdet.cc: + Use octave_idx_type instead of int where needed. + + 2005-03-31 Clinton Chee + + * Cell.cc, Cell.h, data.cc, defaults.cc, dirfns.cc, file-io.cc, + gripes.cc, gripes.h, ls-mat-ascii.cc, ls-mat4.cc, ls-oct-ascii.cc, + oct-map.cc, oct-map.h, oct-obj.cc, oct-obj.h, oct-stream.cc, + oct-stream.h, octave.cc, ops.h, ov-base-mat.cc, ov-base.h, + ov-bool-mat.cc, ov-cell.cc, ov-cs-list.cc, ov-cx-mat.cc, + ov-intx.h, ov-list.cc, ov-mapper.cc, ov-range.cc, ov-range.h, + ov-re-mat.cc, ov-scalar.h, ov-str-mat.cc, ov-struct.cc, ov.cc, + ov.h, pr-output.cc, pt-arg-list.cc, pt-cell.cc, pt-loop.cc, + pt-mat.cc, pt-select.cc, symtab.h, utils.cc, utils.h, xdiv.cc, + xpow.cc: + Use octave_idx_type instead of int where needed. + + 2005-04-01 John W. Eaton + + * toplev.cc (octave_config_info): Add USE_64_BIT_IDX_T to the list. + * oct-conf.h.in (OCTAVE_CONF_USE_64_BIT_IDX_T): Substitute here. + + 2005-03-31 John W. Eaton + + * DLD-FUNCTIONS/sort.cc: Don't use unsigned int for index into + dim_vector, or cast dim to unsigned int. + (Fsort): No need to cast arg before asking for dims. + + * DLD-FUNCTIONS/gcd.cc (Fgcd): Use OCTAVE_LOCAL_BUFFER to allocate + local array of NDArray objects. + + 2005-03-31 Clinton Chee + + * DLD-FUNCTIONS/balance.cc, DLD-FUNCTIONS/besselj.cc, + DLD-FUNCTIONS/chol.cc, DLD-FUNCTIONS/colloc.cc, + DLD-FUNCTIONS/daspk.cc, DLD-FUNCTIONS/dasrt.cc, + DLD-FUNCTIONS/dassl.cc, DLD-FUNCTIONS/det.cc, + DLD-FUNCTIONS/eig.cc, DLD-FUNCTIONS/expm.cc, DLD-FUNCTIONS/fft.cc, + DLD-FUNCTIONS/fft2.cc, DLD-FUNCTIONS/fftn.cc, + DLD-FUNCTIONS/fftw_wisdom.cc, DLD-FUNCTIONS/filter.cc, + DLD-FUNCTIONS/find.cc, DLD-FUNCTIONS/fsolve.cc, + DLD-FUNCTIONS/gcd.cc, DLD-FUNCTIONS/hess.cc, DLD-FUNCTIONS/inv.cc, + DLD-FUNCTIONS/kron.cc, DLD-FUNCTIONS/lu.cc, + DLD-FUNCTIONS/minmax.cc, DLD-FUNCTIONS/quad.cc, + DLD-FUNCTIONS/qz.cc, DLD-FUNCTIONS/rand.cc, + DLD-FUNCTIONS/schur.cc, DLD-FUNCTIONS/sort.cc, + DLD-FUNCTIONS/sqrtm.cc, DLD-FUNCTIONS/svd.cc, + DLD-FUNCTIONS/syl.cc: + Use octave_idx_type instead of int where needed. + 2005-04-06 David Bateman * Makefile.in: Link to UMFPACK_LIBS. Add zfstream.{cc,h} to build and diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/balance.cc --- a/src/DLD-FUNCTIONS/balance.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/balance.cc Fri Apr 08 16:07:37 2005 +0000 @@ -44,29 +44,29 @@ extern "C" { F77_RET_T - F77_FUNC (dggbal, DGGBAL) (F77_CONST_CHAR_ARG_DECL, const int& N, - double* A, const int& LDA, double* B, - const int& LDB, int& ILO, int& IHI, + F77_FUNC (dggbal, DGGBAL) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type& N, + double* A, const octave_idx_type& LDA, double* B, + const octave_idx_type& LDB, octave_idx_type& ILO, octave_idx_type& IHI, double* LSCALE, double* RSCALE, - double* WORK, int& INFO + double* WORK, octave_idx_type& INFO F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (dggbak, DGGBAK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int& N, const int& ILO, - const int& IHI, const double* LSCALE, - const double* RSCALE, int& M, double* V, - const int& LDV, int& INFO + const octave_idx_type& N, const octave_idx_type& ILO, + const octave_idx_type& IHI, const double* LSCALE, + const double* RSCALE, octave_idx_type& M, double* V, + const octave_idx_type& LDV, octave_idx_type& INFO F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (zggbal, ZGGBAL) (F77_CONST_CHAR_ARG_DECL, const int& N, - Complex* A, const int& LDA, Complex* B, - const int& LDB, int& ILO, int& IHI, + F77_FUNC (zggbal, ZGGBAL) (F77_CONST_CHAR_ARG_DECL, const octave_idx_type& N, + Complex* A, const octave_idx_type& LDA, Complex* B, + const octave_idx_type& LDB, octave_idx_type& ILO, octave_idx_type& IHI, double* LSCALE, double* RSCALE, - double* WORK, int& INFO + double* WORK, octave_idx_type& INFO F77_CHAR_ARG_LEN_DECL); } @@ -128,9 +128,9 @@ std::string bal_job; // problem dimension - int nn = args(0).rows (); + octave_idx_type nn = args(0).rows (); - int arg_is_empty = empty_arg ("balance", nn, args(0).columns()); + octave_idx_type arg_is_empty = empty_arg ("balance", nn, args(0).columns()); if (arg_is_empty < 0) return retval; @@ -230,11 +230,11 @@ // Both matrices loaded, now let's check what kind of arithmetic: // first, declare variables used in both the real and complex case - int ilo, ihi, info; + octave_idx_type ilo, ihi, info; RowVector lscale(nn), rscale(nn), work(6*nn); char job = bal_job[0]; - static int complex_case + static octave_idx_type complex_case = (args(0).is_complex_type () || args(1).is_complex_type ()); // now balance @@ -282,8 +282,8 @@ Matrix Pl(nn,nn), Pr(nn,nn); - for (int ii = 0; ii < nn; ii++) - for (int jj = 0; jj < nn; jj++) + for (octave_idx_type ii = 0; ii < nn; ii++) + for (octave_idx_type jj = 0; jj < nn; jj++) { OCTAVE_QUIT; diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/besselj.cc --- a/src/DLD-FUNCTIONS/besselj.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/besselj.cc Fri Apr 08 16:07:37 2005 +0000 @@ -79,15 +79,15 @@ while (0) static inline Matrix -int_array2_to_matrix (const Array2& a) +int_array2_to_matrix (const Array2& a) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); Matrix retval (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; @@ -148,7 +148,7 @@ if (! error_state) { - int ierr; + octave_idx_type ierr; octave_value result; DO_BESSEL (type, alpha, x, scaled, ierr, result); @@ -167,7 +167,7 @@ if (! error_state) { - ArrayN ierr; + ArrayN ierr; octave_value result; DO_BESSEL (type, alpha, x, scaled, ierr, result); @@ -203,7 +203,7 @@ if (! error_state) { - Array2 ierr; + Array2 ierr; octave_value result; DO_BESSEL (type, ralpha, cx, scaled, ierr, result); @@ -231,7 +231,7 @@ if (! error_state) { - ArrayN ierr; + ArrayN ierr; octave_value result; DO_BESSEL (type, alpha, x, scaled, ierr, result); @@ -250,7 +250,7 @@ if (! error_state) { - ArrayN ierr; + ArrayN ierr; octave_value result; DO_BESSEL (type, alpha, x, scaled, ierr, result); @@ -379,7 +379,7 @@ } else if (nargin == 3 || nargin == 4) { - int kind = args(1).int_value (); + octave_idx_type kind = args(1).int_value (); if (! error_state) { @@ -481,7 +481,7 @@ if (! error_state) { - ArrayN ierr; + ArrayN ierr; octave_value result; if (kind > 1) diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/chol.cc --- a/src/DLD-FUNCTIONS/chol.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/chol.cc Fri Apr 08 16:07:37 2005 +0000 @@ -64,8 +64,8 @@ octave_value arg = args(0); - int nr = arg.rows (); - int nc = arg.columns (); + octave_idx_type nr = arg.rows (); + octave_idx_type nc = arg.columns (); int arg_is_empty = empty_arg ("chol", nr, nc); @@ -80,7 +80,7 @@ if (! error_state) { - int info; + octave_idx_type info; CHOL fact (m, info); if (nargout == 2 || info == 0) { @@ -97,7 +97,7 @@ if (! error_state) { - int info; + octave_idx_type info; ComplexCHOL fact (m, info); if (nargout == 2 || info == 0) { diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/colloc.cc --- a/src/DLD-FUNCTIONS/colloc.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/colloc.cc Fri Apr 08 16:07:37 2005 +0000 @@ -70,16 +70,16 @@ return retval; } - int ncol = NINT (tmp); + octave_idx_type ncol = NINTbig (tmp); if (ncol < 0) { error ("colloc: first argument must be non-negative"); return retval; } - int ntot = ncol; - int left = 0; - int right = 0; + octave_idx_type ntot = ncol; + octave_idx_type left = 0; + octave_idx_type right = 0; for (int i = 1; i < nargin; i++) { diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/daspk.cc --- a/src/DLD-FUNCTIONS/daspk.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/daspk.cc Fri Apr 08 16:07:37 2005 +0000 @@ -58,7 +58,7 @@ ColumnVector daspk_user_function (const ColumnVector& x, const ColumnVector& xdot, - double t, int& ires) + double t, octave_idx_type& ires) { ColumnVector retval; diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/dasrt.cc --- a/src/DLD-FUNCTIONS/dasrt.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/dasrt.cc Fri Apr 08 16:07:37 2005 +0000 @@ -58,7 +58,7 @@ static ColumnVector dasrt_user_f (const ColumnVector& x, const ColumnVector& xdot, - double t, int&) + double t, octave_idx_type&) { ColumnVector retval; diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/dassl.cc --- a/src/DLD-FUNCTIONS/dassl.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/dassl.cc Fri Apr 08 16:07:37 2005 +0000 @@ -58,7 +58,7 @@ ColumnVector dassl_user_function (const ColumnVector& x, const ColumnVector& xdot, - double t, int& ires) + double t, octave_idx_type& ires) { ColumnVector retval; diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/det.cc --- a/src/DLD-FUNCTIONS/det.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/det.cc Fri Apr 08 16:07:37 2005 +0000 @@ -82,7 +82,7 @@ // Always compute rcond, so we can detect numerically // singular matrices. - int info; + octave_idx_type info; double rcond = 0.0; DET det = m.determinant (info, rcond); retval(1) = rcond; @@ -100,7 +100,7 @@ // Always compute rcond, so we can detect numerically // singular matrices. - int info; + octave_idx_type info; double rcond = 0.0; ComplexDET det = m.determinant (info, rcond); retval(1) = rcond; diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/eig.cc --- a/src/DLD-FUNCTIONS/eig.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/eig.cc Fri Apr 08 16:07:37 2005 +0000 @@ -55,8 +55,8 @@ octave_value arg = args(0); - int nr = arg.rows (); - int nc = arg.columns (); + octave_idx_type nr = arg.rows (); + octave_idx_type nc = arg.columns (); int arg_is_empty = empty_arg ("eig", nr, nc); if (arg_is_empty < 0) diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/expm.cc --- a/src/DLD-FUNCTIONS/expm.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/expm.cc Fri Apr 08 16:07:37 2005 +0000 @@ -130,8 +130,8 @@ octave_value arg = args(0); - int nr = arg.rows (); - int nc = arg.columns (); + octave_idx_type nr = arg.rows (); + octave_idx_type nc = arg.columns (); int arg_is_empty = empty_arg ("expm", nr, nc); diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/fft.cc --- a/src/DLD-FUNCTIONS/fft.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/fft.cc Fri Apr 08 16:07:37 2005 +0000 @@ -54,7 +54,7 @@ octave_value arg = args(0); dim_vector dims = arg.dims (); - int n_points = -1; + octave_idx_type n_points = -1; int dim = -1; if (nargin > 1) @@ -66,7 +66,7 @@ error ("%s: NaN is invalid as the N_POINTS", fcn); else { - n_points = NINT (dval); + n_points = NINTbig (dval); if (n_points < 0) error ("%s: number of points must be greater than zero", fcn); } @@ -84,19 +84,20 @@ else if (dval < 1 || dval > dims.length ()) error ("%s: invalid dimension along which to perform fft", fcn); else + // to be safe, cast it back to int since dim is an int dim = NINT (dval) - 1; } if (error_state) return retval; - for (int i = 0; i < dims.length (); i++) + for (octave_idx_type i = 0; i < dims.length (); i++) if (dims(i) < 0) return retval; if (dim < 0) { - for (int i = 0; i < dims.length (); i++) + for (octave_idx_type i = 0; i < dims.length (); i++) if ( dims(i) > 1) { dim = i; diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/fft2.cc --- a/src/DLD-FUNCTIONS/fft2.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/fft2.cc Fri Apr 08 16:07:37 2005 +0000 @@ -56,7 +56,7 @@ octave_value arg = args(0); dim_vector dims = arg.dims (); - int n_rows = -1; + octave_idx_type n_rows = -1; if (nargin > 1) { @@ -65,7 +65,7 @@ error ("%s: NaN is invalid as the N_ROWS", fcn); else { - n_rows = NINT (dval); + n_rows = NINTbig (dval); if (n_rows < 0) error ("%s: number of rows must be greater than zero", fcn); } @@ -74,7 +74,7 @@ if (error_state) return retval; - int n_cols = -1; + octave_idx_type n_cols = -1; if (nargin > 2) { double dval = args(2).double_value (); @@ -82,7 +82,7 @@ error ("%s: NaN is invalid as the N_COLS", fcn); else { - n_cols = NINT (dval); + n_cols = NINTbig (dval); if (n_cols < 0) error ("%s: number of columns must be greater than zero", fcn); } diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/fftn.cc --- a/src/DLD-FUNCTIONS/fftn.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/fftn.cc Fri Apr 08 16:07:37 2005 +0000 @@ -74,11 +74,11 @@ { if (xisnan (val(i,0))) error ("%s: NaN is invalid as a dimension", fcn); - else if (NINT (val(i,0)) < 0) + else if (NINTbig (val(i,0)) < 0) error ("%s: all dimension must be greater than zero", fcn); else { - dims(i) = NINT(val(i,0)); + dims(i) = NINTbig(val(i,0)); } } } diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/fftw_wisdom.cc --- a/src/DLD-FUNCTIONS/fftw_wisdom.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/fftw_wisdom.cc Fri Apr 08 16:07:37 2005 +0000 @@ -103,7 +103,7 @@ if (nargin != 1) { double dval = args (1).double_value (); - if (NINT (dval) != 0) + if (NINTbig (dval) != 0) overwrite = true; } @@ -150,21 +150,21 @@ OSSTREAM cmd_buf; cmd_buf << Vfftw_wisdom_prog << " -n -o \"" << name << "\""; - for (int k = 0; k < m.rows (); k++) + for (octave_idx_type k = 0; k < m.rows (); k++) { bool first = true; cmd_buf << " "; // Note reversal of dimensions for column major storage in FFTW - for (int j = m.columns()-1; j >= 0; j--) - if (NINT(m(k,j)) > 0) + for (octave_idx_type j = m.columns()-1; j >= 0; j--) + if (NINTbig(m(k,j)) > 0) { if (first) first = false; else cmd_buf << "x"; - cmd_buf << NINT(m(k,j)) ; + cmd_buf << NINTbig(m(k,j)) ; } } diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/filter.cc --- a/src/DLD-FUNCTIONS/filter.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/filter.cc Fri Apr 08 16:07:37 2005 +0000 @@ -53,10 +53,10 @@ { MArrayN y; - int a_len = a.length (); - int b_len = b.length (); + octave_idx_type a_len = a.length (); + octave_idx_type b_len = b.length (); - int ab_len = a_len > b_len ? a_len : b_len; + octave_idx_type ab_len = a_len > b_len ? a_len : b_len; b.resize (ab_len, 0.0); if (a_len > 1) @@ -77,10 +77,10 @@ return y; } - int x_len = x_dims(dim); + octave_idx_type x_len = x_dims(dim); dim_vector si_dims = si.dims (); - int si_len = si_dims(0); + octave_idx_type si_len = si_dims(0); if (si_len != ab_len - 1) { @@ -94,8 +94,8 @@ return y; } - int si_dim = 0; - for (int i = 0; i < x_dims.length (); i++) + octave_idx_type si_dim = 0; + for (octave_idx_type i = 0; i < x_dims.length (); i++) { if (i == dim) continue; @@ -125,15 +125,15 @@ for (int i = 0; i < dim; i++) x_stride *= x_dims(i); - int x_num = x_dims.numel () / x_len; - for (int num = 0; num < x_num; num++) + octave_idx_type x_num = x_dims.numel () / x_len; + for (octave_idx_type num = 0; num < x_num; num++) { - int x_offset; + octave_idx_type x_offset; if (x_stride == 1) x_offset = num * x_len; else { - int x_offset2 = 0; + octave_idx_type x_offset2 = 0; x_offset = num; while (x_offset >= x_stride) { @@ -142,7 +142,7 @@ } x_offset += x_offset2 * x_stride * x_len; } - int si_offset = num * si_len; + octave_idx_type si_offset = num * si_len; if (a_len > 1) { @@ -155,13 +155,13 @@ psi += si_offset; - for (int i = 0, idx = x_offset; i < x_len; i++, idx += x_stride) + for (octave_idx_type i = 0, idx = x_offset; i < x_len; i++, idx += x_stride) { py[idx] = psi[0] + pb[0] * px[idx]; if (si_len > 0) { - for (int j = 0; j < si_len - 1; j++) + for (octave_idx_type j = 0; j < si_len - 1; j++) { OCTAVE_QUIT; @@ -188,13 +188,13 @@ psi += si_offset; - for (int i = 0, idx = x_offset; i < x_len; i++, idx += x_stride) + for (octave_idx_type i = 0, idx = x_offset; i < x_len; i++, idx += x_stride) { py[idx] = psi[0] + pb[0] * px[idx]; if (si_len > 1) { - for (int j = 0; j < si_len - 1; j++) + for (octave_idx_type j = 0; j < si_len - 1; j++) { OCTAVE_QUIT; @@ -249,10 +249,10 @@ return MArrayN (); } - int a_len = a.length (); - int b_len = b.length (); + octave_idx_type a_len = a.length (); + octave_idx_type b_len = b.length (); - int si_len = (a_len > b_len ? a_len : b_len) - 1; + octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1; dim_vector si_dims = x.dims (); for (int i = dim; i > 0; i--) si_dims(i) = si_dims(i-1); @@ -412,10 +412,10 @@ if (nargin == 3 || args(3).is_empty ()) { - int a_len = a.length (); - int b_len = b.length (); + octave_idx_type a_len = a.length (); + octave_idx_type b_len = b.length (); - int si_len = (a_len > b_len ? a_len : b_len) - 1; + octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1; dim_vector si_dims = x.dims (); for (int i = dim; i > 0; i--) @@ -469,10 +469,10 @@ if (nargin == 3 || args(3).is_empty ()) { - int a_len = a.length (); - int b_len = b.length (); + octave_idx_type a_len = a.length (); + octave_idx_type b_len = b.length (); - int si_len = (a_len > b_len ? a_len : b_len) - 1; + octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1; dim_vector si_dims = x.dims (); for (int i = dim; i > 0; i--) diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/find.cc --- a/src/DLD-FUNCTIONS/find.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/find.cc Fri Apr 08 16:07:37 2005 +0000 @@ -39,11 +39,11 @@ { octave_value_list retval (((nargout == 0) ? 1 : nargout), Matrix ()); - int count = 0; + octave_idx_type count = 0; - int nel = nda.nelem (); + octave_idx_type nel = nda.nelem (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { OCTAVE_QUIT; @@ -55,8 +55,8 @@ // the overall indices to be returned. But see below for scalar // case... - int result_nr = count; - int result_nc = 1; + octave_idx_type result_nr = count; + octave_idx_type result_nc = 1; bool scalar_arg = false; @@ -79,12 +79,12 @@ { count = 0; - int nr = nda.rows (); + octave_idx_type nr = nda.rows (); - int i = 0; - int j = 0; + octave_idx_type i = 0; + octave_idx_type j = 0; - for (int k = 0; k < nel; k++) + for (octave_idx_type k = 0; k < nel; k++) { OCTAVE_QUIT; diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/fsolve.cc --- a/src/DLD-FUNCTIONS/fsolve.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/fsolve.cc Fri Apr 08 16:07:37 2005 +0000 @@ -56,8 +56,8 @@ // Is this a recursive call? static int call_depth = 0; -int -hybrd_info_to_fsolve_info (int info) +octave_idx_type +hybrd_info_to_fsolve_info (octave_idx_type info) { switch (info) { @@ -95,7 +95,7 @@ { ColumnVector retval; - int n = x.length (); + octave_idx_type n = x.length (); octave_value_list args; args.resize (1); @@ -103,7 +103,7 @@ if (n > 1) { Matrix m (n, 1); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) m (i, 0) = x (i); octave_value vars (m); args(0) = vars; @@ -144,7 +144,7 @@ { Matrix retval; - int n = x.length (); + octave_idx_type n = x.length (); octave_value_list args; args.resize (1); @@ -152,7 +152,7 @@ if (n > 1) { Matrix m (n, 1); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) m(i,0) = x(i); octave_value vars (m); args(0) = vars; @@ -316,7 +316,7 @@ NLEqn nleqn (x, nleqn_fcn); nleqn.set_options (fsolve_opts); - int info; + octave_idx_type info; ColumnVector soln = nleqn.solve (info); if (! error_state) diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/gcd.cc --- a/src/DLD-FUNCTIONS/gcd.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/gcd.cc Fri Apr 08 16:07:37 2005 +0000 @@ -241,7 +241,8 @@ else { NDArray g = args(0).array_value (); - NDArray v[nargin]; + + OCTAVE_LOCAL_BUFFER (NDArray, v, nargin); int nel = dv.numel (); diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/hess.cc --- a/src/DLD-FUNCTIONS/hess.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/hess.cc Fri Apr 08 16:07:37 2005 +0000 @@ -72,8 +72,8 @@ octave_value arg = args(0); - int nr = arg.rows (); - int nc = arg.columns (); + octave_idx_type nr = arg.rows (); + octave_idx_type nc = arg.columns (); int arg_is_empty = empty_arg ("hess", nr, nc); diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/inv.cc --- a/src/DLD-FUNCTIONS/inv.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/inv.cc Fri Apr 08 16:07:37 2005 +0000 @@ -51,8 +51,8 @@ octave_value arg = args(0); - int nr = arg.rows (); - int nc = arg.columns (); + octave_idx_type nr = arg.rows (); + octave_idx_type nc = arg.columns (); int arg_is_empty = empty_arg ("inverse", nr, nc); @@ -73,7 +73,7 @@ if (! error_state) { - int info; + octave_idx_type info; double rcond = 0.0; Matrix result = m.inverse (info, rcond, 1); @@ -96,7 +96,7 @@ if (! error_state) { - int info; + octave_idx_type info; double rcond = 0.0; ComplexMatrix result = m.inverse (info, rcond, 1); diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/kron.cc --- a/src/DLD-FUNCTIONS/kron.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/kron.cc Fri Apr 08 16:07:37 2005 +0000 @@ -48,14 +48,14 @@ { C.resize (A.rows () * B.rows (), A.columns () * B.columns ()); - int Ac, Ar, Cc, Cr; + octave_idx_type Ac, Ar, Cc, Cr; for (Ac = Cc = 0; Ac < A.columns (); Ac++, Cc += B.columns ()) for (Ar = Cr = 0; Ar < A.rows (); Ar++, Cr += B.rows ()) { const T v = A (Ar, Ac); - for (int Bc = 0; Bc < B.columns (); Bc++) - for (int Br = 0; Br < B.rows (); Br++) + for (octave_idx_type Bc = 0; Bc < B.columns (); Bc++) + for (octave_idx_type Br = 0; Br < B.rows (); Br++) { OCTAVE_QUIT; C.xelem (Cr+Br, Cc+Bc) = v * B.elem (Br, Bc); diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/lu.cc --- a/src/DLD-FUNCTIONS/lu.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/lu.cc Fri Apr 08 16:07:37 2005 +0000 @@ -81,8 +81,8 @@ octave_value arg = args(0); - int nr = arg.rows (); - int nc = arg.columns (); + octave_idx_type nr = arg.rows (); + octave_idx_type nc = arg.columns (); int arg_is_empty = empty_arg ("lu", nr, nc); diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/minmax.cc --- a/src/DLD-FUNCTIONS/minmax.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/minmax.cc Fri Apr 08 16:07:37 2005 +0000 @@ -127,7 +127,7 @@ } \ else if (single_arg && nargout == 2) \ { \ - ArrayN index; \ + ArrayN index; \ \ if (arg1.is_real_type ()) \ { \ @@ -152,7 +152,7 @@ else \ gripe_wrong_type_arg (#FCN, arg1); \ \ - int len = index.numel (); \ + octave_idx_type len = index.numel (); \ \ if (len > 0) \ { \ @@ -160,7 +160,7 @@ \ NDArray idx (index.dims ()); \ \ - for (int i = 0; i < len; i++) \ + for (octave_idx_type i = 0; i < len; i++) \ { \ OCTAVE_QUIT; \ int tmp = index.elem (i) + 1; \ diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/quad.cc --- a/src/DLD-FUNCTIONS/quad.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/quad.cc Fri Apr 08 16:07:37 2005 +0000 @@ -230,8 +230,8 @@ indef_type = IndefQuad::bound_to_inf; } - int ier = 0; - int nfun = 0; + octave_idx_type ier = 0; + octave_idx_type nfun = 0; double abserr = 0.0; double val = 0.0; bool have_sing = false; diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/qz.cc --- a/src/DLD-FUNCTIONS/qz.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/qz.cc Fri Apr 08 16:07:37 2005 +0000 @@ -55,7 +55,7 @@ #include "utils.h" #include "variables.h" -typedef int (*sort_function) (const int& LSIZE, const double& ALPHA, +typedef octave_idx_type (*sort_function) (const octave_idx_type& LSIZE, const double& ALPHA, const double& BETA, const double& S, const double& P); @@ -63,31 +63,31 @@ { F77_RET_T F77_FUNC (dggbal, DGGBAL) (F77_CONST_CHAR_ARG_DECL, - const int& N, double* A, const int& LDA, - double* B, const int& LDB, int& ILO, - int& IHI, double* LSCALE, double* RSCALE, - double* WORK, int& INFO + const octave_idx_type& N, double* A, const octave_idx_type& LDA, + double* B, const octave_idx_type& LDB, octave_idx_type& ILO, + octave_idx_type& IHI, double* LSCALE, double* RSCALE, + double* WORK, octave_idx_type& INFO F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (dggbak, DGGBAK) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int& N, const int& ILO, - const int& IHI, const double* LSCALE, - const double* RSCALE, int& M, double* V, - const int& LDV, int& INFO + const octave_idx_type& N, const octave_idx_type& ILO, + const octave_idx_type& IHI, const double* LSCALE, + const double* RSCALE, octave_idx_type& M, double* V, + const octave_idx_type& LDV, octave_idx_type& INFO F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T F77_FUNC (dgghrd, DGGHRD) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int& N, const int& ILO, - const int& IHI, double* A, - const int& LDA, double* B, - const int& LDB, double* Q, - const int& LDQ, double* Z, - const int& LDZ, int& INFO + const octave_idx_type& N, const octave_idx_type& ILO, + const octave_idx_type& IHI, double* A, + const octave_idx_type& LDA, double* B, + const octave_idx_type& LDB, double* Q, + const octave_idx_type& LDQ, double* Z, + const octave_idx_type& LDZ, octave_idx_type& INFO F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); @@ -95,30 +95,30 @@ F77_FUNC (dhgeqz, DHGEQZ) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - const int& N, const int& ILO, const int& IHI, - double* A, const int& LDA, double* B, - const int& LDB, double* ALPHAR, + const octave_idx_type& N, const octave_idx_type& ILO, const octave_idx_type& IHI, + double* A, const octave_idx_type& LDA, double* B, + const octave_idx_type& LDB, double* ALPHAR, double* ALPHAI, double* BETA, double* Q, - const int& LDQ, double* Z, - const int& LDZ, double* WORK, - const int& LWORK, int& INFO + const octave_idx_type& LDQ, double* Z, + const octave_idx_type& LDZ, double* WORK, + const octave_idx_type& LWORK, octave_idx_type& INFO F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); F77_RET_T - F77_FUNC (dlag2, DLAG2) (const double* A, const int& LDA, const double* B, - const int& LDB, const double& SAFMIN, + F77_FUNC (dlag2, DLAG2) (const double* A, const octave_idx_type& LDA, const double* B, + const octave_idx_type& LDB, const double& SAFMIN, double& SCALE1, double& SCALE2, double& WR1, double& WR2, double& WI); // Van Dooren's code (netlib.org: toms/590) for reordering // GEP. Only processes Z, not Q. F77_RET_T - F77_FUNC (dsubsp, DSUBSP) (const int& NMAX, const int& N, double* A, + F77_FUNC (dsubsp, DSUBSP) (const octave_idx_type& NMAX, const octave_idx_type& N, double* A, double* B, double* Z, sort_function, - const double& EPS, int& NDIM, int& FAIL, - int* IND); + const double& EPS, octave_idx_type& NDIM, octave_idx_type& FAIL, + octave_idx_type* IND); // documentation for DTGEVC incorrectly states that VR, VL are // complex*16; they are declared in DTGEVC as double precision @@ -126,12 +126,12 @@ F77_RET_T F77_FUNC (dtgevc, DTGEVC) (F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, - int* SELECT, const int& N, double* A, - const int& LDA, double* B, - const int& LDB, double* VL, - const int& LDVL, double* VR, - const int& LDVR, const int& MM, - int& M, double* WORK, int& INFO + octave_idx_type* SELECT, const octave_idx_type& N, double* A, + const octave_idx_type& LDA, double* B, + const octave_idx_type& LDB, double* VL, + const octave_idx_type& LDVL, double* VR, + const octave_idx_type& LDVR, const octave_idx_type& MM, + octave_idx_type& M, double* WORK, octave_idx_type& INFO F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL); @@ -142,8 +142,8 @@ F77_RET_T F77_FUNC (xdlange, XDLANGE) (F77_CONST_CHAR_ARG_DECL, - const int&, const int&, const double*, - const int&, double*, double& + const octave_idx_type&, const octave_idx_type&, const double*, + const octave_idx_type&, double*, double& F77_CHAR_ARG_LEN_DECL); } @@ -155,8 +155,8 @@ // fcrhp: real(lambda) >= 0 // folhp: real(lambda) < 0 -static int -fcrhp (const int& lsize, const double& alpha, +static octave_idx_type +fcrhp (const octave_idx_type& lsize, const double& alpha, const double& beta, const double& s, const double&) { if (lsize == 1) @@ -165,11 +165,11 @@ return (s >= 0 ? 1 : -1); } -static int -fin (const int& lsize, const double& alpha, +static octave_idx_type +fin (const octave_idx_type& lsize, const double& alpha, const double& beta, const double&, const double& p) { - int retval; + octave_idx_type retval; if (lsize == 1) retval = (fabs (alpha) < fabs (beta) ? 1 : -1); @@ -183,8 +183,8 @@ return retval; } -static int -folhp (const int& lsize, const double& alpha, +static octave_idx_type +folhp (const octave_idx_type& lsize, const double& alpha, const double& beta, const double& s, const double&) { if (lsize == 1) @@ -193,8 +193,8 @@ return (s < 0 ? 1 : -1); } -static int -fout (const int& lsize, const double& alpha, +static octave_idx_type +fout (const octave_idx_type& lsize, const double& alpha, const double& beta, const double&, const double& p) { if (lsize == 1) @@ -361,7 +361,7 @@ #endif // Argument 1: check if it's o.k. dimensioned - int nn = args(0).rows (); + octave_idx_type nn = args(0).rows (); #ifdef DEBUG std::cout << "argument 1 dimensions: (" << nn << "," << args(0).columns () << ")" @@ -437,14 +437,14 @@ RowVector alphar(nn), alphai(nn), betar(nn); ComplexMatrix CQ(nn,nn), CZ(nn,nn), CVR(nn,nn), CVL(nn,nn); - int ilo, ihi, info; + octave_idx_type ilo, ihi, info; char compq = (nargout >= 3 ? 'V' : 'N'); char compz = (nargout >= 4 ? 'V' : 'N'); // initialize Q, Z to identity if we need either of them if (compq == 'V' || compz == 'V') - for (int ii = 0; ii < nn; ii++) - for (int jj = 0; jj < nn; jj++) + for (octave_idx_type ii = 0; ii < nn; ii++) + for (octave_idx_type jj = 0; jj < nn; jj++) { OCTAVE_QUIT; QQ(ii,jj) = ZZ(ii,jj) = (ii == jj ? 1.0 : 0.0); @@ -673,7 +673,7 @@ break; } - int ndim, fail; + octave_idx_type ndim, fail; double inf_norm; F77_XFCN (xdlange, XDLANGE, @@ -703,7 +703,7 @@ std::cout << std::endl; #endif - Array ind (nn); + Array ind (nn); F77_XFCN (dsubsp, DSUBSP, (nn, nn, aa.fortran_vec (), bb.fortran_vec (), @@ -875,8 +875,8 @@ { char side = (nargout == 5 ? 'R' : 'B'); // which side to compute? char howmny = 'B'; // compute all of them and backtransform - int *select = NULL; // dummy pointer; select is not used. - int m; + octave_idx_type *select = NULL; // dummy pointer; select is not used. + octave_idx_type m; if (complex_case) { diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/rand.cc --- a/src/DLD-FUNCTIONS/rand.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/rand.cc Fri Apr 08 16:07:37 2005 +0000 @@ -99,8 +99,8 @@ { dims.resize (2); - dims(0) = NINT (tmp.double_value ()); - dims(1) = NINT (tmp.double_value ()); + dims(0) = NINTbig (tmp.double_value ()); + dims(1) = NINTbig (tmp.double_value ()); if (! error_state) goto gen_matrix; @@ -112,19 +112,19 @@ if (r.all_elements_are_ints ()) { - int n = r.nelem (); + octave_idx_type n = r.nelem (); dims.resize (n); - int base = NINT (r.base ()); - int incr = NINT (r.inc ()); - int lim = NINT (r.limit ()); + octave_idx_type base = NINTbig (r.base ()); + octave_idx_type incr = NINTbig (r.inc ()); + octave_idx_type lim = NINTbig (r.limit ()); if (base < 0 || lim < 0) error ("%s: all dimensions must be nonnegative", fcn); else { - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { dims(i) = base; base += incr; @@ -143,13 +143,13 @@ if (! error_state) { - int len = iv.length (); + octave_idx_type len = iv.length (); dims.resize (len); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { - int elt = iv(i); + octave_idx_type elt = iv(i); if (elt < 0) { @@ -197,7 +197,7 @@ for (int i = 0; i < nargin; i++) { - dims(i) = args(i).int_value (); + dims(i) = (octave_idx_type)args(i).int_value (); if (error_state) { diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/schur.cc --- a/src/DLD-FUNCTIONS/schur.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/schur.cc Fri Apr 08 16:07:37 2005 +0000 @@ -278,8 +278,8 @@ return retval; } - int nr = arg.rows (); - int nc = arg.columns (); + octave_idx_type nr = arg.rows (); + octave_idx_type nc = arg.columns (); int arg_is_empty = empty_arg ("schur", nr, nc); diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/sort.cc --- a/src/DLD-FUNCTIONS/sort.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/sort.cc Fri Apr 08 16:07:37 2005 +0000 @@ -48,7 +48,7 @@ { public: T vec; - int indx; + octave_idx_type indx; }; template @@ -89,10 +89,10 @@ return retval; dim_vector dv = m.dims (); - unsigned int ns = dv(dim); - unsigned int iter = dv.numel () / ns; - unsigned int stride = 1; - for (unsigned int i = 0; i < static_cast (dim); i++) + octave_idx_type ns = dv(dim); + octave_idx_type iter = dv.numel () / ns; + octave_idx_type stride = 1; + for (int i = 0; i < dim; i++) stride *= dv(i); T *v = m.fortran_vec (); @@ -105,7 +105,7 @@ if (stride == 1) { - for (unsigned int j = 0; j < iter; j++) + for (octave_idx_type j = 0; j < iter; j++) { sort.sort (v, ns); v += ns; @@ -114,10 +114,10 @@ else { OCTAVE_LOCAL_BUFFER (T, vi, ns); - for (unsigned int j = 0; j < iter; j++) + for (octave_idx_type j = 0; j < iter; j++) { - unsigned int offset = j; - unsigned int offset2 = 0; + octave_idx_type offset = j; + octave_idx_type offset2 = 0; while (offset >= stride) { offset -= stride; @@ -125,12 +125,12 @@ } offset += offset2 * stride * ns; - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) vi[i] = v[i*stride + offset]; sort.sort (vi, ns); - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) v[i*stride + offset] = vi[i]; } } @@ -150,10 +150,10 @@ return retval; dim_vector dv = m.dims (); - unsigned int ns = dv(dim); - unsigned int iter = dv.numel () / ns; - unsigned int stride = 1; - for (unsigned int i = 0; i < static_cast (dim); i++) + octave_idx_type ns = dv(dim); + octave_idx_type iter = dv.numel () / ns; + octave_idx_type stride = 1; + for (int i = 0; i < dim; i++) stride *= dv(i); T *v = m.fortran_vec (); @@ -167,18 +167,18 @@ OCTAVE_LOCAL_BUFFER (vec_index *, vi, ns); OCTAVE_LOCAL_BUFFER (vec_index, vix, ns); - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) vi[i] = &vix[i]; NDArray idx (dv); if (stride == 1) { - for (unsigned int j = 0; j < iter; j++) + for (octave_idx_type j = 0; j < iter; j++) { - unsigned int offset = j * ns; + octave_idx_type offset = j * ns; - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) { vi[i]->vec = v[i]; vi[i]->indx = i + 1; @@ -186,7 +186,7 @@ indexed_sort.sort (vi, ns); - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) { v[i] = vi[i]->vec; idx(i + offset) = vi[i]->indx; @@ -196,10 +196,10 @@ } else { - for (unsigned int j = 0; j < iter; j++) + for (octave_idx_type j = 0; j < iter; j++) { - unsigned int offset = j; - unsigned int offset2 = 0; + octave_idx_type offset = j; + octave_idx_type offset2 = 0; while (offset >= stride) { offset -= stride; @@ -207,7 +207,7 @@ } offset += offset2 * stride * ns; - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) { vi[i]->vec = v[i*stride + offset]; vi[i]->indx = i + 1; @@ -215,7 +215,7 @@ indexed_sort.sort (vi, ns); - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) { v[i*stride+offset] = vi[i]->vec; idx(i*stride+offset) = vi[i]->indx; @@ -289,7 +289,7 @@ template class octave_sort *>; template <> -static octave_value +octave_value mx_sort (ArrayN &m, int dim, sortmode mode) { octave_value retval; @@ -298,10 +298,10 @@ return retval; dim_vector dv = m.dims (); - unsigned int ns = dv(dim); - unsigned int iter = dv.numel () / ns; - unsigned int stride = 1; - for (unsigned int i = 0; i < static_cast (dim); i++) + octave_idx_type ns = dv(dim); + octave_idx_type iter = dv.numel () / ns; + octave_idx_type stride = 1; + for (int i = 0; i < dim; i++) stride *= dv(i); double *v = m.fortran_vec (); @@ -317,12 +317,12 @@ if (stride == 1) { - for (unsigned int j = 0; j < iter; j++) + for (octave_idx_type j = 0; j < iter; j++) { // Flip the data in the vector so that int compares on // IEEE754 give the correct ordering. - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) p[i] = FloatFlip (p[i]); sort.sort (p, ns); @@ -330,7 +330,7 @@ // Flip the data out of the vector so that int compares // on IEEE754 give the correct ordering. - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) p[i] = IFloatFlip (p[i]); // There are two representations of NaN. One will be @@ -341,22 +341,22 @@ if (lo_ieee_signbit (octave_NaN)) if (mode == UNDEFINED || mode == ASCENDING) { - unsigned int i = 0; + octave_idx_type i = 0; double *vtmp = (double *)p; while (xisnan (vtmp[i++]) && i < ns); - for (unsigned int l = 0; l < ns - i + 1; l++) + for (octave_idx_type l = 0; l < ns - i + 1; l++) vtmp[l] = vtmp[l+i-1]; - for (unsigned int l = ns - i + 1; l < ns; l++) + for (octave_idx_type l = ns - i + 1; l < ns; l++) vtmp[l] = octave_NaN; } else { - unsigned int i = ns; + octave_idx_type i = ns; double *vtmp = (double *)p; while (xisnan (vtmp[--i]) && i > 0); - for (int l = i; l >= 0; l--) + for (octave_idx_type l = i; l >= 0; l--) vtmp[l-i+ns-1] = vtmp[l]; - for (unsigned int l = 0; l < ns - i - 1; l++) + for (octave_idx_type l = 0; l < ns - i - 1; l++) vtmp[l] = octave_NaN; } @@ -367,10 +367,10 @@ { OCTAVE_LOCAL_BUFFER (unsigned EIGHT_BYTE_INT, vi, ns); - for (unsigned int j = 0; j < iter; j++) + for (octave_idx_type j = 0; j < iter; j++) { - unsigned int offset = j; - unsigned int offset2 = 0; + octave_idx_type offset = j; + octave_idx_type offset2 = 0; while (offset >= stride) { offset -= stride; @@ -381,7 +381,7 @@ // Flip the data in the vector so that int compares on // IEEE754 give the correct ordering. - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) vi[i] = FloatFlip (p[i*stride + offset]); sort.sort (vi, ns); @@ -389,7 +389,7 @@ // Flip the data out of the vector so that int compares // on IEEE754 give the correct ordering. - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) p[i*stride + offset] = IFloatFlip (vi[i]); // There are two representations of NaN. One will be @@ -400,20 +400,20 @@ if (lo_ieee_signbit (octave_NaN)) if (mode == UNDEFINED || mode == ASCENDING) { - unsigned int i = 0; + octave_idx_type i = 0; while (xisnan (v[i++*stride + offset]) && i < ns); - for (unsigned int l = 0; l < ns - i + 1; l++) + for (octave_idx_type l = 0; l < ns - i + 1; l++) v[l*stride + offset] = v[(l+i-1)*stride + offset]; - for (unsigned int l = ns - i + 1; l < ns; l++) + for (octave_idx_type l = ns - i + 1; l < ns; l++) v[l*stride + offset] = octave_NaN; } else { - unsigned int i = ns; + octave_idx_type i = ns; while (xisnan (v[--i*stride + offset]) && i > 0); - for (int l = i; l >= 0; l--) + for (octave_idx_type l = i; l >= 0; l--) v[(l-i+ns-1)*stride + offset] = v[l*stride + offset]; - for (unsigned int l = 0; l < ns - i - 1; l++) + for (octave_idx_type l = 0; l < ns - i - 1; l++) v[l*stride + offset] = octave_NaN; } } @@ -424,8 +424,9 @@ return retval; } +// Should other overloaded functions have their static keywords removed? template <> -static octave_value_list +octave_value_list mx_sort_indexed (ArrayN &m, int dim, sortmode mode) { octave_value_list retval; @@ -434,10 +435,10 @@ return retval; dim_vector dv = m.dims (); - unsigned int ns = dv(dim); - unsigned int iter = dv.numel () / ns; - unsigned int stride = 1; - for (unsigned int i = 0; i < static_cast (dim); i++) + octave_idx_type ns = dv(dim); + octave_idx_type iter = dv.numel () / ns; + octave_idx_type stride = 1; + for (int i = 0; i < dim; i++) stride *= dv(i); double *v = m.fortran_vec (); @@ -454,15 +455,15 @@ OCTAVE_LOCAL_BUFFER (vec_index *, vi, ns); OCTAVE_LOCAL_BUFFER (vec_index, vix, ns); - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) vi[i] = &vix[i]; NDArray idx (dv); - for (unsigned int j = 0; j < iter; j++) + for (octave_idx_type j = 0; j < iter; j++) { - unsigned int offset = j; - unsigned int offset2 = 0; + octave_idx_type offset = j; + octave_idx_type offset2 = 0; while (offset >= stride) { offset -= stride; @@ -473,7 +474,7 @@ // Flip the data in the vector so that int compares on // IEEE754 give the correct ordering. - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) { vi[i]->vec = FloatFlip (p[i*stride + offset]); vi[i]->indx = i + 1; @@ -484,7 +485,7 @@ // Flip the data out of the vector so that int compares on // IEEE754 give the correct ordering - for (unsigned int i = 0; i < ns; i++) + for (octave_idx_type i = 0; i < ns; i++) { p[i*stride + offset] = IFloatFlip (vi[i]->vec); idx(i*stride + offset) = vi[i]->indx; @@ -497,17 +498,17 @@ if (lo_ieee_signbit (octave_NaN)) if (mode == UNDEFINED || mode == ASCENDING) { - unsigned int i = 0; + octave_idx_type i = 0; while (xisnan (v[i++*stride+offset]) && i < ns); OCTAVE_LOCAL_BUFFER (double, itmp, i - 1); - for (unsigned int l = 0; l < i -1; l++) + for (octave_idx_type l = 0; l < i -1; l++) itmp[l] = idx(l*stride + offset); - for (unsigned int l = 0; l < ns - i + 1; l++) + for (octave_idx_type l = 0; l < ns - i + 1; l++) { v[l*stride + offset] = v[(l+i-1)*stride + offset]; idx(l*stride + offset) = idx((l+i-1)*stride + offset); } - for (unsigned int k = 0, l = ns - i + 1; l < ns; l++, k++) + for (octave_idx_type k = 0, l = ns - i + 1; l < ns; l++, k++) { v[l*stride + offset] = octave_NaN; idx(l*stride + offset) = itmp[k]; @@ -515,17 +516,17 @@ } else { - unsigned int i = ns; + octave_idx_type i = ns; while (xisnan (v[--i*stride+offset]) && i > 0); OCTAVE_LOCAL_BUFFER (double, itmp, ns - i - 1); - for (unsigned int l = 0; l < ns - i -1; l++) + for (octave_idx_type l = 0; l < ns - i -1; l++) itmp[l] = idx((l+i+1)*stride + offset); - for (int l = i; l >= 0; l--) + for (octave_idx_type l = i; l >= 0; l--) { v[(l-i+ns-1)*stride + offset] = v[l*stride + offset]; idx((l-i+ns-1)*stride + offset) = idx(l*stride + offset); } - for (unsigned int k = 0, l = 0; l < ns - i - 1; l++, k++) + for (octave_idx_type k = 0, l = 0; l < ns - i - 1; l++, k++) { v[l*stride + offset] = octave_NaN; idx(l*stride + offset) = itmp[k]; @@ -775,7 +776,7 @@ } } - dim_vector dv = ((const octave_complex_matrix&) arg) .dims (); + dim_vector dv = arg.dims (); if (error_state) { gripe_wrong_type_arg ("sort", arg); @@ -856,7 +857,7 @@ Cell cellm = arg.cell_value (); // Need to check that all elements are strings - for (int i = 0; i < cellm.numel (); i++) + for (octave_idx_type i = 0; i < cellm.numel (); i++) if (! cellm(i).is_string ()) { gripe_wrong_type_arg ("sort", arg); diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/sparse.cc --- a/src/DLD-FUNCTIONS/sparse.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/sparse.cc Fri Apr 08 16:07:37 2005 +0000 @@ -194,7 +194,7 @@ } else { - int m = 1, n = 1; + octave_idx_type m = 1, n = 1; if (nargin == 2) { m = args(0).int_value(); @@ -271,7 +271,7 @@ return retval; // Confirm that i,j,s all have the same number of elements - int ns; + octave_idx_type ns; if (use_complex) ns = coefAC.length(); else if (use_bool) @@ -279,9 +279,9 @@ else ns = coefA.length(); - int ni = ridxA.length(); - int nj = cidxA.length(); - int nnz = (ni > nj ? ni : nj); + octave_idx_type ni = ridxA.length(); + octave_idx_type nj = cidxA.length(); + octave_idx_type nnz = (ni > nj ? ni : nj); if ((ns != 1 && ns != nnz) || (ni != 1 && ni != nnz) || (nj != 1 && nj != nnz)) @@ -292,8 +292,8 @@ if (nargin == 3 || nargin == 4) { - m = static_cast (ridxA.max()); - n = static_cast (cidxA.max()); + m = static_cast (ridxA.max()); + n = static_cast (cidxA.max()); // if args(3) is not string, then ignore the value // otherwise check for summation or unique @@ -433,9 +433,9 @@ else if (args(0).type_name () == "complex matrix") { const ComplexMatrix M = args(0).complex_matrix_value(); - int nnz = 0; - for( int j = 0; j < M.cols(); j++) - for( int i = 0; i < M.rows(); i++) + octave_idx_type nnz = 0; + for( octave_idx_type j = 0; j < M.cols(); j++) + for( octave_idx_type i = 0; i < M.rows(); i++) if (M (i, j) != 0.) nnz++; retval = (double) nnz; @@ -443,9 +443,9 @@ else if (args(0).type_name () == "matrix") { const Matrix M = args(0).matrix_value(); - int nnz = 0; - for( int j = 0; j < M.cols(); j++) - for( int i = 0; i < M.rows(); i++) + octave_idx_type nnz = 0; + for( octave_idx_type j = 0; j < M.cols(); j++) + for( octave_idx_type i = 0; i < M.rows(); i++) if (M (i, j) != 0.) nnz++; retval = (double) nnz; @@ -453,9 +453,9 @@ else if (args(0).type_name () == "string") { const charMatrix M = args(0).char_matrix_value(); - int nnz = 0; - for( int j = 0; j < M.cols(); j++) - for( int i = 0; i < M.rows(); i++) + octave_idx_type nnz = 0; + for( octave_idx_type j = 0; j < M.cols(); j++) + for( octave_idx_type i = 0; i < M.rows(); i++) if (M (i, j) != 0) nnz++; retval = (double) nnz; @@ -512,18 +512,18 @@ sparse_find (const SparseMatrix& v) { octave_value_list retval; - int nnz = v.nnz (); + octave_idx_type nnz = v.nnz (); dim_vector dv = v.dims (); - int nr = dv(0); - int nc = dv (1); + octave_idx_type nr = dv(0); + octave_idx_type nc = dv (1); ColumnVector I (nnz), J (nnz); ColumnVector S (nnz); - for (int i = 0, cx = 0; i < nc; i++) + for (octave_idx_type i = 0, cx = 0; i < nc; i++) { OCTAVE_QUIT; - for (int j = v.cidx(i); j < v.cidx(i+1); j++ ) + for (octave_idx_type j = v.cidx(i); j < v.cidx(i+1); j++ ) { I (cx) = static_cast (v.ridx(j) + 1); J (cx) = static_cast (i + 1); @@ -553,18 +553,18 @@ sparse_find (const SparseComplexMatrix& v) { octave_value_list retval; - int nnz = v.nnz (); + octave_idx_type nnz = v.nnz (); dim_vector dv = v.dims (); - int nr = dv(0); - int nc = dv (1); + octave_idx_type nr = dv(0); + octave_idx_type nc = dv (1); ColumnVector I (nnz), J (nnz); ComplexColumnVector S (nnz); - for (int i = 0, cx = 0; i < nc; i++) + for (octave_idx_type i = 0, cx = 0; i < nc; i++) { OCTAVE_QUIT; - for (int j = v.cidx(i); j < v.cidx(i+1); j++ ) + for (octave_idx_type j = v.cidx(i); j < v.cidx(i+1); j++ ) { I (cx) = static_cast (v.ridx(j) + 1); J (cx) = static_cast (i + 1); @@ -594,18 +594,18 @@ sparse_find (const SparseBoolMatrix& v) { octave_value_list retval; - int nnz = v.nnz (); + octave_idx_type nnz = v.nnz (); dim_vector dv = v.dims (); - int nr = dv(0); - int nc = dv (1); + octave_idx_type nr = dv(0); + octave_idx_type nc = dv (1); ColumnVector I (nnz), J (nnz); ColumnVector S (nnz); - for (int i = 0, cx = 0; i < nc; i++) + for (octave_idx_type i = 0, cx = 0; i < nc; i++) { OCTAVE_QUIT; - for (int j = v.cidx(i); j < v.cidx(i+1); j++ ) + for (octave_idx_type j = v.cidx(i); j < v.cidx(i+1); j++ ) { I (cx) = static_cast (v.ridx(j) + 1); J (cx) = static_cast (i + 1); @@ -865,7 +865,7 @@ } \ else if (single_arg && nargout == 2) \ { \ - Array2 index; \ + Array2 index; \ \ if (arg1.type_id () == octave_sparse_matrix::static_type_id ()) \ retval(0) = arg1.sparse_matrix_value () .FCN (index, dim); \ @@ -875,7 +875,7 @@ else \ gripe_wrong_type_arg (#FCN, arg1); \ \ - int len = index.numel (); \ + octave_idx_type len = index.numel (); \ \ if (len > 0) \ { \ @@ -883,10 +883,10 @@ \ NDArray idx (index.dims ()); \ \ - for (int i = 0; i < len; i++) \ + for (octave_idx_type i = 0; i < len; i++) \ { \ OCTAVE_QUIT; \ - int tmp = index.elem (i) + 1; \ + octave_idx_type tmp = index.elem (i) + 1; \ idx.elem (i) = (tmp <= 0) \ ? nan_val : static_cast (tmp); \ } \ @@ -1155,20 +1155,20 @@ if (a.is_complex_type ()) { SparseComplexMatrix m = a.sparse_complex_matrix_value (); - int k = b.nint_value(true); + octave_idx_type k = b.nint_value(true); if (error_state) return retval; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nr == 0 || nc == 0) retval = m; else if (nr == 1 || nc == 1) { - int roff = 0; - int coff = 0; + octave_idx_type roff = 0; + octave_idx_type coff = 0; if (k > 0) { roff = 0; @@ -1183,34 +1183,34 @@ if (nr == 1) { - int n = nc + k; - int nz = m.nnz (); + octave_idx_type n = nc + k; + octave_idx_type nz = m.nnz (); SparseComplexMatrix r (n, n, nz); - for (int i = 0; i < coff+1; i++) + for (octave_idx_type i = 0; i < coff+1; i++) r.xcidx (i) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = m.cidx(j); i < m.cidx(j+1); i++) + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) { r.xdata (i) = m.data (i); r.xridx (i) = j + roff; } r.xcidx (j+coff+1) = m.cidx(j+1); } - for (int i = nc+coff+1; i < n+1; i++) + for (octave_idx_type i = nc+coff+1; i < n+1; i++) r.xcidx (i) = nz; retval = r; } else { - int n = nr + k; - int nz = m.nnz (); - int ii = 0; - int ir = m.ridx(0); + octave_idx_type n = nr + k; + octave_idx_type nz = m.nnz (); + octave_idx_type ii = 0; + octave_idx_type ir = m.ridx(0); SparseComplexMatrix r (n, n, nz); - for (int i = 0; i < coff+1; i++) + for (octave_idx_type i = 0; i < coff+1; i++) r.xcidx (i) = 0; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { if (ir == i) { @@ -1221,7 +1221,7 @@ } r.xcidx (i+coff+1) = ii; } - for (int i = nr+coff+1; i < n+1; i++) + for (octave_idx_type i = nr+coff+1; i < n+1; i++) r.xcidx (i) = nz; retval = r; } @@ -1238,20 +1238,20 @@ { SparseMatrix m = a.sparse_matrix_value (); - int k = b.nint_value(true); + octave_idx_type k = b.nint_value(true); if (error_state) return retval; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nr == 0 || nc == 0) retval = m; else if (nr == 1 || nc == 1) { - int roff = 0; - int coff = 0; + octave_idx_type roff = 0; + octave_idx_type coff = 0; if (k > 0) { roff = 0; @@ -1266,35 +1266,35 @@ if (nr == 1) { - int n = nc + k; - int nz = m.nnz (); + octave_idx_type n = nc + k; + octave_idx_type nz = m.nnz (); SparseMatrix r (n, n, nz); - for (int i = 0; i < coff+1; i++) + for (octave_idx_type i = 0; i < coff+1; i++) r.xcidx (i) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = m.cidx(j); i < m.cidx(j+1); i++) + for (octave_idx_type i = m.cidx(j); i < m.cidx(j+1); i++) { r.xdata (i) = m.data (i); r.xridx (i) = j + roff; } r.xcidx (j+coff+1) = m.cidx(j+1); } - for (int i = nc+coff+1; i < n+1; i++) + for (octave_idx_type i = nc+coff+1; i < n+1; i++) r.xcidx (i) = nz; retval = r; } else { - int n = nr + k; - int nz = m.nnz (); - int ii = 0; - int ir = m.ridx(0); + octave_idx_type n = nr + k; + octave_idx_type nz = m.nnz (); + octave_idx_type ii = 0; + octave_idx_type ir = m.ridx(0); SparseMatrix r (n, n, nz); - for (int i = 0; i < coff+1; i++) + for (octave_idx_type i = 0; i < coff+1; i++) r.xcidx (i) = 0; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { if (ir == i) { @@ -1305,7 +1305,7 @@ } r.xcidx (i+coff+1) = ii; } - for (int i = nr+coff+1; i < n+1; i++) + for (octave_idx_type i = nr+coff+1; i < n+1; i++) r.xcidx (i) = nz; retval = r; } diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/spdet.cc --- a/src/DLD-FUNCTIONS/spdet.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/spdet.cc Fri Apr 08 16:07:37 2005 +0000 @@ -57,8 +57,8 @@ octave_value arg = args(0); - int nr = arg.rows (); - int nc = arg.columns (); + octave_idx_type nr = arg.rows (); + octave_idx_type nc = arg.columns (); if (nr == 0 && nc == 0) { @@ -87,7 +87,7 @@ // Always compute rcond, so we can detect numerically // singular matrices. - int info; + octave_idx_type info; double rcond = 0.0; DET det = m.determinant (info, rcond); retval(1) = rcond; @@ -105,7 +105,7 @@ // Always compute rcond, so we can detect numerically // singular matrices. - int info; + octave_idx_type info; double rcond = 0.0; ComplexDET det = m.determinant (info, rcond); retval(1) = rcond; diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/sqrtm.cc --- a/src/DLD-FUNCTIONS/sqrtm.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/sqrtm.cc Fri Apr 08 16:07:37 2005 +0000 @@ -50,8 +50,8 @@ { double sum = 0; - for (int i = 0; i < A.rows (); i++) - for (int j = 0; j < A.columns (); j++) + for (octave_idx_type i = 0; i < A.rows (); i++) + for (octave_idx_type j = 0; j < A.columns (); j++) sum += real (A(i,j) * conj (A(i,j))); return sqrt (sum); @@ -61,8 +61,8 @@ frobnorm (const Matrix& A) { double sum = 0; - for (int i = 0; i < A.rows (); i++) - for (int j = 0; j < A.columns (); j++) + for (octave_idx_type i = 0; i < A.rows (); i++) + for (octave_idx_type j = 0; j < A.columns (); j++) sum += A(i,j) * A(i,j); return sqrt (sum); @@ -72,24 +72,24 @@ static ComplexMatrix sqrtm_from_schur (const ComplexMatrix& U, const ComplexMatrix& T) { - const int n = U.rows (); + const octave_idx_type n = U.rows (); ComplexMatrix R (n, n, 0.0); - for (int j = 0; j < n; j++) + for (octave_idx_type j = 0; j < n; j++) R(j,j) = sqrt (T(j,j)); const double fudge = sqrt (DBL_MIN); - for (int p = 0; p < n-1; p++) + for (octave_idx_type p = 0; p < n-1; p++) { - for (int i = 0; i < n-(p+1); i++) + for (octave_idx_type i = 0; i < n-(p+1); i++) { - const int j = i + p + 1; + const octave_idx_type j = i + p + 1; Complex s = T(i,j); - for (int k = i+1; k < j; k++) + for (octave_idx_type k = i+1; k < j; k++) s -= R(i,k) * R(k,j); // dividing @@ -129,8 +129,8 @@ octave_value arg = args(0); - int n = arg.rows (); - int nc = arg.columns (); + octave_idx_type n = arg.rows (); + octave_idx_type nc = arg.columns (); int arg_is_empty = empty_arg ("sqrtm", n, nc); @@ -196,8 +196,8 @@ // Check for minimal imaginary part double normX = 0.0; double imagX = 0.0; - for (int i = 0; i < n; i++) - for (int j = 0; j < n; j++) + for (octave_idx_type i = 0; i < n; i++) + for (octave_idx_type j = 0; j < n; j++) { imagX = getmax (imagX, imag (X(i,j))); normX = getmax (normX, abs (X(i,j))); @@ -219,7 +219,7 @@ // Find min diagonal minT = lo_ieee_inf_value (); - for (int i=0; i < n; i++) + for (octave_idx_type i=0; i < n; i++) minT = getmin(minT, abs(T(i,i))); } else @@ -246,7 +246,7 @@ err = lo_ieee_inf_value (); minT = lo_ieee_inf_value (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) minT = getmin (minT, abs (T(i,i))); } diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/svd.cc --- a/src/DLD-FUNCTIONS/svd.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/svd.cc Fri Apr 08 16:07:37 2005 +0000 @@ -128,8 +128,8 @@ octave_value arg = args(0); - int nr = arg.rows (); - int nc = arg.columns (); + octave_idx_type nr = arg.rows (); + octave_idx_type nc = arg.columns (); if (nr == 0 || nc == 0) { diff -r eae7b40388e9 -r 23b37da9fd5b src/DLD-FUNCTIONS/syl.cc --- a/src/DLD-FUNCTIONS/syl.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/DLD-FUNCTIONS/syl.cc Fri Apr 08 16:07:37 2005 +0000 @@ -73,14 +73,14 @@ octave_value arg_b = args(1); octave_value arg_c = args(2); - int a_nr = arg_a.rows (); - int a_nc = arg_a.columns (); + octave_idx_type a_nr = arg_a.rows (); + octave_idx_type a_nc = arg_a.columns (); - int b_nr = arg_b.rows (); - int b_nc = arg_b.columns (); + octave_idx_type b_nr = arg_b.rows (); + octave_idx_type b_nc = arg_b.columns (); - int c_nr = arg_c.rows (); - int c_nc = arg_c.columns (); + octave_idx_type c_nr = arg_c.rows (); + octave_idx_type c_nc = arg_c.columns (); int arg_a_is_empty = empty_arg ("syl", a_nr, a_nc); int arg_b_is_empty = empty_arg ("syl", b_nr, b_nc); diff -r eae7b40388e9 -r 23b37da9fd5b src/data.cc --- a/src/data.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/data.cc Fri Apr 08 16:07:37 2005 +0000 @@ -118,13 +118,13 @@ static Matrix map_d_m (d_dd_fcn f, double x, const Matrix& y) { - int nr = y.rows (); - int nc = y.columns (); + octave_idx_type nr = y.rows (); + octave_idx_type nc = y.columns (); Matrix retval (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; retval (i, j) = f (x, y (i, j)); @@ -136,13 +136,13 @@ static Matrix map_m_d (d_dd_fcn f, const Matrix& x, double y) { - int nr = x.rows (); - int nc = x.columns (); + octave_idx_type nr = x.rows (); + octave_idx_type nc = x.columns (); Matrix retval (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; retval (i, j) = f (x (i, j), y); @@ -154,18 +154,18 @@ static Matrix map_m_m (d_dd_fcn f, const Matrix& x, const Matrix& y) { - int x_nr = x.rows (); - int x_nc = x.columns (); + octave_idx_type x_nr = x.rows (); + octave_idx_type x_nc = x.columns (); - int y_nr = y.rows (); - int y_nc = y.columns (); + octave_idx_type y_nr = y.rows (); + octave_idx_type y_nc = y.columns (); assert (x_nr == y_nr && x_nc == y_nc); Matrix retval (x_nr, x_nc); - for (int j = 0; j < x_nc; j++) - for (int i = 0; i < x_nr; i++) + for (octave_idx_type j = 0; j < x_nc; j++) + for (octave_idx_type i = 0; i < x_nr; i++) { OCTAVE_QUIT; retval (i, j) = f (x (i, j), y (i, j)); @@ -190,11 +190,11 @@ octave_value arg_y = args(0); octave_value arg_x = args(1); - int y_nr = arg_y.rows (); - int y_nc = arg_y.columns (); + octave_idx_type y_nr = arg_y.rows (); + octave_idx_type y_nc = arg_y.columns (); - int x_nr = arg_x.rows (); - int x_nc = arg_x.columns (); + octave_idx_type x_nr = arg_x.rows (); + octave_idx_type x_nc = arg_x.columns (); int arg_y_empty = empty_arg ("atan2", y_nr, y_nc); int arg_x_empty = empty_arg ("atan2", x_nr, x_nc); @@ -204,8 +204,8 @@ else if (arg_y_empty || arg_x_empty) return retval; - int y_is_scalar = (y_nr == 1 && y_nc == 1); - int x_is_scalar = (x_nr == 1 && x_nc == 1); + octave_idx_type y_is_scalar = (y_nr == 1 && y_nc == 1); + octave_idx_type x_is_scalar = (x_nr == 1 && x_nc == 1); if (y_is_scalar && x_is_scalar) { @@ -281,11 +281,11 @@ octave_value arg_x = args(0); octave_value arg_y = args(1); - int y_nr = arg_y.rows (); - int y_nc = arg_y.columns (); + octave_idx_type y_nr = arg_y.rows (); + octave_idx_type y_nc = arg_y.columns (); - int x_nr = arg_x.rows (); - int x_nc = arg_x.columns (); + octave_idx_type x_nr = arg_x.rows (); + octave_idx_type x_nc = arg_x.columns (); int arg_y_empty = empty_arg ("fmod", y_nr, y_nc); int arg_x_empty = empty_arg ("fmod", x_nr, x_nc); @@ -295,8 +295,8 @@ else if (arg_y_empty || arg_x_empty) return retval; - int y_is_scalar = (y_nr == 1 && y_nc == 1); - int x_is_scalar = (x_nr == 1 && x_nc == 1); + octave_idx_type y_is_scalar = (y_nr == 1 && y_nc == 1); + octave_idx_type x_is_scalar = (x_nr == 1 && x_nc == 1); if (y_is_scalar && x_is_scalar) { @@ -433,16 +433,16 @@ // some template functions or macros. static octave_value -make_diag (const Matrix& v, int k) +make_diag (const Matrix& v, octave_idx_type k) { - int nr = v.rows (); - int nc = v.columns (); + octave_idx_type nr = v.rows (); + octave_idx_type nc = v.columns (); assert (nc == 1 || nr == 1); octave_value retval; - int roff = 0; - int coff = 0; + octave_idx_type roff = 0; + octave_idx_type coff = 0; if (k > 0) { roff = 0; @@ -456,17 +456,17 @@ if (nr == 1) { - int n = nc + std::abs (k); + octave_idx_type n = nc + std::abs (k); Matrix m (n, n, 0.0); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) m (i+roff, i+coff) = v (0, i); retval = m; } else { - int n = nr + std::abs (k); + octave_idx_type n = nr + std::abs (k); Matrix m (n, n, 0.0); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) m (i+roff, i+coff) = v (i, 0); retval = m; } @@ -475,16 +475,16 @@ } static octave_value -make_diag (const ComplexMatrix& v, int k) +make_diag (const ComplexMatrix& v, octave_idx_type k) { - int nr = v.rows (); - int nc = v.columns (); + octave_idx_type nr = v.rows (); + octave_idx_type nc = v.columns (); assert (nc == 1 || nr == 1); octave_value retval; - int roff = 0; - int coff = 0; + octave_idx_type roff = 0; + octave_idx_type coff = 0; if (k > 0) { roff = 0; @@ -498,17 +498,17 @@ if (nr == 1) { - int n = nc + std::abs (k); + octave_idx_type n = nc + std::abs (k); ComplexMatrix m (n, n, 0.0); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) m (i+roff, i+coff) = v (0, i); retval = m; } else { - int n = nr + std::abs (k); + octave_idx_type n = nr + std::abs (k); ComplexMatrix m (n, n, 0.0); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) m (i+roff, i+coff) = v (i, 0); retval = m; } @@ -527,8 +527,8 @@ if (! error_state) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nr == 0 || nc == 0) retval = Matrix (); @@ -550,8 +550,8 @@ if (! error_state) { - int nr = cm.rows (); - int nc = cm.columns (); + octave_idx_type nr = cm.rows (); + octave_idx_type nc = cm.columns (); if (nr == 0 || nc == 0) retval = Matrix (); @@ -578,7 +578,7 @@ { octave_value retval; - int k = b.int_value (); + octave_idx_type k = b.int_value (); if (error_state) { @@ -592,8 +592,8 @@ if (! error_state) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nr == 1 || nc == 1) retval = make_diag (m, k); @@ -612,8 +612,8 @@ if (! error_state) { - int nr = cm.rows (); - int nc = cm.columns (); + octave_idx_type nr = cm.rows (); + octave_idx_type nc = cm.columns (); if (nr == 1 || nc == 1) retval = make_diag (cm, k); @@ -688,7 +688,7 @@ if (n_args > 2) { - int dim = args(0).int_value () - 1; + octave_idx_type dim = args(0).int_value () - 1; if (error_state) { @@ -1057,7 +1057,7 @@ } else if (nargin == 2 && nargout < 2) { - int nd = args(1).int_value (true); + octave_idx_type nd = args(1).int_value (true); if (error_state) error ("size: expecting scalar as second argument"); @@ -1582,7 +1582,7 @@ case 1: { - int nr, nc; + octave_idx_type nr, nc; get_dimensions (args(0), "eye", nr, nc); if (! error_state) @@ -1592,7 +1592,7 @@ case 2: { - int nr, nc; + octave_idx_type nr, nc; get_dimensions (args(0), args(1), "eye", nr, nc); if (! error_state) @@ -1791,7 +1791,7 @@ new_dims.resize (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) new_dims(i) = new_size(i); octave_value arg = args(0); diff -r eae7b40388e9 -r 23b37da9fd5b src/defaults.cc --- a/src/defaults.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/defaults.cc Fri Apr 08 16:07:37 2005 +0000 @@ -113,16 +113,16 @@ input_from_startup_file = true; - int a_len = a.length (); - int b_len = b.length (); + octave_idx_type a_len = a.length (); + octave_idx_type b_len = b.length (); - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) { std::string a_dir = a[i]; bool found = false; - for (int j = 0; j < b_len; j++) + for (octave_idx_type j = 0; j < b_len; j++) { if (b[j] == a_dir) { @@ -183,7 +183,7 @@ if (Voctave_home != prefix) { - int len = prefix.length (); + octave_idx_type len = prefix.length (); size_t start = 0; while ((start = retval.find (prefix, start)) != NPOS) { diff -r eae7b40388e9 -r 23b37da9fd5b src/dirfns.cc --- a/src/dirfns.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/dirfns.cc Fri Apr 08 16:07:37 2005 +0000 @@ -614,11 +614,11 @@ Array tmp = pattern.match (str); - int n = tmp.length (); + octave_idx_type n = tmp.length (); ColumnVector result (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) result(i) = tmp(i); retval = result; diff -r eae7b40388e9 -r 23b37da9fd5b src/file-io.cc --- a/src/file-io.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/file-io.cc Fri Apr 08 16:07:37 2005 +0000 @@ -1038,7 +1038,7 @@ { std::string fmt = args(1).string_value (); - int count = 0; + octave_idx_type count = 0; Array size = (nargin == 3) ? args(2).vector_value () @@ -1126,7 +1126,7 @@ { std::string fmt = args(1).string_value (); - int count = 0; + octave_idx_type count = 0; Array size = (nargin == 3) ? args(2).vector_value () @@ -1186,7 +1186,7 @@ static octave_value do_fread (octave_stream& os, const octave_value& size_arg, const octave_value& prec_arg, const octave_value& skip_arg, - const octave_value& arch_arg, int& count) + const octave_value& arch_arg, octave_idx_type& count) { octave_value retval; @@ -1448,7 +1448,7 @@ if (nargin > idx) arch = args(idx++); - int count = -1; + octave_idx_type count = -1; octave_value tmp = do_fread (os, size, prec, skip, arch, count); diff -r eae7b40388e9 -r 23b37da9fd5b src/gripes.cc --- a/src/gripes.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/gripes.cc Fri Apr 08 16:07:37 2005 +0000 @@ -53,7 +53,7 @@ } void -gripe_nonconformant (int r1, int c1, int r2, int c2) +gripe_nonconformant (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) { error ("nonconformant matrices (op1 is %dx%d, op2 is %dx%d)", r1, c1, r2, c2); diff -r eae7b40388e9 -r 23b37da9fd5b src/gripes.h --- a/src/gripes.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/gripes.h Fri Apr 08 16:07:37 2005 +0000 @@ -25,6 +25,8 @@ #include +#include "oct-types.h" + class octave_value; extern void @@ -40,7 +42,7 @@ gripe_nonconformant (void); extern void -gripe_nonconformant (int r1, int c1, int r2, int c2); +gripe_nonconformant (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2); extern void gripe_empty_arg (const char *name, bool is_error); diff -r eae7b40388e9 -r 23b37da9fd5b src/ls-mat-ascii.cc --- a/src/ls-mat-ascii.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ls-mat-ascii.cc Fri Apr 08 16:07:37 2005 +0000 @@ -108,7 +108,7 @@ } static void -get_lines_and_columns (std::istream& is, const std::string& filename, int& nr, int& nc) +get_lines_and_columns (std::istream& is, const std::string& filename, octave_idx_type& nr, octave_idx_type& nc) { std::streampos pos = is.tellg (); @@ -138,7 +138,7 @@ beg = NPOS; } - int tmp_nc = 0; + octave_idx_type tmp_nc = 0; while (beg != NPOS) { @@ -228,8 +228,8 @@ if (valid_identifier (varname)) { - int nr = 0; - int nc = 0; + octave_idx_type nr = 0; + octave_idx_type nc = 0; int total_count = 0; @@ -246,7 +246,7 @@ else { double d; - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { std::string buf = get_mat_data_input_line (is); @@ -256,7 +256,7 @@ std::istrstream tmp_stream (buf.c_str ()); #endif - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { OCTAVE_QUIT; @@ -305,7 +305,7 @@ if (is.eof ()) is.clear (); - int expected = nr * nc; + octave_idx_type expected = nr * nc; if (expected == total_count) { diff -r eae7b40388e9 -r 23b37da9fd5b src/ls-mat4.cc --- a/src/ls-mat4.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ls-mat4.cc Fri Apr 08 16:07:37 2005 +0000 @@ -332,7 +332,7 @@ if (order) { - int tmp = nr; + octave_idx_type tmp = nr; nr = nc; nc = tmp; } @@ -362,8 +362,8 @@ ComplexMatrix ctmp (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) ctmp (i, j) = Complex (re (i, j), im (i, j)); tc = order ? ctmp.transpose () : ctmp; @@ -406,7 +406,7 @@ FOUR_BYTE_INT nc = tc.columns (); os.write (X_CAST (char *, &nc), 4); - int len = nr * nc; + octave_idx_type len = nr * nc; FOUR_BYTE_INT imag = tc.is_complex_type () ? 1 : 0; os.write (X_CAST (char *, &imag), 4); @@ -425,17 +425,17 @@ charMatrix chm = tc.char_matrix_value (); - int nrow = chm.rows (); - int ncol = chm.cols (); + octave_idx_type nrow = chm.rows (); + octave_idx_type ncol = chm.cols (); OCTAVE_LOCAL_BUFFER (double, buf, ncol*nrow); - for (int i = 0; i < nrow; i++) + for (octave_idx_type i = 0; i < nrow; i++) { std::string tstr = chm.row_as_string (i); const char *s = tstr.data (); - for (int j = 0; j < ncol; j++) + for (octave_idx_type j = 0; j < ncol; j++) buf[j*nrow+i] = static_cast (*s++ & 0x00FF); } os.write ((char *)buf, nrow*ncol*sizeof(double)); @@ -447,8 +447,8 @@ Range r = tc.range_value (); double base = r.base (); double inc = r.inc (); - int nel = r.nelem (); - for (int i = 0; i < nel; i++) + octave_idx_type nel = r.nelem (); + for (octave_idx_type i = 0; i < nel; i++) { double x = base + i * inc; os.write (X_CAST (char *, &x), 8); diff -r eae7b40388e9 -r 23b37da9fd5b src/ls-mat5.cc --- a/src/ls-mat5.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ls-mat5.cc Fri Apr 08 16:07:37 2005 +0000 @@ -586,7 +586,9 @@ // Setup return value if (imag) { - scm = SparseComplexMatrix (nr, nc, nnz); + scm = SparseComplexMatrix (static_cast (nr), + static_cast (nc), + static_cast (nnz)); ridx = scm.ridx (); cidx = scm.cidx (); re = NDArray (dim_vector (static_cast (nnz))); @@ -594,7 +596,9 @@ } else { - sm = SparseMatrix (nr, nc, nnz); + sm = SparseMatrix (static_cast (nr), + static_cast (nc), + static_cast (nnz)); ridx = sm.ridx (); cidx = sm.cidx (); data = sm.data (); diff -r eae7b40388e9 -r 23b37da9fd5b src/ls-oct-ascii.cc --- a/src/ls-oct-ascii.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ls-oct-ascii.cc Fri Apr 08 16:07:37 2005 +0000 @@ -74,15 +74,15 @@ static Matrix strip_infnan (const Matrix& m) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); Matrix retval (nr, nc); - int k = 0; - for (int i = 0; i < nr; i++) + octave_idx_type k = 0; + for (octave_idx_type i = 0; i < nr; i++) { - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { double d = m (i, j); if (xisnan (d)) @@ -178,127 +178,6 @@ return retval; } -// Match KEYWORD on stream IS, placing the associated value in VALUE, -// returning TRUE if successful and FALSE otherwise. -// -// Input should look something like: -// -// [%#][ \t]*keyword[ \t]*int-value.*\n - -bool -extract_keyword (std::istream& is, const char *keyword, int& value, - const bool next_only) -{ - bool status = false; - value = 0; - - char c; - while (is.get (c)) - { - if (c == '%' || c == '#') - { - OSSTREAM buf; - - while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#')) - ; // Skip whitespace and comment characters. - - if (isalpha (c)) - buf << c; - - while (is.get (c) && isalpha (c)) - buf << c; - - buf << OSSTREAM_ENDS; - const char *tmp = OSSTREAM_C_STR (buf); - int match = (strncmp (tmp, keyword, strlen (keyword)) == 0); - OSSTREAM_FREEZE (buf); - - if (match) - { - while (is.get (c) && (c == ' ' || c == '\t' || c == ':')) - ; // Skip whitespace and the colon. - - is.putback (c); - if (c != '\n') - is >> value; - if (is) - status = true; - while (is.get (c) && c != '\n') - ; // Skip to beginning of next line; - break; - } - else if (next_only) - break; - } - } - return status; -} - -// Match one of the elements in KEYWORDS on stream IS, placing the -// matched keyword in KW and the associated value in VALUE, -// returning TRUE if successful and FALSE otherwise. -// -// Input should look something like: -// -// [%#][ \t]*keyword[ \t]*int-value.*\n - -bool -extract_keyword (std::istream& is, const string_vector& keywords, - std::string& kw, int& value, const bool next_only) -{ - bool status = false; - kw = ""; - value = 0; - - char c; - while (is.get (c)) - { - if (c == '%' || c == '#') - { - OSSTREAM buf; - - while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#')) - ; // Skip whitespace and comment characters. - - if (isalpha (c)) - buf << c; - - while (is.get (c) && isalpha (c)) - buf << c; - - buf << OSSTREAM_ENDS; - std::string tmp = OSSTREAM_STR (buf); - OSSTREAM_FREEZE (buf); - - for (int i = 0; i < keywords.length (); i++) - { - int match = (tmp == keywords[i]); - - if (match) - { - kw = keywords[i]; - - while (is.get (c) && (c == ' ' || c == '\t' || c == ':')) - ; // Skip whitespace and the colon. - - is.putback (c); - if (c != '\n') - is >> value; - if (is) - status = true; - while (is.get (c) && c != '\n') - ; // Skip to beginning of next line; - return status; - } - } - - if (next_only) - break; - } - } - return status; -} - // Extract one value (scalar, matrix, string, etc.) from stream IS and // place it in TC, returning the name of the variable. If the value // is tagged as global in the file, return TRUE in GLOBAL. @@ -523,8 +402,8 @@ { bool fail = false; - int nr = tc.rows (); - int nc = tc.columns (); + octave_idx_type nr = tc.rows (); + octave_idx_type nc = tc.columns (); if (tc.is_real_matrix ()) { @@ -535,7 +414,7 @@ if (parametric) { - int extras = nc % 3; + octave_idx_type extras = nc % 3; if (extras) warning ("ignoring last %d columns", extras); @@ -543,7 +422,7 @@ tmp = strip_infnan (tmp); nr = tmp.rows (); - for (int i = 0; i < nc-extras; i += 3) + for (octave_idx_type i = 0; i < nc-extras; i += 3) { os << tmp.extract (0, i, nr-1, i+2); if (i+3 < nc-extras) @@ -556,7 +435,7 @@ tmp = strip_infnan (tmp); nr = tmp.rows (); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { os << tmp.extract (0, i, nr-1, i); if (i+1 < nc) diff -r eae7b40388e9 -r 23b37da9fd5b src/ls-oct-ascii.h --- a/src/ls-oct-ascii.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ls-oct-ascii.h Fri Apr 08 16:07:37 2005 +0000 @@ -27,6 +27,7 @@ #include +#include "lo-sstream.h" #include "str-vec.h" // Flag for cell elements @@ -42,15 +43,6 @@ extract_keyword (std::istream& is, const char *keyword, const bool next_only = false); -extern bool -extract_keyword (std::istream& is, const char *keyword, int& value, - const bool next_only = false); - -extern bool -extract_keyword (std::istream& is, const string_vector& keywords, - std::string& keyword, int& value, - const bool next_only = false); - extern std::string read_ascii_data (std::istream& is, const std::string& filename, bool& global, octave_value& tc, int count); @@ -65,6 +57,129 @@ save_ascii_data_for_plotting (std::ostream& os, const octave_value& t, const std::string& name); +// Match KEYWORD on stream IS, placing the associated value in VALUE, +// returning TRUE if successful and FALSE otherwise. +// +// Input should look something like: +// +// [%#][ \t]*keyword[ \t]*int-value.*\n + +template +bool +extract_keyword (std::istream& is, const char *keyword, T& value, + const bool next_only = false) +{ + bool status = false; + value = 0; + + char c; + while (is.get (c)) + { + if (c == '%' || c == '#') + { + OSSTREAM buf; + + while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#')) + ; // Skip whitespace and comment characters. + + if (isalpha (c)) + buf << c; + + while (is.get (c) && isalpha (c)) + buf << c; + + buf << OSSTREAM_ENDS; + const char *tmp = OSSTREAM_C_STR (buf); + int match = (strncmp (tmp, keyword, strlen (keyword)) == 0); + OSSTREAM_FREEZE (buf); + + if (match) + { + while (is.get (c) && (c == ' ' || c == '\t' || c == ':')) + ; // Skip whitespace and the colon. + + is.putback (c); + if (c != '\n') + is >> value; + if (is) + status = true; + while (is.get (c) && c != '\n') + ; // Skip to beginning of next line; + break; + } + else if (next_only) + break; + } + } + return status; +} + +// Match one of the elements in KEYWORDS on stream IS, placing the +// matched keyword in KW and the associated value in VALUE, +// returning TRUE if successful and FALSE otherwise. +// +// Input should look something like: +// +// [%#][ \t]*keyword[ \t]*int-value.*\n + +template +bool +extract_keyword (std::istream& is, const string_vector& keywords, + std::string& kw, T& value, const bool next_only = false) +{ + bool status = false; + kw = ""; + value = 0; + + char c; + while (is.get (c)) + { + if (c == '%' || c == '#') + { + OSSTREAM buf; + + while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#')) + ; // Skip whitespace and comment characters. + + if (isalpha (c)) + buf << c; + + while (is.get (c) && isalpha (c)) + buf << c; + + buf << OSSTREAM_ENDS; + std::string tmp = OSSTREAM_STR (buf); + OSSTREAM_FREEZE (buf); + + for (int i = 0; i < keywords.length (); i++) + { + int match = (tmp == keywords[i]); + + if (match) + { + kw = keywords[i]; + + while (is.get (c) && (c == ' ' || c == '\t' || c == ':')) + ; // Skip whitespace and the colon. + + is.putback (c); + if (c != '\n') + is >> value; + if (is) + status = true; + while (is.get (c) && c != '\n') + ; // Skip to beginning of next line; + return status; + } + } + + if (next_only) + break; + } + } + return status; +} + #endif /* diff -r eae7b40388e9 -r 23b37da9fd5b src/oct-conf.h.in --- a/src/oct-conf.h.in Thu Apr 07 21:51:37 2005 +0000 +++ b/src/oct-conf.h.in Fri Apr 08 16:07:37 2005 +0000 @@ -284,6 +284,10 @@ #define OCTAVE_CONF_UGLY_DEFS %OCTAVE_CONF_UGLY_DEFS% #endif +#ifndef OCTAVE_CONF_USE_64_BIT_IDX_T +#define OCTAVE_CONF_USE_64_BIT_IDX_T %OCTAVE_CONF_USE_64_BIT_IDX_T% +#endif + #ifndef OCTAVE_CONF_ENABLE_DYNAMIC_LINKING #define OCTAVE_CONF_ENABLE_DYNAMIC_LINKING %OCTAVE_CONF_ENABLE_DYNAMIC_LINKING% #endif diff -r eae7b40388e9 -r 23b37da9fd5b src/oct-map.cc --- a/src/oct-map.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/oct-map.cc Fri Apr 08 16:07:37 2005 +0000 @@ -68,11 +68,11 @@ string_vector Octave_map::keys (void) const { - int len = length (); + octave_idx_type len = length (); string_vector names (len); - int i = 0; + octave_idx_type i = 0; for (const_iterator p = begin (); p != end (); p++) names[i++] = key (p); @@ -97,10 +97,10 @@ return retval; } -int +octave_idx_type Octave_map::numel (void) const { - int retval; + octave_idx_type retval; if (empty ()) retval = 0; @@ -137,7 +137,7 @@ } Octave_map -Octave_map::concat (const Octave_map& rb, const Array& ra_idx) +Octave_map::concat (const Octave_map& rb, const Array& ra_idx) { Octave_map retval; @@ -171,12 +171,12 @@ string_vector a_keys = a.keys().qsort (); string_vector b_keys = b.keys().qsort (); - int a_len = a_keys.length (); - int b_len = b_keys.length (); + octave_idx_type a_len = a_keys.length (); + octave_idx_type b_len = b_keys.length (); if (a_len == b_len) { - for (int i = 0; i < a_len; i++) + for (octave_idx_type i = 0; i < a_len; i++) { if (a_keys[i] != b_keys[i]) return retval; @@ -195,9 +195,9 @@ if (! t_keys.empty ()) { - int len = t_keys.length (); + octave_idx_type len = t_keys.length (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { std::string k = t_keys[i]; @@ -220,25 +220,25 @@ { dim_vector retval; - int a_len = a.length (); - int b_len = b.length (); + octave_idx_type a_len = a.length (); + octave_idx_type b_len = b.length (); - int new_len = std::max (a_len, b_len); - int min_len = std::min (a_len, b_len); + octave_idx_type new_len = std::max (a_len, b_len); + octave_idx_type min_len = std::min (a_len, b_len); retval.resize (new_len); - for (int i = 0; i < min_len; i++) + for (octave_idx_type i = 0; i < min_len; i++) retval(i) = std::max (a(i), b(i)); if (a_len < b_len) { - for (int i = min_len; i < b_len; i++) + for (octave_idx_type i = min_len; i < b_len; i++) retval(i) = b(i); } else if (a_len > b_len) { - for (int i = min_len; i < a_len; i++) + for (octave_idx_type i = min_len; i < a_len; i++) retval(i) = a(i); } diff -r eae7b40388e9 -r 23b37da9fd5b src/oct-map.h --- a/src/oct-map.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/oct-map.h Fri Apr 08 16:07:37 2005 +0000 @@ -71,7 +71,7 @@ ~Octave_map (void) { } // This is the number of keys. - int length (void) const { return map.size (); } + octave_idx_type length (void) const { return map.size (); } int empty (void) const { return map.empty (); } @@ -109,9 +109,9 @@ string_vector keys (void) const; - int rows (void) const { return dimensions(0); } + octave_idx_type rows (void) const { return dimensions(0); } - int columns (void) const { return dimensions(1); } + octave_idx_type columns (void) const { return dimensions(1); } dim_vector dims (void) const { return dimensions; } @@ -119,9 +119,9 @@ Octave_map resize (const dim_vector& dv) const; - int numel (void) const; + octave_idx_type numel (void) const; - Octave_map concat (const Octave_map& rb, const Array& ra_idx); + Octave_map concat (const Octave_map& rb, const Array& ra_idx); Octave_map& assign (const octave_value_list& idx, const Octave_map& rhs); diff -r eae7b40388e9 -r 23b37da9fd5b src/oct-obj.cc --- a/src/oct-obj.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/oct-obj.cc Fri Apr 08 16:07:37 2005 +0000 @@ -33,9 +33,9 @@ bool octave_value_list::valid_scalar_indices (void) const { - int n = length (); + octave_idx_type n = length (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) if (! data[i].valid_as_scalar_index ()) return false; @@ -43,15 +43,15 @@ } void -octave_value_list::resize (int n, const octave_value& val) +octave_value_list::resize (octave_idx_type n, const octave_value& val) { - int len = length (); + octave_idx_type len = length (); if (n > len) { data.resize (n); - for (int i = len; i < n; i++) + for (octave_idx_type i = len; i < n; i++) data[i] = val; } else if (n < len) @@ -61,7 +61,7 @@ octave_value_list& octave_value_list::prepend (const octave_value& val) { - int n = length (); + octave_idx_type n = length (); resize (n + 1); @@ -79,7 +79,7 @@ octave_value_list& octave_value_list::append (const octave_value& val) { - int n = length (); + octave_idx_type n = length (); resize (n + 1); @@ -91,12 +91,12 @@ octave_value_list& octave_value_list::append (const octave_value_list& lst) { - int len = length (); - int lst_len = lst.length (); + octave_idx_type len = length (); + octave_idx_type lst_len = lst.length (); resize (len + lst_len); - for (int i = 0; i < lst_len; i++) + for (octave_idx_type i = 0; i < lst_len; i++) elem (len + i) = lst (i); return *this; @@ -105,9 +105,9 @@ octave_value_list& octave_value_list::reverse (void) { - int n = length (); + octave_idx_type n = length (); - for (int i = 0; i < n / 2; i++) + for (octave_idx_type i = 0; i < n / 2; i++) { octave_value tmp = elem (i); elem (i) = elem (n - i - 1); @@ -118,12 +118,12 @@ } octave_value_list -octave_value_list::splice (int offset, int rep_length, +octave_value_list::splice (octave_idx_type offset, octave_idx_type rep_length, const octave_value_list& lst) const { octave_value_list retval; - int len = length (); + octave_idx_type len = length (); if (offset < 0 || offset >= len) { @@ -140,21 +140,21 @@ return retval; } - int lst_len = lst.length (); + octave_idx_type lst_len = lst.length (); - int new_len = len - rep_length + lst_len; + octave_idx_type new_len = len - rep_length + lst_len; retval.resize (new_len); - int k = 0; + octave_idx_type k = 0; - for (int i = 0; i < offset; i++) + for (octave_idx_type i = 0; i < offset; i++) retval(k++) = elem (i); - for (int i = 0; i < lst_len; i++) + for (octave_idx_type i = 0; i < lst_len; i++) retval(k++) = lst(i); - for (int i = offset + rep_length; i < len; i++) + for (octave_idx_type i = offset + rep_length; i < len; i++) retval(k++) = elem (i); return retval; @@ -163,9 +163,9 @@ bool octave_value_list::all_strings_p (void) const { - int n = length (); + octave_idx_type n = length (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) if (! elem(i).is_string ()) return 0; @@ -179,16 +179,16 @@ if (all_strings_p ()) { - int len = length (); + octave_idx_type len = length (); - int total_nr = 0; + octave_idx_type total_nr = 0; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { // An empty std::string ("") has zero columns and zero rows (a // change that was made for Matlab contemptibility. - int n = elem(i).rows (); + octave_idx_type n = elem(i).rows (); total_nr += n ? n : 1; } @@ -197,10 +197,10 @@ argv[0] = fcn_name; - int k = 1; - for (int i = 0; i < len; i++) + octave_idx_type k = 1; + for (octave_idx_type i = 0; i < len; i++) { - int nr = elem(i).rows (); + octave_idx_type nr = elem(i).rows (); if (nr < 2) argv[k++] = elem(i).string_value (); @@ -208,7 +208,7 @@ { string_vector tmp = elem(i).all_strings (); - for (int j = 0; j < nr; j++) + for (octave_idx_type j = 0; j < nr; j++) argv[k++] = tmp[j]; } } diff -r eae7b40388e9 -r 23b37da9fd5b src/oct-obj.h --- a/src/oct-obj.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/oct-obj.h Fri Apr 08 16:07:37 2005 +0000 @@ -39,7 +39,7 @@ octave_value_list (void) : data () { } - octave_value_list (int n, const octave_value& val) + octave_value_list (octave_idx_type n, const octave_value& val) : data (n, val) { } octave_value_list (const octave_value& tc) @@ -85,17 +85,17 @@ // Assignment will resize on range errors. - octave_value& operator () (int n) { return elem (n); } + octave_value& operator () (octave_idx_type n) { return elem (n); } - octave_value operator () (int n) const { return elem (n); } + octave_value operator () (octave_idx_type n) const { return elem (n); } - int length (void) const { return data.size (); } + octave_idx_type length (void) const { return data.size (); } bool empty (void) const { return length () == 0; } - void resize (int n) { data.resize (n); } + void resize (octave_idx_type n) { data.resize (n); } - void resize (int n, const octave_value& val); + void resize (octave_idx_type n, const octave_value& val); octave_value_list& prepend (const octave_value& val); @@ -105,7 +105,7 @@ octave_value_list& reverse (void); - octave_value_list splice (int offset, int length, + octave_value_list splice (octave_idx_type offset, octave_idx_type length, const octave_value_list& lst) const; bool all_strings_p (void) const; @@ -140,11 +140,11 @@ // and supply a default value to create a vector-valued // octave_value_list. - octave_value_list (int n); + octave_value_list (octave_idx_type n); octave_value_list (const Array& d); - octave_value& elem (int n) + octave_value& elem (octave_idx_type n) { static Matrix empty_matrix; @@ -154,7 +154,7 @@ return data[n]; } - octave_value elem (int n) const + octave_value elem (octave_idx_type n) const { #if defined (BOUNDS_CHECKING) return data.at (n); diff -r eae7b40388e9 -r 23b37da9fd5b src/oct-stream.cc --- a/src/oct-stream.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/oct-stream.cc Fri Apr 08 16:07:37 2005 +0000 @@ -112,7 +112,7 @@ } static void -get_size (const Array& size, int& nr, int& nc, bool& one_elt_size_spec, +get_size (const Array& size, octave_idx_type& nr, octave_idx_type& nc, bool& one_elt_size_spec, const std::string& who) { nr = -1; @@ -123,7 +123,7 @@ double dnr = -1.0; double dnc = -1.0; - int sz_len = size.length (); + octave_idx_type sz_len = size.length (); if (sz_len == 1) { @@ -234,9 +234,9 @@ scanf_format_list::~scanf_format_list (void) { - int n = list.length (); - - for (int i = 0; i < n; i++) + octave_idx_type n = list.length (); + + for (octave_idx_type i = 0; i < n; i++) { scanf_format_elt *elt = list(i); delete elt; @@ -963,7 +963,7 @@ // are those that define is). std::string -octave_base_stream::do_gets (int max_len, bool& err, +octave_base_stream::do_gets (octave_idx_type max_len, bool& err, bool strip_newline, const std::string& who) { std::string retval; @@ -1028,13 +1028,13 @@ } std::string -octave_base_stream::getl (int max_len, bool& err, const std::string& who) +octave_base_stream::getl (octave_idx_type max_len, bool& err, const std::string& who) { return do_gets (max_len, err, true, who); } std::string -octave_base_stream::gets (int max_len, bool& err, const std::string& who) +octave_base_stream::gets (octave_idx_type max_len, bool& err, const std::string& who) { return do_gets (max_len, err, false, who); } @@ -1325,8 +1325,8 @@ template void do_scanf_conv (std::istream& is, const scanf_format_elt& fmt, - T valptr, Matrix& mval, double *data, int& idx, - int& conversion_count, int nr, int max_size, + 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) { OCTAVE_SCAN (is, fmt, valptr); @@ -1355,37 +1355,37 @@ template void do_scanf_conv (std::istream&, const scanf_format_elt&, int*, - Matrix&, double*, int&, int&, int, int, bool); + Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); template void do_scanf_conv (std::istream&, const scanf_format_elt&, long int*, - Matrix&, double*, int&, int&, int, int, bool); + Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); template void do_scanf_conv (std::istream&, const scanf_format_elt&, short int*, - Matrix&, double*, int&, int&, int, int, bool); + Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); template void do_scanf_conv (std::istream&, const scanf_format_elt&, unsigned int*, - Matrix&, double*, int&, int&, int, int, bool); + Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); template void do_scanf_conv (std::istream&, const scanf_format_elt&, unsigned long int*, - Matrix&, double*, int&, int&, int, int, bool); + Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); template void do_scanf_conv (std::istream&, const scanf_format_elt&, unsigned short int*, - Matrix&, double*, int&, int&, int, int, bool); + Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); #if 0 template void do_scanf_conv (std::istream&, const scanf_format_elt&, float*, - Matrix&, double*, int&, int&, int, int, bool); + Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); #endif template void do_scanf_conv (std::istream&, const scanf_format_elt&, double*, - Matrix&, double*, int&, int&, int, int, bool); + Matrix&, double*, octave_idx_type&, octave_idx_type&, octave_idx_type, octave_idx_type, bool); #define DO_WHITESPACE_CONVERSION() \ do \ @@ -1595,14 +1595,14 @@ octave_value octave_base_stream::do_scanf (scanf_format_list& fmt_list, - int nr, int nc, bool one_elt_size_spec, - int& conversion_count, const std::string& who) + octave_idx_type nr, octave_idx_type nc, bool one_elt_size_spec, + octave_idx_type& conversion_count, const std::string& who) { conversion_count = 0; int nconv = fmt_list.num_conversions (); - int data_index = 0; + octave_idx_type data_index = 0; octave_value retval = Matrix (); @@ -1620,11 +1620,11 @@ Matrix mval; double *data = 0; - int max_size = 0; - int max_conv = 0; - - int final_nr = 0; - int final_nc = 0; + octave_idx_type max_size = 0; + octave_idx_type max_conv = 0; + + octave_idx_type final_nr = 0; + octave_idx_type final_nc = 0; if (all_char_conv) { @@ -1956,7 +1956,7 @@ octave_value octave_base_stream::scanf (const std::string& fmt, const Array& size, - int& conversion_count, const std::string& who) + octave_idx_type& conversion_count, const std::string& who) { octave_value retval = Matrix (); @@ -1972,8 +1972,8 @@ ::error ("%s: invalid format specified", who.c_str ()); else { - int nr = -1; - int nc = -1; + octave_idx_type nr = -1; + octave_idx_type nc = -1; bool one_elt_size_spec; @@ -2170,7 +2170,7 @@ bool quit = false; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { octave_value tmp; @@ -2378,15 +2378,15 @@ charMatrix chm = tval.char_matrix_value (); - int nr = chm.rows (); - int nc = chm.columns (); + octave_idx_type nr = chm.rows (); + octave_idx_type nc = chm.columns (); int k = 0; retval.resize (nr * nc, '\0'); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) retval[k++] = chm(i,j); } @@ -2771,7 +2771,7 @@ } std::string -octave_stream::getl (int max_len, bool& err, const std::string& who) +octave_stream::getl (octave_idx_type max_len, bool& err, const std::string& who) { std::string retval; @@ -2805,7 +2805,7 @@ } std::string -octave_stream::gets (int max_len, bool& err, const std::string& who) +octave_stream::gets (octave_idx_type max_len, bool& err, const std::string& who) { std::string retval; @@ -2987,9 +2987,9 @@ template octave_value -do_read (octave_stream& strm, int nr, int nc, int block_size, - int skip, bool do_float_fmt_conv, - oct_mach_info::float_format from_flt_fmt, int& count) +do_read (octave_stream& strm, octave_idx_type nr, octave_idx_type nc, octave_idx_type block_size, + octave_idx_type skip, bool do_float_fmt_conv, + oct_mach_info::float_format from_flt_fmt, octave_idx_type& count) { octave_value retval; @@ -3002,10 +3002,10 @@ typename octave_array_type_traits::element_type *dat = 0; - int max_size = 0; - - int final_nr = 0; - int final_nc = 1; + octave_idx_type max_size = 0; + + octave_idx_type final_nr = 0; + octave_idx_type final_nc = 1; if (nr > 0) { @@ -3052,7 +3052,7 @@ { std::istream& is = *isp; - int elts_read = 0; + octave_idx_type elts_read = 0; for (;;) { @@ -3150,8 +3150,8 @@ #define DO_READ_VAL_TEMPLATE(RET_T, READ_T) \ template octave_value \ - do_read (octave_stream&, int, int, int, int, bool, \ - oct_mach_info::float_format, int&) + do_read (octave_stream&, octave_idx_type, octave_idx_type, octave_idx_type, octave_idx_type, bool, \ + oct_mach_info::float_format, octave_idx_type&) // XXX FIXME XXX -- should we only have float if it is a different // size from double? @@ -3183,8 +3183,8 @@ INSTANTIATE_DO_READ (NDArray); INSTANTIATE_DO_READ (charNDArray); -typedef octave_value (*read_fptr) (octave_stream&, int, int, int, int, bool, - oct_mach_info::float_format ffmt, int&); +typedef octave_value (*read_fptr) (octave_stream&, octave_idx_type, octave_idx_type, octave_idx_type, octave_idx_type, bool, + oct_mach_info::float_format ffmt, octave_idx_type&); INSTANTIATE_ARRAY (read_fptr); template class Array2; @@ -3206,11 +3206,11 @@ read_fptr_table(R,oct_data_conv::dt_logical) = do_read octave_value -octave_stream::read (const Array& size, int block_size, +octave_stream::read (const Array& size, octave_idx_type block_size, oct_data_conv::data_type input_type, oct_data_conv::data_type output_type, - int skip, oct_mach_info::float_format ffmt, - int& char_count) + octave_idx_type skip, oct_mach_info::float_format ffmt, + octave_idx_type& char_count) { static bool initialized = false; @@ -3249,8 +3249,8 @@ char_count = 0; - int nr = -1; - int nc = -1; + octave_idx_type nr = -1; + octave_idx_type nc = -1; bool ignore; @@ -3295,12 +3295,12 @@ return retval; } -int -octave_stream::write (const octave_value& data, int block_size, - oct_data_conv::data_type output_type, int skip, +octave_idx_type +octave_stream::write (const octave_value& data, octave_idx_type block_size, + oct_data_conv::data_type output_type, octave_idx_type skip, oct_mach_info::float_format flt_fmt) { - int retval = -1; + octave_idx_type retval = -1; if (stream_ok ("fwrite")) { @@ -3309,7 +3309,7 @@ if (flt_fmt == oct_mach_info::flt_fmt_unknown) flt_fmt = float_format (); - int status = data.write (*this, block_size, output_type, + octave_idx_type status = data.write (*this, block_size, output_type, skip, flt_fmt); if (status < 0) @@ -3435,20 +3435,20 @@ } template -int -octave_stream::write (const Array& data, int block_size, +octave_idx_type +octave_stream::write (const Array& data, octave_idx_type block_size, oct_data_conv::data_type output_type, - int skip, oct_mach_info::float_format flt_fmt) + octave_idx_type skip, oct_mach_info::float_format flt_fmt) { - int retval = -1; + octave_idx_type retval = -1; bool status = true; - int count = 0; + octave_idx_type count = 0; const T *d = data.data (); - int n = data.length (); + octave_idx_type n = data.length (); oct_mach_info::float_format native_flt_fmt = oct_mach_info::float_format (); @@ -3466,7 +3466,7 @@ else swap = (flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { std::ostream *osp = output_stream (); @@ -3516,64 +3516,64 @@ return retval; } -template int -octave_stream::write (const Array&, int, +template octave_idx_type +octave_stream::write (const Array&, octave_idx_type, oct_data_conv::data_type, - int, oct_mach_info::float_format); - -template int -octave_stream::write (const Array&, int, + octave_idx_type, oct_mach_info::float_format); + +template octave_idx_type +octave_stream::write (const Array&, octave_idx_type, oct_data_conv::data_type, - int, oct_mach_info::float_format); - -template int -octave_stream::write (const Array&, int, + octave_idx_type, oct_mach_info::float_format); + +template octave_idx_type +octave_stream::write (const Array&, octave_idx_type, oct_data_conv::data_type, - int, oct_mach_info::float_format); - -template int -octave_stream::write (const Array&, int, + octave_idx_type, oct_mach_info::float_format); + +template octave_idx_type +octave_stream::write (const Array&, octave_idx_type, oct_data_conv::data_type, - int, oct_mach_info::float_format); - -template int -octave_stream::write (const Array&, int, + octave_idx_type, oct_mach_info::float_format); + +template octave_idx_type +octave_stream::write (const Array&, octave_idx_type, oct_data_conv::data_type, - int, oct_mach_info::float_format); - -template int -octave_stream::write (const Array&, int, + octave_idx_type, oct_mach_info::float_format); + +template octave_idx_type +octave_stream::write (const Array&, octave_idx_type, oct_data_conv::data_type, - int, oct_mach_info::float_format); - -template int -octave_stream::write (const Array&, int, + octave_idx_type, oct_mach_info::float_format); + +template octave_idx_type +octave_stream::write (const Array&, octave_idx_type, oct_data_conv::data_type, - int, oct_mach_info::float_format); - -template int -octave_stream::write (const Array&, int, + octave_idx_type, oct_mach_info::float_format); + +template octave_idx_type +octave_stream::write (const Array&, octave_idx_type, oct_data_conv::data_type, - int, oct_mach_info::float_format); - -template int -octave_stream::write (const Array&, int, + octave_idx_type, oct_mach_info::float_format); + +template octave_idx_type +octave_stream::write (const Array&, octave_idx_type, oct_data_conv::data_type, - int, oct_mach_info::float_format); - -template int -octave_stream::write (const Array&, int, + octave_idx_type, oct_mach_info::float_format); + +template octave_idx_type +octave_stream::write (const Array&, octave_idx_type, oct_data_conv::data_type, - int, oct_mach_info::float_format); - -template int -octave_stream::write (const Array&, int, + octave_idx_type, oct_mach_info::float_format); + +template octave_idx_type +octave_stream::write (const Array&, octave_idx_type, oct_data_conv::data_type, - int, oct_mach_info::float_format); + octave_idx_type, oct_mach_info::float_format); octave_value octave_stream::scanf (const std::string& fmt, const Array& size, - int& count, const std::string& who) + octave_idx_type& count, const std::string& who) { octave_value retval; diff -r eae7b40388e9 -r 23b37da9fd5b src/oct-stream.h --- a/src/oct-stream.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/oct-stream.h Fri Apr 08 16:07:37 2005 +0000 @@ -406,7 +406,7 @@ private: // A reference count. - int count; + octave_idx_type count; // The permission bits for the file. Should be some combination of // std::ios::open_mode bits. @@ -427,18 +427,18 @@ // Functions that are defined for all input streams (input streams // are those that define is). - std::string do_gets (int max_len, bool& err, bool strip_newline, + std::string do_gets (octave_idx_type max_len, bool& err, bool strip_newline, const std::string& who /* = "gets" */); - std::string getl (int max_len, bool& err, const std::string& who /* = "getl" */); - std::string gets (int max_len, bool& err, const std::string& who /* = "gets" */); + std::string getl (octave_idx_type max_len, bool& err, const std::string& who /* = "getl" */); + std::string gets (octave_idx_type max_len, bool& err, const std::string& who /* = "gets" */); - octave_value do_scanf (scanf_format_list& fmt_list, int nr, int nc, - bool one_elt_size_spec, int& count, + octave_value do_scanf (scanf_format_list& fmt_list, octave_idx_type nr, octave_idx_type nc, + bool one_elt_size_spec, octave_idx_type& count, const std::string& who /* = "scanf" */); octave_value scanf (const std::string& fmt, const Array& size, - int& count, const std::string& who /* = "scanf" */); + octave_idx_type& count, const std::string& who /* = "scanf" */); bool do_oscanf (const scanf_format_elt *elt, octave_value&, const std::string& who /* = "scanf" */); @@ -488,11 +488,11 @@ int flush (void); - std::string getl (int max_len, bool& err, const std::string& who /* = "getl" */); + std::string getl (octave_idx_type max_len, bool& err, const std::string& who /* = "getl" */); std::string getl (const octave_value& max_len, bool& err, const std::string& who /* = "getl" */); - std::string gets (int max_len, bool& err, const std::string& who /* = "gets" */); + std::string gets (octave_idx_type max_len, bool& err, const std::string& who /* = "gets" */); std::string gets (const octave_value& max_len, bool& err, const std::string& who /* = "gets" */); @@ -507,23 +507,23 @@ void close (void); - octave_value read (const Array& size, int block_size, + octave_value read (const Array& size, octave_idx_type block_size, oct_data_conv::data_type input_type, oct_data_conv::data_type output_type, - int skip, oct_mach_info::float_format flt_fmt, - int& count); + octave_idx_type skip, oct_mach_info::float_format flt_fmt, + octave_idx_type& count); - int write (const octave_value& data, int block_size, + octave_idx_type write (const octave_value& data, octave_idx_type block_size, oct_data_conv::data_type output_type, - int skip, oct_mach_info::float_format flt_fmt); + octave_idx_type skip, oct_mach_info::float_format flt_fmt); template - int write (const Array&, int block_size, + octave_idx_type write (const Array&, octave_idx_type block_size, oct_data_conv::data_type output_type, - int skip, oct_mach_info::float_format flt_fmt); + octave_idx_type skip, oct_mach_info::float_format flt_fmt); octave_value scanf (const std::string& fmt, const Array& size, - int& count, const std::string& who /* = "scanf" */); + octave_idx_type& count, const std::string& who /* = "scanf" */); octave_value_list oscanf (const std::string& fmt, const std::string& who /* = "scanf" */); diff -r eae7b40388e9 -r 23b37da9fd5b src/octave.cc --- a/src/octave.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/octave.cc Fri Apr 08 16:07:37 2005 +0000 @@ -74,7 +74,7 @@ #include // Kluge. -extern "C" void F77_FUNC (xerbla, XERBLA) (const char *, int, long); +extern "C" void F77_FUNC (xerbla, XERBLA) (const char *, octave_idx_type, long); extern void install_builtins (void); diff -r eae7b40388e9 -r 23b37da9fd5b src/ops.h --- a/src/ops.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ops.h Fri Apr 08 16:07:37 2005 +0000 @@ -70,13 +70,13 @@ yt yn = get_y; #define BOOL_OP2(x) \ - int nr = x.rows (); \ - int nc = x.columns (); + octave_idx_type nr = x.rows (); \ + octave_idx_type nc = x.columns (); #define BOOL_OP3(test) \ boolMatrix retval (nr, nc); \ - for (int j = 0; j < nc; j++) \ - for (int i = 0; i < nr; i++) \ + for (octave_idx_type j = 0; j < nc; j++) \ + for (octave_idx_type i = 0; i < nr; i++) \ retval (i, j) = test; \ return retval; @@ -107,10 +107,10 @@ do \ { \ BOOL_OP1 (m1t, m1n, get_m1, m2t, m2n, get_m2) \ - int m1_nr = m1n.rows (); \ - int m1_nc = m1n.cols (); \ - int m2_nr = m2n.rows (); \ - int m2_nc = m2n.cols (); \ + octave_idx_type m1_nr = m1n.rows (); \ + octave_idx_type m1_nc = m1n.cols (); \ + octave_idx_type m2_nr = m2n.rows (); \ + octave_idx_type m2_nc = m2n.cols (); \ if (m1_nr == m2_nr && m1_nc == m2_nc) \ { \ if (m1_nr == 0 && m1_nc == 0) \ diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-base-mat.cc --- a/src/ov-base-mat.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-base-mat.cc Fri Apr 08 16:07:37 2005 +0000 @@ -131,7 +131,7 @@ { octave_value retval; - int n_idx = idx.length (); + octave_idx_type n_idx = idx.length (); int nd = matrix.ndims (); @@ -169,7 +169,7 @@ { Array idx_vec (n_idx); - for (int i = 0; i < n_idx; i++) + for (octave_idx_type i = 0; i < n_idx; i++) { idx_vec(i) = idx(i).index_vector (); @@ -192,9 +192,9 @@ void octave_base_matrix::assign (const octave_value_list& idx, const MT& rhs) { - int len = idx.length (); + octave_idx_type len = idx.length (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) matrix.set_index (idx(i).index_vector ()); ::assign (matrix, rhs, MT::resize_fill_value ()); diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-base-sparse.cc --- a/src/ov-base-sparse.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-base-sparse.cc Fri Apr 08 16:07:37 2005 +0000 @@ -47,7 +47,7 @@ { octave_value retval; - int n_idx = idx.length (); + octave_idx_type n_idx = idx.length (); int nd = matrix.ndims (); @@ -84,7 +84,7 @@ { Array idx_vec (n_idx); - for (int i = 0; i < n_idx; i++) + for (octave_idx_type i = 0; i < n_idx; i++) { idx_vec(i) = idx(i).index_vector (); @@ -181,9 +181,9 @@ void octave_base_sparse::assign (const octave_value_list& idx, const T& rhs) { - int len = idx.length (); + octave_idx_type len = idx.length (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) matrix.set_index (idx(i).index_vector ()); ::assign (matrix, rhs); @@ -196,8 +196,8 @@ { bool retval = false; dim_vector dv = matrix.dims (); - int nel = dv.numel (); - int nz = nnz (); + octave_idx_type nel = dv.numel (); + octave_idx_type nz = nnz (); if (nz == nel && nel > 0) { @@ -241,9 +241,9 @@ octave_base_sparse::print_raw (std::ostream& os, bool pr_as_read_syntax) const { - int nr = matrix.rows (); - int nc = matrix.cols (); - int nz = nonzero (); + octave_idx_type nr = matrix.rows (); + octave_idx_type nc = matrix.cols (); + octave_idx_type nz = nonzero (); os << "Compressed Column Sparse (rows=" << nr << ", cols=" << nc << @@ -254,10 +254,10 @@ if (nz != 0) { - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { OCTAVE_QUIT; - for (int i = matrix.cidx(j); i < matrix.cidx(j+1); i++) + for (octave_idx_type i = matrix.cidx(j); i < matrix.cidx(j+1); i++) { os << "\n"; os << " (" << matrix.ridx(i)+1 << @@ -290,9 +290,9 @@ bool octave_base_sparse::load_ascii (std::istream& is) { - int nz = 0; - int nr = 0; - int nc = 0; + octave_idx_type nz = 0; + octave_idx_type nr = 0; + octave_idx_type nc = 0; bool success = true; if (extract_keyword (is, "nnz", nz, true) && diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-base-sparse.h --- a/src/ov-base-sparse.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-base-sparse.h Fri Apr 08 16:07:37 2005 +0000 @@ -74,8 +74,8 @@ octave_value *empty_clone (void) const { return new octave_base_sparse (); } - int nnz (void) const { return matrix.nnz (); } - int nonzero (void) const { return matrix.nonzero (); } + octave_idx_type nnz (void) const { return matrix.nnz (); } + octave_idx_type nonzero (void) const { return matrix.nonzero (); } size_t byte_size (void) const { return matrix.byte_size (); } @@ -126,7 +126,7 @@ bool is_true (void) const; - int capacity (void) const { return matrix.capacity (); } + octave_idx_type capacity (void) const { return matrix.capacity (); } bool print_as_scalar (void) const; diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-base.h --- a/src/ov-base.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-base.h Fri Apr 08 16:07:37 2005 +0000 @@ -92,9 +92,9 @@ dim_vector dims (void) const { return dim_vector (-1, -1); } - int numel (void) const { return dims ().numel (); } + octave_idx_type numel (void) const { return dims ().numel (); } - int capacity (void) const { return numel (); } + octave_idx_type capacity (void) const { return numel (); } size_t byte_size (void) const { return 0; } diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-bool-mat.cc --- a/src/ov-bool-mat.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-bool-mat.cc Fri Apr 08 16:07:37 2005 +0000 @@ -76,8 +76,8 @@ { boolMatrix bm = matrix.matrix_value (); - int nr = bm.rows (); - int nc = bm.cols (); + octave_idx_type nr = bm.rows (); + octave_idx_type nc = bm.cols (); if (nr == 1 && nc == 1) retval = new octave_bool (bm (0, 0)); @@ -160,7 +160,7 @@ NDArray tmp = array_value (); os << "# ndims: " << d.length () << "\n"; - for (int i=0; i < d.length (); i++) + for (int i = 0; i < d.length (); i++) os << " " << d (i); os << "\n" << tmp; @@ -191,13 +191,13 @@ keywords[1] = "rows"; std::string kw; - int val = 0; + octave_idx_type val = 0; if (extract_keyword (is, keywords, kw, val, true)) { if (kw == "ndims") { - int mdims = val; + int mdims = static_cast (val); if (mdims >= 0) { @@ -217,7 +217,7 @@ } boolNDArray btmp (dv); - for (int i = 0; i < btmp.nelem (); i++) + for (octave_idx_type i = 0; i < btmp.nelem (); i++) btmp.elem (i) = (tmp.elem (i) != 0.); matrix = btmp; @@ -230,8 +230,8 @@ } else if (kw == "rows") { - int nr = val; - int nc = 0; + octave_idx_type nr = val; + octave_idx_type nc = 0; if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0) { @@ -245,9 +245,9 @@ success = false; } - boolMatrix btmp (nr,nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + boolMatrix btmp (nr, nc); + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) btmp.elem (i,j) = (tmp.elem (i, j) != 0.); matrix = btmp; @@ -286,7 +286,7 @@ // Use negative value for ndims to differentiate with old format!! FOUR_BYTE_INT tmp = - d.length(); os.write (X_CAST (char *, &tmp), 4); - for (int i=0; i < d.length (); i++) + for (int i = 0; i < d.length (); i++) { tmp = d(i); os.write (X_CAST (char *, &tmp), 4); @@ -294,10 +294,10 @@ boolNDArray m = bool_array_value (); bool *mtmp = m.fortran_vec (); - int nel = m.nelem (); + octave_idx_type nel = m.nelem (); OCTAVE_LOCAL_BUFFER (char, htmp, nel); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) htmp[i] = (mtmp[i] ? 1 : 0); os.write (htmp, nel); @@ -346,13 +346,13 @@ dv(0) = 1; } - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); OCTAVE_LOCAL_BUFFER (char, htmp, nel); if (! is.read (htmp, nel)) return false; boolNDArray m(dv); bool *mtmp = m.fortran_vec (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) mtmp[i] = (htmp[i] ? 1 : 0); matrix = m; @@ -392,11 +392,11 @@ return false; } - int nel = m.nelem (); + octave_idx_type nel = m.nelem (); bool *mtmp = m.fortran_vec (); hbool_t htmp[nel]; - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) htmp[i] = mtmp[i]; retval = H5Dwrite (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL, @@ -451,7 +451,7 @@ dv(j) = hdims[i]; } - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); hbool_t htmp[nel]; if (H5Dread (data_hid, H5T_NATIVE_HBOOL, H5S_ALL, H5S_ALL, H5P_DEFAULT, htmp) >= 0) @@ -459,7 +459,7 @@ retval = true; boolNDArray btmp (dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) btmp.elem (i) = htmp[i]; matrix = btmp; diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-bool-sparse.cc --- a/src/ov-bool-sparse.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-bool-sparse.cc Fri Apr 08 16:07:37 2005 +0000 @@ -275,7 +275,9 @@ swap_bytes<4> (&nz); } - SparseBoolMatrix m (nr, nc, nz); + SparseBoolMatrix m (static_cast (nr), + static_cast (nc), + static_cast (nz)); for (int i = 0; i < nc+1; i++) { @@ -571,7 +573,9 @@ H5Dclose (data_hid); - SparseBoolMatrix m (nr, nc, nz); + SparseBoolMatrix m (static_cast (nr), + static_cast (nc), + static_cast (nz)); data_hid = H5Dopen (group_hid, "cidx"); space_hid = H5Dget_space (data_hid); diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-cell.cc --- a/src/ov-cell.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-cell.cc Fri Apr 08 16:07:37 2005 +0000 @@ -79,11 +79,11 @@ retval(0) = tcell(0,0); else { - int n = tcell.numel (); + octave_idx_type n = tcell.numel (); octave_value_list lst (n, octave_value ()); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { OCTAVE_QUIT; lst(i) = tcell(i); @@ -253,7 +253,7 @@ { size_t retval = 0; - for (int i = 0; i < numel (); i++) + for (octave_idx_type i = 0; i < numel (); i++) retval += matrix(i).byte_size (); return retval; @@ -264,21 +264,21 @@ { octave_value_list retval; - int nr = rows (); - int nc = columns (); + octave_idx_type nr = rows (); + octave_idx_type nc = columns (); if (nr == 1 && nc > 0) { retval.resize (nc); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval(i) = matrix(0,i); } else if (nc == 1 && nr > 0) { retval.resize (nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval(i) = matrix(i,0); } else @@ -292,16 +292,16 @@ { string_vector retval; - int nr = rows (); - int nc = columns (); + octave_idx_type nr = rows (); + octave_idx_type nc = columns (); int n_elts = 0; - int max_len = 0; + octave_idx_type max_len = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { string_vector s = matrix(i,j).all_strings (); @@ -310,7 +310,7 @@ n_elts += s.length (); - int s_max_len = s.max_length (); + octave_idx_type s_max_len = s.max_length (); if (s_max_len > max_len) max_len = s_max_len; @@ -319,17 +319,17 @@ retval.resize (n_elts); - int k = 0; + octave_idx_type k = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { string_vector s = matrix(i,j).all_strings (); int n = s.length (); - for (int ii = 0; ii < n; ii++) + for (octave_idx_type ii = 0; ii < n; ii++) { std::string t = s[ii]; int t_len = t.length (); @@ -364,8 +364,8 @@ if (nd == 2) { - int nr = rows (); - int nc = columns (); + octave_idx_type nr = rows (); + octave_idx_type nc = columns (); if (nr > 0 && nc > 0) { @@ -375,9 +375,9 @@ increment_indent_level (); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; @@ -426,13 +426,13 @@ { os << "# ndims: " << d.length () << "\n"; - for (int i=0; i < d.length (); i++) + for (int i = 0; i < d.length (); i++) os << " " << d (i); os << "\n"; Cell tmp = cell_value (); - for (int i = 0; i < d.numel (); i++) + for (octave_idx_type i = 0; i < d.numel (); i++) { octave_value o_val = tmp.elem (i); @@ -453,9 +453,9 @@ Cell tmp = cell_value (); - for (int j = 0; j < tmp.cols (); j++) + for (octave_idx_type j = 0; j < tmp.cols (); j++) { - for (int i = 0; i < tmp.rows (); i++) + for (octave_idx_type i = 0; i < tmp.rows (); i++) { octave_value o_val = tmp.elem (i, j); @@ -486,13 +486,13 @@ keywords[1] = "rows"; std::string kw; - int val = 0; + octave_idx_type val = 0; if (extract_keyword (is, keywords, kw, val, true)) { if (kw == "ndims") { - int mdims = val; + int mdims = static_cast (val); if (mdims >= 0) { @@ -504,7 +504,7 @@ Cell tmp(dv); - for (int i = 0; i < dv.numel (); i++) + for (octave_idx_type i = 0; i < dv.numel (); i++) { octave_value t2; bool dummy; @@ -542,8 +542,8 @@ } else if (kw == "rows") { - int nr = val; - int nc = 0; + octave_idx_type nr = val; + octave_idx_type nc = 0; if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0) { @@ -551,9 +551,9 @@ { Cell tmp (nr, nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { octave_value t2; bool dummy; @@ -619,7 +619,7 @@ // Use negative value for ndims FOUR_BYTE_INT di = - d.length(); os.write (X_CAST (char *, &di), 4); - for (int i=0; i < d.length (); i++) + for (int i = 0; i < d.length (); i++) { di = d(i); os.write (X_CAST (char *, &di), 4); @@ -627,7 +627,7 @@ Cell tmp = cell_value (); - for (int i = 0; i < d.numel (); i++) + for (octave_idx_type i = 0; i < d.numel (); i++) { octave_value o_val = tmp.elem (i); @@ -681,10 +681,10 @@ dv(0) = 1; } - int nel = dv.numel (); + octave_idx_type nel = dv.numel (); Cell tmp(dv); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { octave_value t2; bool dummy; @@ -778,7 +778,7 @@ Cell tmp = cell_value (); - for (int i = 0; i < dv.numel (); i++) + for (octave_idx_type i = 0; i < dv.numel (); i++) { char s[20]; sprintf (s, "_%d", i); @@ -867,7 +867,7 @@ H5Gclose (group_id); #endif - for (int i = 0; i < dv.numel (); i++) + for (octave_idx_type i = 0; i < dv.numel (); i++) { #ifdef HAVE_H5GGET_NUM_OBJS @@ -1089,7 +1089,7 @@ string_vector keys = m.keys (); - int fields_numel = keys.length (); + octave_idx_type fields_numel = keys.length (); // The resulting dim_vector should have dimensions: // [numel(fields) size(struct)] @@ -1113,12 +1113,12 @@ // ra_idx(0) will both contain fields_numel for each call to // increment_index and j for each assignment. - Array ra_idx (result_dv.length (), 0); + Array ra_idx (result_dv.length (), 0); ra_idx(0) = fields_numel; - for (int i = 0; i < m_dv.numel (); i++) + for (octave_idx_type i = 0; i < m_dv.numel (); i++) { - for (int j = 0; j < fields_numel; j++) + for (octave_idx_type j = 0; j < fields_numel; j++) { ra_idx(0) = j; diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-cs-list.cc --- a/src/ov-cs-list.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-cs-list.cc Fri Apr 08 16:07:37 2005 +0000 @@ -41,11 +41,11 @@ octave_cs_list::octave_cs_list (const Cell& c) : octave_base_value (), lst () { - int n = c.length (); + octave_idx_type n = c.length (); lst.resize (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) lst(i) = c(i); } @@ -60,7 +60,7 @@ { unwind_protect::begin_frame ("octave_cs_list_print"); - int n = lst.length (); + octave_idx_type n = lst.length (); if (n > 0) { @@ -70,7 +70,7 @@ increment_indent_level (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { OSSTREAM buf; buf << "[" << i+1 << "]" << OSSTREAM_ENDS; diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-cx-mat.cc --- a/src/ov-cx-mat.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-cx-mat.cc Fri Apr 08 16:07:37 2005 +0000 @@ -66,8 +66,8 @@ { ComplexMatrix cm = matrix.matrix_value (); - int nr = cm.rows (); - int nc = cm.cols (); + octave_idx_type nr = cm.rows (); + octave_idx_type nc = cm.cols (); if (nr == 1 && nc == 1) { @@ -100,9 +100,9 @@ octave_complex_matrix::assign (const octave_value_list& idx, const NDArray& rhs) { - int len = idx.length (); + octave_idx_type len = idx.length (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) matrix.set_index (idx(i).index_vector ()); ::assign (matrix, rhs); @@ -201,15 +201,15 @@ static ComplexMatrix strip_infnan (const ComplexMatrix& m) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); ComplexMatrix retval (nr, nc); - int k = 0; - for (int i = 0; i < nr; i++) + octave_idx_type k = 0; + for (octave_idx_type i = 0; i < nr; i++) { - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { Complex c = m (i, j); if (xisnan (c)) @@ -260,7 +260,7 @@ os << "# ndims: " << d.length () << "\n"; - for (int i=0; i < d.length (); i++) + for (int i = 0; i < d.length (); i++) os << " " << d (i); os << "\n" << tmp; @@ -299,13 +299,13 @@ keywords[1] = "rows"; std::string kw; - int val = 0; + octave_idx_type val = 0; if (extract_keyword (is, keywords, kw, val, true)) { if (kw == "ndims") { - int mdims = val; + int mdims = static_cast (val); if (mdims >= 0) { @@ -333,8 +333,8 @@ } else if (kw == "rows") { - int nr = val; - int nc = 0; + octave_idx_type nr = val; + octave_idx_type nc = 0; if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0) { @@ -382,7 +382,7 @@ // Use negative value for ndims to differentiate with old format!! FOUR_BYTE_INT tmp = - d.length(); os.write (X_CAST (char *, &tmp), 4); - for (int i=0; i < d.length (); i++) + for (int i = 0; i < d.length (); i++) { tmp = d(i); os.write (X_CAST (char *, &tmp), 4); @@ -475,7 +475,7 @@ return false; ComplexMatrix m (nr, nc); Complex *im = m.fortran_vec (); - int len = nr * nc; + octave_idx_type len = nr * nc; read_doubles (is, X_CAST (double *, im), X_CAST (save_type, tmp), 2*len, swap, fmt); if (error_state || ! is) diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-cx-sparse.cc --- a/src/ov-cx-sparse.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-cx-sparse.cc Fri Apr 08 16:07:37 2005 +0000 @@ -295,7 +295,9 @@ swap_bytes<4> (&nz); } - SparseComplexMatrix m (nr, nc, nz); + SparseComplexMatrix m (static_cast (nr), + static_cast (nc), + static_cast (nz)); for (int i = 0; i < nc+1; i++) { @@ -626,7 +628,9 @@ H5Dclose (data_hid); - SparseComplexMatrix m (nr, nc, nz); + SparseComplexMatrix m (static_cast (nr), + static_cast (nc), + static_cast (nz)); data_hid = H5Dopen (group_hid, "cidx"); space_hid = H5Dget_space (data_hid); diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-intx.h --- a/src/ov-intx.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-intx.h Fri Apr 08 16:07:37 2005 +0000 @@ -204,7 +204,7 @@ idx_vector index_vector (void) const { return idx_vector (scalar); } int write (octave_stream& os, int block_size, - oct_data_conv::data_type output_type, int skip, + oct_data_conv::data_type output_type, octave_idx_type skip, oct_mach_info::float_format flt_fmt) const { return os.write (OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION (), diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-list.cc --- a/src/ov-list.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-list.cc Fri Apr 08 16:07:37 2005 +0000 @@ -49,11 +49,11 @@ octave_list::octave_list (const Cell& c) : octave_base_value (), data () { - int n = c.length (); + octave_idx_type n = c.length (); data.resize (dim_vector (1, n)); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) data(i) = c(i); } @@ -147,7 +147,7 @@ { octave_value retval; - int n = type.length (); + octave_idx_type n = type.length (); octave_value t_rhs = rhs; @@ -194,9 +194,9 @@ { octave_value_list i = idx.front (); - int len = i.length (); + octave_idx_type len = i.length (); - for (int k = 0; k < len; k++) + for (octave_idx_type k = 0; k < len; k++) data.set_index (i(k).index_vector ()); ::assign (data, Cell (t_rhs), Cell::resize_fill_value ()); @@ -230,7 +230,7 @@ if (! error_state) { - int n = data.length (); + octave_idx_type n = data.length (); if (i > 0) { @@ -254,7 +254,7 @@ { size_t retval = 0; - for (int i = 0; i < numel (); i++) + for (octave_idx_type i = 0; i < numel (); i++) retval += data(i).byte_size (); return retval; @@ -265,11 +265,11 @@ { octave_value_list retval; - int n = data.length (); + octave_idx_type n = data.length (); retval.resize (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) retval(i) = data(i); return retval; @@ -286,7 +286,7 @@ { unwind_protect::begin_frame ("octave_list_print"); - int n = data.length (); + octave_idx_type n = data.length (); if (n > 0) { @@ -296,7 +296,7 @@ increment_indent_level (); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) { OSSTREAM buf; @@ -633,7 +633,7 @@ { octave_value_list lst; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { octave_value t2; bool dummy; @@ -679,7 +679,7 @@ // recursively add each element of the list to this group octave_value_list lst = list_value (); - for (int i = 0; i < lst.length (); ++i) + for (octave_idx_type i = 0; i < lst.length (); ++i) { // should we use lst.name_tags () to label the elements? char s[20]; diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-mapper.cc --- a/src/ov-mapper.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-mapper.cc Fri Apr 08 16:07:37 2005 +0000 @@ -43,9 +43,9 @@ static bool any_element_less_than (const NDArray& a, double val) { - int len = a.length (); + octave_idx_type len = a.length (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { OCTAVE_QUIT; @@ -59,9 +59,9 @@ static bool any_element_greater_than (const NDArray& a, double val) { - int len = a.length (); + octave_idx_type len = a.length (); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { OCTAVE_QUIT; @@ -80,11 +80,11 @@ #define MAPPER_LOOP_2(T, F, M, CONV, R) \ do \ { \ - int len = M.length (); \ + octave_idx_type len = M.length (); \ \ T result (M.dims ()); \ \ - for (int i = 0; i < len; i++) \ + for (octave_idx_type i = 0; i < len; i++) \ { \ OCTAVE_QUIT; \ \ diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-range.cc --- a/src/ov-range.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-range.cc Fri Apr 08 16:07:37 2005 +0000 @@ -131,7 +131,7 @@ { double retval = lo_ieee_nan_value (); - int nel = range.nelem (); + octave_idx_type nel = range.nelem (); if (nel > 0) { @@ -191,7 +191,7 @@ Complex retval (tmp, tmp); - int nel = range.nelem (); + octave_idx_type nel = range.nelem (); if (nel > 0) { @@ -233,7 +233,7 @@ { bool retval = false; - int n = range.nelem (); + octave_idx_type n = range.nelem (); indent (os); diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-range.h --- a/src/ov-range.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-range.h Fri Apr 08 16:07:37 2005 +0000 @@ -100,8 +100,8 @@ idx_vector index_vector (void) const { return idx_vector (range); } dim_vector dims (void) const - { - int n = range.nelem (); + { + octave_idx_type n = range.nelem (); return dim_vector (n > 0, n); } @@ -129,14 +129,14 @@ { double b = range.base (); return (range.nelem () == 1 - && ! xisnan (b) && D_NINT (b) == b && NINT (b) == 1); + && ! xisnan (b) && D_NINT (b) == b && NINTbig (b) == 1); } bool valid_as_zero_index (void) const { double b = range.base (); return (range.nelem () == 1 - && ! xisnan (b) && D_NINT (b) == b && NINT (b) == 0); + && ! xisnan (b) && D_NINT (b) == b && NINTbig (b) == 0); } bool is_numeric_type (void) const { return true; } diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-re-mat.cc --- a/src/ov-re-mat.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-re-mat.cc Fri Apr 08 16:07:37 2005 +0000 @@ -152,9 +152,9 @@ { charNDArray retval (dims ()); - int nel = numel (); + octave_idx_type nel = numel (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) retval.elem (i) = static_cast(matrix.elem (i)); return retval; @@ -180,9 +180,9 @@ { streamoff_array retval (dims ()); - int nel = numel (); + octave_idx_type nel = numel (); - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { double d = matrix(i); @@ -216,7 +216,7 @@ bool warned = false; - for (int i = 0; i < nel; i++) + for (octave_idx_type i = 0; i < nel; i++) { OCTAVE_QUIT; @@ -258,15 +258,15 @@ static Matrix strip_infnan (const Matrix& m) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); Matrix retval (nr, nc); - int k = 0; - for (int i = 0; i < nr; i++) + octave_idx_type k = 0; + for (octave_idx_type i = 0; i < nr; i++) { - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { double d = m (i, j); if (xisnan (d)) @@ -348,13 +348,13 @@ keywords[1] = "rows"; std::string kw; - int val = 0; + octave_idx_type val = 0; if (extract_keyword (is, keywords, kw, val, true)) { if (kw == "ndims") { - int mdims = val; + int mdims = static_cast (val); if (mdims >= 0) { @@ -382,8 +382,8 @@ } else if (kw == "rows") { - int nr = val; - int nc = 0; + octave_idx_type nr = val; + octave_idx_type nc = 0; if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0) { @@ -433,7 +433,7 @@ // Use negative value for ndims to differentiate with old format!! FOUR_BYTE_INT tmp = - d.length(); os.write (X_CAST (char *, &tmp), 4); - for (int i=0; i < d.length (); i++) + for (int i = 0; i < d.length (); i++) { tmp = d(i); os.write (X_CAST (char *, &tmp), 4); @@ -524,7 +524,7 @@ return false; Matrix m (nr, nc); double *re = m.fortran_vec (); - int len = nr * nc; + octave_idx_type len = nr * nc; read_doubles (is, re, X_CAST (save_type, tmp), len, swap, fmt); if (error_state || ! is) return false; diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-re-sparse.cc --- a/src/ov-re-sparse.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-re-sparse.cc Fri Apr 08 16:07:37 2005 +0000 @@ -266,7 +266,9 @@ swap_bytes<4> (&nz); } - SparseMatrix m (nr, nc, nz); + SparseMatrix m (static_cast (nr), + static_cast (nc), + static_cast (nz)); for (int i = 0; i < nc+1; i++) { @@ -580,7 +582,9 @@ H5Dclose (data_hid); - SparseMatrix m (nr, nc, nz); + SparseMatrix m (static_cast (nr), + static_cast (nc), + static_cast (nz)); data_hid = H5Dopen (group_hid, "cidx"); space_hid = H5Dget_space (data_hid); diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-scalar.h --- a/src/ov-scalar.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-scalar.h Fri Apr 08 16:07:37 2005 +0000 @@ -85,14 +85,14 @@ { return (! xisnan (scalar) && D_NINT (scalar) == scalar - && NINT (scalar) == 1); + && NINTbig (scalar) == 1); } bool valid_as_zero_index (void) const { return (! xisnan (scalar) && D_NINT (scalar) == scalar - && NINT (scalar) == 0); + && NINTbig (scalar) == 0); } double double_value (bool = false) const { return scalar; } diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-str-mat.cc --- a/src/ov-str-mat.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-str-mat.cc Fri Apr 08 16:07:37 2005 +0000 @@ -83,7 +83,7 @@ { octave_value retval; - int len = idx.length (); + octave_idx_type len = idx.length (); switch (len) { @@ -112,7 +112,7 @@ { Array idx_vec (len); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) idx_vec(i) = idx(i).index_vector (); if (! error_state) @@ -129,14 +129,14 @@ octave_char_matrix_str::assign (const octave_value_list& idx, const charMatrix& rhs) { - int len = idx.length (); + octave_idx_type len = idx.length (); // XXX FIXME XXX charMatrix tmp = rhs; if (tmp.rows () == 1 && tmp.columns () == 0) tmp.resize (0, 0); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) matrix.set_index (idx(i).index_vector ()); ::assign (matrix, tmp, Vstring_fill_char); @@ -211,11 +211,11 @@ { charMatrix chm = matrix.matrix_value (); - int n = chm.rows (); + octave_idx_type n = chm.rows (); retval.resize (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) retval[i] = chm.row_as_string (i, true); } else @@ -269,9 +269,9 @@ // Keep this case, rather than use generic code above for // backward compatiability. Makes load_ascii much more complex!! charMatrix chm = char_matrix_value (); - int elements = chm.rows (); + octave_idx_type elements = chm.rows (); os << "# elements: " << elements << "\n"; - for (int i = 0; i < elements; i++) + for (octave_idx_type i = 0; i < elements; i++) { unsigned len = chm.cols (); os << "# length: " << len << "\n"; diff -r eae7b40388e9 -r 23b37da9fd5b src/ov-struct.cc --- a/src/ov-struct.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov-struct.cc Fri Apr 08 16:07:37 2005 +0000 @@ -402,7 +402,7 @@ increment_indent_level (); - int n = map.numel (); + octave_idx_type n = map.numel (); if (n > 1 && print_keys_only) { @@ -733,12 +733,13 @@ } static void -cell2struct_construct_idx (Array& ra_idx1, const Array& ra_idx2, - int dim, int fill_value) +cell2struct_construct_idx (Array& ra_idx1, + const Array& ra_idx2, + octave_idx_type dim, octave_idx_type fill_value) { - int iidx = 0; + octave_idx_type iidx = 0; - for (int idx = 0; idx < ra_idx1.length (); idx++) + for (octave_idx_type idx = 0; idx < ra_idx1.length (); idx++) { if (idx == dim) ra_idx1.elem (idx) = fill_value; @@ -800,7 +801,7 @@ // XXX FIX ME XXX -- int_value () should print out the // conversions it does to be Matlab compatible. - int dim = args(2).int_value () - 1; + octave_idx_type dim = args(2).int_value () - 1; if (! error_state) { @@ -810,7 +811,7 @@ if (cell2struct_check_args (c_dv, field_dv, field_is_cell, dim)) { - int c_dv_length = c_dv.length (); + octave_idx_type c_dv_length = c_dv.length (); // Dimension vector for the Cell arrays to be // put into the structure. @@ -824,9 +825,9 @@ else value_dv.resize (c_dv_length - 1); - int idx_tmp = 0; + octave_idx_type idx_tmp = 0; - for (int i = 0; i < c_dv_length; i++) + for (octave_idx_type i = 0; i < c_dv_length; i++) { if (i != dim) value_dv.elem (idx_tmp++) = c_dv.elem (i); @@ -842,7 +843,7 @@ // field is a character array the number of // elements is equals the number of rows. - int field_numel + octave_idx_type field_numel = field_is_cell ? field_dv.numel (): field_dv(0); // For matlab compatibility. @@ -850,7 +851,7 @@ if (field_numel == 0) map.reshape (dim_vector (0, 1)); - for (int i = 0; i < field_numel; i++) + for (octave_idx_type i = 0; i < field_numel; i++) { // Construct cell array which goes into the // structure together with the appropriate @@ -858,10 +859,10 @@ Cell c_value (value_dv); - Array value_idx (value_dv.length (), 0); - Array c_idx (c_dv_length, 0); + Array value_idx (value_dv.length (), 0); + Array c_idx (c_dv_length, 0); - for (int j = 0; j < value_dv.numel (); j++) + for (octave_idx_type j = 0; j < value_dv.numel (); j++) { // Need to do this to construct the // appropriate idx for getting elements @@ -1003,7 +1004,7 @@ bool octave_struct::load_ascii (std::istream& is) { - int len = 0; + octave_idx_type len = 0; bool success = true; if (extract_keyword (is, "length", len) && len >= 0) @@ -1012,7 +1013,7 @@ { Octave_map m (map); - for (int j = 0; j < len; j++) + for (octave_idx_type j = 0; j < len; j++) { octave_value t2; bool dummy; @@ -1088,7 +1089,7 @@ { Octave_map m (map); - for (int j = 0; j < len; j++) + for (octave_idx_type j = 0; j < len; j++) { octave_value t2; bool dummy; diff -r eae7b40388e9 -r 23b37da9fd5b src/ov.cc --- a/src/ov.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov.cc Fri Apr 08 16:07:37 2005 +0000 @@ -1012,7 +1012,7 @@ return *this; } -int +octave_idx_type octave_value::rows (void) const { dim_vector dv = dims (); @@ -1020,7 +1020,7 @@ return (dv.length () > 0) ? dv(0) : -1; } -int +octave_idx_type octave_value::columns (void) const { dim_vector dv = dims (); @@ -1028,7 +1028,7 @@ return (dv.length () > 1) ? dv(1) : -1; } -int +octave_idx_type octave_value::length (void) const { int retval = 0; @@ -1158,13 +1158,13 @@ if (error_state) return retval; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nc == 1) { retval.resize (nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i) = m (i, 0); } else @@ -1187,13 +1187,13 @@ if (error_state) return retval; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nc == 1) { retval.resize (nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i) = m (i, 0); } else @@ -1216,13 +1216,13 @@ if (error_state) return retval; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nr == 1) { retval.resize (nc); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval (i) = m (0, i); } else @@ -1245,13 +1245,13 @@ if (error_state) return retval; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nr == 1) { retval.resize (nc); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval (i) = m (0, i); } else @@ -1276,19 +1276,19 @@ if (error_state) return retval; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nr == 1) { retval.resize (nc); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) retval (i) = m (0, i); } else if (nc == 1) { retval.resize (nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) retval (i) = m (i, 0); } else if (nr > 0 && nc > 0) @@ -1298,9 +1298,9 @@ gripe_implicit_conversion (type_name (), "real vector"); retval.resize (nr * nc); - int k = 0; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + octave_idx_type k = 0; + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; @@ -1327,13 +1327,13 @@ if (error_state) return retval; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nr == 1) { retval.resize (nc); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { OCTAVE_QUIT; @@ -1351,7 +1351,7 @@ else if (nc == 1) { retval.resize (nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; @@ -1373,10 +1373,10 @@ gripe_implicit_conversion (type_name (), "real vector"); retval.resize (nr * nc); - int k = 0; - for (int j = 0; j < nc; j++) + octave_idx_type k = 0; + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; @@ -1412,13 +1412,13 @@ if (error_state) return retval; - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nr == 1) { retval.resize (nc); - for (int i = 0; i < nc; i++) + for (octave_idx_type i = 0; i < nc; i++) { OCTAVE_QUIT; retval (i) = m (0, i); @@ -1427,7 +1427,7 @@ else if (nc == 1) { retval.resize (nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; retval (i) = m (i, 0); @@ -1440,9 +1440,9 @@ gripe_implicit_conversion (type_name (), "complex vector"); retval.resize (nr * nc); - int k = 0; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + octave_idx_type k = 0; + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; retval (k++) = m (i, j); diff -r eae7b40388e9 -r 23b37da9fd5b src/ov.h --- a/src/ov.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/ov.h Fri Apr 08 16:07:37 2005 +0000 @@ -354,20 +354,20 @@ virtual dim_vector dims (void) const { return rep->dims (); } - int rows (void) const; + octave_idx_type rows (void) const; - int columns (void) const; + octave_idx_type columns (void) const; - int length (void) const; + octave_idx_type length (void) const; int ndims (void) const; bool all_zero_dims (void) const { return dims().all_zero (); } - virtual int numel (void) const + virtual octave_idx_type numel (void) const { return rep->numel (); } - virtual int capacity (void) const + virtual octave_idx_type capacity (void) const { return rep->capacity (); } virtual size_t byte_size (void) const diff -r eae7b40388e9 -r 23b37da9fd5b src/pr-output.cc --- a/src/pr-output.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/pr-output.cc Fri Apr 08 16:07:37 2005 +0000 @@ -227,13 +227,13 @@ static double pr_max_internal (const Matrix& m) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); double result = -DBL_MAX; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { double val = m(i,j); if (xisinf (val) || octave_is_NaN_or_NA (val)) @@ -249,13 +249,13 @@ static double pr_min_internal (const Matrix& m) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); double result = DBL_MAX; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { double val = m(i,j); if (xisinf (val) || octave_is_NaN_or_NA (val)) @@ -1263,7 +1263,7 @@ } static void -print_empty_matrix (std::ostream& os, int nr, int nc, bool pr_as_read_syntax) +print_empty_matrix (std::ostream& os, octave_idx_type nr, octave_idx_type nc, bool pr_as_read_syntax) { assert (nr == 0 || nc == 0); @@ -1318,8 +1318,8 @@ } static void -pr_col_num_header (std::ostream& os, int total_width, int max_width, - int lim, int col, int extra_indent) +pr_col_num_header (std::ostream& os, octave_idx_type total_width, int max_width, + octave_idx_type lim, octave_idx_type col, int extra_indent) { if (total_width > max_width && Vsplit_long_rows) { @@ -1331,7 +1331,7 @@ os << "\n\n"; } - int num_cols = lim - col; + octave_idx_type num_cols = lim - col; os << std::setw (extra_indent) << ""; @@ -1381,16 +1381,16 @@ octave_print_internal (std::ostream& os, const Matrix& m, bool pr_as_read_syntax, int extra_indent) { - int nr = m.rows (); - int nc = m.columns (); + octave_idx_type nr = m.rows (); + octave_idx_type nc = m.columns (); if (nr == 0 || nc == 0) print_empty_matrix (os, nr, nc, pr_as_read_syntax); else if (plus_format && ! pr_as_read_syntax) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { OCTAVE_QUIT; @@ -1407,8 +1407,8 @@ double scale = 1.0; set_format (m, fw, scale); int column_width = fw + 2; - int total_width = nc * column_width; - int max_width = command_editor::terminal_cols (); + octave_idx_type total_width = nc * column_width; + octave_idx_type max_width = command_editor::terminal_cols (); if (pr_as_read_syntax) max_width -= 4; @@ -1431,7 +1431,7 @@ return; } - int inc = nc; + octave_idx_type inc = nc; if (total_width > max_width && Vsplit_long_rows) { inc = max_width / column_width; @@ -1441,14 +1441,14 @@ if (pr_as_read_syntax) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { - int col = 0; + octave_idx_type col = 0; while (col < nc) { - int lim = col + inc < nc ? col + inc : nc; - - for (int j = col; j < lim; j++) + octave_idx_type lim = col + inc < nc ? col + inc : nc; + + for (octave_idx_type j = col; j < lim; j++) { OCTAVE_QUIT; @@ -1483,18 +1483,18 @@ { pr_scale_header (os, scale); - for (int col = 0; col < nc; col += inc) + for (octave_idx_type col = 0; col < nc; col += inc) { - int lim = col + inc < nc ? col + inc : nc; + octave_idx_type lim = col + inc < nc ? col + inc : nc; pr_col_num_header (os, total_width, max_width, lim, col, extra_indent); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { os << std::setw (extra_indent) << ""; - for (int j = col; j < lim; j++) + for (octave_idx_type j = col; j < lim; j++) { OCTAVE_QUIT; @@ -1523,17 +1523,17 @@ \ dim_vector dims = nda.dims (); \ \ - Array ra_idx (ndims, 0); \ + Array ra_idx (ndims, 0); \ \ - int m = 1; \ + octave_idx_type m = 1; \ \ for (int i = 2; i < ndims; i++) \ m *= dims(i); \ \ - int nr = dims(0); \ - int nc = dims(1); \ + octave_idx_type nr = dims(0); \ + octave_idx_type nc = dims(1); \ \ - for (int i = 0; i < m; i++) \ + for (octave_idx_type i = 0; i < m; i++) \ { \ OCTAVE_QUIT; \ \ @@ -1642,16 +1642,16 @@ octave_print_internal (std::ostream& os, const ComplexMatrix& cm, bool pr_as_read_syntax, int extra_indent) { - int nr = cm.rows (); - int nc = cm.columns (); + octave_idx_type nr = cm.rows (); + octave_idx_type nc = cm.columns (); if (nr == 0 || nc == 0) print_empty_matrix (os, nr, nc, pr_as_read_syntax); else if (plus_format && ! pr_as_read_syntax) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { OCTAVE_QUIT; @@ -1669,8 +1669,8 @@ set_format (cm, r_fw, i_fw, scale); int column_width = i_fw + r_fw; column_width += (bank_format || hex_format|| bit_format) ? 2 : 7; - int total_width = nc * column_width; - int max_width = command_editor::terminal_cols (); + octave_idx_type total_width = nc * column_width; + octave_idx_type max_width = command_editor::terminal_cols (); if (pr_as_read_syntax) max_width -= 4; @@ -1693,7 +1693,7 @@ return; } - int inc = nc; + octave_idx_type inc = nc; if (total_width > max_width && Vsplit_long_rows) { inc = max_width / column_width; @@ -1703,14 +1703,14 @@ if (pr_as_read_syntax) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { - int col = 0; + octave_idx_type col = 0; while (col < nc) { - int lim = col + inc < nc ? col + inc : nc; - - for (int j = col; j < lim; j++) + octave_idx_type lim = col + inc < nc ? col + inc : nc; + + for (octave_idx_type j = col; j < lim; j++) { OCTAVE_QUIT; @@ -1745,18 +1745,18 @@ { pr_scale_header (os, scale); - for (int col = 0; col < nc; col += inc) + for (octave_idx_type col = 0; col < nc; col += inc) { - int lim = col + inc < nc ? col + inc : nc; + octave_idx_type lim = col + inc < nc ? col + inc : nc; pr_col_num_header (os, total_width, max_width, lim, col, extra_indent); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { os << std::setw (extra_indent) << ""; - for (int j = col; j < lim; j++) + for (octave_idx_type j = col; j < lim; j++) { OCTAVE_QUIT; @@ -1798,11 +1798,11 @@ double base = r.base (); double increment = r.inc (); double limit = r.limit (); - int num_elem = r.nelem (); + octave_idx_type num_elem = r.nelem (); if (plus_format && ! pr_as_read_syntax) { - for (int i = 0; i < num_elem; i++) + for (octave_idx_type i = 0; i < num_elem; i++) { OCTAVE_QUIT; @@ -1841,8 +1841,8 @@ else { int column_width = fw + 2; - int total_width = num_elem * column_width; - int max_width = command_editor::terminal_cols (); + octave_idx_type total_width = num_elem * column_width; + octave_idx_type max_width = command_editor::terminal_cols (); if (free_format) { @@ -1850,7 +1850,7 @@ return; } - int inc = num_elem; + octave_idx_type inc = num_elem; if (total_width > max_width && Vsplit_long_rows) { inc = max_width / column_width; @@ -1865,17 +1865,17 @@ pr_scale_header (os, scale); - int col = 0; + octave_idx_type col = 0; while (col < num_elem) { - int lim = col + inc < num_elem ? col + inc : num_elem; + octave_idx_type lim = col + inc < num_elem ? col + inc : num_elem; pr_col_num_header (os, total_width, max_width, lim, col, extra_indent); os << std::setw (extra_indent) << ""; - for (int i = col; i < lim; i++) + for (octave_idx_type i = col; i < lim; i++) { OCTAVE_QUIT; @@ -1940,14 +1940,14 @@ { if (pr_as_string) { - int nstr = chm.rows (); + octave_idx_type nstr = chm.rows (); if (pr_as_read_syntax && nstr > 1) os << "[ "; if (nstr != 0) { - for (int i = 0; i < nstr; i++) + for (octave_idx_type i = 0; i < nstr; i++) { OCTAVE_QUIT; @@ -2026,17 +2026,17 @@ dim_vector dims = nda.dims (); - Array ra_idx (ndims, 0); - - int m = 1; + Array ra_idx (ndims, 0); + + octave_idx_type m = 1; for (int i = 2; i < ndims; i++) m *= dims(i); - int nr = dims(0); - int nc = dims(1); - - for (int i = 0; i < m; i++) + octave_idx_type nr = dims(0); + octave_idx_type nc = dims(1); + + for (octave_idx_type i = 0; i < m; i++) { std::string nm = "ans"; @@ -2076,14 +2076,14 @@ // XXX FIXME XXX -- need to do some more work to put these // in neatly aligned columns... - int n_rows = page.rows (); - int n_cols = page.cols (); + octave_idx_type n_rows = page.rows (); + octave_idx_type n_cols = page.cols (); os << nm << " =\n\n"; - for (int ii = 0; ii < n_rows; ii++) + for (octave_idx_type ii = 0; ii < n_rows; ii++) { - for (int jj = 0; jj < n_cols; jj++) + for (octave_idx_type jj = 0; jj < n_cols; jj++) os << " " << page(ii,jj); os << "\n"; @@ -2187,19 +2187,19 @@ { int ndims = nda.ndims (); - Array ra_idx (ndims, 0); + Array ra_idx (ndims, 0); dim_vector dims = nda.dims (); - int m = 1; + octave_idx_type m = 1; for (int i = 2; i < ndims; i++) m *= dims(i); - int nr = dims(0); - int nc = dims(1); - - for (int i = 0; i < m; i++) + octave_idx_type nr = dims(0); + octave_idx_type nc = dims(1); + + for (octave_idx_type i = 0; i < m; i++) { if (m > 1) { @@ -2236,9 +2236,9 @@ Array2 page (nda.index (idx), nr, nc); - for (int ii = 0; ii < nr; ii++) + for (octave_idx_type ii = 0; ii < nr; ii++) { - for (int jj = 0; jj < nc; jj++) + for (octave_idx_type jj = 0; jj < nc; jj++) { OCTAVE_QUIT; @@ -2262,15 +2262,15 @@ dim_vector dims = nda.dims (); - Array ra_idx (ndims, 0); - - int m = 1; + Array ra_idx (ndims, 0); + + octave_idx_type m = 1; for (int i = 2; i < ndims; i++) m *= dims(i); - int nr = dims(0); - int nc = dims(1); + octave_idx_type nr = dims(0); + octave_idx_type nc = dims(1); int fw = 0; if (hex_format) @@ -2282,7 +2282,7 @@ bool isneg = false; int digits = 0; - for (int i = 0; i < dims.numel (); i++) + for (octave_idx_type i = 0; i < dims.numel (); i++) { int new_digits = static_cast (floor (log10 (double (abs (nda(i).value ()))) + 1.0)); @@ -2298,9 +2298,9 @@ } int column_width = fw + (bank_format ? 5 : 2); - int total_width = nc * column_width; + octave_idx_type total_width = nc * column_width; int max_width = command_editor::terminal_cols () - extra_indent; - int inc = nc; + octave_idx_type inc = nc; if (total_width > max_width && Vsplit_long_rows) { inc = max_width / column_width; @@ -2308,7 +2308,7 @@ inc++; } - for (int i = 0; i < m; i++) + for (octave_idx_type i = 0; i < m; i++) { if (m > 1) { @@ -2350,9 +2350,9 @@ if (pr_as_read_syntax) os << "[\n"; - for (int ii = 0; ii < nr; ii++) + for (octave_idx_type ii = 0; ii < nr; ii++) { - for (int jj = 0; jj < nc; jj++) + for (octave_idx_type jj = 0; jj < nc; jj++) { OCTAVE_QUIT; os << " "; @@ -2366,21 +2366,21 @@ } else { - int n_rows = page.rows (); - int n_cols = page.cols (); - - for (int col = 0; col < n_cols; col += inc) + octave_idx_type n_rows = page.rows (); + octave_idx_type n_cols = page.cols (); + + for (octave_idx_type col = 0; col < n_cols; col += inc) { - int lim = col + inc < n_cols ? col + inc : n_cols; + octave_idx_type lim = col + inc < n_cols ? col + inc : n_cols; pr_col_num_header (os, total_width, max_width, lim, col, extra_indent); - for (int ii = 0; ii < n_rows; ii++) + for (octave_idx_type ii = 0; ii < n_rows; ii++) { os << std::setw (extra_indent) << ""; - for (int jj = col; jj < lim; jj++) + for (octave_idx_type jj = col; jj < lim; jj++) { OCTAVE_QUIT; os << " "; diff -r eae7b40388e9 -r 23b37da9fd5b src/pt-arg-list.cc --- a/src/pt-arg-list.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/pt-arg-list.cc Fri Apr 08 16:07:37 2005 +0000 @@ -125,7 +125,7 @@ { case -1: { - int numel = dv.numel (); + octave_idx_type numel = dv.numel (); if (numel < 0) { diff -r eae7b40388e9 -r 23b37da9fd5b src/pt-cell.cc --- a/src/pt-cell.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/pt-cell.cc Fri Apr 08 16:07:37 2005 +0000 @@ -46,8 +46,8 @@ MAYBE_DO_BREAKPOINT; - int nr = length (); - int nc = -1; + octave_idx_type nr = length (); + octave_idx_type nc = -1; Cell val; @@ -67,7 +67,7 @@ } else { - int this_nc = row.length (); + octave_idx_type this_nc = row.length (); if (nc != this_nc) { @@ -76,7 +76,7 @@ } } - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) val(i,j) = row(j); i++; diff -r eae7b40388e9 -r 23b37da9fd5b src/pt-loop.cc --- a/src/pt-loop.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/pt-loop.cc Fri Apr 08 16:07:37 2005 +0000 @@ -242,11 +242,11 @@ { \ int ndims = dv.length (); \ Array idx; \ - int steps = dv.numel () / dv (0); \ - idx.resize (ndims, idx_vector (1)); \ + octave_idx_type steps = dv.numel () / dv (0); \ + idx.resize (ndims, idx_vector (static_cast (1))); \ idx (0) = idx_vector (':'); \ \ - for (int i = 0; i < steps; i++) \ + for (octave_idx_type i = 0; i < steps; i++) \ { \ MAYBE_DO_BREAKPOINT; \ \ @@ -266,7 +266,7 @@ if (idx(j)(0) < dv(j)) \ break; \ else \ - idx(j) = idx_vector (1); \ + idx(j) = idx_vector (static_cast (1)); \ } \ } \ } \ @@ -305,11 +305,11 @@ { Range rng = rhs.range_value (); - int steps = rng.nelem (); + octave_idx_type steps = rng.nelem (); double b = rng.base (); double increment = rng.inc (); - for (int i = 0; i < steps; i++) + for (octave_idx_type i = 0; i < steps; i++) { MAYBE_DO_BREAKPOINT; @@ -336,8 +336,8 @@ else if (rhs.is_string ()) { charMatrix chm_tmp = rhs.char_matrix_value (); - int nr = chm_tmp.rows (); - int steps = chm_tmp.columns (); + octave_idx_type nr = chm_tmp.rows (); + octave_idx_type steps = chm_tmp.columns (); if (error_state) goto cleanup; @@ -346,7 +346,7 @@ DO_LOOP (chm_tmp (0, i)); else { - for (int i = 0; i < steps; i++) + for (octave_idx_type i = 0; i < steps; i++) { MAYBE_DO_BREAKPOINT; @@ -521,7 +521,7 @@ Cell val_lst = tmp_val.contents (q); - int n = tmp_val.numel (); + octave_idx_type n = tmp_val.numel (); octave_value val = (n == 1) ? val_lst(0) : octave_value (val_lst); diff -r eae7b40388e9 -r 23b37da9fd5b src/pt-mat.cc --- a/src/pt-mat.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/pt-mat.cc Fri Apr 08 16:07:37 2005 +0000 @@ -140,10 +140,10 @@ delete rep; } - int rows (void) + octave_idx_type rows (void) { return (rep->dv.length () > 0 ? rep->dv(0) : 0); } - int cols (void) + octave_idx_type cols (void) { return (rep->dv.length () > 1 ? rep->dv(1) : 0); } dim_vector dims (void) { return rep->dv; } @@ -171,8 +171,8 @@ const octave_value& val, bool& first_elem) { - int this_elt_nr = val.rows (); - int this_elt_nc = val.columns (); + octave_idx_type this_elt_nr = val.rows (); + octave_idx_type this_elt_nc = val.columns (); dim_vector this_elt_dv = val.dims (); @@ -272,7 +272,7 @@ { octave_value_list tlst = tmp.list_value (); - for (int i = 0; i < tlst.length (); i++) + for (octave_idx_type i = 0; i < tlst.length (); i++) { if (! do_init_element (elt, tlst(i), first_elem)) goto done; @@ -333,8 +333,8 @@ ~tm_const (void) { } - int rows (void) const { return (dv.length () > 0 ? dv.elem (0) : 0); } - int cols (void) const { return (dv.length () > 1 ? dv.elem (1) : 0); } + octave_idx_type rows (void) const { return (dv.length () > 0 ? dv.elem (0) : 0); } + octave_idx_type cols (void) const { return (dv.length () > 1 ? dv.elem (1) : 0); } dim_vector dims (void) const { return dv; } @@ -409,8 +409,8 @@ { tm_row_const elt = *p; - int this_elt_nr = elt.rows (); - int this_elt_nc = elt.cols (); + octave_idx_type this_elt_nr = elt.rows (); + octave_idx_type this_elt_nc = elt.cols (); dim_vector this_elt_dv = elt.dims (); diff -r eae7b40388e9 -r 23b37da9fd5b src/pt-select.cc --- a/src/pt-select.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/pt-select.cc Fri Apr 08 16:07:37 2005 +0000 @@ -152,9 +152,9 @@ { Cell cell (label_value.cell_value ()); - for (int i = 0; i < cell.rows (); i++) + for (octave_idx_type i = 0; i < cell.rows (); i++) { - for (int j = 0; j < cell.columns (); j++) + for (octave_idx_type j = 0; j < cell.columns (); j++) { bool match = equal (val, cell(i,j)); diff -r eae7b40388e9 -r 23b37da9fd5b src/sparse-xdiv.cc --- a/src/sparse-xdiv.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/sparse-xdiv.cc Fri Apr 08 16:07:37 2005 +0000 @@ -36,7 +36,7 @@ #include "sparse-xdiv.h" static inline bool -result_ok (int info) +result_ok (octave_idx_type info) { #ifdef HAVE_LSSOLVE return (info != -2 && info != -1); @@ -57,13 +57,13 @@ bool mx_leftdiv_conform (const T1& a, const T2& b) { - int a_nr = a.rows (); - int b_nr = b.rows (); + octave_idx_type a_nr = a.rows (); + octave_idx_type b_nr = b.rows (); if (a_nr != b_nr) { - int a_nc = a.cols (); - int b_nc = b.cols (); + octave_idx_type a_nc = a.cols (); + octave_idx_type b_nc = b.cols (); gripe_nonconformant ("operator \\", a_nr, a_nc, b_nr, b_nc); return false; @@ -88,13 +88,13 @@ bool mx_div_conform (const T1& a, const T2& b) { - int a_nc = a.cols (); - int b_nc = b.cols (); + octave_idx_type a_nc = a.cols (); + octave_idx_type b_nc = b.cols (); if (a_nc != b_nc) { - int a_nr = a.rows (); - int b_nr = b.rows (); + octave_idx_type a_nr = a.rows (); + octave_idx_type b_nr = b.rows (); gripe_nonconformant ("operator /", a_nr, a_nc, b_nr, b_nc); return false; @@ -134,7 +134,7 @@ Matrix atmp = a.transpose (); SparseMatrix btmp = b.transpose (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -146,7 +146,7 @@ return Matrix (result.transpose ()); } - int rank; + octave_idx_type rank; Matrix result = btmp.lssolve (atmp, info, rank); return result.transpose (); @@ -162,7 +162,7 @@ Matrix atmp = a.transpose (); SparseComplexMatrix btmp = b.hermitian (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -174,7 +174,7 @@ return result.hermitian (); } - int rank; + octave_idx_type rank; ComplexMatrix result = btmp.lssolve (atmp, info, rank); return result.hermitian (); @@ -190,7 +190,7 @@ ComplexMatrix atmp = a.hermitian (); SparseMatrix btmp = b.transpose (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -202,7 +202,7 @@ return result.hermitian (); } - int rank; + octave_idx_type rank; ComplexMatrix result = btmp.lssolve (atmp, info, rank); return result.hermitian (); @@ -218,7 +218,7 @@ ComplexMatrix atmp = a.hermitian (); SparseComplexMatrix btmp = b.hermitian (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -230,7 +230,7 @@ return result.hermitian (); } - int rank; + octave_idx_type rank; ComplexMatrix result = btmp.lssolve (atmp, info, rank); return result.hermitian (); @@ -246,7 +246,7 @@ SparseMatrix atmp = a.transpose (); SparseMatrix btmp = b.transpose (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -258,7 +258,7 @@ return SparseMatrix (result.transpose ()); } - int rank; + octave_idx_type rank; SparseMatrix result = btmp.lssolve (atmp, info, rank); return result.transpose (); @@ -274,7 +274,7 @@ SparseMatrix atmp = a.transpose (); SparseComplexMatrix btmp = b.hermitian (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -286,7 +286,7 @@ return result.hermitian (); } - int rank; + octave_idx_type rank; SparseComplexMatrix result = btmp.lssolve (atmp, info, rank); return result.hermitian (); @@ -302,7 +302,7 @@ SparseComplexMatrix atmp = a.hermitian (); SparseMatrix btmp = b.transpose (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -314,7 +314,7 @@ return result.hermitian (); } - int rank; + octave_idx_type rank; SparseComplexMatrix result = btmp.lssolve (atmp, info, rank); return result.hermitian (); @@ -330,7 +330,7 @@ SparseComplexMatrix atmp = a.hermitian (); SparseComplexMatrix btmp = b.hermitian (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -342,7 +342,7 @@ return result.hermitian (); } - int rank; + octave_idx_type rank; SparseComplexMatrix result = btmp.lssolve (atmp, info, rank); return result.hermitian (); @@ -360,8 +360,8 @@ Matrix x_el_div (double a, const SparseMatrix& b) { - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); Matrix result; if (a == 0.) @@ -372,8 +372,8 @@ result = Matrix (nr, nc, -octave_Inf); - for (int j = 0; j < nc; j++) - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { OCTAVE_QUIT; result.elem (b.ridx(i), j) = a / b.data (i); @@ -385,13 +385,13 @@ ComplexMatrix x_el_div (double a, const SparseComplexMatrix& b) { - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); ComplexMatrix result (nr, nc, Complex(octave_NaN, octave_NaN)); - for (int j = 0; j < nc; j++) - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { OCTAVE_QUIT; result.elem (b.ridx(i), j) = a / b.data (i); @@ -403,13 +403,13 @@ ComplexMatrix x_el_div (const Complex a, const SparseMatrix& b) { - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); ComplexMatrix result (nr, nc, (a / 0.0)); - for (int j = 0; j < nc; j++) - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { OCTAVE_QUIT; result.elem (b.ridx(i), j) = a / b.data (i); @@ -421,13 +421,13 @@ ComplexMatrix x_el_div (const Complex a, const SparseComplexMatrix& b) { - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); ComplexMatrix result (nr, nc, (a / 0.0)); - for (int j = 0; j < nc; j++) - for (int i = b.cidx(j); i < b.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) { OCTAVE_QUIT; result.elem (b.ridx(i), j) = a / b.data (i); @@ -456,7 +456,7 @@ if (! mx_leftdiv_conform (a, b)) return Matrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -468,7 +468,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } @@ -479,7 +479,7 @@ if (! mx_leftdiv_conform (a, b)) return ComplexMatrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -491,7 +491,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } @@ -502,7 +502,7 @@ if (! mx_leftdiv_conform (a, b)) return SparseMatrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -514,7 +514,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } @@ -525,7 +525,7 @@ if (! mx_leftdiv_conform (a, b)) return SparseComplexMatrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -537,7 +537,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } @@ -548,7 +548,7 @@ if (! mx_leftdiv_conform (a, b)) return ComplexMatrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -560,7 +560,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } @@ -571,7 +571,7 @@ if (! mx_leftdiv_conform (a, b)) return ComplexMatrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -583,7 +583,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } @@ -594,7 +594,7 @@ if (! mx_leftdiv_conform (a, b)) return SparseComplexMatrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -606,7 +606,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } @@ -617,7 +617,7 @@ if (! mx_leftdiv_conform (a, b)) return SparseComplexMatrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -629,7 +629,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } diff -r eae7b40388e9 -r 23b37da9fd5b src/sparse-xpow.cc --- a/src/sparse-xpow.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/sparse-xpow.cc Fri Apr 08 16:07:37 2005 +0000 @@ -57,8 +57,8 @@ { octave_value retval; - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); if (nr == 0 || nc == 0 || nr != nc) error ("for A^b, A must be square"); @@ -70,12 +70,12 @@ if (btmp == 0) { SparseMatrix tmp = SparseMatrix (nr, nr, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { tmp.data (i) = 1.0; tmp.ridx (i) = i; } - for (int i = 0; i < nr + 1; i++) + for (octave_idx_type i = 0; i < nr + 1; i++) tmp.cidx (i) = i; retval = tmp; @@ -87,7 +87,7 @@ { btmp = -btmp; - int info; + octave_idx_type info; double rcond = 0.0; atmp = a.inverse (info, rcond, 1); @@ -129,8 +129,8 @@ { octave_value retval; - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); if (nr == 0 || nc == 0 || nr != nc) error ("for A^b, A must be square"); @@ -142,12 +142,12 @@ if (btmp == 0) { SparseMatrix tmp = SparseMatrix (nr, nr, nr); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { tmp.data (i) = 1.0; tmp.ridx (i) = i; } - for (int i = 0; i < nr + 1; i++) + for (octave_idx_type i = 0; i < nr + 1; i++) tmp.cidx (i) = i; retval = tmp; @@ -159,7 +159,7 @@ { btmp = -btmp; - int info; + octave_idx_type info; double rcond = 0.0; atmp = a.inverse (info, rcond, 1); @@ -231,8 +231,8 @@ { octave_value retval; - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); double d1, d2; @@ -241,9 +241,9 @@ Complex atmp (a); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = pow (atmp, b(i,j)); @@ -256,9 +256,9 @@ { Matrix result (nr, nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = pow (a, b(i,j)); @@ -275,15 +275,15 @@ octave_value elem_xpow (double a, const SparseComplexMatrix& b) { - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); Complex atmp (a); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = pow (atmp, b(i,j)); @@ -303,12 +303,12 @@ octave_value retval; - int nz = a.nnz (); + octave_idx_type nz = a.nnz (); if (b <= 0.0) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); if (static_cast (b) != b && a.any_element_is_negative ()) { @@ -318,8 +318,8 @@ // converting A and B to complex instead of just A. Complex btmp (b); - for (int j = 0; j < nc; j++) - for (int i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { OCTAVE_QUIT; @@ -334,8 +334,8 @@ { Matrix result (nr, nc, (pow (0.0, b))); - for (int j = 0; j < nc; j++) - for (int i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { OCTAVE_QUIT; result (a.ridx(i), j) = pow (a.data (i), b); @@ -348,7 +348,7 @@ { SparseComplexMatrix result (a); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { OCTAVE_QUIT; @@ -369,7 +369,7 @@ { SparseMatrix result (a); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { OCTAVE_QUIT; result.data (i) = pow (a.data (i), b); @@ -389,11 +389,11 @@ { octave_value retval; - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (nr != b_nr || nc != b_nc) { @@ -402,8 +402,8 @@ } int convert_to_complex = 0; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; double atmp = a (i, j); @@ -417,9 +417,9 @@ done: - int nel = 0; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) if (!(a.elem (i, j) == 0. && b.elem (i, j) != 0.)) nel++; @@ -427,11 +427,11 @@ { SparseComplexMatrix complex_result (nr, nc, nel); - int ii = 0; + octave_idx_type ii = 0; complex_result.cidx(0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; Complex atmp (a (i, j)); @@ -452,12 +452,12 @@ else { SparseMatrix result (nr, nc, nel); - int ii = 0; + octave_idx_type ii = 0; result.cidx (0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; double tmp = pow (a (i, j), b (i, j)); @@ -489,10 +489,10 @@ retval = octave_value (NDArray (a.dims (), 1)); else { - int nz = a.nnz (); + octave_idx_type nz = a.nnz (); SparseComplexMatrix result (a); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { OCTAVE_QUIT; result.data (i) = pow (Complex (a.data (i)), b); @@ -510,11 +510,11 @@ octave_value elem_xpow (const SparseMatrix& a, const SparseComplexMatrix& b) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (nr != b_nr || nc != b_nc) { @@ -522,19 +522,19 @@ return octave_value (); } - int nel = 0; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) if (!(a.elem (i, j) == 0. && b.elem (i, j) != 0.)) nel++; SparseComplexMatrix result (nr, nc, nel); - int ii = 0; + octave_idx_type ii = 0; result.cidx(0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; Complex tmp = pow (Complex (a (i, j)), b (i, j)); @@ -556,14 +556,14 @@ octave_value elem_xpow (const Complex& a, const SparseMatrix& b) { - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; double btmp = b (i, j); @@ -581,12 +581,12 @@ octave_value elem_xpow (const Complex& a, const SparseComplexMatrix& b) { - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = pow (a, b (i, j)); @@ -603,15 +603,15 @@ if (b <= 0) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); ComplexMatrix result (nr, nc, Complex (pow (0.0, b))); if (xisint (b)) { - for (int j = 0; j < nc; j++) - for (int i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { OCTAVE_QUIT; result (a.ridx(i), j) = @@ -620,8 +620,8 @@ } else { - for (int j = 0; j < nc; j++) - for (int i = a.cidx(j); i < a.cidx(j+1); i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) { OCTAVE_QUIT; result (a.ridx(i), j) = pow (a.data (i), b); @@ -632,13 +632,13 @@ } else { - int nz = a.nnz (); + octave_idx_type nz = a.nnz (); SparseComplexMatrix result (a); if (xisint (b)) { - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { OCTAVE_QUIT; result.data (i) = pow (a.data (i), static_cast (b)); @@ -646,7 +646,7 @@ } else { - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { OCTAVE_QUIT; result.data (i) = pow (a.data (i), b); @@ -665,11 +665,11 @@ octave_value elem_xpow (const SparseComplexMatrix& a, const SparseMatrix& b) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (nr != b_nr || nc != b_nc) { @@ -677,19 +677,19 @@ return octave_value (); } - int nel = 0; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) if (!(a.elem (i, j) == 0. && b.elem (i, j) != 0.)) nel++; SparseComplexMatrix result (nr, nc, nel); - int ii = 0; + octave_idx_type ii = 0; result.cidx (0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; double btmp = b (i, j); @@ -725,11 +725,11 @@ else { - int nz = a.nnz (); + octave_idx_type nz = a.nnz (); SparseComplexMatrix result (a); - for (int i = 0; i < nz; i++) + for (octave_idx_type i = 0; i < nz; i++) { OCTAVE_QUIT; result.data (i) = pow (a.data (i), b); @@ -747,11 +747,11 @@ octave_value elem_xpow (const SparseComplexMatrix& a, const SparseComplexMatrix& b) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (nr != b_nr || nc != b_nc) { @@ -759,19 +759,19 @@ return octave_value (); } - int nel = 0; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + octave_idx_type nel = 0; + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) if (!(a.elem (i, j) == 0. && b.elem (i, j) != 0.)) nel++; SparseComplexMatrix result (nr, nc, nel); - int ii = 0; + octave_idx_type ii = 0; result.cidx (0) = 0; - for (int j = 0; j < nc; j++) + for (octave_idx_type j = 0; j < nc; j++) { - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; Complex tmp = pow (a (i, j), b (i, j)); diff -r eae7b40388e9 -r 23b37da9fd5b src/symtab.h --- a/src/symtab.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/symtab.h Fri Apr 08 16:07:37 2005 +0000 @@ -173,17 +173,17 @@ size_t byte_size (void) const { return definition.byte_size (); }; - int numel (void) const + octave_idx_type numel (void) const { return definition.numel (); }; - int capacity (void) const + octave_idx_type capacity (void) const { return definition.capacity (); }; dim_vector dims (void) const { return definition.dims (); } - int rows (void) const { return definition.rows (); } - int columns (void) const { return definition.columns (); } + octave_idx_type rows (void) const { return definition.rows (); } + octave_idx_type columns (void) const { return definition.columns (); } std::string type_name (void) const { return definition.type_name (); } @@ -380,10 +380,10 @@ size_t byte_size (void) const { return definition->byte_size (); }; - int numel (void) const + octave_idx_type numel (void) const { return definition->numel (); }; - int capacity (void) const + octave_idx_type capacity (void) const { return definition->capacity (); }; dim_vector dims (void) const { return definition->dims (); } @@ -394,8 +394,8 @@ std::string make_dimensions_string (int print_dims) const; - int rows (void) const { return definition->rows (); } - int columns (void) const { return definition->columns (); } + octave_idx_type rows (void) const { return definition->rows (); } + octave_idx_type columns (void) const { return definition->columns (); } std::string type_name (void) const { return definition->type_name (); } diff -r eae7b40388e9 -r 23b37da9fd5b src/toplev.cc --- a/src/toplev.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/toplev.cc Fri Apr 08 16:07:37 2005 +0000 @@ -689,6 +689,7 @@ "STATIC_LIBS", OCTAVE_CONF_STATIC_LIBS, "DEFS", OCTAVE_CONF_DEFS, "UGLY_DEFS", OCTAVE_CONF_UGLY_DEFS, + "USE_64_BIT_IDX_T", OCTAVE_CONF_USE_64_BIT_IDX_T, "ENABLE_DYNAMIC_LINKING", OCTAVE_CONF_ENABLE_DYNAMIC_LINKING, "XTRA_CFLAGS", OCTAVE_CONF_XTRA_CFLAGS, "XTRA_CXXFLAGS", OCTAVE_CONF_XTRA_CXXFLAGS, diff -r eae7b40388e9 -r 23b37da9fd5b src/utils.cc --- a/src/utils.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/utils.cc Fri Apr 08 16:07:37 2005 +0000 @@ -229,7 +229,7 @@ // should be considered fatal; return 1 if this is ok. int -empty_arg (const char * /* name */, int nr, int nc) +empty_arg (const char * /* name */, octave_idx_type nr, octave_idx_type nc) { return (nr == 0 || nc == 0); } @@ -755,7 +755,7 @@ } static void -check_dimensions (int& nr, int& nc, const char *warnfor) +check_dimensions (octave_idx_type& nr, octave_idx_type& nc, const char *warnfor) { if (nr < 0 || nc < 0) { @@ -798,8 +798,8 @@ } else { - int nr = a.rows (); - int nc = a.columns (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.columns (); if (nr == 1 || nc == 1) { @@ -808,9 +808,9 @@ if (error_state) return; - int n = v.length (); + octave_idx_type n = v.length (); dim.resize (n); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) dim(i) = static_cast (fix (v(i))); } else @@ -824,7 +824,7 @@ void get_dimensions (const octave_value& a, const char *warn_for, - int& nr, int& nc) + octave_idx_type& nr, octave_idx_type& nc) { if (a.is_scalar_type ()) { @@ -842,8 +842,8 @@ if (error_state) return; - nr = static_cast (fix (v (0))); - nc = static_cast (fix (v (1))); + nr = static_cast (fix (v (0))); + nc = static_cast (fix (v (1))); } else error ("%s (A): use %s (size (A)) instead", warn_for, warn_for); @@ -855,7 +855,7 @@ void get_dimensions (const octave_value& a, const octave_value& b, - const char *warn_for, int& nr, int& nc) + const char *warn_for, octave_idx_type& nr, octave_idx_type& nc) { nr = a.is_empty () ? 0 : a.int_value (); nc = b.is_empty () ? 0 : b.int_value (); @@ -867,15 +867,15 @@ } Matrix -identity_matrix (int nr, int nc) +identity_matrix (octave_idx_type nr, octave_idx_type nc) { Matrix m (nr, nc, 0.0); if (nr > 0 && nc > 0) { - int n = std::min (nr, nc); + octave_idx_type n = std::min (nr, nc); - for (int i = 0; i < n; i++) + for (octave_idx_type i = 0; i < n; i++) m (i, i) = 1.0; } diff -r eae7b40388e9 -r 23b37da9fd5b src/utils.h --- a/src/utils.h Thu Apr 07 21:51:37 2005 +0000 +++ b/src/utils.h Fri Apr 08 16:07:37 2005 +0000 @@ -46,7 +46,7 @@ const std::string& s, int min_toks_to_match, int max_toks); -extern int empty_arg (const char *name, int nr, int nc); +extern int empty_arg (const char *name, octave_idx_type nr, octave_idx_type nc); extern std::string search_path_for_file (const std::string&, const string_vector&); @@ -75,13 +75,13 @@ extern void get_dimensions (const octave_value& a, const octave_value& b, - const char *warn_for, int& nr, int& nc); + const char *warn_for, octave_idx_type& nr, octave_idx_type& nc); extern void get_dimensions (const octave_value& a, - const char *warn_for, int& nr, int& nc); + const char *warn_for, octave_idx_type& nr, octave_idx_type& nc); -extern Matrix identity_matrix (int nr, int nc); +extern Matrix identity_matrix (octave_idx_type nr, octave_idx_type nc); extern int octave_format (std::ostream& os, const char *fmt, ...); diff -r eae7b40388e9 -r 23b37da9fd5b src/xdiv.cc --- a/src/xdiv.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/xdiv.cc Fri Apr 08 16:07:37 2005 +0000 @@ -38,7 +38,7 @@ #include "xdiv.h" static inline bool -result_ok (int info) +result_ok (octave_idx_type info) { assert (info != -1); @@ -56,13 +56,13 @@ bool mx_leftdiv_conform (const T1& a, const T2& b) { - int a_nr = a.rows (); - int b_nr = b.rows (); + octave_idx_type a_nr = a.rows (); + octave_idx_type b_nr = b.rows (); if (a_nr != b_nr) { - int a_nc = a.cols (); - int b_nc = b.cols (); + octave_idx_type a_nc = a.cols (); + octave_idx_type b_nc = b.cols (); gripe_nonconformant ("operator \\", a_nr, a_nc, b_nr, b_nc); return false; @@ -83,13 +83,13 @@ bool mx_div_conform (const T1& a, const T2& b) { - int a_nc = a.cols (); - int b_nc = b.cols (); + octave_idx_type a_nc = a.cols (); + octave_idx_type b_nc = b.cols (); if (a_nc != b_nc) { - int a_nr = a.rows (); - int b_nr = b.rows (); + octave_idx_type a_nr = a.rows (); + octave_idx_type b_nr = b.rows (); gripe_nonconformant ("operator /", a_nr, a_nc, b_nr, b_nc); return false; @@ -125,7 +125,7 @@ Matrix atmp = a.transpose (); Matrix btmp = b.transpose (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -137,7 +137,7 @@ return Matrix (result.transpose ()); } - int rank; + octave_idx_type rank; Matrix result = btmp.lssolve (atmp, info, rank); return result.transpose (); @@ -153,7 +153,7 @@ Matrix atmp = a.transpose (); ComplexMatrix btmp = b.hermitian (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -165,7 +165,7 @@ return result.hermitian (); } - int rank; + octave_idx_type rank; ComplexMatrix result = btmp.lssolve (atmp, info, rank); return result.hermitian (); @@ -181,7 +181,7 @@ ComplexMatrix atmp = a.hermitian (); Matrix btmp = b.transpose (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -193,7 +193,7 @@ return result.hermitian (); } - int rank; + octave_idx_type rank; ComplexMatrix result = btmp.lssolve (atmp, info, rank); return result.hermitian (); @@ -209,7 +209,7 @@ ComplexMatrix atmp = a.hermitian (); ComplexMatrix btmp = b.hermitian (); - int info; + octave_idx_type info; if (btmp.rows () == btmp.columns ()) { double rcond = 0.0; @@ -221,7 +221,7 @@ return result.hermitian (); } - int rank; + octave_idx_type rank; ComplexMatrix result = btmp.lssolve (atmp, info, rank); return result.hermitian (); @@ -239,13 +239,13 @@ Matrix x_el_div (double a, const Matrix& b) { - int nr = b.rows (); - int nc = b.columns (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.columns (); Matrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = a / b (i, j); @@ -257,13 +257,13 @@ ComplexMatrix x_el_div (double a, const ComplexMatrix& b) { - int nr = b.rows (); - int nc = b.columns (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.columns (); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = a / b (i, j); @@ -275,13 +275,13 @@ ComplexMatrix x_el_div (const Complex a, const Matrix& b) { - int nr = b.rows (); - int nc = b.columns (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.columns (); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = a / b (i, j); @@ -293,13 +293,13 @@ ComplexMatrix x_el_div (const Complex a, const ComplexMatrix& b) { - int nr = b.rows (); - int nc = b.columns (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.columns (); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = a / b (i, j); @@ -322,7 +322,7 @@ { NDArray result (b.dims ()); - for (int i = 0; i < b.length (); i++) + for (octave_idx_type i = 0; i < b.length (); i++) { OCTAVE_QUIT; result (i) = a / b (i); @@ -336,7 +336,7 @@ { ComplexNDArray result (b.dims ()); - for (int i = 0; i < b.length (); i++) + for (octave_idx_type i = 0; i < b.length (); i++) { OCTAVE_QUIT; result (i) = a / b (i); @@ -350,7 +350,7 @@ { ComplexNDArray result (b.dims ()); - for (int i = 0; i < b.length (); i++) + for (octave_idx_type i = 0; i < b.length (); i++) { OCTAVE_QUIT; result (i) = a / b (i); @@ -364,7 +364,7 @@ { ComplexNDArray result (b.dims ()); - for (int i = 0; i < b.length (); i++) + for (octave_idx_type i = 0; i < b.length (); i++) { OCTAVE_QUIT; result (i) = a / b (i); @@ -389,7 +389,7 @@ if (! mx_leftdiv_conform (a, b)) return Matrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -401,7 +401,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } @@ -412,7 +412,7 @@ if (! mx_leftdiv_conform (a, b)) return ComplexMatrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -424,7 +424,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } @@ -435,7 +435,7 @@ if (! mx_leftdiv_conform (a, b)) return ComplexMatrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -447,7 +447,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } @@ -458,7 +458,7 @@ if (! mx_leftdiv_conform (a, b)) return ComplexMatrix (); - int info; + octave_idx_type info; if (a.rows () == a.columns ()) { double rcond = 0.0; @@ -470,7 +470,7 @@ return result; } - int rank; + octave_idx_type rank; return a.lssolve (b, info, rank); } diff -r eae7b40388e9 -r 23b37da9fd5b src/xpow.cc --- a/src/xpow.cc Thu Apr 07 21:51:37 2005 +0000 +++ b/src/xpow.cc Fri Apr 08 16:07:37 2005 +0000 @@ -43,6 +43,10 @@ #include "utils.h" #include "xpow.h" +#ifdef _OPENMP +#include +#endif + static inline int xisint (double x) { @@ -84,8 +88,8 @@ { octave_value retval; - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); if (nr == 0 || nc == 0 || nr != nc) error ("for x^A, A must be square"); @@ -95,7 +99,7 @@ ComplexColumnVector lambda (b_eig.eigenvalues ()); ComplexMatrix Q (b_eig.eigenvectors ()); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { Complex elt = lambda (i); if (std::imag (elt) == 0.0) @@ -127,8 +131,8 @@ { octave_value retval; - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); if (nr == 0 || nc == 0 || nr != nc) error ("for x^A, A must be square"); @@ -138,7 +142,7 @@ ComplexColumnVector lambda (b_eig.eigenvalues ()); ComplexMatrix Q (b_eig.eigenvectors ()); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { Complex elt = lambda (i); if (std::imag (elt) == 0.0) @@ -160,8 +164,8 @@ { octave_value retval; - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); if (nr == 0 || nc == 0 || nr != nc) error ("for A^b, A must be square"); @@ -185,7 +189,7 @@ { btmp = -btmp; - int info; + octave_idx_type info; double rcond = 0.0; atmp = a.inverse (info, rcond, 1); @@ -221,7 +225,7 @@ ComplexColumnVector lambda (a_eig.eigenvalues ()); ComplexMatrix Q (a_eig.eigenvectors ()); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) lambda (i) = std::pow (lambda (i), b); ComplexDiagMatrix D (lambda); @@ -239,8 +243,8 @@ { octave_value retval; - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); if (nr == 0 || nc == 0 || nr != nc) error ("for A^b, A must be square"); @@ -250,7 +254,7 @@ ComplexColumnVector lambda (a_eig.eigenvalues ()); ComplexMatrix Q (a_eig.eigenvectors ()); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) lambda (i) = std::pow (lambda (i), b); ComplexDiagMatrix D (lambda); @@ -281,8 +285,8 @@ { octave_value retval; - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); if (nr == 0 || nc == 0 || nr != nc) error ("for x^A, A must be square"); @@ -292,7 +296,7 @@ ComplexColumnVector lambda (b_eig.eigenvalues ()); ComplexMatrix Q (b_eig.eigenvectors ()); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { Complex elt = lambda (i); if (std::imag (elt) == 0.0) @@ -323,8 +327,8 @@ { octave_value retval; - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); if (nr == 0 || nc == 0 || nr != nc) error ("for x^A, A must be square"); @@ -334,7 +338,7 @@ ComplexColumnVector lambda (b_eig.eigenvalues ()); ComplexMatrix Q (b_eig.eigenvectors ()); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) { Complex elt = lambda (i); if (std::imag (elt) == 0.0) @@ -356,8 +360,8 @@ { octave_value retval; - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); if (nr == 0 || nc == 0 || nr != nc) error ("for A^b, A must be square"); @@ -381,7 +385,7 @@ { btmp = -btmp; - int info; + octave_idx_type info; double rcond = 0.0; atmp = a.inverse (info, rcond, 1); @@ -417,7 +421,7 @@ ComplexColumnVector lambda (a_eig.eigenvalues ()); ComplexMatrix Q (a_eig.eigenvectors ()); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) lambda (i) = std::pow (lambda (i), b); ComplexDiagMatrix D (lambda); @@ -435,8 +439,8 @@ { octave_value retval; - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); if (nr == 0 || nc == 0 || nr != nc) error ("for A^b, A must be square"); @@ -446,7 +450,7 @@ ComplexColumnVector lambda (a_eig.eigenvalues ()); ComplexMatrix Q (a_eig.eigenvectors ()); - for (int i = 0; i < nr; i++) + for (octave_idx_type i = 0; i < nr; i++) lambda (i) = std::pow (lambda (i), b); ComplexDiagMatrix D (lambda); @@ -492,8 +496,8 @@ { octave_value retval; - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); double d1, d2; @@ -501,8 +505,9 @@ { Complex atmp (a); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (atmp, b (i, j)); @@ -513,8 +518,9 @@ else { Matrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (a, b (i, j)); @@ -530,13 +536,14 @@ octave_value elem_xpow (double a, const ComplexMatrix& b) { - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); ComplexMatrix result (nr, nc); Complex atmp (a); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (atmp, b (i, j)); @@ -551,16 +558,17 @@ { octave_value retval; - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); if (static_cast (b) != b && a.any_element_is_negative ()) { ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + 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)); @@ -572,8 +580,9 @@ else { Matrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (a (i, j), b); @@ -591,11 +600,11 @@ { octave_value retval; - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (nr != b_nr || nc != b_nc) { @@ -604,8 +613,8 @@ } int convert_to_complex = 0; - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; double atmp = a (i, j); @@ -623,8 +632,8 @@ { ComplexMatrix complex_result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; Complex atmp (a (i, j)); @@ -638,8 +647,8 @@ { Matrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (a (i, j), b (i, j)); @@ -655,12 +664,13 @@ octave_value elem_xpow (const Matrix& a, const Complex& b) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (Complex (a (i, j)), b); @@ -673,11 +683,11 @@ octave_value elem_xpow (const Matrix& a, const ComplexMatrix& b) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (nr != b_nr || nc != b_nc) { @@ -686,8 +696,9 @@ } ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (Complex (a (i, j)), b (i, j)); @@ -700,12 +711,13 @@ octave_value elem_xpow (const Complex& a, const Matrix& b) { - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; double btmp = b (i, j); @@ -722,12 +734,13 @@ octave_value elem_xpow (const Complex& a, const ComplexMatrix& b) { - int nr = b.rows (); - int nc = b.cols (); + octave_idx_type nr = b.rows (); + octave_idx_type nc = b.cols (); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (a, b (i, j)); @@ -740,15 +753,15 @@ octave_value elem_xpow (const ComplexMatrix& a, double b) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); ComplexMatrix result (nr, nc); if (xisint (b)) { - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (a (i, j), static_cast (b)); @@ -756,8 +769,8 @@ } else { - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (a (i, j), b); @@ -771,11 +784,11 @@ octave_value elem_xpow (const ComplexMatrix& a, const Matrix& b) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (nr != b_nr || nc != b_nc) { @@ -784,8 +797,9 @@ } ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; double btmp = b (i, j); @@ -802,12 +816,13 @@ octave_value elem_xpow (const ComplexMatrix& a, const Complex& b) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (a (i, j), b); @@ -820,11 +835,11 @@ octave_value elem_xpow (const ComplexMatrix& a, const ComplexMatrix& b) { - int nr = a.rows (); - int nc = a.cols (); + octave_idx_type nr = a.rows (); + octave_idx_type nc = a.cols (); - int b_nr = b.rows (); - int b_nc = b.cols (); + octave_idx_type b_nr = b.rows (); + octave_idx_type b_nc = b.cols (); if (nr != b_nr || nc != b_nc) { @@ -833,8 +848,9 @@ } ComplexMatrix result (nr, nc); - for (int j = 0; j < nc; j++) - for (int i = 0; i < nr; i++) + + for (octave_idx_type j = 0; j < nc; j++) + for (octave_idx_type i = 0; i < nr; i++) { OCTAVE_QUIT; result (i, j) = std::pow (a (i, j), b (i, j)); @@ -884,7 +900,7 @@ { Complex atmp (a); ComplexNDArray result (b.dims ()); - for (int i = 0; i < b.length (); i++) + for (octave_idx_type i = 0; i < b.length (); i++) { OCTAVE_QUIT; result(i) = std::pow (atmp, b(i)); @@ -895,7 +911,7 @@ else { NDArray result (b.dims ()); - for (int i = 0; i < b.length (); i++) + for (octave_idx_type i = 0; i < b.length (); i++) { OCTAVE_QUIT; result (i) = std::pow (a, b(i)); @@ -913,7 +929,8 @@ { ComplexNDArray result (b.dims ()); Complex atmp (a); - for (int i = 0; i < b.length (); i++) + + for (octave_idx_type i = 0; i < b.length (); i++) { OCTAVE_QUIT; result(i) = std::pow (atmp, b(i)); @@ -932,7 +949,7 @@ { ComplexNDArray result (a.dims ()); - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) { OCTAVE_QUIT; @@ -947,7 +964,7 @@ { NDArray result (a.dims ()); - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) { OCTAVE_QUIT; result(i) = std::pow (a(i), b); @@ -978,7 +995,7 @@ bool convert_to_complex = false; - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { OCTAVE_QUIT; double atmp = a(i); @@ -996,7 +1013,7 @@ { ComplexNDArray complex_result (a_dims); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { OCTAVE_QUIT; Complex atmp (a(i)); @@ -1010,7 +1027,7 @@ { NDArray result (a_dims); - for (int i = 0; i < len; i++) + for (octave_idx_type i = 0; i < len; i++) { OCTAVE_QUIT; result(i) = std::pow (a(i), b(i)); @@ -1028,7 +1045,7 @@ { ComplexNDArray result (a.dims ()); - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) { OCTAVE_QUIT; result(i) = std::pow (Complex (a(i)), b); @@ -1051,7 +1068,8 @@ } ComplexNDArray result (a_dims); - for (int i = 0; i < a.length (); i++) + + for (octave_idx_type i = 0; i < a.length (); i++) { OCTAVE_QUIT; result(i) = std::pow (Complex (a(i)), b(i)); @@ -1065,7 +1083,8 @@ elem_xpow (const Complex& a, const NDArray& b) { ComplexNDArray result (b.dims ()); - for (int i = 0; i < b.length (); i++) + + for (octave_idx_type i = 0; i < b.length (); i++) { OCTAVE_QUIT; double btmp = b(i); @@ -1083,7 +1102,8 @@ elem_xpow (const Complex& a, const ComplexNDArray& b) { ComplexNDArray result (b.dims ()); - for (int i = 0; i < b.length (); i++) + + for (octave_idx_type i = 0; i < b.length (); i++) { OCTAVE_QUIT; result(i) = std::pow (a, b(i)); @@ -1100,7 +1120,7 @@ if (xisint (b)) { - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) { OCTAVE_QUIT; result(i) = std::pow (a(i), static_cast (b)); @@ -1108,7 +1128,7 @@ } else { - for (int i = 0; i < a.length (); i++) + for (octave_idx_type i = 0; i < a.length (); i++) { OCTAVE_QUIT; result(i) = std::pow (a(i), b); @@ -1132,7 +1152,8 @@ } ComplexNDArray result (a_dims); - for (int i = 0; i < a.length (); i++) + + for (octave_idx_type i = 0; i < a.length (); i++) { OCTAVE_QUIT; double btmp = b(i); @@ -1150,7 +1171,8 @@ elem_xpow (const ComplexNDArray& a, const Complex& b) { ComplexNDArray result (a.dims ()); - for (int i = 0; i < a.length (); i++) + + for (octave_idx_type i = 0; i < a.length (); i++) { OCTAVE_QUIT; result(i) = std::pow (a(i), b); @@ -1173,7 +1195,8 @@ } ComplexNDArray result (a_dims); - for (int i = 0; i < a.length (); i++) + + for (octave_idx_type i = 0; i < a.length (); i++) { OCTAVE_QUIT; result(i) = std::pow (a(i), b(i));