36 template <
typename scalar_t>
52 o0 = m00 * v0 + m01 * v1 + m02 * v2;
53 o1 = m10 * v0 + m11 * v1 + m12 * v2;
54 o2 = m20 * v0 + m21 * v1 + m22 * v2;
57 template <
typename scalar_t>
59 const scalar_t* B_3x1,
61 C_3x1[0] = A_3x3[0] * B_3x1[0] + A_3x3[1] * B_3x1[1] + A_3x3[2] * B_3x1[2];
62 C_3x1[1] = A_3x3[3] * B_3x1[0] + A_3x3[4] * B_3x1[1] + A_3x3[5] * B_3x1[2];
63 C_3x1[2] = A_3x3[6] * B_3x1[0] + A_3x3[7] * B_3x1[1] + A_3x3[8] * B_3x1[2];
66 template <
typename scalar_t>
68 const scalar_t* B_3x3,
70 matmul3x3_3x1(A_3x3[0], A_3x3[1], A_3x3[2], A_3x3[3], A_3x3[4], A_3x3[5],
71 A_3x3[6], A_3x3[7], A_3x3[8], B_3x3[0], B_3x3[3], B_3x3[6],
72 C_3x3[0], C_3x3[3], C_3x3[6]);
73 matmul3x3_3x1(A_3x3[0], A_3x3[1], A_3x3[2], A_3x3[3], A_3x3[4], A_3x3[5],
74 A_3x3[6], A_3x3[7], A_3x3[8], B_3x3[1], B_3x3[4], B_3x3[7],
75 C_3x3[1], C_3x3[4], C_3x3[7]);
76 matmul3x3_3x1(A_3x3[0], A_3x3[1], A_3x3[2], A_3x3[3], A_3x3[4], A_3x3[5],
77 A_3x3[6], A_3x3[7], A_3x3[8], B_3x3[2], B_3x3[5], B_3x3[8],
78 C_3x3[2], C_3x3[5], C_3x3[8]);
81 template <
typename scalar_t>
83 const scalar_t* A_3x1_input,
84 const scalar_t* B_3x1_input,
85 scalar_t* C_3x1_output) {
87 A_3x1_input[1] * B_3x1_input[2] - A_3x1_input[2] * B_3x1_input[1];
89 A_3x1_input[2] * B_3x1_input[0] - A_3x1_input[0] * B_3x1_input[2];
91 A_3x1_input[0] * B_3x1_input[1] - A_3x1_input[1] * B_3x1_input[0];
94 template <
typename scalar_t>
96 dot_3x1(
const scalar_t* A_3x1_input,
const scalar_t* B_3x1_input) {
97 return A_3x1_input[0] * B_3x1_input[0] + A_3x1_input[1] * B_3x1_input[1] +
98 A_3x1_input[2] * B_3x1_input[2];
102 template <
typename scalar_t>
104 return A_2x2[0] * A_2x2[3] - A_2x2[1] * A_2x2[2];
107 template <
typename scalar_t>
109 return A_3x3[0] * (A_3x3[4] * A_3x3[8] - A_3x3[5] * A_3x3[7]) -
110 A_3x3[3] * (A_3x3[1] * A_3x3[8] - A_3x3[2] * A_3x3[7]) +
111 A_3x3[6] * (A_3x3[1] * A_3x3[5] - A_3x3[2] * A_3x3[4]);
114 template <
typename scalar_t>
116 scalar_t* output_2x2) {
117 scalar_t det =
det3x3(A_2x2);
121 scalar_t invdet = 1.0 / det;
122 output_2x2[0] = A_2x2[3] * det;
123 output_2x2[1] = -A_2x2[1] * det;
124 output_2x2[2] = -A_2x2[2] * det;
125 output_2x2[3] = A_2x2[0] * det;
131 template <
typename scalar_t>
133 scalar_t* output_3x3) {
134 scalar_t det =
det3x3(A_3x3);
138 scalar_t invdet = 1.0 / det;
139 output_3x3[0] = (A_3x3[4] * A_3x3[8] - A_3x3[7] * A_3x3[5]) * invdet;
140 output_3x3[1] = (A_3x3[2] * A_3x3[7] - A_3x3[1] * A_3x3[8]) * invdet;
141 output_3x3[2] = (A_3x3[1] * A_3x3[5] - A_3x3[2] * A_3x3[4]) * invdet;
142 output_3x3[3] = (A_3x3[5] * A_3x3[6] - A_3x3[3] * A_3x3[8]) * invdet;
143 output_3x3[4] = (A_3x3[0] * A_3x3[8] - A_3x3[2] * A_3x3[6]) * invdet;
144 output_3x3[5] = (A_3x3[3] * A_3x3[2] - A_3x3[0] * A_3x3[5]) * invdet;
145 output_3x3[6] = (A_3x3[3] * A_3x3[7] - A_3x3[6] * A_3x3[4]) * invdet;
146 output_3x3[7] = (A_3x3[6] * A_3x3[1] - A_3x3[0] * A_3x3[7]) * invdet;
147 output_3x3[8] = (A_3x3[0] * A_3x3[4] - A_3x3[3] * A_3x3[1]) * invdet;
153 template <
typename scalar_t>
155 scalar_t temp_01 = A_2x2[1];
160 template <
typename scalar_t>
162 scalar_t* output_2x2) {
163 output_2x2[0] = A_2x2[0];
164 output_2x2[1] = A_2x2[2];
165 output_2x2[2] = A_2x2[1];
166 output_2x2[3] = A_2x2[3];
169 template <
typename scalar_t>
171 scalar_t temp_01 = A_3x3[1];
172 scalar_t temp_02 = A_3x3[2];
173 scalar_t temp_12 = A_3x3[5];
182 template <
typename scalar_t>
184 scalar_t* output_3x3) {
185 output_3x3[0] = A_3x3[0];
186 output_3x3[1] = A_3x3[3];
187 output_3x3[2] = A_3x3[6];
189 output_3x3[3] = A_3x3[1];
190 output_3x3[4] = A_3x3[4];
191 output_3x3[5] = A_3x3[7];
193 output_3x3[6] = A_3x3[2];
194 output_3x3[7] = A_3x3[5];
195 output_3x3[8] = A_3x3[8];
198 template <
typename scalar_t>
200 scalar_t temp_01 = A_4x4[1];
201 scalar_t temp_02 = A_4x4[2];
202 scalar_t temp_03 = A_4x4[3];
203 scalar_t temp_12 = A_4x4[6];
204 scalar_t temp_13 = A_4x4[7];
205 scalar_t temp_23 = A_4x4[11];
208 A_4x4[3] = A_4x4[12];
210 A_4x4[7] = A_4x4[13];
211 A_4x4[11] = A_4x4[14];
220 template <
typename scalar_t>
222 scalar_t* output_4x4) {
223 output_4x4[0] = A_4x4[0];
224 output_4x4[1] = A_4x4[4];
225 output_4x4[2] = A_4x4[8];
226 output_4x4[3] = A_4x4[12];
228 output_4x4[4] = A_4x4[1];
229 output_4x4[5] = A_4x4[5];
230 output_4x4[6] = A_4x4[9];
231 output_4x4[7] = A_4x4[13];
233 output_4x4[8] = A_4x4[2];
234 output_4x4[9] = A_4x4[6];
235 output_4x4[10] = A_4x4[10];
236 output_4x4[11] = A_4x4[14];
238 output_4x4[12] = A_4x4[3];
239 output_4x4[13] = A_4x4[7];
240 output_4x4[14] = A_4x4[11];
241 output_4x4[15] = A_4x4[15];
OPEN3D_DEVICE OPEN3D_FORCE_INLINE scalar_t det3x3(const scalar_t *A_3x3)
Definition: Matrix.h:108
OPEN3D_DEVICE OPEN3D_FORCE_INLINE bool inverse2x2(const scalar_t *A_2x2, scalar_t *output_2x2)
Definition: Matrix.h:115
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void matmul3x3_3x3(const scalar_t *A_3x3, const scalar_t *B_3x3, scalar_t *C_3x3)
Definition: Matrix.h:67
#define OPEN3D_FORCE_INLINE
Definition: CUDAUtils.h:62
OPEN3D_DEVICE OPEN3D_FORCE_INLINE scalar_t det2x2(const scalar_t *A_2x2)
Definition: Matrix.h:103
OPEN3D_HOST_DEVICE OPEN3D_FORCE_INLINE void cross_3x1(const scalar_t *A_3x1_input, const scalar_t *B_3x1_input, scalar_t *C_3x1_output)
Definition: Matrix.h:82
OPEN3D_HOST_DEVICE OPEN3D_FORCE_INLINE scalar_t dot_3x1(const scalar_t *A_3x1_input, const scalar_t *B_3x1_input)
Definition: Matrix.h:96
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose2x2(const scalar_t *A_2x2, scalar_t *output_2x2)
Definition: Matrix.h:161
OPEN3D_DEVICE OPEN3D_FORCE_INLINE bool inverse3x3(const scalar_t *A_3x3, scalar_t *output_3x3)
Definition: Matrix.h:132
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose3x3_(scalar_t *A_3x3)
Definition: Matrix.h:170
#define OPEN3D_DEVICE
Definition: CUDAUtils.h:64
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose3x3(const scalar_t *A_3x3, scalar_t *output_3x3)
Definition: Matrix.h:183
#define OPEN3D_HOST_DEVICE
Definition: CUDAUtils.h:63
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose4x4(const scalar_t *A_4x4, scalar_t *output_4x4)
Definition: Matrix.h:221
Definition: PinholeCameraIntrinsic.cpp:35
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose4x4_(scalar_t *A_4x4)
Definition: Matrix.h:199
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose2x2_(scalar_t *A_2x2)
Definition: Matrix.h:154