Between reading
optimizing ML algos and working on some research code, I'd like to suggest adding the capability to weight rows and columns in gonum/matrix/mat64 using []float64 or mat64.Vector.
Since a square matrix would require a dimension precedence, I'd suggest a flag type to denote the weighted dimension. They would error if len(:
const(
row dimFlag = iota
col
)
func (m *mat64.Dense)Weight(dim dimFlag, wgt mat64.Vector)
func (m *mat64.Dense)WeightTo(dim dimFlag, wgt mat64.Vector, dst mat64.Dense)
The alternative is to use a full matrix type to perform matrix multiplication with a diagonal matrix. That's a waste of memory and/or operations multiplying by zero.
The assembly code isn't terribly difficult, but the API can be built in multiple ways. I'm leaning towards Weights with a dimension flag, but it could be built as separate WeigtRows() and WeightCols() calls. I'm mainly looking for a consensus on need and API design.