upgrade vector and matrix