Mercurial > hg > octave-nkf
comparison liboctave/fCNDArray.cc @ 9825:7483fe200fab
narrow complex values with negative zero imaginary parts
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 13 Nov 2009 12:34:46 +0100 |
parents | f80c566bc751 |
children | c15a5ed0da58 |
comparison
equal
deleted
inserted
replaced
9824:6631c61a4a4e | 9825:7483fe200fab |
---|---|
531 // Return true if no elements have imaginary components. | 531 // Return true if no elements have imaginary components. |
532 | 532 |
533 bool | 533 bool |
534 FloatComplexNDArray::all_elements_are_real (void) const | 534 FloatComplexNDArray::all_elements_are_real (void) const |
535 { | 535 { |
536 octave_idx_type nel = nelem (); | 536 return mx_inline_all_real (numel (), data ()); |
537 | |
538 for (octave_idx_type i = 0; i < nel; i++) | |
539 { | |
540 float ip = std::imag (elem (i)); | |
541 | |
542 if (ip != 0.0 || lo_ieee_signbit (ip)) | |
543 return false; | |
544 } | |
545 | |
546 return true; | |
547 } | 537 } |
548 | 538 |
549 // Return nonzero if any element of CM has a non-integer real or | 539 // Return nonzero if any element of CM has a non-integer real or |
550 // imaginary part. Also extract the largest and smallest (real or | 540 // imaginary part. Also extract the largest and smallest (real or |
551 // imaginary) values and return them in MAX_VAL and MIN_VAL. | 541 // imaginary) values and return them in MAX_VAL and MIN_VAL. |