Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Instabilities in Tensor\Matrix->multiply #43

Closed
Aweptimum opened this issue Mar 8, 2024 · 2 comments
Closed

Instabilities in Tensor\Matrix->multiply #43

Aweptimum opened this issue Mar 8, 2024 · 2 comments

Comments

@Aweptimum
Copy link
Contributor

Aweptimum commented Mar 8, 2024

I installed version 3.0.4 of both the composer package (for autocompletion) and the PHP extension (using php-extension-installer) inside of a docker environment.

I verified it was enabled correctly using php -i, and then I did a basic multiplication test:

$A = Tensor\Matrix::quick([
  [1,2,3],
  [1,2,3],
  [1,2,3],
]);

$b = Tensor\Vector::quick([1,2,4]);
print_r($A->multiply($b))

What I got back was not the right answer:

[
  [1, 12, 0],
  [1, 12, 0],
  [1, 12, 0],
]

It should be:

[
  [1, 4, 12],
  [1, 4, 12],
  [1, 4, 12],
]

The first column is fine, however, the last column is shifted over one and the second column (of 4's) is just missing.

@Aweptimum
Copy link
Contributor Author

In looking around at other issues, I found this statement by @andrewdalpino in the RubixML repo on RubixML/ML#303

I believe we have a fix for this now ... please try compiling the Tensor extension from the latest master branch. Or wait for us to test and release Tensor 3.0.5 and download from PECL.

So I changed from installing the latest release to @master and re-ran my test. I am now getting the correct answer!
Moreover, I had also been getting a crash when trying the svd and pseudoinverse methods, but they also work.

It might be a good idea to tag a new release that includes an upgraded zephir dep - a fix for the self, static deprecation errors was just merged in a month ago: zephir-lang/zephir#2405 (comment)

@Aweptimum
Copy link
Contributor Author

Aweptimum commented Mar 15, 2024

Newest 3.0.5 release fixes the crash, all good. #38 might also be able to be closed, but they manually compiled the extension.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant