comparison liboctave/operators/mx-inlines.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 49a5a4be04a1
children 6c706a83070f
comparison
equal deleted inserted replaced
18083:938f01339043 18084:8e056300994b
363 void (*op) (size_t, R *, const X *, const Y *) throw (), 363 void (*op) (size_t, R *, const X *, const Y *) throw (),
364 void (*op1) (size_t, R *, X, const Y *) throw (), 364 void (*op1) (size_t, R *, X, const Y *) throw (),
365 void (*op2) (size_t, R *, const X *, Y) throw (), 365 void (*op2) (size_t, R *, const X *, Y) throw (),
366 const char *opname) 366 const char *opname)
367 { 367 {
368 dim_vector dx = x.dims (), dy = y.dims (); 368 dim_vector dx = x.dims ();
369 dim_vector dy = y.dims ();
369 if (dx == dy) 370 if (dx == dy)
370 { 371 {
371 Array<R> r (dx); 372 Array<R> r (dx);
372 op (r.length (), r.fortran_vec (), x.data (), y.data ()); 373 op (r.length (), r.fortran_vec (), x.data (), y.data ());
373 return r; 374 return r;
408 do_mm_inplace_op (Array<R>& r, const Array<X>& x, 409 do_mm_inplace_op (Array<R>& r, const Array<X>& x,
409 void (*op) (size_t, R *, const X *) throw (), 410 void (*op) (size_t, R *, const X *) throw (),
410 void (*op1) (size_t, R *, X) throw (), 411 void (*op1) (size_t, R *, X) throw (),
411 const char *opname) 412 const char *opname)
412 { 413 {
413 dim_vector dr = r.dims (), dx = x.dims (); 414 dim_vector dr = r.dims ();
415 dim_vector dx = x.dims ();
414 if (dr == dx) 416 if (dr == dx)
415 { 417 {
416 op (r.length (), r.fortran_vec (), x.data ()); 418 op (r.length (), r.fortran_vec (), x.data ());
417 } 419 }
418 else if (is_valid_inplace_bsxfun (opname, dr, dx)) 420 else if (is_valid_inplace_bsxfun (opname, dr, dx))
854 template <class T> \ 856 template <class T> \
855 void F (const T *v, T *r, octave_idx_type n) \ 857 void F (const T *v, T *r, octave_idx_type n) \
856 { \ 858 { \
857 if (! n) return; \ 859 if (! n) return; \
858 T tmp = v[0]; \ 860 T tmp = v[0]; \
859 octave_idx_type i = 1, j = 0; \ 861 octave_idx_type i = 1; \
862 octave_idx_type j = 0; \
860 if (xisnan (tmp)) \ 863 if (xisnan (tmp)) \
861 { \ 864 { \
862 for (; i < n && xisnan (v[i]); i++) ; \ 865 for (; i < n && xisnan (v[i]); i++) ; \
863 for (; j < i; j++) r[j] = tmp; \ 866 for (; j < i; j++) r[j] = tmp; \
864 if (i < n) tmp = v[i]; \ 867 if (i < n) tmp = v[i]; \
874 template <class T> \ 877 template <class T> \
875 void F (const T *v, T *r, octave_idx_type *ri, octave_idx_type n) \ 878 void F (const T *v, T *r, octave_idx_type *ri, octave_idx_type n) \
876 { \ 879 { \
877 if (! n) return; \ 880 if (! n) return; \
878 T tmp = v[0]; octave_idx_type tmpi = 0; \ 881 T tmp = v[0]; octave_idx_type tmpi = 0; \
879 octave_idx_type i = 1, j = 0; \ 882 octave_idx_type i = 1; \
883 octave_idx_type j = 0; \
880 if (xisnan (tmp)) \ 884 if (xisnan (tmp)) \
881 { \ 885 { \
882 for (; i < n && xisnan (v[i]); i++) ; \ 886 for (; i < n && xisnan (v[i]); i++) ; \
883 for (; j < i; j++) { r[j] = tmp; ri[j] = tmpi; } \ 887 for (; j < i; j++) { r[j] = tmp; ri[j] = tmpi; } \
884 if (i < n) { tmp = v[i]; tmpi = i; } \ 888 if (i < n) { tmp = v[i]; tmpi = i; } \
1328 1332
1329 template <class T> 1333 template <class T>
1330 inline void twosum_accum (T& s, T& e, 1334 inline void twosum_accum (T& s, T& e,
1331 const T& x) 1335 const T& x)
1332 { 1336 {
1333 T s1 = s + x, t = s1 - s, e1 = (s - (s1 - t)) + (x - t); 1337 T s1 = s + x;
1338 T t = s1 - s;
1339 T e1 = (s - (s1 - t)) + (x - t);
1334 s = s1; 1340 s = s1;
1335 e += e1; 1341 e += e1;
1336 } 1342 }
1337 1343
1338 template <class T> 1344 template <class T>
1339 inline T 1345 inline T
1340 mx_inline_xsum (const T *v, octave_idx_type n) 1346 mx_inline_xsum (const T *v, octave_idx_type n)
1341 { 1347 {
1342 T s = 0, e = 0; 1348 T s = 0;
1349 T e = 0;
1343 for (octave_idx_type i = 0; i < n; i++) 1350 for (octave_idx_type i = 0; i < n; i++)
1344 twosum_accum (s, e, v[i]); 1351 twosum_accum (s, e, v[i]);
1345 1352
1346 return s + e; 1353 return s + e;
1347 } 1354 }