MatrixToolkit
stevenmess2004
Posts: 1,102
Well, I've pulled out my propeller and finally done some more coding. Here is a matrix toolkit for anyone who wants to use it. It uses either the floatmath or float32 objects which are both single precision floating point objects. It can handle matrixes up to any size that will fit in the memory of the propeller chip and the demo shows an example with a 60x60 matrix that is row-reduced. Since it is only single precision you will get some rounding errors but they should be fairly obvious. In theory you should be able to solve a system of about 60 linear equations with 60 variables. If you add an sd card and partition the matrix then you would only be limited by the processing time.
A few things to be careful of
If I get motivated I may add some more methods or convert it all to assembly. If anyone uses it please let me know how it works for you. Nothing is optimised at the moment so I may look at doing that as well.
Edit: The demo is setup for a proto-board and PAL output, you may need to change it.
A few things to be careful of
- The minv function doesn't check to see if the matrix is actually invertible and could invert a matrix that isn't actually invertible due to several things including rounding errors.
- The minv function takes to matrixes and turns one into an identity matrix and the other into the inverse of the matrix that got turned into the identity matrix.
- If you use the FloatString object make sure you check somewhere for NaNs, FloatString just prints them as a number , maybe I should fix it.
If I get motivated I may add some more methods or convert it all to assembly. If anyone uses it please let me know how it works for you. Nothing is optimised at the moment so I may look at doing that as well.
Edit: The demo is setup for a proto-board and PAL output, you may need to change it.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon
www.norfolkhelicopterclub.com
“Before you criticize someone, you should walk a mile in their shoes. That way when you criticize them, you are a mile away from them and you have their shoes.” - Jack Handey.
1. All that fast at floating point calculations. It's pretty good compared to AVR's etc but its probably hopeless compared to an ARM chip with floating point extensions (if such a thing exists)
2. It doesn't have much memory and doesn't have a really fast memory interface. This could be fixed to a certain extent if you really wanted to with the memory expansion that several people are working on. The problem with that is that their probably going to use a cpld or fpga. If your going to use one of them you may as well use that to do your matrix calculations because it will be a lot faster than the prop.
Edit: File now attached