I haven't used PDL, but Math::Matrix might suit your needs. You mention that speed is important, so a couple of caveats: it's written purely in Perl (no optimised C code; I don't know if PDL or any other matrix module uses optimised C code), and the equation solver uses the Gauss Jordan elimination algorithm which has a run time of O(n^3). This last point is probably only important if you're using very large arrays... you didn't mention this, though, so I'm guessing you're using only relatively small arrays with fewer than (say) 30 unknowns. If that's the case, the Gauss-Jordan will most likely be fast enough.
As for your example of the sorts of systems you want to solve, I take it that each equation you gave represents a complete set of simultaneous equations? It wasn't clear, but I wondered whether you meant that all three matrix equations needed to be solved together rather than individually. If that is the case, can you rewrite the equations to involve only one matrix (the co-efficients) times a vector (of unknowns) = a vector (the result)? | [reply] |
| [reply] |
I am currently looking at Math::Matrix, but might end up using PDL.
@dec: yes, all equations are a set of linear equations and yes, they need to be solved simultaneously. Rewriting is not an option, though...
Math::Matrix looks good but I will have to make hundreds or maybe even thousands of runs and am not quite sure yet whether perl would be fast enough for that.
I think I might just try math::matrix first as it seems easier to use quickly and then see if I need more speed ;)
@ambrus: yes, of course that would be an option but I am not that good at numerical problem solving, so I am glad to use code already written and probably optimized to a point where I might not get...
@all: sry for horrible format and thx for all your answers!
| [reply] |
PDL was already mentioned, but I don't know of any better starting point for this linear-algebra type problem than PDL::LinearAlgebra, probably one of the msolve* routines. If anyone does know of such, I'd love to know of it! | [reply] [d/l] |