$search
00001 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2008-2011 Conrad Sanderson 00003 // 00004 // This file is part of the Armadillo C++ library. 00005 // It is provided without any warranty of fitness 00006 // for any purpose. You can redistribute this file 00007 // and/or modify it under the terms of the GNU 00008 // Lesser General Public License (LGPL) as published 00009 // by the Free Software Foundation, either version 3 00010 // of the License or (at your option) any later version. 00011 // (see http://www.opensource.org/licenses for more info) 00012 00013 00016 00017 00019 template<typename eT> 00020 inline 00021 Row<eT>::Row() 00022 : Mat<eT>(1, 0) 00023 { 00024 arma_extra_debug_sigprint(); 00025 00026 access::rw(Mat<eT>::vec_state) = 2; 00027 } 00028 00029 00030 00031 template<typename eT> 00032 inline 00033 Row<eT>::Row(const Row<eT>& X) 00034 : Mat<eT>(1, X.n_elem) 00035 { 00036 arma_extra_debug_sigprint(); 00037 00038 access::rw(Mat<eT>::vec_state) = 2; 00039 00040 arrayops::copy((*this).memptr(), X.memptr(), X.n_elem); 00041 } 00042 00043 00044 00046 template<typename eT> 00047 inline 00048 Row<eT>::Row(const uword in_n_elem) 00049 : Mat<eT>(1, in_n_elem) 00050 { 00051 arma_extra_debug_sigprint(); 00052 00053 access::rw(Mat<eT>::vec_state) = 2; 00054 } 00055 00056 00057 00058 template<typename eT> 00059 inline 00060 Row<eT>::Row(const uword in_n_rows, const uword in_n_cols) 00061 { 00062 arma_extra_debug_sigprint(); 00063 00064 access::rw(Mat<eT>::vec_state) = 2; 00065 00066 Mat<eT>::init_warm(in_n_rows, in_n_cols); 00067 } 00068 00069 00070 00071 template<typename eT> 00072 inline 00073 Row<eT>::Row(const char* text) 00074 { 00075 arma_extra_debug_sigprint(); 00076 00077 access::rw(Mat<eT>::vec_state) = 2; 00078 00079 Mat<eT>::operator=(text); 00080 } 00081 00082 00083 00084 template<typename eT> 00085 inline 00086 const Row<eT>& 00087 Row<eT>::operator=(const char* text) 00088 { 00089 arma_extra_debug_sigprint(); 00090 00091 Mat<eT>::operator=(text); 00092 00093 return *this; 00094 } 00095 00096 00097 00098 template<typename eT> 00099 inline 00100 Row<eT>::Row(const std::string& text) 00101 { 00102 arma_extra_debug_sigprint(); 00103 00104 access::rw(Mat<eT>::vec_state) = 2; 00105 00106 Mat<eT>::operator=(text); 00107 } 00108 00109 00110 00111 template<typename eT> 00112 inline 00113 const Row<eT>& 00114 Row<eT>::operator=(const std::string& text) 00115 { 00116 arma_extra_debug_sigprint(); 00117 00118 Mat<eT>::operator=(text); 00119 00120 return *this; 00121 } 00122 00123 00124 00125 #if defined(ARMA_USE_CXX11) 00126 00127 template<typename eT> 00128 inline 00129 Row<eT>::Row(const std::initializer_list<eT>& list) 00130 { 00131 arma_extra_debug_sigprint(); 00132 00133 access::rw(Mat<eT>::vec_state) = 2; 00134 00135 Mat<eT>::operator=(list); 00136 } 00137 00138 00139 00140 template<typename eT> 00141 inline 00142 const Row<eT>& 00143 Row<eT>::operator=(const std::initializer_list<eT>& list) 00144 { 00145 arma_extra_debug_sigprint(); 00146 00147 Mat<eT>::operator=(list); 00148 00149 return *this; 00150 } 00151 00152 #endif 00153 00154 00155 00156 template<typename eT> 00157 inline 00158 const Row<eT>& 00159 Row<eT>::operator=(const eT val) 00160 { 00161 arma_extra_debug_sigprint(); 00162 00163 Mat<eT>::operator=(val); 00164 00165 return *this; 00166 } 00167 00168 00169 00170 template<typename eT> 00171 template<typename T1> 00172 inline 00173 Row<eT>::Row(const Base<eT,T1>& X) 00174 { 00175 arma_extra_debug_sigprint(); 00176 00177 access::rw(Mat<eT>::vec_state) = 2; 00178 00179 Mat<eT>::operator=(X.get_ref()); 00180 } 00181 00182 00183 00184 template<typename eT> 00185 template<typename T1> 00186 inline 00187 const Row<eT>& 00188 Row<eT>::operator=(const Base<eT,T1>& X) 00189 { 00190 arma_extra_debug_sigprint(); 00191 00192 Mat<eT>::operator=(X.get_ref()); 00193 00194 return *this; 00195 } 00196 00197 00198 00200 template<typename eT> 00201 inline 00202 Row<eT>::Row(eT* aux_mem, const uword aux_length, const bool copy_aux_mem, const bool strict) 00203 : Mat<eT>(aux_mem, 1, aux_length, copy_aux_mem, strict) 00204 { 00205 arma_extra_debug_sigprint(); 00206 00207 access::rw(Mat<eT>::vec_state) = 2; 00208 } 00209 00210 00211 00213 template<typename eT> 00214 inline 00215 Row<eT>::Row(const eT* aux_mem, const uword aux_length) 00216 : Mat<eT>(aux_mem, 1, aux_length) 00217 { 00218 arma_extra_debug_sigprint(); 00219 00220 access::rw(Mat<eT>::vec_state) = 2; 00221 } 00222 00223 00224 00225 template<typename eT> 00226 template<typename T1, typename T2> 00227 inline 00228 Row<eT>::Row 00229 ( 00230 const Base<typename Row<eT>::pod_type, T1>& A, 00231 const Base<typename Row<eT>::pod_type, T2>& B 00232 ) 00233 { 00234 arma_extra_debug_sigprint(); 00235 00236 access::rw(Mat<eT>::vec_state) = 2; 00237 00238 Mat<eT>::init(A,B); 00239 } 00240 00241 00242 00243 template<typename eT> 00244 template<typename T1> 00245 inline 00246 Row<eT>::Row(const BaseCube<eT,T1>& X) 00247 { 00248 arma_extra_debug_sigprint(); 00249 00250 access::rw(Mat<eT>::vec_state) = 2; 00251 00252 Mat<eT>::operator=(X); 00253 } 00254 00255 00256 00257 template<typename eT> 00258 template<typename T1> 00259 inline 00260 const Row<eT>& 00261 Row<eT>::operator=(const BaseCube<eT,T1>& X) 00262 { 00263 arma_extra_debug_sigprint(); 00264 00265 Mat<eT>::operator=(X); 00266 00267 return *this; 00268 } 00269 00270 00271 00272 template<typename eT> 00273 inline 00274 Row<eT>::Row(const subview_cube<eT>& X) 00275 { 00276 arma_extra_debug_sigprint(); 00277 00278 access::rw(Mat<eT>::vec_state) = 2; 00279 00280 Mat<eT>::operator=(X); 00281 } 00282 00283 00284 00285 template<typename eT> 00286 inline 00287 const Row<eT>& 00288 Row<eT>::operator=(const subview_cube<eT>& X) 00289 { 00290 arma_extra_debug_sigprint(); 00291 00292 Mat<eT>::operator=(X); 00293 00294 return *this; 00295 } 00296 00297 00298 00299 template<typename eT> 00300 inline 00301 mat_injector< Row<eT> > 00302 Row<eT>::operator<<(const eT val) 00303 { 00304 return mat_injector< Row<eT> >(*this, val); 00305 } 00306 00307 00308 00309 template<typename eT> 00310 arma_inline 00311 eT& 00312 Row<eT>::col(const uword col_num) 00313 { 00314 arma_debug_check( (col_num >= Mat<eT>::n_cols), "Row::col(): out of bounds" ); 00315 00316 return access::rw(Mat<eT>::mem[col_num]); 00317 } 00318 00319 00320 00321 template<typename eT> 00322 arma_inline 00323 eT 00324 Row<eT>::col(const uword col_num) const 00325 { 00326 arma_debug_check( (col_num >= Mat<eT>::n_cols), "Row::col(): out of bounds" ); 00327 00328 return Mat<eT>::mem[col_num]; 00329 } 00330 00331 00332 00333 template<typename eT> 00334 arma_inline 00335 subview_row<eT> 00336 Row<eT>::cols(const uword in_col1, const uword in_col2) 00337 { 00338 arma_extra_debug_sigprint(); 00339 00340 arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::cols(): indices out of bounds or incorrectly used"); 00341 00342 const uword subview_n_cols = in_col2 - in_col1 + 1; 00343 00344 return subview_row<eT>(*this, 0, in_col1, subview_n_cols); 00345 } 00346 00347 00348 00349 template<typename eT> 00350 arma_inline 00351 const subview_row<eT> 00352 Row<eT>::cols(const uword in_col1, const uword in_col2) const 00353 { 00354 arma_extra_debug_sigprint(); 00355 00356 arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::cols(): indices out of bounds or incorrectly used"); 00357 00358 const uword subview_n_cols = in_col2 - in_col1 + 1; 00359 00360 return subview_row<eT>(*this, 0, in_col1, subview_n_cols); 00361 } 00362 00363 00364 00365 template<typename eT> 00366 arma_inline 00367 subview_row<eT> 00368 Row<eT>::subvec(const uword in_col1, const uword in_col2) 00369 { 00370 arma_extra_debug_sigprint(); 00371 00372 arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::subvec(): indices out of bounds or incorrectly used"); 00373 00374 const uword subview_n_cols = in_col2 - in_col1 + 1; 00375 00376 return subview_row<eT>(*this, 0, in_col1, subview_n_cols); 00377 } 00378 00379 00380 00381 template<typename eT> 00382 arma_inline 00383 const subview_row<eT> 00384 Row<eT>::subvec(const uword in_col1, const uword in_col2) const 00385 { 00386 arma_extra_debug_sigprint(); 00387 00388 arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::subvec(): indices out of bounds or incorrectly used"); 00389 00390 const uword subview_n_cols = in_col2 - in_col1 + 1; 00391 00392 return subview_row<eT>(*this, 0, in_col1, subview_n_cols); 00393 } 00394 00395 00396 00397 template<typename eT> 00398 arma_inline 00399 subview_row<eT> 00400 Row<eT>::subvec(const span& col_span) 00401 { 00402 arma_extra_debug_sigprint(); 00403 00404 const bool col_all = col_span.whole; 00405 00406 const uword local_n_cols = Mat<eT>::n_cols; 00407 00408 const uword in_col1 = col_all ? 0 : col_span.a; 00409 const uword in_col2 = col_span.b; 00410 const uword subvec_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; 00411 00412 arma_debug_check( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ), "Row::subvec(): indices out of bounds or incorrectly used"); 00413 00414 return subview_row<eT>(*this, 0, in_col1, subvec_n_cols); 00415 } 00416 00417 00418 00419 template<typename eT> 00420 arma_inline 00421 const subview_row<eT> 00422 Row<eT>::subvec(const span& col_span) const 00423 { 00424 arma_extra_debug_sigprint(); 00425 00426 const bool col_all = col_span.whole; 00427 00428 const uword local_n_cols = Mat<eT>::n_cols; 00429 00430 const uword in_col1 = col_all ? 0 : col_span.a; 00431 const uword in_col2 = col_span.b; 00432 const uword subvec_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; 00433 00434 arma_debug_check( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ), "Row::subvec(): indices out of bounds or incorrectly used"); 00435 00436 return subview_row<eT>(*this, 0, in_col1, subvec_n_cols); 00437 } 00438 00439 00440 00441 // template<typename eT> 00442 // arma_inline 00443 // subview_row<eT> 00444 // Row<eT>::operator()(const span& col_span) 00445 // { 00446 // arma_extra_debug_sigprint(); 00447 // 00448 // return subvec(col_span); 00449 // } 00450 // 00451 // 00452 // 00453 // template<typename eT> 00454 // arma_inline 00455 // const subview_row<eT> 00456 // Row<eT>::operator()(const span& col_span) const 00457 // { 00458 // arma_extra_debug_sigprint(); 00459 // 00460 // return subvec(col_span); 00461 // } 00462 00463 00464 00466 template<typename eT> 00467 inline 00468 void 00469 Row<eT>::shed_col(const uword col_num) 00470 { 00471 arma_extra_debug_sigprint(); 00472 00473 arma_debug_check( col_num >= Mat<eT>::n_cols, "Row::shed_col(): out of bounds"); 00474 00475 shed_cols(col_num, col_num); 00476 } 00477 00478 00479 00481 template<typename eT> 00482 inline 00483 void 00484 Row<eT>::shed_cols(const uword in_col1, const uword in_col2) 00485 { 00486 arma_extra_debug_sigprint(); 00487 00488 arma_debug_check 00489 ( 00490 (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols), 00491 "Row::shed_cols(): indices out of bounds or incorrectly used" 00492 ); 00493 00494 const uword n_keep_front = in_col1; 00495 const uword n_keep_back = Mat<eT>::n_cols - (in_col2 + 1); 00496 00497 Row<eT> X(n_keep_front + n_keep_back); 00498 00499 eT* X_mem = X.memptr(); 00500 const eT* t_mem = (*this).memptr(); 00501 00502 if(n_keep_front > 0) 00503 { 00504 arrayops::copy( X_mem, t_mem, n_keep_front ); 00505 } 00506 00507 if(n_keep_back > 0) 00508 { 00509 arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_col2+1]), n_keep_back); 00510 } 00511 00512 Mat<eT>::steal_mem(X); 00513 } 00514 00515 00516 00519 template<typename eT> 00520 inline 00521 void 00522 Row<eT>::insert_cols(const uword col_num, const uword N, const bool set_to_zero) 00523 { 00524 arma_extra_debug_sigprint(); 00525 00526 const uword t_n_cols = Mat<eT>::n_cols; 00527 00528 const uword A_n_cols = col_num; 00529 const uword B_n_cols = t_n_cols - col_num; 00530 00531 // insertion at col_num == n_cols is in effect an append operation 00532 arma_debug_check( (col_num > t_n_cols), "Row::insert_cols(): out of bounds"); 00533 00534 if(N > 0) 00535 { 00536 Row<eT> out(t_n_cols + N); 00537 00538 eT* out_mem = out.memptr(); 00539 const eT* t_mem = (*this).memptr(); 00540 00541 if(A_n_cols > 0) 00542 { 00543 arrayops::copy( out_mem, t_mem, A_n_cols ); 00544 } 00545 00546 if(B_n_cols > 0) 00547 { 00548 arrayops::copy( &(out_mem[col_num + N]), &(t_mem[col_num]), B_n_cols ); 00549 } 00550 00551 if(set_to_zero == true) 00552 { 00553 arrayops::inplace_set( &(out_mem[col_num]), eT(0), N ); 00554 } 00555 00556 Mat<eT>::steal_mem(out); 00557 } 00558 } 00559 00560 00561 00564 template<typename eT> 00565 template<typename T1> 00566 inline 00567 void 00568 Row<eT>::insert_cols(const uword col_num, const Base<eT,T1>& X) 00569 { 00570 arma_extra_debug_sigprint(); 00571 00572 Mat<eT>::insert_cols(col_num, X); 00573 } 00574 00575 00576 00577 template<typename eT> 00578 inline 00579 typename Row<eT>::row_iterator 00580 Row<eT>::begin_row(const uword row_num) 00581 { 00582 arma_extra_debug_sigprint(); 00583 00584 arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out of bounds"); 00585 00586 return Mat<eT>::memptr(); 00587 } 00588 00589 00590 00591 template<typename eT> 00592 inline 00593 typename Row<eT>::const_row_iterator 00594 Row<eT>::begin_row(const uword row_num) const 00595 { 00596 arma_extra_debug_sigprint(); 00597 00598 arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out of bounds"); 00599 00600 return Mat<eT>::memptr(); 00601 } 00602 00603 00604 00605 template<typename eT> 00606 inline 00607 typename Row<eT>::row_iterator 00608 Row<eT>::end_row(const uword row_num) 00609 { 00610 arma_extra_debug_sigprint(); 00611 00612 arma_debug_check( (row_num >= Mat<eT>::n_rows), "end_row(): index out of bounds"); 00613 00614 return Mat<eT>::memptr() + Mat<eT>::n_cols; 00615 } 00616 00617 00618 00619 template<typename eT> 00620 inline 00621 typename Row<eT>::const_row_iterator 00622 Row<eT>::end_row(const uword row_num) const 00623 { 00624 arma_extra_debug_sigprint(); 00625 00626 arma_debug_check( (row_num >= Mat<eT>::n_rows), "end_row(): index out of bounds"); 00627 00628 return Mat<eT>::memptr() + Mat<eT>::n_cols; 00629 } 00630 00631 00632 00633 template<typename eT> 00634 template<uword fixed_n_elem> 00635 arma_inline 00636 void 00637 Row<eT>::fixed<fixed_n_elem>::mem_setup() 00638 { 00639 arma_extra_debug_sigprint(); 00640 00641 access::rw(Mat<eT>::n_rows) = 1; 00642 access::rw(Mat<eT>::n_cols) = fixed_n_elem; 00643 access::rw(Mat<eT>::n_elem) = fixed_n_elem; 00644 access::rw(Mat<eT>::vec_state) = 2; 00645 access::rw(Mat<eT>::mem_state) = 3; 00646 access::rw(Mat<eT>::mem) = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; 00647 } 00648 00649 00650 00651 template<typename eT> 00652 template<uword fixed_n_elem> 00653 inline 00654 Row<eT>::fixed<fixed_n_elem>::fixed() 00655 { 00656 arma_extra_debug_sigprint_this(this); 00657 00658 mem_setup(); 00659 } 00660 00661 00662 00663 template<typename eT> 00664 template<uword fixed_n_elem> 00665 arma_inline 00666 Row<eT>::fixed<fixed_n_elem>::fixed(const fixed<fixed_n_elem>& X) 00667 { 00668 arma_extra_debug_sigprint_this(this); 00669 00670 mem_setup(); 00671 00672 eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; 00673 00674 arrayops::copy( dest, X.mem, fixed_n_elem ); 00675 } 00676 00677 00678 00679 template<typename eT> 00680 template<uword fixed_n_elem> 00681 arma_inline 00682 Row<eT>::fixed<fixed_n_elem>::fixed(const subview_cube<eT>& X) 00683 { 00684 arma_extra_debug_sigprint_this(this); 00685 00686 mem_setup(); 00687 00688 Row<eT>::operator=(X); 00689 } 00690 00691 00692 00693 template<typename eT> 00694 template<uword fixed_n_elem> 00695 template<typename T1> 00696 arma_inline 00697 Row<eT>::fixed<fixed_n_elem>::fixed(const Base<eT,T1>& A) 00698 { 00699 arma_extra_debug_sigprint_this(this); 00700 00701 mem_setup(); 00702 00703 Row<eT>::operator=(A.get_ref()); 00704 } 00705 00706 00707 00708 template<typename eT> 00709 template<uword fixed_n_elem> 00710 template<typename T1, typename T2> 00711 arma_inline 00712 Row<eT>::fixed<fixed_n_elem>::fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B) 00713 { 00714 arma_extra_debug_sigprint_this(this); 00715 00716 mem_setup(); 00717 00718 Row<eT>::init(A,B); 00719 } 00720 00721 00722 00723 template<typename eT> 00724 template<uword fixed_n_elem> 00725 inline 00726 Row<eT>::fixed<fixed_n_elem>::fixed(eT* aux_mem, const bool copy_aux_mem) 00727 { 00728 arma_extra_debug_sigprint_this(this); 00729 00730 access::rw(Mat<eT>::n_rows) = 1; 00731 access::rw(Mat<eT>::n_cols) = fixed_n_elem; 00732 access::rw(Mat<eT>::n_elem) = fixed_n_elem; 00733 access::rw(Mat<eT>::vec_state) = 2; 00734 access::rw(Mat<eT>::mem_state) = 3; 00735 00736 if(copy_aux_mem == true) 00737 { 00738 eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; 00739 00740 access::rw(Mat<eT>::mem) = dest; 00741 00742 arrayops::copy( dest, aux_mem, fixed_n_elem ); 00743 } 00744 else 00745 { 00746 access::rw(Mat<eT>::mem) = aux_mem; 00747 } 00748 } 00749 00750 00751 00752 template<typename eT> 00753 template<uword fixed_n_elem> 00754 inline 00755 Row<eT>::fixed<fixed_n_elem>::fixed(const eT* aux_mem) 00756 { 00757 arma_extra_debug_sigprint_this(this); 00758 00759 mem_setup(); 00760 00761 arrayops::copy( const_cast<eT*>(Mat<eT>::mem), aux_mem, fixed_n_elem ); 00762 } 00763 00764 00765 00766 template<typename eT> 00767 template<uword fixed_n_elem> 00768 inline 00769 Row<eT>::fixed<fixed_n_elem>::fixed(const char* text) 00770 { 00771 arma_extra_debug_sigprint_this(this); 00772 00773 mem_setup(); 00774 00775 Row<eT>::operator=(text); 00776 } 00777 00778 00779 00780 template<typename eT> 00781 template<uword fixed_n_elem> 00782 inline 00783 Row<eT>::fixed<fixed_n_elem>::fixed(const std::string& text) 00784 { 00785 arma_extra_debug_sigprint_this(this); 00786 00787 mem_setup(); 00788 00789 Row<eT>::operator=(text); 00790 } 00791 00792 00793 00794 template<typename eT> 00795 template<uword fixed_n_elem> 00796 inline 00797 subview_row<eT> 00798 Row<eT>::fixed<fixed_n_elem>::operator()(const uword row_num, const span& col_span) 00799 { 00800 arma_extra_debug_sigprint(); 00801 00802 return Mat<eT>::operator()(row_num, col_span); 00803 } 00804 00805 00806 00807 template<typename eT> 00808 template<uword fixed_n_elem> 00809 template<typename T1> 00810 const Row<eT>& 00811 Row<eT>::fixed<fixed_n_elem>::operator=(const Base<eT,T1>& A) 00812 { 00813 arma_extra_debug_sigprint(); 00814 00815 Row<eT>::operator=(A.get_ref()); 00816 00817 return *this; 00818 } 00819 00820 00821 00822 template<typename eT> 00823 template<uword fixed_n_elem> 00824 const Row<eT>& 00825 Row<eT>::fixed<fixed_n_elem>::operator=(const eT val) 00826 { 00827 arma_extra_debug_sigprint(); 00828 00829 Row<eT>::operator=(val); 00830 00831 return *this; 00832 } 00833 00834 00835 00836 template<typename eT> 00837 template<uword fixed_n_elem> 00838 const Row<eT>& 00839 Row<eT>::fixed<fixed_n_elem>::operator=(const char* text) 00840 { 00841 arma_extra_debug_sigprint(); 00842 00843 Row<eT>::operator=(text); 00844 00845 return *this; 00846 } 00847 00848 00849 00850 template<typename eT> 00851 template<uword fixed_n_elem> 00852 const Row<eT>& 00853 Row<eT>::fixed<fixed_n_elem>::operator=(const std::string& text) 00854 { 00855 arma_extra_debug_sigprint(); 00856 00857 Row<eT>::operator=(text); 00858 00859 return *this; 00860 } 00861 00862 00863 00864 template<typename eT> 00865 template<uword fixed_n_elem> 00866 const Row<eT>& 00867 Row<eT>::fixed<fixed_n_elem>::operator=(const subview_cube<eT>& X) 00868 { 00869 arma_extra_debug_sigprint(); 00870 00871 Row<eT>::operator=(X); 00872 00873 return *this; 00874 } 00875 00876 00877 00878 template<typename eT> 00879 template<uword fixed_n_elem> 00880 inline 00881 const subview_row<eT> 00882 Row<eT>::fixed<fixed_n_elem>::operator()(const uword row_num, const span& col_span) const 00883 { 00884 arma_extra_debug_sigprint(); 00885 00886 return Mat<eT>::operator()(row_num, col_span); 00887 } 00888 00889 00890 00891 template<typename eT> 00892 template<uword fixed_n_elem> 00893 inline 00894 subview_col<eT> 00895 Row<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const uword col_num) 00896 { 00897 arma_extra_debug_sigprint(); 00898 00899 return Mat<eT>::operator()(row_span, col_num); 00900 } 00901 00902 00903 00904 template<typename eT> 00905 template<uword fixed_n_elem> 00906 inline 00907 const subview_col<eT> 00908 Row<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const uword col_num) const 00909 { 00910 arma_extra_debug_sigprint(); 00911 00912 return Mat<eT>::operator()(row_span, col_num); 00913 } 00914 00915 00916 00917 template<typename eT> 00918 template<uword fixed_n_elem> 00919 inline 00920 subview<eT> 00921 Row<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const span& col_span) 00922 { 00923 arma_extra_debug_sigprint(); 00924 00925 return Mat<eT>::operator()(row_span, col_span); 00926 } 00927 00928 00929 00930 template<typename eT> 00931 template<uword fixed_n_elem> 00932 inline 00933 const subview<eT> 00934 Row<eT>::fixed<fixed_n_elem>::operator()(const span& row_span, const span& col_span) const 00935 { 00936 arma_extra_debug_sigprint(); 00937 00938 return Mat<eT>::operator()(row_span, col_span); 00939 } 00940 00941 00942 00943 template<typename eT> 00944 template<uword fixed_n_elem> 00945 arma_inline 00946 arma_warn_unused 00947 eT& 00948 Row<eT>::fixed<fixed_n_elem>::operator[] (const uword i) 00949 { 00950 return access::rw( Mat<eT>::mem[i] ); 00951 } 00952 00953 00954 00955 template<typename eT> 00956 template<uword fixed_n_elem> 00957 arma_inline 00958 arma_warn_unused 00959 eT 00960 Row<eT>::fixed<fixed_n_elem>::operator[] (const uword i) const 00961 { 00962 return ( Mat<eT>::mem[i] ); 00963 } 00964 00965 00966 00967 template<typename eT> 00968 template<uword fixed_n_elem> 00969 arma_inline 00970 arma_warn_unused 00971 eT& 00972 Row<eT>::fixed<fixed_n_elem>::at(const uword i) 00973 { 00974 return access::rw( Mat<eT>::mem[i] ); 00975 } 00976 00977 00978 00979 template<typename eT> 00980 template<uword fixed_n_elem> 00981 arma_inline 00982 arma_warn_unused 00983 eT 00984 Row<eT>::fixed<fixed_n_elem>::at(const uword i) const 00985 { 00986 return ( Mat<eT>::mem[i] ); 00987 } 00988 00989 00990 00991 template<typename eT> 00992 template<uword fixed_n_elem> 00993 arma_inline 00994 arma_warn_unused 00995 eT& 00996 Row<eT>::fixed<fixed_n_elem>::operator() (const uword i) 00997 { 00998 arma_debug_check( (i >= fixed_n_elem), "Row::fixed::operator(): out of bounds"); 00999 01000 return access::rw( Mat<eT>::mem[i] ); 01001 } 01002 01003 01004 01005 template<typename eT> 01006 template<uword fixed_n_elem> 01007 arma_inline 01008 arma_warn_unused 01009 eT 01010 Row<eT>::fixed<fixed_n_elem>::operator() (const uword i) const 01011 { 01012 arma_debug_check( (i >= fixed_n_elem), "Row::fixed::operator(): out of bounds"); 01013 01014 return ( Mat<eT>::mem[i] ); 01015 } 01016 01017 01018 01019 template<typename eT> 01020 template<uword fixed_n_elem> 01021 arma_inline 01022 arma_warn_unused 01023 eT& 01024 Row<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col) 01025 { 01026 return access::rw( Mat<eT>::mem[in_col] ); 01027 } 01028 01029 01030 01031 template<typename eT> 01032 template<uword fixed_n_elem> 01033 arma_inline 01034 arma_warn_unused 01035 eT 01036 Row<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col) const 01037 { 01038 return ( Mat<eT>::mem[in_col] ); 01039 } 01040 01041 01042 01043 template<typename eT> 01044 template<uword fixed_n_elem> 01045 arma_inline 01046 arma_warn_unused 01047 eT& 01048 Row<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword in_col) 01049 { 01050 arma_debug_check( ((in_row >= 1) || (in_col >= fixed_n_elem)), "Row::fixed::operator(): out of bounds" ); 01051 01052 return access::rw( Mat<eT>::mem[in_col] ); 01053 } 01054 01055 01056 01057 template<typename eT> 01058 template<uword fixed_n_elem> 01059 arma_inline 01060 arma_warn_unused 01061 eT 01062 Row<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword in_col) const 01063 { 01064 arma_debug_check( ((in_row >= 1) || (in_col >= fixed_n_elem)), "Row::fixed::operator(): out of bounds" ); 01065 01066 return ( Mat<eT>::mem[in_col] ); 01067 } 01068 01069 01070 01071 template<typename eT> 01072 template<uword fixed_n_elem> 01073 arma_hot 01074 inline 01075 const Row<eT>& 01076 Row<eT>::fixed<fixed_n_elem>::fill(const eT val) 01077 { 01078 arma_extra_debug_sigprint(); 01079 01080 arrayops::inplace_set( const_cast<eT*>(Mat<eT>::mem), val, fixed_n_elem ); 01081 01082 return *this; 01083 } 01084 01085 01086 01087 template<typename eT> 01088 template<uword fixed_n_elem> 01089 arma_hot 01090 inline 01091 const Row<eT>& 01092 Row<eT>::fixed<fixed_n_elem>::zeros() 01093 { 01094 arma_extra_debug_sigprint(); 01095 01096 arrayops::inplace_set( const_cast<eT*>(Mat<eT>::mem), eT(0), fixed_n_elem ); 01097 01098 return *this; 01099 } 01100 01101 01102 01103 template<typename eT> 01104 template<uword fixed_n_elem> 01105 arma_hot 01106 inline 01107 const Row<eT>& 01108 Row<eT>::fixed<fixed_n_elem>::ones() 01109 { 01110 arma_extra_debug_sigprint(); 01111 01112 arrayops::inplace_set( const_cast<eT*>(Mat<eT>::mem), eT(1), fixed_n_elem ); 01113 01114 return *this; 01115 } 01116 01117 01118 01119 #ifdef ARMA_EXTRA_ROW_MEAT 01120 #include ARMA_INCFILE_WRAP(ARMA_EXTRA_ROW_MEAT) 01121 #endif 01122 01123 01124