Mercurial > hg > octave-nkf
comparison liboctave/array/fCNDArray.cc @ 20428:b2100e1659ac
maint: Use cuddled parentheses when indexing dimension_vectors.
* libinterp/corefcn/besselj.cc, libinterp/corefcn/bsxfun.cc,
libinterp/corefcn/data.cc, libinterp/corefcn/dot.cc, libinterp/corefcn/fft.cc,
libinterp/corefcn/fft2.cc, libinterp/corefcn/tril.cc,
libinterp/corefcn/typecast.cc, libinterp/octave-value/ov-base-int.cc,
libinterp/octave-value/ov-base-mat.cc,
libinterp/octave-value/ov-base-sparse.cc,
libinterp/octave-value/ov-bool-mat.cc, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-cx-mat.cc, libinterp/octave-value/ov-flt-cx-mat.cc,
libinterp/octave-value/ov-flt-re-mat.cc, libinterp/octave-value/ov-lazy-idx.cc,
libinterp/octave-value/ov-re-mat.cc, libinterp/octave-value/ov-str-mat.cc,
libinterp/octave-value/ov-struct.cc, liboctave/array/Array-util.cc,
liboctave/array/Array.cc, liboctave/array/CMatrix.cc,
liboctave/array/CNDArray.cc, liboctave/array/MArray.cc,
liboctave/array/Sparse.cc, liboctave/array/dMatrix.cc,
liboctave/array/dNDArray.cc, liboctave/array/fCMatrix.cc,
liboctave/array/fCNDArray.cc, liboctave/array/fMatrix.cc,
liboctave/array/fNDArray.cc, liboctave/operators/mx-inlines.cc:
maint: Use cuddled parentheses when indexing dimension_vectors.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 23 May 2015 21:46:44 -0700 |
parents | 4197fc428c7d |
children | 00cf2847355d |
comparison
equal
deleted
inserted
replaced
20427:b5d2f6954c48 | 20428:b2100e1659ac |
---|---|
67 octave_idx_type n = dv(dim); | 67 octave_idx_type n = dv(dim); |
68 | 68 |
69 for (int i = 0; i < dim; i++) | 69 for (int i = 0; i < dim; i++) |
70 stride *= dv(i); | 70 stride *= dv(i); |
71 | 71 |
72 octave_idx_type howmany = numel () / dv (dim); | 72 octave_idx_type howmany = numel () / dv(dim); |
73 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); | 73 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); |
74 octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); | 74 octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride); |
75 octave_idx_type dist = (stride == 1 ? n : 1); | 75 octave_idx_type dist = (stride == 1 ? n : 1); |
76 | 76 |
77 const FloatComplex *in (fortran_vec ()); | 77 const FloatComplex *in (fortran_vec ()); |
78 FloatComplexNDArray retval (dv); | 78 FloatComplexNDArray retval (dv); |
79 FloatComplex *out (retval.fortran_vec ()); | 79 FloatComplex *out (retval.fortran_vec ()); |
98 octave_idx_type n = dv(dim); | 98 octave_idx_type n = dv(dim); |
99 | 99 |
100 for (int i = 0; i < dim; i++) | 100 for (int i = 0; i < dim; i++) |
101 stride *= dv(i); | 101 stride *= dv(i); |
102 | 102 |
103 octave_idx_type howmany = numel () / dv (dim); | 103 octave_idx_type howmany = numel () / dv(dim); |
104 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); | 104 howmany = (stride == 1 ? howmany : (howmany > stride ? stride : howmany)); |
105 octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv (dim) / stride); | 105 octave_idx_type nloop = (stride == 1 ? 1 : numel () / dv(dim) / stride); |
106 octave_idx_type dist = (stride == 1 ? n : 1); | 106 octave_idx_type dist = (stride == 1 ? n : 1); |
107 | 107 |
108 const FloatComplex *in (fortran_vec ()); | 108 const FloatComplex *in (fortran_vec ()); |
109 FloatComplexNDArray retval (dv); | 109 FloatComplexNDArray retval (dv); |
110 FloatComplex *out (retval.fortran_vec ()); | 110 FloatComplex *out (retval.fortran_vec ()); |
122 { | 122 { |
123 dim_vector dv = dims (); | 123 dim_vector dv = dims (); |
124 if (dv.length () < 2) | 124 if (dv.length () < 2) |
125 return FloatComplexNDArray (); | 125 return FloatComplexNDArray (); |
126 | 126 |
127 dim_vector dv2(dv(0), dv(1)); | 127 dim_vector dv2 (dv(0), dv(1)); |
128 const FloatComplex *in = fortran_vec (); | 128 const FloatComplex *in = fortran_vec (); |
129 FloatComplexNDArray retval (dv); | 129 FloatComplexNDArray retval (dv); |
130 FloatComplex *out = retval.fortran_vec (); | 130 FloatComplex *out = retval.fortran_vec (); |
131 octave_idx_type howmany = numel () / dv(0) / dv(1); | 131 octave_idx_type howmany = numel () / dv(0) / dv(1); |
132 octave_idx_type dist = dv(0) * dv(1); | 132 octave_idx_type dist = dv(0) * dv(1); |
142 { | 142 { |
143 dim_vector dv = dims (); | 143 dim_vector dv = dims (); |
144 if (dv.length () < 2) | 144 if (dv.length () < 2) |
145 return FloatComplexNDArray (); | 145 return FloatComplexNDArray (); |
146 | 146 |
147 dim_vector dv2(dv(0), dv(1)); | 147 dim_vector dv2 (dv(0), dv(1)); |
148 const FloatComplex *in = fortran_vec (); | 148 const FloatComplex *in = fortran_vec (); |
149 FloatComplexNDArray retval (dv); | 149 FloatComplexNDArray retval (dv); |
150 FloatComplex *out = retval.fortran_vec (); | 150 FloatComplex *out = retval.fortran_vec (); |
151 octave_idx_type howmany = numel () / dv(0) / dv(1); | 151 octave_idx_type howmany = numel () / dv(0) / dv(1); |
152 octave_idx_type dist = dv(0) * dv(1); | 152 octave_idx_type dist = dv(0) * dv(1); |
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 } |
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 () NECESSARY 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 } |