Mercurial > octave-nkf
comparison src/ov-flt-complex.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 | fd0a3ac60b0e |
children | 72c96de7a403 |
comparison
equal
deleted
inserted
replaced
11585:1473d0cf86d2 | 11586:12df7854fa7c |
---|---|
203 octave_float_complex::float_complex_array_value (bool /* force_conversion */) const | 203 octave_float_complex::float_complex_array_value (bool /* force_conversion */) const |
204 { | 204 { |
205 return FloatComplexNDArray (dim_vector (1, 1), scalar); | 205 return FloatComplexNDArray (dim_vector (1, 1), scalar); |
206 } | 206 } |
207 | 207 |
208 octave_value | 208 octave_value |
209 octave_float_complex::resize (const dim_vector& dv, bool fill) const | 209 octave_float_complex::resize (const dim_vector& dv, bool fill) const |
210 { | 210 { |
211 if (fill) | 211 if (fill) |
212 { | 212 { |
213 FloatComplexNDArray retval (dv, FloatComplexNDArray::resize_fill_value ()); | 213 FloatComplexNDArray retval (dv, FloatComplexNDArray::resize_fill_value ()); |
226 | 226 |
227 return retval; | 227 return retval; |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 bool | 231 bool |
232 octave_float_complex::save_ascii (std::ostream& os) | 232 octave_float_complex::save_ascii (std::ostream& os) |
233 { | 233 { |
234 FloatComplex c = float_complex_value (); | 234 FloatComplex c = float_complex_value (); |
235 | 235 |
236 octave_write_float_complex (os, c); | 236 octave_write_float_complex (os, c); |
238 os << "\n"; | 238 os << "\n"; |
239 | 239 |
240 return true; | 240 return true; |
241 } | 241 } |
242 | 242 |
243 bool | 243 bool |
244 octave_float_complex::load_ascii (std::istream& is) | 244 octave_float_complex::load_ascii (std::istream& is) |
245 { | 245 { |
246 scalar = octave_read_value<FloatComplex> (is); | 246 scalar = octave_read_value<FloatComplex> (is); |
247 | 247 |
248 if (!is) | 248 if (!is) |
249 { | 249 { |
250 error ("load: failed to load complex scalar constant"); | 250 error ("load: failed to load complex scalar constant"); |
251 return false; | 251 return false; |
252 } | 252 } |
253 | 253 |
254 return true; | 254 return true; |
255 } | 255 } |
256 | 256 |
257 | 257 |
258 bool | 258 bool |
259 octave_float_complex::save_binary (std::ostream& os, bool& /* save_as_floats */) | 259 octave_float_complex::save_binary (std::ostream& os, bool& /* save_as_floats */) |
260 { | 260 { |
261 char tmp = static_cast<char> (LS_FLOAT); | 261 char tmp = static_cast<char> (LS_FLOAT); |
262 os.write (reinterpret_cast<char *> (&tmp), 1); | 262 os.write (reinterpret_cast<char *> (&tmp), 1); |
263 FloatComplex ctmp = float_complex_value (); | 263 FloatComplex ctmp = float_complex_value (); |
264 os.write (reinterpret_cast<char *> (&ctmp), 8); | 264 os.write (reinterpret_cast<char *> (&ctmp), 8); |
265 | 265 |
266 return true; | 266 return true; |
267 } | 267 } |
268 | 268 |
269 bool | 269 bool |
270 octave_float_complex::load_binary (std::istream& is, bool swap, | 270 octave_float_complex::load_binary (std::istream& is, bool swap, |
271 oct_mach_info::float_format fmt) | 271 oct_mach_info::float_format fmt) |
272 { | 272 { |
273 char tmp; | 273 char tmp; |
274 if (! is.read (reinterpret_cast<char *> (&tmp), 1)) | 274 if (! is.read (reinterpret_cast<char *> (&tmp), 1)) |
297 space_hid = H5Screate_simple (0, dimens, 0); | 297 space_hid = H5Screate_simple (0, dimens, 0); |
298 if (space_hid < 0) | 298 if (space_hid < 0) |
299 return false; | 299 return false; |
300 | 300 |
301 type_hid = hdf5_make_complex_type (H5T_NATIVE_FLOAT); | 301 type_hid = hdf5_make_complex_type (H5T_NATIVE_FLOAT); |
302 if (type_hid < 0) | 302 if (type_hid < 0) |
303 { | 303 { |
304 H5Sclose (space_hid); | 304 H5Sclose (space_hid); |
305 return false; | 305 return false; |
306 } | 306 } |
307 #if HAVE_HDF5_18 | 307 #if HAVE_HDF5_18 |
308 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, | 308 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, |
309 H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); | 309 H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); |
310 #else | 310 #else |
311 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT); | 311 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT); |
312 #endif | 312 #endif |
313 if (data_hid < 0) | 313 if (data_hid < 0) |
314 { | 314 { |
315 H5Sclose (space_hid); | 315 H5Sclose (space_hid); |
316 H5Tclose (type_hid); | 316 H5Tclose (type_hid); |
317 return false; | 317 return false; |
318 } | 318 } |
319 | 319 |
320 FloatComplex tmp = float_complex_value (); | 320 FloatComplex tmp = float_complex_value (); |
321 retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT, | 321 retval = H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT, |
322 &tmp) >= 0; | 322 &tmp) >= 0; |
323 | 323 |
324 H5Dclose (data_hid); | 324 H5Dclose (data_hid); |
325 H5Tclose (type_hid); | 325 H5Tclose (type_hid); |
326 H5Sclose (space_hid); | 326 H5Sclose (space_hid); |
349 } | 349 } |
350 | 350 |
351 hid_t space_id = H5Dget_space (data_hid); | 351 hid_t space_id = H5Dget_space (data_hid); |
352 hsize_t rank = H5Sget_simple_extent_ndims (space_id); | 352 hsize_t rank = H5Sget_simple_extent_ndims (space_id); |
353 | 353 |
354 if (rank != 0) | 354 if (rank != 0) |
355 { | 355 { |
356 H5Tclose (complex_type); | 356 H5Tclose (complex_type); |
357 H5Sclose (space_id); | 357 H5Sclose (space_id); |
358 H5Dclose (data_hid); | 358 H5Dclose (data_hid); |
359 return false; | 359 return false; |