-
Notifications
You must be signed in to change notification settings - Fork 0
/
np3.py
54 lines (42 loc) · 760 Bytes
/
np3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import numpy as np
x1 = np.zeros(4)
# [0. 0. 0. 0.]
y1 = np.ones(4)
# [1. 1. 1. 1.]
x2 = np.zeros((2, 3, 4), dtype=np.int)
# [[[0 0 0 0]
# [0 0 0 0]
# [0 0 0 0]]
# [[0 0 0 0]
# [0 0 0 0]
# [0 0 0 0]]]
z1 = np.full((2,3), 10)
# [[10 10 10]
# [10 10 10]]
x3 = 10.0 + np.zeros((2,3))
# [[10. 10. 10.]
# [10. 10. 10.]]
y3 = 10.0 * np.ones((2,3))
# [[10. 10. 10.]
# [10. 10. 10.]]
x4 = np.empty((2,2))
# [[1. 1.]
# [1. 1.]]
x4.fill(3)
# [[3. 3.]
# [3. 3.]]
x5 = np.eye(4)#birim matris
# [[1. 0. 0. 0.]
# [0. 1. 0. 0.]
# [0. 0. 1. 0.]
# [0. 0. 0. 1.]]
x6 = np.identity(5)
# [[1. 0. 0. 0.]
# [0. 1. 0. 0.]
# [0. 0. 1. 0.]
# [0. 0. 0. 1.]]
x7 = np.diag([4, 7, 11, 3])
# [[ 4 0 0 0]
# [ 0 7 0 0]
# [ 0 0 11 0]
# [ 0 0 0 3]]