construction data structure for the imputation algorithm, stuck with
list-to-matrix conversion