第2章準備
2.3.13. Exercises2.3.13 練習問題
- Prove that the transpose of the transpose of a matrix is the matrix itself: .
英語のヒント
行列の転置の転置はその行列自身であること、を証明せよ。 - Given two matrices and , show that sum and transposition commute: .
英語のヒント
二つの行列とが与えられたとき、和と転置が交換できること、を示せ。 - Given any square matrix , is always symmetric? Can you prove the result by using only the results of the previous two exercises?
英語のヒント
任意の正方行列について、はいつも対称か。前の二つの練習問題の結果だけを使って、それを証明できるか。 - We defined the tensor
Xof shape (2, 3, 4) in this section. What is the output oflen(X)? Write your answer without implementing any code, then check your answer using code.英語のヒント
この節では、形状が(2, 3, 4)のテンソルXを定義した。len(X)の出力は何か。コードを実装せずに答えを書き、それからコードで答えを確かめよ。 - For a tensor
Xof arbitrary shape, doeslen(X)always correspond to the length of a certain axis ofX? What is that axis?英語のヒント
任意の形状のテンソルXについて、len(X)はいつもXのある軸の長さに対応するか。それはどの軸か。 - Run
A / A.sum(axis=1)and see what happens. Can you analyze the results?英語のヒント
A / A.sum(axis=1)を実行して、何が起きるかを見よ。結果を分析できるか。 - When traveling between two points in downtown Manhattan, what is the distance that you need to cover in terms of the coordinates, i.e., in terms of avenues and streets? Can you travel diagonally?
英語のヒント
マンハッタンの中心部で二点間を移動するとき、座標、つまり大通りと通りの観点で、どれだけの距離を進む必要があるか。斜めに移動できるか。 - Consider a tensor of shape (2, 3, 4). What are the shapes of the summation outputs along axes 0, 1, and 2?
英語のヒント
形状が(2, 3, 4)のテンソルを考える。軸0、1、2に沿って和をとった出力の形状はそれぞれ何か。 - Feed a tensor with three or more axes to the
linalg.normfunction and observe its output. What does this function compute for tensors of arbitrary shape?英語のヒント
軸が三つ以上あるテンソルをlinalg.norm関数に与え、その出力を観察せよ。この関数は任意の形状のテンソルについて何を計算するか。 - Consider three large matrices, say , and , initialized with Gaussian random variables. You want to compute the product . Is there any difference in memory footprint and speed, depending on whether you compute or . Why?
英語のヒント
たとえば、、という、ガウス確率変数で初期化した三つの大きな行列を考える。積を計算したい。とのどちらで計算するかによって、メモリの使用量と速度に違いはあるか。それはなぜか。 - Consider three large matrices, say , and . Is there any difference in speed depending on whether you compute or ? Why? What changes if you initialize without cloning memory? Why?
英語のヒント
たとえば、、という三つの大きな行列を考える。とのどちらを計算するかによって、速度に違いはあるか。それはなぜか。メモリを複製せずにと初期化すると、何が変わるか。それはなぜか。 - Consider three matrices, say . Construct a tensor with three axes by stacking . What is the dimensionality? Slice out the second coordinate of the third axis to recover . Check that your answer is correct.
英語のヒント
たとえばという三つの行列を考える。を積み重ねて、軸が三つのテンソルを作れ。その次元数はいくつか。3番目の軸の2番目の座標を切り出してを取り戻せ。答えが正しいことを確かめよ。