Taking into account the views of Aaron, Ronan, and Vinzent on whether to follow an OO or procedural design, I think the best idea (as it always had been) would be to use a combination of both. The high level user interface would be and also appear completely OO. However the core would contain procedural code, which as Aaron says, can also be optimized by PyPy.
There are some points regarding why many matrix functions cannot be 'inside' a Matrix class. How is an algorithm, for example, the linear solve, a property of a Matrix ? The LU decomposition can be regarded as the Matrix's property, but not linear solve. It is a function which takes in A, rhs, and returns vector x. This hints that the Matrix class isn't inherently OO. Still, as the user is familiar with OO design pattern, the interface will be completely OO. Here's an alternate OO+procedural design which I had considered. It is basically the design in my first post with a small modification. The idea is to have the low level class which contains the algorithms, *assume* that the final Matrix object has element callers like A[i, j], slices, and iterators, but do *not* actually implement it. The Data structure Matrix classes (like DOKMatrix, COOMatrix, etc.) inherit the abstract low level matrix and add in the element access functions, iterators, etc. Then, we can either have the User call the DS Matrix class themselves ( A = DOKMatrix(...) ), or we can have a function/class (matrix(...), Matrix(...)) which returns one of the DS Matrix classes. The abstract Matrix class (_Matrix) will only have functions and variables which are in essence *properties* of a Matrix. Other functions like private helper functions, and I would also like to include functions like linearsolve should *not* be inside the class. I'm still not sure where the to put the actual algorithms, like cholesky decomposition, LU decomposition. Would putting it inside a class reduce its performance. If yes, how ? I would also think that GMPY integration would be much easier in procedural design rather than OO. Any comments ? Best, Sherjil Ozair -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
