Matrix base code