Indexing and dummy dimensions work for this as this
Perldl2 session shows:
PDL> $_REPL->do_print(1) # use MATLAB print results default
1
PDL> $a = sequence(10)
$PDL1 = [0 1 2 3 4 5 6 7 8 9];
PDL> $c = $a->dummy(1,4) # method call
$PDL1 =
[
[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 4 5 6 7 8 9]
]
;
PDL> $d = $a(,*4) # NiceSlice version
$PDL1 =
[
[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 4 5 6 7 8 9]
]
;
PDL> $e = $a(,*4)->sever # stop dataflow (many-to-one problems)
$PDL1 =
[
[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 4 5 6 7 8 9]
[0 1 2 3 4 5 6 7 8 9]
]
;
PDL> help 'vars'
PDL variables in package main::
Name Type Dimension Flow State Mem
----------------------------------------------------------------
$a Double D [10] P 0.08Kb
$b Double D [10,4] P 0.31Kb
$c Double D [10,4] VC 0.00Kb
$d Double D [10,4] VC 0.00Kb
$e Double D [10,4] P 0.31Kb
On 6/20/2010 12:31 PM, P Kishor wrote:
> for testing purpose, I want to quickly create a large piddle from
> piddles. So, given
>
> $a = sequence 10;
>
> I want to create
>
> $b = pdl $a, $a, $a ...
> $c = pdl $b, $b, $b ...
>
> That is
>
> $c = [
> [$a $a $a $a]
> [$a $a $a $a]
> [$a $a $a $a]
> ]
>
> I am looking for something like
>
> $b = pdl $a x n
>
> where 'x' behaves like 'x' in Perl, not like it does so currently in
> PDL. Is there something like this?
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl