comparison liboctave/CNDArray.cc @ 5389:25c8956d2204

[project @ 2005-06-15 03:45:46 by jwe]
author jwe
date Wed, 15 Jun 2005 03:45:49 +0000
parents 5b00a8beb504
children ace8d8d26933
comparison
equal deleted inserted replaced
5388:7099eb9841b4 5389:25c8956d2204
592 Complex val = elem (i); 592 Complex val = elem (i);
593 593
594 double r_val = std::real (val); 594 double r_val = std::real (val);
595 double i_val = std::imag (val); 595 double i_val = std::imag (val);
596 596
597 if ((! (octave_is_NaN_or_NA (r_val) || xisinf (r_val)) 597 if ((! (xisnan (r_val) || xisinf (r_val))
598 && fabs (r_val) > FLT_MAX) 598 && fabs (r_val) > FLT_MAX)
599 || (! (octave_is_NaN_or_NA (i_val) || xisinf (i_val)) 599 || (! (xisnan (i_val) || xisinf (i_val))
600 && fabs (i_val) > FLT_MAX)) 600 && fabs (i_val) > FLT_MAX))
601 return true; 601 return true;
602 } 602 }
603 603
604 return false; 604 return false;
733 733
734 for (idx_j = 0; idx_j < x_len; idx_j++) 734 for (idx_j = 0; idx_j < x_len; idx_j++)
735 { 735 {
736 tmp_max = elem (idx_j * x_stride + x_offset); 736 tmp_max = elem (idx_j * x_stride + x_offset);
737 737
738 if (! octave_is_NaN_or_NA (tmp_max)) 738 if (! xisnan (tmp_max))
739 { 739 {
740 abs_max = std::abs(tmp_max); 740 abs_max = std::abs(tmp_max);
741 break; 741 break;
742 } 742 }
743 } 743 }
744 744
745 for (octave_idx_type j = idx_j+1; j < x_len; j++) 745 for (octave_idx_type j = idx_j+1; j < x_len; j++)
746 { 746 {
747 Complex tmp = elem (j * x_stride + x_offset); 747 Complex tmp = elem (j * x_stride + x_offset);
748 748
749 if (octave_is_NaN_or_NA (tmp)) 749 if (xisnan (tmp))
750 continue; 750 continue;
751 751
752 double abs_tmp = std::abs (tmp); 752 double abs_tmp = std::abs (tmp);
753 753
754 if (abs_tmp > abs_max) 754 if (abs_tmp > abs_max)
757 tmp_max = tmp; 757 tmp_max = tmp;
758 abs_max = abs_tmp; 758 abs_max = abs_tmp;
759 } 759 }
760 } 760 }
761 761
762 if (octave_is_NaN_or_NA (tmp_max)) 762 if (xisnan (tmp_max))
763 { 763 {
764 result.elem (i) = Complex_NaN_result; 764 result.elem (i) = Complex_NaN_result;
765 idx_arg.elem (i) = 0; 765 idx_arg.elem (i) = 0;
766 } 766 }
767 else 767 else
825 825
826 for (idx_j = 0; idx_j < x_len; idx_j++) 826 for (idx_j = 0; idx_j < x_len; idx_j++)
827 { 827 {
828 tmp_min = elem (idx_j * x_stride + x_offset); 828 tmp_min = elem (idx_j * x_stride + x_offset);
829 829
830 if (! octave_is_NaN_or_NA (tmp_min)) 830 if (! xisnan (tmp_min))
831 { 831 {
832 abs_min = std::abs(tmp_min); 832 abs_min = std::abs(tmp_min);
833 break; 833 break;
834 } 834 }
835 } 835 }
836 836
837 for (octave_idx_type j = idx_j+1; j < x_len; j++) 837 for (octave_idx_type j = idx_j+1; j < x_len; j++)
838 { 838 {
839 Complex tmp = elem (j * x_stride + x_offset); 839 Complex tmp = elem (j * x_stride + x_offset);
840 840
841 if (octave_is_NaN_or_NA (tmp)) 841 if (xisnan (tmp))
842 continue; 842 continue;
843 843
844 double abs_tmp = std::abs (tmp); 844 double abs_tmp = std::abs (tmp);
845 845
846 if (abs_tmp < abs_min) 846 if (abs_tmp < abs_min)
849 tmp_min = tmp; 849 tmp_min = tmp;
850 abs_min = abs_tmp; 850 abs_min = abs_tmp;
851 } 851 }
852 } 852 }
853 853
854 if (octave_is_NaN_or_NA (tmp_min)) 854 if (xisnan (tmp_min))
855 { 855 {
856 result.elem (i) = Complex_NaN_result; 856 result.elem (i) = Complex_NaN_result;
857 idx_arg.elem (i) = 0; 857 idx_arg.elem (i) = 0;
858 } 858 }
859 else 859 else