Hi, Puneet,

It is not possible to truncate the way you describe (modifying the  
size of the output array) and remain consistent. That is because range 
() is threadable over the index, and if one of many threaded ranges  
breaks the boundary, there is no guarantee that any of the others will  
also.  Further, shrinking the range as you describe in *only* the  
single-range case would violate the principle of least surprise.

(Mobile)


On Jun 26, 2010, at 8:16 PM, P Kishor <[email protected]> wrote:

> $in = pdl(
>    [
>        [ 0  1  2  3  4]
>        [ 5  6  7  8  9]
>        [10 11 12 13 14]
>    ]
> );
>
> boundary: f
> -----------
> $out = $pdl->range( [2, 0], [4, 2], 'f');
> index out-of-bounds in range at
> /usr/local/lib/perl5/site_perl/5.12.1/darwin-2level/PDL/Core.pm line
> 2779.
> punk...@dyn-72-33-101-43 ~/Data/carbonmodel/daymet$perl pdl.pl
>
> boundary: t
> -----------
> $out = $pdl->range( [2, 0], [4, 2], 't');
> [
> [2 3 4 0]
> [7 8 9 0]
> ]
>
> Based on the my understanding of the word 'truncate,' I was expecting
> [
> [2 3 4]
> [7 8 9]
> ]
>
> Is there any way to get something like above? That is, the range
> outside the boundary is just ignored, or, in other words, the range is
> "clipped" or truncated based on the boundary?
>
> boundary: e
> -----------
> $out = $pdl->range( [2, 0], [4, 2], 'e');
> [
> [2 3 4 4]
> [7 8 9 9]
> ]
>
> boundary: x
> -----------
> $out = $pdl->range( [2, 0], [4, 2], 'x');
> Error in rangeb: Unknown boundary condition 'x' in range at
> /usr/local/lib/perl5/site_perl/5.12.1/darwin-2level/PDL/Slices.pm line
> 332.
> punk...@dyn-72-33-101-43 ~/Data/carbonmodel/daymet$perl pdl.pl
>
> huh! I thought 'x' was a synonym for 'e'. What happened? Is there a
> mistake in the docs?
>
>
> boundary: p
> -----------
> $out = $pdl->range( [2, 0], [4, 2], 'p');
> [
> [2 3 4 0]
> [7 8 9 5]
> ]
>
> I don't understand what 'p' is doing. Could someone explain that
> please? Maybe the docs need to be expanded.
>
> boundary: m
> -----------
> $out = $pdl->range( [2, 0], [4, 2], 'm');
> [
> [2 3 4 4]
> [7 8 9 9]
> ]
>
> I don't understand what 'm' is doing. Could someone explain please?
>
> Many thanks.
>
>
>
>
> -- 
> Puneet Kishor
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to