1 // SPDX-License-Identifier: Apache-2.0
2 //
3 // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
4 // Copyright 2008-2016 National ICT Australia (NICTA)
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 // ------------------------------------------------------------------------
17 
18 
19 //! \addtogroup SpRow
20 //! @{
21 
22 
23 //! Class for sparse row vectors (sparse matrices with only one row)
24 template<typename eT>
25 class SpRow : public SpMat<eT>
26   {
27   public:
28 
29   typedef eT                                elem_type;
30   typedef typename get_pod_type<eT>::result pod_type;
31 
32   static constexpr bool is_row  = true;
33   static constexpr bool is_col  = false;
34   static constexpr bool is_xvec = false;
35 
36 
37   inline          SpRow();
38   inline explicit SpRow(const uword N);
39   inline explicit SpRow(const uword in_rows, const uword in_cols);
40   inline explicit SpRow(const SizeMat& s);
41 
42   inline            SpRow(const char*        text);
43   inline SpRow& operator=(const char*        text);
44 
45   inline            SpRow(const std::string& text);
46   inline SpRow& operator=(const std::string& text);
47 
48   inline SpRow& operator=(const eT val);
49 
50   template<typename T1> inline            SpRow(const Base<eT,T1>& X);
51   template<typename T1> inline SpRow& operator=(const Base<eT,T1>& X);
52 
53   template<typename T1> inline            SpRow(const SpBase<eT,T1>& X);
54   template<typename T1> inline SpRow& operator=(const SpBase<eT,T1>& X);
55 
56   template<typename T1, typename T2>
57   inline explicit SpRow(const SpBase<pod_type,T1>& A, const SpBase<pod_type,T2>& B);
58 
59   inline arma_warn_unused const SpOp<SpRow<eT>,spop_htrans>  t() const;
60   inline arma_warn_unused const SpOp<SpRow<eT>,spop_htrans> ht() const;
61   inline arma_warn_unused const SpOp<SpRow<eT>,spop_strans> st() const;
62 
63   inline void shed_col (const uword col_num);
64   inline void shed_cols(const uword in_col1, const uword in_col2);
65 
66   // inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero = true);
67 
68 
69   typedef typename SpMat<eT>::iterator       row_iterator;
70   typedef typename SpMat<eT>::const_iterator const_row_iterator;
71 
72   inline       row_iterator begin_row(const uword row_num = 0);
73   inline const_row_iterator begin_row(const uword row_num = 0) const;
74 
75   inline       row_iterator end_row(const uword row_num = 0);
76   inline const_row_iterator end_row(const uword row_num = 0) const;
77 
78   #ifdef ARMA_EXTRA_SPROW_PROTO
79     #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPROW_PROTO)
80   #endif
81   };
82 
83 
84 
85 //! @}
86