Mercurial > octave
comparison liboctave/numeric/CmplxQR.cc @ 20232:a9574e3c6e9e
Deprecate Array::length() and Sparse::length() in favour of ::numel().
* liboctave/array/Array.h (Array::length): deprecate for ::numel.
* liboctave/array/Sparse.h (Sparse::length): deprecate for ::numel.
* libgui/graphics/QtHandlesUtils.cc, libgui/src/octave-qt-link.cc,
libinterp/corefcn/Cell.cc, libinterp/corefcn/__contourc__.cc,
libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc,
libinterp/corefcn/cellfun.cc, libinterp/corefcn/daspk.cc,
libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc,
libinterp/corefcn/data.cc, libinterp/corefcn/filter.cc,
libinterp/corefcn/find.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/gl-render.h, libinterp/corefcn/graphics.cc,
libinterp/corefcn/graphics.in.h, libinterp/corefcn/help.cc,
libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc,
libinterp/corefcn/load-path.cc, libinterp/corefcn/load-save.cc,
libinterp/corefcn/ls-oct-ascii.h, libinterp/corefcn/lsode.cc,
libinterp/corefcn/matrix_type.cc, libinterp/corefcn/oct-hist.cc,
libinterp/corefcn/oct-map.cc, libinterp/corefcn/oct-map.h,
libinterp/corefcn/oct-obj.h, libinterp/corefcn/oct-stream.cc,
libinterp/corefcn/oct-stream.h, libinterp/corefcn/pr-output.cc,
libinterp/corefcn/quadcc.cc, libinterp/corefcn/rand.cc,
libinterp/corefcn/regexp.cc, libinterp/corefcn/strfns.cc,
libinterp/corefcn/sub2ind.cc, libinterp/corefcn/symtab.h,
libinterp/corefcn/syscalls.cc, libinterp/corefcn/tsearch.cc,
libinterp/corefcn/urlwrite.cc, libinterp/corefcn/utils.cc,
libinterp/corefcn/variables.cc, libinterp/corefcn/xdiv.cc,
libinterp/corefcn/xpow.cc, libinterp/dldfcn/__glpk__.cc,
libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__magick_read__.cc,
libinterp/dldfcn/audiodevinfo.cc, libinterp/dldfcn/ccolamd.cc,
libinterp/dldfcn/colamd.cc, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-class.cc, libinterp/octave-value/ov-class.h,
libinterp/octave-value/ov-fcn-inline.cc, libinterp/octave-value/ov-java.cc,
libinterp/octave-value/ov-perm.cc, libinterp/octave-value/ov-struct.cc,
libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov.cc,
libinterp/operators/op-int.h, libinterp/parse-tree/pt-pr-code.cc,
liboctave/array/Array-util.cc, liboctave/array/Array.cc,
liboctave/array/CColVector.cc, liboctave/array/CDiagMatrix.cc,
liboctave/array/CMatrix.cc, liboctave/array/CRowVector.cc,
liboctave/array/DiagArray2.cc, liboctave/array/DiagArray2.h,
liboctave/array/MArray.cc, liboctave/array/PermMatrix.cc,
liboctave/array/PermMatrix.h, liboctave/array/Sparse.cc,
liboctave/array/boolMatrix.cc, liboctave/array/chMatrix.cc,
liboctave/array/chNDArray.cc, liboctave/array/dColVector.cc,
liboctave/array/dDiagMatrix.cc, liboctave/array/dMatrix.cc,
liboctave/array/dRowVector.cc, liboctave/array/fCColVector.cc,
liboctave/array/fCDiagMatrix.cc, liboctave/array/fCMatrix.cc,
liboctave/array/fCRowVector.cc, liboctave/array/fColVector.cc,
liboctave/array/fDiagMatrix.cc, liboctave/array/fMatrix.cc,
liboctave/array/fRowVector.cc, liboctave/array/idx-vector.cc,
liboctave/array/intNDArray.cc, liboctave/numeric/CmplxCHOL.cc,
liboctave/numeric/CmplxLU.cc, liboctave/numeric/CmplxQR.cc,
liboctave/numeric/DASPK.cc, liboctave/numeric/DASRT.cc,
liboctave/numeric/DASSL.cc, liboctave/numeric/LSODE.cc,
liboctave/numeric/ODES.cc, liboctave/numeric/ODES.h,
liboctave/numeric/base-dae.h, liboctave/numeric/base-lu.cc,
liboctave/numeric/dbleCHOL.cc, liboctave/numeric/dbleLU.cc,
liboctave/numeric/dbleQR.cc, liboctave/numeric/eigs-base.cc,
liboctave/numeric/fCmplxCHOL.cc, liboctave/numeric/fCmplxLU.cc,
liboctave/numeric/fCmplxQR.cc, liboctave/numeric/floatCHOL.cc,
liboctave/numeric/floatLU.cc, liboctave/numeric/floatQR.cc,
liboctave/numeric/lo-specfun.cc, liboctave/numeric/oct-rand.cc,
liboctave/numeric/oct-spparms.cc, liboctave/numeric/sparse-base-chol.cc,
liboctave/operators/mx-inlines.cc, liboctave/system/file-ops.cc,
liboctave/util/glob-match.h, liboctave/util/kpse.cc,
liboctave/util/lo-regexp.cc, liboctave/util/oct-glob.cc,
liboctave/util/pathsearch.cc, liboctave/util/str-vec.cc,
liboctave/util/str-vec.h, liboctave/util/url-transfer.cc: replace all usage
of Array::length() and Sparse::length() with ::numel().
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Sat, 30 May 2015 03:14:07 +0100 |
parents | 4197fc428c7d |
children | 7cac4e7458f2 |
comparison
equal
deleted
inserted
replaced
20231:83792dd9bcc1 | 20232:a9574e3c6e9e |
---|---|
210 { | 210 { |
211 octave_idx_type m = q.rows (); | 211 octave_idx_type m = q.rows (); |
212 octave_idx_type n = r.columns (); | 212 octave_idx_type n = r.columns (); |
213 octave_idx_type k = q.columns (); | 213 octave_idx_type k = q.columns (); |
214 | 214 |
215 if (u.length () == m && v.length () == n) | 215 if (u.numel () == m && v.numel () == n) |
216 { | 216 { |
217 ComplexColumnVector utmp = u; | 217 ComplexColumnVector utmp = u; |
218 ComplexColumnVector vtmp = v; | 218 ComplexColumnVector vtmp = v; |
219 OCTAVE_LOCAL_BUFFER (Complex, w, k); | 219 OCTAVE_LOCAL_BUFFER (Complex, w, k); |
220 OCTAVE_LOCAL_BUFFER (double, rw, k); | 220 OCTAVE_LOCAL_BUFFER (double, rw, k); |
257 { | 257 { |
258 octave_idx_type m = q.rows (); | 258 octave_idx_type m = q.rows (); |
259 octave_idx_type n = r.columns (); | 259 octave_idx_type n = r.columns (); |
260 octave_idx_type k = q.columns (); | 260 octave_idx_type k = q.columns (); |
261 | 261 |
262 if (u.length () != m) | 262 if (u.numel () != m) |
263 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 263 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
264 else if (j < 0 || j > n) | 264 else if (j < 0 || j > n) |
265 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 265 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
266 else | 266 else |
267 { | 267 { |
290 octave_idx_type n = r.columns (); | 290 octave_idx_type n = r.columns (); |
291 octave_idx_type k = q.columns (); | 291 octave_idx_type k = q.columns (); |
292 | 292 |
293 Array<octave_idx_type> jsi; | 293 Array<octave_idx_type> jsi; |
294 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); | 294 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); |
295 octave_idx_type nj = js.length (); | 295 octave_idx_type nj = js.numel (); |
296 bool dups = false; | 296 bool dups = false; |
297 for (octave_idx_type i = 0; i < nj - 1; i++) | 297 for (octave_idx_type i = 0; i < nj - 1; i++) |
298 dups = dups && js(i) == js(i+1); | 298 dups = dups && js(i) == js(i+1); |
299 | 299 |
300 if (dups) | 300 if (dups) |
301 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); | 301 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
302 else if (u.length () != m || u.columns () != nj) | 302 else if (u.numel () != m || u.columns () != nj) |
303 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 303 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
304 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) | 304 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) |
305 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 305 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
306 else if (nj > 0) | 306 else if (nj > 0) |
307 { | 307 { |
315 { | 315 { |
316 r.resize (k, n + nj); | 316 r.resize (k, n + nj); |
317 } | 317 } |
318 | 318 |
319 OCTAVE_LOCAL_BUFFER (double, rw, kmax); | 319 OCTAVE_LOCAL_BUFFER (double, rw, kmax); |
320 for (volatile octave_idx_type i = 0; i < js.length (); i++) | 320 for (volatile octave_idx_type i = 0; i < js.numel (); i++) |
321 { | 321 { |
322 octave_idx_type ii = i; | 322 octave_idx_type ii = i; |
323 ComplexColumnVector utmp = u.column (jsi(i)); | 323 ComplexColumnVector utmp = u.column (jsi(i)); |
324 F77_XFCN (zqrinc, ZQRINC, (m, n + ii, std::min (kmax, k + ii), | 324 F77_XFCN (zqrinc, ZQRINC, (m, n + ii, std::min (kmax, k + ii), |
325 q.fortran_vec (), q.rows (), | 325 q.fortran_vec (), q.rows (), |
363 octave_idx_type n = r.columns (); | 363 octave_idx_type n = r.columns (); |
364 octave_idx_type k = q.columns (); | 364 octave_idx_type k = q.columns (); |
365 | 365 |
366 Array<octave_idx_type> jsi; | 366 Array<octave_idx_type> jsi; |
367 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); | 367 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); |
368 octave_idx_type nj = js.length (); | 368 octave_idx_type nj = js.numel (); |
369 bool dups = false; | 369 bool dups = false; |
370 for (octave_idx_type i = 0; i < nj - 1; i++) | 370 for (octave_idx_type i = 0; i < nj - 1; i++) |
371 dups = dups && js(i) == js(i+1); | 371 dups = dups && js(i) == js(i+1); |
372 | 372 |
373 if (dups) | 373 if (dups) |
375 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) | 375 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) |
376 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 376 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
377 else if (nj > 0) | 377 else if (nj > 0) |
378 { | 378 { |
379 OCTAVE_LOCAL_BUFFER (double, rw, k); | 379 OCTAVE_LOCAL_BUFFER (double, rw, k); |
380 for (volatile octave_idx_type i = 0; i < js.length (); i++) | 380 for (volatile octave_idx_type i = 0; i < js.numel (); i++) |
381 { | 381 { |
382 octave_idx_type ii = i; | 382 octave_idx_type ii = i; |
383 F77_XFCN (zqrdec, ZQRDEC, (m, n - ii, k == m ? k : k - ii, | 383 F77_XFCN (zqrdec, ZQRDEC, (m, n - ii, k == m ? k : k - ii, |
384 q.fortran_vec (), q.rows (), | 384 q.fortran_vec (), q.rows (), |
385 r.fortran_vec (), r.rows (), | 385 r.fortran_vec (), r.rows (), |
403 { | 403 { |
404 octave_idx_type m = r.rows (); | 404 octave_idx_type m = r.rows (); |
405 octave_idx_type n = r.columns (); | 405 octave_idx_type n = r.columns (); |
406 octave_idx_type k = std::min (m, n); | 406 octave_idx_type k = std::min (m, n); |
407 | 407 |
408 if (! q.is_square () || u.length () != n) | 408 if (! q.is_square () || u.numel () != n) |
409 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 409 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
410 else if (j < 0 || j > m) | 410 else if (j < 0 || j > m) |
411 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 411 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
412 else | 412 else |
413 { | 413 { |
475 warn_qrupdate_once (); | 475 warn_qrupdate_once (); |
476 | 476 |
477 octave_idx_type m = q.rows (); | 477 octave_idx_type m = q.rows (); |
478 octave_idx_type n = r.columns (); | 478 octave_idx_type n = r.columns (); |
479 | 479 |
480 if (u.length () == m && v.length () == n) | 480 if (u.numel () == m && v.numel () == n) |
481 { | 481 { |
482 init (q*r + ComplexMatrix (u) * ComplexMatrix (v).hermitian (), | 482 init (q*r + ComplexMatrix (u) * ComplexMatrix (v).hermitian (), |
483 get_type ()); | 483 get_type ()); |
484 } | 484 } |
485 else | 485 else |
571 warn_qrupdate_once (); | 571 warn_qrupdate_once (); |
572 | 572 |
573 octave_idx_type m = q.rows (); | 573 octave_idx_type m = q.rows (); |
574 octave_idx_type n = r.columns (); | 574 octave_idx_type n = r.columns (); |
575 | 575 |
576 if (u.length () != m) | 576 if (u.numel () != m) |
577 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 577 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
578 else if (j < 0 || j > n) | 578 else if (j < 0 || j > n) |
579 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 579 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
580 else | 580 else |
581 { | 581 { |
591 octave_idx_type m = q.rows (); | 591 octave_idx_type m = q.rows (); |
592 octave_idx_type n = r.columns (); | 592 octave_idx_type n = r.columns (); |
593 | 593 |
594 Array<octave_idx_type> jsi; | 594 Array<octave_idx_type> jsi; |
595 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); | 595 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); |
596 octave_idx_type nj = js.length (); | 596 octave_idx_type nj = js.numel (); |
597 bool dups = false; | 597 bool dups = false; |
598 for (octave_idx_type i = 0; i < nj - 1; i++) | 598 for (octave_idx_type i = 0; i < nj - 1; i++) |
599 dups = dups && js(i) == js(i+1); | 599 dups = dups && js(i) == js(i+1); |
600 | 600 |
601 if (dups) | 601 if (dups) |
602 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); | 602 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
603 else if (u.length () != m || u.columns () != nj) | 603 else if (u.numel () != m || u.columns () != nj) |
604 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 604 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
605 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) | 605 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) |
606 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 606 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
607 else if (nj > 0) | 607 else if (nj > 0) |
608 { | 608 { |
609 ComplexMatrix a = q*r; | 609 ComplexMatrix a = q*r; |
610 for (octave_idx_type i = 0; i < js.length (); i++) | 610 for (octave_idx_type i = 0; i < js.numel (); i++) |
611 a = ::insert_col (a, js(i), u.column (i)); | 611 a = ::insert_col (a, js(i), u.column (i)); |
612 init (a, get_type ()); | 612 init (a, get_type ()); |
613 } | 613 } |
614 } | 614 } |
615 | 615 |
635 | 635 |
636 octave_idx_type n = r.columns (); | 636 octave_idx_type n = r.columns (); |
637 | 637 |
638 Array<octave_idx_type> jsi; | 638 Array<octave_idx_type> jsi; |
639 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); | 639 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); |
640 octave_idx_type nj = js.length (); | 640 octave_idx_type nj = js.numel (); |
641 bool dups = false; | 641 bool dups = false; |
642 for (octave_idx_type i = 0; i < nj - 1; i++) | 642 for (octave_idx_type i = 0; i < nj - 1; i++) |
643 dups = dups && js(i) == js(i+1); | 643 dups = dups && js(i) == js(i+1); |
644 | 644 |
645 if (dups) | 645 if (dups) |
647 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) | 647 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) |
648 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 648 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
649 else if (nj > 0) | 649 else if (nj > 0) |
650 { | 650 { |
651 ComplexMatrix a = q*r; | 651 ComplexMatrix a = q*r; |
652 for (octave_idx_type i = 0; i < js.length (); i++) | 652 for (octave_idx_type i = 0; i < js.numel (); i++) |
653 a = ::delete_col (a, js(i)); | 653 a = ::delete_col (a, js(i)); |
654 init (a, get_type ()); | 654 init (a, get_type ()); |
655 } | 655 } |
656 } | 656 } |
657 | 657 |
661 warn_qrupdate_once (); | 661 warn_qrupdate_once (); |
662 | 662 |
663 octave_idx_type m = r.rows (); | 663 octave_idx_type m = r.rows (); |
664 octave_idx_type n = r.columns (); | 664 octave_idx_type n = r.columns (); |
665 | 665 |
666 if (! q.is_square () || u.length () != n) | 666 if (! q.is_square () || u.numel () != n) |
667 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 667 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
668 else if (j < 0 || j > m) | 668 else if (j < 0 || j > m) |
669 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 669 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
670 else | 670 else |
671 { | 671 { |