PolyMath icon indicating copy to clipboard operation
PolyMath copied to clipboard

Add support for arithmetic operations with other collections

Open olekscode opened this issue 7 years ago • 0 comments

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.

olekscode avatar Jul 05 '18 02:07 olekscode