comparison liboctave/numeric/CmplxQR.cc @ 21136:7cac4e7458f2

maint: clean up code around calls to current_liboctave_error_handler. Remove statements after call to handler that are no longer reachable. Place input validation first and immediately call handler if necessary. Change if/error_handler/else to if/error_handler and re-indent code. * Array-util.cc, Array.cc, CColVector.cc, CDiagMatrix.cc, CMatrix.cc, CNDArray.cc, CRowVector.cc, CSparse.cc, DiagArray2.cc, MArray.cc, PermMatrix.cc, Sparse.cc, Sparse.h, chMatrix.cc, chNDArray.cc, dColVector.cc, dDiagMatrix.cc, dMatrix.cc, dNDArray.cc, dRowVector.cc, dSparse.cc, fCColVector.cc, fCDiagMatrix.cc, fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fColVector.cc, fDiagMatrix.cc, fMatrix.cc, fNDArray.cc, fRowVector.cc, idx-vector.cc, CmplxAEPBAL.cc, CmplxCHOL.cc, CmplxGEPBAL.cc, CmplxHESS.cc, CmplxLU.cc, CmplxQR.cc, CmplxSCHUR.cc, CmplxSVD.cc, DASPK.cc, EIG.cc, LSODE.cc, Quad.cc, SparseCmplxCHOL.cc, SparseCmplxLU.cc, SparseCmplxQR.cc, SparseQR.cc, SparsedbleCHOL.cc, SparsedbleLU.cc, base-lu.cc, bsxfun-defs.cc, dbleAEPBAL.cc, dbleCHOL.cc, dbleGEPBAL.cc, dbleHESS.cc, dbleLU.cc, dbleQR.cc, dbleSCHUR.cc, dbleSVD.cc, eigs-base.cc, fCmplxAEPBAL.cc, fCmplxCHOL.cc, fCmplxLU.cc, fCmplxQR.cc, fCmplxSCHUR.cc, fEIG.cc, floatAEPBAL.cc, floatCHOL.cc, floatGEPBAL.cc, floatHESS.cc, floatLU.cc, floatQR.cc, floatSCHUR.cc, floatSVD.cc, lo-specfun.cc, oct-fftw.cc, oct-rand.cc, oct-spparms.cc, sparse-base-chol.cc, sparse-dmsolve.cc, file-ops.cc, lo-sysdep.cc, mach-info.cc, oct-env.cc, oct-syscalls.cc, cmd-edit.cc, cmd-hist.cc, data-conv.cc, lo-ieee.cc, lo-regexp.cc, oct-base64.cc, oct-shlib.cc, pathsearch.cc, singleton-cleanup.cc, sparse-util.cc, unwind-prot.cc: Remove statements after call to handler that are no longer reachable. Place input validation first and immediately call handler if necessary. Change if/error_handler/else to if/error_handler and re-indent code.
author Rik <rik@octave.org>
date Sat, 23 Jan 2016 13:52:03 -0800
parents a9574e3c6e9e
children f7121e111991
comparison
equal deleted inserted replaced
21135:95da3bc8a281 21136:7cac4e7458f2
210 { 210 {
211 octave_idx_type m = q.rows (); 211 octave_idx_type m = q.rows ();
212 octave_idx_type n = r.columns (); 212 octave_idx_type n = r.columns ();
213 octave_idx_type k = q.columns (); 213 octave_idx_type k = q.columns ();
214 214
215 if (u.numel () == m && v.numel () == n) 215 if (u.numel () != m || v.numel () != n)
216 { 216 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
217 ComplexColumnVector utmp = u; 217
218 ComplexColumnVector vtmp = v; 218 ComplexColumnVector utmp = u;
219 OCTAVE_LOCAL_BUFFER (Complex, w, k); 219 ComplexColumnVector vtmp = v;
220 OCTAVE_LOCAL_BUFFER (double, rw, k); 220 OCTAVE_LOCAL_BUFFER (Complex, w, k);
221 OCTAVE_LOCAL_BUFFER (double, rw, k);
222 F77_XFCN (zqr1up, ZQR1UP, (m, n, k, q.fortran_vec (),
223 m, r.fortran_vec (), k,
224 utmp.fortran_vec (), vtmp.fortran_vec (),
225 w, rw));
226 }
227
228 void
229 ComplexQR::update (const ComplexMatrix& u, const ComplexMatrix& v)
230 {
231 octave_idx_type m = q.rows ();
232 octave_idx_type n = r.columns ();
233 octave_idx_type k = q.columns ();
234
235 if (u.rows () != m || v.rows () != n || u.cols () != v.cols ())
236 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
237
238 OCTAVE_LOCAL_BUFFER (Complex, w, k);
239 OCTAVE_LOCAL_BUFFER (double, rw, k);
240 for (volatile octave_idx_type i = 0; i < u.cols (); i++)
241 {
242 ComplexColumnVector utmp = u.column (i);
243 ComplexColumnVector vtmp = v.column (i);
221 F77_XFCN (zqr1up, ZQR1UP, (m, n, k, q.fortran_vec (), 244 F77_XFCN (zqr1up, ZQR1UP, (m, n, k, q.fortran_vec (),
222 m, r.fortran_vec (), k, 245 m, r.fortran_vec (), k,
223 utmp.fortran_vec (), vtmp.fortran_vec (), 246 utmp.fortran_vec (), vtmp.fortran_vec (),
224 w, rw)); 247 w, rw));
225 } 248 }
226 else
227 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
228 }
229
230 void
231 ComplexQR::update (const ComplexMatrix& u, const ComplexMatrix& v)
232 {
233 octave_idx_type m = q.rows ();
234 octave_idx_type n = r.columns ();
235 octave_idx_type k = q.columns ();
236
237 if (u.rows () == m && v.rows () == n && u.cols () == v.cols ())
238 {
239 OCTAVE_LOCAL_BUFFER (Complex, w, k);
240 OCTAVE_LOCAL_BUFFER (double, rw, k);
241 for (volatile octave_idx_type i = 0; i < u.cols (); i++)
242 {
243 ComplexColumnVector utmp = u.column (i);
244 ComplexColumnVector vtmp = v.column (i);
245 F77_XFCN (zqr1up, ZQR1UP, (m, n, k, q.fortran_vec (),
246 m, r.fortran_vec (), k,
247 utmp.fortran_vec (), vtmp.fortran_vec (),
248 w, rw));
249 }
250 }
251 else
252 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
253 } 249 }
254 250
255 void 251 void
256 ComplexQR::insert_col (const ComplexColumnVector& u, octave_idx_type j) 252 ComplexQR::insert_col (const ComplexColumnVector& u, octave_idx_type j)
257 { 253 {
259 octave_idx_type n = r.columns (); 255 octave_idx_type n = r.columns ();
260 octave_idx_type k = q.columns (); 256 octave_idx_type k = q.columns ();
261 257
262 if (u.numel () != m) 258 if (u.numel () != m)
263 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 259 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
264 else if (j < 0 || j > n) 260 if (j < 0 || j > n)
265 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 261 (*current_liboctave_error_handler) ("qrinsert: index out of range");
262
263 if (k < m)
264 {
265 q.resize (m, k+1);
266 r.resize (k+1, n+1);
267 }
266 else 268 else
267 { 269 {
268 if (k < m) 270 r.resize (k, n+1);
269 { 271 }
270 q.resize (m, k+1); 272
271 r.resize (k+1, n+1); 273 ComplexColumnVector utmp = u;
272 } 274 OCTAVE_LOCAL_BUFFER (double, rw, k);
273 else 275 F77_XFCN (zqrinc, ZQRINC, (m, n, k, q.fortran_vec (), q.rows (),
274 { 276 r.fortran_vec (), r.rows (), j + 1,
275 r.resize (k, n+1); 277 utmp.data (), rw));
276 }
277
278 ComplexColumnVector utmp = u;
279 OCTAVE_LOCAL_BUFFER (double, rw, k);
280 F77_XFCN (zqrinc, ZQRINC, (m, n, k, q.fortran_vec (), q.rows (),
281 r.fortran_vec (), r.rows (), j + 1,
282 utmp.data (), rw));
283 }
284 } 278 }
285 279
286 void 280 void
287 ComplexQR::insert_col (const ComplexMatrix& u, const Array<octave_idx_type>& j) 281 ComplexQR::insert_col (const ComplexMatrix& u, const Array<octave_idx_type>& j)
288 { 282 {
297 for (octave_idx_type i = 0; i < nj - 1; i++) 291 for (octave_idx_type i = 0; i < nj - 1; i++)
298 dups = dups && js(i) == js(i+1); 292 dups = dups && js(i) == js(i+1);
299 293
300 if (dups) 294 if (dups)
301 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); 295 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
302 else if (u.numel () != m || u.columns () != nj) 296 if (u.numel () != m || u.columns () != nj)
303 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 297 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
304 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) 298 if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
305 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 299 (*current_liboctave_error_handler) ("qrinsert: index out of range");
306 else if (nj > 0) 300
301 if (nj > 0)
307 { 302 {
308 octave_idx_type kmax = std::min (k + nj, m); 303 octave_idx_type kmax = std::min (k + nj, m);
309 if (k < m) 304 if (k < m)
310 { 305 {
311 q.resize (m, kmax); 306 q.resize (m, kmax);
336 octave_idx_type k = r.rows (); 331 octave_idx_type k = r.rows ();
337 octave_idx_type n = r.columns (); 332 octave_idx_type n = r.columns ();
338 333
339 if (j < 0 || j > n-1) 334 if (j < 0 || j > n-1)
340 (*current_liboctave_error_handler) ("qrdelete: index out of range"); 335 (*current_liboctave_error_handler) ("qrdelete: index out of range");
336
337 OCTAVE_LOCAL_BUFFER (double, rw, k);
338 F77_XFCN (zqrdec, ZQRDEC, (m, n, k, q.fortran_vec (), q.rows (),
339 r.fortran_vec (), r.rows (), j + 1, rw));
340
341 if (k < m)
342 {
343 q.resize (m, k-1);
344 r.resize (k-1, n-1);
345 }
341 else 346 else
342 { 347 {
343 OCTAVE_LOCAL_BUFFER (double, rw, k); 348 r.resize (k, n-1);
344 F77_XFCN (zqrdec, ZQRDEC, (m, n, k, q.fortran_vec (), q.rows (),
345 r.fortran_vec (), r.rows (), j + 1, rw));
346
347 if (k < m)
348 {
349 q.resize (m, k-1);
350 r.resize (k-1, n-1);
351 }
352 else
353 {
354 r.resize (k, n-1);
355 }
356 } 349 }
357 } 350 }
358 351
359 void 352 void
360 ComplexQR::delete_col (const Array<octave_idx_type>& j) 353 ComplexQR::delete_col (const Array<octave_idx_type>& j)
370 for (octave_idx_type i = 0; i < nj - 1; i++) 363 for (octave_idx_type i = 0; i < nj - 1; i++)
371 dups = dups && js(i) == js(i+1); 364 dups = dups && js(i) == js(i+1);
372 365
373 if (dups) 366 if (dups)
374 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); 367 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
375 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) 368 if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0))
376 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 369 (*current_liboctave_error_handler) ("qrinsert: index out of range");
377 else if (nj > 0) 370
371 if (nj > 0)
378 { 372 {
379 OCTAVE_LOCAL_BUFFER (double, rw, k); 373 OCTAVE_LOCAL_BUFFER (double, rw, k);
380 for (volatile octave_idx_type i = 0; i < js.numel (); i++) 374 for (volatile octave_idx_type i = 0; i < js.numel (); i++)
381 { 375 {
382 octave_idx_type ii = i; 376 octave_idx_type ii = i;
405 octave_idx_type n = r.columns (); 399 octave_idx_type n = r.columns ();
406 octave_idx_type k = std::min (m, n); 400 octave_idx_type k = std::min (m, n);
407 401
408 if (! q.is_square () || u.numel () != n) 402 if (! q.is_square () || u.numel () != n)
409 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 403 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
410 else if (j < 0 || j > m) 404 if (j < 0 || j > m)
411 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 405 (*current_liboctave_error_handler) ("qrinsert: index out of range");
412 else 406
413 { 407 q.resize (m + 1, m + 1);
414 q.resize (m + 1, m + 1); 408 r.resize (m + 1, n);
415 r.resize (m + 1, n); 409 ComplexRowVector utmp = u;
416 ComplexRowVector utmp = u; 410 OCTAVE_LOCAL_BUFFER (double, rw, k);
417 OCTAVE_LOCAL_BUFFER (double, rw, k); 411 F77_XFCN (zqrinr, ZQRINR, (m, n, q.fortran_vec (), q.rows (),
418 F77_XFCN (zqrinr, ZQRINR, (m, n, q.fortran_vec (), q.rows (), 412 r.fortran_vec (), r.rows (),
419 r.fortran_vec (), r.rows (), 413 j + 1, utmp.fortran_vec (), rw));
420 j + 1, utmp.fortran_vec (), rw)); 414
421
422 }
423 } 415 }
424 416
425 void 417 void
426 ComplexQR::delete_row (octave_idx_type j) 418 ComplexQR::delete_row (octave_idx_type j)
427 { 419 {
428 octave_idx_type m = r.rows (); 420 octave_idx_type m = r.rows ();
429 octave_idx_type n = r.columns (); 421 octave_idx_type n = r.columns ();
430 422
431 if (! q.is_square ()) 423 if (! q.is_square ())
432 (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); 424 (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch");
433 else if (j < 0 || j > m-1) 425 if (j < 0 || j > m-1)
434 (*current_liboctave_error_handler) ("qrdelete: index out of range"); 426 (*current_liboctave_error_handler) ("qrdelete: index out of range");
435 else 427
436 { 428 OCTAVE_LOCAL_BUFFER (Complex, w, m);
437 OCTAVE_LOCAL_BUFFER (Complex, w, m); 429 OCTAVE_LOCAL_BUFFER (double, rw, m);
438 OCTAVE_LOCAL_BUFFER (double, rw, m); 430 F77_XFCN (zqrder, ZQRDER, (m, n, q.fortran_vec (), q.rows (),
439 F77_XFCN (zqrder, ZQRDER, (m, n, q.fortran_vec (), q.rows (), 431 r.fortran_vec (), r.rows (), j + 1,
440 r.fortran_vec (), r.rows (), j + 1, 432 w, rw));
441 w, rw)); 433
442 434 q.resize (m - 1, m - 1);
443 q.resize (m - 1, m - 1); 435 r.resize (m - 1, n);
444 r.resize (m - 1, n);
445 }
446 } 436 }
447 437
448 void 438 void
449 ComplexQR::shift_cols (octave_idx_type i, octave_idx_type j) 439 ComplexQR::shift_cols (octave_idx_type i, octave_idx_type j)
450 { 440 {
452 octave_idx_type k = r.rows (); 442 octave_idx_type k = r.rows ();
453 octave_idx_type n = r.columns (); 443 octave_idx_type n = r.columns ();
454 444
455 if (i < 0 || i > n-1 || j < 0 || j > n-1) 445 if (i < 0 || i > n-1 || j < 0 || j > n-1)
456 (*current_liboctave_error_handler) ("qrshift: index out of range"); 446 (*current_liboctave_error_handler) ("qrshift: index out of range");
457 else 447
458 { 448 OCTAVE_LOCAL_BUFFER (Complex, w, k);
459 OCTAVE_LOCAL_BUFFER (Complex, w, k); 449 OCTAVE_LOCAL_BUFFER (double, rw, k);
460 OCTAVE_LOCAL_BUFFER (double, rw, k); 450 F77_XFCN (zqrshc, ZQRSHC, (m, n, k,
461 F77_XFCN (zqrshc, ZQRSHC, (m, n, k, 451 q.fortran_vec (), q.rows (),
462 q.fortran_vec (), q.rows (), 452 r.fortran_vec (), r.rows (),
463 r.fortran_vec (), r.rows (), 453 i + 1, j + 1, w, rw));
464 i + 1, j + 1, w, rw));
465 }
466 } 454 }
467 455
468 #else 456 #else
469 457
470 // Replacement update methods. 458 // Replacement update methods.
475 warn_qrupdate_once (); 463 warn_qrupdate_once ();
476 464
477 octave_idx_type m = q.rows (); 465 octave_idx_type m = q.rows ();
478 octave_idx_type n = r.columns (); 466 octave_idx_type n = r.columns ();
479 467
480 if (u.numel () == m && v.numel () == n) 468 if (u.numel () != m || v.numel () != n)
481 {
482 init (q*r + ComplexMatrix (u) * ComplexMatrix (v).hermitian (),
483 get_type ());
484 }
485 else
486 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); 469 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
470
471 init (q*r + ComplexMatrix (u) * ComplexMatrix (v).hermitian (),
472 get_type ());
487 } 473 }
488 474
489 void 475 void
490 ComplexQR::update (const ComplexMatrix& u, const ComplexMatrix& v) 476 ComplexQR::update (const ComplexMatrix& u, const ComplexMatrix& v)
491 { 477 {
492 warn_qrupdate_once (); 478 warn_qrupdate_once ();
493 479
494 octave_idx_type m = q.rows (); 480 octave_idx_type m = q.rows ();
495 octave_idx_type n = r.columns (); 481 octave_idx_type n = r.columns ();
496 482
497 if (u.rows () == m && v.rows () == n && u.cols () == v.cols ()) 483 if (u.rows () != m || v.rows () != n || u.cols () != v.cols ())
498 {
499 init (q*r + u * v.hermitian (), get_type ());
500 }
501 else
502 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch"); 484 (*current_liboctave_error_handler) ("qrupdate: dimensions mismatch");
485
486 init (q*r + u * v.hermitian (), get_type ());
503 } 487 }
504 488
505 static 489 static
506 ComplexMatrix insert_col (const ComplexMatrix& a, octave_idx_type i, 490 ComplexMatrix insert_col (const ComplexMatrix& a, octave_idx_type i,
507 const ComplexColumnVector& x) 491 const ComplexColumnVector& x)
573 octave_idx_type m = q.rows (); 557 octave_idx_type m = q.rows ();
574 octave_idx_type n = r.columns (); 558 octave_idx_type n = r.columns ();
575 559
576 if (u.numel () != m) 560 if (u.numel () != m)
577 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 561 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
578 else if (j < 0 || j > n) 562 if (j < 0 || j > n)
579 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 563 (*current_liboctave_error_handler) ("qrinsert: index out of range");
580 else 564
581 { 565 init (::insert_col (q*r, j, u), get_type ());
582 init (::insert_col (q*r, j, u), get_type ());
583 }
584 } 566 }
585 567
586 void 568 void
587 ComplexQR::insert_col (const ComplexMatrix& u, const Array<octave_idx_type>& j) 569 ComplexQR::insert_col (const ComplexMatrix& u, const Array<octave_idx_type>& j)
588 { 570 {
598 for (octave_idx_type i = 0; i < nj - 1; i++) 580 for (octave_idx_type i = 0; i < nj - 1; i++)
599 dups = dups && js(i) == js(i+1); 581 dups = dups && js(i) == js(i+1);
600 582
601 if (dups) 583 if (dups)
602 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); 584 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
603 else if (u.numel () != m || u.columns () != nj) 585 if (u.numel () != m || u.columns () != nj)
604 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 586 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
605 else if (nj > 0 && (js(0) < 0 || js(nj-1) > n)) 587 if (nj > 0 && (js(0) < 0 || js(nj-1) > n))
606 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 588 (*current_liboctave_error_handler) ("qrinsert: index out of range");
607 else if (nj > 0) 589
590 if (nj > 0)
608 { 591 {
609 ComplexMatrix a = q*r; 592 ComplexMatrix a = q*r;
610 for (octave_idx_type i = 0; i < js.numel (); i++) 593 for (octave_idx_type i = 0; i < js.numel (); i++)
611 a = ::insert_col (a, js(i), u.column (i)); 594 a = ::insert_col (a, js(i), u.column (i));
612 init (a, get_type ()); 595 init (a, get_type ());
620 603
621 octave_idx_type n = r.columns (); 604 octave_idx_type n = r.columns ();
622 605
623 if (j < 0 || j > n-1) 606 if (j < 0 || j > n-1)
624 (*current_liboctave_error_handler) ("qrdelete: index out of range"); 607 (*current_liboctave_error_handler) ("qrdelete: index out of range");
625 else 608
626 { 609 init (::delete_col (q*r, j), get_type ());
627 init (::delete_col (q*r, j), get_type ());
628 }
629 } 610 }
630 611
631 void 612 void
632 ComplexQR::delete_col (const Array<octave_idx_type>& j) 613 ComplexQR::delete_col (const Array<octave_idx_type>& j)
633 { 614 {
642 for (octave_idx_type i = 0; i < nj - 1; i++) 623 for (octave_idx_type i = 0; i < nj - 1; i++)
643 dups = dups && js(i) == js(i+1); 624 dups = dups && js(i) == js(i+1);
644 625
645 if (dups) 626 if (dups)
646 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected"); 627 (*current_liboctave_error_handler) ("qrinsert: duplicate index detected");
647 else if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0)) 628 if (nj > 0 && (js(0) > n-1 || js(nj-1) < 0))
648 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 629 (*current_liboctave_error_handler) ("qrinsert: index out of range");
649 else if (nj > 0) 630
631 if (nj > 0)
650 { 632 {
651 ComplexMatrix a = q*r; 633 ComplexMatrix a = q*r;
652 for (octave_idx_type i = 0; i < js.numel (); i++) 634 for (octave_idx_type i = 0; i < js.numel (); i++)
653 a = ::delete_col (a, js(i)); 635 a = ::delete_col (a, js(i));
654 init (a, get_type ()); 636 init (a, get_type ());
663 octave_idx_type m = r.rows (); 645 octave_idx_type m = r.rows ();
664 octave_idx_type n = r.columns (); 646 octave_idx_type n = r.columns ();
665 647
666 if (! q.is_square () || u.numel () != n) 648 if (! q.is_square () || u.numel () != n)
667 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch"); 649 (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
668 else if (j < 0 || j > m) 650 if (j < 0 || j > m)
669 (*current_liboctave_error_handler) ("qrinsert: index out of range"); 651 (*current_liboctave_error_handler) ("qrinsert: index out of range");
670 else 652
671 { 653 init (::insert_row (q*r, j, u), get_type ());
672 init (::insert_row (q*r, j, u), get_type ());
673 }
674 } 654 }
675 655
676 void 656 void
677 ComplexQR::delete_row (octave_idx_type j) 657 ComplexQR::delete_row (octave_idx_type j)
678 { 658 {
680 660
681 octave_idx_type m = r.rows (); 661 octave_idx_type m = r.rows ();
682 662
683 if (! q.is_square ()) 663 if (! q.is_square ())
684 (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch"); 664 (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch");
685 else if (j < 0 || j > m-1) 665 if (j < 0 || j > m-1)
686 (*current_liboctave_error_handler) ("qrdelete: index out of range"); 666 (*current_liboctave_error_handler) ("qrdelete: index out of range");
687 else 667
688 { 668 init (::delete_row (q*r, j), get_type ());
689 init (::delete_row (q*r, j), get_type ());
690 }
691 } 669 }
692 670
693 void 671 void
694 ComplexQR::shift_cols (octave_idx_type i, octave_idx_type j) 672 ComplexQR::shift_cols (octave_idx_type i, octave_idx_type j)
695 { 673 {
697 675
698 octave_idx_type n = r.columns (); 676 octave_idx_type n = r.columns ();
699 677
700 if (i < 0 || i > n-1 || j < 0 || j > n-1) 678 if (i < 0 || i > n-1 || j < 0 || j > n-1)
701 (*current_liboctave_error_handler) ("qrshift: index out of range"); 679 (*current_liboctave_error_handler) ("qrshift: index out of range");
702 else 680
703 { 681 init (::shift_cols (q*r, i, j), get_type ());
704 init (::shift_cols (q*r, i, j), get_type ());
705 }
706 } 682 }
707 683
708 #endif 684 #endif