comparison src/ov-base-int.cc @ 14846:460a3c6d8bf1

maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists. Example: func() => func () * dynamic.txi, func.txi, oop.txi, var.txi, embedded.cc, fortdemo.cc, funcdemo.cc, paramdemo.cc, stringdemo.cc, unwinddemo.cc, Array.cc, Array.h, CColVector.cc, CDiagMatrix.h, CMatrix.cc, CNDArray.cc, CRowVector.cc, CSparse.cc, CmplxGEPBAL.cc, EIG.cc, MSparse.cc, MatrixType.cc, Sparse-op-defs.h, Sparse-perm-op-defs.h, Sparse.cc, Sparse.h, SparseCmplxCHOL.cc, SparseCmplxCHOL.h, SparseCmplxLU.cc, SparseCmplxQR.cc, SparseCmplxQR.h, SparseQR.cc, SparseQR.h, SparsedbleCHOL.cc, SparsedbleCHOL.h, SparsedbleLU.cc, SparsedbleLU.h, base-lu.cc, cmd-hist.cc, dColVector.cc, dDiagMatrix.h, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc, dbleCHOL.cc, dbleGEPBAL.cc, dim-vector.cc, eigs-base.cc, f2c-main.c, fCColVector.cc, fCDiagMatrix.h, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fCmplxGEPBAL.cc, fColVector.cc, fDiagMatrix.h, fEIG.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc, file-ops.cc, file-stat.cc, floatCHOL.cc, floatGEPBAL.cc, idx-vector.h, lo-specfun.cc, lo-sysdep.cc, mx-inlines.cc, oct-binmap.h, oct-convn.cc, oct-md5.cc, oct-mem.h, oct-rand.cc, oct-syscalls.cc, randgamma.c, randmtzig.c, sparse-base-chol.cc, sparse-base-chol.h, sparse-base-lu.cc, sparse-dmsolve.cc, tempname.c, curl.m, divergence.m, randi.m, dlmwrite.m, edit.m, getappdata.m, what.m, getarchdir.m, install.m, installed_packages.m, repackage.m, unload_packages.m, colorbar.m, figure.m, isosurface.m, legend.m, loglog.m, plot.m, plot3.m, plotyy.m, polar.m, __errplot__.m, __ghostscript__.m, __marching_cube__.m, __plt__.m, __scatter__.m, semilogx.m, semilogy.m, trimesh.m, trisurf.m, demo.m, test.m, datetick.m, __delaunayn__.cc, __dsearchn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, balance.cc, bsxfun.cc, ccolamd.cc, cellfun.cc, chol.cc, daspk.cc, dasrt.cc, dassl.cc, dmperm.cc, eig.cc, eigs.cc, fftw.cc, filter.cc, find.cc, kron.cc, lookup.cc, lsode.cc, matrix_type.cc, md5sum.cc, mgorth.cc, qr.cc, quad.cc, rand.cc, regexp.cc, symbfact.cc, tril.cc, urlwrite.cc, op-bm-bm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-cm-cm.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fdm-fdm.cc, op-fm-fm.cc, op-int.h, op-m-m.cc, op-m-scm.cc, op-m-sm.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-range.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-str.cc, op-struct.cc, bitfcns.cc, data.cc, debug.cc, dynamic-ld.cc, error.cc, gl-render.cc, graphics.cc, graphics.in.h, load-path.cc, ls-hdf5.cc, ls-mat5.cc, ls-mat5.h, ls-oct-ascii.cc, ls-oct-ascii.h, mex.cc, mk-errno-list, oct-map.cc, oct-obj.h, oct-parse.yy, octave-config.in.cc, ov-base-int.cc, ov-base-mat.cc, ov-base.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-cell.cc, ov-class.cc, ov-class.h, ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-intx.h, ov-range.h, ov-re-mat.cc, ov-re-sparse.cc, ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.h, ov.h, pr-output.cc, pt-id.cc, pt-id.h, pt-mat.cc, pt-select.cc, sparse.cc, symtab.cc, symtab.h, syscalls.cc, toplev.cc, txt-eng-ft.cc, variables.cc, zfstream.cc, zfstream.h, Dork.m, getStash.m, myStash.m, Gork.m, Pork.m, myStash.m, getStash.m, myStash.m, getStash.m, myStash.m, fntests.m: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
author Rik <octave@nomad.inbox5.com>
date Sun, 08 Jul 2012 11:28:50 -0700
parents 72c96de7a403
children f7afecdd87ef
comparison
equal deleted inserted replaced
14844:5bc9b9cb4362 14846:460a3c6d8bf1
237 template <class T> 237 template <class T>
238 bool 238 bool
239 octave_base_int_matrix<T>::save_binary (std::ostream& os, bool&) 239 octave_base_int_matrix<T>::save_binary (std::ostream& os, bool&)
240 { 240 {
241 dim_vector d = this->dims (); 241 dim_vector d = this->dims ();
242 if (d.length() < 1) 242 if (d.length () < 1)
243 return false; 243 return false;
244 244
245 // Use negative value for ndims to differentiate with old format!! 245 // Use negative value for ndims to differentiate with old format!!
246 int32_t tmp = - d.length(); 246 int32_t tmp = - d.length ();
247 os.write (reinterpret_cast<char *> (&tmp), 4); 247 os.write (reinterpret_cast<char *> (&tmp), 4);
248 for (int i=0; i < d.length (); i++) 248 for (int i=0; i < d.length (); i++)
249 { 249 {
250 tmp = d(i); 250 tmp = d(i);
251 os.write (reinterpret_cast<char *> (&tmp), 4); 251 os.write (reinterpret_cast<char *> (&tmp), 4);
252 } 252 }
253 253
254 os.write (reinterpret_cast<const char *> (this->matrix.data()), this->byte_size()); 254 os.write (reinterpret_cast<const char *> (this->matrix.data ()), this->byte_size ());
255 255
256 return true; 256 return true;
257 } 257 }
258 258
259 template <class T> 259 template <class T>
301 return false; 301 return false;
302 302
303 if (swap) 303 if (swap)
304 { 304 {
305 int nel = dv.numel (); 305 int nel = dv.numel ();
306 int bytes = nel / m.byte_size(); 306 int bytes = nel / m.byte_size ();
307 for (int i = 0; i < nel; i++) 307 for (int i = 0; i < nel; i++)
308 switch (bytes) 308 switch (bytes)
309 { 309 {
310 case 8: 310 case 8:
311 swap_bytes<8> (&m(i)); 311 swap_bytes<8> (&m(i));
362 H5Sclose (space_hid); 362 H5Sclose (space_hid);
363 return false; 363 return false;
364 } 364 }
365 365
366 retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL, 366 retval = H5Dwrite (data_hid, save_type_hid, H5S_ALL, H5S_ALL,
367 H5P_DEFAULT, this->matrix.data()) >= 0; 367 H5P_DEFAULT, this->matrix.data ()) >= 0;
368 368
369 H5Dclose (data_hid); 369 H5Dclose (data_hid);
370 H5Sclose (space_hid); 370 H5Sclose (space_hid);
371 371
372 return retval; 372 return retval;
420 dv(j) = hdims[i]; 420 dv(j) = hdims[i];
421 } 421 }
422 422
423 T m (dv); 423 T m (dv);
424 if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL, 424 if (H5Dread (data_hid, save_type_hid, H5S_ALL, H5S_ALL,
425 H5P_DEFAULT, m.fortran_vec()) >= 0) 425 H5P_DEFAULT, m.fortran_vec ()) >= 0)
426 { 426 {
427 retval = true; 427 retval = true;
428 this->matrix = m; 428 this->matrix = m;
429 } 429 }
430 430
499 499
500 template <class T> 500 template <class T>
501 bool 501 bool
502 octave_base_int_scalar<T>::save_binary (std::ostream& os, bool&) 502 octave_base_int_scalar<T>::save_binary (std::ostream& os, bool&)
503 { 503 {
504 os.write (reinterpret_cast<char *> (&(this->scalar)), this->byte_size()); 504 os.write (reinterpret_cast<char *> (&(this->scalar)), this->byte_size ());
505 return true; 505 return true;
506 } 506 }
507 507
508 template <class T> 508 template <class T>
509 bool 509 bool
510 octave_base_int_scalar<T>::load_binary (std::istream& is, bool swap, 510 octave_base_int_scalar<T>::load_binary (std::istream& is, bool swap,
511 oct_mach_info::float_format) 511 oct_mach_info::float_format)
512 { 512 {
513 T tmp; 513 T tmp;
514 if (! is.read (reinterpret_cast<char *> (&tmp), this->byte_size())) 514 if (! is.read (reinterpret_cast<char *> (&tmp), this->byte_size ()))
515 return false; 515 return false;
516 516
517 if (swap) 517 if (swap)
518 switch (this->byte_size()) 518 switch (this->byte_size ())
519 { 519 {
520 case 8: 520 case 8:
521 swap_bytes<8> (&tmp); 521 swap_bytes<8> (&tmp);
522 break; 522 break;
523 case 4: 523 case 4: