I lied ;), this one is the final one that seem to work :
for my $idx (0 .. $count-1) {
$coords = append($coords, pdl( zeros($list->nelem), $list,
zeros($list->nelem) + $idx ));
}
print $coords->transpose;
On Thu, Sep 19, 2013 at 10:44 PM, mraptor <[email protected]> wrote:
> thanks .. pdl(0,$c,0)->transpose worked...
> It is hard sometimes to imagine all those operations without visual cue :)
>
>
> On Thu, Sep 19, 2013 at 9:10 PM, Craig DeForest <[email protected]
> > wrote:
>
>> You can also use the constructor - it zero-pads by default: pdl($a,0,0)
>> will add a dimension of size 3 and fill the two extra $a-shaped hyperplanes
>> with zeroes.
>>
>> (Mobile)
>>
>>
>> On Sep 19, 2013, at 4:28 PM, Derek Lamb <[email protected]> wrote:
>>
>> > If you want them filled with zeroes then a dummy dim is not what you
>> want. You will need to merge together two piddles. Functions cat(),
>> append(), and glue() (the most general) do what you want:
>> >
>> > #this is a pain if you need to dynamically allocate the resultant
>> piddle size
>> > $c->cat(0*$c,0*$c)->transpose;
>> >
>> > #these two are equivalent
>> > $c->glue(1,zeroes($c->nelem,2))->transpose;
>> > $c->transpose->glue(0,zeroes(2,$c->nelem));
>> >
>> > #this is most like what you where thinking of:
>> > $c->transpose->append($c->dummy(0,2)->zeroes)
>> >
>> > [
>> > [1 0 0]
>> > [3 0 0]
>> > [4 0 0]
>> > [5 0 0]
>> > ]
>> >
>> >
>> > cheers,
>> > Derek
>> >
>> > On Sep 19, 2013, at 12:27 PM, mraptor wrote:
>> >
>> >> I have :
>> >> pdl> p $c
>> >> [1 3 4 5]
>> >>
>> >> then this what I want, except :
>>
>>
>> pdl> p $c->dummy(0,3)
>> >>
>> >> [
>> >> [1 1 1]
>> >> [3 3 3]
>> >> [4 4 4]
>> >> [5 5 5]
>> >> ]
>> >>
>> >> I want the new columns to be ZERO, how can I do that..
>> >> thanks
>> >> _______________________________________________
>> >> 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
>> >
>>
>
>
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl