diff options
| author | Luis Mochan <mochan@fis.unam.mx> | 2022-06-20 11:29:26 -0500 |
|---|---|---|
| committer | Luis Mochan <mochan@fis.unam.mx> | 2022-06-20 11:29:26 -0500 |
| commit | b576044b175af6c0f1d8c3daa42a7d96e75b3455 (patch) | |
| tree | bdd796a6837b89b1570727a71f4fbb7aee8cd99a | |
| parent | 81dbca5aee35c37745314b48f5993d314004782f (diff) | |
| download | perlweeklychallenge-club-b576044b175af6c0f1d8c3daa42a7d96e75b3455.tar.gz perlweeklychallenge-club-b576044b175af6c0f1d8c3daa42a7d96e75b3455.tar.bz2 perlweeklychallenge-club-b576044b175af6c0f1d8c3daa42a7d96e75b3455.zip | |
Add a comment
| -rwxr-xr-x | challenge-170/wlmb/perl/ch-2.pl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/challenge-170/wlmb/perl/ch-2.pl b/challenge-170/wlmb/perl/ch-2.pl index 2b2e12da3a..46722bdcde 100755 --- a/challenge-170/wlmb/perl/ch-2.pl +++ b/challenge-170/wlmb/perl/ch-2.pl @@ -13,8 +13,9 @@ die "Usage: ./ch-2.pl A B\nto obtain the Kronecker product of A and B" unless @A # for a 2x3 matrix my ($A, $B)=map {pdl $_} @ARGV; my $C=$A(*1,*1,:,:)*$B(:,:,*1,*1); #use dummy indices to build tensor - #product # C_{ijkl}=A_{ij}B_{kl} -# get size of each dimension + #product # C_{ijkl}=A_{ij}B_{kl} +# Notice: PDL uses column,row notation, not the algebraic row, column +# Get size of each dimension my ($I, $J, $K, $L)=($A->dim(1), $A->dim(0), $B->dim(1), $B->dim(0)); my $Kronecker=$C->mv(1,2) # change indices to ikjl ->reshape($J*$L, $I*$K); # clump indices i and k, and j and l |
