in Programming in C
418 views
0 votes
0 votes

I am not getting the problem which is given below. Please help

Matrix transposition must be a familiar task. This problem is a generalization of it.  We can assume matrix transposition as a permutation of the two dimensions of the matrix. Suppose the matrix dimensions are 16 x 8, the permutation for transpose is "1 0" where "1" means the first dimension of output comes from the 2nd (starting from 0) dimension of input and "0" means the second dimension of output comes from the first dimension of input. The only other permutation possible here is "0 1" which gives output same as input. For a 3D array, we can have 3!= 6 possible permutations possible. Now we can generalize this problem. Given any higher dimensional array -- called a tensor -- and a given permutation, we should produce the output tensor. Input must be read from a file and should be of the following form:

5   15 14 13 12 11       4 3 2 1 0

where the first entry denotes the number of dimensions followed by as many dimension values (lowest most or fastest varying dimension first) followed by the required permutation - explanation given in the previous paragraph.

The program template and input files are attached. Answer verification is done by doing a reverse transposition and then comparing the original tensor with the final one. All these codes are included and you only need to write the transposition algorithm. (Hint: Code required is not more than 50 lines)

Please submit the final code only.

Hint: Given an array index values we can linearize them and get to the memory location. Now, for each tensor element, try to do the reverse and get the dimension values of the input tensor and then again linearize and get the location in the output tensor.

file1

transpose

in Programming in C
418 views

2 Comments

You are posting after the deadline :) Ido not think any one can get this problem that easily - it is about spending time to understand the problem - 90% time understanding the problem and 10% time coding. That is how people answered this. You can also go through the transpose code given to understand better and also think how matrix transposition works.
2
2
yes sir , you are right. To understand the problem is difficult task here. I will try to solve it.
0
0

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
4