Are there any matrix math modules compatible with Python 3.x?
When I began this project, I thought it would be easy to get libraries for common stuff like matrix math, so I chose to work in Python 3.1- it being the most recent, updated version of the language. Unfortunately, NumPy is only compatible with 2.5 and 2.6 and seems to be the only game in town! Even other stuff that I turned up like gameobjects seemed to be based on NumPy and therefore incompatible with 3.x as well.
Does anyone out there know of a matrix library that is compatible with 3? I need to be able to do the following: matrix add, subtract, multiply, scalar multiply, inverse, transpose, and determinant. I've been looking all day and all roads seem to lead back to NumPy. I even tried this module: http://www.nightmare.com/squirl/python-ext/misc/matrix.py but it too is for 2.x. Even after converting it using the 2to3 tool, I can't get the yarn module that it refers to (and开发者_如何学运维 is probably itself 2.x).
Any help is hugely appreciated.
Given that a large portion of those interested in this sort of development are involved in NumPy, and given their schedule for migrating I think the answer is "no, there is nothing yet".
I would advise treating Python 3.x as "still experimental" and start with Python 2.6 instead. Make some small effort to write your code in a such a way that it won't be too hard to migrate in, say, a year or two, when the Python 3.x series really stabilizes, but don't jump there just yet. Other more general questions have answers that may help you decide.
EDIT: PyEuclid has supports matrices, vectors up to 4 dimensions and is designed for geometric operations.
Otherwise, the answer is probably not what you want, but:
- use python 2.x instead, do use
numpy
(which is really good), until numpy supports python 3.x - implement your own Matrix class, since you don't require too much functionality and it's a good exercise to implement. Should be less work than looking a day on the internet.
精彩评论