How can be expressed a sum of a few products, vector.*Ref(matrix)

If v is a vector, and A a matrix, then v .*Ref(A) is a Length(v)-vector of size(A)-matrices.
I want to get the matrices x,y defined here as follows:

v =[1.2, -3.1]
A =3*rand(3,4)
w= [-4.3, 0.7]
B = rand(3,4)
x, y = [(v .* Ref(A))[i] .+ (w .* Ref(B))[i] for i=1:2]

Is there a possibility to get x,y in a more “elegant” way?

julia> x1, y1 = hcat(v,w) * [A, B]
2-element Vector{Matrix{Float64}}:
 [1.012616619461433 -1.0348272876234768 1.180874509493181 -0.4389223921261124; 0.6060087112091006 0.7052355254247051 -3.661946535430225 -0.3949603721711128; 0.1502086423883977 1.969067118332341 2.1668346186413796 -0.7699022502648285]
 [-4.5229305858275435 -3.185465219781199 -3.2244126583122794 -1.9295328082568828; -4.584289305884756 -2.8853973146710206 0.0015184558293669381 -2.4527059143189582; -6.313818162101733 -8.863052166499791 -8.65699855272134 -5.122121989322053]

julia> x1 == x
true

julia> y1 == y
true
2 Likes

just to rewrite the two solutions in a different form.

[v;;w]*[A, B]

X1, X2 = [(v[i] * A) + (w[i] * B) for i=1:2]