How to implement matrix multiplication in PHP

Please kindly need your help to implement this case into PHP code

i have table stored in mysql like this :

table data stored in mysql

what I want to do is do a matrix multiplication with the following data:

Average data stored in database mysql with avg function

i want to implement using PHP like this calculation :

1 = 1 x 0.5661 + 4 x 0.2249 + 5 x 0.1343 + 5 x 0.0748 = 2.5112
2 = 0.25 x 0.5661 + 1 x 0.2249 + 3 x 0.1343 + 3 x 0.0748 = 0.993725
3 = 0.2 x 0.5661 + 0.3333 x 0.2249 + 1 x 0.1343 + 3 x 0.0748 = 0.54687917
4 = 0.2 x 0.5661 + 0.3333 x 0.2249 + 0.3333 x 0.1343 + 1 x 0.0748 = 0.30774136

I really appreciate if you can help me to implement this into PHP.

Thank you for your attention.



Read more here: https://stackoverflow.com/questions/67925182/how-to-implement-matrix-multiplication-in-php

Content Attribution

This content was originally published by Fulan Bin Abdullah at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: