00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 template<typename eT>
00023 inline
00024 Col<eT>::Col()
00025 : Mat<eT>()
00026 {
00027 arma_extra_debug_sigprint();
00028 }
00029
00030
00031
00032
00033 template<typename eT>
00034 inline
00035 Col<eT>::Col(const u32 in_n_elem)
00036 : Mat<eT>(in_n_elem, 1)
00037 {
00038 arma_extra_debug_sigprint();
00039 }
00040
00041
00042
00043 template<typename eT>
00044 inline
00045 Col<eT>::Col(const u32 in_n_rows, const u32 in_n_cols)
00046 : Mat<eT>(in_n_rows, in_n_cols)
00047 {
00048 arma_extra_debug_sigprint();
00049
00050 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00051 }
00052
00053
00054
00055
00056 template<typename eT>
00057 inline
00058 Col<eT>::Col(const char* text)
00059 : Mat<eT>(text)
00060 {
00061 arma_extra_debug_sigprint();
00062
00063 std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
00064
00065 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00066 }
00067
00068
00069
00070
00071 template<typename eT>
00072 inline
00073 const Col<eT>&
00074 Col<eT>::operator=(const char* text)
00075 {
00076 arma_extra_debug_sigprint();
00077
00078 Mat<eT>::operator=(text);
00079
00080 std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
00081
00082 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00083
00084 return *this;
00085 }
00086
00087
00088
00089
00090 template<typename eT>
00091 inline
00092 Col<eT>::Col(const std::string& text)
00093 : Mat<eT>(text)
00094 {
00095 arma_extra_debug_sigprint();
00096
00097 std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
00098
00099 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00100 }
00101
00102
00103
00104
00105 template<typename eT>
00106 inline
00107 const Col<eT>&
00108 Col<eT>::operator=(const std::string& text)
00109 {
00110 arma_extra_debug_sigprint();
00111
00112 Mat<eT>::operator=(text);
00113
00114 std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
00115
00116 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00117
00118 return *this;
00119 }
00120
00121
00122
00123
00124 template<typename eT>
00125 inline
00126 Col<eT>::Col(const Col<eT>& X)
00127 : Mat<eT>(X)
00128 {
00129 arma_extra_debug_sigprint();
00130 }
00131
00132
00133
00134
00135 template<typename eT>
00136 inline
00137 const Col<eT>&
00138 Col<eT>::operator=(const Col<eT>& X)
00139 {
00140 arma_extra_debug_sigprint();
00141
00142 Mat<eT>::operator=(X);
00143
00144 return *this;
00145 }
00146
00147
00148
00149
00150 template<typename eT>
00151 inline
00152 Col<eT>::Col(const Mat<eT>& X)
00153 : Mat<eT>(X)
00154 {
00155 arma_extra_debug_sigprint();
00156
00157 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00158 }
00159
00160
00161
00162
00163 template<typename eT>
00164 inline
00165 const Col<eT>&
00166 Col<eT>::operator=(const Mat<eT>& X)
00167 {
00168 arma_extra_debug_sigprint();
00169
00170 Mat<eT>::operator=(X);
00171
00172 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00173
00174 return *this;
00175 }
00176
00177
00178
00179 template<typename eT>
00180 inline
00181 const Col<eT>&
00182 Col<eT>::operator*=(const Mat<eT>& X)
00183 {
00184 arma_extra_debug_sigprint();
00185
00186 Mat<eT>::operator*=(X);
00187
00188 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00189
00190 return *this;
00191 }
00192
00193
00194
00195
00196 template<typename eT>
00197 inline
00198 Col<eT>::Col(eT* aux_mem, const u32 aux_n_rows, const u32 aux_n_cols, const bool copy_aux_mem)
00199 : Mat<eT>(aux_mem, aux_n_rows, aux_n_cols, copy_aux_mem)
00200 {
00201 arma_extra_debug_sigprint();
00202
00203 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00204 }
00205
00206
00207
00208
00209 template<typename eT>
00210 inline
00211 Col<eT>::Col(const eT* aux_mem, const u32 aux_n_rows, const u32 aux_n_cols)
00212 : Mat<eT>(aux_mem, aux_n_rows, aux_n_cols)
00213 {
00214 arma_extra_debug_sigprint();
00215
00216 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00217 }
00218
00219
00220
00221
00222 template<typename eT>
00223 inline
00224 Col<eT>::Col(eT* aux_mem, const u32 aux_length, const bool copy_aux_mem)
00225 : Mat<eT>(aux_mem, aux_length, 1, copy_aux_mem)
00226 {
00227 arma_extra_debug_sigprint();
00228
00229
00230
00231
00232
00233
00234 }
00235
00236
00237
00238
00239 template<typename eT>
00240 inline
00241 Col<eT>::Col(const eT* aux_mem, const u32 aux_length)
00242 : Mat<eT>(aux_mem, aux_length, 1)
00243 {
00244 arma_extra_debug_sigprint();
00245
00246
00247
00248
00249
00250
00251 }
00252
00253
00254
00255 template<typename eT>
00256 template<typename T1, typename T2>
00257 inline
00258 Col<eT>::Col
00259 (
00260 const Base<typename Col<eT>::pod_type, T1>& A,
00261 const Base<typename Col<eT>::pod_type, T2>& B
00262 )
00263 : Mat<eT>(A,B)
00264 {
00265 arma_extra_debug_sigprint();
00266
00267 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00268 }
00269
00270
00271
00272
00273 template<typename eT>
00274 inline
00275 Col<eT>::Col(const subview<eT>& X)
00276 : Mat<eT>(X)
00277 {
00278 arma_extra_debug_sigprint();
00279
00280 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00281 }
00282
00283
00284
00285
00286 template<typename eT>
00287 inline
00288 const Col<eT>&
00289 Col<eT>::operator=(const subview<eT>& X)
00290 {
00291 arma_extra_debug_sigprint();
00292
00293 Mat<eT>::operator=(X);
00294
00295 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00296
00297 return *this;
00298 }
00299
00300
00301
00302 template<typename eT>
00303 inline
00304 const Col<eT>&
00305 Col<eT>::operator*=(const subview<eT>& X)
00306 {
00307 arma_extra_debug_sigprint();
00308
00309 Mat<eT>::operator*=(X);
00310
00311 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00312
00313 return *this;
00314 }
00315
00316
00317
00318
00319 template<typename eT>
00320 inline
00321 Col<eT>::Col(const subview_cube<eT>& X)
00322 : Mat<eT>(X)
00323 {
00324 arma_extra_debug_sigprint();
00325
00326 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00327 }
00328
00329
00330
00331
00332 template<typename eT>
00333 inline
00334 const Col<eT>&
00335 Col<eT>::operator=(const subview_cube<eT>& X)
00336 {
00337 arma_extra_debug_sigprint();
00338
00339 Mat<eT>::operator=(X);
00340
00341 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00342
00343 return *this;
00344 }
00345
00346
00347
00348 template<typename eT>
00349 inline
00350 const Col<eT>&
00351 Col<eT>::operator*=(const subview_cube<eT>& X)
00352 {
00353 arma_extra_debug_sigprint();
00354
00355 Mat<eT>::operator*=(X);
00356
00357 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00358
00359 return *this;
00360 }
00361
00362
00363
00364
00365 template<typename eT>
00366 inline
00367 Col<eT>::Col(const diagview<eT>& X)
00368 : Mat<eT>(X)
00369 {
00370 arma_extra_debug_sigprint();
00371
00372 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00373 }
00374
00375
00376
00377
00378 template<typename eT>
00379 inline
00380 const Col<eT>&
00381 Col<eT>::operator=(const diagview<eT>& X)
00382 {
00383 arma_extra_debug_sigprint();
00384
00385 Mat<eT>::operator=(X);
00386
00387 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00388
00389 return *this;
00390 }
00391
00392
00393
00394 template<typename eT>
00395 inline
00396 const Col<eT>&
00397 Col<eT>::operator*=(const diagview<eT>& X)
00398 {
00399 arma_extra_debug_sigprint();
00400
00401 Mat<eT>::operator*=(X);
00402
00403 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00404
00405 return *this;
00406 }
00407
00408
00409
00410 template<typename eT>
00411 arma_inline
00412 eT&
00413 Col<eT>::row(const u32 row_num)
00414 {
00415 arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::row(): out of bounds" );
00416
00417 return access::rw(Mat<eT>::mem[row_num]);
00418 }
00419
00420
00421
00422 template<typename eT>
00423 arma_inline
00424 eT
00425 Col<eT>::row(const u32 row_num)
00426 const
00427 {
00428 arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::row(): out of bounds" );
00429
00430 return Mat<eT>::mem[row_num];
00431 }
00432
00433
00434
00435 template<typename eT>
00436 arma_inline
00437 subview_col<eT>
00438 Col<eT>::rows(const u32 in_row1, const u32 in_row2)
00439 {
00440 arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used");
00441
00442 return subview_col<eT>(*this, 0, in_row1, in_row2);
00443 }
00444
00445
00446
00447 template<typename eT>
00448 arma_inline
00449 const subview_col<eT>
00450 Col<eT>::rows(const u32 in_row1, const u32 in_row2)
00451 const
00452 {
00453 arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used");
00454
00455 return subview_col<eT>(*this, 0, in_row1, in_row2);
00456 }
00457
00458
00459
00460
00461 template<typename eT>
00462 template<typename T1, typename op_type>
00463 inline
00464 Col<eT>::Col(const Op<T1, op_type>& X)
00465 : Mat<eT>(X)
00466 {
00467 arma_extra_debug_sigprint();
00468
00469 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00470 }
00471
00472
00473
00474
00475 template<typename eT>
00476 template<typename T1, typename op_type>
00477 inline
00478 const Col<eT>&
00479 Col<eT>::operator=(const Op<T1, op_type>& X)
00480 {
00481 arma_extra_debug_sigprint();
00482
00483 Mat<eT>::operator=(X);
00484 arma_debug_check( (Mat<eT>::n_cols > 1), "Col::operator=(): given matrix can't be interpreted as a column vector" );
00485 return *this;
00486 }
00487
00488
00489
00490 template<typename eT>
00491 template<typename T1, typename op_type>
00492 inline
00493 const Col<eT>&
00494 Col<eT>::operator*=(const Op<T1, op_type>& X)
00495 {
00496 arma_extra_debug_sigprint();
00497
00498 Mat<eT>::operator*=(X);
00499
00500 arma_debug_check( (Mat<eT>::n_cols > 1), "Col::operator=(): incompatible dimensions" );
00501
00502 return *this;
00503 }
00504
00505
00506
00507 template<typename eT>
00508 template<typename T1, typename eop_type>
00509 inline
00510 Col<eT>::Col(const eOp<T1, eop_type>& X)
00511 : Mat<eT>(X)
00512 {
00513 arma_extra_debug_sigprint();
00514
00515 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00516 }
00517
00518
00519
00520 template<typename eT>
00521 template<typename T1, typename eop_type>
00522 inline
00523 const Col<eT>&
00524 Col<eT>::operator=(const eOp<T1, eop_type>& X)
00525 {
00526 arma_extra_debug_sigprint();
00527
00528 Mat<eT>::operator=(X);
00529 arma_debug_check( (Mat<eT>::n_cols > 1), "Col::operator=(): given matrix can't be interpreted as a column vector" );
00530 return *this;
00531 }
00532
00533
00534
00535 template<typename eT>
00536 template<typename T1, typename eop_type>
00537 inline
00538 const Col<eT>&
00539 Col<eT>::operator*=(const eOp<T1, eop_type>& X)
00540 {
00541 arma_extra_debug_sigprint();
00542
00543 Mat<eT>::operator*=(X);
00544
00545 arma_debug_check( (Mat<eT>::n_cols > 1), "Col::operator=(): incompatible dimensions" );
00546
00547 return *this;
00548 }
00549
00550
00551
00552
00553 template<typename eT>
00554 template<typename T1, typename T2, typename glue_type>
00555 inline
00556 Col<eT>::Col(const Glue<T1, T2, glue_type>& X)
00557 : Mat<eT>(X)
00558 {
00559 arma_extra_debug_sigprint();
00560
00561 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00562 }
00563
00564
00565
00566
00567 template<typename eT>
00568 template<typename T1, typename T2, typename glue_type>
00569 inline
00570 const Col<eT>&
00571 Col<eT>::operator=(const Glue<T1, T2, glue_type>& X)
00572 {
00573 arma_extra_debug_sigprint();
00574
00575 Mat<eT>::operator=(X);
00576
00577 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00578
00579 return *this;
00580 }
00581
00582
00583
00584 template<typename eT>
00585 template<typename T1, typename T2, typename glue_type>
00586 inline
00587 const Col<eT>&
00588 Col<eT>::operator*=(const Glue<T1, T2, glue_type>& X)
00589 {
00590 arma_extra_debug_sigprint();
00591
00592 Mat<eT>::operator*=(X);
00593
00594 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00595
00596 return *this;
00597 }
00598
00599
00600
00601 template<typename eT>
00602 template<typename T1, typename T2, typename eglue_type>
00603 inline
00604 Col<eT>::Col(const eGlue<T1, T2, eglue_type>& X)
00605 : Mat<eT>(X)
00606 {
00607 arma_extra_debug_sigprint();
00608
00609 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00610 }
00611
00612
00613
00614 template<typename eT>
00615 template<typename T1, typename T2, typename eglue_type>
00616 inline
00617 const Col<eT>&
00618 Col<eT>::operator=(const eGlue<T1, T2, eglue_type>& X)
00619 {
00620 arma_extra_debug_sigprint();
00621
00622 Mat<eT>::operator=(X);
00623
00624 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00625
00626 return *this;
00627 }
00628
00629
00630
00631 template<typename eT>
00632 template<typename T1, typename T2, typename eglue_type>
00633 inline
00634 const Col<eT>&
00635 Col<eT>::operator*=(const eGlue<T1, T2, eglue_type>& X)
00636 {
00637 arma_extra_debug_sigprint();
00638
00639 Mat<eT>::operator*=(X);
00640
00641 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00642
00643 return *this;
00644 }
00645
00646
00647
00648
00649 template<typename eT>
00650 inline
00651 void
00652 Col<eT>::set_size(const u32 in_n_elem)
00653 {
00654 arma_extra_debug_sigprint();
00655
00656 Mat<eT>::set_size(in_n_elem,1);
00657 }
00658
00659
00660
00661
00662 template<typename eT>
00663 inline
00664 void
00665 Col<eT>::set_size(const u32 in_n_rows, const u32 in_n_cols)
00666 {
00667 arma_extra_debug_sigprint();
00668
00669
00670 Mat<eT>::set_size( in_n_rows, (std::min)( u32(1), in_n_cols ) );
00671
00672 arma_debug_check( (in_n_cols > 1), "Col::set_size(): incompatible dimensions" );
00673 }
00674
00675
00676
00677
00678 template<typename eT>
00679 template<typename eT2>
00680 inline
00681 void
00682 Col<eT>::copy_size(const Mat<eT2>& x)
00683 {
00684 arma_extra_debug_sigprint();
00685
00686
00687 Mat<eT>::set_size( x.n_rows, (std::min)( u32(1), x.n_cols ) );
00688
00689 arma_debug_check( (x.n_cols > 1), "Col::copy_size(): incompatible dimensions" );
00690 }
00691
00692
00693
00694 template<typename eT>
00695 inline
00696 void
00697 Col<eT>::zeros()
00698 {
00699 arma_extra_debug_sigprint();
00700
00701 Mat<eT>::zeros();
00702 }
00703
00704
00705
00706 template<typename eT>
00707 inline
00708 void
00709 Col<eT>::zeros(const u32 in_n_elem)
00710 {
00711 arma_extra_debug_sigprint();
00712
00713 Mat<eT>::zeros(in_n_elem, 1);
00714 }
00715
00716
00717
00718 template<typename eT>
00719 inline
00720 void
00721 Col<eT>::zeros(const u32 in_n_rows, const u32 in_n_cols)
00722 {
00723 arma_extra_debug_sigprint();
00724
00725
00726 Mat<eT>::zeros( in_n_rows, (std::min)( u32(1), in_n_cols ) );
00727
00728 arma_debug_check( (in_n_cols > 1), "Col::zeros(): incompatible dimensions" );
00729 }
00730
00731
00732
00733 template<typename eT>
00734 inline
00735 void
00736 Col<eT>::ones()
00737 {
00738 arma_extra_debug_sigprint();
00739
00740 Mat<eT>::ones();
00741 }
00742
00743
00744
00745 template<typename eT>
00746 inline
00747 void
00748 Col<eT>::ones(const u32 in_n_elem)
00749 {
00750 arma_extra_debug_sigprint();
00751
00752 Mat<eT>::ones(in_n_elem, 1);
00753 }
00754
00755
00756
00757 template<typename eT>
00758 inline
00759 void
00760 Col<eT>::ones(const u32 in_n_rows, const u32 in_n_cols)
00761 {
00762 arma_extra_debug_sigprint();
00763
00764
00765 Mat<eT>::ones( in_n_rows, (std::min)( u32(1), in_n_cols ) );
00766
00767 arma_debug_check( (in_n_cols > 1), "Col::ones(): incompatible dimensions" );
00768 }
00769
00770
00771
00772 template<typename eT>
00773 inline
00774 void
00775 Col<eT>::load(const std::string name, const file_type type)
00776 {
00777 arma_extra_debug_sigprint();
00778
00779 Mat<eT>::load(name,type);
00780
00781 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00782 }
00783
00784
00785
00786 template<typename eT>
00787 inline
00788 void
00789 Col<eT>::load(std::istream& is, const file_type type)
00790 {
00791 arma_extra_debug_sigprint();
00792
00793 Mat<eT>::load(is, type);
00794
00795 arma_debug_check( (Mat<eT>::n_cols > 1), "Col(): incompatible dimensions" );
00796 }
00797
00798
00799
00800 template<typename eT>
00801 inline
00802 typename Col<eT>::row_iterator
00803 Col<eT>::begin_row(const u32 row_num)
00804 {
00805 arma_extra_debug_sigprint();
00806
00807 arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out of bounds");
00808
00809 return Mat<eT>::memptr() + row_num;
00810 }
00811
00812
00813
00814 template<typename eT>
00815 inline
00816 typename Col<eT>::const_row_iterator
00817 Col<eT>::begin_row(const u32 row_num) const
00818 {
00819 arma_extra_debug_sigprint();
00820
00821 arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out of bounds");
00822
00823 return Mat<eT>::memptr() + row_num;
00824 }
00825
00826
00827
00828 template<typename eT>
00829 inline
00830 typename Col<eT>::row_iterator
00831 Col<eT>::end_row(const u32 row_num)
00832 {
00833 arma_extra_debug_sigprint();
00834
00835 arma_debug_check( (row_num >= Mat<eT>::n_rows), "end_row(): index out of bounds");
00836
00837 return Mat<eT>::memptr() + row_num + 1;
00838 }
00839
00840
00841
00842 template<typename eT>
00843 inline
00844 typename Col<eT>::const_row_iterator
00845 Col<eT>::end_row(const u32 row_num) const
00846 {
00847 arma_extra_debug_sigprint();
00848
00849 arma_debug_check( (row_num >= Mat<eT>::n_rows), "end_row(): index out of bounds");
00850
00851 return Mat<eT>::memptr() + row_num + 1;
00852 }
00853
00854
00855
00856