comparison liboctave/numeric/fCmplxQR.cc @ 20267: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
comparison
equal deleted inserted replaced
20266:83792dd9bcc1 20267:a9574e3c6e9e
214 { 214 {
215 octave_idx_type m = q.rows (); 215 octave_idx_type m = q.rows ();
216 octave_idx_type n = r.columns (); 216 octave_idx_type n = r.columns ();
217 octave_idx_type k = q.columns (); 217 octave_idx_type k = q.columns ();
218 218
219 if (u.length () == m && v.length () == n) 219 if (u.numel () == m && v.numel () == n)
220 { 220 {
221 FloatComplexColumnVector utmp = u; 221 FloatComplexColumnVector utmp = u;
222 FloatComplexColumnVector vtmp = v; 222 FloatComplexColumnVector vtmp = v;
223 OCTAVE_LOCAL_BUFFER (FloatComplex, w, k); 223 OCTAVE_LOCAL_BUFFER (FloatComplex, w, k);
224 OCTAVE_LOCAL_BUFFER (float, rw, k); 224 OCTAVE_LOCAL_BUFFER (float, rw, k);
263 { 263 {
264 octave_idx_type m = q.rows (); 264 octave_idx_type m = q.rows ();
265 octave_idx_type n = r.columns (); 265 octave_idx_type n = r.columns ();
266 octave_idx_type k = q.columns (); 266 octave_idx_type k = q.columns ();
267 267
268 if (u.length () != m) 268 if (u.numel () != m)
269 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 269 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
270 else if (j < 0 || j > n) 270 else if (j < 0 || j > n)
271 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 271 (*current_liboctave_error_handler) ("qrinsert: index out of range");
272 else 272 else
273 { 273 {
297 octave_idx_type n = r.columns (); 297 octave_idx_type n = r.columns ();
298 octave_idx_type k = q.columns (); 298 octave_idx_type k = q.columns ();
299 299
300 Array<octave_idx_type> jsi; 300 Array<octave_idx_type> jsi;
301 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); 301 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING);
302 octave_idx_type nj = js.length (); 302 octave_idx_type nj = js.numel ();
303 bool dups = false; 303 bool dups = false;
304 for (octave_idx_type i = 0; i < nj - 1; i++) 304 for (octave_idx_type i = 0; i < nj - 1; i++)
305 dups = dups && js(i) == js(i+1); 305 dups = dups && js(i) == js(i+1);
306 306
307 if (dups) 307 if (dups)
308 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); 308 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
309 else if (u.length () != m || u.columns () != nj) 309 else if (u.numel () != m || u.columns () != nj)
310 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 310 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
311 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) 311 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
312 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 312 (*current_liboctave_error_handler) ("qrinsert: index out of range");
313 else if (nj > 0) 313 else if (nj > 0)
314 { 314 {
322 { 322 {
323 r.resize (k, n + nj); 323 r.resize (k, n + nj);
324 } 324 }
325 325
326 OCTAVE_LOCAL_BUFFER (float, rw, kmax); 326 OCTAVE_LOCAL_BUFFER (float, rw, kmax);
327 for (volatile octave_idx_type i = 0; i < js.length (); i++) 327 for (volatile octave_idx_type i = 0; i < js.numel (); i++)
328 { 328 {
329 octave_idx_type ii = i; 329 octave_idx_type ii = i;
330 F77_XFCN (cqrinc, CQRINC, (m, n + ii, std::min (kmax, k + ii), 330 F77_XFCN (cqrinc, CQRINC, (m, n + ii, std::min (kmax, k + ii),
331 q.fortran_vec (), q.rows (), 331 q.fortran_vec (), q.rows (),
332 r.fortran_vec (), r.rows (), js(ii) + 1, 332 r.fortran_vec (), r.rows (), js(ii) + 1,
369 octave_idx_type n = r.columns (); 369 octave_idx_type n = r.columns ();
370 octave_idx_type k = q.columns (); 370 octave_idx_type k = q.columns ();
371 371
372 Array<octave_idx_type> jsi; 372 Array<octave_idx_type> jsi;
373 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); 373 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING);
374 octave_idx_type nj = js.length (); 374 octave_idx_type nj = js.numel ();
375 bool dups = false; 375 bool dups = false;
376 for (octave_idx_type i = 0; i < nj - 1; i++) 376 for (octave_idx_type i = 0; i < nj - 1; i++)
377 dups = dups && js(i) == js(i+1); 377 dups = dups && js(i) == js(i+1);
378 378
379 if (dups) 379 if (dups)
381 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) 381 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0))
382 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 382 (*current_liboctave_error_handler) ("qrinsert: index out of range");
383 else if (nj > 0) 383 else if (nj > 0)
384 { 384 {
385 OCTAVE_LOCAL_BUFFER (float, rw, k); 385 OCTAVE_LOCAL_BUFFER (float, rw, k);
386 for (volatile octave_idx_type i = 0; i < js.length (); i++) 386 for (volatile octave_idx_type i = 0; i < js.numel (); i++)
387 { 387 {
388 octave_idx_type ii = i; 388 octave_idx_type ii = i;
389 F77_XFCN (cqrdec, CQRDEC, (m, n - ii, k == m ? k : k - ii, 389 F77_XFCN (cqrdec, CQRDEC, (m, n - ii, k == m ? k : k - ii,
390 q.fortran_vec (), q.rows (), 390 q.fortran_vec (), q.rows (),
391 r.fortran_vec (), r.rows (), 391 r.fortran_vec (), r.rows (),
409 { 409 {
410 octave_idx_type m = r.rows (); 410 octave_idx_type m = r.rows ();
411 octave_idx_type n = r.columns (); 411 octave_idx_type n = r.columns ();
412 octave_idx_type k = std::min (m, n); 412 octave_idx_type k = std::min (m, n);
413 413
414 if (! q.is_square () || u.length () != n) 414 if (! q.is_square () || u.numel () != n)
415 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 415 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
416 else if (j < 0 || j > m) 416 else if (j < 0 || j > m)
417 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 417 (*current_liboctave_error_handler) ("qrinsert: index out of range");
418 else 418 else
419 { 419 {
482 warn_qrupdate_once (); 482 warn_qrupdate_once ();
483 483
484 octave_idx_type m = q.rows (); 484 octave_idx_type m = q.rows ();
485 octave_idx_type n = r.columns (); 485 octave_idx_type n = r.columns ();
486 486
487 if (u.length () == m && v.length () == n) 487 if (u.numel () == m && v.numel () == n)
488 { 488 {
489 init (q*r + FloatComplexMatrix (u) * FloatComplexMatrix (v).hermitian (), 489 init (q*r + FloatComplexMatrix (u) * FloatComplexMatrix (v).hermitian (),
490 get_type ()); 490 get_type ());
491 } 491 }
492 else 492 else
580 warn_qrupdate_once (); 580 warn_qrupdate_once ();
581 581
582 octave_idx_type m = q.rows (); 582 octave_idx_type m = q.rows ();
583 octave_idx_type n = r.columns (); 583 octave_idx_type n = r.columns ();
584 584
585 if (u.length () != m) 585 if (u.numel () != m)
586 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 586 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
587 else if (j < 0 || j > n) 587 else if (j < 0 || j > n)
588 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 588 (*current_liboctave_error_handler) ("qrinsert: index out of range");
589 else 589 else
590 { 590 {
601 octave_idx_type m = q.rows (); 601 octave_idx_type m = q.rows ();
602 octave_idx_type n = r.columns (); 602 octave_idx_type n = r.columns ();
603 603
604 Array<octave_idx_type> jsi; 604 Array<octave_idx_type> jsi;
605 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); 605 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING);
606 octave_idx_type nj = js.length (); 606 octave_idx_type nj = js.numel ();
607 bool dups = false; 607 bool dups = false;
608 for (octave_idx_type i = 0; i < nj - 1; i++) 608 for (octave_idx_type i = 0; i < nj - 1; i++)
609 dups = dups && js(i) == js(i+1); 609 dups = dups && js(i) == js(i+1);
610 610
611 if (dups) 611 if (dups)
612 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); 612 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
613 else if (u.length () != m || u.columns () != nj) 613 else if (u.numel () != m || u.columns () != nj)
614 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 614 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
615 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) 615 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
616 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 616 (*current_liboctave_error_handler) ("qrinsert: index out of range");
617 else if (nj > 0) 617 else if (nj > 0)
618 { 618 {
619 FloatComplexMatrix a = q*r; 619 FloatComplexMatrix a = q*r;
620 for (octave_idx_type i = 0; i < js.length (); i++) 620 for (octave_idx_type i = 0; i < js.numel (); i++)
621 a = ::insert_col (a, js(i), u.column (i)); 621 a = ::insert_col (a, js(i), u.column (i));
622 init (a, get_type ()); 622 init (a, get_type ());
623 } 623 }
624 } 624 }
625 625
645 645
646 octave_idx_type n = r.columns (); 646 octave_idx_type n = r.columns ();
647 647
648 Array<octave_idx_type> jsi; 648 Array<octave_idx_type> jsi;
649 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); 649 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING);
650 octave_idx_type nj = js.length (); 650 octave_idx_type nj = js.numel ();
651 bool dups = false; 651 bool dups = false;
652 for (octave_idx_type i = 0; i < nj - 1; i++) 652 for (octave_idx_type i = 0; i < nj - 1; i++)
653 dups = dups && js(i) == js(i+1); 653 dups = dups && js(i) == js(i+1);
654 654
655 if (dups) 655 if (dups)
657 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) 657 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0))
658 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 658 (*current_liboctave_error_handler) ("qrinsert: index out of range");
659 else if (nj > 0) 659 else if (nj > 0)
660 { 660 {
661 FloatComplexMatrix a = q*r; 661 FloatComplexMatrix a = q*r;
662 for (octave_idx_type i = 0; i < js.length (); i++) 662 for (octave_idx_type i = 0; i < js.numel (); i++)
663 a = ::delete_col (a, js(i)); 663 a = ::delete_col (a, js(i));
664 init (a, get_type ()); 664 init (a, get_type ());
665 } 665 }
666 } 666 }
667 667
671 warn_qrupdate_once (); 671 warn_qrupdate_once ();
672 672
673 octave_idx_type m = r.rows (); 673 octave_idx_type m = r.rows ();
674 octave_idx_type n = r.columns (); 674 octave_idx_type n = r.columns ();
675 675
676 if (! q.is_square () || u.length () != n) 676 if (! q.is_square () || u.numel () != n)
677 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 677 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
678 else if (j < 0 || j > m) 678 else if (j < 0 || j > m)
679 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 679 (*current_liboctave_error_handler) ("qrinsert: index out of range");
680 else 680 else
681 { 681 {