in reply to Translating python math to Perl

my python is very limited so all above with caution. All the above can be done with pure perl but perhaps a dedicated module or PDL can be employed.

Replies are listed 'Best First'.
Re^2: Translating python math to Perl
by NERDVANA (Priest) on Aug 25, 2023 at 20:24 UTC
    Did a quick search and found that the '@' operator is matrix multiplication.

    So that line points @ matrix.T is multiplying the matrix 'points' by the transpose of 'matrix'.

    I'd say this really should be translated to PDL, because otherwise it's going to get very verbose. That's the real reason people use matrices in linear algebra - it is just too much fiddly math otherwise, and it's all fairly repetitive. Mathmaticians created "matrix math" just to simplify the notation for these common formulas. Unfortunately I don't know PDL so I can't help there.

      Jeez! my search was talking about overwriting methods.Talk of the snake with the forked tongue. I will update my answer.