Go to the documentation of this file. 1 #ifndef PARGEMSLR_INT_VECTOR_H
2 #define PARGEMSLR_INT_VECTOR_H
9 #include "../utils/utils.hpp"
110 int Setup(
int length);
119 int Setup(
int length,
bool setzero);
129 int Setup(
int length,
int location,
bool setzero);
141 int Setup(
int length,
int reserve,
int location,
bool setzero);
152 int SetupPtr( T* data,
int length,
int location);
163 int SetupPtr( T* data,
int length,
int location,
bool hold_data);
195 int Copy(
const T *data,
int length,
int loc_from,
int loc_to);
214 int Resize(
int length,
bool keepdata,
bool setzero);
225 int Resize(
int length,
int reserve,
bool keepdata,
bool setzero);
276 virtual int Fill(
const T &v);
322 int BinarySearch(
const T &val,
int &idx,
bool ascending);
330 int Sort(
bool ascending);
359 int Plot(
int conditiona,
int conditionb,
int width);
370 template <
typename T1>
382 template <
typename T1>
391 virtual int MoveData(
const int &location);
int Setup(int length)
Free the current vector, and malloc memory to initilize the vector.
Definition: int_vector.cpp:134
The virtual vector classes.
T Min() const
Get the min value in the vector.
Definition: int_vector.cpp:513
virtual T * GetData() const
Get the data pointer of the vector.
Definition: int_vector.cpp:391
int GatherPerm(const VectorVirtualClass< T1 > &v_in, VectorVirtualClass< T1 > &v_out)
Copy element from a vector to another vector use this vector as map. (v_out := v_in(map))
Definition: int_vector.cpp:667
virtual ~IntVectorClass()
The destructor of IntVectorClass.
Definition: int_vector.cpp:383
int Copy(const T *data, int length, int loc_from, int loc_to)
Free the current vector, allocate memory, and copy data to initilize the vector.
Definition: int_vector.cpp:254
int Sort(bool ascending)
Sort the current vector.
Definition: int_vector.cpp:531
IntVectorClass< T > & operator=(const IntVectorClass< T > &vec)
The = operator of IntVectorClass.
Definition: int_vector.cpp:71
int Plot(int conditiona, int conditionb, int width)
Print the vector.
Definition: int_vector.cpp:715
int Resize(int length, bool keepdata, bool setzero)
Resize the vector. Re-allocate memory when necessary.
Definition: int_vector.cpp:313
int PushBack(T v)
Insert value at the end of the vector, expand the vector when necessary.
Definition: int_vector.cpp:297
virtual T & operator[](int i)
Get the reference of an index in the vector.
Definition: int_vector.cpp:116
int SetupPtr(T *data, int length, int location)
Free the current vector, and points the vector to an address in the memory.
Definition: int_vector.cpp:205
T Max() const
Get the max value in the vector.
Definition: int_vector.cpp:495
virtual int GetDataLocation() const
Get the data location of the vector.
Definition: int_vector.cpp:399
IntVectorClass()
The constructor of IntVectorClass.
Definition: int_vector.cpp:20
T & Back()
Get the reference of the last index in the vector.
Definition: int_vector.cpp:126
int MaxIndex() const
Get the index of the max value in the vector.
Definition: int_vector.cpp:505
int BinarySearch(const T &val, int &idx, bool ascending)
Binary search between [s, e] inside an array.
Definition: int_vector.cpp:419
virtual int GetLengthLocal() const
Get the length of the vector.
Definition: int_vector.cpp:411
The template class complex.
Definition: complex.hpp:24
The class of sequential integer vector.
Definition: int_vector.hpp:27
int ScatterRperm(const VectorVirtualClass< T1 > &v_in, VectorVirtualClass< T1 > &v_out)
Copy element from a vector to another vector use vector as map. (v_out(map) := v_in)
Definition: int_vector.cpp:628
int UnitPerm()
Generate a unit permutation vector.
Definition: int_vector.cpp:465
int MinIndex() const
Get the index of the min value in the vector.
Definition: int_vector.cpp:523
virtual int MoveData(const int &location)
Move the data to another memory location.
Definition: int_vector.cpp:705
virtual int Fill(const T &v)
Fill the vector with constant value.
Definition: int_vector.cpp:434
virtual int Clear()
Free the current vector.
Definition: int_vector.cpp:274
The virtual class of all vector classes.
Definition: vector.hpp:22
Tell if a value is a complex value.
Definition: complex.hpp:684
int Perm(IntVectorClass< int > &perm)
Apply permutation to the current vector v := v(perm).
Definition: int_vector.cpp:604