PHP support for matrix operations - BLAS, LAPACK.

php.internals

J. Adams

3 years ago
I apologize if I have the wrong mailing list here. I'm hoping ot ask the PHP developer community if there's any appetite for functions to handle matrix operations and scientific computing. I took a course on machine learning which had us code solutions using matlab/octave. This year I embarked on trying to translate those functions to PHP and have been quite surprised to learn that pure php is quite inefficient for matrix multiplication. I've been trying to chase down an effective way to perform matrix operations in PHP and posting my questions and progress on this forum at PHPBuilder: https://board.phpbuilder.com/d/10403480-converting-matlab-machine-learning-routines-to-php-need-matrix-operations Fast matrix operations seem to be absolutely critical for machine learning, at least for Support Vector Machines and Neural Networks. I know that there is a FANN extension, but it seems to me that it would be beneficial for PHP's use in scientific applications if it had support -- either natively or via some extension -- for matrix operations and possibly other statistical or scientific computations. Python has numpy, for example. How does everyone feel about BLAS or LAPACK extension for PHP? I'm poorly equipped to cook up such a thing, but these libraries already exist and could offer great improvements in performance.

Deleu

3 years ago
On Sun, Dec 4, 2022, 8:43 PM j adams <zardozrocks@gmail.com> wrote:
> I apologize if I have the wrong mailing list here. I'm hoping ot ask the > PHP developer community if there's any appetite for functions to handle > matrix operations and scientific computing. > > I took a course on machine learning which had us code solutions using > matlab/octave. This year I embarked on trying to translate those functions > to PHP and have been quite surprised to learn that pure php is quite > inefficient for matrix multiplication. I've been trying to chase down an > effective way to perform matrix operations in PHP and posting my questions > and progress on this forum at PHPBuilder: > > https://board.phpbuilder.com/d/10403480-converting-matlab-machine-learning-routines-to-php-need-matrix-operations > > Fast matrix operations seem to be absolutely critical for machine learning, > at least for Support Vector Machines and Neural Networks. I know that there > is a FANN extension, but it seems to me that it would be beneficial for > PHP's use in scientific applications if it had support -- either natively > or via some extension -- for matrix operations and possibly other > statistical or scientific computations. Python has numpy, for example. > > How does everyone feel about BLAS or LAPACK extension for PHP? I'm poorly > equipped to cook up such a thing, but these libraries already exist and > could offer great improvements in performance. >
I remember studying some ML algorithms back in 2015 and I felt PHP was lacking a lot in terms of matrix operations, specially invert a matrix. It would have been cool to have some fundamental functionalities baked in.

Christoph Becker

3 years ago
On 05.12.2022 at 00:43, j adams wrote:
> I apologize if I have the wrong mailing list here. I'm hoping ot ask the > PHP developer community if there's any appetite for functions to handle > matrix operations and scientific computing. > > I took a course on machine learning which had us code solutions using > matlab/octave. This year I embarked on trying to translate those functions > to PHP and have been quite surprised to learn that pure php is quite > inefficient for matrix multiplication. I've been trying to chase down an > effective way to perform matrix operations in PHP and posting my questions > and progress on this forum at PHPBuilder: > https://board.phpbuilder.com/d/10403480-converting-matlab-machine-learning-routines-to-php-need-matrix-operations > > Fast matrix operations seem to be absolutely critical for machine learning, > at least for Support Vector Machines and Neural Networks. I know that there > is a FANN extension, but it seems to me that it would be beneficial for > PHP's use in scientific applications if it had support -- either natively > or via some extension -- for matrix operations and possibly other > statistical or scientific computations. Python has numpy, for example. > > How does everyone feel about BLAS or LAPACK extension for PHP? I'm poorly > equipped to cook up such a thing, but these libraries already exist and > could offer great improvements in performance.
There is already <https://pecl.php.net/package/Tensor>, which should serve these needs.
-- Christoph M. Becker