寻找适用于php的主动维护的矩阵数学库 [英] Looking for actively maintained matrix math library for php

查看:73
本文介绍了寻找适用于php的主动维护的矩阵数学库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道我在哪里可以找到仍在积极维护的PHP矩阵数学库吗?

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:

PHP中的矩阵人工关节? > https://stackoverflow.com/questions/435074/matrix-arithmetic-in-php-again

当我看到这些时,我正在安装pear Math_Matrix库,并意识到这对我没有帮助. (感谢Ben在您的问题中发表有关转置的评论.)

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.

推荐答案

使用其他语言进行矩阵操作并从PHP调用该代码可能会更好. PHP社区通常并不关心矩阵计算,因此我想找到想要的东西将是一个挑战.但是,还有许多其他语言的数学库.例如,您可以尝试使用Python(SciPy),尽管我不知道混合使用PHP和Python有多困难.我不懂PHP,但是大多数语言都有一种调用C的方法,例如,您可以从C中调用Gnu科学库.

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.

顺便说一句,几乎没有理由要反转矩阵.看来需要矩阵求逆的大多数问题实际上都需要求解线性系统.后者更稳定.另外,某些库本身可能没有矩阵求逆例程,因为它们假定人们将使用分解例程(例如Cholesky)并重复求解方程组.

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的主动维护的矩阵数学库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆