annotate armadillo-2.4.4/include/armadillo_bits/unwrap.hpp @ 0:8b6102e2a9b0

Armadillo Library
author maxzanoni76 <max.zanoni@eecs.qmul.ac.uk>
date Wed, 11 Apr 2012 09:27:06 +0100
parents
children
rev   line source
max@0 1 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
max@0 2 // Copyright (C) 2008-2011 Conrad Sanderson
max@0 3 //
max@0 4 // This file is part of the Armadillo C++ library.
max@0 5 // It is provided without any warranty of fitness
max@0 6 // for any purpose. You can redistribute this file
max@0 7 // and/or modify it under the terms of the GNU
max@0 8 // Lesser General Public License (LGPL) as published
max@0 9 // by the Free Software Foundation, either version 3
max@0 10 // of the License or (at your option) any later version.
max@0 11 // (see http://www.opensource.org/licenses for more info)
max@0 12
max@0 13
max@0 14 //! \addtogroup unwrap
max@0 15 //! @{
max@0 16
max@0 17
max@0 18
max@0 19 template<typename T1>
max@0 20 class unwrap
max@0 21 {
max@0 22 public:
max@0 23
max@0 24 typedef typename T1::elem_type eT;
max@0 25
max@0 26 inline unwrap(const T1& A) // TODO: change this to Base ?
max@0 27 : M(A)
max@0 28 {
max@0 29 arma_extra_debug_sigprint();
max@0 30 }
max@0 31
max@0 32 const Mat<eT> M;
max@0 33 };
max@0 34
max@0 35
max@0 36
max@0 37 template<typename eT>
max@0 38 class unwrap< Mat<eT> >
max@0 39 {
max@0 40 public:
max@0 41
max@0 42 inline unwrap(const Mat<eT>& A)
max@0 43 : M(A)
max@0 44 {
max@0 45 arma_extra_debug_sigprint();
max@0 46 }
max@0 47
max@0 48 const Mat<eT>& M;
max@0 49 };
max@0 50
max@0 51
max@0 52
max@0 53 template<typename eT>
max@0 54 class unwrap< Row<eT> >
max@0 55 {
max@0 56 public:
max@0 57
max@0 58 inline unwrap(const Row<eT>& A)
max@0 59 : M(A)
max@0 60 {
max@0 61 arma_extra_debug_sigprint();
max@0 62 }
max@0 63
max@0 64 const Row<eT>& M;
max@0 65 };
max@0 66
max@0 67
max@0 68
max@0 69 template<typename eT>
max@0 70 class unwrap< Col<eT> >
max@0 71 {
max@0 72 public:
max@0 73
max@0 74 inline unwrap(const Col<eT>& A)
max@0 75 : M(A)
max@0 76 {
max@0 77 arma_extra_debug_sigprint();
max@0 78 }
max@0 79
max@0 80 const Col<eT>& M;
max@0 81 };
max@0 82
max@0 83
max@0 84
max@0 85 template<typename out_eT, typename T1, typename T2, typename glue_type>
max@0 86 class unwrap< mtGlue<out_eT, T1, T2, glue_type> >
max@0 87 {
max@0 88 public:
max@0 89
max@0 90 inline unwrap(const mtGlue<out_eT, T1, T2, glue_type>& A)
max@0 91 : M(A)
max@0 92 {
max@0 93 arma_extra_debug_sigprint();
max@0 94 }
max@0 95
max@0 96 const Mat<out_eT> M;
max@0 97 };
max@0 98
max@0 99
max@0 100 template<typename out_eT, typename T1, typename op_type>
max@0 101 class unwrap< mtOp<out_eT, T1, op_type> >
max@0 102 {
max@0 103 public:
max@0 104
max@0 105 inline unwrap(const mtOp<out_eT, T1, op_type>& A)
max@0 106 : M(A)
max@0 107 {
max@0 108 arma_extra_debug_sigprint();
max@0 109 }
max@0 110
max@0 111 const Mat<out_eT> M;
max@0 112 };
max@0 113
max@0 114
max@0 115
max@0 116 //
max@0 117 //
max@0 118 //
max@0 119
max@0 120
max@0 121 template<typename T1>
max@0 122 class unwrap_check
max@0 123 {
max@0 124 public:
max@0 125
max@0 126 typedef typename T1::elem_type eT;
max@0 127
max@0 128 inline
max@0 129 unwrap_check(const T1& A, const Mat<eT>& B)
max@0 130 : M(A)
max@0 131 {
max@0 132 arma_extra_debug_sigprint();
max@0 133 arma_ignore(B);
max@0 134 }
max@0 135
max@0 136 inline
max@0 137 ~unwrap_check()
max@0 138 {
max@0 139 arma_extra_debug_sigprint();
max@0 140 }
max@0 141
max@0 142 const Mat<eT> M;
max@0 143 };
max@0 144
max@0 145
max@0 146
max@0 147 template<typename eT>
max@0 148 class unwrap_check< Mat<eT> >
max@0 149 {
max@0 150 public:
max@0 151
max@0 152 inline
max@0 153 unwrap_check(const Mat<eT>& A, const Mat<eT>& B)
max@0 154 : M_local( (&A == &B) ? new Mat<eT>(A) : 0 )
max@0 155 , M ( (&A == &B) ? (*M_local) : A )
max@0 156 {
max@0 157 arma_extra_debug_sigprint();
max@0 158 }
max@0 159
max@0 160
max@0 161 inline
max@0 162 ~unwrap_check()
max@0 163 {
max@0 164 arma_extra_debug_sigprint();
max@0 165
max@0 166 if(M_local)
max@0 167 {
max@0 168 delete M_local;
max@0 169 }
max@0 170 }
max@0 171
max@0 172
max@0 173 // the order below is important
max@0 174 const Mat<eT>* M_local;
max@0 175 const Mat<eT>& M;
max@0 176 };
max@0 177
max@0 178
max@0 179
max@0 180 template<typename eT>
max@0 181 class unwrap_check< Row<eT> >
max@0 182 {
max@0 183 public:
max@0 184
max@0 185 inline
max@0 186 unwrap_check(const Row<eT>& A, const Mat<eT>& B)
max@0 187 : M_local( (&A == reinterpret_cast<const Row<eT>*>(&B)) ? new Row<eT>(A) : 0 )
max@0 188 , M ( (&A == reinterpret_cast<const Row<eT>*>(&B)) ? (*M_local) : A )
max@0 189 {
max@0 190 arma_extra_debug_sigprint();
max@0 191 }
max@0 192
max@0 193
max@0 194 inline
max@0 195 ~unwrap_check()
max@0 196 {
max@0 197 arma_extra_debug_sigprint();
max@0 198
max@0 199 if(M_local)
max@0 200 {
max@0 201 delete M_local;
max@0 202 }
max@0 203 }
max@0 204
max@0 205
max@0 206 // the order below is important
max@0 207 const Row<eT>* M_local;
max@0 208 const Row<eT>& M;
max@0 209 };
max@0 210
max@0 211
max@0 212
max@0 213 template<typename eT>
max@0 214 class unwrap_check< Col<eT> >
max@0 215 {
max@0 216 public:
max@0 217
max@0 218 inline
max@0 219 unwrap_check(const Col<eT>& A, const Mat<eT>& B)
max@0 220 : M_local( (&A == reinterpret_cast<const Col<eT>*>(&B)) ? new Col<eT>(A) : 0 )
max@0 221 , M ( (&A == reinterpret_cast<const Col<eT>*>(&B)) ? (*M_local) : A )
max@0 222 {
max@0 223 arma_extra_debug_sigprint();
max@0 224 }
max@0 225
max@0 226
max@0 227 inline
max@0 228 ~unwrap_check()
max@0 229 {
max@0 230 arma_extra_debug_sigprint();
max@0 231
max@0 232 if(M_local)
max@0 233 {
max@0 234 delete M_local;
max@0 235 }
max@0 236 }
max@0 237
max@0 238
max@0 239 // the order below is important
max@0 240 const Col<eT>* M_local;
max@0 241 const Col<eT>& M;
max@0 242
max@0 243 };
max@0 244
max@0 245
max@0 246
max@0 247 //
max@0 248 //
max@0 249 //
max@0 250
max@0 251
max@0 252
max@0 253 template<typename T1>
max@0 254 class unwrap_check_mixed
max@0 255 {
max@0 256 public:
max@0 257
max@0 258 typedef typename T1::elem_type eT1;
max@0 259
max@0 260 template<typename eT2>
max@0 261 inline
max@0 262 unwrap_check_mixed(const T1& A, const Mat<eT2>& B)
max@0 263 : M(A)
max@0 264 {
max@0 265 arma_extra_debug_sigprint();
max@0 266 arma_ignore(B);
max@0 267 }
max@0 268
max@0 269 inline
max@0 270 ~unwrap_check_mixed()
max@0 271 {
max@0 272 arma_extra_debug_sigprint();
max@0 273 }
max@0 274
max@0 275 const Mat<eT1> M;
max@0 276 };
max@0 277
max@0 278
max@0 279
max@0 280 template<typename eT1>
max@0 281 class unwrap_check_mixed< Mat<eT1> >
max@0 282 {
max@0 283 public:
max@0 284
max@0 285 template<typename eT2>
max@0 286 inline
max@0 287 unwrap_check_mixed(const Mat<eT1>& A, const Mat<eT2>& B)
max@0 288 : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Mat<eT1>(A) : 0 )
max@0 289 , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A )
max@0 290 {
max@0 291 arma_extra_debug_sigprint();
max@0 292 }
max@0 293
max@0 294
max@0 295 inline
max@0 296 ~unwrap_check_mixed()
max@0 297 {
max@0 298 arma_extra_debug_sigprint();
max@0 299
max@0 300 if(M_local)
max@0 301 {
max@0 302 delete M_local;
max@0 303 }
max@0 304 }
max@0 305
max@0 306
max@0 307 // the order below is important
max@0 308 const Mat<eT1>* M_local;
max@0 309 const Mat<eT1>& M;
max@0 310 };
max@0 311
max@0 312
max@0 313
max@0 314 template<typename eT1>
max@0 315 class unwrap_check_mixed< Row<eT1> >
max@0 316 {
max@0 317 public:
max@0 318
max@0 319 template<typename eT2>
max@0 320 inline
max@0 321 unwrap_check_mixed(const Row<eT1>& A, const Mat<eT2>& B)
max@0 322 : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Row<eT1>(A) : 0 )
max@0 323 , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A )
max@0 324 {
max@0 325 arma_extra_debug_sigprint();
max@0 326 }
max@0 327
max@0 328
max@0 329 inline
max@0 330 ~unwrap_check_mixed()
max@0 331 {
max@0 332 arma_extra_debug_sigprint();
max@0 333
max@0 334 if(M_local)
max@0 335 {
max@0 336 delete M_local;
max@0 337 }
max@0 338 }
max@0 339
max@0 340
max@0 341 // the order below is important
max@0 342 const Row<eT1>* M_local;
max@0 343 const Row<eT1>& M;
max@0 344 };
max@0 345
max@0 346
max@0 347
max@0 348 template<typename eT1>
max@0 349 class unwrap_check_mixed< Col<eT1> >
max@0 350 {
max@0 351 public:
max@0 352
max@0 353 template<typename eT2>
max@0 354 inline
max@0 355 unwrap_check_mixed(const Col<eT1>& A, const Mat<eT2>& B)
max@0 356 : M_local( (void_ptr(&A) == void_ptr(&B)) ? new Col<eT1>(A) : 0 )
max@0 357 , M ( (void_ptr(&A) == void_ptr(&B)) ? (*M_local) : A )
max@0 358 {
max@0 359 arma_extra_debug_sigprint();
max@0 360 }
max@0 361
max@0 362
max@0 363 inline
max@0 364 ~unwrap_check_mixed()
max@0 365 {
max@0 366 arma_extra_debug_sigprint();
max@0 367
max@0 368 if(M_local)
max@0 369 {
max@0 370 delete M_local;
max@0 371 }
max@0 372 }
max@0 373
max@0 374
max@0 375 // the order below is important
max@0 376 const Col<eT1>* M_local;
max@0 377 const Col<eT1>& M;
max@0 378 };
max@0 379
max@0 380
max@0 381
max@0 382 //
max@0 383
max@0 384
max@0 385
max@0 386 template<typename T1>
max@0 387 class partial_unwrap
max@0 388 {
max@0 389 public:
max@0 390
max@0 391 typedef typename T1::elem_type eT;
max@0 392
max@0 393 inline partial_unwrap(const T1& A) // TODO: change this to Base ?
max@0 394 : M(A)
max@0 395 {
max@0 396 arma_extra_debug_sigprint();
max@0 397 }
max@0 398
max@0 399
max@0 400 inline
max@0 401 ~partial_unwrap()
max@0 402 {
max@0 403 arma_extra_debug_sigprint();
max@0 404 }
max@0 405
max@0 406
max@0 407 inline eT get_val() const { return eT(1); }
max@0 408
max@0 409
max@0 410 static const bool do_trans = false;
max@0 411 static const bool do_times = false;
max@0 412
max@0 413 const Mat<eT> M;
max@0 414 };
max@0 415
max@0 416
max@0 417
max@0 418 template<typename eT>
max@0 419 class partial_unwrap< Mat<eT> >
max@0 420 {
max@0 421 public:
max@0 422
max@0 423 inline
max@0 424 partial_unwrap(const Mat<eT>& A)
max@0 425 : M(A)
max@0 426 {
max@0 427 arma_extra_debug_sigprint();
max@0 428 }
max@0 429
max@0 430
max@0 431 inline
max@0 432 ~partial_unwrap()
max@0 433 {
max@0 434 arma_extra_debug_sigprint();
max@0 435 }
max@0 436
max@0 437
max@0 438 inline eT get_val() const { return eT(1); }
max@0 439
max@0 440
max@0 441 static const bool do_trans = false;
max@0 442 static const bool do_times = false;
max@0 443
max@0 444 const Mat<eT>& M;
max@0 445 };
max@0 446
max@0 447
max@0 448
max@0 449 template<typename eT>
max@0 450 class partial_unwrap< Row<eT> >
max@0 451 {
max@0 452 public:
max@0 453
max@0 454 inline
max@0 455 partial_unwrap(const Row<eT>& A)
max@0 456 : M(A)
max@0 457 {
max@0 458 arma_extra_debug_sigprint();
max@0 459 }
max@0 460
max@0 461
max@0 462 inline
max@0 463 ~partial_unwrap()
max@0 464 {
max@0 465 arma_extra_debug_sigprint();
max@0 466 }
max@0 467
max@0 468
max@0 469 inline eT get_val() const { return eT(1); }
max@0 470
max@0 471
max@0 472 static const bool do_trans = false;
max@0 473 static const bool do_times = false;
max@0 474
max@0 475 const Mat<eT>& M;
max@0 476 };
max@0 477
max@0 478
max@0 479
max@0 480 template<typename eT>
max@0 481 class partial_unwrap< Col<eT> >
max@0 482 {
max@0 483 public:
max@0 484
max@0 485 inline
max@0 486 partial_unwrap(const Col<eT>& A)
max@0 487 : M(A)
max@0 488 {
max@0 489 arma_extra_debug_sigprint();
max@0 490 }
max@0 491
max@0 492
max@0 493 inline
max@0 494 ~partial_unwrap()
max@0 495 {
max@0 496 arma_extra_debug_sigprint();
max@0 497 }
max@0 498
max@0 499
max@0 500 inline eT get_val() const { return eT(1); }
max@0 501
max@0 502
max@0 503 static const bool do_trans = false;
max@0 504 static const bool do_times = false;
max@0 505
max@0 506 const Mat<eT>& M;
max@0 507 };
max@0 508
max@0 509
max@0 510
max@0 511 template<typename T1>
max@0 512 class partial_unwrap< Op<T1, op_htrans> >
max@0 513 {
max@0 514 public:
max@0 515
max@0 516 typedef typename T1::elem_type eT;
max@0 517
max@0 518 inline
max@0 519 partial_unwrap(const Op<T1,op_htrans>& A)
max@0 520 : M(A.m)
max@0 521 {
max@0 522 arma_extra_debug_sigprint();
max@0 523 }
max@0 524
max@0 525 inline
max@0 526 ~partial_unwrap()
max@0 527 {
max@0 528 arma_extra_debug_sigprint();
max@0 529 }
max@0 530
max@0 531
max@0 532 inline eT get_val() const { return eT(1); }
max@0 533
max@0 534
max@0 535 static const bool do_trans = true;
max@0 536 static const bool do_times = false;
max@0 537
max@0 538 const Mat<eT> M;
max@0 539 };
max@0 540
max@0 541
max@0 542
max@0 543 template<typename eT>
max@0 544 class partial_unwrap< Op< Mat<eT>, op_htrans> >
max@0 545 {
max@0 546 public:
max@0 547
max@0 548 inline
max@0 549 partial_unwrap(const Op< Mat<eT>, op_htrans>& A)
max@0 550 : M(A.m)
max@0 551 {
max@0 552 arma_extra_debug_sigprint();
max@0 553 }
max@0 554
max@0 555
max@0 556 inline
max@0 557 ~partial_unwrap()
max@0 558 {
max@0 559 arma_extra_debug_sigprint();
max@0 560 }
max@0 561
max@0 562
max@0 563 inline eT get_val() const { return eT(1); }
max@0 564
max@0 565
max@0 566 static const bool do_trans = true;
max@0 567 static const bool do_times = false;
max@0 568
max@0 569 const Mat<eT>& M;
max@0 570 };
max@0 571
max@0 572
max@0 573
max@0 574 template<typename eT>
max@0 575 class partial_unwrap< Op< Row<eT>, op_htrans> >
max@0 576 {
max@0 577 public:
max@0 578
max@0 579 inline
max@0 580 partial_unwrap(const Op< Row<eT>, op_htrans>& A)
max@0 581 : M(A.m)
max@0 582 {
max@0 583 arma_extra_debug_sigprint();
max@0 584 }
max@0 585
max@0 586 inline
max@0 587 ~partial_unwrap()
max@0 588 {
max@0 589 arma_extra_debug_sigprint();
max@0 590 }
max@0 591
max@0 592
max@0 593 inline eT get_val() const { return eT(1); }
max@0 594
max@0 595
max@0 596 static const bool do_trans = true;
max@0 597 static const bool do_times = false;
max@0 598
max@0 599 const Mat<eT>& M;
max@0 600 };
max@0 601
max@0 602
max@0 603
max@0 604 template<typename eT>
max@0 605 class partial_unwrap< Op< Col<eT>, op_htrans> >
max@0 606 {
max@0 607 public:
max@0 608
max@0 609 inline
max@0 610 partial_unwrap(const Op< Col<eT>, op_htrans>& A)
max@0 611 : M(A.m)
max@0 612 {
max@0 613 arma_extra_debug_sigprint();
max@0 614 }
max@0 615
max@0 616 inline
max@0 617 ~partial_unwrap()
max@0 618 {
max@0 619 arma_extra_debug_sigprint();
max@0 620 }
max@0 621
max@0 622
max@0 623 inline eT get_val() const { return eT(1); }
max@0 624
max@0 625
max@0 626 static const bool do_trans = true;
max@0 627 static const bool do_times = false;
max@0 628
max@0 629 const Mat<eT>& M;
max@0 630 };
max@0 631
max@0 632
max@0 633
max@0 634 template<typename T1>
max@0 635 class partial_unwrap< Op<T1, op_htrans2> >
max@0 636 {
max@0 637 public:
max@0 638
max@0 639 typedef typename T1::elem_type eT;
max@0 640
max@0 641 inline
max@0 642 partial_unwrap(const Op<T1,op_htrans2>& A)
max@0 643 : val(A.aux)
max@0 644 , M (A.m)
max@0 645 {
max@0 646 arma_extra_debug_sigprint();
max@0 647 }
max@0 648
max@0 649 inline
max@0 650 ~partial_unwrap()
max@0 651 {
max@0 652 arma_extra_debug_sigprint();
max@0 653 }
max@0 654
max@0 655
max@0 656 inline eT get_val() const { return val; }
max@0 657
max@0 658
max@0 659 static const bool do_trans = true;
max@0 660 static const bool do_times = true;
max@0 661
max@0 662 const eT val;
max@0 663 const Mat<eT> M;
max@0 664 };
max@0 665
max@0 666
max@0 667
max@0 668 template<typename eT>
max@0 669 class partial_unwrap< Op< Mat<eT>, op_htrans2> >
max@0 670 {
max@0 671 public:
max@0 672
max@0 673 inline
max@0 674 partial_unwrap(const Op< Mat<eT>, op_htrans2>& A)
max@0 675 : val(A.aux)
max@0 676 , M (A.m)
max@0 677 {
max@0 678 arma_extra_debug_sigprint();
max@0 679 }
max@0 680
max@0 681 inline
max@0 682 ~partial_unwrap()
max@0 683 {
max@0 684 arma_extra_debug_sigprint();
max@0 685 }
max@0 686
max@0 687
max@0 688 inline eT get_val() const { return val; }
max@0 689
max@0 690
max@0 691 static const bool do_trans = true;
max@0 692 static const bool do_times = true;
max@0 693
max@0 694 const eT val;
max@0 695 const Mat<eT>& M;
max@0 696 };
max@0 697
max@0 698
max@0 699
max@0 700 template<typename eT>
max@0 701 class partial_unwrap< Op< Row<eT>, op_htrans2> >
max@0 702 {
max@0 703 public:
max@0 704
max@0 705 inline
max@0 706 partial_unwrap(const Op< Row<eT>, op_htrans2>& A)
max@0 707 : val(A.aux)
max@0 708 , M (A.m)
max@0 709 {
max@0 710 arma_extra_debug_sigprint();
max@0 711 }
max@0 712
max@0 713 inline
max@0 714 ~partial_unwrap()
max@0 715 {
max@0 716 arma_extra_debug_sigprint();
max@0 717 }
max@0 718
max@0 719
max@0 720 inline eT get_val() const { return val; }
max@0 721
max@0 722
max@0 723 static const bool do_trans = true;
max@0 724 static const bool do_times = true;
max@0 725
max@0 726 const eT val;
max@0 727 const Mat<eT>& M;
max@0 728 };
max@0 729
max@0 730
max@0 731
max@0 732 template<typename eT>
max@0 733 class partial_unwrap< Op< Col<eT>, op_htrans2> >
max@0 734 {
max@0 735 public:
max@0 736
max@0 737 inline
max@0 738 partial_unwrap(const Op< Col<eT>, op_htrans2>& A)
max@0 739 : val(A.aux)
max@0 740 , M (A.m)
max@0 741 {
max@0 742 arma_extra_debug_sigprint();
max@0 743 }
max@0 744
max@0 745 inline
max@0 746 ~partial_unwrap()
max@0 747 {
max@0 748 arma_extra_debug_sigprint();
max@0 749 }
max@0 750
max@0 751
max@0 752 inline eT get_val() const { return val; }
max@0 753
max@0 754
max@0 755 static const bool do_trans = true;
max@0 756 static const bool do_times = true;
max@0 757
max@0 758 const eT val;
max@0 759 const Mat<eT>& M;
max@0 760 };
max@0 761
max@0 762
max@0 763
max@0 764 template<typename T1>
max@0 765 class partial_unwrap< eOp<T1, eop_scalar_times> >
max@0 766 {
max@0 767 public:
max@0 768
max@0 769 typedef typename T1::elem_type eT;
max@0 770
max@0 771 inline
max@0 772 partial_unwrap(const eOp<T1,eop_scalar_times>& A)
max@0 773 : val(A.aux)
max@0 774 , M (A.P.Q)
max@0 775 {
max@0 776 arma_extra_debug_sigprint();
max@0 777 }
max@0 778
max@0 779 inline
max@0 780 ~partial_unwrap()
max@0 781 {
max@0 782 arma_extra_debug_sigprint();
max@0 783 }
max@0 784
max@0 785
max@0 786 inline eT get_val() const { return val; }
max@0 787
max@0 788
max@0 789 static const bool do_trans = false;
max@0 790 static const bool do_times = true;
max@0 791
max@0 792 const eT val;
max@0 793 const Mat<eT> M;
max@0 794 };
max@0 795
max@0 796
max@0 797
max@0 798 template<typename eT>
max@0 799 class partial_unwrap< eOp<Mat<eT>, eop_scalar_times> >
max@0 800 {
max@0 801 public:
max@0 802
max@0 803 inline
max@0 804 partial_unwrap(const eOp<Mat<eT>,eop_scalar_times>& A)
max@0 805 : val(A.aux)
max@0 806 , M (A.P.Q)
max@0 807 {
max@0 808 arma_extra_debug_sigprint();
max@0 809 }
max@0 810
max@0 811 inline
max@0 812 ~partial_unwrap()
max@0 813 {
max@0 814 arma_extra_debug_sigprint();
max@0 815 }
max@0 816
max@0 817
max@0 818 inline eT get_val() const { return val; }
max@0 819
max@0 820
max@0 821 static const bool do_trans = false;
max@0 822 static const bool do_times = true;
max@0 823
max@0 824 const eT val;
max@0 825 const Mat<eT>& M;
max@0 826 };
max@0 827
max@0 828
max@0 829
max@0 830 template<typename eT>
max@0 831 class partial_unwrap< eOp<Row<eT>, eop_scalar_times> >
max@0 832 {
max@0 833 public:
max@0 834
max@0 835 inline
max@0 836 partial_unwrap(const eOp<Row<eT>,eop_scalar_times>& A)
max@0 837 : val(A.aux)
max@0 838 , M (A.P.Q)
max@0 839 {
max@0 840 arma_extra_debug_sigprint();
max@0 841 }
max@0 842
max@0 843 inline
max@0 844 ~partial_unwrap()
max@0 845 {
max@0 846 arma_extra_debug_sigprint();
max@0 847 }
max@0 848
max@0 849
max@0 850 inline eT get_val() const { return val; }
max@0 851
max@0 852
max@0 853 static const bool do_trans = false;
max@0 854 static const bool do_times = true;
max@0 855
max@0 856 const eT val;
max@0 857 const Mat<eT>& M;
max@0 858 };
max@0 859
max@0 860
max@0 861
max@0 862 template<typename eT>
max@0 863 class partial_unwrap< eOp<Col<eT>, eop_scalar_times> >
max@0 864 {
max@0 865 public:
max@0 866
max@0 867 inline
max@0 868 partial_unwrap(const eOp<Col<eT>,eop_scalar_times>& A)
max@0 869 : val(A.aux)
max@0 870 , M (A.P.Q)
max@0 871 {
max@0 872 arma_extra_debug_sigprint();
max@0 873 }
max@0 874
max@0 875 inline
max@0 876 ~partial_unwrap()
max@0 877 {
max@0 878 arma_extra_debug_sigprint();
max@0 879 }
max@0 880
max@0 881
max@0 882 inline eT get_val() const { return val; }
max@0 883
max@0 884
max@0 885 static const bool do_trans = false;
max@0 886 static const bool do_times = true;
max@0 887
max@0 888 const eT val;
max@0 889 const Mat<eT>& M;
max@0 890 };
max@0 891
max@0 892
max@0 893
max@0 894 //
max@0 895
max@0 896
max@0 897
max@0 898 template<typename T1>
max@0 899 class partial_unwrap_check
max@0 900 {
max@0 901 public:
max@0 902
max@0 903 typedef typename T1::elem_type eT;
max@0 904
max@0 905 inline partial_unwrap_check(const T1& A, const Mat<eT>& B)
max@0 906 : M(A)
max@0 907 {
max@0 908 arma_extra_debug_sigprint();
max@0 909 arma_ignore(B);
max@0 910 }
max@0 911
max@0 912
max@0 913 inline
max@0 914 ~partial_unwrap_check()
max@0 915 {
max@0 916 arma_extra_debug_sigprint();
max@0 917 }
max@0 918
max@0 919
max@0 920 inline eT get_val() const { return eT(1); }
max@0 921
max@0 922
max@0 923 static const bool do_trans = false;
max@0 924 static const bool do_times = false;
max@0 925
max@0 926 const Mat<eT> M;
max@0 927 };
max@0 928
max@0 929
max@0 930
max@0 931 template<typename eT>
max@0 932 class partial_unwrap_check< Mat<eT> >
max@0 933 {
max@0 934 public:
max@0 935
max@0 936 inline
max@0 937 partial_unwrap_check(const Mat<eT>& A, const Mat<eT>& B)
max@0 938 : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 )
max@0 939 , M ( (&A == &B) ? (*M_local) : A )
max@0 940 {
max@0 941 arma_extra_debug_sigprint();
max@0 942 }
max@0 943
max@0 944
max@0 945 inline
max@0 946 ~partial_unwrap_check()
max@0 947 {
max@0 948 arma_extra_debug_sigprint();
max@0 949
max@0 950 if(M_local)
max@0 951 {
max@0 952 delete M_local;
max@0 953 }
max@0 954 }
max@0 955
max@0 956
max@0 957 inline eT get_val() const { return eT(1); }
max@0 958
max@0 959
max@0 960 static const bool do_trans = false;
max@0 961 static const bool do_times = false;
max@0 962
max@0 963 // the order below is important
max@0 964 const Mat<eT>* M_local;
max@0 965 const Mat<eT>& M;
max@0 966 };
max@0 967
max@0 968
max@0 969
max@0 970 template<typename eT>
max@0 971 class partial_unwrap_check< Row<eT> >
max@0 972 {
max@0 973 public:
max@0 974
max@0 975 inline
max@0 976 partial_unwrap_check(const Row<eT>& A, const Mat<eT>& B)
max@0 977 : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 )
max@0 978 , M ( (&A == &B) ? (*M_local) : A )
max@0 979 {
max@0 980 arma_extra_debug_sigprint();
max@0 981 }
max@0 982
max@0 983
max@0 984 inline
max@0 985 ~partial_unwrap_check()
max@0 986 {
max@0 987 arma_extra_debug_sigprint();
max@0 988
max@0 989 if(M_local)
max@0 990 {
max@0 991 delete M_local;
max@0 992 }
max@0 993 }
max@0 994
max@0 995
max@0 996 inline eT get_val() const { return eT(1); }
max@0 997
max@0 998
max@0 999 static const bool do_trans = false;
max@0 1000 static const bool do_times = false;
max@0 1001
max@0 1002 // the order below is important
max@0 1003 const Mat<eT>* M_local;
max@0 1004 const Mat<eT>& M;
max@0 1005 };
max@0 1006
max@0 1007
max@0 1008
max@0 1009 template<typename eT>
max@0 1010 class partial_unwrap_check< Col<eT> >
max@0 1011 {
max@0 1012 public:
max@0 1013
max@0 1014 inline
max@0 1015 partial_unwrap_check(const Col<eT>& A, const Mat<eT>& B)
max@0 1016 : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 )
max@0 1017 , M ( (&A == &B) ? (*M_local) : A )
max@0 1018 {
max@0 1019 arma_extra_debug_sigprint();
max@0 1020 }
max@0 1021
max@0 1022
max@0 1023 inline
max@0 1024 ~partial_unwrap_check()
max@0 1025 {
max@0 1026 arma_extra_debug_sigprint();
max@0 1027
max@0 1028 if(M_local)
max@0 1029 {
max@0 1030 delete M_local;
max@0 1031 }
max@0 1032 }
max@0 1033
max@0 1034
max@0 1035 inline eT get_val() const { return eT(1); }
max@0 1036
max@0 1037
max@0 1038 static const bool do_trans = false;
max@0 1039 static const bool do_times = false;
max@0 1040
max@0 1041 // the order below is important
max@0 1042 const Mat<eT>* M_local;
max@0 1043 const Mat<eT>& M;
max@0 1044 };
max@0 1045
max@0 1046
max@0 1047
max@0 1048 template<typename T1>
max@0 1049 class partial_unwrap_check< Op<T1, op_htrans> >
max@0 1050 {
max@0 1051 public:
max@0 1052
max@0 1053 typedef typename T1::elem_type eT;
max@0 1054
max@0 1055 inline
max@0 1056 partial_unwrap_check(const Op<T1,op_htrans>& A, const Mat<eT>& B)
max@0 1057 : M(A.m)
max@0 1058 {
max@0 1059 arma_extra_debug_sigprint();
max@0 1060 arma_ignore(B);
max@0 1061 }
max@0 1062
max@0 1063 inline
max@0 1064 ~partial_unwrap_check()
max@0 1065 {
max@0 1066 arma_extra_debug_sigprint();
max@0 1067 }
max@0 1068
max@0 1069
max@0 1070 inline eT get_val() const { return eT(1); }
max@0 1071
max@0 1072
max@0 1073 static const bool do_trans = true;
max@0 1074 static const bool do_times = false;
max@0 1075
max@0 1076 const Mat<eT> M;
max@0 1077 };
max@0 1078
max@0 1079
max@0 1080
max@0 1081 template<typename eT>
max@0 1082 class partial_unwrap_check< Op< Mat<eT>, op_htrans> >
max@0 1083 {
max@0 1084 public:
max@0 1085
max@0 1086 inline
max@0 1087 partial_unwrap_check(const Op< Mat<eT>, op_htrans>& A, const Mat<eT>& B)
max@0 1088 : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 )
max@0 1089 , M ( (&A.m == &B) ? (*M_local) : A.m )
max@0 1090 {
max@0 1091 arma_extra_debug_sigprint();
max@0 1092 }
max@0 1093
max@0 1094 inline
max@0 1095 ~partial_unwrap_check()
max@0 1096 {
max@0 1097 arma_extra_debug_sigprint();
max@0 1098
max@0 1099 if(M_local)
max@0 1100 {
max@0 1101 delete M_local;
max@0 1102 }
max@0 1103 }
max@0 1104
max@0 1105
max@0 1106 inline eT get_val() const { return eT(1); }
max@0 1107
max@0 1108
max@0 1109 static const bool do_trans = true;
max@0 1110 static const bool do_times = false;
max@0 1111
max@0 1112 // the order below is important
max@0 1113 const Mat<eT>* M_local;
max@0 1114 const Mat<eT>& M;
max@0 1115 };
max@0 1116
max@0 1117
max@0 1118
max@0 1119 template<typename eT>
max@0 1120 class partial_unwrap_check< Op< Row<eT>, op_htrans> >
max@0 1121 {
max@0 1122 public:
max@0 1123
max@0 1124 inline
max@0 1125 partial_unwrap_check(const Op< Row<eT>, op_htrans>& A, const Mat<eT>& B)
max@0 1126 : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 )
max@0 1127 , M ( (&A.m == &B) ? (*M_local) : A.m )
max@0 1128 {
max@0 1129 arma_extra_debug_sigprint();
max@0 1130 }
max@0 1131
max@0 1132 inline
max@0 1133 ~partial_unwrap_check()
max@0 1134 {
max@0 1135 arma_extra_debug_sigprint();
max@0 1136
max@0 1137 if(M_local)
max@0 1138 {
max@0 1139 delete M_local;
max@0 1140 }
max@0 1141 }
max@0 1142
max@0 1143
max@0 1144 inline eT get_val() const { return eT(1); }
max@0 1145
max@0 1146
max@0 1147 static const bool do_trans = true;
max@0 1148 static const bool do_times = false;
max@0 1149
max@0 1150 // the order below is important
max@0 1151 const Mat<eT>* M_local;
max@0 1152 const Mat<eT>& M;
max@0 1153 };
max@0 1154
max@0 1155
max@0 1156
max@0 1157 template<typename eT>
max@0 1158 class partial_unwrap_check< Op< Col<eT>, op_htrans> >
max@0 1159 {
max@0 1160 public:
max@0 1161
max@0 1162 inline
max@0 1163 partial_unwrap_check(const Op< Col<eT>, op_htrans>& A, const Mat<eT>& B)
max@0 1164 : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 )
max@0 1165 , M ( (&A.m == &B) ? (*M_local) : A.m )
max@0 1166 {
max@0 1167 arma_extra_debug_sigprint();
max@0 1168 }
max@0 1169
max@0 1170 inline
max@0 1171 ~partial_unwrap_check()
max@0 1172 {
max@0 1173 arma_extra_debug_sigprint();
max@0 1174
max@0 1175 if(M_local)
max@0 1176 {
max@0 1177 delete M_local;
max@0 1178 }
max@0 1179 }
max@0 1180
max@0 1181
max@0 1182 inline eT get_val() const { return eT(1); }
max@0 1183
max@0 1184
max@0 1185 static const bool do_trans = true;
max@0 1186 static const bool do_times = false;
max@0 1187
max@0 1188 // the order below is important
max@0 1189 const Mat<eT>* M_local;
max@0 1190 const Mat<eT>& M;
max@0 1191 };
max@0 1192
max@0 1193
max@0 1194
max@0 1195 template<typename T1>
max@0 1196 class partial_unwrap_check< Op<T1, op_htrans2> >
max@0 1197 {
max@0 1198 public:
max@0 1199
max@0 1200 typedef typename T1::elem_type eT;
max@0 1201
max@0 1202 inline
max@0 1203 partial_unwrap_check(const Op<T1,op_htrans2>& A, const Mat<eT>& B)
max@0 1204 : val(A.aux)
max@0 1205 , M (A.m)
max@0 1206 {
max@0 1207 arma_extra_debug_sigprint();
max@0 1208 }
max@0 1209
max@0 1210 inline
max@0 1211 ~partial_unwrap_check()
max@0 1212 {
max@0 1213 arma_extra_debug_sigprint();
max@0 1214 }
max@0 1215
max@0 1216
max@0 1217 inline eT get_val() const { return val; }
max@0 1218
max@0 1219
max@0 1220 static const bool do_trans = true;
max@0 1221 static const bool do_times = true;
max@0 1222
max@0 1223 const eT val;
max@0 1224 const Mat<eT> M;
max@0 1225 };
max@0 1226
max@0 1227
max@0 1228
max@0 1229 template<typename eT>
max@0 1230 class partial_unwrap_check< Op< Mat<eT>, op_htrans2> >
max@0 1231 {
max@0 1232 public:
max@0 1233
max@0 1234 inline
max@0 1235 partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B)
max@0 1236 : val (A.aux)
max@0 1237 , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 )
max@0 1238 , M ( (&A.m == &B) ? (*M_local) : A.m )
max@0 1239 {
max@0 1240 arma_extra_debug_sigprint();
max@0 1241 }
max@0 1242
max@0 1243 inline
max@0 1244 ~partial_unwrap_check()
max@0 1245 {
max@0 1246 arma_extra_debug_sigprint();
max@0 1247
max@0 1248 if(M_local)
max@0 1249 {
max@0 1250 delete M_local;
max@0 1251 }
max@0 1252 }
max@0 1253
max@0 1254
max@0 1255 inline eT get_val() const { return val; }
max@0 1256
max@0 1257
max@0 1258 static const bool do_trans = true;
max@0 1259 static const bool do_times = true;
max@0 1260
max@0 1261 // the order below is important
max@0 1262 const eT val;
max@0 1263 const Mat<eT>* M_local;
max@0 1264 const Mat<eT>& M;
max@0 1265 };
max@0 1266
max@0 1267
max@0 1268
max@0 1269 template<typename eT>
max@0 1270 class partial_unwrap_check< Op< Row<eT>, op_htrans2> >
max@0 1271 {
max@0 1272 public:
max@0 1273
max@0 1274 inline
max@0 1275 partial_unwrap_check(const Op< Row<eT>, op_htrans2>& A, const Mat<eT>& B)
max@0 1276 : val (A.aux)
max@0 1277 , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 )
max@0 1278 , M ( (&A.m == &B) ? (*M_local) : A.m )
max@0 1279 {
max@0 1280 arma_extra_debug_sigprint();
max@0 1281 }
max@0 1282
max@0 1283 inline
max@0 1284 ~partial_unwrap_check()
max@0 1285 {
max@0 1286 arma_extra_debug_sigprint();
max@0 1287
max@0 1288 if(M_local)
max@0 1289 {
max@0 1290 delete M_local;
max@0 1291 }
max@0 1292 }
max@0 1293
max@0 1294
max@0 1295 inline eT get_val() const { return val; }
max@0 1296
max@0 1297
max@0 1298 static const bool do_trans = true;
max@0 1299 static const bool do_times = true;
max@0 1300
max@0 1301 // the order below is important
max@0 1302 const eT val;
max@0 1303 const Mat<eT>* M_local;
max@0 1304 const Mat<eT>& M;
max@0 1305 };
max@0 1306
max@0 1307
max@0 1308
max@0 1309 template<typename eT>
max@0 1310 class partial_unwrap_check< Op< Col<eT>, op_htrans2> >
max@0 1311 {
max@0 1312 public:
max@0 1313
max@0 1314 inline
max@0 1315 partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B)
max@0 1316 : val (A.aux)
max@0 1317 , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 )
max@0 1318 , M ( (&A.m == &B) ? (*M_local) : A.m )
max@0 1319 {
max@0 1320 arma_extra_debug_sigprint();
max@0 1321 }
max@0 1322
max@0 1323 inline
max@0 1324 ~partial_unwrap_check()
max@0 1325 {
max@0 1326 arma_extra_debug_sigprint();
max@0 1327
max@0 1328 if(M_local)
max@0 1329 {
max@0 1330 delete M_local;
max@0 1331 }
max@0 1332 }
max@0 1333
max@0 1334
max@0 1335 inline eT get_val() const { return val; }
max@0 1336
max@0 1337
max@0 1338 static const bool do_trans = true;
max@0 1339 static const bool do_times = true;
max@0 1340
max@0 1341 // the order below is important
max@0 1342 const eT val;
max@0 1343 const Mat<eT>* M_local;
max@0 1344 const Mat<eT>& M;
max@0 1345 };
max@0 1346
max@0 1347
max@0 1348
max@0 1349 template<typename T1>
max@0 1350 class partial_unwrap_check< eOp<T1, eop_scalar_times> >
max@0 1351 {
max@0 1352 public:
max@0 1353
max@0 1354 typedef typename T1::elem_type eT;
max@0 1355
max@0 1356 inline
max@0 1357 partial_unwrap_check(const eOp<T1,eop_scalar_times>& A, const Mat<eT>& B)
max@0 1358 : val(A.aux)
max@0 1359 , M (A.P.Q)
max@0 1360 {
max@0 1361 arma_extra_debug_sigprint();
max@0 1362 arma_ignore(B);
max@0 1363 }
max@0 1364
max@0 1365 inline
max@0 1366 ~partial_unwrap_check()
max@0 1367 {
max@0 1368 arma_extra_debug_sigprint();
max@0 1369 }
max@0 1370
max@0 1371
max@0 1372 inline eT get_val() const { return val; }
max@0 1373
max@0 1374
max@0 1375 static const bool do_trans = false;
max@0 1376 static const bool do_times = true;
max@0 1377
max@0 1378 const eT val;
max@0 1379 const Mat<eT> M;
max@0 1380 };
max@0 1381
max@0 1382
max@0 1383
max@0 1384 template<typename eT>
max@0 1385 class partial_unwrap_check< eOp<Mat<eT>, eop_scalar_times> >
max@0 1386 {
max@0 1387 public:
max@0 1388
max@0 1389 inline
max@0 1390 partial_unwrap_check(const eOp<Mat<eT>,eop_scalar_times>& A, const Mat<eT>& B)
max@0 1391 : val(A.aux)
max@0 1392 , M (A.P.Q)
max@0 1393 {
max@0 1394 arma_extra_debug_sigprint();
max@0 1395 arma_ignore(B);
max@0 1396 }
max@0 1397
max@0 1398 inline
max@0 1399 ~partial_unwrap_check()
max@0 1400 {
max@0 1401 arma_extra_debug_sigprint();
max@0 1402 }
max@0 1403
max@0 1404
max@0 1405 inline eT get_val() const { return val; }
max@0 1406
max@0 1407
max@0 1408 static const bool do_trans = false;
max@0 1409 static const bool do_times = true;
max@0 1410
max@0 1411 const eT val;
max@0 1412 const Mat<eT>& M;
max@0 1413 };
max@0 1414
max@0 1415
max@0 1416
max@0 1417 template<typename eT>
max@0 1418 class partial_unwrap_check< eOp<Row<eT>, eop_scalar_times> >
max@0 1419 {
max@0 1420 public:
max@0 1421
max@0 1422 inline
max@0 1423 partial_unwrap_check(const eOp<Row<eT>,eop_scalar_times>& A, const Mat<eT>& B)
max@0 1424 : val(A.aux)
max@0 1425 , M (A.P.Q)
max@0 1426 {
max@0 1427 arma_extra_debug_sigprint();
max@0 1428 arma_ignore(B);
max@0 1429 }
max@0 1430
max@0 1431 inline
max@0 1432 ~partial_unwrap_check()
max@0 1433 {
max@0 1434 arma_extra_debug_sigprint();
max@0 1435 }
max@0 1436
max@0 1437
max@0 1438 inline eT get_val() const { return val; }
max@0 1439
max@0 1440
max@0 1441 static const bool do_trans = false;
max@0 1442 static const bool do_times = true;
max@0 1443
max@0 1444 const eT val;
max@0 1445 const Mat<eT>& M;
max@0 1446 };
max@0 1447
max@0 1448
max@0 1449
max@0 1450 template<typename eT>
max@0 1451 class partial_unwrap_check< eOp<Col<eT>, eop_scalar_times> >
max@0 1452 {
max@0 1453 public:
max@0 1454
max@0 1455 inline
max@0 1456 partial_unwrap_check(const eOp<Col<eT>,eop_scalar_times>& A, const Mat<eT>& B)
max@0 1457 : val(A.aux)
max@0 1458 , M (A.P.Q)
max@0 1459 {
max@0 1460 arma_extra_debug_sigprint();
max@0 1461 arma_ignore(B);
max@0 1462 }
max@0 1463
max@0 1464 inline
max@0 1465 ~partial_unwrap_check()
max@0 1466 {
max@0 1467 arma_extra_debug_sigprint();
max@0 1468 }
max@0 1469
max@0 1470
max@0 1471 inline eT get_val() const { return val; }
max@0 1472
max@0 1473
max@0 1474 static const bool do_trans = false;
max@0 1475 static const bool do_times = true;
max@0 1476
max@0 1477 const eT val;
max@0 1478 const Mat<eT>& M;
max@0 1479 };
max@0 1480
max@0 1481
max@0 1482
max@0 1483 //! @}