Optimized Matrix and Vector, fixed opt error