Many thanks! I did not even know this document existed. I generally stick to the official PDL documents at pdl.perl.org. That has been enough so far.
Maybe a NumPy to PDL glossary might be a useful addition to the tutorial materials. Any thoughts? On Sun, Jul 14, 2019 at 12:01 PM Chris Marshall <[email protected]> wrote: > > See the PDL Cookbook entry at > https://sourceforge.net/p/pdl/wiki/Resampling_up_a_piddle/ for other > approaches. > > --Chris > > On 7/13/2019 21:11, Robert Ryley wrote: > > Thanks! I will have to study this example a bit more closely. > > > > There have already been other Python to PDL tutorial attempts on Perl > > Monks. For example: https://www.perlmonks.org/?node_id=1213987 > > > > It might make it a bit easier for newcomers to get oriented. Would > > anyone object to including such a tutorial into the PDL documents > > and/or website, once it is compiled and edited? > > > > > > > > On Sat, Jul 13, 2019 at 8:45 PM Luis Mochan <[email protected]> wrote: > >> How about > >> > >> pdl> $a=pdl(1,2,3) > >> > >> pdl> p pdl($a(*3),$a(:,*3))->flat > >> [1 1 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3] > >> pdl> > >> > >> though you might prefer > >> > >> pdl> p append($a(*3)->flat,$a(:,*3)->flat) > >> [1 1 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3] > >> > >> to avoid problems when the shapes of the intermediate arrays are > >> incompatible. The *3 inserts a dummy dimension of size 3 in the first > >> place, producing three identical columns, while :,*3 produces a dummy > >> dimension of size 3 as the second index, so you produce tree identical > >> columns, > >> > >> pdl> p $a(*3) > >> > >> [ > >> [1 1 1] > >> [2 2 2] > >> [3 3 3] > >> ] > >> > >> pdl> p $a(:,*3) > >> > >> [ > >> [1 2 3] > >> [1 2 3] > >> [1 2 3] > >> ] > >> > >> ->flat makes them 1D and append puts one after the other. > >> > >> > >> Regards, > >> Luis > >> > >> > >> > >> > >> On Sat, Jul 13, 2019 at 02:54:34PM -0400, Robert Ryley wrote: > >>> I've been working on translating some NumPY examples into PDL. There > >>> has been some positive reinforcement on Perl Monks as can be seen > >>> here: > >>> > >>> https://www.perlmonks.org/?node_id=1233413 > >>> > >>> I am stuck on the following NumPy example: > >>> > >>> Q. Create the following pattern without hardcoding. Use only numpy > >>> functions and the below input array a. > >>> > >>> Input: > >>> a = np.array([1,2,3])` > >>> > >>> Desired Output: > >>> array([1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) > >>> > >>> Solution > >>> np.r_[np.repeat(a, 3), np.tile(a, 3)] > >>> #> array([1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]) > >>> > >>> Does PDL have something equivalent to NumPy's "tile" function? I've > >>> looked through the docs and do not see anything obvious to solve the > >>> problem. > >>> > >>> > >>> _______________________________________________ > >>> pdl-general mailing list > >>> [email protected] > >>> https://lists.sourceforge.net/lists/listinfo/pdl-general > >>> > >> -- > >> > >> o > >> W. Luis Mochán, | tel:(52)(777)329-1734 /<(*) > >> Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\ > >> Apdo. Postal 48-3, 62251 | (*)/\/ \ > >> Cuernavaca, Morelos, México | [email protected] /\_/\__/ > >> GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16 C2DF 5F0A C52B 791E B9EB > >> > >> > >> _______________________________________________ > >> pdl-general mailing list > >> [email protected] > >> https://lists.sourceforge.net/lists/listinfo/pdl-general > > > > _______________________________________________ > > pdl-general mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/pdl-general > > > > _______________________________________________ > pdl-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/pdl-general _______________________________________________ pdl-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pdl-general
