Optimized matrix operations