VectorCollectionInline.cxx
1 // Copyright (C) 2010, INRIA
2 // Author(s): Marc Fragu, Vivien Mallet
3 //
4 // This file is part of the linear-algebra library Seldon,
5 // http://seldon.sourceforge.net/.
6 //
7 // Seldon is free software; you can redistribute it and/or modify it under the
8 // terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 2.1 of the License, or (at your option)
10 // any later version.
11 //
12 // Seldon is distributed in the hope that it will be useful, but WITHOUT ANY
13 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
15 // more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with Seldon. If not, see http://www.gnu.org/licenses/.
19 
20 
21 #ifndef SELDON_FILE_VECTOR_VECTORCOLLECTION_INLINE_CXX
22 
23 
24 #include "VectorCollection.hxx"
25 
26 
27 namespace Seldon
28 {
29 
30 
32  // VECTORCOLLECTION //
34 
35 
36  /***************
37  * CONSTRUCTOR *
38  ***************/
39 
40 
42 
45  template <class T, class Allocator>
47  Vector_Base<T, Allocator>(), label_map_(), label_vector_()
48  {
49  Nvector_ = 0;
50  }
51 
52 
54 
57  template <class T, class Allocator>
59  Vector_Base<T, Allocator>(0), length_(i), length_sum_(i), vector_(i),
60  label_map_(), label_vector_()
61  {
62  Nvector_ = i;
63  for (int k = 0; k < i; k++)
64  length_(k) = length_sum_(k) = 0;
65  }
66 
67 
69 
72  template <class T, class Allocator>
75  Vector_Base<T, Allocator>(V), Nvector_(0)
76  {
77  Copy(V);
78  }
79 
80 
81  /*****************
82  * BASIC METHODS *
83  *****************/
84 
85 
87 
90  template <class T, class Allocator >
92  {
93  return this->m_;
94  }
95 
96 
98 
101  template <class T, class Allocator >
103  {
104  return this->m_;
105  }
106 
107 
109 
112  template <class T, class Allocator >
114  {
115  return Nvector_;
116  }
117 
118 
120 
123  template <class T, class Allocator >
126  {
127  return length_;
128  }
129 
130 
132 
135  template <class T, class Allocator >
138  {
139  return length_sum_;
140  }
141 
142 
144 
147  template <class T, class Allocator >
150  {
151  return vector_;
152  }
153 
154 
156 
159  template <class T, class Allocator >
162  {
163  return vector_;
164  }
165 
166 
168 
172  template <class T, class Allocator >
173  inline typename Vector<T, Collection, Allocator>::vector_reference
175  {
176  return vector_(i);
177  }
178 
179 
181 
185  template <class T, class Allocator >
186  inline typename
189  {
190  return vector_(i);
191  }
192 
193 
195 
198  template <class T, class Allocator>
199  template<class T0>
202  {
203  for (int i = 0; i < this->Nvector_; i++)
204  this->vector_(i) *= alpha;
205 
206  return *this;
207  }
208 
209 
210 } // namespace Seldon.
211 
212 
213 #define SELDON_FILE_VECTOR_VECTORCOLLECTION_INLINE_CXX
214 #endif
Seldon::Vector
Definition: SeldonHeader.hxx:207
Seldon::Vector_Base
Base structure for all vectors.
Definition: SeldonHeader.hxx:201
Seldon::Vector< T, Collection, Allocator >
Structure for distributed vectors.
Definition: VectorCollection.hxx:38
Seldon
Seldon namespace.
Definition: Array.cxx:24