# HG changeset patch # User Kai T. Ohlhus # Date 1452099842 -3600 # Node ID 63374982750bea68d4a1e42e716860755d8ae371 # Parent 3e7cfee5f7862efff6cf4b3efa19492eeeaa4ccc Usage of corresponding value extractor for octave_idx_type. Improves support for large matrices in 64 bit builds, e.g. calls of "size" and large sparse matrix creation. * libinterp/corefcn/daspk.cc(daspk_user_function): Use idx_type_value (). * libinterp/corefcn/data.cc(diag,size): Use idx_type_value (). * libinterp/corefcn/rand.cc(do_rand): Use idx_type_value (). * libinterp/corefcn/tril.cc(do_trilu): Use idx_type_value (). * libinterp/corefcn/utils.cc(get_dimensions): Use idx_type_value (). * libinterp/dldfcn/qr.cc(qrshift): Use idx_type_value (). diff -r 3e7cfee5f786 -r 63374982750b libinterp/corefcn/daspk.cc --- a/libinterp/corefcn/daspk.cc Tue Jan 05 14:16:58 2016 -0800 +++ b/libinterp/corefcn/daspk.cc Wed Jan 06 18:04:02 2016 +0100 @@ -96,7 +96,7 @@ retval = tmp(0).vector_value (); if (tlen > 1) - ires = tmp(1).int_value (); + ires = tmp(1).idx_type_value (); if (retval.is_empty ()) gripe_user_supplied_eval ("daspk"); diff -r 3e7cfee5f786 -r 63374982750b libinterp/corefcn/data.cc --- a/libinterp/corefcn/data.cc Tue Jan 05 14:16:58 2016 -0800 +++ b/libinterp/corefcn/data.cc Wed Jan 06 18:04:02 2016 +0100 @@ -1367,7 +1367,7 @@ retval = args(0).diag (); else if (nargin == 2) { - octave_idx_type k = args(1).xint_value ("diag: invalid argument K"); + octave_idx_type k = args(1).xidx_type_value ("diag: invalid argument K"); retval = args(0).diag (k); } @@ -1378,8 +1378,8 @@ if (arg0.ndims () != 2 || (arg0.rows () != 1 && arg0.columns () != 1)) error ("diag: V must be a vector"); - octave_idx_type m = args(1).xint_value ("diag: invalid dimensions"); - octave_idx_type n = args(2).xint_value ("diag: invalid dimensions"); + octave_idx_type m = args(1).xidx_type_value ("diag: invalid dimensions"); + octave_idx_type n = args(2).xidx_type_value ("diag: invalid dimensions"); retval = arg0.diag (m, n); } @@ -2783,7 +2783,7 @@ } else if (nargin == 2 && nargout < 2) { - octave_idx_type nd = args(1).xint_value ("size: DIM must be an integer"); + octave_idx_type nd = args(1).xidx_type_value ("size: DIM must be an integer"); const dim_vector dv = args(0).dims (); diff -r 3e7cfee5f786 -r 63374982750b libinterp/corefcn/rand.cc --- a/libinterp/corefcn/rand.cc Tue Jan 05 14:16:58 2016 -0800 +++ b/libinterp/corefcn/rand.cc Wed Jan 06 18:04:02 2016 +0100 @@ -259,7 +259,10 @@ for (int i = 0; i < nargin; i++) { - octave_idx_type elt = args(idx+i).xint_value ("%s: dimension must be a scalar or array of integers", fcn); + octave_idx_type elt = + args(idx+i).xidx_type_value ( + "%s: dimension must be a scalar or array of integers", + fcn); // Negative dimensions treated as zero for Matlab compatibility dims(i) = elt >= 0 ? elt : 0; diff -r 3e7cfee5f786 -r 63374982750b libinterp/corefcn/tril.cc --- a/libinterp/corefcn/tril.cc Tue Jan 05 14:16:58 2016 -0800 +++ b/libinterp/corefcn/tril.cc Wed Jan 06 18:04:02 2016 +0100 @@ -200,7 +200,7 @@ octave_idx_type k = 0; if (nargin == 2) - k = args(1).int_value (true); + k = args(1).idx_type_value (true); octave_value arg = args(0); diff -r 3e7cfee5f786 -r 63374982750b libinterp/corefcn/utils.cc --- a/libinterp/corefcn/utils.cc Tue Jan 05 14:16:58 2016 -0800 +++ b/libinterp/corefcn/utils.cc Wed Jan 06 18:04:02 2016 +0100 @@ -1121,7 +1121,7 @@ if (a.is_scalar_type ()) { dim.resize (2); - dim(0) = a.int_value (); + dim(0) = a.idx_type_value (); dim(1) = dim(0); } else @@ -1149,7 +1149,7 @@ { if (a.is_scalar_type ()) { - nr = nc = a.int_value (); + nr = nc = a.idx_type_value (); } else { @@ -1172,9 +1172,9 @@ const char *warn_for, octave_idx_type& nr, octave_idx_type& nc) { nr = a.is_empty () - ? 0 : a.int_value ("%s: row dimension must be a scalar", warn_for); + ? 0 : a.idx_type_value ("%s: row dimension must be a scalar", warn_for); nc = b.is_empty () - ? 0 : b.int_value ("%s: column dimension must be a scalar", warn_for); + ? 0 : b.idx_type_value ("%s: column dimension must be a scalar", warn_for); check_dimensions (nr, nc, warn_for); } diff -r 3e7cfee5f786 -r 63374982750b libinterp/dldfcn/qr.cc --- a/libinterp/dldfcn/qr.cc Tue Jan 05 14:16:58 2016 -0800 +++ b/libinterp/dldfcn/qr.cc Wed Jan 06 18:04:02 2016 +0100 @@ -1348,8 +1348,8 @@ if (! check_qr_dims (argq, argr, true)) error ("qrshift: dimensions mismatch"); - octave_idx_type i = argi.int_value (); - octave_idx_type j = argj.int_value (); + octave_idx_type i = argi.idx_type_value (); + octave_idx_type j = argj.idx_type_value (); if (! check_index (argi) || ! check_index (argj)) error ("qrshift: invalid index I or J");