寻找积极维护的 php 矩阵数学库
有谁知道我在哪里可以找到仍在积极维护的 PHP 矩阵数学库?
我需要能够进行基本的矩阵运算,如归约、转置(包括非方阵)、求逆、行列式等。
这个问题过去曾被问过,然后没有答案就关闭了。 现在我需要同一问题的答案。 请参阅相关问题的链接:
PHP 中的矩阵算术? https://stackoverflow.com/questions/435074/matrix-arithmetic-in-php-again< /a>
当我看到这些并意识到它对我没有帮助时,我正在安装 pear Math_Matrix 库。 (感谢 Ben 在你的问题中添加关于转置的评论。)
我可以自己编写这些东西,但我会更高兴看到某个地方有一个用于此目的的库。
Does anyone know where I might find a PHP matrix math library which is still actively maintained?
I need to be able to do the basic matrix operations like reduce, transpose (including non-square matrices), invert, determinant, etc.
This question was asked in the past, then closed with no answers. Now I need an answer to the same question. See these links to related questions:
Matrix artihmetic in PHP?
https://stackoverflow.com/questions/435074/matrix-arithmetic-in-php-again
I was in the process of installing the pear Math_Matrix library when I saw these and realized it wouldn't help me. (Thanks Ben for putting that comment about transpose in your question.)
I can code this stuff myself, but I would make me happier to see that there is a library for this somewhere.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我用过这个,效果非常好:
https://github.com/mcordingley/LinearAlgebra
这看起来也不错:
http://numphp.org/
I've used this one which is quite good:
https://github.com/mcordingley/LinearAlgebra
Also this one looks ok:
http://numphp.org/
您可能会更好地使用另一种语言进行矩阵操作并从 PHP 调用该代码。 PHP 社区通常不关心矩阵计算,所以我想找到你想要的东西会很困难。 但也有很多其他语言的数学库。 例如,您可以尝试Python(SciPy),尽管我不知道混合PHP和Python有多难。 我不懂 PHP,但大多数语言都有调用 C 的方法,例如,您可以从 C 调用 Gnu 科学库。
顺便说一句,几乎没有理由对矩阵求逆。 大多数看似需要矩阵求逆的问题实际上都需要求解线性系统。 后者更稳定。 此外,一些库本身可能没有矩阵求逆例程,因为它们假设人们将使用因式分解例程(例如 Cholesky)和重复求解方程组。
You might do better to do your matrix manipulations in another language and call that code from PHP. The PHP community isn't typically concerned with matrix computation, so I imagine it will be challenging to find what you want. But there are plenty of math libraries in other languages. For example, you might try Python (SciPy), though I don't know how hard it is to mix PHP and Python. I don't know PHP, but most languages have a way to call C, and from C you could call the Gnu Scientific Library, for example.
By the way, there's hardly ever a reason to invert a matrix. Most problems that appear to require matrix inversion actually require solving linear systems. The latter is more stable. Also, some libraries may not have a matrix inversion routine per se because they assume people will use a factorization routine (e.g. Cholesky) and repeated solve systems of equations.
它并不是真正的库,但此页面上有很多有用的 php 数学代码(包括矩阵运算):
http://www.phpmath.com/home
我希望这会有所帮助
It is not really a library but there is a lot of usefull php math code (including operations on matrices) on this page:
http://www.phpmath.com/home
I hope this will help