normalize matrix