Matlab style matrix and tensor lib