Matrix library