Consider a given vector, how to add 1 to each element indexed by a second vector (be careful with repeated indices)? (★★★)
How to accumulate elements of a vector (X) to an array (F) based on an index list (I)? (★★★)
Considering a (w,h,3) image of (dtype=ubyte), compute the number of unique colors (★★★)
Considering a four dimensions array, how to get sum over the last two axis at once? (★★★)
Considering a one-dimensional vector D, how to compute means of subsets of D using a vector S of same size describing subset indices? (★★★)
How to get the diagonal of a dot product? (★★★)
Consider the vector [1, 2, 3, 4, 5], how to build a new vector with 3 consecutive zeros interleaved between each value? (★★★)
Consider an array of dimension (5,5,3), how to mulitply it by an array with dimensions (5,5)? (★★★)
How to swap two rows of an array? (★★★)
Consider a set of 10 triplets describing 10 triangles (with shared vertices), find the set of unique line segments composing all the triangles (★★★)
Given an array C that is a bincount, how to produce an array A such that np.bincount(A) == C? (★★★)
How to compute averages using a sliding window over an array? (★★★)
Consider a one-dimensional array Z, build a two-dimensional array whose first row is (Z[0],Z[1],Z[2]) and each subsequent row is shifted by 1 (last row should be (Z[-3],Z[-2],Z[-1]) (★★★)
How to negate a boolean, or to change the sign of a float inplace? (★★★)
Consider 2 sets of points P0,P1 describing lines (2d) and a point p, how to compute distance from p to each line i (P0[i],P1[i])? (★★★)
Consider 2 sets of points P0,P1 describing lines (2d) and a set of points P, how to compute distance from each point j (P[j]) to each line i (P0[i],P1[i])? (★★★)
Consider an arbitrary array, write a function that extract a subpart with a fixed shape and centered on a given element (pad with a fill value when necessary) (★★★)
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]]? (★★★)
Compute a matrix rank (★★★)
How to find the most frequent value in an array?
Extract all the contiguous 3x3 blocks from a random 10x10 matrix (★★★)
Create a 2D array subclass such that Z[i,j] == Z[j,i] (★★★)
Consider a set of p matrices wich shape (n,n) and a set of p vectors with shape (n,1). How to compute the sum of of the p matrix products at once? (result has shape (n,1)) (★★★)
Consider a 16x16 array, how to get the block-sum (block size is 4x4)? (★★★)
How to implement the Game of Life using numpy arrays? (★★★)
How to get the n largest values of an array (★★★)
Given an arbitrary number of vectors, build the cartesian product (every combinations of every item) (★★★)
How to create a record array from a regular array? (★★★)
Consider a large vector Z, compute Z to the power of 3 using 3 different methods (★★★)
Consider two arrays A and B of shape (8,3) and (2,2). How to find rows of A that contain elements of each row of B regardless of the order of the elements in B? (★★★)
Considering a 10x3 matrix, extract rows with unequal values (e.g. [2,2,3]) (★★★)
Convert a vector of ints into a matrix binary representation (★★★)
Given a two dimensional array, how to extract unique rows? (★★★)
Considering 2 vectors A & B, write the einsum equivalent of inner, outer, sum, and mul function (★★★)
Considering a path described by two vectors (X,Y), how to sample it using equidistant samples (★★★)?
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. (★★★)
Compute bootstrapped 95% confidence intervals for the mean of a 1D array X (i.e., resample the elements of an array with replacement N times, compute the mean of each sample, and then compute percentiles over the means). (★★★)