comparison liboctave/fCNDArray.cc @ 11586:12df7854fa7c

strip trailing whitespace from source files
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:24:59 -0500
parents 57632dea2446
children 353c71c76f22
comparison
equal deleted inserted replaced
11585:1473d0cf86d2 11586:12df7854fa7c
77 FloatComplexNDArray retval (dv); 77 FloatComplexNDArray retval (dv);
78 FloatComplex *out (retval.fortran_vec ()); 78 FloatComplex *out (retval.fortran_vec ());
79 79
80 // Need to be careful here about the distance between fft's 80 // Need to be careful here about the distance between fft's
81 for (octave_idx_type k = 0; k < nloop; k++) 81 for (octave_idx_type k = 0; k < nloop; k++)
82 octave_fftw::fft (in + k * stride * n, out + k * stride * n, 82 octave_fftw::fft (in + k * stride * n, out + k * stride * n,
83 n, howmany, stride, dist); 83 n, howmany, stride, dist);
84 84
85 return retval; 85 return retval;
86 } 86 }
87 87
108 FloatComplexNDArray retval (dv); 108 FloatComplexNDArray retval (dv);
109 FloatComplex *out (retval.fortran_vec ()); 109 FloatComplex *out (retval.fortran_vec ());
110 110
111 // Need to be careful here about the distance between fft's 111 // Need to be careful here about the distance between fft's
112 for (octave_idx_type k = 0; k < nloop; k++) 112 for (octave_idx_type k = 0; k < nloop; k++)
113 octave_fftw::ifft (in + k * stride * n, out + k * stride * n, 113 octave_fftw::ifft (in + k * stride * n, out + k * stride * n,
114 n, howmany, stride, dist); 114 n, howmany, stride, dist);
115 115
116 return retval; 116 return retval;
117 } 117 }
118 118
314 FloatComplex *pwsave = wsave.fortran_vec (); 314 FloatComplex *pwsave = wsave.fortran_vec ();
315 Array<FloatComplex> row (npts, 1); 315 Array<FloatComplex> row (npts, 1);
316 FloatComplex *prow = row.fortran_vec (); 316 FloatComplex *prow = row.fortran_vec ();
317 317
318 octave_idx_type howmany = numel () / npts; 318 octave_idx_type howmany = numel () / npts;
319 howmany = (stride == 1 ? howmany : 319 howmany = (stride == 1 ? howmany :
320 (howmany > stride ? stride : howmany)); 320 (howmany > stride ? stride : howmany));
321 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); 321 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride);
322 octave_idx_type dist = (stride == 1 ? npts : 1); 322 octave_idx_type dist = (stride == 1 ? npts : 1);
323 323
324 F77_FUNC (cffti, CFFTI) (npts, pwsave); 324 F77_FUNC (cffti, CFFTI) (npts, pwsave);
362 FloatComplex *pwsave = wsave.fortran_vec (); 362 FloatComplex *pwsave = wsave.fortran_vec ();
363 Array<FloatComplex> row (npts, 1); 363 Array<FloatComplex> row (npts, 1);
364 FloatComplex *prow = row.fortran_vec (); 364 FloatComplex *prow = row.fortran_vec ();
365 365
366 octave_idx_type howmany = numel () / npts; 366 octave_idx_type howmany = numel () / npts;
367 howmany = (stride == 1 ? howmany : 367 howmany = (stride == 1 ? howmany :
368 (howmany > stride ? stride : howmany)); 368 (howmany > stride ? stride : howmany));
369 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); 369 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride);
370 octave_idx_type dist = (stride == 1 ? npts : 1); 370 octave_idx_type dist = (stride == 1 ? npts : 1);
371 371
372 F77_FUNC (cffti, CFFTI) (npts, pwsave); 372 F77_FUNC (cffti, CFFTI) (npts, pwsave);
410 FloatComplex *pwsave = wsave.fortran_vec (); 410 FloatComplex *pwsave = wsave.fortran_vec ();
411 Array<FloatComplex> row (npts, 1); 411 Array<FloatComplex> row (npts, 1);
412 FloatComplex *prow = row.fortran_vec (); 412 FloatComplex *prow = row.fortran_vec ();
413 413
414 octave_idx_type howmany = numel () / npts; 414 octave_idx_type howmany = numel () / npts;
415 howmany = (stride == 1 ? howmany : 415 howmany = (stride == 1 ? howmany :
416 (howmany > stride ? stride : howmany)); 416 (howmany > stride ? stride : howmany));
417 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); 417 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride);
418 octave_idx_type dist = (stride == 1 ? npts : 1); 418 octave_idx_type dist = (stride == 1 ? npts : 1);
419 419
420 F77_FUNC (cffti, CFFTI) (npts, pwsave); 420 F77_FUNC (cffti, CFFTI) (npts, pwsave);
457 FloatComplex *pwsave = wsave.fortran_vec (); 457 FloatComplex *pwsave = wsave.fortran_vec ();
458 Array<FloatComplex> row (npts, 1); 458 Array<FloatComplex> row (npts, 1);
459 FloatComplex *prow = row.fortran_vec (); 459 FloatComplex *prow = row.fortran_vec ();
460 460
461 octave_idx_type howmany = numel () / npts; 461 octave_idx_type howmany = numel () / npts;
462 howmany = (stride == 1 ? howmany : 462 howmany = (stride == 1 ? howmany :
463 (howmany > stride ? stride : howmany)); 463 (howmany > stride ? stride : howmany));
464 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride); 464 octave_idx_type nloop = (stride == 1 ? 1 : numel () / npts / stride);
465 octave_idx_type dist = (stride == 1 ? npts : 1); 465 octave_idx_type dist = (stride == 1 ? npts : 1);
466 466
467 F77_FUNC (cffti, CFFTI) (npts, pwsave); 467 F77_FUNC (cffti, CFFTI) (npts, pwsave);
524 return do_mx_check<FloatComplex> (*this, mx_inline_all_real); 524 return do_mx_check<FloatComplex> (*this, mx_inline_all_real);
525 } 525 }
526 526
527 // Return nonzero if any element of CM has a non-integer real or 527 // Return nonzero if any element of CM has a non-integer real or
528 // imaginary part. Also extract the largest and smallest (real or 528 // imaginary part. Also extract the largest and smallest (real or
529 // imaginary) values and return them in MAX_VAL and MIN_VAL. 529 // imaginary) values and return them in MAX_VAL and MIN_VAL.
530 530
531 bool 531 bool
532 FloatComplexNDArray::all_integers (float& max_val, float& min_val) const 532 FloatComplexNDArray::all_integers (float& max_val, float& min_val) const
533 { 533 {
534 octave_idx_type nel = nelem (); 534 octave_idx_type nel = nelem ();
537 { 537 {
538 FloatComplex val = elem (0); 538 FloatComplex val = elem (0);
539 539
540 float r_val = std::real (val); 540 float r_val = std::real (val);
541 float i_val = std::imag (val); 541 float i_val = std::imag (val);
542 542
543 max_val = r_val; 543 max_val = r_val;
544 min_val = r_val; 544 min_val = r_val;
545 545
546 if (i_val > max_val) 546 if (i_val > max_val)
547 max_val = i_val; 547 max_val = i_val;
762 762
763 FloatComplexNDArray& 763 FloatComplexNDArray&
764 FloatComplexNDArray::insert (const NDArray& a, octave_idx_type r, octave_idx_type c) 764 FloatComplexNDArray::insert (const NDArray& a, octave_idx_type r, octave_idx_type c)
765 { 765 {
766 dim_vector a_dv = a.dims (); 766 dim_vector a_dv = a.dims ();
767 767
768 int n = a_dv.length (); 768 int n = a_dv.length ();
769 769
770 if (n == dimensions.length ()) 770 if (n == dimensions.length ())
771 { 771 {
772 Array<octave_idx_type> a_ra_idx (dim_vector (a_dv.length (), 1), 0); 772 Array<octave_idx_type> a_ra_idx (dim_vector (a_dv.length (), 1), 0);
773 773
774 a_ra_idx.elem (0) = r; 774 a_ra_idx.elem (0) = r;
775 a_ra_idx.elem (1) = c; 775 a_ra_idx.elem (1) = c;
776 776
777 for (int i = 0; i < n; i++) 777 for (int i = 0; i < n; i++)
778 { 778 {
779 if (a_ra_idx (i) < 0 || (a_ra_idx (i) + a_dv (i)) > dimensions (i)) 779 if (a_ra_idx (i) < 0 || (a_ra_idx (i) + a_dv (i)) > dimensions (i))
780 { 780 {
781 (*current_liboctave_error_handler) 781 (*current_liboctave_error_handler)
782 ("Array<T>::insert: range error for insert"); 782 ("Array<T>::insert: range error for insert");
783 return *this; 783 return *this;
784 } 784 }
785 } 785 }
786 786
787 a_ra_idx.elem (0) = 0; 787 a_ra_idx.elem (0) = 0;
788 a_ra_idx.elem (1) = 0; 788 a_ra_idx.elem (1) = 0;
789 789
790 octave_idx_type n_elt = a.numel (); 790 octave_idx_type n_elt = a.numel ();
791 791
792 // IS make_unique () NECCESSARY HERE?? 792 // IS make_unique () NECCESSARY HERE??
793 793
794 for (octave_idx_type i = 0; i < n_elt; i++) 794 for (octave_idx_type i = 0; i < n_elt; i++)
795 { 795 {
796 Array<octave_idx_type> ra_idx = a_ra_idx; 796 Array<octave_idx_type> ra_idx = a_ra_idx;
797 797
798 ra_idx.elem (0) = a_ra_idx (0) + r; 798 ra_idx.elem (0) = a_ra_idx (0) + r;
799 ra_idx.elem (1) = a_ra_idx (1) + c; 799 ra_idx.elem (1) = a_ra_idx (1) + c;
800 800
801 elem (ra_idx) = a.elem (a_ra_idx); 801 elem (ra_idx) = a.elem (a_ra_idx);
802 802
803 increment_index (a_ra_idx, a_dv); 803 increment_index (a_ra_idx, a_dv);
804 } 804 }
805 } 805 }
844 int start_dimension) 844 int start_dimension)
845 { 845 {
846 ::increment_index (ra_idx, dimensions, start_dimension); 846 ::increment_index (ra_idx, dimensions, start_dimension);
847 } 847 }
848 848
849 octave_idx_type 849 octave_idx_type
850 FloatComplexNDArray::compute_index (Array<octave_idx_type>& ra_idx, 850 FloatComplexNDArray::compute_index (Array<octave_idx_type>& ra_idx,
851 const dim_vector& dimensions) 851 const dim_vector& dimensions)
852 { 852 {
853 return ::compute_index (ra_idx, dimensions); 853 return ::compute_index (ra_idx, dimensions);
854 } 854 }