23template <
typename T1,
typename T2>
42 val = utils::SafeMalloc<T1>(SP_LEN);
43 lev = utils::SafeMalloc<T2>(SP_LEN);
44 idx = utils::SafeMalloc<int>(SP_LEN);
63 inline void Append(T1 t_val, T2 t_lev,
int t_idx) {
82 inline void Append(T1 *t_val, T2 *t_lev,
int *t_idx,
int t_len) {
89 for(
int i=0; i<t_len; i++) {
115 inline std::tuple<T1, T2, int>
Get(
int i) {
void Clear()
Set the value of len to 0.
int * idx
An array that stores the indices of the nonzero elements.
std::tuple< T1, T2, int > Get(int i)
Return the tuple of i-th values of val, lev, and idx.
int len
The number of the nonzero elements.
T1 * val
An array that stores the values of the nonzero elements.
int GetIdx(int i)
Return i-th value of idx.
int mlen
The size of allocated memories.
void Append(T1 *t_val, T2 *t_lev, int *t_idx, int t_len)
Append argument values to the arrays.
T2 GetLev(int i)
Return i-th value of lev.
T1 GetVal(int i)
Return i-th value of val.
T2 * lev
An array that stores the supplemental values of the nonzero elements.
void Append(T1 t_val, T2 t_lev, int t_idx)
Append argument values to the arrays.
void SafeFree(T **ptr)
Free allocated memory.
T * SafeRealloc(T *old, int size)
Reallocate memory.
The top-level namespace of SenK.
Utility functions are defined.