add mark matrix function