1
00:00:01,560 --> 00:00:01,850
Hi.

2
00:00:01,890 --> 00:00:06,490
Even so in this lesson we are going to learn how we can initialize our metrics.

3
00:00:06,510 --> 00:00:10,800
Or you can say to damage and Larry.

4
00:00:11,000 --> 00:00:13,340
So how do we initialize our one theory.

5
00:00:13,370 --> 00:00:18,400
So we write like this and then let's say four elements and I will give four values.

6
00:00:18,410 --> 00:00:21,660
That's a one two three and four.

7
00:00:21,680 --> 00:00:24,140
So this is the way for initializing a the array.

8
00:00:24,170 --> 00:00:27,350
Now how we can initialize our to the area.

9
00:00:27,350 --> 00:00:29,300
So I will write like this.

10
00:00:29,540 --> 00:00:31,880
I want to create a truly array of integers.

11
00:00:31,880 --> 00:00:38,420
Many of the array number of rows and columns letter to roots and three columns and I will initialize

12
00:00:38,480 --> 00:00:39,140
it like this.

13
00:00:39,140 --> 00:00:42,480
So I will give one two entry.

14
00:00:42,550 --> 00:00:44,040
So this is the content.

15
00:00:44,050 --> 00:00:44,740
1 2 and 3.

16
00:00:44,740 --> 00:00:48,040
So this is the content for the first row.

17
00:00:48,040 --> 00:00:49,320
Now I have to give one rule.

18
00:00:49,330 --> 00:00:54,640
So since then I will write 4 5 and 6

19
00:00:57,380 --> 00:00:59,930
so that's how I will initialize my to the area.

20
00:01:00,770 --> 00:01:02,280
So this will look like this.

21
00:01:02,300 --> 00:01:04,700
I have two rows and three columns

22
00:01:08,690 --> 00:01:13,930
so in the first row I will fill this element 1 2 3 in the next row.

23
00:01:13,950 --> 00:01:21,050
I will fill these elements forward five and six so it is very simple to initialize I would do the 80

24
00:01:21,920 --> 00:01:27,230
now in to the array basically giving rows is optional.

25
00:01:27,230 --> 00:01:34,240
So giving rows is optional and giving columns is mandatory.

26
00:01:34,260 --> 00:01:40,590
So this is giving columns item mandatory and giving the value of rules out optional.

27
00:01:40,590 --> 00:01:46,220
And we will see why it is so but not in this way a deal probably in the next video.

28
00:01:46,230 --> 00:01:54,270
So basically I can write like this also I want to create a airy I do not want to give rules and again

29
00:01:54,270 --> 00:01:56,920
the columns I mean it is so we have to give columns.

30
00:01:57,150 --> 00:02:07,620
And if I will write like this 120 and let's say in the next row four five six four five six and now

31
00:02:07,830 --> 00:02:08,640
seven eight nine

32
00:02:11,430 --> 00:02:11,650
okay.

33
00:02:11,660 --> 00:02:13,880
So this is not this is only a comma

34
00:02:20,140 --> 00:02:21,180
and then this.

35
00:02:21,190 --> 00:02:23,280
So what will be my final edit.

36
00:02:23,860 --> 00:02:25,810
So how many rules will be there.

37
00:02:25,840 --> 00:02:30,300
So we can figure it out with the help of the number of elements that I'm trying to insert.

38
00:02:30,460 --> 00:02:36,460
So I will have to use and the number of columns are obviously given three so three rows and three columns

39
00:02:37,620 --> 00:02:39,080
what is the content of the first rule.

40
00:02:39,090 --> 00:02:40,880
It is 1 2 3.

41
00:02:41,000 --> 00:02:47,930
What is the content for the second group 4 5 6 and what is the content for the third 2 7 8 9 so that

42
00:02:47,960 --> 00:02:50,160
is the meaning of giving it all this is optional.

43
00:02:50,180 --> 00:02:56,990
Giving rules is optional but giving the number of columns in a duty Eddy is mandatory.

44
00:02:56,990 --> 00:03:03,920
Now let's say Now tell me what will happen if I try and do something like this into V I do not want

45
00:03:03,920 --> 00:03:09,580
to give the number of flues but I want to give the number of columns which are totally and what is my

46
00:03:09,580 --> 00:03:10,100
content.

47
00:03:10,120 --> 00:03:14,670
So let's say 1 2.

48
00:03:14,910 --> 00:03:26,600
Now let's say 2 4 5 and now let's say 7 and 8.

49
00:03:26,630 --> 00:03:28,860
So what will be my duty.

50
00:03:29,750 --> 00:03:32,060
So 1 2 and 3.

51
00:03:32,060 --> 00:03:36,800
So first of all I will have clear rules and the number of columns I've given three.

52
00:03:36,890 --> 00:03:42,430
So this is two cross three three cross three.

53
00:03:42,430 --> 00:03:44,320
What is the content for the festival.

54
00:03:44,380 --> 00:03:47,710
The content for the first ROIs 1 2 1 and 2.

55
00:03:47,830 --> 00:03:51,610
What is the content for the second 2 3 4 and 5.

56
00:03:51,640 --> 00:03:57,940
What is the content for the third row 7 and 8 and what will happen to the values which are not provided

57
00:03:57,940 --> 00:03:58,510
by the user.

58
00:03:58,540 --> 00:04:03,360
So I will put zero there so this is just like one diary.

59
00:04:03,380 --> 00:04:10,070
So in one diary if you will do something like this a 0 4 and you give only one value let's say 1 or

60
00:04:10,070 --> 00:04:13,000
do you give 2 values then what will happen.

61
00:04:13,010 --> 00:04:20,580
So basically you will get four boxes and inside the first row box then the values will be went in two

62
00:04:20,580 --> 00:04:22,810
and rest the values will become zero.

63
00:04:22,830 --> 00:04:24,570
So that is what happening here.

64
00:04:24,570 --> 00:04:27,220
All the values which apply which I will not provide.

65
00:04:27,230 --> 00:04:31,160
They will automatically become zero simple.

66
00:04:31,350 --> 00:04:32,950
So let's take one more example.

67
00:04:34,020 --> 00:04:41,420
So let's say if I would lose something like this I want to create a duty at let's say 5 loosely worded

68
00:04:41,500 --> 00:04:49,000
and 4 columns are going to be presented and I give value like this one and two and then I give three

69
00:04:49,000 --> 00:04:52,060
and four.

70
00:04:52,090 --> 00:04:54,590
So what will happen.

71
00:04:54,650 --> 00:05:02,500
So first of all I am going to have five rules and there will be four columns so first rule second rule

72
00:05:03,620 --> 00:05:12,460
third rule fourth and fifth rule and this is first column second the third and fourth column.

73
00:05:12,510 --> 00:05:14,070
So what is the content for the first rule.

74
00:05:14,070 --> 00:05:15,430
This is one in two.

75
00:05:15,480 --> 00:05:16,920
What is the content for the second rule.

76
00:05:16,920 --> 00:05:18,200
This is three and four.

77
00:05:18,540 --> 00:05:21,820
And what will happen to all the all these black boxes.

78
00:05:21,840 --> 00:05:23,350
So they will become zero.

79
00:05:23,550 --> 00:05:25,740
So zero will be placed every year

80
00:05:31,170 --> 00:05:37,090
so this is the desired so I hope you understood.

81
00:05:37,150 --> 00:05:42,890
Now I want to initialize my complete Matrix complete to the area with all the zeros.

82
00:05:43,060 --> 00:05:45,280
So for example what I want to say here is

83
00:05:49,520 --> 00:05:52,910
so how do you create an array with all the zeros.

84
00:05:53,000 --> 00:05:54,950
How to initialize an array with all the.

85
00:05:54,950 --> 00:05:59,530
Also you will have to write something like this in D3.

86
00:05:59,540 --> 00:06:05,200
Let's say you want to create of size 10 and if you write it like this then what will happen.

87
00:06:05,240 --> 00:06:08,480
So all the elements inside are ready.

88
00:06:08,510 --> 00:06:13,370
So first of all this element is zero so that's why the first element will become detail and the rest

89
00:06:13,370 --> 00:06:17,560
of the elements are going to become zero.

90
00:06:17,570 --> 00:06:21,150
Now I want to initialize my to the area with all the zeros.

91
00:06:21,230 --> 00:06:24,330
Again this index is way too simple.

92
00:06:24,830 --> 00:06:30,890
Let's say 10 goes and 10 columns and you will write it something like this zero.

93
00:06:30,920 --> 00:06:32,520
So what will happen again.

94
00:06:32,540 --> 00:06:36,670
You will get a 10 cost 10 judiciary.

95
00:06:36,970 --> 00:06:39,970
So this is 0 9 and again 0 9.

96
00:06:40,600 --> 00:06:46,030
And all the values inside this truly array will visit was so zero as will be the

97
00:06:51,380 --> 00:06:56,010
so net so we can initialize our duty metrics with all the zeros.

98
00:06:56,150 --> 00:06:57,100
Simple.

99
00:06:57,200 --> 00:07:05,030
So now let us try to print all this because I know we should not trust someone we should write the code

100
00:07:05,030 --> 00:07:13,460
and then we should see what our output will be so let's say okay.

101
00:07:13,470 --> 00:07:17,830
So first of all let us create a function.

102
00:07:17,950 --> 00:07:20,320
So how do we create a function.

103
00:07:20,320 --> 00:07:23,320
So let us create a function print Eddie

104
00:07:28,300 --> 00:07:33,800
so this print data function what it will take it will take.

105
00:07:33,920 --> 00:07:35,080
Obviously the eddy.

106
00:07:35,080 --> 00:07:42,640
So do damage and Eddie will take how many to lose out there and it will take how many columns How did

107
00:07:46,020 --> 00:07:48,490
than what they have to do so let's copy discord

108
00:07:51,480 --> 00:08:00,960
I'm going to print the content of the judiciary revise and now let us comment everything from here.

109
00:08:01,060 --> 00:08:07,030
So what I will do I will not take the input I will just vaguely call the function.

110
00:08:07,030 --> 00:08:07,450
So

111
00:08:10,750 --> 00:08:15,550
let us initialize our Eddie So let's say the.

112
00:08:16,090 --> 00:08:21,100
I do not want to give the number of rows because giving them little photos are optional.

113
00:08:21,100 --> 00:08:27,430
I just want to give the number of columns so noted the number of columns are two correct.

114
00:08:27,430 --> 00:08:29,030
So now let us initialize them in it.

115
00:08:29,050 --> 00:08:34,280
So the first let's say one comma two.

116
00:08:34,400 --> 00:08:50,800
Now let's say I want to give to go my for.

117
00:08:50,900 --> 00:08:51,740
So this is correct.

118
00:08:51,740 --> 00:09:00,200
Now what you have to do so we have to call this function Big Daddy so let's call the function Bring

119
00:09:00,270 --> 00:09:00,820
daddy.

120
00:09:00,930 --> 00:09:02,450
So I have to pass the edit.

121
00:09:02,460 --> 00:09:06,720
So let's pass Eddie so the value of passing the array is exactly the same.

122
00:09:06,720 --> 00:09:11,170
We are passing the Eddy just like we used to pass in one dimension that in just the name of the ad is

123
00:09:11,180 --> 00:09:13,780
in a then how many rows.

124
00:09:13,790 --> 00:09:16,630
So there are two rows and there are two columns.

125
00:09:16,640 --> 00:09:20,910
So the value of eminent in order to commit to correct.

126
00:09:21,050 --> 00:09:23,450
Now one thing so this code is not correct.

127
00:09:23,450 --> 00:09:30,050
Why it is not correct because I told you giving rules are optional but giving columns are mandatory.

128
00:09:30,290 --> 00:09:36,040
So giving column some and it is all this is the same if you want to pass are to really giving columns

129
00:09:36,040 --> 00:09:38,320
are mandatory.

130
00:09:38,350 --> 00:09:44,890
So what I want to say here is just like I told you that when you are creating your to really giving

131
00:09:44,890 --> 00:09:48,610
the values of rules are optional but giving the values of columns are mandatory.

132
00:09:48,610 --> 00:09:51,850
Similarly when you want to pass an edit to a function.

133
00:09:51,850 --> 00:09:55,420
So we want the possibility to a function.

134
00:09:55,420 --> 00:10:05,020
So giving the rules so giving the rules are again optional but giving the number of columns are mandatory

135
00:10:05,870 --> 00:10:07,780
vite is mandatory.

136
00:10:07,780 --> 00:10:09,280
We will see it in the next review.

137
00:10:09,880 --> 00:10:11,320
So this is too.

138
00:10:11,350 --> 00:10:13,940
So that's why you have to write to here.

139
00:10:13,990 --> 00:10:16,150
OK so let's test our program

140
00:10:24,230 --> 00:10:28,050
so this is my output went to tea and food.

141
00:10:28,060 --> 00:10:36,580
Now let's do some experiments now let's say instead of two if the number of columns out of five.

142
00:10:36,700 --> 00:10:37,920
So what should be an output.

143
00:10:38,290 --> 00:10:43,030
So again if you are making it five then you have to write five here also because the number of columns

144
00:10:43,090 --> 00:10:44,010
should be seen.

145
00:10:44,020 --> 00:10:50,300
So this value and this value they should be same This is the requirement.

146
00:10:50,770 --> 00:10:52,510
And why this is the requirement.

147
00:10:52,510 --> 00:10:54,570
We will see it in the next video.

148
00:10:54,640 --> 00:10:55,990
So let's run our program

149
00:11:03,920 --> 00:11:04,210
OK.

150
00:11:04,220 --> 00:11:14,940
So one thing that I did wrong here is so the number of columns I actually 5 know Let's run again.

151
00:11:14,950 --> 00:11:24,830
So now you can see so there are zeros peasant every year so this will be so 1 and 2 then then the content

152
00:11:24,830 --> 00:11:29,910
of the second draw to you in full and then the all the three rest columns will become zero.

153
00:11:29,910 --> 00:11:31,390
So this is the output.

154
00:11:31,530 --> 00:11:32,230
Correct.

155
00:11:32,250 --> 00:11:37,780
And again I'm repeating myself giving the value of columns are mandatory Vitus mandatory we will see

156
00:11:37,780 --> 00:11:38,640
it in the next redo.

157
00:11:38,640 --> 00:11:40,170
So you have to 5.

158
00:11:40,170 --> 00:11:43,250
So this value and this value they should match.

159
00:11:43,260 --> 00:11:45,270
Otherwise you get output will be wrong

160
00:11:48,700 --> 00:11:52,030
now let's say.

161
00:11:52,120 --> 00:11:55,170
Now let's say the number of rules are also five.

162
00:11:55,180 --> 00:11:59,940
So if the number of rows at five let's change let's make five here.

163
00:12:00,400 --> 00:12:02,350
So now let's try to test our program

164
00:12:09,080 --> 00:12:19,200
so see there are you peasant every year so let me explain this output to you so again there are five

165
00:12:19,200 --> 00:12:27,610
rules in five columns so you will get a five Gross five metrics the content of the first rule is 1 and

166
00:12:27,610 --> 00:12:35,190
2 the of the second choice 2 and 4 rest they will be zeros every year so zeros zeros and zeros.

167
00:12:35,190 --> 00:12:43,560
So that's why you can see how many zeros are there and can we initialize our duty metrics with zeros.

168
00:12:43,560 --> 00:12:46,140
Yes we definitely we can.

169
00:12:46,140 --> 00:12:48,780
So how do we initialize our duty metrics with zeros.

170
00:12:48,810 --> 00:12:55,100
So let us create an identity let's say it b number of rows again optional.

171
00:12:55,100 --> 00:13:01,600
Let's say there are five rows and five columns and I want to initialize my David all Aussie rules so

172
00:13:01,600 --> 00:13:02,620
I will write to zero here.

173
00:13:02,630 --> 00:13:07,170
Simple and I will call.

174
00:13:07,170 --> 00:13:08,920
I will pass B at a

175
00:13:13,050 --> 00:13:21,940
so you can see Zoe's present every viewer so in this we do we learned two important things first thing

176
00:13:21,940 --> 00:13:27,070
is basically how to initialize our duty metrics how do initialize our to the data.

177
00:13:27,070 --> 00:13:32,140
We learned how we can initialize over to the idea and the second thing is basically venue initializing

178
00:13:32,140 --> 00:13:37,030
the to the edit giving the value of rules are optional but giving the values of columns are mandatory.

179
00:13:37,030 --> 00:13:44,990
Similarly when you are passing so when you are passing your 2D Eddie to a function then the number of

180
00:13:44,990 --> 00:13:45,440
rows.

181
00:13:46,460 --> 00:13:52,280
So the value of you can give rows but giving the value of column side mandatory.

182
00:13:53,360 --> 00:13:58,970
So when you are passing function and you are passing to the idea to a function so giving the value of

183
00:13:58,970 --> 00:14:01,010
columns are mandatory.

184
00:14:01,040 --> 00:14:08,770
So this is mandatory and their value should be same and giving that value for was not optional.

185
00:14:08,770 --> 00:14:12,690
So this is optional.

186
00:14:12,740 --> 00:14:18,620
Now the next we do we will discuss why giving the value of columns are mandatory.

187
00:14:18,620 --> 00:14:20,810
So I will see you in the next one but by.
