Fix bug 684: optimize vectorization of array-scalar and scalar-array