Mercurial > octave-nkf
comparison liboctave/numeric/bsxfun-defs.cc @ 18084:8e056300994b
Follow coding convention of defining and initializing only 1 variable per line in liboctave.
* liboctave/array/Array-b.cc, liboctave/array/Array-util.cc,
liboctave/array/Array.cc, liboctave/array/CDiagMatrix.cc,
liboctave/array/CMatrix.cc, liboctave/array/CSparse.cc,
liboctave/array/MDiagArray2.cc, liboctave/array/MatrixType.cc,
liboctave/array/PermMatrix.cc, liboctave/array/Sparse.cc,
liboctave/array/Sparse.h, liboctave/array/boolSparse.cc,
liboctave/array/dDiagMatrix.cc, liboctave/array/dMatrix.cc,
liboctave/array/dSparse.cc, liboctave/array/dim-vector.cc,
liboctave/array/fCDiagMatrix.cc, liboctave/array/fCMatrix.cc,
liboctave/array/fDiagMatrix.cc, liboctave/array/fMatrix.cc,
liboctave/array/idx-vector.cc, liboctave/array/idx-vector.h,
liboctave/numeric/CmplxLU.cc, liboctave/numeric/CmplxQR.cc,
liboctave/numeric/base-qr.cc, liboctave/numeric/bsxfun-defs.cc,
liboctave/numeric/bsxfun.h, liboctave/numeric/dbleLU.cc,
liboctave/numeric/dbleQR.cc, liboctave/numeric/fCmplxLU.cc,
liboctave/numeric/fCmplxQR.cc, liboctave/numeric/floatLU.cc,
liboctave/numeric/floatQR.cc, liboctave/numeric/lo-specfun.cc,
liboctave/numeric/oct-convn.cc, liboctave/numeric/oct-norm.cc,
liboctave/numeric/sparse-dmsolve.cc, liboctave/operators/mx-inlines.cc,
liboctave/operators/mx-op-defs.h, liboctave/util/caseless-str.h,
liboctave/util/kpse.cc, liboctave/util/lo-utils.cc,
liboctave/util/oct-binmap.h, liboctave/util/oct-cmplx.h,
liboctave/util/oct-inttypes.cc, liboctave/util/oct-inttypes.h,
liboctave/util/oct-sort.cc:
Follow coding convention of defining and initializing only 1 variable per line in liboctave.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 04 Dec 2013 22:13:18 -0800 |
parents | d63878346099 |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
18083:938f01339043 | 18084:8e056300994b |
---|---|
39 void (*op_vv) (size_t, R *, const X *, const Y *), | 39 void (*op_vv) (size_t, R *, const X *, const Y *), |
40 void (*op_sv) (size_t, R *, X, const Y *), | 40 void (*op_sv) (size_t, R *, X, const Y *), |
41 void (*op_vs) (size_t, R *, const X *, Y)) | 41 void (*op_vs) (size_t, R *, const X *, Y)) |
42 { | 42 { |
43 int nd = std::max (x.ndims (), y.ndims ()); | 43 int nd = std::max (x.ndims (), y.ndims ()); |
44 dim_vector dvx = x.dims ().redim (nd), dvy = y.dims ().redim (nd); | 44 dim_vector dvx = x.dims ().redim (nd); |
45 dim_vector dvy = y.dims ().redim (nd); | |
45 | 46 |
46 // Construct the result dimensions. | 47 // Construct the result dimensions. |
47 dim_vector dvr; | 48 dim_vector dvr; |
48 dvr.resize (nd); | 49 dvr.resize (nd); |
49 for (int i = 0; i < nd; i++) | 50 for (int i = 0; i < nd; i++) |
50 { | 51 { |
51 octave_idx_type xk = dvx(i), yk = dvy(i); | 52 octave_idx_type xk = dvx(i); |
53 octave_idx_type yk = dvy(i); | |
52 if (xk == 1) | 54 if (xk == 1) |
53 dvr(i) = yk; | 55 dvr(i) = yk; |
54 else if (yk == 1 || xk == yk) | 56 else if (yk == 1 || xk == yk) |
55 dvr(i) = xk; | 57 dvr(i) = xk; |
56 else | 58 else |
82 else if (start == nd) | 84 else if (start == nd) |
83 op_vv (retval.numel (), rvec, xvec, yvec); | 85 op_vv (retval.numel (), rvec, xvec, yvec); |
84 else | 86 else |
85 { | 87 { |
86 // Determine the type of the low-level loop. | 88 // Determine the type of the low-level loop. |
87 bool xsing = false, ysing = false; | 89 bool xsing = false; |
90 bool ysing = false; | |
88 if (ldr == 1) | 91 if (ldr == 1) |
89 { | 92 { |
90 xsing = dvx(start) == 1; | 93 xsing = dvx(start) == 1; |
91 ysing = dvy(start) == 1; | 94 ysing = dvy(start) == 1; |
92 if (xsing || ysing) | 95 if (xsing || ysing) |
93 { | 96 { |
94 ldr *= dvx(start) * dvy(start); | 97 ldr *= dvx(start) * dvy(start); |
95 start++; | 98 start++; |
96 } | 99 } |
97 } | 100 } |
98 dim_vector cdvx = dvx.cumulative (), cdvy = dvy.cumulative (); | 101 dim_vector cdvx = dvx.cumulative (); |
102 dim_vector cdvy = dvy.cumulative (); | |
99 // Nullify singleton dims to achieve a spread effect. | 103 // Nullify singleton dims to achieve a spread effect. |
100 for (int i = std::max (start, octave_idx_type (1)); i < nd; i++) | 104 for (int i = std::max (start, octave_idx_type (1)); i < nd; i++) |
101 { | 105 { |
102 if (dvx(i) == 1) | 106 if (dvx(i) == 1) |
103 cdvx(i-1) = 0; | 107 cdvx(i-1) = 0; |
137 void | 141 void |
138 do_inplace_bsxfun_op (Array<R>& r, const Array<X>& x, | 142 do_inplace_bsxfun_op (Array<R>& r, const Array<X>& x, |
139 void (*op_vv) (size_t, R *, const X *), | 143 void (*op_vv) (size_t, R *, const X *), |
140 void (*op_vs) (size_t, R *, X)) | 144 void (*op_vs) (size_t, R *, X)) |
141 { | 145 { |
142 dim_vector dvr = r.dims (), dvx = x.dims (); | 146 dim_vector dvr = r.dims (); |
147 dim_vector dvx = x.dims (); | |
143 octave_idx_type nd = r.ndims (); | 148 octave_idx_type nd = r.ndims (); |
144 dvx.redim (nd); | 149 dvx.redim (nd); |
145 | 150 |
146 const X* xvec = x.fortran_vec (); | 151 const X* xvec = x.fortran_vec (); |
147 R* rvec = r.fortran_vec (); | 152 R* rvec = r.fortran_vec (); |