// Copyright (C) 2008-2015 National ICT Australia (NICTA) // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. // ------------------------------------------------------------------- // // Written by Conrad Sanderson - http://conradsanderson.id.au //! \addtogroup Col //! @{ //! construct an empty column vector template inline Col::Col() : Mat(arma_vec_indicator(), 1) { arma_extra_debug_sigprint(); } template inline Col::Col(const Col& X) : Mat(arma_vec_indicator(), X.n_elem, 1, 1) { arma_extra_debug_sigprint(); arrayops::copy((*this).memptr(), X.memptr(), X.n_elem); } //! construct a column vector with the specified number of n_elem template inline Col::Col(const uword in_n_elem) : Mat(arma_vec_indicator(), in_n_elem, 1, 1) { arma_extra_debug_sigprint(); } template inline Col::Col(const uword in_n_rows, const uword in_n_cols) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_extra_debug_sigprint(); Mat::init_warm(in_n_rows, in_n_cols); } template inline Col::Col(const SizeMat& s) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_extra_debug_sigprint(); Mat::init_warm(s.n_rows, s.n_cols); } template template inline Col::Col(const uword in_n_elem, const fill::fill_class& f) : Mat(arma_vec_indicator(), in_n_elem, 1, 1) { arma_extra_debug_sigprint(); (*this).fill(f); } template template inline Col::Col(const uword in_n_rows, const uword in_n_cols, const fill::fill_class& f) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_extra_debug_sigprint(); Mat::init_warm(in_n_rows, in_n_cols); (*this).fill(f); } template template inline Col::Col(const SizeMat& s, const fill::fill_class& f) : Mat(arma_vec_indicator(), 0, 0, 1) { arma_extra_debug_sigprint(); Mat::init_warm(s.n_rows, s.n_cols); (*this).fill(f); } //! construct a column vector from specified text template inline Col::Col(const char* text) { arma_extra_debug_sigprint(); access::rw(Mat::vec_state) = 2; Mat::operator=(text); std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); access::rw(Mat::vec_state) = 1; } //! construct a column vector from specified text template inline const Col& Col::operator=(const char* text) { arma_extra_debug_sigprint(); access::rw(Mat::vec_state) = 2; Mat::operator=(text); std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); access::rw(Mat::vec_state) = 1; return *this; } //! construct a column vector from specified text template inline Col::Col(const std::string& text) { arma_extra_debug_sigprint(); access::rw(Mat::vec_state) = 2; Mat::operator=(text); std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); access::rw(Mat::vec_state) = 1; } //! construct a column vector from specified text template inline const Col& Col::operator=(const std::string& text) { arma_extra_debug_sigprint(); access::rw(Mat::vec_state) = 2; Mat::operator=(text); std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); access::rw(Mat::vec_state) = 1; return *this; } //! create a column vector from std::vector template inline Col::Col(const std::vector& x) : Mat(arma_vec_indicator(), uword(x.size()), 1, 1) { arma_extra_debug_sigprint_this(this); if(x.size() > 0) { arrayops::copy( Mat::memptr(), &(x[0]), uword(x.size()) ); } } //! create a column vector from std::vector template inline const Col& Col::operator=(const std::vector& x) { arma_extra_debug_sigprint(); Mat::init_warm(uword(x.size()), 1); if(x.size() > 0) { arrayops::copy( Mat::memptr(), &(x[0]), uword(x.size()) ); } return *this; } #if defined(ARMA_USE_CXX11) template inline Col::Col(const std::initializer_list& list) { arma_extra_debug_sigprint(); access::rw(Mat::vec_state) = 2; Mat::operator=(list); std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); access::rw(Mat::vec_state) = 1; } template inline const Col& Col::operator=(const std::initializer_list& list) { arma_extra_debug_sigprint(); access::rw(Mat::vec_state) = 2; Mat::operator=(list); std::swap( access::rw(Mat::n_rows), access::rw(Mat::n_cols) ); access::rw(Mat::vec_state) = 1; return *this; } template inline Col::Col(Col&& X) : Mat(arma_vec_indicator(), 1) { arma_extra_debug_sigprint(arma_str::format("this = %x X = %x") % this % &X); access::rw(Mat::n_rows) = X.n_rows; access::rw(Mat::n_cols) = 1; access::rw(Mat::n_elem) = X.n_elem; if( ((X.mem_state == 0) && (X.n_elem > arma_config::mat_prealloc)) || (X.mem_state == 1) || (X.mem_state == 2) ) { access::rw(Mat::mem_state) = X.mem_state; access::rw(Mat::mem) = X.mem; access::rw(X.n_rows) = 0; access::rw(X.n_cols) = 1; access::rw(X.n_elem) = 0; access::rw(X.mem_state) = 0; access::rw(X.mem) = 0; } else { (*this).init_cold(); arrayops::copy( (*this).memptr(), X.mem, X.n_elem ); if( (X.mem_state == 0) && (X.n_elem <= arma_config::mat_prealloc) ) { access::rw(X.n_rows) = 0; access::rw(X.n_cols) = 1; access::rw(X.n_elem) = 0; access::rw(X.mem) = 0; } } } template inline const Col& Col::operator=(Col&& X) { arma_extra_debug_sigprint(arma_str::format("this = %x X = %x") % this % &X); (*this).steal_mem(X); if( (X.mem_state == 0) && (X.n_elem <= arma_config::mat_prealloc) && (this != &X) ) { access::rw(X.n_rows) = 0; access::rw(X.n_cols) = 1; access::rw(X.n_elem) = 0; access::rw(X.mem) = 0; } return *this; } #endif template inline Col::Col(const SpCol& X) : Mat(arma_vec_indicator(), X.n_elem, 1, 1) { arma_extra_debug_sigprint_this(this); arrayops::inplace_set(Mat::memptr(), eT(0), X.n_elem); for(typename SpCol::const_iterator it = X.begin(); it != X.end(); ++it) { at(it.row()) = (*it); } } template inline const Col& Col::operator=(const eT val) { arma_extra_debug_sigprint(); Mat::operator=(val); return *this; } template inline const Col& Col::operator=(const Col& X) { arma_extra_debug_sigprint(); Mat::operator=(X); return *this; } template template inline Col::Col(const Base& X) : Mat(arma_vec_indicator(), 1) { arma_extra_debug_sigprint(); Mat::operator=(X.get_ref()); } template template inline const Col& Col::operator=(const Base& X) { arma_extra_debug_sigprint(); Mat::operator=(X.get_ref()); return *this; } //! construct a column vector from a given auxiliary array of eTs template inline Col::Col(eT* aux_mem, const uword aux_length, const bool copy_aux_mem, const bool strict) : Mat(aux_mem, aux_length, 1, copy_aux_mem, strict) { arma_extra_debug_sigprint(); access::rw(Mat::vec_state) = 1; } //! construct a column vector from a given auxiliary array of eTs template inline Col::Col(const eT* aux_mem, const uword aux_length) : Mat(aux_mem, aux_length, 1) { arma_extra_debug_sigprint(); access::rw(Mat::vec_state) = 1; } template template inline Col::Col ( const Base::pod_type, T1>& A, const Base::pod_type, T2>& B ) { arma_extra_debug_sigprint(); access::rw(Mat::vec_state) = 1; Mat::init(A,B); } template template inline Col::Col(const BaseCube& X) { arma_extra_debug_sigprint(); access::rw(Mat::vec_state) = 1; Mat::operator=(X); } template template inline const Col& Col::operator=(const BaseCube& X) { arma_extra_debug_sigprint(); Mat::operator=(X); return *this; } template inline Col::Col(const subview_cube& X) { arma_extra_debug_sigprint(); access::rw(Mat::vec_state) = 1; Mat::operator=(X); } template inline const Col& Col::operator=(const subview_cube& X) { arma_extra_debug_sigprint(); Mat::operator=(X); return *this; } template inline mat_injector< Col > Col::operator<<(const eT val) { return mat_injector< Col >(*this, val); } template arma_inline const Op,op_htrans> Col::t() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_htrans> Col::ht() const { return Op,op_htrans>(*this); } template arma_inline const Op,op_strans> Col::st() const { return Op,op_strans>(*this); } template arma_inline subview_col Col::row(const uword in_row1) { arma_extra_debug_sigprint(); arma_debug_check( (in_row1 >= Mat::n_rows), "Col::row(): indices out of bounds or incorrectly used"); return subview_col(*this, 0, in_row1, 1); } template arma_inline const subview_col Col::row(const uword in_row1) const { arma_extra_debug_sigprint(); arma_debug_check( (in_row1 >= Mat::n_rows), "Col::row(): indices out of bounds or incorrectly used"); return subview_col(*this, 0, in_row1, 1); } template arma_inline subview_col Col::rows(const uword in_row1, const uword in_row2) { arma_extra_debug_sigprint(); arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used"); const uword subview_n_rows = in_row2 - in_row1 + 1; return subview_col(*this, 0, in_row1, subview_n_rows); } template arma_inline const subview_col Col::rows(const uword in_row1, const uword in_row2) const { arma_extra_debug_sigprint(); arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used"); const uword subview_n_rows = in_row2 - in_row1 + 1; return subview_col(*this, 0, in_row1, subview_n_rows); } template arma_inline subview_col Col::subvec(const uword in_row1, const uword in_row2) { arma_extra_debug_sigprint(); arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used"); const uword subview_n_rows = in_row2 - in_row1 + 1; return subview_col(*this, 0, in_row1, subview_n_rows); } template arma_inline const subview_col Col::subvec(const uword in_row1, const uword in_row2) const { arma_extra_debug_sigprint(); arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used"); const uword subview_n_rows = in_row2 - in_row1 + 1; return subview_col(*this, 0, in_row1, subview_n_rows); } template arma_inline subview_col Col::rows(const span& row_span) { arma_extra_debug_sigprint(); return subvec(row_span); } template arma_inline const subview_col Col::rows(const span& row_span) const { arma_extra_debug_sigprint(); return subvec(row_span); } template arma_inline subview_col Col::subvec(const span& row_span) { arma_extra_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = Mat::n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used"); return subview_col(*this, 0, in_row1, subvec_n_rows); } template arma_inline const subview_col Col::subvec(const span& row_span) const { arma_extra_debug_sigprint(); const bool row_all = row_span.whole; const uword local_n_rows = Mat::n_rows; const uword in_row1 = row_all ? 0 : row_span.a; const uword in_row2 = row_span.b; const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used"); return subview_col(*this, 0, in_row1, subvec_n_rows); } template arma_inline subview_col Col::operator()(const span& row_span) { arma_extra_debug_sigprint(); return subvec(row_span); } template arma_inline const subview_col Col::operator()(const span& row_span) const { arma_extra_debug_sigprint(); return subvec(row_span); } template arma_inline subview_col Col::head(const uword N) { arma_extra_debug_sigprint(); arma_debug_check( (N > Mat::n_rows), "Col::head(): size out of bounds"); return subview_col(*this, 0, 0, N); } template arma_inline const subview_col Col::head(const uword N) const { arma_extra_debug_sigprint(); arma_debug_check( (N > Mat::n_rows), "Col::head(): size out of bounds"); return subview_col(*this, 0, 0, N); } template arma_inline subview_col Col::tail(const uword N) { arma_extra_debug_sigprint(); arma_debug_check( (N > Mat::n_rows), "Col::tail(): size out of bounds"); const uword start_row = Mat::n_rows - N; return subview_col(*this, 0, start_row, N); } template arma_inline const subview_col Col::tail(const uword N) const { arma_extra_debug_sigprint(); arma_debug_check( (N > Mat::n_rows), "Col::tail(): size out of bounds"); const uword start_row = Mat::n_rows - N; return subview_col(*this, 0, start_row, N); } template arma_inline subview_col Col::head_rows(const uword N) { arma_extra_debug_sigprint(); return (*this).head(N); } template arma_inline const subview_col Col::head_rows(const uword N) const { arma_extra_debug_sigprint(); return (*this).head(N); } template arma_inline subview_col Col::tail_rows(const uword N) { arma_extra_debug_sigprint(); return (*this).tail(N); } template arma_inline const subview_col Col::tail_rows(const uword N) const { arma_extra_debug_sigprint(); return (*this).tail(N); } //! remove specified row template inline void Col::shed_row(const uword row_num) { arma_extra_debug_sigprint(); arma_debug_check( row_num >= Mat::n_rows, "Col::shed_row(): index out of bounds"); shed_rows(row_num, row_num); } //! remove specified rows template inline void Col::shed_rows(const uword in_row1, const uword in_row2) { arma_extra_debug_sigprint(); arma_debug_check ( (in_row1 > in_row2) || (in_row2 >= Mat::n_rows), "Col::shed_rows(): indices out of bounds or incorrectly used" ); const uword n_keep_front = in_row1; const uword n_keep_back = Mat::n_rows - (in_row2 + 1); Col X(n_keep_front + n_keep_back); eT* X_mem = X.memptr(); const eT* t_mem = (*this).memptr(); if(n_keep_front > 0) { arrayops::copy( X_mem, t_mem, n_keep_front ); } if(n_keep_back > 0) { arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_row2+1]), n_keep_back); } Mat::steal_mem(X); } //! insert N rows at the specified row position, //! optionally setting the elements of the inserted rows to zero template inline void Col::insert_rows(const uword row_num, const uword N, const bool set_to_zero) { arma_extra_debug_sigprint(); const uword t_n_rows = Mat::n_rows; const uword A_n_rows = row_num; const uword B_n_rows = t_n_rows - row_num; // insertion at row_num == n_rows is in effect an append operation arma_debug_check( (row_num > t_n_rows), "Col::insert_rows(): index out of bounds"); if(N > 0) { Col out(t_n_rows + N); eT* out_mem = out.memptr(); const eT* t_mem = (*this).memptr(); if(A_n_rows > 0) { arrayops::copy( out_mem, t_mem, A_n_rows ); } if(B_n_rows > 0) { arrayops::copy( &(out_mem[row_num + N]), &(t_mem[row_num]), B_n_rows ); } if(set_to_zero == true) { arrayops::inplace_set( &(out_mem[row_num]), eT(0), N ); } Mat::steal_mem(out); } } //! insert the given object at the specified row position; //! the given object must have one column template template inline void Col::insert_rows(const uword row_num, const Base& X) { arma_extra_debug_sigprint(); Mat::insert_rows(row_num, X); } template arma_inline arma_warn_unused eT& Col::at(const uword i) { return access::rw(Mat::mem[i]); } template arma_inline arma_warn_unused const eT& Col::at(const uword i) const { return Mat::mem[i]; } template arma_inline arma_warn_unused eT& Col::at(const uword in_row, const uword) { return access::rw( Mat::mem[in_row] ); } template arma_inline arma_warn_unused const eT& Col::at(const uword in_row, const uword) const { return Mat::mem[in_row]; } template inline typename Col::row_iterator Col::begin_row(const uword row_num) { arma_extra_debug_sigprint(); arma_debug_check( (row_num >= Mat::n_rows), "Col::begin_row(): index out of bounds"); return Mat::memptr() + row_num; } template inline typename Col::const_row_iterator Col::begin_row(const uword row_num) const { arma_extra_debug_sigprint(); arma_debug_check( (row_num >= Mat::n_rows), "Col::begin_row(): index out of bounds"); return Mat::memptr() + row_num; } template inline typename Col::row_iterator Col::end_row(const uword row_num) { arma_extra_debug_sigprint(); arma_debug_check( (row_num >= Mat::n_rows), "Col::end_row(): index out of bounds"); return Mat::memptr() + row_num + 1; } template inline typename Col::const_row_iterator Col::end_row(const uword row_num) const { arma_extra_debug_sigprint(); arma_debug_check( (row_num >= Mat::n_rows), "Col::end_row(): index out of bounds"); return Mat::memptr() + row_num + 1; } template template arma_inline void Col::fixed::change_to_row() { arma_extra_debug_sigprint(); access::rw(Mat::n_cols) = fixed_n_elem; access::rw(Mat::n_rows) = 1; } template template arma_inline Col::fixed::fixed() : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_extra_debug_sigprint_this(this); } template template arma_inline Col::fixed::fixed(const fixed& X) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_extra_debug_sigprint_this(this); eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; arrayops::copy( dest, src, fixed_n_elem ); } template template inline Col::fixed::fixed(const subview_cube& X) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_extra_debug_sigprint_this(this); Col::operator=(X); } template template template inline Col::fixed::fixed(const fill::fill_class&) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_extra_debug_sigprint_this(this); if(is_same_type::yes) (*this).zeros(); if(is_same_type::yes) (*this).ones(); if(is_same_type::yes) (*this).eye(); if(is_same_type::yes) (*this).randu(); if(is_same_type::yes) (*this).randn(); } template template template inline Col::fixed::fixed(const Base& A) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_extra_debug_sigprint_this(this); Col::operator=(A.get_ref()); } template template template inline Col::fixed::fixed(const Base& A, const Base& B) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_extra_debug_sigprint_this(this); Col::init(A,B); } template template inline Col::fixed::fixed(const eT* aux_mem) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_extra_debug_sigprint_this(this); eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; arrayops::copy( dest, aux_mem, fixed_n_elem ); } //! NOTE: this function relies on //! Col::operator=(text), to change vec_state as well as swapping n_rows and n_cols, //! and Mat::init(), to check that the given vector will not have a different size than fixed_n_elem. template template inline Col::fixed::fixed(const char* text) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_extra_debug_sigprint_this(this); change_to_row(); Col::operator=(text); } //! NOTE: this function relies on //! Col::operator=(text), to change vec_state as well as swapping n_rows and n_cols, //! and Mat::init(), to check that the given vector will not have a different size than fixed_n_elem. template template inline Col::fixed::fixed(const std::string& text) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_extra_debug_sigprint_this(this); change_to_row(); Col::operator=(text); } template template template const Col& Col::fixed::operator=(const Base& A) { arma_extra_debug_sigprint(); Col::operator=(A.get_ref()); return *this; } template template const Col& Col::fixed::operator=(const eT val) { arma_extra_debug_sigprint(); Col::operator=(val); return *this; } template template const Col& Col::fixed::operator=(const char* text) { arma_extra_debug_sigprint(); change_to_row(); Col::operator=(text); return *this; } template template const Col& Col::fixed::operator=(const std::string& text) { arma_extra_debug_sigprint(); change_to_row(); Col::operator=(text); return *this; } template template const Col& Col::fixed::operator=(const subview_cube& X) { arma_extra_debug_sigprint(); Col::operator=(X); return *this; } #if defined(ARMA_USE_CXX11) template template inline Col::fixed::fixed(const std::initializer_list& list) : Col( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat::mem_local) ) { arma_extra_debug_sigprint_this(this); (*this).operator=(list); } template template inline const Col& Col::fixed::operator=(const std::initializer_list& list) { arma_extra_debug_sigprint(); const uword N = uword(list.size()); arma_debug_check( (N > fixed_n_elem), "Col::fixed: initialiser list is too long" ); eT* this_mem = (*this).memptr(); arrayops::copy( this_mem, list.begin(), N ); for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); } return *this; } #endif template template arma_inline const Col& Col::fixed::operator=(const fixed& X) { arma_extra_debug_sigprint(); if(this != &X) { eT* dest = (use_extra) ? mem_local_extra : Mat::mem_local; const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; arrayops::copy( dest, src, fixed_n_elem ); } return *this; } #if defined(ARMA_GOOD_COMPILER) template template template inline const Col& Col::fixed::operator=(const eOp& X) { arma_extra_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); const bool bad_alias = (eOp::proxy_type::has_subview && X.P.is_alias(*this)); if(bad_alias == false) { arma_debug_assert_same_size(fixed_n_elem, uword(1), X.get_n_rows(), X.get_n_cols(), "Col::fixed::operator="); eop_type::apply(*this, X); } else { arma_extra_debug_print("bad_alias = true"); Col tmp(X); (*this) = tmp; } return *this; } template template template inline const Col& Col::fixed::operator=(const eGlue& X) { arma_extra_debug_sigprint(); arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); const bool bad_alias = ( (eGlue::proxy1_type::has_subview && X.P1.is_alias(*this)) || (eGlue::proxy2_type::has_subview && X.P2.is_alias(*this)) ); if(bad_alias == false) { arma_debug_assert_same_size(fixed_n_elem, uword(1), X.get_n_rows(), X.get_n_cols(), "Col::fixed::operator="); eglue_type::apply(*this, X); } else { arma_extra_debug_print("bad_alias = true"); Col tmp(X); (*this) = tmp; } return *this; } #endif template template arma_inline const Op< typename Col::template fixed::Col_fixed_type, op_htrans > Col::fixed::t() const { return Op< typename Col::template fixed::Col_fixed_type, op_htrans >(*this); } template template arma_inline const Op< typename Col::template fixed::Col_fixed_type, op_htrans > Col::fixed::ht() const { return Op< typename Col::template fixed::Col_fixed_type, op_htrans >(*this); } template template arma_inline const Op< typename Col::template fixed::Col_fixed_type, op_strans > Col::fixed::st() const { return Op< typename Col::template fixed::Col_fixed_type, op_strans >(*this); } template template arma_inline arma_warn_unused const eT& Col::fixed::at_alt(const uword ii) const { #if defined(ARMA_HAVE_ALIGNED_ATTRIBUTE) return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; #else const eT* mem_aligned = (use_extra) ? mem_local_extra : Mat::mem_local; memory::mark_as_aligned(mem_aligned); return mem_aligned[ii]; #endif } template template arma_inline arma_warn_unused eT& Col::fixed::operator[] (const uword ii) { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline arma_warn_unused const eT& Col::fixed::operator[] (const uword ii) const { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline arma_warn_unused eT& Col::fixed::at(const uword ii) { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline arma_warn_unused const eT& Col::fixed::at(const uword ii) const { return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline arma_warn_unused eT& Col::fixed::operator() (const uword ii) { arma_debug_check( (ii >= fixed_n_elem), "Col::operator(): index out of bounds"); return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline arma_warn_unused const eT& Col::fixed::operator() (const uword ii) const { arma_debug_check( (ii >= fixed_n_elem), "Col::operator(): index out of bounds"); return (use_extra) ? mem_local_extra[ii] : Mat::mem_local[ii]; } template template arma_inline arma_warn_unused eT& Col::fixed::at(const uword in_row, const uword) { return (use_extra) ? mem_local_extra[in_row] : Mat::mem_local[in_row]; } template template arma_inline arma_warn_unused const eT& Col::fixed::at(const uword in_row, const uword) const { return (use_extra) ? mem_local_extra[in_row] : Mat::mem_local[in_row]; } template template arma_inline arma_warn_unused eT& Col::fixed::operator() (const uword in_row, const uword in_col) { arma_debug_check( ((in_row >= fixed_n_elem) || (in_col > 0)), "Col::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[in_row] : Mat::mem_local[in_row]; } template template arma_inline arma_warn_unused const eT& Col::fixed::operator() (const uword in_row, const uword in_col) const { arma_debug_check( ((in_row >= fixed_n_elem) || (in_col > 0)), "Col::operator(): index out of bounds" ); return (use_extra) ? mem_local_extra[in_row] : Mat::mem_local[in_row]; } template template arma_inline arma_warn_unused eT* Col::fixed::memptr() { return (use_extra) ? mem_local_extra : Mat::mem_local; } template template arma_inline arma_warn_unused const eT* Col::fixed::memptr() const { return (use_extra) ? mem_local_extra : Mat::mem_local; } template template arma_hot inline const Col& Col::fixed::fill(const eT val) { arma_extra_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat::mem_local[0]); arrayops::inplace_set_fixed( mem_use, val ); return *this; } template template arma_hot inline const Col& Col::fixed::zeros() { arma_extra_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat::mem_local[0]); arrayops::inplace_set_fixed( mem_use, eT(0) ); return *this; } template template arma_hot inline const Col& Col::fixed::ones() { arma_extra_debug_sigprint(); eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat::mem_local[0]); arrayops::inplace_set_fixed( mem_use, eT(1) ); return *this; } template inline Col::Col(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem) : Mat(arma_fixed_indicator(), in_n_elem, 1, 1, in_mem) { arma_extra_debug_sigprint_this(this); } #ifdef ARMA_EXTRA_COL_MEAT #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_MEAT) #endif //! @}