finish matrix define.