Matrix Based Analysis for State-space Inference and Clustering