回答編集履歴
5
d
test
CHANGED
File without changes
|
4
d
test
CHANGED
@@ -62,15 +62,13 @@
|
|
62
62
|
|
63
63
|
```python
|
64
64
|
|
65
|
-
m1 =
|
65
|
+
m1 = [1, 2]
|
66
66
|
|
67
|
-
m2 =
|
67
|
+
m2 = [2, 2]
|
68
68
|
|
69
|
+
T1 = [3, 1]
|
69
70
|
|
70
|
-
|
71
|
-
T1 = "c"
|
72
|
-
|
73
|
-
T2 =
|
71
|
+
T2 = [4, 1]
|
74
72
|
|
75
73
|
|
76
74
|
|
@@ -100,12 +98,12 @@
|
|
100
98
|
|
101
99
|
C[i][j].append([m[i][k], T[k][j]])
|
102
100
|
|
103
|
-
|
101
|
+
|
104
102
|
|
105
103
|
print(C)
|
106
104
|
|
107
|
-
# [[[[
|
105
|
+
# [ [ [[[1, 2], [3, 1]]], [[[1, 2], [4, 1]]] ],
|
108
106
|
|
109
|
-
[[[
|
107
|
+
# [ [[[2, 2], [3, 1]]], [[[2, 2], [4, 1]]] ] ]
|
110
108
|
|
111
109
|
```
|
3
d
test
CHANGED
@@ -47,3 +47,65 @@
|
|
47
47
|
print(C)
|
48
48
|
|
49
49
|
```
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
## 追記
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
こういうことでしょうか?
|
58
|
+
|
59
|
+
numpy は数値計算ライブラリなので、数値計算でないなら、numpy は使えないと思います。
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
```python
|
64
|
+
|
65
|
+
m1 = "a"
|
66
|
+
|
67
|
+
m2 = "b"
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
T1 = "c"
|
72
|
+
|
73
|
+
T2 = "d"
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
m = [[m1],
|
78
|
+
|
79
|
+
[m2]] # (2, 1)
|
80
|
+
|
81
|
+
T = [[T1, T2]] # (1, 2)
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
m_row, m_col = len(m), len(m[0])
|
86
|
+
|
87
|
+
T_row, T_col = len(T), len(T[0])
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
C = [[[] for j in range(T_col)] for i in range(m_row)]
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
for i in range(m_row):
|
96
|
+
|
97
|
+
for j in range(T_col):
|
98
|
+
|
99
|
+
for k in range(m_col):
|
100
|
+
|
101
|
+
C[i][j].append([m[i][k], T[k][j]])
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
print(C)
|
106
|
+
|
107
|
+
# [[[['a', 'c']], [['a', 'd']]],
|
108
|
+
|
109
|
+
[[['b', 'c']], [['b', 'd']]]]
|
110
|
+
|
111
|
+
```
|
2
d
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
![イメージ説明](
|
5
|
+
![イメージ説明](9386ce8aa4cb08457c749531d2873edb.png)
|
6
6
|
|
7
7
|
|
8
8
|
|
1
d
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
![イメージ説明](d
|
5
|
+
![イメージ説明](f235717cdc23cf87f570e18b7820d8e5.png)
|
6
6
|
|
7
7
|
|
8
8
|
|