Mercurial > hg > octave-lojdl
comparison src/ov-cx-diag.cc @ 10315:57a59eae83cc
untabify src C++ source files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 11 Feb 2010 12:41:46 -0500 |
parents | f80c566bc751 |
children | 0eb323b71957 |
comparison
equal
deleted
inserted
replaced
10314:07ebe522dac2 | 10315:57a59eae83cc |
---|---|
100 { | 100 { |
101 DiagMatrix retval; | 101 DiagMatrix retval; |
102 | 102 |
103 if (! force_conversion) | 103 if (! force_conversion) |
104 gripe_implicit_conversion ("Octave:imag-to-real", | 104 gripe_implicit_conversion ("Octave:imag-to-real", |
105 type_name (), "real matrix"); | 105 type_name (), "real matrix"); |
106 | 106 |
107 retval = ::real (matrix); | 107 retval = ::real (matrix); |
108 | 108 |
109 return retval; | 109 return retval; |
110 } | 110 } |
114 { | 114 { |
115 DiagMatrix retval; | 115 DiagMatrix retval; |
116 | 116 |
117 if (! force_conversion) | 117 if (! force_conversion) |
118 gripe_implicit_conversion ("Octave:imag-to-real", | 118 gripe_implicit_conversion ("Octave:imag-to-real", |
119 type_name (), "real matrix"); | 119 type_name (), "real matrix"); |
120 | 120 |
121 retval = ::real (matrix); | 121 retval = ::real (matrix); |
122 | 122 |
123 return retval; | 123 return retval; |
124 } | 124 } |
171 ComplexMatrix m = ComplexMatrix (matrix.diag ()); | 171 ComplexMatrix m = ComplexMatrix (matrix.diag ()); |
172 save_type st = LS_DOUBLE; | 172 save_type st = LS_DOUBLE; |
173 if (save_as_floats) | 173 if (save_as_floats) |
174 { | 174 { |
175 if (m.too_large_for_float ()) | 175 if (m.too_large_for_float ()) |
176 { | 176 { |
177 warning ("save: some values too large to save as floats --"); | 177 warning ("save: some values too large to save as floats --"); |
178 warning ("save: saving as doubles instead"); | 178 warning ("save: saving as doubles instead"); |
179 } | 179 } |
180 else | 180 else |
181 st = LS_FLOAT; | 181 st = LS_FLOAT; |
182 } | 182 } |
183 else if (matrix.length () > 4096) // FIXME -- make this configurable. | 183 else if (matrix.length () > 4096) // FIXME -- make this configurable. |
184 { | 184 { |
185 double max_val, min_val; | 185 double max_val, min_val; |
186 if (m.all_integers (max_val, min_val)) | 186 if (m.all_integers (max_val, min_val)) |
187 st = get_save_type (max_val, min_val); | 187 st = get_save_type (max_val, min_val); |
188 } | 188 } |
189 | 189 |
190 const Complex *mtmp = m.data (); | 190 const Complex *mtmp = m.data (); |
191 write_doubles (os, reinterpret_cast<const double *> (mtmp), st, 2 * m.numel ()); | 191 write_doubles (os, reinterpret_cast<const double *> (mtmp), st, 2 * m.numel ()); |
192 | 192 |
193 return true; | 193 return true; |
194 } | 194 } |
195 | 195 |
196 bool | 196 bool |
197 octave_complex_diag_matrix::load_binary (std::istream& is, bool swap, | 197 octave_complex_diag_matrix::load_binary (std::istream& is, bool swap, |
198 oct_mach_info::float_format fmt) | 198 oct_mach_info::float_format fmt) |
199 { | 199 { |
200 int32_t r, c; | 200 int32_t r, c; |
201 char tmp; | 201 char tmp; |
202 if (! (is.read (reinterpret_cast<char *> (&r), 4) | 202 if (! (is.read (reinterpret_cast<char *> (&r), 4) |
203 && is.read (reinterpret_cast<char *> (&c), 4) | 203 && is.read (reinterpret_cast<char *> (&c), 4) |