Mercurial > hg > octave-lyh
comparison liboctave/dMatrix.cc @ 10363:a0728e81ed25
improve diag matrix interface & implementation
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 26 Feb 2010 11:44:38 +0100 |
parents | b47ab50a6aa8 |
children | 832732c2eb80 |
comparison
equal
deleted
inserted
replaced
10362:b47ab50a6aa8 | 10363:a0728e81ed25 |
---|---|
563 } | 563 } |
564 | 564 |
565 Matrix | 565 Matrix |
566 real (const ComplexMatrix& a) | 566 real (const ComplexMatrix& a) |
567 { | 567 { |
568 return Matrix (mx_inline_real_dup (a.data (), a.length ()), | 568 return do_mx_unary_op<double, Complex> (a, mx_inline_real); |
569 a.rows (), a.cols ()); | |
570 } | 569 } |
571 | 570 |
572 Matrix | 571 Matrix |
573 imag (const ComplexMatrix& a) | 572 imag (const ComplexMatrix& a) |
574 { | 573 { |
575 return Matrix (mx_inline_imag_dup (a.data (), a.length ()), | 574 return do_mx_unary_op<double, Complex> (a, mx_inline_imag); |
576 a.rows (), a.cols ()); | |
577 } | 575 } |
578 | 576 |
579 Matrix | 577 Matrix |
580 Matrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const | 578 Matrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const |
581 { | 579 { |
2820 } | 2818 } |
2821 | 2819 |
2822 Matrix | 2820 Matrix |
2823 Matrix::abs (void) const | 2821 Matrix::abs (void) const |
2824 { | 2822 { |
2825 return Matrix (mx_inline_fabs_dup (data (), length ()), | 2823 return do_mx_unary_map<double, double, std::abs> (*this); |
2826 rows (), cols ()); | |
2827 } | 2824 } |
2828 | 2825 |
2829 Matrix | 2826 Matrix |
2830 Matrix::diag (octave_idx_type k) const | 2827 Matrix::diag (octave_idx_type k) const |
2831 { | 2828 { |