PolyMath
PolyMath copied to clipboard
Add support for arithmetic operations with other collections
PolyMath data structures should be well integrated into the system of standard Smalltalk collections. This means that PMVector should behave as an Array since it is a subclass of Array unless the different behavior is necessary.
Arithmetic operations such as +, -, *, / are defined on the level of Collection using the adaptToCollection:andSend: method. PMVector redefines these arithmetic operations, even though (in most cases) it could simply reuse the inherited functionality of Collection.
Moreover, the reimplemented functionality is incomplete. adaptToCollection:andSend: allows us to combine any sequenceable collections arithmetically. For example, Array can be added to LinkedList. PMVector on the other hand can only be added to scalars, other vectors, and arrays.
I think we need to rewrite the arithmetic operations of PMVector and PMMatrix to make them more elegant and more compatible with the rest of Smalltalk.