max@0: // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2008-2011 Conrad Sanderson max@0: // max@0: // This file is part of the Armadillo C++ library. max@0: // It is provided without any warranty of fitness max@0: // for any purpose. You can redistribute this file max@0: // and/or modify it under the terms of the GNU max@0: // Lesser General Public License (LGPL) as published max@0: // by the Free Software Foundation, either version 3 max@0: // of the License or (at your option) any later version. max@0: // (see http://www.opensource.org/licenses for more info) max@0: max@0: max@0: //! \addtogroup Col max@0: //! @{ max@0: max@0: max@0: //! construct an empty column vector max@0: template max@0: inline max@0: Col::Col() max@0: : Mat(0, 1) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: Col::Col(const Col& X) max@0: : Mat(X.n_elem, 1) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: max@0: arrayops::copy((*this).memptr(), X.memptr(), X.n_elem); max@0: } max@0: max@0: max@0: max@0: //! construct a column vector with the specified number of n_elem max@0: template max@0: inline max@0: Col::Col(const uword in_n_elem) max@0: : Mat(in_n_elem, 1) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: Col::Col(const uword in_n_rows, const uword in_n_cols) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: max@0: Mat::init_warm(in_n_rows, in_n_cols); max@0: } max@0: max@0: max@0: max@0: //! construct a column vector from specified text max@0: template max@0: inline max@0: Col::Col(const char* text) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 2; max@0: max@0: Mat::operator=(text); max@0: max@0: std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: } max@0: max@0: max@0: max@0: //! construct a column vector from specified text max@0: template max@0: inline max@0: const Col& max@0: Col::operator=(const char* text) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 2; max@0: max@0: Mat::operator=(text); max@0: max@0: std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: //! construct a column vector from specified text max@0: template max@0: inline max@0: Col::Col(const std::string& text) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 2; max@0: max@0: Mat::operator=(text); max@0: max@0: std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: } max@0: max@0: max@0: max@0: //! construct a column vector from specified text max@0: template max@0: inline max@0: const Col& max@0: Col::operator=(const std::string& text) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 2; max@0: max@0: Mat::operator=(text); max@0: max@0: std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: #if defined(ARMA_USE_CXX11) max@0: max@0: template max@0: inline max@0: Col::Col(const std::initializer_list& list) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 2; max@0: max@0: Mat::operator=(list); max@0: max@0: std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: const Col& max@0: Col::operator=(const std::initializer_list& list) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 2; max@0: max@0: Mat::operator=(list); max@0: max@0: std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: max@0: return *this; max@0: } max@0: max@0: #endif max@0: max@0: max@0: max@0: template max@0: inline max@0: const Col& max@0: Col::operator=(const eT val) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: Mat::operator=(val); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: Col::Col(const Base& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: max@0: Mat::operator=(X.get_ref()); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: const Col& max@0: Col::operator=(const Base& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: Mat::operator=(X.get_ref()); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: //! construct a column vector from a given auxiliary array of eTs max@0: template max@0: inline max@0: Col::Col(eT* aux_mem, const uword aux_length, const bool copy_aux_mem, const bool strict) max@0: : Mat(aux_mem, aux_length, 1, copy_aux_mem, strict) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: } max@0: max@0: max@0: max@0: //! construct a column vector from a given auxiliary array of eTs max@0: template max@0: inline max@0: Col::Col(const eT* aux_mem, const uword aux_length) max@0: : Mat(aux_mem, aux_length, 1) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: Col::Col max@0: ( max@0: const Base::pod_type, T1>& A, max@0: const Base::pod_type, T2>& B max@0: ) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: max@0: Mat::init(A,B); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: Col::Col(const BaseCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: max@0: Mat::operator=(X); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: const Col& max@0: Col::operator=(const BaseCube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: Mat::operator=(X); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: Col::Col(const subview_cube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::vec_state) = 1; max@0: max@0: Mat::operator=(X); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: const Col& max@0: Col::operator=(const subview_cube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: Mat::operator=(X); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: mat_injector< Col > max@0: Col::operator<<(const eT val) max@0: { max@0: return mat_injector< Col >(*this, val); max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: eT& max@0: Col::row(const uword row_num) max@0: { max@0: arma_debug_check( (row_num >= Mat::n_rows), "Col::row(): out of bounds" ); max@0: max@0: return access::rw(Mat::mem[row_num]); max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: eT max@0: Col::row(const uword row_num) const max@0: { max@0: arma_debug_check( (row_num >= Mat::n_rows), "Col::row(): out of bounds" ); max@0: max@0: return Mat::mem[row_num]; max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: subview_col max@0: Col::rows(const uword in_row1, const uword in_row2) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used"); max@0: max@0: const uword subview_n_rows = in_row2 - in_row1 + 1; max@0: max@0: return subview_col(*this, 0, in_row1, subview_n_rows); max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: const subview_col max@0: Col::rows(const uword in_row1, const uword in_row2) const max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used"); max@0: max@0: const uword subview_n_rows = in_row2 - in_row1 + 1; max@0: max@0: return subview_col(*this, 0, in_row1, subview_n_rows); max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: subview_col max@0: Col::subvec(const uword in_row1, const uword in_row2) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used"); max@0: max@0: const uword subview_n_rows = in_row2 - in_row1 + 1; max@0: max@0: return subview_col(*this, 0, in_row1, subview_n_rows); max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: const subview_col max@0: Col::subvec(const uword in_row1, const uword in_row2) const max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used"); max@0: max@0: const uword subview_n_rows = in_row2 - in_row1 + 1; max@0: max@0: return subview_col(*this, 0, in_row1, subview_n_rows); max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: subview_col max@0: Col::subvec(const span& row_span) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: const bool row_all = row_span.whole; max@0: max@0: const uword local_n_rows = Mat::n_rows; max@0: max@0: const uword in_row1 = row_all ? 0 : row_span.a; max@0: const uword in_row2 = row_span.b; max@0: const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; max@0: max@0: arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used"); max@0: max@0: return subview_col(*this, 0, in_row1, subvec_n_rows); max@0: } max@0: max@0: max@0: max@0: template max@0: arma_inline max@0: const subview_col max@0: Col::subvec(const span& row_span) const max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: const bool row_all = row_span.whole; max@0: max@0: const uword local_n_rows = Mat::n_rows; max@0: max@0: const uword in_row1 = row_all ? 0 : row_span.a; max@0: const uword in_row2 = row_span.b; max@0: const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; max@0: max@0: arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used"); max@0: max@0: return subview_col(*this, 0, in_row1, subvec_n_rows); max@0: } max@0: max@0: max@0: max@0: // template max@0: // arma_inline max@0: // subview_col max@0: // Col::operator()(const span& row_span) max@0: // { max@0: // arma_extra_debug_sigprint(); max@0: // max@0: // return subvec(row_span); max@0: // } max@0: // max@0: // max@0: // max@0: // template max@0: // arma_inline max@0: // const subview_col max@0: // Col::operator()(const span& row_span) const max@0: // { max@0: // arma_extra_debug_sigprint(); max@0: // max@0: // return subvec(row_span); max@0: // } max@0: max@0: max@0: max@0: //! remove specified row max@0: template max@0: inline max@0: void max@0: Col::shed_row(const uword row_num) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_debug_check( row_num >= Mat::n_rows, "Col::shed_row(): out of bounds"); max@0: max@0: shed_rows(row_num, row_num); max@0: } max@0: max@0: max@0: max@0: //! remove specified rows max@0: template max@0: inline max@0: void max@0: Col::shed_rows(const uword in_row1, const uword in_row2) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_debug_check max@0: ( max@0: (in_row1 > in_row2) || (in_row2 >= Mat::n_rows), max@0: "Col::shed_rows(): indices out of bounds or incorrectly used" max@0: ); max@0: max@0: const uword n_keep_front = in_row1; max@0: const uword n_keep_back = Mat::n_rows - (in_row2 + 1); max@0: max@0: Col X(n_keep_front + n_keep_back); max@0: max@0: eT* X_mem = X.memptr(); max@0: const eT* t_mem = (*this).memptr(); max@0: max@0: if(n_keep_front > 0) max@0: { max@0: arrayops::copy( X_mem, t_mem, n_keep_front ); max@0: } max@0: max@0: if(n_keep_back > 0) max@0: { max@0: arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_row2+1]), n_keep_back); max@0: } max@0: max@0: Mat::steal_mem(X); max@0: } max@0: max@0: max@0: max@0: //! insert N rows at the specified row position, max@0: //! optionally setting the elements of the inserted rows to zero max@0: template max@0: inline max@0: void max@0: Col::insert_rows(const uword row_num, const uword N, const bool set_to_zero) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: const uword t_n_rows = Mat::n_rows; max@0: max@0: const uword A_n_rows = row_num; max@0: const uword B_n_rows = t_n_rows - row_num; max@0: max@0: // insertion at row_num == n_rows is in effect an append operation max@0: arma_debug_check( (row_num > t_n_rows), "Col::insert_rows(): out of bounds"); max@0: max@0: if(N > 0) max@0: { max@0: Col out(t_n_rows + N); max@0: max@0: eT* out_mem = out.memptr(); max@0: const eT* t_mem = (*this).memptr(); max@0: max@0: if(A_n_rows > 0) max@0: { max@0: arrayops::copy( out_mem, t_mem, A_n_rows ); max@0: } max@0: max@0: if(B_n_rows > 0) max@0: { max@0: arrayops::copy( &(out_mem[row_num + N]), &(t_mem[row_num]), B_n_rows ); max@0: } max@0: max@0: if(set_to_zero == true) max@0: { max@0: arrayops::inplace_set( &(out_mem[row_num]), eT(0), N ); max@0: } max@0: max@0: Mat::steal_mem(out); max@0: } max@0: } max@0: max@0: max@0: max@0: //! insert the given object at the specified row position; max@0: //! the given object must have one column max@0: template max@0: template max@0: inline max@0: void max@0: Col::insert_rows(const uword row_num, const Base& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: Mat::insert_rows(row_num, X); max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: typename Col::row_iterator max@0: Col::begin_row(const uword row_num) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_debug_check( (row_num >= Mat::n_rows), "begin_row(): index out of bounds"); max@0: max@0: return Mat::memptr() + row_num; max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: typename Col::const_row_iterator max@0: Col::begin_row(const uword row_num) const max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_debug_check( (row_num >= Mat::n_rows), "begin_row(): index out of bounds"); max@0: max@0: return Mat::memptr() + row_num; max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: typename Col::row_iterator max@0: Col::end_row(const uword row_num) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_debug_check( (row_num >= Mat::n_rows), "end_row(): index out of bounds"); max@0: max@0: return Mat::memptr() + row_num + 1; max@0: } max@0: max@0: max@0: max@0: template max@0: inline max@0: typename Col::const_row_iterator max@0: Col::end_row(const uword row_num) const max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arma_debug_check( (row_num >= Mat::n_rows), "end_row(): index out of bounds"); max@0: max@0: return Mat::memptr() + row_num + 1; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: void max@0: Col::fixed::mem_setup() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::n_rows) = fixed_n_elem; max@0: access::rw(Mat::n_cols) = 1; max@0: access::rw(Mat::n_elem) = fixed_n_elem; max@0: access::rw(Mat::vec_state) = 1; max@0: access::rw(Mat::mem_state) = 3; max@0: access::rw(Mat::mem) = (use_extra) ? mem_local_extra : Mat::mem_local; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: void max@0: Col::fixed::change_to_row() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: access::rw(Mat::n_cols) = fixed_n_elem; max@0: access::rw(Mat::n_rows) = 1; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: Col::fixed::fixed() max@0: { max@0: arma_extra_debug_sigprint_this(this); max@0: max@0: mem_setup(); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: Col::fixed::fixed(const fixed& X) max@0: { max@0: arma_extra_debug_sigprint_this(this); max@0: max@0: mem_setup(); max@0: max@0: eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; max@0: max@0: arrayops::copy( dest, X.mem, fixed_n_elem ); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: Col::fixed::fixed(const subview_cube& X) max@0: { max@0: arma_extra_debug_sigprint_this(this); max@0: max@0: mem_setup(); max@0: max@0: Col::operator=(X); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: template max@0: inline max@0: Col::fixed::fixed(const Base& A) max@0: { max@0: arma_extra_debug_sigprint_this(this); max@0: max@0: mem_setup(); max@0: max@0: Col::operator=(A.get_ref()); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: template max@0: inline max@0: Col::fixed::fixed(const Base& A, const Base& B) max@0: { max@0: arma_extra_debug_sigprint_this(this); max@0: max@0: mem_setup(); max@0: max@0: Col::init(A,B); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: Col::fixed::fixed(eT* aux_mem, const bool copy_aux_mem) max@0: { max@0: arma_extra_debug_sigprint_this(this); max@0: max@0: access::rw(Mat::n_rows) = fixed_n_elem; max@0: access::rw(Mat::n_cols) = 1; max@0: access::rw(Mat::n_elem) = fixed_n_elem; max@0: access::rw(Mat::vec_state) = 1; max@0: access::rw(Mat::mem_state) = 3; max@0: max@0: if(copy_aux_mem == true) max@0: { max@0: eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; max@0: max@0: access::rw(Mat::mem) = dest; max@0: max@0: arrayops::copy( dest, aux_mem, fixed_n_elem ); max@0: } max@0: else max@0: { max@0: access::rw(Mat::mem) = aux_mem; max@0: } max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: Col::fixed::fixed(const eT* aux_mem) max@0: { max@0: arma_extra_debug_sigprint_this(this); max@0: max@0: mem_setup(); max@0: max@0: arrayops::copy( const_cast(Mat::mem), aux_mem, fixed_n_elem ); max@0: } max@0: max@0: max@0: max@0: //! NOTE: this function relies on max@0: //! Col::operator=(text), to change vec_state as well as swapping n_rows and n_cols, max@0: //! and Mat::init(), to check that the given vector will not have a different size than fixed_n_elem. max@0: template max@0: template max@0: inline max@0: Col::fixed::fixed(const char* text) max@0: { max@0: arma_extra_debug_sigprint_this(this); max@0: max@0: mem_setup(); max@0: max@0: change_to_row(); max@0: max@0: Col::operator=(text); max@0: } max@0: max@0: max@0: max@0: //! NOTE: this function relies on max@0: //! Col::operator=(text), to change vec_state as well as swapping n_rows and n_cols, max@0: //! and Mat::init(), to check that the given vector will not have a different size than fixed_n_elem. max@0: template max@0: template max@0: inline max@0: Col::fixed::fixed(const std::string& text) max@0: { max@0: arma_extra_debug_sigprint_this(this); max@0: max@0: mem_setup(); max@0: max@0: change_to_row(); max@0: max@0: Col::operator=(text); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: template max@0: const Col& max@0: Col::fixed::operator=(const Base& A) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: Col::operator=(A.get_ref()); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: const Col& max@0: Col::fixed::operator=(const eT val) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: Col::operator=(val); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: const Col& max@0: Col::fixed::operator=(const char* text) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: change_to_row(); max@0: max@0: Col::operator=(text); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: const Col& max@0: Col::fixed::operator=(const std::string& text) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: change_to_row(); max@0: max@0: Col::operator=(text); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: const Col& max@0: Col::fixed::operator=(const subview_cube& X) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: Col::operator=(X); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: subview_row max@0: Col::fixed::operator()(const uword row_num, const span& col_span) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: return Mat::operator()(row_num, col_span); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: const subview_row max@0: Col::fixed::operator()(const uword row_num, const span& col_span) const max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: return Mat::operator()(row_num, col_span); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: subview_col max@0: Col::fixed::operator()(const span& row_span, const uword col_num) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: return Mat::operator()(row_span, col_num); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: const subview_col max@0: Col::fixed::operator()(const span& row_span, const uword col_num) const max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: return Mat::operator()(row_span, col_num); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: subview max@0: Col::fixed::operator()(const span& row_span, const span& col_span) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: return Mat::operator()(row_span, col_span); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: inline max@0: const subview max@0: Col::fixed::operator()(const span& row_span, const span& col_span) const max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: return Mat::operator()(row_span, col_span); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: arma_warn_unused max@0: eT& max@0: Col::fixed::operator[] (const uword i) max@0: { max@0: return access::rw( Mat::mem[i] ); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: arma_warn_unused max@0: eT max@0: Col::fixed::operator[] (const uword i) const max@0: { max@0: return ( Mat::mem[i] ); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: arma_warn_unused max@0: eT& max@0: Col::fixed::at(const uword i) max@0: { max@0: return access::rw( Mat::mem[i] ); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: arma_warn_unused max@0: eT max@0: Col::fixed::at(const uword i) const max@0: { max@0: return ( Mat::mem[i] ); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: arma_warn_unused max@0: eT& max@0: Col::fixed::operator() (const uword i) max@0: { max@0: arma_debug_check( (i >= fixed_n_elem), "Col::fixed::operator(): out of bounds"); max@0: max@0: return access::rw( Mat::mem[i] ); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: arma_warn_unused max@0: eT max@0: Col::fixed::operator() (const uword i) const max@0: { max@0: arma_debug_check( (i >= fixed_n_elem), "Col::fixed::operator(): out of bounds"); max@0: max@0: return ( Mat::mem[i] ); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: arma_warn_unused max@0: eT& max@0: Col::fixed::at(const uword in_row, const uword in_col) max@0: { max@0: return access::rw( Mat::mem[in_row] ); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: arma_warn_unused max@0: eT max@0: Col::fixed::at(const uword in_row, const uword in_col) const max@0: { max@0: return ( Mat::mem[in_row] ); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: arma_warn_unused max@0: eT& max@0: Col::fixed::operator() (const uword in_row, const uword in_col) max@0: { max@0: arma_debug_check( ((in_row >= fixed_n_elem) || (in_col >= 1)), "Col::fixed::operator(): out of bounds" ); max@0: max@0: return access::rw( Mat::mem[in_row] ); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_inline max@0: arma_warn_unused max@0: eT max@0: Col::fixed::operator() (const uword in_row, const uword in_col) const max@0: { max@0: arma_debug_check( ((in_row >= fixed_n_elem) || (in_col >= 1)), "Col::fixed::operator(): out of bounds" ); max@0: max@0: return ( Mat::mem[in_row] ); max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_hot max@0: inline max@0: const Col& max@0: Col::fixed::fill(const eT val) max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arrayops::inplace_set( const_cast(Mat::mem), val, fixed_n_elem ); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_hot max@0: inline max@0: const Col& max@0: Col::fixed::zeros() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arrayops::inplace_set( const_cast(Mat::mem), eT(0), fixed_n_elem ); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: template max@0: template max@0: arma_hot max@0: inline max@0: const Col& max@0: Col::fixed::ones() max@0: { max@0: arma_extra_debug_sigprint(); max@0: max@0: arrayops::inplace_set( const_cast(Mat::mem), eT(1), fixed_n_elem ); max@0: max@0: return *this; max@0: } max@0: max@0: max@0: max@0: #ifdef ARMA_EXTRA_COL_MEAT max@0: #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_MEAT) max@0: #endif max@0: max@0: max@0: max@0: //! @}