Adding back vec.m since it is not present in MATLAB and avoiding usage of short-circuit logical operator for vector inputs