// 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 Row //! @{ //! Class for row vectors (matrices with only one row) template class Row : public Mat { public: typedef eT elem_type; typedef typename get_pod_type::result pod_type; static const bool is_col = false; static const bool is_row = true; inline Row(); inline Row(const Row& X); inline explicit Row(const uword N); inline explicit Row(const uword in_rows, const uword in_cols); inline explicit Row(const SizeMat& s); template inline Row(const uword n_elem, const fill::fill_class& f); template inline Row(const uword in_rows, const uword in_cols, const fill::fill_class& f); template inline Row(const SizeMat& s, const fill::fill_class& f); inline Row(const char* text); inline const Row& operator=(const char* text); inline Row(const std::string& text); inline const Row& operator=(const std::string& text); inline Row(const std::vector& x); inline const Row& operator=(const std::vector& x); #if defined(ARMA_USE_CXX11) inline Row(const std::initializer_list& list); inline const Row& operator=(const std::initializer_list& list); inline Row(Row&& m); inline const Row& operator=(Row&& m); #endif inline explicit Row(const SpRow& X); inline const Row& operator=(const eT val); inline const Row& operator=(const Row& X); template inline Row(const Base& X); template inline const Row& operator=(const Base& X); inline Row( eT* aux_mem, const uword aux_length, const bool copy_aux_mem = true, const bool strict = false); inline Row(const eT* aux_mem, const uword aux_length); template inline explicit Row(const Base& A, const Base& B); template inline Row(const BaseCube& X); template inline const Row& operator=(const BaseCube& X); inline Row(const subview_cube& X); inline const Row& operator=(const subview_cube& X); inline mat_injector operator<<(const eT val); arma_inline const Op,op_htrans> t() const; arma_inline const Op,op_htrans> ht() const; arma_inline const Op,op_strans> st() const; arma_inline subview_row col(const uword col_num); arma_inline const subview_row col(const uword col_num) const; using Mat::cols; using Mat::operator(); arma_inline subview_row cols(const uword in_col1, const uword in_col2); arma_inline const subview_row cols(const uword in_col1, const uword in_col2) const; arma_inline subview_row subvec(const uword in_col1, const uword in_col2); arma_inline const subview_row subvec(const uword in_col1, const uword in_col2) const; arma_inline subview_row cols(const span& col_span); arma_inline const subview_row cols(const span& col_span) const; arma_inline subview_row subvec(const span& col_span); arma_inline const subview_row subvec(const span& col_span) const; arma_inline subview_row operator()(const span& col_span); arma_inline const subview_row operator()(const span& col_span) const; arma_inline subview_row head(const uword N); arma_inline const subview_row head(const uword N) const; arma_inline subview_row tail(const uword N); arma_inline const subview_row tail(const uword N) const; arma_inline subview_row head_cols(const uword N); arma_inline const subview_row head_cols(const uword N) const; arma_inline subview_row tail_cols(const uword N); arma_inline const subview_row tail_cols(const uword N) const; inline void shed_col (const uword col_num); inline void shed_cols(const uword in_col1, const uword in_col2); inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero = true); template inline void insert_cols(const uword col_num, const Base& X); arma_inline arma_warn_unused eT& at(const uword i); arma_inline arma_warn_unused const eT& at(const uword i) const; arma_inline arma_warn_unused eT& at(const uword in_row, const uword in_col); arma_inline arma_warn_unused const eT& at(const uword in_row, const uword in_col) const; typedef eT* row_iterator; typedef const eT* const_row_iterator; inline row_iterator begin_row(const uword row_num); inline const_row_iterator begin_row(const uword row_num) const; inline row_iterator end_row (const uword row_num); inline const_row_iterator end_row (const uword row_num) const; template class fixed; protected: inline Row(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem); public: #ifdef ARMA_EXTRA_ROW_PROTO #include ARMA_INCFILE_WRAP(ARMA_EXTRA_ROW_PROTO) #endif }; template template class Row::fixed : public Row { private: static const bool use_extra = (fixed_n_elem > arma_config::mat_prealloc); arma_align_mem eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ]; public: typedef fixed Row_fixed_type; typedef eT elem_type; typedef typename get_pod_type::result pod_type; static const bool is_col = false; static const bool is_row = true; static const uword n_rows = 1; static const uword n_cols = fixed_n_elem; static const uword n_elem = fixed_n_elem; arma_inline fixed(); arma_inline fixed(const fixed& X); inline fixed(const subview_cube& X); template inline fixed(const fill::fill_class& f); template inline fixed(const Base& A); template inline fixed(const Base& A, const Base& B); inline fixed(const eT* aux_mem); inline fixed(const char* text); inline fixed(const std::string& text); template inline const Row& operator=(const Base& A); inline const Row& operator=(const eT val); inline const Row& operator=(const char* text); inline const Row& operator=(const std::string& text); inline const Row& operator=(const subview_cube& X); using Row::operator(); #if defined(ARMA_USE_CXX11) inline fixed(const std::initializer_list& list); inline const Row& operator=(const std::initializer_list& list); #endif arma_inline const Row& operator=(const fixed& X); #if defined(ARMA_GOOD_COMPILER) template inline const Row& operator=(const eOp& X); template inline const Row& operator=(const eGlue& X); #endif arma_inline const Op< Row_fixed_type, op_htrans > t() const; arma_inline const Op< Row_fixed_type, op_htrans > ht() const; arma_inline const Op< Row_fixed_type, op_strans > st() const; arma_inline arma_warn_unused const eT& at_alt (const uword i) const; arma_inline arma_warn_unused eT& operator[] (const uword i); arma_inline arma_warn_unused const eT& operator[] (const uword i) const; arma_inline arma_warn_unused eT& at (const uword i); arma_inline arma_warn_unused const eT& at (const uword i) const; arma_inline arma_warn_unused eT& operator() (const uword i); arma_inline arma_warn_unused const eT& operator() (const uword i) const; arma_inline arma_warn_unused eT& at (const uword in_row, const uword in_col); arma_inline arma_warn_unused const eT& at (const uword in_row, const uword in_col) const; arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col); arma_inline arma_warn_unused const eT& operator() (const uword in_row, const uword in_col) const; arma_inline arma_warn_unused eT* memptr(); arma_inline arma_warn_unused const eT* memptr() const; arma_hot inline const Row& fill(const eT val); arma_hot inline const Row& zeros(); arma_hot inline const Row& ones(); }; //! @}