Code Sample, a copy-pastable example if possible
require "num"
include Num
alias RT64 = Tensor(Float64, CPU(Float64))
alias CT64 = Tensor(Complex, CPU(Complex))
complexMatrix = RT64.random(0.0..1.0, [3, 8])
realVector = RT64.random(0.0..1.0, [8 ])
complexMatrix *= (1 + 1.i) # Didn't get random working, so cheat here.
result = complexMatrix.matmul(realVector)
pp result
Problem description
matmul (and possibly other operations, not managed to check yet) only seems to be defined for operand matrices of the same data type. Multiplying a complex and a float is well-defined on an element-by-element basis, as would be multiplication of a real an an integer, so I reckon an overload should be provided for cases where the underlying element types are different but compatible.
Code Sample, a copy-pastable example if possible
Problem description
matmul(and possibly other operations, not managed to check yet) only seems to be defined for operand matrices of the same data type. Multiplying a complex and a float is well-defined on an element-by-element basis, as would be multiplication of a real an an integer, so I reckon an overload should be provided for cases where the underlying element types are different but compatible.