Also, a good general rule is any multidim operation which is naturally ‘first index first’ in PDL is better expressed as ‘last index first’ in numpy. Then the threading <> broadcasting and reduction operations translates reasonably naturally. This may require you to transpose your data.
Karl > On 14 Jul 2019, at 4:54 am, Robert Ryley <thechart...@gmail.com> 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 > pdl-general@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pdl-general _______________________________________________ pdl-general mailing list pdl-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pdl-general