Keep It Simple, Stupid  
PerlMonks 
Re: RFC: 100 PDL Exercises (ported from numpy)by vr (Deacon) 
on May 03, 2018 at 17:12 UTC ( #1214017=note: print w/replies, xml )  Need Help?? 
I'll pick an easy one of "TODO" first and will add some more later, in no order  so there'll be a few edits, return for more :) 99. Given an integer n and a 2D array X, select from X the rows which can be interpreted as draws from a multinomial distribution with n degrees, i.e., the rows which only contain integers and which sum to n:
 Added:  print $PDL::Version::VERSION; Is it officially recommended way? What's the benefit over usual $PDL::VERSION;? I also wonder what's the $VERSION = eval $VERSION; in that tiny module.  4. How to find the memory size of any matrix?
 35. How to compute ((A+B)*(A/2)) in place? There's maybe a typo or two in Python solution (what's the "C"?). But to operate inplace, I'd do this:
IIRC, combined assignment operators are overloaded to work inplace, but I can't find a reference right now, will do it later.  53. How to convert a float (32 bits) array into an integer (32 bits) in place? Good question. The ceil and floor convert double to long inplace. Not sure if PDL allows to do so for 32bit types.  45. Create random vector of size 10 and replace the maximum value by 0: More efficient:
 64. Consider a given vector, how to add 1 to each element indexed by a second vector (be careful with repeated indices)?
 81. Consider an array Z = [1,2,3,4,5,6,7,8,9,10,11,12,13,14], how to generate an array R = [[1,2,3,4], [2,3,4,5], [3,4,5,6], ..., [11,12,13,14]]:
 87. Consider a 16x16 array, how to get the blocksum (block size is 4x4)? If I understand the task correctly,
(Sigh...) Utilizing benefits of idle commuting and thinking things over:
In Section
Meditations

