Return inv_delta_C which is needed to calculate T
(self, F, C)
| 108 | return C # F x 2 |
| 109 | |
| 110 | def _build_inv_delta_C(self, F, C): |
| 111 | """ Return inv_delta_C which is needed to calculate T """ |
| 112 | hat_C = np.zeros((F, F), dtype=float) # F x F |
| 113 | for i in range(0, F): |
| 114 | for j in range(i, F): |
| 115 | r = np.linalg.norm(C[i] - C[j]) |
| 116 | hat_C[i, j] = r |
| 117 | hat_C[j, i] = r |
| 118 | np.fill_diagonal(hat_C, 1) |
| 119 | hat_C = (hat_C ** 2) * np.log(hat_C) |
| 120 | # print(C.shape, hat_C.shape) |
| 121 | delta_C = np.concatenate( # F+3 x F+3 |
| 122 | [ |
| 123 | np.concatenate([np.ones((F, 1)), C, hat_C], axis=1), # F x F+3 |
| 124 | np.concatenate([np.zeros((2, 3)), np.transpose(C)], axis=1), # 2 x F+3 |
| 125 | np.concatenate([np.zeros((1, 3)), np.ones((1, F))], axis=1) # 1 x F+3 |
| 126 | ], |
| 127 | axis=0 |
| 128 | ) |
| 129 | inv_delta_C = np.linalg.inv(delta_C) |
| 130 | return inv_delta_C # F+3 x F+3 |
| 131 | |
| 132 | def _build_P(self, I_r_width, I_r_height): |
| 133 | I_r_grid_x = (np.arange(-I_r_width, I_r_width, 2) + 1.0) / I_r_width # self.I_r_width |