Is there a good canonical spelling for taking a linear combination, e.g.
combo(xs, ys) = sum(x*y for (x,y) in zip(xs, ys))
basis = [[1,0], [1,1]]
weights = [0.5, 0.5]
julia> combo(basis, weights)
It’s not a
LinearAlgebra.dot-product, since that is supposed to return a scalar. It’s isomorphic to a matrix-vector product, yes, but what should the spelling of the operation on
weights be to avoid reshaping the
basis elements into vectors?
I don’t know what a canonical spelling is, but this is what comes into my mind seeing the code:
is doing the same operation.
An element wise multiplication is called a
- Hadamard product or
- Schur product or
- entrywise product
The sum operation doesn’t have a name except for the sum of the elements.
Ah, I see, its not the same operation…
Now it is, edited above from
One solution (in the context that motivated my question) from @tkoolen:
It works on e.g. basis elements which are matrices.
julia> transpose([10, 20]) * [[1 0; 0 1], [0 1; 0 0]]