Kotlin, luckily for us does not have broadcast operations. It means that operation logic is defined by the actual container type you are using (if container addition is defined as element-wise, it will be done element-wise, if not - it won’t work).
Broadcast simplifies simple operations, but tremendously complicates larger code and makes it really hard to understand. And Python style, where you do not know if you do one-to-one or one-to-many operation before seeing the result is the worst of all. Julia style, where you have special broadcast
. operator is much better, but still is a terrible mess when it comes to multiple argument functions.
My current effort in kmath is to make many-to-many operations accessible inside specific scope. Meaning that normally you can’t add a number to a vector, but you can when you call the operation in a specific scope. which defines it.
If you really interested in the development of those features, please join us on kotlin slack #mathematics channel.