in reply to PDL matrix ... increasing column length
use PDL; my $pdl1 = pdl( [ 2.7650514, 0, 0, 0, 0, 0 +, 0], [0, 1.2905497, 0, 0, 0, 0, + 0], [ 0, 0, 0.54930597, 0, 0, + 0, 0], [ 0, 0, 0, 0.23264228, 0, + 0, 0], [ 0, 0, 0, 0, 0.19463077, + 0, 0], [ 0, 0, 0, 0, 0, 0.1666 +9291, 0], [ 0, 0, 0, 0, 0, + 0, 0.095157451]); my $pdl2 = zeroes(27,7); $pdl1=transpose($pdl1); $pdl3 = $pdl1->append($pdl2); $pdl3=transpose($pdl3); print $pdl3;
Append appends along the first dimension, so you have to transpose first, then transpose back afterwards.
--------------------------------------------------------------
$perlquestion=~s/Can I/How do I/g;
|
|---|