DESCRIPTION Students: Please note instructions in paper copy of quiz. Save your files often, make sure OMSI fills your entire screen at all times, etc. A question may not fully fit into your OMSI question box, which is not scrollable. You can try adjusting the relative size of the question and answer boxes, but remember that clicking CopyQtoA will copy the entire question box to the answer box. In questions involving code which will partially be given to you in the question specs, you may need add new lines of code. For full credit, do not change any of the existing lines. QUESTION What Thrust function serves as an analog of R's a:b? QUESTION What is Thrust's analog of + in the table on p.88 of our book? QUESTION -ext .R -run "Rscript omsi_answer3.R" Consider a sequence of numbers g_1, g_2, g_3,... similar to the numbers f_i in Sec. 11.4.2, but such that the first three are all 1, and for k > 3, g_k = g_{k-1} + g_{k-2} + 2 g_{k-3}. State what the matrix analogous to A in Equation (11.31) will be. In the equation, the vector consisting of g_{k+2}, g_{k+1} and g_{k} will be on the left, with g_{k+1}, g_{k} and g_{k-1} on the right. WRITE YOUR ANSWER AS A SINGLE R EXPRESSION; IT WILL BE EXECUTED! QUESTION -ext .R -run "Rscript omsi_answer4.R" Here you will write parallel R code to do vector-valued cumulative sums. Complete the partial code below. # x is a matrix, and we wish to compute the cumulative sums on each row, # using R's cumsum() function as the core of computation; we will have # each worker work on its own chunk of rows of x library(parallel) matcumsum <- function(cls,x) { rowgrps <- clusterApply(cls,rowgrps, function(onegrp) myx <<- x[onegrp,,drop=FALSE]) # use apply() here: results <- clusterEvalQ(cls, ) } test <- function() { x <- rbind(3:5,c(6,2,9),c(5,12,13)) cls <- makeCluster(2) print(matcumsum(cls,x)) } test()