hakonhagland

pdl-perl-square-matrix

Nov 14th, 2021 (edited)
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. # Script p.pl
  2. use feature qw(say);
  3. use strict;
  4. use warnings;
  5. use PDL;
  6. my $m = pdl [[0,0,1,0],[0,0,1,0],[1,1,0,1],[0,0,1,0]];
  7. my $m2 = $m x $m;
  8. print $m2;
  9.  
  10. -----------------
  11. Output:
  12. $ perl p.pl
  13. [
  14. [1 1 0 1]
  15. [1 1 0 1]
  16. [0 0 3 0]
  17. [1 1 0 1]
  18. ]
  19.  
Add Comment
Please, Sign In to add comment