vectorized vector and matrix