
On Sunday 26 June 2005 19:22, Henning Thielemann wrote:
The reason why these operators are methods of classes is that it shall be possible to write mathematical expressions which can be universally used for different types of numbers, such as Float, Double, Rational, Integer and so on. Prelude's class framework is oriented at the scalar types it provides. My concern is: Are matrices a natural extension of these scalar types? What is (fromInteger 1) for the matrix class? The identity matrix or the matrix which consists entirely of ones?
The identity matrix, of course. For a given dimension, numeric literals of value x should be converted as (x .* m_id), where (.*) is scalar multiplication, and m_id is the identity matrix. This is BTW an embedding of the number field into the (quadratic) matrices (over teh numbers in question) as a subring. The real problem is the dimension, which we would like to have as an extra type argument and this is incompatible with the Prelude. Ben