I have a 2 dimensional pdl,for example:
my $data = random(4,4);
and I want to compute the sum of the 0,0 and the 1,0 element outside of the pdl context.
(Not like, for example $data->slice('0,0') + $data->slice('1,0), which still returns a pdl object)
What is the correct way of doing this?
If you're looking to extract individual elements as normal Perl scalars, use
atinstead ofslice:To convert the entire ndarray object into nested Perl arrays, use
unpdlNote that the indexing of elements in the Perl arrays is the transverse of that done in the ndarray objects. For example,