Support for spectral decomposition, diagonalization, etc.
It seems like most (if not all) of the foundation is already built to extend these methods. Do you think it would be worthwhile to include?
Sure. Sounds like a good additional feature for the Matrix classes.
If you want to tackle it, do a pull request. Or, if you document here what it entails then I or someone else can implement it in the future.
Thanks for contributing!
I thought I'd add an unrelated comment. I saw you were having difficulty getting unit tests to work without an include statement. If you sign up for an account on travis-ci.org you can see whether or not things pass, and what the problems are. I don't have php7 on my development system, so I've been using github as my IDE.
I'd recommend trying Vagrant with VirtualBox, and run a modern Linux VM on your Mac or PC that has PHP7. With Vagrant, you don't have to know anything about setting up the environment, as you can select VMs from an online catalog, and the VM runs in the background, and you can use your computer's IDE to directly edit files in the VM. You still need to SSH into the VM to run unit tests, but you can use git an everything else outside of the VM because all the files are on your computer via a shared synced directory. https://www.vagrantup.com/
I'm having trouble with a few pretty basic things, not quite sure what is happening. When I try to execute a file in my command line, for example:
php math-php/src/Statistics/Regression/Linear.php
I get an error:
PHP Fatal error: Class 'Math\Statistics\Regression\ParametricRegression' not found in /home/jakob/math-php/src/Statistics/Regression/Linear.php on line 29
I am actually working on a Linux distribution already (Ubuntu). This is a very similar error that I was getting when I was getting unit testing. It seems like something weird is happening with the namespaces. Linear.php and ParametricRegression.php share the same namespace, so I'm not sure why it can't find the class.
Any ideas?
Sounds like you have not run composer. On the main github page there are instructions for using composer. In this case, you aren't installing the library, but you still have to run composer to set up the autoloader.
Then, just require the autoloader in your PHP file and you can then access any Math class without needing to individually require any.
Since you already cloned the repo, you don't have to edit any composer.json file. Just run composer in the root directory and it will create the vendor directory, which contains autoload.php which you include.
I don't have composer installed either. When I test something from the command line I run 'php -r' and manually include the files I need in the statement with whatever test I'm doing. I really need to install and learn composer.
Install composer installer: php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
Install composer: php composer-setup.php
Run composer to set up the autoloader: php composer.phar install
Once composer sets up the autoloader, you can run the unit tests by going into the test directory and just running phpunit: cd tests phpunit
You can run just a single test suite by naming it: phpunit LinearAlgebra
If you want to run just a single test, you have to include the bootstrap since you are bypassing the phpunit manifest: phpunit --bootstrap bootstrap.php path/to/test.php
If you are using Math classes in a script, you will just include the composer autoloader and then everything works just like in the main github instructions:
require_once(__DIR__ . '/vendor/autoload.php');
Or if you are adding something to a class and just want to run that with some test code at the bottom or something, add a temporary require in that with the right path:
require_once(__DIR__ . '/../../vendor/autoload.php'); // or whatever the path is.
Oh wow, I feel so silly. I didn't even realize that the autoloader was not running.
I have everything up and running now. Thanks for all the instructions and your help!
Well, now I know what I'm doing this weekend...get on the PHP7/composer bandwagon. I just saw that Debian has PHP7 in testing.