Mercurial > octave-nkf
comparison liboctave/numeric/floatQR.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 |
---|---|
209 { | 209 { |
210 octave_idx_type m = q.rows (); | 210 octave_idx_type m = q.rows (); |
211 octave_idx_type n = r.columns (); | 211 octave_idx_type n = r.columns (); |
212 octave_idx_type k = q.columns (); | 212 octave_idx_type k = q.columns (); |
213 | 213 |
214 if (u.length () == m && v.length () == n) | 214 if (u.numel () == m && v.numel () == n) |
215 { | 215 { |
216 FloatColumnVector utmp = u; | 216 FloatColumnVector utmp = u; |
217 FloatColumnVector vtmp = v; | 217 FloatColumnVector vtmp = v; |
218 OCTAVE_LOCAL_BUFFER (float, w, 2*k); | 218 OCTAVE_LOCAL_BUFFER (float, w, 2*k); |
219 F77_XFCN (sqr1up, SQR1UP, (m, n, k, q.fortran_vec (), | 219 F77_XFCN (sqr1up, SQR1UP, (m, n, k, q.fortran_vec (), |
253 { | 253 { |
254 octave_idx_type m = q.rows (); | 254 octave_idx_type m = q.rows (); |
255 octave_idx_type n = r.columns (); | 255 octave_idx_type n = r.columns (); |
256 octave_idx_type k = q.columns (); | 256 octave_idx_type k = q.columns (); |
257 | 257 |
258 if (u.length () != m) | 258 if (u.numel () != m) |
259 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 259 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
260 else if (j < 0 || j > n) | 260 else if (j < 0 || j > n) |
261 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 261 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
262 else | 262 else |
263 { | 263 { |
286 octave_idx_type n = r.columns (); | 286 octave_idx_type n = r.columns (); |
287 octave_idx_type k = q.columns (); | 287 octave_idx_type k = q.columns (); |
288 | 288 |
289 Array<octave_idx_type> jsi; | 289 Array<octave_idx_type> jsi; |
290 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); | 290 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); |
291 octave_idx_type nj = js.length (); | 291 octave_idx_type nj = js.numel (); |
292 bool dups = false; | 292 bool dups = false; |
293 for (octave_idx_type i = 0; i < nj - 1; i++) | 293 for (octave_idx_type i = 0; i < nj - 1; i++) |
294 dups = dups && js(i) == js(i+1); | 294 dups = dups && js(i) == js(i+1); |
295 | 295 |
296 if (dups) | 296 if (dups) |
297 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); | 297 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
298 else if (u.length () != m || u.columns () != nj) | 298 else if (u.numel () != m || u.columns () != nj) |
299 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 299 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
300 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) | 300 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) |
301 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 301 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
302 else if (nj > 0) | 302 else if (nj > 0) |
303 { | 303 { |
311 { | 311 { |
312 r.resize (k, n + nj); | 312 r.resize (k, n + nj); |
313 } | 313 } |
314 | 314 |
315 OCTAVE_LOCAL_BUFFER (float, w, kmax); | 315 OCTAVE_LOCAL_BUFFER (float, w, kmax); |
316 for (volatile octave_idx_type i = 0; i < js.length (); i++) | 316 for (volatile octave_idx_type i = 0; i < js.numel (); i++) |
317 { | 317 { |
318 octave_idx_type ii = i; | 318 octave_idx_type ii = i; |
319 FloatColumnVector utmp = u.column (jsi(i)); | 319 FloatColumnVector utmp = u.column (jsi(i)); |
320 F77_XFCN (sqrinc, SQRINC, (m, n + ii, std::min (kmax, k + ii), | 320 F77_XFCN (sqrinc, SQRINC, (m, n + ii, std::min (kmax, k + ii), |
321 q.fortran_vec (), q.rows (), | 321 q.fortran_vec (), q.rows (), |
359 octave_idx_type n = r.columns (); | 359 octave_idx_type n = r.columns (); |
360 octave_idx_type k = q.columns (); | 360 octave_idx_type k = q.columns (); |
361 | 361 |
362 Array<octave_idx_type> jsi; | 362 Array<octave_idx_type> jsi; |
363 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); | 363 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); |
364 octave_idx_type nj = js.length (); | 364 octave_idx_type nj = js.numel (); |
365 bool dups = false; | 365 bool dups = false; |
366 for (octave_idx_type i = 0; i < nj - 1; i++) | 366 for (octave_idx_type i = 0; i < nj - 1; i++) |
367 dups = dups && js(i) == js(i+1); | 367 dups = dups && js(i) == js(i+1); |
368 | 368 |
369 if (dups) | 369 if (dups) |
371 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) | 371 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) |
372 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 372 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
373 else if (nj > 0) | 373 else if (nj > 0) |
374 { | 374 { |
375 OCTAVE_LOCAL_BUFFER (float, w, k); | 375 OCTAVE_LOCAL_BUFFER (float, w, k); |
376 for (volatile octave_idx_type i = 0; i < js.length (); i++) | 376 for (volatile octave_idx_type i = 0; i < js.numel (); i++) |
377 { | 377 { |
378 octave_idx_type ii = i; | 378 octave_idx_type ii = i; |
379 F77_XFCN (sqrdec, SQRDEC, (m, n - ii, k == m ? k : k - ii, | 379 F77_XFCN (sqrdec, SQRDEC, (m, n - ii, k == m ? k : k - ii, |
380 q.fortran_vec (), q.rows (), | 380 q.fortran_vec (), q.rows (), |
381 r.fortran_vec (), r.rows (), | 381 r.fortran_vec (), r.rows (), |
399 { | 399 { |
400 octave_idx_type m = r.rows (); | 400 octave_idx_type m = r.rows (); |
401 octave_idx_type n = r.columns (); | 401 octave_idx_type n = r.columns (); |
402 octave_idx_type k = std::min (m, n); | 402 octave_idx_type k = std::min (m, n); |
403 | 403 |
404 if (! q.is_square () || u.length () != n) | 404 if (! q.is_square () || u.numel () != n) |
405 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 405 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
406 else if (j < 0 || j > m) | 406 else if (j < 0 || j > m) |
407 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 407 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
408 else | 408 else |
409 { | 409 { |
469 warn_qrupdate_once (); | 469 warn_qrupdate_once (); |
470 | 470 |
471 octave_idx_type m = q.rows (); | 471 octave_idx_type m = q.rows (); |
472 octave_idx_type n = r.columns (); | 472 octave_idx_type n = r.columns (); |
473 | 473 |
474 if (u.length () == m && v.length () == n) | 474 if (u.numel () == m && v.numel () == n) |
475 { | 475 { |
476 init (q*r + FloatMatrix (u) * FloatMatrix (v).transpose (), get_type ()); | 476 init (q*r + FloatMatrix (u) * FloatMatrix (v).transpose (), get_type ()); |
477 } | 477 } |
478 else | 478 else |
479 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); | 479 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); |
564 warn_qrupdate_once (); | 564 warn_qrupdate_once (); |
565 | 565 |
566 octave_idx_type m = q.rows (); | 566 octave_idx_type m = q.rows (); |
567 octave_idx_type n = r.columns (); | 567 octave_idx_type n = r.columns (); |
568 | 568 |
569 if (u.length () != m) | 569 if (u.numel () != m) |
570 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 570 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
571 else if (j < 0 || j > n) | 571 else if (j < 0 || j > n) |
572 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 572 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
573 else | 573 else |
574 { | 574 { |
584 octave_idx_type m = q.rows (); | 584 octave_idx_type m = q.rows (); |
585 octave_idx_type n = r.columns (); | 585 octave_idx_type n = r.columns (); |
586 | 586 |
587 Array<octave_idx_type> jsi; | 587 Array<octave_idx_type> jsi; |
588 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); | 588 Array<octave_idx_type> js = j.sort (jsi, 0, ASCENDING); |
589 octave_idx_type nj = js.length (); | 589 octave_idx_type nj = js.numel (); |
590 bool dups = false; | 590 bool dups = false; |
591 for (octave_idx_type i = 0; i < nj - 1; i++) | 591 for (octave_idx_type i = 0; i < nj - 1; i++) |
592 dups = dups && js(i) == js(i+1); | 592 dups = dups && js(i) == js(i+1); |
593 | 593 |
594 if (dups) | 594 if (dups) |
595 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); | 595 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); |
596 else if (u.length () != m || u.columns () != nj) | 596 else if (u.numel () != m || u.columns () != nj) |
597 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 597 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
598 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) | 598 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) |
599 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 599 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
600 else if (nj > 0) | 600 else if (nj > 0) |
601 { | 601 { |
602 FloatMatrix a = q*r; | 602 FloatMatrix a = q*r; |
603 for (octave_idx_type i = 0; i < js.length (); i++) | 603 for (octave_idx_type i = 0; i < js.numel (); i++) |
604 a = ::insert_col (a, js(i), u.column (i)); | 604 a = ::insert_col (a, js(i), u.column (i)); |
605 init (a, get_type ()); | 605 init (a, get_type ()); |
606 } | 606 } |
607 } | 607 } |
608 | 608 |
628 | 628 |
629 octave_idx_type n = r.columns (); | 629 octave_idx_type n = r.columns (); |
630 | 630 |
631 Array<octave_idx_type> jsi; | 631 Array<octave_idx_type> jsi; |
632 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); | 632 Array<octave_idx_type> js = j.sort (jsi, 0, DESCENDING); |
633 octave_idx_type nj = js.length (); | 633 octave_idx_type nj = js.numel (); |
634 bool dups = false; | 634 bool dups = false; |
635 for (octave_idx_type i = 0; i < nj - 1; i++) | 635 for (octave_idx_type i = 0; i < nj - 1; i++) |
636 dups = dups && js(i) == js(i+1); | 636 dups = dups && js(i) == js(i+1); |
637 | 637 |
638 if (dups) | 638 if (dups) |
640 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) | 640 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) |
641 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 641 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
642 else if (nj > 0) | 642 else if (nj > 0) |
643 { | 643 { |
644 FloatMatrix a = q*r; | 644 FloatMatrix a = q*r; |
645 for (octave_idx_type i = 0; i < js.length (); i++) | 645 for (octave_idx_type i = 0; i < js.numel (); i++) |
646 a = ::delete_col (a, js(i)); | 646 a = ::delete_col (a, js(i)); |
647 init (a, get_type ()); | 647 init (a, get_type ()); |
648 } | 648 } |
649 } | 649 } |
650 | 650 |
654 warn_qrupdate_once (); | 654 warn_qrupdate_once (); |
655 | 655 |
656 octave_idx_type m = r.rows (); | 656 octave_idx_type m = r.rows (); |
657 octave_idx_type n = r.columns (); | 657 octave_idx_type n = r.columns (); |
658 | 658 |
659 if (! q.is_square () || u.length () != n) | 659 if (! q.is_square () || u.numel () != n) |
660 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); | 660 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); |
661 else if (j < 0 || j > m) | 661 else if (j < 0 || j > m) |
662 (*current_liboctave_error_handler) ("qrinsert: index out of range"); | 662 (*current_liboctave_error_handler) ("qrinsert: index out of range"); |
663 else | 663 else |
664 { | 664 { |