22 #ifndef SELDON_FILE_VECTOR_VECTOR2_HXX
25 #ifndef SELDON_VECTOR2_DEFAULT_ALLOCATOR_1
29 #define SELDON_VECTOR2_DEFAULT_ALLOCATOR_1 MallocObject
49 template <
class T,
class Allocator0 =
50 typename SeldonDefaultAllocator<VectFull, T>::allocator,
51 class Allocator1 = SELDON_VECTOR2_DEFAULT_ALLOCATOR_1<
52 Vector<T, VectFull, Allocator0> > >
58 typedef const T* const_pointer;
60 typedef const T& const_reference;
89 void Select(
long beg,
long end);
91 template <
class Td,
class Allocatord>
93 template <
class Td,
class Allocatord>
108 void Fill(
const T& x);
132 const_reference
operator() (
long i,
long j)
const;
144 void Write(
string file_name,
bool with_size =
true)
const;
145 void Write(ostream& file_stream,
bool with_size =
true)
const;
146 void Read(
string file_name,
bool with_size =
true);
147 void Read(istream& file_stream,
bool with_size =
true);
154 #define SELDON_FILE_VECTOR_VECTOR2_HXX
bool HasSameShape(const V2 &V) const
Checks whether another Vector2 instance has the same shape.
long GetLength() const
Returns the size along dimension 1.
long GetSize() const
Returns the size along dimension 1.
size_t GetMemorySize() const
Returns the memory used by the object in bytes.
Vector< Vector< T, VectFull, Allocator0 >, VectFull, Allocator1 > & GetVector()
Returns the vector of vectors.
long GetNelement() const
Returns the total number of elements in the inner vectors.
void Print() const
Displays the vector.
bool IsEmpty() const
Checks whether no elements are contained in the inner vectors.
void PushBack(long i, const T &x)
Appends an element at the end of the inner vector #i.
void Write(string file_name, bool with_size=true) const
Writes the instance in a binary file.
~Vector2()
Destructor. The vector of vectors and the inner vectors are deallocated.
void Fill(const T &x)
Fills the vector with a given value.
void Read(string file_name, bool with_size=true)
Reads the Vector2 from a file.
Vector< long > GetShape() const
Returns the shape.
void Select(long beg, long end)
Selects a range of inner vectors.
void Reallocate(long M)
Reallocates the vector of vector.
void Clear()
Clears the vector.
Vector2()
Default constructor.
Vector< T, VectFull, Allocator0 > Flatten() const
Returns all values in a vector.
const Vector< T, VectFull, Allocator0 > & operator()(long i) const
Returns a given inner vector.
Vector2< T, Allocator0, Allocator1 > Copy() const
Copies a Vector2 instance.