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