comparison liboctave/MatrixType.cc @ 15018:3d8ace26c5b4

maint: Use Octave coding conventions for cuddled parentheses in liboctave/. * Array-util.cc, Array.cc, Array.h, CMatrix.cc, CNDArray.cc, CSparse.cc, CmplxQR.cc, CollocWt.cc, DASPK.cc, DASRT.cc, DASSL.cc, EIG.cc, LSODE.cc, MSparse.cc, MatrixType.cc, Sparse-op-defs.h, Sparse-perm-op-defs.h, Sparse.cc, Sparse.h, SparseCmplxCHOL.cc, SparseCmplxLU.cc, SparseCmplxQR.cc, SparseQR.cc, SparsedbleCHOL.cc, SparsedbleLU.cc, boolSparse.cc, cmd-hist.cc, dDiagMatrix.cc, dMatrix.cc, dNDArray.cc, dSparse.cc, data-conv.cc, dbleQR.cc, dbleSVD.cc, dim-vector.cc, eigs-base.cc, f2c-main.c, fCMatrix.cc, fCNDArray.cc, fCmplxQR.cc, fEIG.cc, fMatrix.cc, fNDArray.cc, floatQR.cc, floatSVD.cc, idx-vector.cc, kpse.cc, lo-specfun.cc, mx-inlines.cc, mx-op-defs.h, oct-alloc.cc, oct-binmap.h, oct-fftw.cc, oct-group.h, oct-inttypes.cc, oct-inttypes.h, oct-locbuf.cc, oct-md5.cc, oct-rand.cc, oct-sort.cc, oct-syscalls.cc, randgamma.c, randmtzig.c, randpoisson.c, sparse-base-chol.cc, sparse-base-lu.cc, sparse-dmsolve.cc, str-vec.cc, str-vec.h, tempnam.c, tempname.c: Use Octave coding conventions for cuddled parentheses in liboctave/.
author Rik <rik@octave.org>
date Thu, 26 Jul 2012 08:13:22 -0700
parents 460a3c6d8bf1
children 560317fd5977
comparison
equal deleted inserted replaced
15017:dd4ad69e4ab9 15018:3d8ace26c5b4
49 upper_band (a.upper_band), lower_band (a.lower_band), 49 upper_band (a.upper_band), lower_band (a.lower_band),
50 dense (a.dense), full (a.full), nperm (a.nperm), perm (0) 50 dense (a.dense), full (a.full), nperm (a.nperm), perm (0)
51 { 51 {
52 if (nperm != 0) 52 if (nperm != 0)
53 { 53 {
54 perm = new octave_idx_type [nperm]; 54 perm = new octave_idx_type[nperm];
55 for (octave_idx_type i = 0; i < nperm; i++) 55 for (octave_idx_type i = 0; i < nperm; i++)
56 perm[i] = a.perm[i]; 56 perm[i] = a.perm[i];
57 } 57 }
58 } 58 }
59 59
229 matrix_type tmp_typ = MatrixType::Diagonal; 229 matrix_type tmp_typ = MatrixType::Diagonal;
230 octave_idx_type i; 230 octave_idx_type i;
231 // Maybe the matrix is diagonal 231 // Maybe the matrix is diagonal
232 for (i = 0; i < nm; i++) 232 for (i = 0; i < nm; i++)
233 { 233 {
234 if (a.cidx(i+1) != a.cidx(i) + 1) 234 if (a.cidx (i+1) != a.cidx (i) + 1)
235 { 235 {
236 tmp_typ = MatrixType::Full; 236 tmp_typ = MatrixType::Full;
237 break; 237 break;
238 } 238 }
239 if (a.ridx(i) != i) 239 if (a.ridx (i) != i)
240 { 240 {
241 tmp_typ = MatrixType::Permuted_Diagonal; 241 tmp_typ = MatrixType::Permuted_Diagonal;
242 break; 242 break;
243 } 243 }
244 } 244 }
246 if (tmp_typ == MatrixType::Permuted_Diagonal) 246 if (tmp_typ == MatrixType::Permuted_Diagonal)
247 { 247 {
248 std::vector<bool> found (nrows); 248 std::vector<bool> found (nrows);
249 249
250 for (octave_idx_type j = 0; j < i; j++) 250 for (octave_idx_type j = 0; j < i; j++)
251 found [j] = true; 251 found[j] = true;
252 for (octave_idx_type j = i; j < nrows; j++) 252 for (octave_idx_type j = i; j < nrows; j++)
253 found [j] = false; 253 found[j] = false;
254 254
255 for (octave_idx_type j = i; j < nm; j++) 255 for (octave_idx_type j = i; j < nm; j++)
256 { 256 {
257 if ((a.cidx(j+1) > a.cidx(j) + 1) || 257 if ((a.cidx (j+1) > a.cidx (j) + 1) ||
258 ((a.cidx(j+1) == a.cidx(j) + 1) && found [a.ridx(j)])) 258 ((a.cidx (j+1) == a.cidx (j) + 1) && found [a.ridx (j)]))
259 { 259 {
260 tmp_typ = MatrixType::Full; 260 tmp_typ = MatrixType::Full;
261 break; 261 break;
262 } 262 }
263 found [a.ridx(j)] = true; 263 found [a.ridx (j)] = true;
264 } 264 }
265 } 265 }
266 typ = tmp_typ; 266 typ = tmp_typ;
267 } 267 }
268 268
276 { 276 {
277 bool zero_on_diagonal = false; 277 bool zero_on_diagonal = false;
278 if (j < nrows) 278 if (j < nrows)
279 { 279 {
280 zero_on_diagonal = true; 280 zero_on_diagonal = true;
281 for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) 281 for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
282 if (a.ridx(i) == j) 282 if (a.ridx (i) == j)
283 { 283 {
284 zero_on_diagonal = false; 284 zero_on_diagonal = false;
285 break; 285 break;
286 } 286 }
287 } 287 }
290 { 290 {
291 singular = true; 291 singular = true;
292 break; 292 break;
293 } 293 }
294 294
295 if (a.cidx(j+1) != a.cidx(j)) 295 if (a.cidx (j+1) != a.cidx (j))
296 { 296 {
297 octave_idx_type ru = a.ridx(a.cidx(j)); 297 octave_idx_type ru = a.ridx (a.cidx (j));
298 octave_idx_type rl = a.ridx(a.cidx(j+1)-1); 298 octave_idx_type rl = a.ridx (a.cidx (j+1)-1);
299 299
300 if (j - ru > upper_band) 300 if (j - ru > upper_band)
301 upper_band = j - ru; 301 upper_band = j - ru;
302 302
303 if (rl - j > lower_band) 303 if (rl - j > lower_band)
346 // FIXME 346 // FIXME
347 // Perhaps this should be based on a dmperm algorithm 347 // Perhaps this should be based on a dmperm algorithm
348 bool found = false; 348 bool found = false;
349 349
350 nperm = ncols; 350 nperm = ncols;
351 perm = new octave_idx_type [ncols]; 351 perm = new octave_idx_type[ncols];
352 352
353 for (octave_idx_type i = 0; i < ncols; i++) 353 for (octave_idx_type i = 0; i < ncols; i++)
354 perm [i] = -1; 354 perm[i] = -1;
355 355
356 for (octave_idx_type i = 0; i < nm; i++) 356 for (octave_idx_type i = 0; i < nm; i++)
357 { 357 {
358 found = false; 358 found = false;
359 359
360 for (octave_idx_type j = 0; j < ncols; j++) 360 for (octave_idx_type j = 0; j < ncols; j++)
361 { 361 {
362 if ((a.cidx(j+1) - a.cidx(j)) > 0 && 362 if ((a.cidx (j+1) - a.cidx (j)) > 0 &&
363 (a.ridx(a.cidx(j+1)-1) == i)) 363 (a.ridx (a.cidx (j+1)-1) == i))
364 { 364 {
365 perm [i] = j; 365 perm[i] = j;
366 found = true; 366 found = true;
367 break; 367 break;
368 } 368 }
369 } 369 }
370 370
377 typ = MatrixType::Permuted_Upper; 377 typ = MatrixType::Permuted_Upper;
378 if (ncols > nrows) 378 if (ncols > nrows)
379 { 379 {
380 octave_idx_type k = nrows; 380 octave_idx_type k = nrows;
381 for (octave_idx_type i = 0; i < ncols; i++) 381 for (octave_idx_type i = 0; i < ncols; i++)
382 if (perm [i] == -1) 382 if (perm[i] == -1)
383 perm[i] = k++; 383 perm[i] = k++;
384 } 384 }
385 } 385 }
386 else if (a.cidx(nm) == a.cidx(ncols)) 386 else if (a.cidx (nm) == a.cidx (ncols))
387 { 387 {
388 nperm = nrows; 388 nperm = nrows;
389 delete [] perm; 389 delete [] perm;
390 perm = new octave_idx_type [nrows]; 390 perm = new octave_idx_type[nrows];
391 OCTAVE_LOCAL_BUFFER (octave_idx_type, tmp, nrows); 391 OCTAVE_LOCAL_BUFFER (octave_idx_type, tmp, nrows);
392 392
393 for (octave_idx_type i = 0; i < nrows; i++) 393 for (octave_idx_type i = 0; i < nrows; i++)
394 { 394 {
395 perm [i] = -1; 395 perm[i] = -1;
396 tmp [i] = -1; 396 tmp[i] = -1;
397 } 397 }
398 398
399 for (octave_idx_type j = 0; j < ncols; j++) 399 for (octave_idx_type j = 0; j < ncols; j++)
400 for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) 400 for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
401 perm [a.ridx(i)] = j; 401 perm [a.ridx (i)] = j;
402 402
403 found = true; 403 found = true;
404 for (octave_idx_type i = 0; i < nm; i++) 404 for (octave_idx_type i = 0; i < nm; i++)
405 if (perm[i] == -1) 405 if (perm[i] == -1)
406 { 406 {
476 ColumnVector diag (ncols); 476 ColumnVector diag (ncols);
477 477
478 for (octave_idx_type j = 0; is_herm && j < ncols; j++) 478 for (octave_idx_type j = 0; is_herm && j < ncols; j++)
479 { 479 {
480 is_herm = false; 480 is_herm = false;
481 for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) 481 for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
482 { 482 {
483 if (a.ridx(i) == j) 483 if (a.ridx (i) == j)
484 { 484 {
485 double d = a.data(i); 485 double d = a.data (i);
486 is_herm = d > 0.; 486 is_herm = d > 0.;
487 diag(j) = d; 487 diag(j) = d;
488 break; 488 break;
489 } 489 }
490 } 490 }
492 492
493 493
494 // next, check symmetry and 2x2 positiveness 494 // next, check symmetry and 2x2 positiveness
495 495
496 for (octave_idx_type j = 0; is_herm && j < ncols; j++) 496 for (octave_idx_type j = 0; is_herm && j < ncols; j++)
497 for (octave_idx_type i = a.cidx(j); is_herm && i < a.cidx(j+1); i++) 497 for (octave_idx_type i = a.cidx (j); is_herm && i < a.cidx (j+1); i++)
498 { 498 {
499 octave_idx_type k = a.ridx(i); 499 octave_idx_type k = a.ridx (i);
500 is_herm = k == j; 500 is_herm = k == j;
501 if (is_herm) 501 if (is_herm)
502 continue; 502 continue;
503 double d = a.data(i); 503 double d = a.data (i);
504 if (d*d < diag(j)*diag(k)) 504 if (d*d < diag(j)*diag(k))
505 { 505 {
506 for (octave_idx_type l = a.cidx(k); l < a.cidx(k+1); l++) 506 for (octave_idx_type l = a.cidx (k); l < a.cidx (k+1); l++)
507 { 507 {
508 if (a.ridx(l) == j) 508 if (a.ridx (l) == j)
509 { 509 {
510 is_herm = a.data(l) == d; 510 is_herm = a.data (l) == d;
511 break; 511 break;
512 } 512 }
513 } 513 }
514 } 514 }
515 } 515 }
550 matrix_type tmp_typ = MatrixType::Diagonal; 550 matrix_type tmp_typ = MatrixType::Diagonal;
551 octave_idx_type i; 551 octave_idx_type i;
552 // Maybe the matrix is diagonal 552 // Maybe the matrix is diagonal
553 for (i = 0; i < nm; i++) 553 for (i = 0; i < nm; i++)
554 { 554 {
555 if (a.cidx(i+1) != a.cidx(i) + 1) 555 if (a.cidx (i+1) != a.cidx (i) + 1)
556 { 556 {
557 tmp_typ = MatrixType::Full; 557 tmp_typ = MatrixType::Full;
558 break; 558 break;
559 } 559 }
560 if (a.ridx(i) != i) 560 if (a.ridx (i) != i)
561 { 561 {
562 tmp_typ = MatrixType::Permuted_Diagonal; 562 tmp_typ = MatrixType::Permuted_Diagonal;
563 break; 563 break;
564 } 564 }
565 } 565 }
567 if (tmp_typ == MatrixType::Permuted_Diagonal) 567 if (tmp_typ == MatrixType::Permuted_Diagonal)
568 { 568 {
569 std::vector<bool> found (nrows); 569 std::vector<bool> found (nrows);
570 570
571 for (octave_idx_type j = 0; j < i; j++) 571 for (octave_idx_type j = 0; j < i; j++)
572 found [j] = true; 572 found[j] = true;
573 for (octave_idx_type j = i; j < nrows; j++) 573 for (octave_idx_type j = i; j < nrows; j++)
574 found [j] = false; 574 found[j] = false;
575 575
576 for (octave_idx_type j = i; j < nm; j++) 576 for (octave_idx_type j = i; j < nm; j++)
577 { 577 {
578 if ((a.cidx(j+1) > a.cidx(j) + 1) || 578 if ((a.cidx (j+1) > a.cidx (j) + 1) ||
579 ((a.cidx(j+1) == a.cidx(j) + 1) && found [a.ridx(j)])) 579 ((a.cidx (j+1) == a.cidx (j) + 1) && found [a.ridx (j)]))
580 { 580 {
581 tmp_typ = MatrixType::Full; 581 tmp_typ = MatrixType::Full;
582 break; 582 break;
583 } 583 }
584 found [a.ridx(j)] = true; 584 found [a.ridx (j)] = true;
585 } 585 }
586 } 586 }
587 typ = tmp_typ; 587 typ = tmp_typ;
588 } 588 }
589 589
597 { 597 {
598 bool zero_on_diagonal = false; 598 bool zero_on_diagonal = false;
599 if (j < nrows) 599 if (j < nrows)
600 { 600 {
601 zero_on_diagonal = true; 601 zero_on_diagonal = true;
602 for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) 602 for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
603 if (a.ridx(i) == j) 603 if (a.ridx (i) == j)
604 { 604 {
605 zero_on_diagonal = false; 605 zero_on_diagonal = false;
606 break; 606 break;
607 } 607 }
608 } 608 }
611 { 611 {
612 singular = true; 612 singular = true;
613 break; 613 break;
614 } 614 }
615 615
616 if (a.cidx(j+1) != a.cidx(j)) 616 if (a.cidx (j+1) != a.cidx (j))
617 { 617 {
618 octave_idx_type ru = a.ridx(a.cidx(j)); 618 octave_idx_type ru = a.ridx (a.cidx (j));
619 octave_idx_type rl = a.ridx(a.cidx(j+1)-1); 619 octave_idx_type rl = a.ridx (a.cidx (j+1)-1);
620 620
621 if (j - ru > upper_band) 621 if (j - ru > upper_band)
622 upper_band = j - ru; 622 upper_band = j - ru;
623 623
624 if (rl - j > lower_band) 624 if (rl - j > lower_band)
667 // FIXME 667 // FIXME
668 // Perhaps this should be based on a dmperm algorithm 668 // Perhaps this should be based on a dmperm algorithm
669 bool found = false; 669 bool found = false;
670 670
671 nperm = ncols; 671 nperm = ncols;
672 perm = new octave_idx_type [ncols]; 672 perm = new octave_idx_type[ncols];
673 673
674 for (octave_idx_type i = 0; i < ncols; i++) 674 for (octave_idx_type i = 0; i < ncols; i++)
675 perm [i] = -1; 675 perm[i] = -1;
676 676
677 for (octave_idx_type i = 0; i < nm; i++) 677 for (octave_idx_type i = 0; i < nm; i++)
678 { 678 {
679 found = false; 679 found = false;
680 680
681 for (octave_idx_type j = 0; j < ncols; j++) 681 for (octave_idx_type j = 0; j < ncols; j++)
682 { 682 {
683 if ((a.cidx(j+1) - a.cidx(j)) > 0 && 683 if ((a.cidx (j+1) - a.cidx (j)) > 0 &&
684 (a.ridx(a.cidx(j+1)-1) == i)) 684 (a.ridx (a.cidx (j+1)-1) == i))
685 { 685 {
686 perm [i] = j; 686 perm[i] = j;
687 found = true; 687 found = true;
688 break; 688 break;
689 } 689 }
690 } 690 }
691 691
698 typ = MatrixType::Permuted_Upper; 698 typ = MatrixType::Permuted_Upper;
699 if (ncols > nrows) 699 if (ncols > nrows)
700 { 700 {
701 octave_idx_type k = nrows; 701 octave_idx_type k = nrows;
702 for (octave_idx_type i = 0; i < ncols; i++) 702 for (octave_idx_type i = 0; i < ncols; i++)
703 if (perm [i] == -1) 703 if (perm[i] == -1)
704 perm[i] = k++; 704 perm[i] = k++;
705 } 705 }
706 } 706 }
707 else if (a.cidx(nm) == a.cidx(ncols)) 707 else if (a.cidx (nm) == a.cidx (ncols))
708 { 708 {
709 nperm = nrows; 709 nperm = nrows;
710 delete [] perm; 710 delete [] perm;
711 perm = new octave_idx_type [nrows]; 711 perm = new octave_idx_type[nrows];
712 OCTAVE_LOCAL_BUFFER (octave_idx_type, tmp, nrows); 712 OCTAVE_LOCAL_BUFFER (octave_idx_type, tmp, nrows);
713 713
714 for (octave_idx_type i = 0; i < nrows; i++) 714 for (octave_idx_type i = 0; i < nrows; i++)
715 { 715 {
716 perm [i] = -1; 716 perm[i] = -1;
717 tmp [i] = -1; 717 tmp[i] = -1;
718 } 718 }
719 719
720 for (octave_idx_type j = 0; j < ncols; j++) 720 for (octave_idx_type j = 0; j < ncols; j++)
721 for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) 721 for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
722 perm [a.ridx(i)] = j; 722 perm [a.ridx (i)] = j;
723 723
724 found = true; 724 found = true;
725 for (octave_idx_type i = 0; i < nm; i++) 725 for (octave_idx_type i = 0; i < nm; i++)
726 if (perm[i] == -1) 726 if (perm[i] == -1)
727 { 727 {
797 ColumnVector diag (ncols); 797 ColumnVector diag (ncols);
798 798
799 for (octave_idx_type j = 0; is_herm && j < ncols; j++) 799 for (octave_idx_type j = 0; is_herm && j < ncols; j++)
800 { 800 {
801 is_herm = false; 801 is_herm = false;
802 for (octave_idx_type i = a.cidx(j); i < a.cidx(j+1); i++) 802 for (octave_idx_type i = a.cidx (j); i < a.cidx (j+1); i++)
803 { 803 {
804 if (a.ridx(i) == j) 804 if (a.ridx (i) == j)
805 { 805 {
806 Complex d = a.data(i); 806 Complex d = a.data (i);
807 is_herm = d.real () > 0. && d.imag () == 0.; 807 is_herm = d.real () > 0. && d.imag () == 0.;
808 diag(j) = d.real (); 808 diag(j) = d.real ();
809 break; 809 break;
810 } 810 }
811 } 811 }
812 } 812 }
813 813
814 // next, check symmetry and 2x2 positiveness 814 // next, check symmetry and 2x2 positiveness
815 815
816 for (octave_idx_type j = 0; is_herm && j < ncols; j++) 816 for (octave_idx_type j = 0; is_herm && j < ncols; j++)
817 for (octave_idx_type i = a.cidx(j); is_herm && i < a.cidx(j+1); i++) 817 for (octave_idx_type i = a.cidx (j); is_herm && i < a.cidx (j+1); i++)
818 { 818 {
819 octave_idx_type k = a.ridx(i); 819 octave_idx_type k = a.ridx (i);
820 is_herm = k == j; 820 is_herm = k == j;
821 if (is_herm) 821 if (is_herm)
822 continue; 822 continue;
823 Complex d = a.data(i); 823 Complex d = a.data (i);
824 if (std::norm (d) < diag(j)*diag(k)) 824 if (std::norm (d) < diag(j)*diag(k))
825 { 825 {
826 d = std::conj (d); 826 d = std::conj (d);
827 for (octave_idx_type l = a.cidx(k); l < a.cidx(k+1); l++) 827 for (octave_idx_type l = a.cidx (k); l < a.cidx (k+1); l++)
828 { 828 {
829 if (a.ridx(l) == j) 829 if (a.ridx (l) == j)
830 { 830 {
831 is_herm = a.data(l) == d; 831 is_herm = a.data (l) == d;
832 break; 832 break;
833 } 833 }
834 } 834 }
835 } 835 }
836 } 836 }
874 if ((t == MatrixType::Permuted_Upper || t == MatrixType::Permuted_Lower) && 874 if ((t == MatrixType::Permuted_Upper || t == MatrixType::Permuted_Lower) &&
875 np > 0 && p != 0) 875 np > 0 && p != 0)
876 { 876 {
877 typ = t; 877 typ = t;
878 nperm = np; 878 nperm = np;
879 perm = new octave_idx_type [nperm]; 879 perm = new octave_idx_type[nperm];
880 for (octave_idx_type i = 0; i < nperm; i++) 880 for (octave_idx_type i = 0; i < nperm; i++)
881 perm[i] = p[i]; 881 perm[i] = p[i];
882 } 882 }
883 else 883 else
884 (*current_liboctave_warning_handler) ("Invalid matrix type"); 884 (*current_liboctave_warning_handler) ("Invalid matrix type");
987 full = tmp_typ.full; 987 full = tmp_typ.full;
988 nperm = tmp_typ.nperm; 988 nperm = tmp_typ.nperm;
989 989
990 if (nperm != 0) 990 if (nperm != 0)
991 { 991 {
992 perm = new octave_idx_type [nperm]; 992 perm = new octave_idx_type[nperm];
993 for (octave_idx_type i = 0; i < nperm; i++) 993 for (octave_idx_type i = 0; i < nperm; i++)
994 perm[i] = tmp_typ.perm[i]; 994 perm[i] = tmp_typ.perm[i];
995 } 995 }
996 996
997 return typ; 997 return typ;
1020 full = tmp_typ.full; 1020 full = tmp_typ.full;
1021 nperm = tmp_typ.nperm; 1021 nperm = tmp_typ.nperm;
1022 1022
1023 if (nperm != 0) 1023 if (nperm != 0)
1024 { 1024 {
1025 perm = new octave_idx_type [nperm]; 1025 perm = new octave_idx_type[nperm];
1026 for (octave_idx_type i = 0; i < nperm; i++) 1026 for (octave_idx_type i = 0; i < nperm; i++)
1027 perm[i] = tmp_typ.perm[i]; 1027 perm[i] = tmp_typ.perm[i];
1028 } 1028 }
1029 1029
1030 return typ; 1030 return typ;
1047 full = tmp_typ.full; 1047 full = tmp_typ.full;
1048 nperm = tmp_typ.nperm; 1048 nperm = tmp_typ.nperm;
1049 1049
1050 if (nperm != 0) 1050 if (nperm != 0)
1051 { 1051 {
1052 perm = new octave_idx_type [nperm]; 1052 perm = new octave_idx_type[nperm];
1053 for (octave_idx_type i = 0; i < nperm; i++) 1053 for (octave_idx_type i = 0; i < nperm; i++)
1054 perm[i] = tmp_typ.perm[i]; 1054 perm[i] = tmp_typ.perm[i];
1055 } 1055 }
1056 1056
1057 return typ; 1057 return typ;
1074 full = tmp_typ.full; 1074 full = tmp_typ.full;
1075 nperm = tmp_typ.nperm; 1075 nperm = tmp_typ.nperm;
1076 1076
1077 if (nperm != 0) 1077 if (nperm != 0)
1078 { 1078 {
1079 perm = new octave_idx_type [nperm]; 1079 perm = new octave_idx_type[nperm];
1080 for (octave_idx_type i = 0; i < nperm; i++) 1080 for (octave_idx_type i = 0; i < nperm; i++)
1081 perm[i] = tmp_typ.perm[i]; 1081 perm[i] = tmp_typ.perm[i];
1082 } 1082 }
1083 1083
1084 return typ; 1084 return typ;
1101 full = tmp_typ.full; 1101 full = tmp_typ.full;
1102 nperm = tmp_typ.nperm; 1102 nperm = tmp_typ.nperm;
1103 1103
1104 if (nperm != 0) 1104 if (nperm != 0)
1105 { 1105 {
1106 perm = new octave_idx_type [nperm]; 1106 perm = new octave_idx_type[nperm];
1107 for (octave_idx_type i = 0; i < nperm; i++) 1107 for (octave_idx_type i = 0; i < nperm; i++)
1108 perm[i] = tmp_typ.perm[i]; 1108 perm[i] = tmp_typ.perm[i];
1109 } 1109 }
1110 1110
1111 return typ; 1111 return typ;
1128 full = tmp_typ.full; 1128 full = tmp_typ.full;
1129 nperm = tmp_typ.nperm; 1129 nperm = tmp_typ.nperm;
1130 1130
1131 if (nperm != 0) 1131 if (nperm != 0)
1132 { 1132 {
1133 perm = new octave_idx_type [nperm]; 1133 perm = new octave_idx_type[nperm];
1134 for (octave_idx_type i = 0; i < nperm; i++) 1134 for (octave_idx_type i = 0; i < nperm; i++)
1135 perm[i] = tmp_typ.perm[i]; 1135 perm[i] = tmp_typ.perm[i];
1136 } 1136 }
1137 1137
1138 return typ; 1138 return typ;
1223 1223
1224 void 1224 void
1225 MatrixType::mark_as_permuted (const octave_idx_type np, const octave_idx_type *p) 1225 MatrixType::mark_as_permuted (const octave_idx_type np, const octave_idx_type *p)
1226 { 1226 {
1227 nperm = np; 1227 nperm = np;
1228 perm = new octave_idx_type [nperm]; 1228 perm = new octave_idx_type[nperm];
1229 for (octave_idx_type i = 0; i < nperm; i++) 1229 for (octave_idx_type i = 0; i < nperm; i++)
1230 perm[i] = p[i]; 1230 perm[i] = p[i];
1231 1231
1232 if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal) 1232 if (typ == MatrixType::Diagonal || typ == MatrixType::Permuted_Diagonal)
1233 typ = MatrixType::Permuted_Diagonal; 1233 typ = MatrixType::Permuted_Diagonal;