added matrix normal function