21 #ifndef SELDON_FILE_VECTOR_HETEROGENEOUSCOLLECTION_HXX
24 #include "../share/Common.hxx"
25 #include "../share/Properties.hxx"
26 #include "../share/Storage.hxx"
27 #include "../share/Errors.hxx"
28 #include "../share/Allocator.hxx"
31 #ifndef SELDON_DEFAULT_COLLECTION_ALLOCATOR
32 #define SELDON_DEFAULT_COLLECTION_ALLOCATOR NewAlloc
39 template <
class T,
template <
class U>
class Allocator >
51 SELDON_DEFAULT_COLLECTION_ALLOCATOR<float_dense_v> >
54 SELDON_DEFAULT_COLLECTION_ALLOCATOR<float_sparse_v> >
57 SELDON_DEFAULT_COLLECTION_ALLOCATOR<double_dense_v> >
60 SELDON_DEFAULT_COLLECTION_ALLOCATOR<double_sparse_v> >
109 template <
class T0,
class Storage0,
class Allocator0>
112 void SetVector(
int i,
114 void SetVector(
int i,
116 void SetVector(
int i,
118 void SetVector(
int i,
121 template <
class T0,
class Storage0,
class Allocator0>
124 template <
class T0,
class Storage0,
class Allocator0>
126 void SetName(
int i,
string name);
132 int GetLength()
const;
133 int GetNvector()
const;
155 template <
class T0,
class Storage0,
class Allocator0>
160 double operator() (
int i)
const;
170 operator*= (
const T0& X);
176 void Write(
string FileName,
bool with_size)
const;
177 void Write(ostream& FileStream,
bool with_size)
const;
178 void WriteText(
string FileName)
const;
179 void WriteText(ostream& FileStream)
const;
181 void Read(
string FileName);
182 void Read(istream& FileStream);
185 string GetType(
int i)
const;
188 template <
class T,
template <
class U>
class Allocator >
196 #define SELDON_FILE_VECTOR_HETEROGENEOUSCOLLECTION_HXX
float_sparse_c float_sparse_c_
Pointers of the underlying float sparse vectors.
float_dense_c float_dense_c_
Pointers of the underlying float dense vectors.
double_dense_c double_dense_c_
Pointers of the underlying double dense vectors.
Vector< int, VectFull, MallocAlloc< int > > length_
Lengths of the underlying vectors.
map< string, int > label_map_
Indexes of the inner vectors that have a name.
Vector< int, VectFull, MallocAlloc< int > > subvector_
Index of the underlying vectors in the inner collection.
Base structure for all vectors.
Vector< int, VectFull, MallocAlloc< int > > collection_
For each underlying vectors, index of the corresponding collection.
int Nvector_
Total number of vectors.
double_sparse_c double_sparse_c_
Pointers of the underlying float sparse vectors.
Vector< int, VectFull, MallocAlloc< int > > length_sum_
Cumulative sum of the lengths of the underlying vectors.
ostream & operator<<(ostream &out, const Array< T, N, Allocator > &A)
operator<< overloaded for a 3D array.
vector< string > label_vector_
Names associated with the inner vectors.
void AddVector(const T0 &alpha, const Vector< T1, Storage1, Allocator1 > &X, Vector< T2, Storage2, Allocator2 > &Y)
Adds two vectors Y = Y + alpha X.