CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
SimMat Namespace Reference

Functions

template<class T >
void pack2d (int n, const T *sm, T *pac_sm)
 
int get_idx (int i, int j)
 
template<class T >
get_element (const T *pac_sm, int i, int j)
 
template<class T >
void unpack2d (int n, T *sm, const T *pac_sm)
 

Function Documentation

◆ get_element()

◆ get_idx()

int SimMat::get_idx ( int i,
int j )
inline

Definition at line 20 of file SimMatr.h.

21{
22 return (i>j) ? i*(i+1)/2 + j : j*(j+1)/2 + i;
23}

Referenced by get_element().

◆ pack2d()

template<class T >
void SimMat::pack2d ( int n,
const T * sm,
T * pac_sm )
inline

◆ unpack2d()

template<class T >
void SimMat::unpack2d ( int n,
T * sm,
const T * pac_sm )
inline

Definition at line 35 of file SimMatr.h.

36{
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];
41 }
42 }
43}