comparison liboctave/dbleCHOL.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 57632dea2446
children 72c96de7a403
comparison
equal deleted inserted replaced
11585:1473d0cf86d2 11586:12df7854fa7c
53 53
54 F77_RET_T 54 F77_RET_T
55 F77_FUNC (dpocon, DPOCON) (F77_CONST_CHAR_ARG_DECL, 55 F77_FUNC (dpocon, DPOCON) (F77_CONST_CHAR_ARG_DECL,
56 const octave_idx_type&, double*, 56 const octave_idx_type&, double*,
57 const octave_idx_type&, const double&, 57 const octave_idx_type&, const double&,
58 double&, double*, octave_idx_type*, 58 double&, double*, octave_idx_type*,
59 octave_idx_type& 59 octave_idx_type&
60 F77_CHAR_ARG_LEN_DECL); 60 F77_CHAR_ARG_LEN_DECL);
61 #ifdef HAVE_QRUPDATE 61 #ifdef HAVE_QRUPDATE
62 62
63 F77_RET_T 63 F77_RET_T
111 } 111 }
112 double *h = chol_mat.fortran_vec (); 112 double *h = chol_mat.fortran_vec ();
113 113
114 // Calculate the norm of the matrix, for later use. 114 // Calculate the norm of the matrix, for later use.
115 double anorm = 0; 115 double anorm = 0;
116 if (calc_cond) 116 if (calc_cond)
117 anorm = xnorm (a, 1); 117 anorm = xnorm (a, 1);
118 118
119 F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1), 119 F77_XFCN (dpotrf, DPOTRF, (F77_CONST_CHAR_ARG2 ("U", 1),
120 n, h, n, info 120 n, h, n, info
121 F77_CHAR_ARG_LEN (1))); 121 F77_CHAR_ARG_LEN (1)));
122 122
123 xrcond = 0.0; 123 xrcond = 0.0;
124 if (info > 0) 124 if (info > 0)
125 chol_mat.resize (info - 1, info - 1); 125 chol_mat.resize (info - 1, info - 1);
126 else if (calc_cond) 126 else if (calc_cond)
127 { 127 {
128 octave_idx_type dpocon_info = 0; 128 octave_idx_type dpocon_info = 0;
129 129
130 // Now calculate the condition number for non-singular matrix. 130 // Now calculate the condition number for non-singular matrix.
131 Array<double> z (dim_vector (3*n, 1)); 131 Array<double> z (dim_vector (3*n, 1));
134 octave_idx_type *piz = iz.fortran_vec (); 134 octave_idx_type *piz = iz.fortran_vec ();
135 F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, h, 135 F77_XFCN (dpocon, DPOCON, (F77_CONST_CHAR_ARG2 ("U", 1), n, h,
136 n, anorm, xrcond, pz, piz, dpocon_info 136 n, anorm, xrcond, pz, piz, dpocon_info
137 F77_CHAR_ARG_LEN (1))); 137 F77_CHAR_ARG_LEN (1)));
138 138
139 if (dpocon_info != 0) 139 if (dpocon_info != 0)
140 info = -1; 140 info = -1;
141 } 141 }
142 142
143 return info; 143 return info;
144 } 144 }
190 } 190 }
191 191
192 void 192 void
193 CHOL::set (const Matrix& R) 193 CHOL::set (const Matrix& R)
194 { 194 {
195 if (R.is_square ()) 195 if (R.is_square ())
196 chol_mat = R; 196 chol_mat = R;
197 else 197 else
198 (*current_liboctave_error_handler) ("CHOL requires square matrix"); 198 (*current_liboctave_error_handler) ("CHOL requires square matrix");
199 } 199 }
200 200
244 CHOL::insert_sym (const ColumnVector& u, octave_idx_type j) 244 CHOL::insert_sym (const ColumnVector& u, octave_idx_type j)
245 { 245 {
246 octave_idx_type info = -1; 246 octave_idx_type info = -1;
247 247
248 octave_idx_type n = chol_mat.rows (); 248 octave_idx_type n = chol_mat.rows ();
249 249
250 if (u.length () != n + 1) 250 if (u.length () != n + 1)
251 (*current_liboctave_error_handler) ("cholinsert: dimension mismatch"); 251 (*current_liboctave_error_handler) ("cholinsert: dimension mismatch");
252 else if (j < 0 || j > n) 252 else if (j < 0 || j > n)
253 (*current_liboctave_error_handler) ("cholinsert: index out of range"); 253 (*current_liboctave_error_handler) ("cholinsert: index out of range");
254 else 254 else
268 268
269 void 269 void
270 CHOL::delete_sym (octave_idx_type j) 270 CHOL::delete_sym (octave_idx_type j)
271 { 271 {
272 octave_idx_type n = chol_mat.rows (); 272 octave_idx_type n = chol_mat.rows ();
273 273
274 if (j < 0 || j > n-1) 274 if (j < 0 || j > n-1)
275 (*current_liboctave_error_handler) ("choldelete: index out of range"); 275 (*current_liboctave_error_handler) ("choldelete: index out of range");
276 else 276 else
277 { 277 {
278 OCTAVE_LOCAL_BUFFER (double, w, n); 278 OCTAVE_LOCAL_BUFFER (double, w, n);
279 279
280 F77_XFCN (dchdex, DCHDEX, (n, chol_mat.fortran_vec (), chol_mat.rows (), 280 F77_XFCN (dchdex, DCHDEX, (n, chol_mat.fortran_vec (), chol_mat.rows (),
281 j + 1, w)); 281 j + 1, w));
282 282
283 chol_mat.resize (n-1, n-1); 283 chol_mat.resize (n-1, n-1);
284 } 284 }
285 } 285 }
286 286
287 void 287 void
288 CHOL::shift_sym (octave_idx_type i, octave_idx_type j) 288 CHOL::shift_sym (octave_idx_type i, octave_idx_type j)
289 { 289 {
290 octave_idx_type n = chol_mat.rows (); 290 octave_idx_type n = chol_mat.rows ();
291 291
292 if (i < 0 || i > n-1 || j < 0 || j > n-1) 292 if (i < 0 || i > n-1 || j < 0 || j > n-1)
293 (*current_liboctave_error_handler) ("cholshift: index out of range"); 293 (*current_liboctave_error_handler) ("cholshift: index out of range");
294 else 294 else
295 { 295 {
296 OCTAVE_LOCAL_BUFFER (double, w, 2*n); 296 OCTAVE_LOCAL_BUFFER (double, w, 2*n);
297 297
309 309
310 octave_idx_type n = chol_mat.rows (); 310 octave_idx_type n = chol_mat.rows ();
311 311
312 if (u.length () == n) 312 if (u.length () == n)
313 { 313 {
314 init (chol_mat.transpose () * chol_mat 314 init (chol_mat.transpose () * chol_mat
315 + Matrix (u) * Matrix (u).transpose (), false); 315 + Matrix (u) * Matrix (u).transpose (), false);
316 } 316 }
317 else 317 else
318 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch"); 318 (*current_liboctave_error_handler) ("cholupdate: dimension mismatch");
319 } 319 }
339 { 339 {
340 if (singular (chol_mat)) 340 if (singular (chol_mat))
341 info = 2; 341 info = 2;
342 else 342 else
343 { 343 {
344 info = init (chol_mat.transpose () * chol_mat 344 info = init (chol_mat.transpose () * chol_mat
345 - Matrix (u) * Matrix (u).transpose (), false); 345 - Matrix (u) * Matrix (u).transpose (), false);
346 if (info) info = 1; 346 if (info) info = 1;
347 } 347 }
348 } 348 }
349 else 349 else
414 { 414 {
415 warn_qrupdate_once (); 415 warn_qrupdate_once ();
416 416
417 octave_idx_type n = chol_mat.rows (); 417 octave_idx_type n = chol_mat.rows ();
418 418
419 if (i < 0 || i > n-1 || j < 0 || j > n-1) 419 if (i < 0 || i > n-1 || j < 0 || j > n-1)
420 (*current_liboctave_error_handler) ("cholshift: index out of range"); 420 (*current_liboctave_error_handler) ("cholshift: index out of range");
421 else 421 else
422 { 422 {
423 Matrix a = chol_mat.transpose () * chol_mat; 423 Matrix a = chol_mat.transpose () * chol_mat;
424 Array<octave_idx_type> p (dim_vector (n, 1)); 424 Array<octave_idx_type> p (dim_vector (n, 1));