9inline void pack2d(
int n,
const T* sm, T* pac_sm)
11 for(
int i = 0; i < n; i++) {
12 for(
int j = 0; j <= i; j++) {
13 int k = i*(i+1)/2 + j;
14 pac_sm[k] = sm[i*n+j];
22 return (i>j) ? i*(i+1)/2 + j : j*(j+1)/2 + i;
35inline void unpack2d(
int n, T* sm,
const T* pac_sm)
37 for(
int i = 0; i < n; i++) {
38 for(
int j = 0; j <= i; j++) {
39 int k = i*(i+1)/2 + j;
40 sm[i*n+j] = sm[i+j*n] = pac_sm[k];
T get_element(const T *pac_sm, int i, int j)
int get_idx(int i, int j)
void pack2d(int n, const T *sm, T *pac_sm)
void unpack2d(int n, T *sm, const T *pac_sm)