modified HSMM alogithm to make it more efficient when dealing with sparse factors
modified MATLAB files so that factor generation also includes info about which factors are sparse and what their sparsity pattern.