1 #ifndef OST_TRI_MATRIX_HH
2 #define OST_TRI_MATRIX_HH
16 data_((n*(n+1))/2, def_val), n_(n)
19 void Set(
int i,
int j,
const T& sim)
21 data_[this->GetIndex(i, j)]=sim;
24 const T& Get(
int i,
int j)
const
26 return data_[this->GetIndex(i, j)];
29 T& operator()(
int i,
int j)
31 return data_[this->GetIndex(i, j)];
34 const T& operator()(
int i,
int j)
const
36 return data_[this->GetIndex(i, j)];
43 std::vector<T>& Data()
48 int GetIndex(
int i,
int j)
const {
53 return ((2*n_-j+1)*j)/2+i-j;