1 00:00:00,330 --> 00:00:05,850 All right, now we're going to debug the final exercise we need to take the transpose of a tutera. 2 00:00:06,060 --> 00:00:12,180 The transpose reverses the columns, and so as a result, we should see each row converted into a column. 3 00:00:12,870 --> 00:00:14,040 But if we run the code. 4 00:00:18,400 --> 00:00:24,260 It seems like it worked for the most part, but something is wrong and we're going to figure it out. 5 00:00:24,310 --> 00:00:26,320 So, as always, I want to add some breakpoints. 6 00:00:28,640 --> 00:00:32,930 And I'm going to place the output that we want to achieve on the top rates and let's figure out what's 7 00:00:32,930 --> 00:00:33,320 wrong. 8 00:00:38,280 --> 00:00:42,990 OK, so inside the first pass, we're setting the element at zero zero equal to the element at zero 9 00:00:42,990 --> 00:00:43,320 zero. 10 00:00:43,320 --> 00:00:44,550 So nothing should change. 11 00:00:50,390 --> 00:00:55,400 In the second run, we're setting the element at zero one equal to the element of one zero. 12 00:01:00,010 --> 00:01:00,530 OK. 13 00:01:00,550 --> 00:01:02,380 Wow, so far it's actually working. 14 00:01:06,520 --> 00:01:08,810 But wait, now the two is gone forever. 15 00:01:08,830 --> 00:01:09,790 That's not good. 16 00:01:10,360 --> 00:01:14,530 Eventually, we need to move the two from inducts zero one to one zero. 17 00:01:19,000 --> 00:01:24,550 It seems like whoever did this, their logic is correct, but instead of updating the original array, 18 00:01:24,880 --> 00:01:30,730 they should create a new era so that we always have a reference to values from the original one. 19 00:01:31,570 --> 00:01:37,300 OK, so what I'll do is I'll create a new era and transpose matrix. 20 00:01:41,210 --> 00:01:47,210 Is equal to a new integer, to the array with the same number of rows and the same number of elements. 21 00:01:58,800 --> 00:02:04,080 And now, instead of updating the original matrix with transposed values, we're going to update the 22 00:02:04,080 --> 00:02:05,430 transpose matrix. 23 00:02:08,479 --> 00:02:10,190 OK, relaunched the debugger. 24 00:02:24,720 --> 00:02:29,160 Inside the first past, the element at zero zero equals the element zero zero good. 25 00:02:34,960 --> 00:02:39,340 In the second run, the element at zero one equals the element at one zero. 26 00:02:46,000 --> 00:02:48,280 And it looks like everything is going to work. 27 00:02:54,680 --> 00:02:57,350 Zero two equals the element two zero. 28 00:03:06,520 --> 00:03:08,600 Seems like everything is going to work out. 29 00:03:14,050 --> 00:03:19,060 Every row from the original matrix is going to become a column in the transpose matrix.