17 template <
typename scalar_t>
33 o0 = m00 * v0 + m01 * v1 + m02 * v2;
34 o1 = m10 * v0 + m11 * v1 + m12 * v2;
35 o2 = m20 * v0 + m21 * v1 + m22 * v2;
38 template <
typename scalar_t>
40 const scalar_t* B_3x1,
42 C_3x1[0] = A_3x3[0] * B_3x1[0] + A_3x3[1] * B_3x1[1] + A_3x3[2] * B_3x1[2];
43 C_3x1[1] = A_3x3[3] * B_3x1[0] + A_3x3[4] * B_3x1[1] + A_3x3[5] * B_3x1[2];
44 C_3x1[2] = A_3x3[6] * B_3x1[0] + A_3x3[7] * B_3x1[1] + A_3x3[8] * B_3x1[2];
47 template <
typename scalar_t>
49 const scalar_t* B_3x3,
51 matmul3x3_3x1(A_3x3[0], A_3x3[1], A_3x3[2], A_3x3[3], A_3x3[4], A_3x3[5],
52 A_3x3[6], A_3x3[7], A_3x3[8], B_3x3[0], B_3x3[3], B_3x3[6],
53 C_3x3[0], C_3x3[3], C_3x3[6]);
54 matmul3x3_3x1(A_3x3[0], A_3x3[1], A_3x3[2], A_3x3[3], A_3x3[4], A_3x3[5],
55 A_3x3[6], A_3x3[7], A_3x3[8], B_3x3[1], B_3x3[4], B_3x3[7],
56 C_3x3[1], C_3x3[4], C_3x3[7]);
57 matmul3x3_3x1(A_3x3[0], A_3x3[1], A_3x3[2], A_3x3[3], A_3x3[4], A_3x3[5],
58 A_3x3[6], A_3x3[7], A_3x3[8], B_3x3[2], B_3x3[5], B_3x3[8],
59 C_3x3[2], C_3x3[5], C_3x3[8]);
62 template <
typename scalar_t>
64 const scalar_t* A_3x1_input,
65 const scalar_t* B_3x1_input,
66 scalar_t* C_3x1_output) {
68 A_3x1_input[1] * B_3x1_input[2] - A_3x1_input[2] * B_3x1_input[1];
70 A_3x1_input[2] * B_3x1_input[0] - A_3x1_input[0] * B_3x1_input[2];
72 A_3x1_input[0] * B_3x1_input[1] - A_3x1_input[1] * B_3x1_input[0];
75 template <
typename scalar_t>
77 dot_3x1(
const scalar_t* A_3x1_input,
const scalar_t* B_3x1_input) {
78 return A_3x1_input[0] * B_3x1_input[0] + A_3x1_input[1] * B_3x1_input[1] +
79 A_3x1_input[2] * B_3x1_input[2];
83 template <
typename scalar_t>
85 return A_2x2[0] * A_2x2[3] - A_2x2[1] * A_2x2[2];
88 template <
typename scalar_t>
90 return A_3x3[0] * (A_3x3[4] * A_3x3[8] - A_3x3[5] * A_3x3[7]) -
91 A_3x3[3] * (A_3x3[1] * A_3x3[8] - A_3x3[2] * A_3x3[7]) +
92 A_3x3[6] * (A_3x3[1] * A_3x3[5] - A_3x3[2] * A_3x3[4]);
95 template <
typename scalar_t>
97 scalar_t* output_2x2) {
98 scalar_t det =
det3x3(A_2x2);
102 scalar_t invdet = 1.0 / det;
103 output_2x2[0] = A_2x2[3] * det;
104 output_2x2[1] = -A_2x2[1] * det;
105 output_2x2[2] = -A_2x2[2] * det;
106 output_2x2[3] = A_2x2[0] * det;
112 template <
typename scalar_t>
114 scalar_t* output_3x3) {
115 scalar_t det =
det3x3(A_3x3);
119 scalar_t invdet = 1.0 / det;
120 output_3x3[0] = (A_3x3[4] * A_3x3[8] - A_3x3[7] * A_3x3[5]) * invdet;
121 output_3x3[1] = (A_3x3[2] * A_3x3[7] - A_3x3[1] * A_3x3[8]) * invdet;
122 output_3x3[2] = (A_3x3[1] * A_3x3[5] - A_3x3[2] * A_3x3[4]) * invdet;
123 output_3x3[3] = (A_3x3[5] * A_3x3[6] - A_3x3[3] * A_3x3[8]) * invdet;
124 output_3x3[4] = (A_3x3[0] * A_3x3[8] - A_3x3[2] * A_3x3[6]) * invdet;
125 output_3x3[5] = (A_3x3[3] * A_3x3[2] - A_3x3[0] * A_3x3[5]) * invdet;
126 output_3x3[6] = (A_3x3[3] * A_3x3[7] - A_3x3[6] * A_3x3[4]) * invdet;
127 output_3x3[7] = (A_3x3[6] * A_3x3[1] - A_3x3[0] * A_3x3[7]) * invdet;
128 output_3x3[8] = (A_3x3[0] * A_3x3[4] - A_3x3[3] * A_3x3[1]) * invdet;
134 template <
typename scalar_t>
136 scalar_t temp_01 = A_2x2[1];
141 template <
typename scalar_t>
143 scalar_t* output_2x2) {
144 output_2x2[0] = A_2x2[0];
145 output_2x2[1] = A_2x2[2];
146 output_2x2[2] = A_2x2[1];
147 output_2x2[3] = A_2x2[3];
150 template <
typename scalar_t>
152 scalar_t temp_01 = A_3x3[1];
153 scalar_t temp_02 = A_3x3[2];
154 scalar_t temp_12 = A_3x3[5];
163 template <
typename scalar_t>
165 scalar_t* output_3x3) {
166 output_3x3[0] = A_3x3[0];
167 output_3x3[1] = A_3x3[3];
168 output_3x3[2] = A_3x3[6];
170 output_3x3[3] = A_3x3[1];
171 output_3x3[4] = A_3x3[4];
172 output_3x3[5] = A_3x3[7];
174 output_3x3[6] = A_3x3[2];
175 output_3x3[7] = A_3x3[5];
176 output_3x3[8] = A_3x3[8];
179 template <
typename scalar_t>
181 scalar_t temp_01 = A_4x4[1];
182 scalar_t temp_02 = A_4x4[2];
183 scalar_t temp_03 = A_4x4[3];
184 scalar_t temp_12 = A_4x4[6];
185 scalar_t temp_13 = A_4x4[7];
186 scalar_t temp_23 = A_4x4[11];
189 A_4x4[3] = A_4x4[12];
191 A_4x4[7] = A_4x4[13];
192 A_4x4[11] = A_4x4[14];
201 template <
typename scalar_t>
203 scalar_t* output_4x4) {
204 output_4x4[0] = A_4x4[0];
205 output_4x4[1] = A_4x4[4];
206 output_4x4[2] = A_4x4[8];
207 output_4x4[3] = A_4x4[12];
209 output_4x4[4] = A_4x4[1];
210 output_4x4[5] = A_4x4[5];
211 output_4x4[6] = A_4x4[9];
212 output_4x4[7] = A_4x4[13];
214 output_4x4[8] = A_4x4[2];
215 output_4x4[9] = A_4x4[6];
216 output_4x4[10] = A_4x4[10];
217 output_4x4[11] = A_4x4[14];
219 output_4x4[12] = A_4x4[3];
220 output_4x4[13] = A_4x4[7];
221 output_4x4[14] = A_4x4[11];
222 output_4x4[15] = A_4x4[15];
#define OPEN3D_HOST_DEVICE
Definition: CUDAUtils.h:44
#define OPEN3D_DEVICE
Definition: CUDAUtils.h:45
#define OPEN3D_FORCE_INLINE
Definition: CUDAUtils.h:43
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose3x3_(scalar_t *A_3x3)
Definition: Matrix.h:151
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose2x2_(scalar_t *A_2x2)
Definition: Matrix.h:135
OPEN3D_DEVICE OPEN3D_FORCE_INLINE scalar_t det2x2(const scalar_t *A_2x2)
Definition: Matrix.h:84
OPEN3D_DEVICE OPEN3D_FORCE_INLINE bool inverse2x2(const scalar_t *A_2x2, scalar_t *output_2x2)
Definition: Matrix.h:96
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:63
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:48
OPEN3D_DEVICE OPEN3D_FORCE_INLINE bool inverse3x3(const scalar_t *A_3x3, scalar_t *output_3x3)
Definition: Matrix.h:113
OPEN3D_DEVICE OPEN3D_FORCE_INLINE scalar_t det3x3(const scalar_t *A_3x3)
Definition: Matrix.h:89
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose3x3(const scalar_t *A_3x3, scalar_t *output_3x3)
Definition: Matrix.h:164
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose4x4_(scalar_t *A_4x4)
Definition: Matrix.h:180
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose2x2(const scalar_t *A_2x2, scalar_t *output_2x2)
Definition: Matrix.h:142
OPEN3D_DEVICE OPEN3D_FORCE_INLINE void transpose4x4(const scalar_t *A_4x4, scalar_t *output_4x4)
Definition: Matrix.h:202
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:77
Definition: PinholeCameraIntrinsic.cpp:16