Mercurial > hg > octave-nkf
comparison liboctave/array/fCMatrix.cc @ 20442: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 | b2100e1659ac |
children | 16b9ec39ff46 |
comparison
equal
deleted
inserted
replaced
20441:83792dd9bcc1 | 20442:a9574e3c6e9e |
---|---|
367 FloatComplexMatrix::operator == (const FloatComplexMatrix& a) const | 367 FloatComplexMatrix::operator == (const FloatComplexMatrix& a) const |
368 { | 368 { |
369 if (rows () != a.rows () || cols () != a.cols ()) | 369 if (rows () != a.rows () || cols () != a.cols ()) |
370 return false; | 370 return false; |
371 | 371 |
372 return mx_inline_equal (length (), data (), a.data ()); | 372 return mx_inline_equal (numel (), data (), a.data ()); |
373 } | 373 } |
374 | 374 |
375 bool | 375 bool |
376 FloatComplexMatrix::operator != (const FloatComplexMatrix& a) const | 376 FloatComplexMatrix::operator != (const FloatComplexMatrix& a) const |
377 { | 377 { |
426 | 426 |
427 FloatComplexMatrix& | 427 FloatComplexMatrix& |
428 FloatComplexMatrix::insert (const FloatRowVector& a, | 428 FloatComplexMatrix::insert (const FloatRowVector& a, |
429 octave_idx_type r, octave_idx_type c) | 429 octave_idx_type r, octave_idx_type c) |
430 { | 430 { |
431 octave_idx_type a_len = a.length (); | 431 octave_idx_type a_len = a.numel (); |
432 | 432 |
433 if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ()) | 433 if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ()) |
434 { | 434 { |
435 (*current_liboctave_error_handler) ("range error for insert"); | 435 (*current_liboctave_error_handler) ("range error for insert"); |
436 return *this; | 436 return *this; |
449 | 449 |
450 FloatComplexMatrix& | 450 FloatComplexMatrix& |
451 FloatComplexMatrix::insert (const FloatColumnVector& a, | 451 FloatComplexMatrix::insert (const FloatColumnVector& a, |
452 octave_idx_type r, octave_idx_type c) | 452 octave_idx_type r, octave_idx_type c) |
453 { | 453 { |
454 octave_idx_type a_len = a.length (); | 454 octave_idx_type a_len = a.numel (); |
455 | 455 |
456 if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ()) | 456 if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ()) |
457 { | 457 { |
458 (*current_liboctave_error_handler) ("range error for insert"); | 458 (*current_liboctave_error_handler) ("range error for insert"); |
459 return *this; | 459 return *this; |
508 | 508 |
509 FloatComplexMatrix& | 509 FloatComplexMatrix& |
510 FloatComplexMatrix::insert (const FloatComplexRowVector& a, | 510 FloatComplexMatrix::insert (const FloatComplexRowVector& a, |
511 octave_idx_type r, octave_idx_type c) | 511 octave_idx_type r, octave_idx_type c) |
512 { | 512 { |
513 octave_idx_type a_len = a.length (); | 513 octave_idx_type a_len = a.numel (); |
514 if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ()) | 514 if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ()) |
515 { | 515 { |
516 (*current_liboctave_error_handler) ("range error for insert"); | 516 (*current_liboctave_error_handler) ("range error for insert"); |
517 return *this; | 517 return *this; |
518 } | 518 } |
525 | 525 |
526 FloatComplexMatrix& | 526 FloatComplexMatrix& |
527 FloatComplexMatrix::insert (const FloatComplexColumnVector& a, | 527 FloatComplexMatrix::insert (const FloatComplexColumnVector& a, |
528 octave_idx_type r, octave_idx_type c) | 528 octave_idx_type r, octave_idx_type c) |
529 { | 529 { |
530 octave_idx_type a_len = a.length (); | 530 octave_idx_type a_len = a.numel (); |
531 | 531 |
532 if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ()) | 532 if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ()) |
533 { | 533 { |
534 (*current_liboctave_error_handler) ("range error for insert"); | 534 (*current_liboctave_error_handler) ("range error for insert"); |
535 return *this; | 535 return *this; |
697 (*current_liboctave_error_handler) ("row dimension mismatch for append"); | 697 (*current_liboctave_error_handler) ("row dimension mismatch for append"); |
698 return *this; | 698 return *this; |
699 } | 699 } |
700 | 700 |
701 octave_idx_type nc_insert = nc; | 701 octave_idx_type nc_insert = nc; |
702 FloatComplexMatrix retval (nr, nc + a.length ()); | 702 FloatComplexMatrix retval (nr, nc + a.numel ()); |
703 retval.insert (*this, 0, 0); | 703 retval.insert (*this, 0, 0); |
704 retval.insert (a, 0, nc_insert); | 704 retval.insert (a, 0, nc_insert); |
705 return retval; | 705 return retval; |
706 } | 706 } |
707 | 707 |
708 FloatComplexMatrix | 708 FloatComplexMatrix |
709 FloatComplexMatrix::append (const FloatColumnVector& a) const | 709 FloatComplexMatrix::append (const FloatColumnVector& a) const |
710 { | 710 { |
711 octave_idx_type nr = rows (); | 711 octave_idx_type nr = rows (); |
712 octave_idx_type nc = cols (); | 712 octave_idx_type nc = cols (); |
713 if (nr != a.length ()) | 713 if (nr != a.numel ()) |
714 { | 714 { |
715 (*current_liboctave_error_handler) ("row dimension mismatch for append"); | 715 (*current_liboctave_error_handler) ("row dimension mismatch for append"); |
716 return *this; | 716 return *this; |
717 } | 717 } |
718 | 718 |
769 (*current_liboctave_error_handler) ("row dimension mismatch for append"); | 769 (*current_liboctave_error_handler) ("row dimension mismatch for append"); |
770 return *this; | 770 return *this; |
771 } | 771 } |
772 | 772 |
773 octave_idx_type nc_insert = nc; | 773 octave_idx_type nc_insert = nc; |
774 FloatComplexMatrix retval (nr, nc + a.length ()); | 774 FloatComplexMatrix retval (nr, nc + a.numel ()); |
775 retval.insert (*this, 0, 0); | 775 retval.insert (*this, 0, 0); |
776 retval.insert (a, 0, nc_insert); | 776 retval.insert (a, 0, nc_insert); |
777 return retval; | 777 return retval; |
778 } | 778 } |
779 | 779 |
780 FloatComplexMatrix | 780 FloatComplexMatrix |
781 FloatComplexMatrix::append (const FloatComplexColumnVector& a) const | 781 FloatComplexMatrix::append (const FloatComplexColumnVector& a) const |
782 { | 782 { |
783 octave_idx_type nr = rows (); | 783 octave_idx_type nr = rows (); |
784 octave_idx_type nc = cols (); | 784 octave_idx_type nc = cols (); |
785 if (nr != a.length ()) | 785 if (nr != a.numel ()) |
786 { | 786 { |
787 (*current_liboctave_error_handler) ("row dimension mismatch for append"); | 787 (*current_liboctave_error_handler) ("row dimension mismatch for append"); |
788 return *this; | 788 return *this; |
789 } | 789 } |
790 | 790 |
835 FloatComplexMatrix | 835 FloatComplexMatrix |
836 FloatComplexMatrix::stack (const FloatRowVector& a) const | 836 FloatComplexMatrix::stack (const FloatRowVector& a) const |
837 { | 837 { |
838 octave_idx_type nr = rows (); | 838 octave_idx_type nr = rows (); |
839 octave_idx_type nc = cols (); | 839 octave_idx_type nc = cols (); |
840 if (nc != a.length ()) | 840 if (nc != a.numel ()) |
841 { | 841 { |
842 (*current_liboctave_error_handler) | 842 (*current_liboctave_error_handler) |
843 ("column dimension mismatch for stack"); | 843 ("column dimension mismatch for stack"); |
844 return *this; | 844 return *this; |
845 } | 845 } |
862 ("column dimension mismatch for stack"); | 862 ("column dimension mismatch for stack"); |
863 return *this; | 863 return *this; |
864 } | 864 } |
865 | 865 |
866 octave_idx_type nr_insert = nr; | 866 octave_idx_type nr_insert = nr; |
867 FloatComplexMatrix retval (nr + a.length (), nc); | 867 FloatComplexMatrix retval (nr + a.numel (), nc); |
868 retval.insert (*this, 0, 0); | 868 retval.insert (*this, 0, 0); |
869 retval.insert (a, nr_insert, 0); | 869 retval.insert (a, nr_insert, 0); |
870 return retval; | 870 return retval; |
871 } | 871 } |
872 | 872 |
911 FloatComplexMatrix | 911 FloatComplexMatrix |
912 FloatComplexMatrix::stack (const FloatComplexRowVector& a) const | 912 FloatComplexMatrix::stack (const FloatComplexRowVector& a) const |
913 { | 913 { |
914 octave_idx_type nr = rows (); | 914 octave_idx_type nr = rows (); |
915 octave_idx_type nc = cols (); | 915 octave_idx_type nc = cols (); |
916 if (nc != a.length ()) | 916 if (nc != a.numel ()) |
917 { | 917 { |
918 (*current_liboctave_error_handler) | 918 (*current_liboctave_error_handler) |
919 ("column dimension mismatch for stack"); | 919 ("column dimension mismatch for stack"); |
920 return *this; | 920 return *this; |
921 } | 921 } |
938 ("column dimension mismatch for stack"); | 938 ("column dimension mismatch for stack"); |
939 return *this; | 939 return *this; |
940 } | 940 } |
941 | 941 |
942 octave_idx_type nr_insert = nr; | 942 octave_idx_type nr_insert = nr; |
943 FloatComplexMatrix retval (nr + a.length (), nc); | 943 FloatComplexMatrix retval (nr + a.numel (), nc); |
944 retval.insert (*this, 0, 0); | 944 retval.insert (*this, 0, 0); |
945 retval.insert (a, nr_insert, 0); | 945 retval.insert (a, nr_insert, 0); |
946 return retval; | 946 return retval; |
947 } | 947 } |
948 | 948 |
1234 FloatComplexMatrix U = result.left_singular_matrix (); | 1234 FloatComplexMatrix U = result.left_singular_matrix (); |
1235 FloatComplexMatrix V = result.right_singular_matrix (); | 1235 FloatComplexMatrix V = result.right_singular_matrix (); |
1236 | 1236 |
1237 FloatColumnVector sigma = S.extract_diag (); | 1237 FloatColumnVector sigma = S.extract_diag (); |
1238 | 1238 |
1239 octave_idx_type r = sigma.length () - 1; | 1239 octave_idx_type r = sigma.numel () - 1; |
1240 octave_idx_type nr = rows (); | 1240 octave_idx_type nr = rows (); |
1241 octave_idx_type nc = cols (); | 1241 octave_idx_type nc = cols (); |
1242 | 1242 |
1243 if (tol <= 0.0) | 1243 if (tol <= 0.0) |
1244 { | 1244 { |
2860 octave_idx_type nrhs = 1; | 2860 octave_idx_type nrhs = 1; |
2861 | 2861 |
2862 octave_idx_type m = rows (); | 2862 octave_idx_type m = rows (); |
2863 octave_idx_type n = cols (); | 2863 octave_idx_type n = cols (); |
2864 | 2864 |
2865 if (m != b.length ()) | 2865 if (m != b.numel ()) |
2866 (*current_liboctave_error_handler) | 2866 (*current_liboctave_error_handler) |
2867 ("matrix dimension mismatch solution of linear equations"); | 2867 ("matrix dimension mismatch solution of linear equations"); |
2868 else if (m == 0 || n == 0 || b.cols () == 0) | 2868 else if (m == 0 || n == 0 || b.cols () == 0) |
2869 retval = FloatComplexColumnVector (n, FloatComplex (0.0, 0.0)); | 2869 retval = FloatComplexColumnVector (n, FloatComplex (0.0, 0.0)); |
2870 else | 2870 else |
2973 FloatComplexMatrix | 2973 FloatComplexMatrix |
2974 operator * (const FloatComplexColumnVector& v, const FloatComplexRowVector& a) | 2974 operator * (const FloatComplexColumnVector& v, const FloatComplexRowVector& a) |
2975 { | 2975 { |
2976 FloatComplexMatrix retval; | 2976 FloatComplexMatrix retval; |
2977 | 2977 |
2978 octave_idx_type len = v.length (); | 2978 octave_idx_type len = v.numel (); |
2979 | 2979 |
2980 if (len != 0) | 2980 if (len != 0) |
2981 { | 2981 { |
2982 octave_idx_type a_len = a.length (); | 2982 octave_idx_type a_len = a.numel (); |
2983 | 2983 |
2984 retval = FloatComplexMatrix (len, a_len); | 2984 retval = FloatComplexMatrix (len, a_len); |
2985 FloatComplex *c = retval.fortran_vec (); | 2985 FloatComplex *c = retval.fortran_vec (); |
2986 | 2986 |
2987 F77_XFCN (cgemm, CGEMM, (F77_CONST_CHAR_ARG2 ("N", 1), | 2987 F77_XFCN (cgemm, CGEMM, (F77_CONST_CHAR_ARG2 ("N", 1), |
3101 if (nr == 0 || nc == 0) | 3101 if (nr == 0 || nc == 0) |
3102 return *this; | 3102 return *this; |
3103 | 3103 |
3104 FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates! | 3104 FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates! |
3105 | 3105 |
3106 mx_inline_add2 (length (), d, a.data ()); | 3106 mx_inline_add2 (numel (), d, a.data ()); |
3107 return *this; | 3107 return *this; |
3108 } | 3108 } |
3109 | 3109 |
3110 FloatComplexMatrix& | 3110 FloatComplexMatrix& |
3111 FloatComplexMatrix::operator -= (const FloatMatrix& a) | 3111 FloatComplexMatrix::operator -= (const FloatMatrix& a) |
3125 if (nr == 0 || nc == 0) | 3125 if (nr == 0 || nc == 0) |
3126 return *this; | 3126 return *this; |
3127 | 3127 |
3128 FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates! | 3128 FloatComplex *d = fortran_vec (); // Ensures only 1 reference to my privates! |
3129 | 3129 |
3130 mx_inline_sub2 (length (), d, a.data ()); | 3130 mx_inline_sub2 (numel (), d, a.data ()); |
3131 return *this; | 3131 return *this; |
3132 } | 3132 } |
3133 | 3133 |
3134 // unary operations | 3134 // unary operations |
3135 | 3135 |
4019 octave_idx_type n) | 4019 octave_idx_type n) |
4020 | 4020 |
4021 { | 4021 { |
4022 if (n < 1) n = 1; | 4022 if (n < 1) n = 1; |
4023 | 4023 |
4024 octave_idx_type m = x1.length (); | 4024 octave_idx_type m = x1.numel (); |
4025 | 4025 |
4026 if (x2.length () != m) | 4026 if (x2.numel () != m) |
4027 (*current_liboctave_error_handler) | 4027 (*current_liboctave_error_handler) |
4028 ("linspace: vectors must be of equal length"); | 4028 ("linspace: vectors must be of equal length"); |
4029 | 4029 |
4030 NoAlias<FloatComplexMatrix> retval; | 4030 NoAlias<FloatComplexMatrix> retval; |
4031 | 4031 |