unified protocol function for matrix and vector norms