Generic api for core.matrix

See detailed description on the mailing list