Question: Complete the function compress _ matrix that takes a 2 D array as a parameter and return a new compressed 2 D array. In the

Complete the function compress_matrix that takes a 2D array as a parameter and
return a new compressed 2D array. In the given array the number of row and column will
always be even. Compressing a matrix means grouping elements in 22 blocks and
sums the elements within each block. Check the sample input output for further
clarification.
Hint: Generally the block consists of the (i,j),(i+1,j),(i,j+1) and (i+1,j+1) elements
for 22 blocks.
You cannot use any built-in function except len() and range(). You can use the np
variable to create an array.
 Complete the function compress_matrix that takes a 2D array as a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!