Mercurial > octave-nkf
comparison liboctave/fDiagMatrix.cc @ 10314:07ebe522dac2
untabify liboctave C++ sources
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 11 Feb 2010 12:23:32 -0500 |
parents | 4c0cdbe0acca |
children | a0728e81ed25 |
comparison
equal
deleted
inserted
replaced
10313:f3b65e1ae355 | 10314:07ebe522dac2 |
---|---|
153 { | 153 { |
154 FloatDiagMatrix retval; | 154 FloatDiagMatrix retval; |
155 octave_idx_type a_len = a.length (); | 155 octave_idx_type a_len = a.length (); |
156 if (a_len > 0) | 156 if (a_len > 0) |
157 retval = FloatDiagMatrix (mx_inline_real_dup (a.data (), a_len), a.rows (), | 157 retval = FloatDiagMatrix (mx_inline_real_dup (a.data (), a_len), a.rows (), |
158 a.cols ()); | 158 a.cols ()); |
159 return retval; | 159 return retval; |
160 } | 160 } |
161 | 161 |
162 FloatDiagMatrix | 162 FloatDiagMatrix |
163 imag (const FloatComplexDiagMatrix& a) | 163 imag (const FloatComplexDiagMatrix& a) |
164 { | 164 { |
165 FloatDiagMatrix retval; | 165 FloatDiagMatrix retval; |
166 octave_idx_type a_len = a.length (); | 166 octave_idx_type a_len = a.length (); |
167 if (a_len > 0) | 167 if (a_len > 0) |
168 retval = FloatDiagMatrix (mx_inline_imag_dup (a.data (), a_len), a.rows (), | 168 retval = FloatDiagMatrix (mx_inline_imag_dup (a.data (), a_len), a.rows (), |
169 a.cols ()); | 169 a.cols ()); |
170 return retval; | 170 return retval; |
171 } | 171 } |
172 | 172 |
173 FloatMatrix | 173 FloatMatrix |
174 FloatDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const | 174 FloatDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const |
291 | 291 |
292 info = 0; | 292 info = 0; |
293 for (octave_idx_type i = 0; i < len; i++) | 293 for (octave_idx_type i = 0; i < len; i++) |
294 { | 294 { |
295 if (elem (i, i) == 0.0) | 295 if (elem (i, i) == 0.0) |
296 { | 296 { |
297 info = -1; | 297 info = -1; |
298 return *this; | 298 return *this; |
299 } | 299 } |
300 else | 300 else |
301 retval.elem (i, i) = 1.0 / elem (i, i); | 301 retval.elem (i, i) = 1.0 / elem (i, i); |
302 } | 302 } |
303 | 303 |
304 return retval; | 304 return retval; |
305 } | 305 } |
306 | 306 |
387 // int field_width = os.precision () + 7; | 387 // int field_width = os.precision () + 7; |
388 | 388 |
389 for (octave_idx_type i = 0; i < a.rows (); i++) | 389 for (octave_idx_type i = 0; i < a.rows (); i++) |
390 { | 390 { |
391 for (octave_idx_type j = 0; j < a.cols (); j++) | 391 for (octave_idx_type j = 0; j < a.cols (); j++) |
392 { | 392 { |
393 if (i == j) | 393 if (i == j) |
394 os << " " /* setw (field_width) */ << a.elem (i, i); | 394 os << " " /* setw (field_width) */ << a.elem (i, i); |
395 else | 395 else |
396 os << " " /* setw (field_width) */ << 0.0; | 396 os << " " /* setw (field_width) */ << 0.0; |
397 } | 397 } |
398 os << "\n"; | 398 os << "\n"; |
399 } | 399 } |
400 return os; | 400 return os; |
401 } | 401 } |